@sprig-technologies/sprig-browser 2.39.2 → 2.39.4

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 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-Bijnkt4E.cjs"),p=require("./getAttributedUrl-CMvZtsWh.cjs"),j=require("./core-Cw9EUdoP.cjs"),me=require("./metricsReporter-Bggbn2wu.cjs"),Re=({properties:t,surveyVideoUrl:i,questionId:r})=>{const n=`ul-card-video__question_player-q${r}`,{apiURL:s,viewDocument:o}=e.useConfig(l=>({apiURL:l.apiURL,viewDocument:l.viewDocument}));return e.u("div",{id:n,ref:l=>{if(l&&l.children.length===0&&!t.properties.hideRecordedPrompt){const d=p.videoPlayer(n,{src:i,type:"application/x-mpegURL"},void 0,t.properties.mediaType===p.RECORDER.MEDIA_TYPE_AUDIO,s,o);l.appendChild(d)}}})},W=({isDisabled:t,onClick:i,children:r})=>e.u(p.Button,{className:"ul-card__button-checkmark",disabled:t,onClick:i,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"})}),r||"Ok"]}),Ne=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{useMobileStyling:o,border:l}=e.useConfig(C=>({useMobileStyling:C.useMobileStyling,border:C.border})),[d,u]=e.h(!1),[c,b]=e.h(""),[a,g]=e.h(!1),x=r==null?void 0:r.collectName,f=(r==null?void 0:r.nameLabelText)||"Full Name",m=(r==null?void 0:r.consentText)||"I agree to the stated conditions",R=(r==null?void 0:r.submitButtonText)||"Submit",D=!!c.trim(),h=d&&(!x||D),_=(C,N=!1)=>{C.preventDefault(),C.stopPropagation();let y=null;if(!N){if(!h)return void g(!0);y={submitted:!0},x&&(y.name=c)}i({value:y,questionId:n,type:s},!!N||h)},T=C=>{C.preventDefault(),C.stopPropagation(),b(C.currentTarget.value)},k=C=>{C.currentTarget.style.borderColor=a&&!D?j.ERROR_BORDER_COLOR:l},E=C=>{C.currentTarget.style.borderColor=a&&!D?j.ERROR_BORDER_COLOR:j.DEFAULT_BORDER_COLOR},q=()=>e.u(p.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(p.Option,{allowTextEntry:!1,border:l,error:a&&!d,id:"consent",isRadio:!1,isSelected:d,label:m,onUserInputChanged:({selected:C})=>{C!==d&&u(!d)},useMobileStyling:o}),x&&e.u("input",{"aria-label":f,"aria-placeholder":f,className:e.cc(e.getClasses("ul-consent-legal__name-input",o)),"data-gramm":"false",maxLength:250,name:"name",onBlur:E,onFocus:k,onInput:T,placeholder:f,style:a&&!D?{borderColor:j.ERROR_BORDER_COLOR}:{},tabIndex:0,value:c})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(W,{isDisabled:!h,onClick:C=>_(new SubmitEvent(C.type)),children:e.getButtonText({buttonText:R})}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:C=>_(new SubmitEvent(C.type),!0),children:e.getSkipButtonText(r)})]})]});return e.u("div",{className:e.cc(t,"ul-card__consent-legal","fade-in-transition"),children:e.u(p.MobileEmbedView,{properties:r,defaultBody:q,embeddedType:"pdf"})},n)},Ie=()=>{const{destroy:t,forceBrandedLogo:i}=e.useConfig(r=>({destroy:r.destroy,forceBrandedLogo:r.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{t(j.APP_ID)},i?4e3:2e3)},[t,i]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},De=({icon:t,scaleLabelType:i,value:r,selectedValue:n})=>{if(i==="smiley"&&r===n){let s=0;return t.replace(/black/g,()=>++s==1?"black":"white")}return t},we=({activeValue:t,border:i,icon:r,isPressed:n,range:s,scaleLabelType:o,selectedValue:l,setSelectedValue:d,setActiveValue:u,setIsPressed:c,useMobileStyling:b,value:a,viewDocument:g})=>{const x=`option-${a}`,f=o==="number",m=o==="star",R=o==="smiley",D=f&&a===t||a===l,[h,_]=(()=>{const k=m&&l!==null&&a<=l;return m&&a<=t||R&&a===t||k||a===t||a===l?[i,n||k||a===l?1:.3]:["",1]})(),T=e.F(()=>{const k={borderColor:D?h:"",fillOpacity:D?"":_,zIndex:D?3:"auto",color:l===a?"#fff":""};return f?{...k,backgroundColor:l===a?h:""}:{...k,color:m||R||l===a?h:""}},[D,h,_,l,a,f,m,R]);return e.u("button",{"aria-label":f?void 0:String(a),className:(()=>{switch(o){case"star":return e.cc(e.getClasses("likert-star",b),e.getClasses(`likert-star-${a}`,b));case"smiley":return e.cc(e.getClasses("likert-smiley",b),e.getClasses(`likert-smiley-${a}`,b));default:return a===s?e.cc(e.getClasses("likert-number",b),e.getClasses(`likert-number-${a}`,b),e.getClasses("likert-last-option",b)):e.cc(e.getClasses("likert-number",b),e.getClasses(`likert-number-${a}`,b))}})(),dangerouslySetInnerHTML:{__html:De({icon:r,scaleLabelType:o,value:a,selectedValue:l})},id:x,onClick:k=>{k.preventDefault(),k.stopPropagation(),d(a)},onKeyDown:k=>{var C,N;const E=g.querySelectorAll(`.likert-${o??"number"}`),q=a-1;k.key==="ArrowRight"?(C=E[q+1])==null||C.focus():k.key==="ArrowLeft"?(N=E[q-1])==null||N.focus():k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),k.stopPropagation(),d(a))},onPointerDown:()=>c(!0),onPointerEnter:()=>u(a),onPointerLeave:()=>{u(-1),c(!1)},style:T,tabIndex:0})},Ee=({className:t,labels:i,next:r,properties:n,questionId:s,type:o})=>{const{border:l,useMobileStyling:d,viewDocument:u}=e.useConfig(C=>({border:C.border,useMobileStyling:C.useMobileStyling,viewDocument:C.viewDocument})),[c,b]=e.h(-1),[a,g]=e.h(!1),[x,f]=e.h(null),m=i&&i.left,R=i&&i.right;let D;const{range:h,scaleLabelType:_,ratingIcons:T}=n;h&&(D=Number(h));const k=D||5,E=C=>{var N,y;switch(_){case"star":return(N=T[0])==null?void 0:N.svg;case"smiley":return(y=T[C])==null?void 0:y.svg;default:return String(C+1)}},q=[...Array(k)].map((C,N)=>{const y=N+1;return e.u(we,{activeValue:c,border:l,icon:E(N),isPressed:a,range:k,scaleLabelType:_,selectedValue:x,setActiveValue:b,setIsPressed:g,setSelectedValue:f,useMobileStyling:d,value:y,viewDocument:u},N)});return e.u("form",{className:e.cc(t,"ul-card--likert","fade-in-transition"),children:e.u(p.MobileEmbedView,{properties:n,defaultBody:()=>e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${k})`,className:"ul-card--likert__numbers",role:"radiogroup",children:q}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:m}),e.u("span",{children:R})]})]}),e.u(p.QuestionBodyFooterContainer,{children:e.u(W,{isDisabled:x===null&&n.required,onClick:()=>r({value:x,questionId:s,type:o},!0),children:e.getButtonText(n)})})]})})},s)},Be=({columns:t,onSelect:i,options:r,selectedOptions:n})=>{const s=e._([]),{border:o,useMobileStyling:l}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),d=r.findIndex(g=>n[g.id]===null),[u,c]=e.h(d),b=e.T((g,x)=>{i(g,x);const f=u+1,m=r[f];m&&n[m.id]===null&&c(f)},[i,r,n,u]),a=e.T((g,x)=>{const f=u===g;return e.u(e.Accordion,{animate:!0,header:x.label,isOpen:f,onClick:()=>c(f&&!window.UserLeap.isMobileSDK?-1:g),ref:m=>{m&&(s.current[g]=m)},showHeaderCheck:n[x.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:t.map(m=>e.u(p.Option,{allowTextEntry:!1,ariaLabel:`${x.label}-${m.label}`,border:o,error:!1,id:`${x.id}-${m.value}`,isRadio:!0,isSelected:n[x.id]===m.value,label:m.label,onUserInputChanged:()=>b(x.id,m.value),useMobileStyling:l},m.label))})},x.id)},[o,t,u,b,n,l]);return e.u("div",{children:r.map((g,x)=>a(x,g))})},Pe=({className:t,next:i,options:r,properties:n,questionId:s,type:o,onSubmitButtonClick:l})=>{const d=n.matrixColumn,u=n.required,c=f=>{f.preventDefault(),f.stopPropagation(),i({value:a,questionId:s,type:o},!0),l&&l()},b=r.reduce((f,m)=>(f[m.id]=null,f),{}),[a,g]=e.h(b),x=(f,m)=>{g(R=>({...R,[f]:m}))};return e.u("form",{className:e.cc(t,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:c,children:e.u(p.MobileEmbedView,{properties:n,defaultBody:()=>{return e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:e.u(Be,{columns:d,onSelect:x,options:r,selectedOptions:a})}),e.u(p.QuestionBodyFooterContainer,{children:e.u(W,{isDisabled:(f=a,u&&Object.values(f).every(m=>m==null)),onClick:()=>c(new SubmitEvent("submit")),children:e.getButtonText(n)})})]});var f}})},s)},ge=({className:t,onSubmit:i,options:r=[],properties:n,questionId:s,type:o,showIndividualSubmit:l=!1,onSubmitButtonClick:d})=>{const{border:u,useMobileStyling:c}=e.useConfig(v=>({border:v.border,useMobileStyling:v.useMobileStyling})),b=r.reduce((v,B)=>(v[B.id]={isSelected:!1},v),{}),[a,g]=e.h(b),x=o==="multiplechoice",f=n.required,m=r.find(v=>{var B;return(B=v.optionProperties)==null?void 0:B.noneOfTheAbove}),R=v=>Object.entries(v).some(([B,U])=>{var Q;const $=r.find(V=>`${V.id}`===B),A=U.userText===void 0||U.userText.trim()==="";return((Q=$==null?void 0:$.optionProperties)==null?void 0:Q.allowsTextEntry)&&A&&U.isSelected}),D=v=>Object.values(v).filter(B=>B.isSelected).length,h=n.minSelect&&n.minSelect>0&&n.maxSelectMode===p.MaxSelectModes.Range&&D(a)<n.minSelect&&(f||D(a)>0),_=v=>R(v)||f&&!D(v)||!(B=>{const{minSelect:U=0,maxSelect:$=1/0,maxSelectMode:A}=n,Q=D(B);switch(A){case p.MaxSelectModes.Maximum:return Q<=$;case p.MaxSelectModes.Range:return Q===0||Q>=U;default:return!0}})(v),T=Object.entries(a).some(([v,B])=>{var U,$;return B.isSelected&&(($=(U=r.find(A=>`${A.id}`===v))==null?void 0:U.optionProperties)==null?void 0:$.allowsTextEntry)}),k=l&&(!x||T),E=v=>{y(v.id,v.selected,v.userText,v.noneOfTheAbove)},q=v=>{var B;return(n==null?void 0:n.maxSelectMode)!==p.MaxSelectModes.Unlimited&&D(a)===(n==null?void 0:n.maxSelect)&&!((B=a[v])!=null&&B.isSelected)},C=r.map(({id:v,label:B,value:U,optionProperties:$})=>{var z,Z;const A=`${v}`,{allowsTextEntry:Q,noneOfTheAbove:V}={allowsTextEntry:!1,noneOfTheAbove:!1,...$};return e.u(p.Option,{allowTextEntry:Q,border:u,disabled:q(A),error:(H=a,R(H)),id:A,isRadio:x,isSelected:!!((z=a[A])!=null&&z.isSelected),label:B,noneOfTheAbove:V,onUserInputChanged:E,promptText:"Please specify",text:(Z=a[v])==null?void 0:Z.userText,useMobileStyling:c,value:U},A);var H}),N=()=>{i(a,!0),d&&d()},y=(v,B,U,$)=>{const A=Object.assign({},a);if((x||$)&&B)for(const Q of Object.values(A))Q.isSelected=!1,delete Q.userText;else m&&!$&&a[m.id].isSelected&&(A[m.id].isSelected=!1);A[v]={isSelected:B,userText:U},g(A)};return e.u("form",{className:e.cc(t,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:N,children:e.u(p.MobileEmbedView,{properties:n,defaultBody:()=>e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[n.isDropdown?e.u(p.Select,{disabledOptions:r.filter(v=>q(v.id)),dropdownFooter:h?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(a),"/",n.minSelect]}):void 0,isMultiSelect:!x,multiselectText:n.dropdownMultiselectedText??"choices selected",onChange:v=>{const B={...a};for(const U of r)v.includes(U)?B[U.id].isSelected=!0:B[U.id].isSelected=!1;g(B)},options:r,placeholderText:n.dropdownPlaceholderText??(x?"Select choice":"Select choice(s)"),value:r.filter(v=>a[v.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",c)),role:x?"radiogroup":"group",children:[C,!!h&&e.u("div",{className:"ul-card__min-select-counter",children:[D(a),"/",n.minSelect]})]}),k&&e.u(p.LongformSubmitButton,{handleSubmit:N,isSubmitDisabled:_(a)})]}),e.u(p.QuestionBodyFooterContainer,{children:e.u(W,{isDisabled:_(a),onClick:N,children:e.getButtonText(n)})})]})})},s)},qe=t=>{const{questionId:i,type:r,next:n,options:s}=t;return e.u(ge,{...t,onSubmit:(o,l)=>{const d=Object.entries(o).find(([,g])=>g.isSelected)||[void 0,void 0],[u,c]=d,b=s.find(g=>`${g.id}`===u),a=c!=null&&c.userText?{[u]:{userText:c.userText}}:null;n({value:b&&u?{[u]:b.value}:{},secondaryValue:a,questionId:i,type:r},l)}})},Me=t=>{const{questionId:i,type:r,next:n}=t;return e.u(ge,{...t,onSubmit:(s,o)=>{const l=Object.entries(s).reduce((u,[c,b])=>(u[c]=b.isSelected,u),{}),d=Object.entries(s).reduce((u,[c,b])=>{if(!b.userText)return u;const a=u||{};return a[c]={userText:b.userText},a},null);n({value:l,secondaryValue:d,questionId:i,type:r},o)}})},Le=({className:t,labels:i,properties:r,next:n,questionId:s,type:o})=>{const[l,d]=e.h(null),{border:u,useMobileStyling:c,viewDocument:b}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,viewDocument:f.viewDocument})),a=i&&i.left,g=i&&i.right,x=[...Array(11)].map((f,m)=>e.u("button",{className:e.cc(e.getClasses("nps-number",c),e.getClasses(`nps-number-${m}`,c)),id:`option-${m}`,onClick:R=>{R.preventDefault(),R.stopPropagation(),d(m)},onKeyDown:R=>{var h,_;const D=b.querySelectorAll("button.nps-number");R.key==="ArrowRight"?(h=D[m+1])==null||h.focus():R.key==="ArrowLeft"?(_=D[m-1])==null||_.focus():R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),R.stopPropagation(),d(m))},onPointerDown:R=>{R.currentTarget.style.zIndex="2",R.currentTarget.style.borderColor=u},onPointerLeave:R=>{R.currentTarget.style.zIndex="auto",R.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},style:l===m?{backgroundColor:u,color:"#fff"}:void 0,tabIndex:0,children:m},m));return e.u("form",{className:e.cc(t,"ul-card--nps","fade-in-transition"),children:e.u(p.MobileEmbedView,{properties:r,defaultBody:()=>e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:x}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:a}),e.u("span",{children:g})]})]}),e.u(p.QuestionBodyFooterContainer,{children:e.u(W,{isDisabled:l===null&&r.required,onClick:()=>n({value:l,questionId:s,type:o},!0),children:e.getButtonText(r)})})]})})},s)},Oe=({className:t,next:i,properties:r,questionId:n,type:s,onSubmitButtonClick:o})=>{const{border:l,useMobileStyling:d,update:u}=e.useConfig(T=>({border:T.border,useMobileStyling:T.useMobileStyling,update:T.update})),[c,b]=e.h(""),a=e._(null),g=c.trim(),x=r.required===!0&&!g,f=p.useAutoSize(a,()=>u()),m=T=>{const{value:k}=T.currentTarget;f(),T.preventDefault(),T.stopPropagation(),b(k)},R=T=>{T.preventDefault(),T.stopPropagation();const k=r.required!==!0||g.length>0;i({value:c,questionId:n,type:s},k),o&&o()},D=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",h=T=>{T.currentTarget.style.borderColor=l},_=T=>{T.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR};return e.u("form",{className:e.cc(t,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(p.MobileEmbedView,{defaultBody:()=>e.u("div",{className:"ul-card-text",children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":D,className:e.cc(e.getClasses("ul-card-text__input",d)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:_,onChange:m,onFocus:h,placeholder:D,ref:a,role:"textbox",tabIndex:0})}),r.footerHtml&&e.u("div",{className:"footer",dangerouslySetInnerHTML:{__html:r.footerHtml}})]}),e.u(p.QuestionBodyFooterContainer,{children:e.u(W,{isDisabled:x,onClick:R,children:e.getButtonText(r)})})]}),properties:r})},n)},Ue=({className:t,labels:i,next:r,properties:n,questionId:s,type:o,onSubmitButtonClick:l,options:d,showIndividualSubmit:u=!1})=>{const c=e._(null),b=e._(0),a=e._(0),g=e._(null),x=e._(!1),f=e._([]),[m,R]=e.h(()=>(n==null?void 0:n.required)===!0),[D,h]=e.h(()=>d.map(S=>({...S,rank:null}))),_=e.F(()=>Array.from({length:d.length},(S,w)=>w+1),[d.length]),{useMobileStyling:T,isPreview:k,headers:E}=e.useConfig(S=>({useMobileStyling:S.useMobileStyling,isPreview:S.isPreview,headers:S.headers})),q=(E==null?void 0:E["userleap-platform"])==="android",C=T&&!k&&!q,N=!C&&!q,y=S=>{S.preventDefault(),H(D),l&&l()},v=(S,w)=>{h(P=>{const I=parseInt(w),L=P.map(M=>({...M}));L.some(M=>M.rank==null)&&L.forEach((M,Y)=>M.rank=Y+1);const F=L.findIndex(M=>M.id===S);if(F===-1)return P;const O=L[F].rank;return I<O?L.forEach(M=>{M.id!==S&&M.rank>=I&&M.rank<O&&(M.rank=M.rank+1)}):I>O&&L.forEach(M=>{M.id!==S&&M.rank>O&&M.rank<=I&&(M.rank=M.rank-1)}),L[F].rank=I,L.sort((M,Y)=>M.rank-Y.rank),z(),L})},B=(S,w)=>{for(let P=0;P<f.current.length;P++){const I=f.current[P];if(!I||I===g.current)continue;const L=I.getBoundingClientRect();if(S>=L.left&&S<=L.right&&w>=L.top&&w<=L.bottom)return{element:I,index:P}}return null},U=S=>w=>{if(!C)return;w.preventDefault(),w.stopPropagation(),x.current=!0,c.current=S;const P=w.touches[0];b.current=P.clientY,a.current=P.clientY;const I=w.currentTarget.closest(".ul-card-rank__option");I&&(g.current=I,I.classList.add("is-dragging"))},$=S=>{if(!C||!x.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.touches[0];a.current=w.clientY;const P=a.current-b.current;g.current&&(g.current.style.transform=`translateY(${P}px)`,g.current.style.zIndex="1000"),f.current.forEach(L=>{L&&L!==g.current&&L.classList.remove("is-drop-target")});const I=B(w.clientX,w.clientY);I&&I.element.classList.add("is-drop-target")},A=S=>{if(!C||!x.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.changedTouches[0],P=B(w.clientX,w.clientY);g.current&&(g.current.style.transform="",g.current.style.zIndex="",g.current.classList.remove("is-dragging")),f.current.forEach(I=>{I&&I.classList.remove("is-drop-target")}),P&&P.index!==c.current&&Q(c.current,P.index),c.current=null,g.current=null,x.current=!1},Q=(S,w)=>{h(P=>{const I=P.map(F=>({...F})),[L]=I.splice(S,1);return I.splice(w,0,L),I.forEach((F,O)=>{F.rank=O+1}),z(),I})},V=S=>{S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="move")},H=S=>{const w={};S.reduce((P,I)=>(P[I.id]=I.rank,P),w),r({value:w,questionId:s,type:o},!0)},z=()=>{R(!1)},{left:Z,right:ae}=i,oe=d.length,_e=S=>{S.preventDefault(),S.currentTarget.classList.add("is-drop-target")},Se=S=>{S.currentTarget.classList.remove("is-drop-target")},Te=S=>{c.current=null,S.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(t,"ul-card-rank","fade-in-transition"),onSubmit:y,children:e.u(p.MobileEmbedView,{properties:n,defaultBody:()=>q?e.u(e.g,{children:e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",Z]})}),e.u("ol",{className:"ul-card-rank__list",children:D.map(({id:S,label:w,rank:P})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",P==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:I=>v(S,I.currentTarget.value),value:P??"",children:[P==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),_.map(I=>e.u("option",{className:"ul-card-rank__select-option",value:I,children:I},`${I}-${s}`))]}),e.u("span",{children:w})]},S))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[oe," - ",ae]})})]}),u&&e.u(p.LongformSubmitButton,{handleSubmit:y,isSubmitDisabled:m})]})}):e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",Z]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:q?void 0:V,children:D.map(({id:S,label:w,rank:P},I)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!N||void 0,onDragEnd:N?Te:void 0,onDragEnter:N?_e:void 0,onDragLeave:N?Se:void 0,onDragStart:N?(F=I,O=>{c.current=F,O.dataTransfer&&(O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",String(F)),O.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:N?(L=I,O=>{var Y,le;O.preventDefault(),O.currentTarget.classList.remove("is-drop-target");const M=c.current;c.current=null,(le=(Y=O.currentTarget.closest(".ul-card-rank__list"))==null?void 0:Y.querySelector(".is-dragging"))==null||le.classList.remove("is-dragging"),M!=null&&M!==L&&Q(M,L)}):void 0,ref:O=>f.current[I]=O,children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",P==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:O=>v(S,O.currentTarget.value),value:P??"",children:[P==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),_.map(O=>e.u("option",{className:"ul-card-rank__select-option",value:O,children:O},O))]}),e.u("span",{children:w}),!q&&e.u("button",{"aria-label":`Drag ${w} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:C?A:void 0,onTouchMove:C?$:void 0,onTouchStart:C?U(I):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"})})})]},S);var L,F})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[oe," - ",ae]})})]}),u&&e.u(p.LongformSubmitButton,{handleSubmit:y,isSubmitDisabled:m})]}),e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(p.Button,{disabled:m,children:e.getButtonText(n)})})})]})})},s)},te=1,he=2,ve=3,X=t=>t.type==="av_permission",ue=t=>t.type==="screen_permission",be=(t,i)=>t===void 0?te:t?((r,n)=>!(X(n)?n.permissionDescriptors:[]).includes("camera")||r.getVideoTracks().length>0)(t,i)?ve:te:he,ce={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},G=e.create(t=>({...ce,reset:()=>{t(ce)},updatePage:i=>{t(i)}}));function re({currentPage:t,pages:i}){const{avStream:r,recordingMediaTypes:n,updatePage:s}=G.getState(),{recorderEventEmitter:o}=e.useConfig.getState();o.emit("av.permission",{"permission.descriptors":t.permissionDescriptors,"stream.ready":(l,d)=>{if(r===l)return;let u=t;if(l&&!t.permissionDescriptors.includes("camera")){const c=i.indexOf(t),b=d!=null&&d.active?c+2:c+1;d!=null&&d.active&&n&&o.emit("begin.recording",{"recording.media.types":n,"start.recording.callback":a=>s({mediaRecordingUids:a})}),u=i[b]}s({currentPage:u,avStream:l})}})}function ne({status:t}){const{nextQuestion:i,passthroughData:r,mediaRecordingUids:n,reset:s}=G.getState(),{recorderEventEmitter:o,handleUploadUpdate:l,index:d}=e.useConfig.getState(),u={value:{taskStatus:t},type:"recordedtask",questionId:(r==null?void 0:r.questionId)||1};r&&o.emit("finish.task",{"begin.callback":c=>{l({mediaRecordingUid:c,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(c,b)=>{l({mediaRecordingUid:c,progressPct:b.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":c=>{c&&l({mediaRecordingUid:c,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":r,"current.index":d,"task.response":u,"task.complete.callback":c=>{u.value.taskDurationMillisecond=c,n&&(u.value.mediaRecordingUids=n),s(),i(u)}})}function se({pages:t,setIsRequestingPermission:i}){const{recorderEventEmitter:r,eventEmitFn:n}=e.useConfig.getState(),{updatePage:s,currentPage:o,recordingMediaTypes:l,screenPermissionRequested:d}=G.getState();if(!o)return;const u=t.indexOf(o);switch(o.type){case"av_permission":{const c=d?u+2:u+1;return d&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":b=>{s({mediaRecordingUids:b})}}),void s({currentPage:t[c]})}case"screen_permission":return void r.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(c,b)=>{const a=b?t[u+1]:o;b&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":g=>{s({captureStream:b,mediaRecordingUids:g})}}),s({currentPage:a,screenPermissionRequested:!0,captureStream:b})}});case"start_task":return n("recorded.task.start"),r.emit("recorded.task.start"),r.emit("start.task"),void s({currentPage:t[u+1],screenPermissionRequested:!0});case"complete_task":return}}const ye="ul-permission-graphics-container",fe="ul-permission-body",Ce=e.cc(ye,"ul_recorded-task-inset-spacing"),J=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),ke=({richTextBody:t})=>e.u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:t},id:"ul-task-detail-container"}),ee=({required:t,skipButtonText:i,bottom:r=!1})=>t?null:e.u(p.Button,{className:e.cc(r&&"ul-skip-button-below","ul-button-inactive"),onClick:ne.bind(null,{status:"abandoned"}),children:i||"Skip"}),ie=t=>{const{avStream:i,captureStream:r,recordingMediaTypes:n,updatePage:s}=G.getState(),o=(n==null?void 0:n.includes("audio"))||(n==null?void 0:n.includes("video"));e.p(()=>{const l=setInterval(()=>{o&&i&&!i.active?s({avStream:null,currentPage:t[0]}):r&&r.active||s({captureStream:void 0,currentPage:t[o?1:0]})},1e3);return()=>clearInterval(l)},[i,r,o,t,n,s])},Ae=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s,taskDetail:o}=t;return ie(i),e.u("div",{className:"ul-task-page",children:[o&&e.u(ke,{richTextBody:o}),e.u("div",{className:J,children:[e.u(p.Button,{onClick:se.bind(null,{pages:i}),children:n}),e.u(ee,{required:r,skipButtonText:s})]})]},"start-task")},$e=({content:t,pages:i,properties:r})=>{const{buttonText:n,skipButtonText:s}=t;ie(i);const o=e.u(p.MobileEmbedView,{properties:r,defaultBody:()=>e.u("div",{className:J,children:[e.u(p.Button,{className:"ul-complete-task-button",onClick:ne.bind(null,{status:"completed"}),children:n}),e.u(p.Button,{className:e.cc("ul-button-inactive"),onClick:ne.bind(null,{status:"given.up"}),children:s})]})});return e.u("div",{className:"ul-task-page",children:[t.taskDetail&&e.u(ke,{richTextBody:t.taskDetail}),o]},"complete-task")},Qe=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s}=t,[o]=e.useConfig(u=>[u.tabTitle]),[l,d]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ce,children:[e.u("p",{style:{marginTop:"auto"},children:t.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:fe,children:o})})]}),e.u("div",{className:r?"":J,children:[e.u(p.Button,{disabled:l,onClick:se.bind(null,{pages:i,setIsRequestingPermission:d}),children:n}),e.u(ee,{required:r,skipButtonText:s})]})]})},He=({content:t})=>e.u("div",{className:e.cc(ye,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),dangerouslySetInnerHTML:{__html:t.svg}},"ul-permission-request-graphic"),Fe=({content:t,pages:i,required:r})=>{const{permissionDeniedHeadline:n,permissionDeniedBody:s,skipButtonText:o,tryAgainButtonText:l}=t,d=X(i[0])?i[0]:null;return e.p(()=>{const u=setInterval(()=>{d!==null&&re({currentPage:d,pages:i})},1e3);return()=>clearInterval(u)},[d,i]),d?e.u("div",{children:[e.u("div",{className:Ce,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:n}),e.u("span",{className:fe,children:s})]})}),e.u("div",{className:J,children:[e.u(p.Button,{onClick:re.bind(null,{currentPage:d,pages:i}),children:l}),e.u(ee,{required:r,skipButtonText:o})]})]}):null},Ve=({stream:t})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:i=>{i&&(i.srcObject=t||null)}}),Ge=({content:t,pages:i,required:r})=>{const{skipButtonText:n}=t,{avStream:s}=G.getState();return ie(i),e.u("div",{children:[e.u(Ve,{stream:s}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(p.Button,{onClick:se.bind(null,{pages:i}),children:t.buttonText}),e.u(ee,{bottom:!0,required:r,skipButtonText:n})]})]})},je=({properties:t})=>{const{pages:i,required:r}=t,{avStream:n,currentPage:s}=G.getState();if(s===void 0)return null;switch(s==null?void 0:s.type){case"av_permission":{const o=be(n,s);return o===te?e.u(He,{content:s}):o===he?e.u(Fe,{content:s,pages:i,required:r}):e.u(Ge,{content:s,pages:i,required:r})}case"screen_permission":return e.u(Qe,{content:s,pages:i,required:r});case"start_task":return e.u(Ae,{content:s,pages:i,required:r});case"complete_task":return e.u($e,{content:s,pages:i,properties:t});default:return null}},Ze=({className:t,properties:i,next:r,questionId:n})=>{const s=e.useConfig(),{surveyId:o,responseGroupUid:l,userId:d}=s,u=G(),{screenPermissionRequested:c}=u,b=G(m=>m.avStream);let a=G(m=>m.currentPage);a||(a=function({pages:m,userId:R,responseGroupUid:D,surveyId:h,questionId:_,next:T}){const{updatePage:k}=G.getState(),{eventEmitFn:E,recorderEventEmitter:q}=e.useConfig.getState(),C={questionId:_,surveyId:h,visitorId:R,responseGroupUid:D};let N=0;q.emit("recorded.task.permission.screen"),E("recorded.task.permission.screen"),q.emit("permission.status",{"permission.status.callback":(v,B,U,$)=>{const A=m[N],{type:Q}=A,V=["screen"];if(X(A)){const{permissionDescriptors:H}=A,z=H==null?void 0:H.includes("microphone"),Z=H==null?void 0:H.includes("camera");z&&V.push("audio"),Z&&V.push("video"),(v!=null&&v.active&&!Z||v!=null&&v.active&&B)&&N++}ue(m[N])&&U&&(N++,q.emit("begin.recording",{"recording.media.types":V,"start.recording.callback":H=>k({mediaRecordingUids:H})})),k({currentPage:m[N],avStream:v,screenPermissionRequested:U,nextQuestion:T,type:Q,passthroughData:C,recordingMediaTypes:V,captureStream:$})}});const y=m[N];return y.type==="av_permission"&&re({currentPage:y,pages:m}),y}({questionId:n,surveyId:o,next:m=>{r(m,!0)},pages:i.pages,responseGroupUid:l,userId:d}));let g=a.headline,x=a.captionText;const f=be(b,a);return ue(a)&&c&&(g=a.permissionDeniedHeadline,x=a.permissionDeniedCaptionText),X(a)&&f===ve&&(g=a.permissionGrantedHeadline,x=a.permissionGrantedCaptionText),e.u("div",{className:e.cc(t,"ul-center-horizontally","fade-in-transition"),children:[e.u(p.Header,{message:g,properties:{captionText:x}}),e.u(p.QuestionBodyWrapper,{children:e.u(je,{properties:i})})]})},ze=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{visitorAttributes:o,isLongFormSurvey:l}=e.useConfig(a=>({visitorAttributes:a.visitorAttributes,isLongFormSurvey:me.isLongFormSurvey(a.studyType)})),d=(a,g=!1)=>{i({value:g?{skipped:!0}:void 0,questionId:n,type:s},!0)},u=a=>{a.key!=="Enter"&&a.key!==" "||i({value:void 0,questionId:n,type:s},!0)},c=p.getAttributedUrl(r&&r.buttonUrl,o),b=l&&r.promptActionType===p.PromptActionTypeEnum.NO_BUTTON?()=>e.u(e.g,{}):()=>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:c,id:"ul-card-text__button",onClick:d,onKeyPress:u,rel:"noreferrer",role:c?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(r)}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:a=>d(0,!0),children:e.getSkipButtonText(r)})]})});return e.u("div",{className:e.cc(t,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(p.MobileEmbedView,{defaultBody:b,properties:r})},n)},We=({className:t,questionId:i})=>{const{border:r,destroy:n,endCard:s,forceBrandedLogo:o}=e.useConfig(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{n(j.APP_ID)},o?4e3:2e3)},[n,o]);const l=s&&s.subheader?e.u("p",{className:"ul-caption",children:s.subheader}):null,d=s&&s.headline?s.headline:"";return e.u("div",{className:e.cc(t,"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:r,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:r,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(p.Header,{message:d}),l]})})},i)},Ye=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),Ke=({className:t})=>{const{uploadProgress:i}=e.useConfig(o=>({uploadProgress:o.uploadProgress}));let r,n;Object.values(i).filter(o=>o.isSubmitted).length>1?(r="Your responses are processing",n="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",n="Please keep this tab open until your response is fully processed.");const s=Math.round(Math.min(99,...Object.values(i).filter(o=>o.isSubmitted).map(o=>o.progressPct||0)));return e.u("div",{className:e.cc(t,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(p.Header,{message:`${r} (${s}% complete)`}),e.u("p",{className:"ul-caption",children:n})]})},de=0,pe=1,Xe=({className:t,next:i,properties:r,questionId:n,type:s})=>{const o=`ul-card-video__player_recorder-q${n}`,{apiURL:l,envId:d,handleUploadUpdate:u,headers:c,responseGroupUid:b,surveyId:a,update:g,viewDocument:x,visitorId:f}=e.useConfig(y=>({apiURL:y.apiURL,envId:y.envId,handleUploadUpdate:y.handleUploadUpdate,headers:y.headers,responseGroupUid:y.responseGroupUid,surveyId:y.surveyId,update:y.update,viewDocument:y.viewDocument,visitorId:y.userId})),[m,R]=e.h(!1),[D,h]=e.h(null),[_,T]=e.h(null),[k,E]=e.h(de),q=e._(null);e.p(()=>{const y=q.current,v=new ResizeObserver(()=>{g()});return y&&v.observe(y),()=>{y&&v.unobserve(y)}},[g]);const C=(y,v)=>{y===p.RECORDER.UPLOAD_STARTED?(h(v[p.RECORDER.UPLOAD_ID]),T(v[p.RECORDER.MEDIA_RECORDING_UID]),R(!0)):y===p.RECORDER.DELETE?(h(null),T(null),R(!1)):y===p.RECORDER.UPLOAD_PROGRESS?isNaN(v[p.RECORDER.UPLOAD_PROGRESS_PCT])?u({mediaRecordingUid:v[p.RECORDER.MEDIA_RECORDING_UID],isComplete:!0}):u({mediaRecordingUid:v[p.RECORDER.MEDIA_RECORDING_UID],progressPct:v[p.RECORDER.UPLOAD_PROGRESS_PCT]}):y===p.RECORDER.UPLOAD_FINISHED&&u({mediaRecordingUid:v[p.RECORDER.MEDIA_RECORDING_UID],isComplete:!0})},N=y=>{y.preventDefault(),y.stopPropagation(),document.getElementById(o)&&p.stopRecording(o),D&&_?(u({mediaRecordingUid:_,isSubmitted:!0}),i({value:{mediaRecordingUid:_},questionId:n,type:s},!0)):i({value:null,questionId:n,type:s},!0)};return e.u("form",{className:e.cc(t,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",ref:q,style:{display:k===de?"":"none"},children:e.u(p.MobileEmbedView,{defaultBody:()=>e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:y=>{y.preventDefault(),y.stopPropagation(),document.getElementById(o)&&p.pauseQuestionPlayer(o),E(pe)}}),properties:r})}),e.u("div",{style:{display:k===pe?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:y=>{if(y&&y.children.length===0){const v=p.videoRecorderPlayer(o,{surveyId:a,responseGroupUid:b,questionId:n,visitorId:f,envId:d},l,C,void 0,{...c,"x-ul-video-recorder-origin":"sdk"},r.mediaType===p.RECORDER.MEDIA_TYPE_AUDIO,x);y.appendChild(v)}}})})]}),e.u(p.QuestionBodyFooterContainer,{children:[e.u(W,{isDisabled:!!r.required&&!m,onClick:N,children:e.getButtonText(r)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:N,style:{...r.required?{display:"none"}:{},...m?{display:"none"}:{}},children:e.getSkipButtonText(r)})]})]})},xe=t=>t.type==="thanks"||t.type==="uploading",Je=({card:t,avatars:i,isThinking:r,isCurrentQuestion:n,currentQuestionBubbleRef:s})=>{const o=(l=>"properties"in l.props&&l.props.properties&&"questionHtml"in l.props.properties&&l.props.properties.questionHtml?{content:l.props.properties.questionHtml,isHtml:!0}:"message"in l.props?{content:l.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(t);return e.u(K,{avatars:i,isLeft:!0,message:{id:`question-${t.name}`,type:"question",content:o.content},ref:n?s:null,children:r?e.u(Ye,{}):e.u(e.g,{children:[o.isHtml?e.u("div",{className:"chat-message-text",dangerouslySetInnerHTML:{__html:o.content}}):e.u("div",{className:"chat-message-text",children:o.content}),t.type==="videovoice"&&e.u(Re,{properties:t.props,questionId:t.name,surveyVideoUrl:t.props.properties.videoUrl})]})})},et=({card:t,avatars:i})=>{const r=(n=>{if(!("properties"in n.props)||!n.props.properties||typeof n.props.properties!="object")return null;const s=n.props.properties,o=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:l,isHtml:d}of o){const u=s[l];if(typeof u!="string")continue;const c=u.trim();if(c){if(d&&!c.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:c,isHtml:d}}}return null})(t);return r?e.u(K,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:r.content},children:r.isHtml?e.u("div",{className:"chat-message-text",dangerouslySetInnerHTML:{__html:r.content}}):e.u("div",{className:"chat-message-text",children:r.content})}):null},tt=({card:t,userResponse:i,avatars:r})=>{const n=((s,o)=>{if(s.type==="open"&&o&&typeof o=="object"&&"value"in o)return o.value})(t,i);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:n||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})},rt=({card:t,avatars:i,isCurrentQuestion:r,currentQuestionBubbleRef:n})=>{const{endCard:s}=e.useConfig(o=>({endCard:o.endCard}));return e.u(e.g,{children:[e.u(K,{avatars:i,isLeft:!0,message:{id:`thanks-${t.name}`,type:"question",content:(s==null?void 0:s.headline)??"Great! Thank you for your participation."},ref:r?n:null}),(s==null?void 0:s.subheader)&&e.u(K,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:s.subheader}}),e.u(Ie,{})]})},nt=({card:t,cardIndex:i,index:r,avatars:n,cardResponses:s,questionThinkingStates:o,startingQuestionIdx:l,currentQuestionBubbleRef:d,handleCardResponse:u})=>{const c=i===r,b=i<r,a=xe(t);if(a)return e.u(rt,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:c});const g=`${t.name}`,x=s.get(g),f=t.type==="open",m=o.get(g),R=i>(l??0)&&t.type!=="thanks"&&t.type!=="uploading"&&(m===!0||m===void 0);return e.u(e.wn.Fragment,{children:[e.u(Je,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:c,isThinking:R}),!R&&e.u(et,{avatars:n,card:t}),b&&f?e.u(tt,{avatars:n,card:t,userResponse:x}):(!b||!f)&&!R&&e.u(K,{avatars:n,isLeft:!1,message:{id:`card-${t.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(it,{card:t,className:a?"chat-thanks-card":"chat-card",isAnswered:b,next:c?u:()=>{}})})})]},`question-card-${t.name}`)},K=e.wn.forwardRef(({message:t,isLeft:i=!1,children:r,avatars:n,hideAvatar:s=!1},o)=>{const l=i?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${i?"chat-left":"chat-right"}${i&&s?" chat-no-avatar":""}`,ref:o,children:[i&&!s&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${l}`,children:r||e.u("div",{className:"chat-message-text",children:t.content})}),!i&&!s&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x`})]})});K.displayName="ChatBubble";const st=()=>{const t=e.useConfig(r=>r.close),i=e.F(()=>()=>t(j.APP_ID),[t]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:i,onKeyPress:r=>{r.key==="Enter"&&i()},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"})})})},it=({card:t,next:i,className:r="",isAnswered:n=!1})=>{const s={className:n?`${r} answered-card`:r,next:n?()=>{}:i,questionId:t.name,type:t.type,isAnswered:n};switch(t.type){case"consentlegal":return e.u(Ne,{...s,...t.props});case"likert":return e.u(Ee,{...s,...t.props});case"matrix":return e.u(Pe,{...s,...t.props});case"multiplechoice":return e.u(qe,{...s,...t.props});case"multipleselect":return e.u(Me,{...s,...t.props});case"nps":return e.u(Le,{...s,...t.props});case"open":return e.u(Oe,{...s,...t.props});case"rankorder":return e.u(Ue,{...s,...t.props});case"recordedtask":return e.u(Ze,{...s,...t.props});case"texturlprompt":return e.u(ze,{...s,...t.props});case"thanks":return e.u(We,{...s,...t.props});case"uploading":return e.u(Ke,{...s,...t.props});case"videovoice":return e.u(Xe,{...s,...t.props});default:return null}};exports.default=({cards:t,next:i,previousResponses:r})=>{const{messagesContainerRef:n,currentQuestionBubbleRef:s,scrollToCurrentQuestion:o}=(()=>{const h=e._(null),_=e._(null),T=e.T(()=>{if(_.current&&h.current){const k=h.current,E=_.current.offsetTop-k.offsetTop-16;k.scrollTo({top:Math.max(0,E),behavior:"smooth"})}},[]);return{messagesContainerRef:h,currentQuestionBubbleRef:_,scrollToCurrentQuestion:T}})(),{cardResponses:l,setCardResponse:d}=(()=>{const[h,_]=e.h(new Map);return{cardResponses:h,setCardResponse:e.T((T,k)=>{_(E=>new Map(E).set(T,k))},[])}})(),{index:u,isLongFormSurvey:c,avatars:b,startingQuestionIdx:a}=e.useConfig(h=>({index:h.index,isLongFormSurvey:me.isLongFormSurvey(h.studyType),avatars:h.avatars,startingQuestionIdx:h.startingQuestionIdx})),g=((h,_,T)=>{const[k,E]=e.h(new Map);return e.p(()=>{if(h.length>0&&_<h.length){const q=h[_],C=`${q.name}`;if(_<=(T??0)||xe(q))return void E(y=>new Map(y).set(C,!1));E(y=>new Map(y).set(C,!0));const N=setTimeout(()=>{E(y=>new Map(y).set(C,!1))},1e3);return()=>clearTimeout(N)}},[_,h,T]),k})(t,u,a),x=((h,_)=>{const[T,k]=e.h(new Set([0]));return e.p(()=>{k(E=>new Set(E).add(h))},[h]),e.p(()=>{const E=_??0;E>0&&k(q=>{const C=new Set(q);for(let N=0;N<=E;N++)C.add(N);return C})},[_]),T})(u,a),f=e.F(()=>({...r,...e.buildReadableResponseMap(t.map((h,_)=>{var T,k;return{...h,value:_<u?((T=l.get(`${h.name}`))==null?void 0:T.value)??null:null,secondaryValue:_<u?((k=l.get(`${h.name}`))==null?void 0:k.secondaryValue)??null:null}}))}),[r,l,t,u]),m=e.pipeReadableResponsesIntoCards(t,f);e.p(()=>{requestAnimationFrame(()=>{o()})},[u,o,g]);const R=e.T((h,_)=>{if(!_)return;const T=m[u];if(!T)return;const k=`${T.name}`;d(k,h),i([h])},[m,u,i,d]),D=m.map((h,_)=>({card:h,cardIndex:_})).filter(({cardIndex:h})=>x.has(h));return e.u("div",{className:"conversational-ui ul-conversational-ui",children:[!c&&e.u(st,{}),e.u("div",{className:"chat-container",ref:n,children:e.u("div",{className:"chat-messages",children:D.map(({card:h,cardIndex:_})=>e.u(nt,{avatars:b,card:h,cardIndex:_,cardResponses:l,currentQuestionBubbleRef:s,handleCardResponse:R,index:u,questionThinkingStates:g,startingQuestionIdx:a},`question-card-${h.name}`))})})]})};
@@ -1,12 +0,0 @@
1
- "use strict";var wt=Object.defineProperty;var gt=(r,t,o)=>t in r?wt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var q=(r,t,o)=>gt(r,typeof t!="symbol"?t+"":t,o);const i=require("./metricsReporter-Bggbn2wu.cjs"),Te=()=>{try{return window.parent.Intercom}catch{return null}},Me=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=Te();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=Te();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class $e{static disable(){Me.forEach(t=>t.disable())}static enable(){Me.forEach(t=>t.enable())}}const qe="ul-view-sdk-script",mt=new Set(["ios","android"]),H="visitors",T="environments";async function A(r,t){var n,s,d;const{shouldDropOnRateLimit:o,...a}=t;a.headers=Object.assign(i.getHttpHeaders(window.UserLeap),a.headers);const e=await i.sprigFetch(r,{...a,shouldDropOnRateLimit:o});if(e.ok){const p=(n=e.headers)==null?void 0:n.get("Authorization"),c=p?p.split(" "):void 0,l=c&&c.length===2?c[1]:void 0,u=(s=e.headers)==null?void 0:s.get("x-ul-visitor-id");if(window.UserLeap.userId&&u===window.UserLeap.visitorId){const m=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");m&&m[window.UserLeap.envId]===u&&(delete m[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",m))}l&&u&&(u!==window.UserLeap.visitorId||window.UserLeap.token!==l)&&(R("token",l),R("vid",u),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:u}),window.UserLeap.token=l,window.UserLeap.visitorId=u)}return(d=e.json)!=null&&d.logMessage&&console.warn(`[Sprig] ${e.json.logMessage}`),e}function R(r,t){const o=i.localStorageHelper.getItemObject("userleap.ids");let a=o[window.UserLeap.envId];a?a[r]=t:a={[r]:t},o[window.UserLeap.envId]=a,i.localStorageHelper.setItemObject("userleap.ids",o)}function Ee(){return window.previewMode?"0":window.UserLeap.visitorId??""}function D(r,t,o){const a=[window.UserLeap._API_URL,"sdk",r];return t&&t.forEach(e=>{a.push(e),e===T?a.push(window.UserLeap.envId):e===H&&a.push(Ee())}),o&&a.push(o),a.join("/")}const z=async(r,t,o)=>{var Oe,Ce,Pe;const{context:a,delay:e,avatars:n,forceBrandedLogo:s,endCard:d,isFeedback:p=!1,heatmap:c,locale:l,layout:u,previewMode:m,productConfig:g,questions:w,responseGroupUid:U,surveyId:y,uuid:h,vid:v,sessionReplay:S,studyType:E}=r,k=i.getHttpHeaders(window.UserLeap),L=J(k),C=le(k);if(S)if(L)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:U,hasQuestions:!!(w!=null&&w.length),surveyId:y,uploadId:S.uploadId,replayType:S.replayDurationType??"before",seconds:S.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:U,surveyId:y,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};i.modules.replay.scheduleOrCaptureReplay({responseGroupId:U,surveyId:y,visitorId:v,replayParams:S,completeUploadHeaders:k,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:w.length===0})}if(c){if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:b,replayParams:M,responseGroupUid:ue,surveyId:we}=c;await i.modules.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:o}),i.modules.replay.tryReplayAction(()=>{var He;return(He=i.modules.replay)==null?void 0:He.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:k,eventId:b,isHeatmap:!0,replayParams:M,responseGroupId:ue,surveyId:we,triggerTimestamp:Date.now(),visitorId:v})},"Error in scheduling/capturing replay")}if(v==null||!(w!=null&&w.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:v}),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const b="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(b),{success:!1,message:b,surveyState:"no survey"}}if(v!==window.UserLeap.visitorId&&h!==window.UserLeap.visitorId&&!window.previewMode){const b="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(b)),{success:!1,message:b,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:y}),(Oe=i.modules.replay)==null||Oe.RecordSurveyShown({id:y,userAgent:window.navigator.userAgent}),$e.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":y,layout:u});let _,P,I,Y,X=document.createElement("div");const _e=b=>{const{"view.version":M}=b;M!==k["x-ul-sdk-version"]&&Ke(),i.eventEmitter.removeListener("verify.view.version",_e)};i.eventEmitter.on("verify.view.version",_e),window.UserLeap.useMobileStyling=C,i.shouldDirectEmbed(k)?(_="ul-direct-embeded-frame",P=document.head,I=window,Y=!1,(()=>{const b=i.getHttpHeaders(window.UserLeap),M=J(b),ue=window.UserLeap.forceDirectEmbed,we=b["userleap-platform"]==="web";return M||ue&&we})()&&(Ge(y,p),X.id=_,window.UserLeap.container.appendChild(X),Je(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":y}))):{frameId:_,contentWinDocHead:P,contentWindow:I,hasOverlay:Y,iframe:X}=vt({productConfig:g,useMobileStyling:C,surveyId:y,isFeedback:p}),window.UserLeap.frameId=_;const V={apiURL:window.UserLeap._API_URL,avatars:n,cards:w,configureExitOnOverlayClick:b=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,b)},context:a,endCard:d,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:s,frame:X,headers:k,layout:u,locale:l,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.localStorageHelper.getItem("sprig.previewKey"),previewMode:m,productConfig:{framePosition:g==null?void 0:g.framePosition,desktopDisplay:g==null?void 0:g.desktopDisplay,placement:g==null?void 0:g.placement},responseGroupUid:U,startingQuestionIdx:(Ce=window.UserLeap.config)==null?void 0:Ce.startingQuestionIdx,studyType:E,styleNonce:window.UserLeap.styleNonce,surveyId:y,tabTitle:document.title,trackPageViewUrl:t,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:C,userId:h,viewDocument:I==null?void 0:I.document,viewWindow:I,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},...window.UserLeap._config};(Pe=window.UserLeap._config)!=null&&Pe.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const ut=(p?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??g.customStyles;V.customStyles=ut,I&&(I.__cfg=V);const pe=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:V.path,De=document.getElementById(qe);De&&De.remove();const ce=function(){const b=document.createElement("script");return window.UserLeap.nonce&&b.setAttribute("nonce",window.UserLeap.nonce),b.id=qe,b}(),xe=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(V.installationMethod==="web-npm"||V.installationMethod==="web-npm-bundled"){const{default:b}=await Promise.resolve().then(()=>require("./view-Bijnkt4E.cjs")).then(M=>M.view);b.configure(V),Y&&window.UserLeap.container&&xe()}else pe&&(ce.src=pe,Y&&ce.addEventListener("load",()=>{window.UserLeap.container&&xe()}),I==null||I.addEventListener("error",b=>{b.target instanceof HTMLScriptElement&&b.target.src===pe&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));P==null||P.appendChild(ce);const Ae={success:!0,surveyState:"ready",surveyId:y,responseGroupUid:U};return window.UserLeap.isMobileSDK&&e&&(Ae.delay=e),Ae};function le(r){var o;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=((o=window.UserLeap.windowDimensions)==null?void 0:o.width)??document.body.clientWidth;return J(r)||t>10&&t<500}function J(r){return mt.has(r["userleap-platform"])}const Ie="ul-frame";window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig),window.UserLeap||(window.UserLeap=window.Sprig),window.Sprig||(window.Sprig=window.UserLeap);const ge="0px",Ge=(r,t,o)=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container"+(t?" ul-container-feedback":""),r&&(window.UserLeap.container.dataset.studyId=r.toString());const a=Xe();o&&a&&!window.UserLeap.useMobileStyling?a.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},Ke=(r,t)=>{var a;ht();const o=window.UserLeap.container;if(o)try{(a=o.parentNode)==null||a.removeChild(o),window.UserLeap.container=null,R("trackStartUrl",null),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"dismissed"}),i.eventEmitter.emit(i.SprigEvent.SurveyClosed,{name:i.SprigEvent.SurveyClosed,initiator:r,"survey.id":parseInt(o.dataset.studyId),...t&&{studyType:t}})}catch(e){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} `+o),e instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",e)}},Je=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:t})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),Ke(r,t)})},yt=(r,t,o,a)=>{var l,u;const e={position:"fixed",bottom:"0px",right:ge,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},n=Object.assign({},t,window.UserLeap),{desktopDisplay:s}=t||{},d=s==="center-modal";let p;d&&(n.framePosition="center");let c=!1;if(o)(l=window.UserLeap.windowDimensions)!=null&&l.width?e.width=`${window.UserLeap.windowDimensions.width}px`:e.width="100%",(u=window.UserLeap.windowDimensions)!=null&&u.height?e.maxHeight=window.UserLeap.windowDimensions.height-20+"px":window.UserLeap.maxHeight?e.maxHeight=window.UserLeap.maxHeight:e.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(n.overlayStyleMobile)&&(c=!0);else{e.width="360px",e.maxHeight=window.UserLeap.maxHeight||"66vh";const m=()=>{c=!0,p={margin:"auto",position:"static"}};if(a)d?m():p={position:"relative",height:"300px"};else switch(n.framePosition){case"bottomLeft":p={left:ge};break;case"topLeft":p={left:ge,top:0};break;case"topRight":p={top:0};break;case"center":m()}}return c&&((m,g)=>{const w={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},U=g?m.overlayStyleMobile:m.overlayStyle;w["background-color"]=U==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",g||(w.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,w)})(n,o),Object.assign(r.style,e,p),c},vt=({productConfig:r,useMobileStyling:t,surveyId:o,isFeedback:a})=>{var m,g;const e=Ie,n=a&&r.desktopDisplay==="slider";Ge(o,a,n),ft();const s=document.createElement("iframe");s.id=e,s.setAttribute("title","Sprig User Feedback Dialog");const d=yt(s,r,t,a);Je();let p=!1;s.setHeight=w=>{parseInt(s.style.height)==w&&p||(p=!0,s.style.height=`${w}px`,i.eventEmitter.emit(i.SprigEvent.SurveyHeight,{name:i.SprigEvent.SurveyHeight,contentFrameHeight:w,"survey.id":o}))};let c=!1;s.setWidth=w=>{parseInt(s.style.width)==w&&c||(c=!0,s.style.width=`${w}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:w,"survey.id":o}))},(m=window.UserLeap.container)==null||m.appendChild(s),r&&(t?r.exitOnOverlayClickMobile:r.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{i.eventEmitter.emit(i.SprigEvent.CloseSurveyOnOverlayClick)}),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":o});const l=(g=s.contentWindow)==null?void 0:g.document;if(l&&(l.open("text/html","replace"),l.write("<!doctype html><head></head><body></body></html>"),l.close(),!t)){const w=l.body;w.style.display="flex",w.style.alignItems="center"}const u=l==null?void 0:l.head;return{frameId:e,contentWinDocHead:u,contentWindow:s.contentWindow,hasOverlay:d,iframe:s}},Qe={[i.SprigEvent.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},ft=()=>{Object.entries(Qe).forEach(([r,t])=>{i.eventEmitter.on(r,t)})},ht=()=>{Object.entries(Qe).forEach(([r,t])=>{i.eventEmitter.off(r,t)})},x=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,je=r=>r instanceof HTMLElement||r instanceof SVGElement,Q=({document:r,elementId:t,styleString:o,nonce:a})=>{const e=r.getElementById(t);if(e)return void(e.textContent=o);const n=r.createElement("style");a&&(n.nonce=a),n.textContent=o,n.id=t,r.head.appendChild(n)},St=(r,t)=>{const o=t.querySelector(".sprig-question-body");if(!x(o))return r;const a=o.scrollHeight;return a<100?r:r-(a-100)},Fe=(r,t)=>{const o=t.querySelector(r);if(!x(o))return 0;const a=getComputedStyle(o);return parseFloat(a.paddingLeft)+parseFloat(a.paddingRight)+(parseFloat(a.marginLeft)+parseFloat(a.marginRight))+(parseFloat(a.borderLeftWidth)+parseFloat(a.borderRightWidth))},Ye=(r,t,o)=>{const a=r.querySelector(".ul-card__container"),e=r.querySelector(".ul-app");let n=600,s=360,d=0;if(x(a)&&x(e)){const p=a.querySelector(".ul-card--matrix_grid"),c=!p&&t&&o;try{c&&(e.style.width="360px"),n=a.clientHeight,n+=(m=>{const g=m.querySelector(".sprig-question-body"),w=m.querySelector(".ul-card"),U=m.querySelector(".ul-card-main-content"),y=m.querySelector(".ul-footer"),h=m.querySelector(".sprig-container");let v=0;return x(w)&&(v+=w.scrollHeight-w.clientHeight),x(U)&&(v+=U.scrollHeight-U.clientHeight),x(g)&&(v+=g.scrollHeight-g.clientHeight),x(y)&&x(h)&&h.clientHeight===0&&(v+=y.clientHeight),v})(r);const l=getComputedStyle(a);d=n;const u=parseFloat(l.marginTop)+parseFloat(l.marginBottom);n+=u+(parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth)),p&&(s=p.scrollWidth,s+=Fe(".ul-card__container",r),s+=Fe(".sprig-question-body",r))}finally{c&&e.style.removeProperty("width")}}return[n+1,s,St(d,r)]},Xe=()=>f,N=()=>document.getElementById("sprig-feedback-container"),fe=()=>document.getElementById("sprig-feedback-loading-animation"),Ze=()=>!!document.getElementById(Ie);let Ve=!1,f=null,O=null,ke=!1,$=null,j=null;const bt=["bottom-left","bottom-right","center-left","center-right"],te=()=>{var t;const r=window.UserLeap.container;return((t=r==null?void 0:r.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},et=()=>document.getElementById("sprig-feedback-error-container"),tt=()=>{if(!f)return 0;const r=f==null?void 0:f.clientWidth,t=window.getComputedStyle(f);return r+parseInt(t.borderRightWidth||"0")+parseInt(t.borderLeftWidth||"0")},re=r=>{const t=N();t&&(j!=null&&j.endsWith("right")?t.style.right=`${r}px`:j!=null&&j.endsWith("left")&&(t.style.left=`${r}px`))},me=()=>{if(f&&(te()||et())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,W),he();const r=tt();return re(-r),!0}return!1},W=()=>{if(!f||!O)return;const r=fe();r&&r.remove(),f.style.height="auto",f.style.width="auto",O.disabled=!1,ke=!1},he=()=>{if(f&&!fe()){const r=(()=>{if(fe())return;const t=document.createElement("div");return t.className="ul-loading-spinner-container",t.id="sprig-feedback-loading-animation",t.role="progressbar",t.setAttribute("aria-live","polite"),t.setAttribute("aria-busy","true"),t.setAttribute("aria-label","Processing..."),t.innerHTML=`
2
- <div class="ul-loading-spinner">
3
- <div class="first"></div>
4
- <div class="second"></div>
5
- <div class="third"></div>
6
- <div class="fourth"></div>
7
- </div>
8
- `,t})();r&&(f.style.height="300px",f.style.width="360px",f.appendChild(r))}},Ne=()=>{f&&O&&(re(0),O.disabled=!0,ke=!0)},rt=async(r,t,o)=>{const{buttonTheme:a,customStyles:e,eventId:n,placement:s,desktopDisplay:d,feedbackLabel:p,surveyUuid:c,surveyId:l}=r;window.UserLeap.feedbackCustomStyles=void 0;let u=N();if(u){if(!t&&n===$)return;u.remove(),i.eventEmitter.off(i.EVENTS.SURVEY_FADING_OUT,me)}$=n,Q({document,elementId:"sprig-feedback-style",styleString:'.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}',nonce:window.UserLeap.styleNonce}),Q({document,elementId:"ul-custom-style",styleString:e??"",nonce:window.UserLeap.styleNonce}),Ve=d==="center-modal",j=s;const[m,g]=s.split("-");(h=>{if(N()||!bt.includes(h))return;const[v,S]=h.split("-"),E=document.createElement("div");E.id="sprig-feedback-container",E.classList.add(`sprig-feedback-container-${S}`,`sprig-feedback-container-${v}`),document.body.appendChild(E)})(s),u=N(),O=document.createElement("button");const w=document.createElement("div");w.className="sprig-feedback-button-label",w.innerText=p,O.appendChild(w),O.id="sprig-feedback-button",O.classList.add(`sprig-feedback-button-${g}`,`sprig-feedback-button-${m}`,`sprig-feedback-button-${a}`,"fade-in-transition"),i.eventEmitter.on(i.EVENTS.SURVEY_FADING_OUT,me),O.addEventListener("click",async()=>{const h=document.getElementById("sprig-feedback-error-container");if(Ze()||et()){if(me()){i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:i.DismissReason.FeedbackClosed,studyType:"feedbackButton","survey.id":l}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:i.DismissReason.FeedbackClosed,studyType:"feedbackButton","survey.id":l});const S=N();h&&S&&(S.remove(),$=null,f=null)}return}if(le(i.getHttpHeaders(window.UserLeap))||ke||Ne(),t)return f&&f.classList.add("sprig-feedback-loading-container-previews"),await z(t),void W();const v=await(async S=>{const E=await A(D("1",[H],"startFeedbackStudy"),{body:JSON.stringify({surveyUuid:S}),method:"POST"});return E.ok?E.json:null})(c);if(v)i.eventEmitter.once(i.SprigEvent.SurveyAppeared,W),z({...v,studyType:"feedbackButton"},o);else if(f){const S=Lt();f.appendChild(S),W(),f.style.height="300px",f.style.width="360px"}}),u==null||u.appendChild(O),i.eventEmitter.emit(i.SprigEvent.FeedbackButtonLoaded,{name:i.SprigEvent.FeedbackButtonLoaded,"survey.id":l});const{useMobileStyling:U,_config:{border:y}}=window.UserLeap;if(Ve||U)re(0);else{const h=document.createElement("div");h.id="sprig-feedback-loading-container",h.className=`sprig-feedback-loading-container sprig-feedback-loading-container-${g}`,h.style.setProperty("--feedback-border",y),f=h,he(),u==null||u.appendChild(h);const v=tt();re(-v)}window.UserLeap._config.isOnQuestionsTab&&t&&!te()&&f&&(Ne(),he(),f&&f.classList.add("sprig-feedback-loading-container-previews"),z(t),W())},Lt=()=>{const r=document.createElement("div");r.id="sprig-feedback-error-container",r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
9
- <circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
10
- <path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
11
- <circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
12
- </svg>`;const t=document.createElement("h3");return t.className="sprig-feedback-error-text",t.innerText="There was an error while loading the survey",r.appendChild(t),r},Se=new class{constructor(){q(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(r){try{return!(!r||typeof r!="object"||Array.isArray(r))&&(Object.keys(this._ldData).forEach(t=>{delete this._ldData[t]}),Object.keys(r).forEach(t=>this._ldData[`!launch_darkly_${t}`]=(r[t]??0)+1),!0)}catch(t){return t instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",t),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(Se);const ee=new class{constructor(){q(this,"_optimizelyData",{})}setOptimizelyExperiment(r,t=!0){if(!r||typeof r!="object")return!1;const{experiments:o}=r;try{return t&&Object.keys(this._optimizelyData).map(a=>{delete this._optimizelyData[a]}),o&&o.map(a=>{const{id:e,variation:n}=a,s=this.transformExperimentId(e);n&&typeof n=="string"&&(this._optimizelyData[s]=n)}),!0}catch(a){return a instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",a),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(r){return this._optimizelyData[this.transformExperimentId(r)]}transformExperimentId(r){return"!optimizely_experiments_"+r}getAndSetWebOptimizelyExperiments(){var r;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const t=(r=window.optimizely.get("state"))==null?void 0:r.getExperimentStates({isActive:!0});if(t){const o=Object.keys(t).map(a=>{var e,n;return(e=t[a].variation)!=null&&e.name?{id:a,variation:(n=t[a].variation)==null?void 0:n.name}:{id:a,variation:"Original"}});return this.setOptimizelyExperiment({experiments:o},!1),!0}return!1}return!1}catch(t){return t instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",t),!1}}};Object.freeze(ee);class Ut{constructor(t,o){q(this,"paused");q(this,"queue");q(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(o)}flush(t){const o=t.length;if(o)for(let a=0;a<o;a++)this.push(t[a])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const o=Array.prototype.slice.call(t,1),a=t[0],e=this.ul[a];e instanceof Function?e.apply(this.ul,o):a&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",a)}}perform(t){if(this.paused){let o=()=>{};const a=new Promise(function(e){o=function(){e(t())}});return this.queue.push(o),a}return t()}empty(){this.queue.length=0}}let it,nt;const be=r=>{let t=0,o=r.firstElementChild;for(;o;)t+=be(o),o.shadowRoot&&(t+=be(o.shadowRoot)),o=o.nextElementSibling,t++;return t},Be=()=>{it.report(be(document.body)),nt.report(document.documentElement.innerHTML.length)},Le=(r,t)=>{const o=performance.now();document.hidden?setTimeout(()=>Le(r,t),r):setTimeout(()=>{const a=performance.now()-o;t.report(a/1e3),setTimeout(()=>Le(r,t),r)},0)};let ie,ne,oe,se,We,F={};const Z=(r,t=1)=>{const{name:o}=r;F[o]=(F[o]||0)+t},ot=r=>{let t=1;return r.childNodes.forEach(o=>{t+=ot(o)}),t},ze=r=>{let t=0;return r.forEach(o=>{t+=ot(o)}),t},Et=r=>{switch(r.type){case"childList":return Z(ie,ze(r.addedNodes)),void Z(ne,ze(r.removedNodes));case"attributes":return void Z(oe);case"characterData":return void Z(se)}},It=r=>r.forEach(Et),kt=()=>{ie.report(F[ie.name]||0),ne.report(F[ne.name]||0),oe.report(F[oe.name]||0),se.report(F[se.name]||0),F={}},Rt=(r=1e3)=>{ie=i.registerMetric("sdk_mutations_nodes_added"),ne=i.registerMetric("sdk_mutations_nodes_removed"),oe=i.registerMetric("sdk_mutations_attributes_changed"),se=i.registerMetric("sdk_mutations_character_data"),We=new MutationObserver(It),We.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(kt,r)},_t=({isWeb:r,reportingIntervalSeconds:t,thresholds:o,postMetrics:a})=>{i.registerThresholds(o,(e,n)=>{var s,d;if((s=i.modules.replay)!=null&&s.isReplayRecording()){const p=`Value: ${e} on ${n.metric} violated threshold of ${n.type} ${n.value}`;(d=i.modules.replay)==null||d.disableRecording("Threshold violated",new Error(p),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:n.metric,type:n.type,value:n.value},{metricName:n.metric}),i.disableThresholdChecking()}}),i.initPerformanceReporting({reportingIntervalSeconds:t,postMetrics:a}),r&&(((e=1e3)=>{const n=i.registerMetric("sdk_event_queue_latency_seconds");Le(e,n)})(),((e=1e4)=>{it=i.registerMetric("sdk_dom_nodes_count"),nt=i.registerMetric("sdk_page_html_characters"),Be(),setInterval(Be,e)})(),Rt())},Dt="test",xt=["popState","pushState","replaceState"];let Re,G;const ae={},B="!email",st="pageUrl";let ye=window.location.href;function K(r){var d,p;const{pageUrlEvents:t,interactiveEvents:o,dismissOnPageChange:a,platform:e}=window.UserLeap._config;if(e&&e!=="web")return;ye!==window.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:ye,to:window.location.href}),ye=window.location.href;const n=lt().trackStartUrl,s=n?String(n):null;t&&ct(window.location.href),o&&(dt(),At()),Xe()&&(()=>{if(te())return;const c=N();c&&(i.checkUrlStillMatching($)||(c.remove(),$=null,f=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((p=(d=i.modules.replay)==null?void 0:d.checkPendingHeatmapsUrl())==null||p.then(c=>{var l;c&&((l=i.modules.replay)==null||l.uploadReadyPendingCaptures(!0))})),!te()&&a&&s&&s!==window.location.href&&r&&xt.includes(r.type)&&window.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const at={capture:!0},At=()=>{const r=window.UserLeap._config.interactiveEvents.filter(o=>i.checkUrlMatch(o,window.location.href)).map(o=>{const{name:a,properties:e}=o,{selector:n,innerText:s}=e;return n?d=>{if(je(d.target))try{d.target.closest(n)&&window.UserLeap("track",a)}catch{}return!1}:d=>(je(d.target)&&d.target.innerText===s&&window.UserLeap("track",a),!1)}),t=o=>r.forEach(a=>a(o));window.UserLeap._config.interactiveEventsHandler=t,window.addEventListener("click",t,at)},dt=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,at),delete window.UserLeap._config.interactiveEventsHandler};function lt(){const r=i.localStorageHelper.getItemObject("userleap.ids");return r&&r[window.UserLeap.envId]||{}}function pt(){if(window.previewMode)return;const r=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map")||{},t=r[window.UserLeap.envId];window.UserLeap.visitorId=t||i.v4(),i.breadcrumbsLogger.info("NewVid",{vid:window.UserLeap.visitorId}),R("vid",window.UserLeap.visitorId),t||(r[window.UserLeap.envId]=window.UserLeap.visitorId,i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",r)),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}function ct(r,t,o,a){var e,n;try{if(r.endsWith("mock_snippet.html"))return;i.breadcrumbsLogger.info("PageView",{url:r});const s=(e=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:e.getAttribute("content");(n=i.modules.replay)==null||n.RecordPageView({...s&&{description:s},url:r,referrer:document.referrer,pageTitle:document.title});const d=window.UserLeap._config.pageUrlEvents;let p=!1;if(d&&d.length)for(let l=0;l<d.length&&(p=i.checkUrlMatch(d[l],r),!p);l++);if(!p)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",r);const c={url:r};a&&(c.trackPageView=!0),window.UserLeap._queue.push(["track",st,t,c,o])}catch(s){s instanceof Error&&(s.stack=r,window.UserLeap.reportError("trackPageView",s)),console.warn("[Sprig] (ERR-428) Failed to track page view",s)}}function Ot(){const r="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in r&&(r.pushState=(t=>function(...o){const a=t.apply(this,o),e=new Event("pushState");return window.dispatchEvent(e),K(e),a})(r.pushState)),"replaceState"in r&&(r.replaceState=(t=>function(...o){const a=t.apply(this,o),e=new Event("replaceState");return window.dispatchEvent(e),K(e),a})(r.replaceState)),["hashchange","popstate"].forEach(t=>window.addEventListener(t,K,!0))}async function ve(r,t){const o=Ee();r&&!t&&(window.UserLeap._config.mode=Dt);const a=le(i.getHttpHeaders(window.UserLeap)),e=await A(function(n){const s=new URL(D("1",[T],"questions"));return Object.entries(n||{}).forEach(([d,p])=>{p&&s.searchParams.append(d,String(p))}),s.toString()}({desktopDisplay:window.UserLeap._config.desktopDisplay,isMobile:a,previewLanguage:window.UserLeap._config.previewLanguage,surveyid:r==null?void 0:r.surveyId,surveytemplateid:r==null?void 0:r.surveyTemplateId,vid:o}),{shouldDropOnRateLimit:!0});if(!e.ok)return e.reportError&&e.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",e.error),window.UserLeap.reportError("getQuestions",e.error)),{success:!1,surveyState:"no survey"};if(e.json.delay&&await i.delay(e.json.delay),!e.json.isFeedback)return z(e.json,G,Re);{const{feedbackLabel:n,productConfig:s,surveyUuid:d,feedbackCustomStyles:p}=e.json,{buttonTheme:c,placement:l,desktopDisplay:u}=s;rt({customStyles:p,buttonTheme:c,desktopDisplay:u,eventId:0,feedbackLabel:n,placement:l,surveyUuid:d,surveyId:r==null?void 0:r.surveyId},e.json)}}function Ct(r){if(!r)return;window.UserLeap._config=r,r.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:o,dismissOnPageChange:a}=r;t&&function(e){let n=e.length;for(;n;){const s=Math.floor(Math.random()*n);n-=1;const d=e[n];e[n]=e[s],e[s]=d}}(t),(t||o||a)&&(Ot(),K())}const Pt=function(r){if(!window.UserLeap)return;const t=async(e={})=>{var h,v,S,E,k;const{userId:n,anonymousId:s,metadata:d={},properties:p,showSurveyCallback:c}=e;let{eventName:l}=e;if(window.UserLeap.debugMode&&l!==st&&console.info("[DEBUG] Sprig track",e),r.mode==="test")return;const u=i.localStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const L="[Sprig] - Skipping tracking without userId";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(!l||l.trim().length===0){l=l?String(l):"";const L="[Sprig] - Invalid event name "+l;return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}const m=G??window.location.href;d.url||(d.url=m),R("trackStartUrl",m),(v=(h=window.UserLeap)==null?void 0:h._config)!=null&&v.optimizelyEnabled&&(J(i.getHttpHeaders(window.UserLeap))||ee.getAndSetWebOptimizelyExperiments(),d.optimizelyExperiments=Object.assign({},ee.getAllOptimizelyExperiments())),(E=(S=window.UserLeap)==null?void 0:S._config)!=null&&E.launchDarklyEnabled&&(d.launchDarklyFlags=Se.getAllLaunchDarklyVariations()),n&&(window.UserLeap.userId=n),s&&(window.UserLeap.partnerAnonymousId=s),p&&(d.eventProperties=p),(k=i.modules.replay)==null||k.RecordEvent({name:l,url:d.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:l});const g=window.UserLeap.delayingSurvey||Ze()?await A(D("1",[H],"events/batch"),{body:JSON.stringify({events:[{event:l,metadata:d}],previewKey:u}),method:"POST",shouldDropOnRateLimit:!0}):await A(D("1",[H],"events"),{body:JSON.stringify({event:l,metadata:d,previewKey:u}),method:"POST",shouldDropOnRateLimit:!0});if(!g.ok){const L="[Sprig] (ERR-421) Failed to track event";return g.reportError&&(console.warn(L,g.error),g.error&&window.UserLeap.reportError("track",g.error)),{success:!1,message:L,error:g.error,surveyState:"no survey"}}n&&R("uid",n),s&&R("aid",s);const w=g.json;w.invalidPreviewKey&&i.localStorageHelper.removeItem("sprig.previewKey");const U=d.trackPageView?d.url:void 0;return w!=null&&w.feedbackButton&&rt(w.feedbackButton,void 0,U),await async function(L,C){var P,I;let _=!0;return!(C&&((P=L==null?void 0:L.json)!=null&&P.surveyId)&&(window.UserLeap.delayingSurvey=!0,_=await C(L.json.surveyId),window.UserLeap.delayingSurvey=!1,!_))&&((I=L==null?void 0:L.json)!=null&&I.delay&&!window.UserLeap.isMobileSDK&&(window.UserLeap.delayingSurvey=!0,await i.delay(L.json.delay),window.UserLeap.delayingSurvey=!1),_)}(g,c)?function(L){if(!window.UserLeap._config.dismissOnPageChange)return!0;const C=new URL(L),_=new URL(G??window.location.href);return C.hostname===_.hostname&&C.pathname===_.pathname}(m)?z(w,U,Re):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},o=(e,n)=>{var d;const s=(d=e==null?void 0:e.querySelector(`[id="${Ie}"]`))==null?void 0:d.contentDocument;s&&Q({document:s,elementId:"ul-custom-style",styleString:n})},a={displaySurvey:async e=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),ve({surveyId:e},!0)),_previewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),ve({surveyTemplateId:e},!1)},_reviewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),ve({surveyId:e},!1)},previewSurvey(e){a._previewSurvey(e)},reviewSurvey(e){a._reviewSurvey(e)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(e=i.DismissReason.API){window.UserLeap.container&&(e===i.DismissReason.Closed&&window.Sprig.trackHistory&&window.Sprig.trackHistory({event:"closed"}),i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},async setAttribute(e,n){if(!e||!n&&n!==0&&n!==!1){const s="[Sprig] - Disregarding empty attribute / value provided";return console.warn(s),{success:!1,message:s}}return this.setAttributes({[e]:n})},async setAttributes(e){if(e==null||Object.keys(e).length===0){const n="[Sprig] - Disregarding empty attributes provided";return console.warn(n),{success:!1,message:n}}return this.identifyAndSetAttributes({attributes:e})},async identifyAndSetAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",e),r.mode==="test")return;if(e===null||typeof e!="object"||!(e.userId||e.anonymousId||e.attributes)){const l="[Sprig] - Disregarding empty payload provided";return console.warn(l),{success:!1,message:l}}const{userId:n,anonymousId:s,attributes:d}=e;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const l="[Sprig] - Skipping tracking without userId";return console.warn(l),{success:!1,message:l}}if(d){d.email&&!d[B]&&(d[B]=d.email,delete d.email);const l=Object.keys(d);for(const u of l)d[u]===ae[u]&&delete d[u]}if(!(d&&Object.keys(d).length!==0||n&&window.UserLeap.userId!==n||s&&window.UserLeap.partnerAnonymousId!==s))return{success:!0};const p={};let c;return n&&(p.userId=window.UserLeap.userId=n),s&&(p.partnerAnonymousId=window.UserLeap.partnerAnonymousId=s),d&&Object.keys(d).length>0?(c=await A(D("1",[T,H],"attributes"),{body:JSON.stringify(d),method:"PUT"}),c.ok?Object.assign(ae,d):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await A(D("1",[T,H]),{body:JSON.stringify(p),method:"PUT"}),d&&d[B]&&(window.UserLeap.email=d[B]),c.ok&&(n&&R("uid",n),s&&R("aid",s)),{success:!!c.ok}},async removeAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",e),r.mode==="test")return;if(e==null||e.length===0){const s="[Sprig] - Disregarding empty attributes provided";return console.warn(s),{success:!1,message:s}}if(r.requireUserIdForTracking&&!window.UserLeap.userId){const s="[Sprig] - Skipping tracking without userId";return console.warn(s),{success:!1,message:s}}const n=await A(D("1",[T,H],"attributes"),{body:JSON.stringify({delete:e}),method:"DELETE"});return!n.ok&&n.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",n.error),n.error&&window.UserLeap.reportError("removeAttributes",n.error)),{success:!!n.ok}},async addSurveyListener(e){i.eventEmitter.on(i.SprigEvent.SurveyLifeCycle,e)},async removeSurveyListener(e){i.eventEmitter.removeListener(i.SprigEvent.SurveyLifeCycle,e)},async addListener(e,n){i.eventEmitter.on(e,n)},async removeListener(e,n){i.eventEmitter.removeListener(e,n)},async removeAllListeners(){i.eventEmitter.removeAllListeners()},setPreviewKey(e){e&&typeof e=="string"&&i.localStorageHelper.isStorageAvailable&&e&&i.localStorageHelper.setItem("sprig.previewKey",e)},async setUserId(e){var d;if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",e),e==null){const p=`[Sprig] - Invalid userId ${e}`;return console.warn(p),{success:!1,message:p}}if(r.mode==="test"||e===window.UserLeap.userId)return;window.UserLeap.userId=e;const n=window.UserLeap.visitorId,s=await A(D("1",[T,H]),{body:JSON.stringify({userId:e}),method:"PUT"});s.ok?(n!==window.UserLeap.visitorId&&((d=i.modules.replay)==null||d.clearUserReplayData()),R("uid",e)):s.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",s.error),s.error&&window.UserLeap.reportError("setUserId",s.error))},async setPartnerAnonymousId(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",e),e==null){const n=`[Sprig] - Invalid partnerAnonymousId ${e}`;return console.warn(n),{success:!1,message:n}}return window.UserLeap.partnerAnonymousId=e,R("aid",e),{success:!0}},track:async(e,n,s={},d=void 0)=>t({eventName:e,properties:n,metadata:s,showSurveyCallback:d}),identifyAndTrack:async e=>await t(e),trackPageView(e,n=void 0,s=void 0,d=!0){G=e,ct(e,n,s,d)},applyFeedbackStyles({button:e="",view:n=""}){window.UserLeap.feedbackCustomStyles=n,document.getElementById("sprig-feedback-style")&&Q({document,elementId:"ul-custom-style",styleString:e,nonce:window.UserLeap.styleNonce}),o(document.querySelector(".ul-container-feedback"),n)},applyStyles(e){window.UserLeap.customStyles=e,o(window.UserLeap.container,e)},setWindowDimensions(e,n){var m,g;const s=typeof e=="string"?parseInt(e,10):e,d=typeof n=="string"?parseInt(n,10):n;isNaN(s)||isNaN(d)||(window.UserLeap.windowDimensions={width:s,height:d});const p=i.getHttpHeaders(window.UserLeap),c=le(p),l=p["userleap-platform"]==="web";if(!window.UserLeap.frameId)return;const u=document.getElementById(window.UserLeap.frameId);u&&(window.UserLeap.useMobileStyling&&((m=window.UserLeap.windowDimensions)!=null&&m.width&&(u.style.width=`${window.UserLeap.windowDimensions.width}px`),(g=window.UserLeap.windowDimensions)!=null&&g.height&&(u.style.maxHeight=window.UserLeap.windowDimensions.height-20+"px"),u.contentDocument&&(u.style.height=String(Ye(u.contentDocument,l&&!c,i.shouldDirectEmbed(p))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:u.clientWidth,contentFrameHeight:u.clientHeight,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},logoutUser(){var e;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),i.breadcrumbsLogger.info("LogOut",{vid:window.UserLeap.visitorId,userId:window.UserLeap.userId}),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,i.localStorageHelper.removeItem("userleap.ids"),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),pt(),(e=i.modules.replay)==null||e.clearUserReplayData(),window.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,K,!0)),window.UserLeap._config.interactiveEvents&&dt(),window.UserLeap("dismissActiveSurvey",i.DismissReason.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(e,n=!0){var s,d;if((d=(s=window.UserLeap)==null?void 0:s._config)!=null&&d.optimizelyEnabled)try{const p=typeof e=="string"?JSON.parse(e):e;ee.setOptimizelyExperiment(p,n)}catch(p){console.warn("[Sprig] Error with integrating Optimizely data"),p instanceof Error&&window.UserLeap.reportError("integrateOptimizely",p)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(e){var n,s;if(!((s=(n=window.UserLeap)==null?void 0:n._config)!=null&&s.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:d,variation:p})=>{const c={experiments:[{id:d.id,variation:p.key}]};window.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(e){var n,s;(s=(n=window.UserLeap)==null?void 0:n._config)!=null&&s.launchDarklyEnabled?Se.setLDFlagsVariations(e):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(e,n)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),a.setAttribute(e,n)),setEmail:async e=>a.setAttribute(B,e),setVisitorEmail:async e=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),a.setEmail(e)),_generateVideoUploadUrl:async e=>async function(n){var d;if(!n)return;const s=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const p=await fetch(s,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(p.ok){const c=await p.json();return(d=c==null?void 0:c.upload)==null?void 0:d.url}return null}catch(p){console.warn("[Sprig] Error with generating video upload url"),p instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",p)}}(e),_reportMetric(e,n){i.reportAndRegister(e,n)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:n,eventDigest:s})=>{var d;return i.modules.replay?(d=i.modules.replay)==null?void 0:d._completeSessionReplay({surveyId:e,responseGroupUuid:n,eventDigest:s,headers:i.getHttpHeaders(window.UserLeap)}):(window.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var e,n,s,d;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)||((d=(s=i.modules.replay)==null?void 0:s.recordReplayPaused)==null||d.call(s))},resumeReplayRecording(){var e,n,s,d,p,c;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)&&((d=(s=i.modules.replay)==null?void 0:s.recordReplayResumed)==null||d.call(s),(c=(p=i.modules.replay)==null?void 0:p.recordFullSnapshot)==null||c.call(p))}};Object.assign(window.UserLeap,a)};async function Ht(r,t,o={},a={}){const e=window.__cfg&&window.__cfg.mode,n=Ee(),s=window.UserLeap.envId,d=window.document.documentElement,p={mode:e,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:G??window.location.href,language:window.navigator.language,...o},c={action:r,breadcrumbs:i.breadcrumbsLogger.breadcrumbs,err:{message:`${t==null?void 0:t.name} - ${t==null?void 0:t.message}`,stack:t==null?void 0:t.stack},meta:p,vid:n,envId:s,...a};(await A(D("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Tt(r={}){var a;(a=window.SprigLoggerCallback)==null||a.call(window,"Initializing Sprig");const t=new URLSearchParams(window.location.search).get("sprigPreviewKey")??"";async function o(){var u,m,g,w,U;if(window.UserLeap.loaded)return;if((u=window.SprigLoggerCallback)==null||u.call(window,"Loading Sprig"),window.UserLeap.reportError=Ht,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},r,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const y in window.UserLeap._config)window.UserLeap[y]=window.UserLeap._config[y];if(window.Sprig.outstandingTransactionLimit!==void 0&&(r.outstandingTransactionLimit=window.Sprig.outstandingTransactionLimit),!window.UserLeap.envId){if(!window.UserLeap.appId)throw new Error("Missing Environment id");window.UserLeap.envId=window.UserLeap.appId}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const e=lt(),n=window.UserLeap.sampleRate;let s=e.sampled;if(n){if(s===null&&(s=Math.random()<n,R("sampled",s)),!s)return}else s!==null&&R("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const d=[...window.UserLeap._queue];window.UserLeap._queue=new Ut(window.UserLeap,[]),window.UserLeap._queue.pause();for(let y=0;y<d.length;y++)window.UserLeap._queue.push(d[y]);const p=e.token;p?(window.UserLeap.token=p,window.UserLeap.visitorId=e.vid??null,window.UserLeap.userId=e.uid??null,window.UserLeap.partnerAnonymousId=e.aid??null):pt();const c=J(i.getHttpHeaders(window.UserLeap));(m=window.SprigLoggerCallback)==null||m.call(window,"Sprig fetching config");const l=await async function(y){var E,k;const h=i.getHttpHeaders(window.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const v=await i.sprigFetch(D("1",[T],"config"),{headers:h});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!v.ok)return(E=window.SprigLoggerCallback)==null||E.call(window,"Sprig config fetch failed"),v.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",v.error),v.error&&window.UserLeap.reportError("applyRemoteConfig",v.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),y;const S=v.json;return S!=null&&S.disabled?((k=window.SprigLoggerCallback)==null||k.call(window,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${S.disabled}`),{disabled:S.disabled}):Object.assign({},S,y)}(r);if((g=window.SprigLoggerCallback)==null||g.call(window,"Sprig fetched config"),_t({isWeb:!c,reportingIntervalSeconds:l.metricsReportingEnabled||l.mobileMetricsReportingEnabled?l.metricsReportingIntervalSeconds:0,thresholds:l.metricThresholds,postMetrics:async y=>{var h;await A(D("1",[T],"metrics"),{body:y,method:"POST",headers:{"x-ul-replay-enabled":`${!!((h=i.modules.replay)!=null&&h.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const y=l.alwaysOnReplay?{userAgent:window.navigator.userAgent,surveyId:l.alwaysOnReplay.surveyId,responseGroupUuid:l.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.39.2",maxDurationSeconds:l.alwaysOnReplay.maxDurationSeconds}:void 0;await((w=i.modules.replay)==null?void 0:w.initializeReplay({maxReplayDurationSeconds:l.maxReplayDurationSeconds,maxInflightRequests:window.UserLeap.maxInflightReplayRequests??2,replaySettings:l.replaySettings,apiUrl:window.UserLeap._API_URL,alwaysOnConfig:y})),Re=l.replaySettings}Pt(l),await Ct(l),window.UserLeap._queue.unpause(),(U=window.SprigLoggerCallback)==null||U.call(window,"SdkReady"),i.eventEmitter.emit(i.SprigEvent.SDKReady,{mobileMetricsReportingEnabled:!!l.mobileMetricsReportingEnabled,metricsReportingInterval:l.metricsReportingIntervalSeconds||0,metricsThresholds:l.metricThresholds||[],maxMobileReplayDurationSeconds:l.maxMobileReplayDurationSeconds,mobileReplaySettings:l.mobileReplaySettings}),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}),i.eventEmitter.on(i.SprigEvent.VisitorIDUpdated,()=>{for(const y in ae)delete ae[y]})}window.UserLeap.UPDATES=i.EVENTS,window.UserLeap("setPreviewKey",t),document.readyState==="complete"?o():window.attachEvent?window.attachEvent("onload",o):window.addEventListener("load",()=>{o()},!1)}class de{constructor(){q(this,"UPDATES",i.EVENTS)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,o){window.Sprig("setAttribute",t,o)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,o){window.Sprig("addListener",t,o)}removeListener(t,o){window.Sprig("removeListener",t,o)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,o={},a={}){window.Sprig("track",t,o,a)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,o,a){window.Sprig("trackPageView",t,o,a)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,o){window.Sprig("setWindowDimensions",t,o)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}pauseReplayRecording(){window.Sprig("pauseReplayRecording")}resumeReplayRecording(){window.Sprig("resumeReplayRecording")}}const Ue={configure:r=>{if(!r.envId&&!r.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(r.envId||(r.envId=r.environmentId??""),r.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(de.prototype).map(o=>{o!=="constructor"&&(window.Sprig[o]=de.prototype[o])});const t=window.Sprig;return t.appId=r.envId,t._queue=[],window.UserLeap=t,Tt(r),window.Sprig}},Mt={sprig:Ue,SprigAPI:de,configure:Ue.configure};exports.APP_ID="ul-app",exports.ConflictingWidgets=$e,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.SprigAPI=de,exports.calculateFrameDimensions=Ye,exports.core=Mt,exports.isHTMLElement=x,exports.resetScrollPosition=r=>{const t=r.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=Q,exports.sprig=Ue;