@sprig-technologies/sprig-browser 2.34.2 → 2.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{core-B84vH8bq.cjs → core-CGgKmpNf.cjs} +2 -2
- package/dist/{core-9nFfVPj6.js → core-De2JxeSJ.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-BzXI6BiM.js → metricsReporter-BJVpNufn.js} +1 -1
- package/dist/{metricsReporter-Dy3EDEs8.cjs → metricsReporter-BvLxSPGb.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{view-DJLfkjCB.cjs → view-CCKqaqND.cjs} +2 -2
- package/dist/{view-CDp4O3a5.js → view-kh2hxG3p.js} +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ct=Object.defineProperty;var ut=(r,t,o)=>t in r?ct(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var M=(r,t,o)=>ut(r,typeof t!="symbol"?t+"":t,o);const i=require("./metricsReporter-Dy3EDEs8.cjs"),Ce=()=>{try{return window.parent.Intercom}catch{return null}},He=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=Ce();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=Ce();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class We{static disable(){He.forEach(t=>t.disable())}static enable(){He.forEach(t=>t.enable())}}const Te="ul-view-sdk-script",wt=["ios","android"],P="visitors",C="environments";async function x(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"),u=p?p.split(" "):void 0,l=u&&u.length===2?u[1]:void 0,c=(s=e.headers)==null?void 0:s.get("x-ul-visitor-id");if(window.UserLeap.userId&&c===window.UserLeap.visitorId){const g=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");g&&g[window.UserLeap.envId]===c&&(delete g[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",g))}l&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==l)&&(k("token",l),k("vid",c),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=l,window.UserLeap.visitorId=c)}return(d=e.json)!=null&&d.logMessage&&console.warn(`[Sprig] ${e.json.logMessage}`),e}function k(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 Le(){return window.previewMode?"0":window.UserLeap.visitorId??""}function _(r,t,o){const a=[window.UserLeap._API_URL,"sdk",r];return t&&t.forEach(e=>{a.push(e),e===C?a.push(window.UserLeap.envId):e===P&&a.push(Le())}),o&&a.push(o),a.join("/")}const z=async(r,t,o)=>{var xe,Ae,Oe;const{context:a,delay:e,forceBrandedLogo:n,endCard:s,isFeedback:d=!1,heatmap:p,locale:u,previewMode:l,productConfig:c,questions:g,responseGroupUid:m,surveyId:w,uuid:E,vid:y,sessionReplay:v,studyType:S}=r,h=i.getHttpHeaders(window.UserLeap),I=J(h),O=ae(h);if(v)if(I)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:m,hasQuestions:!!(g!=null&&g.length),surveyId:w,uploadId:v.uploadId,replayType:v.replayDurationType??"before",seconds:v.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:m,surveyId:w,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:m,surveyId:w,visitorId:y,replayParams:v,completeUploadHeaders:h,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:g.length===0})}if(p){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:L,replayParams:N,responseGroupUid:pe,surveyId:ce}=p;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 Pe;return(Pe=i.modules.replay)==null?void 0:Pe.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:h,eventId:L,isHeatmap:!0,replayParams:N,responseGroupId:pe,surveyId:ce,triggerTimestamp:Date.now(),visitorId:y})},"Error in scheduling/capturing replay")}if(y==null||!(g!=null&&g.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:y}),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const L="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(y!==window.UserLeap.visitorId&&E!==window.UserLeap.visitorId&&!window.previewMode){const L="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(L)),{success:!1,message:L,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:w}),(xe=i.modules.replay)==null||xe.RecordSurveyShown({id:w,userAgent:window.navigator.userAgent}),We.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":w});let b,R,U,H,T=document.createElement("div");const ke=L=>{const{"view.version":N}=L;N!==h["x-ul-sdk-version"]&&$e(),i.eventEmitter.removeListener("verify.view.version",ke)};i.eventEmitter.on("verify.view.version",ke),window.UserLeap.useMobileStyling=O,i.shouldDirectEmbed(h)?(b="ul-direct-embeded-frame",R=document.head,U=window,H=!1,(()=>{const L=i.getHttpHeaders(window.UserLeap),N=J(L),pe=window.UserLeap.forceDirectEmbed,ce=L["userleap-platform"]==="web";return N||pe&&ce})()&&(ze(w,d),T.id=b,window.UserLeap.container.appendChild(T),Ge(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":w}))):{frameId:b,contentWinDocHead:R,contentWindow:U,hasOverlay:H,iframe:T}=mt({productConfig:c,useMobileStyling:O,surveyId:w,isFeedback:d}),window.UserLeap.frameId=b;const F={apiURL:window.UserLeap._API_URL,cards:g,configureExitOnOverlayClick:L=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,L)},context:a,endCard:s,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:n,frame:T,headers:h,locale:u,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.localStorageHelper.getItem("sprig.previewKey"),previewMode:l,productConfig:{framePosition:c==null?void 0:c.framePosition,desktopDisplay:c==null?void 0:c.desktopDisplay,placement:c==null?void 0:c.placement},responseGroupUid:m,startingQuestionIdx:(Ae=window.UserLeap.config)==null?void 0:Ae.startingQuestionIdx,studyType:S,styleNonce:window.UserLeap.styleNonce,surveyId:w,tabTitle:document.title,trackPageViewUrl:t,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:O,userId:E,viewDocument:U==null?void 0:U.document,viewWindow:U,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},...window.UserLeap._config};(Oe=window.UserLeap._config)!=null&&Oe.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const pt=(d?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??c.customStyles;F.customStyles=pt,U&&(U.__cfg=F);const de=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:F.path,Re=document.getElementById(Te);Re&&Re.remove();const le=function(){const L=document.createElement("script");return window.UserLeap.nonce&&L.setAttribute("nonce",window.UserLeap.nonce),L.id=Te,L}(),_e=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(F.installationMethod==="web-npm"||F.installationMethod==="web-npm-bundled"){const{default:L}=await Promise.resolve().then(()=>require("./view-DJLfkjCB.cjs"));L.configure(F),H&&window.UserLeap.container&&_e()}else de&&(le.src=de,H&&le.addEventListener("load",()=>{window.UserLeap.container&&_e()}),U==null||U.addEventListener("error",L=>{L.target instanceof HTMLScriptElement&&L.target.src===de&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));R==null||R.appendChild(le);const De={success:!0,surveyState:"ready",surveyId:w,responseGroupUid:m};return window.UserLeap.isMobileSDK&&e&&(De.delay=e),De};function ae(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 wt.includes(r["userleap-platform"])}const Ue="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 ue="0px",ze=(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=Qe();o&&a&&!window.UserLeap.useMobileStyling?a.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},$e=(r,t)=>{var a;vt();const o=window.UserLeap.container;if(o)try{(a=o.parentNode)==null||a.removeChild(o),window.UserLeap.container=null,k("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)}},Ge=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:t})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),$e(r,t)})},gt=(r,t,o,a)=>{var l,c;const e={position:"fixed",bottom:"0px",right:ue,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"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 u=!1;if(o)(l=window.UserLeap.windowDimensions)!=null&&l.width?e.width=`${window.UserLeap.windowDimensions.width}px`:e.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.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)&&(u=!0);else{e.width="360px",e.maxHeight=window.UserLeap.maxHeight||"66vh";const g=()=>{u=!0,p={margin:"auto",position:"static"}};if(a)d?g():p={position:"relative",height:"300px"};else switch(n.framePosition){case"bottomLeft":p={left:ue};break;case"topLeft":p={left:ue,top:0};break;case"topRight":p={top:0};break;case"center":g()}}return u&&((g,m)=>{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},E=m?g.overlayStyleMobile:g.overlayStyle;w["background-color"]=E==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",m||(w.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,w)})(n,o),Object.assign(r.style,e,p),u},mt=({productConfig:r,useMobileStyling:t,surveyId:o,isFeedback:a})=>{var g,m;const e=Ue,n=a&&r.desktopDisplay==="slider";ze(o,a,n),yt();const s=document.createElement("iframe");s.id=e,s.setAttribute("title","Sprig User Feedback Dialog");const d=gt(s,r,t,a);Ge();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 u=!1;s.setWidth=w=>{parseInt(s.style.width)==w&&u||(u=!0,s.style.width=`${w}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:w,"survey.id":o}))},(g=window.UserLeap.container)==null||g.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=(m=s.contentWindow)==null?void 0:m.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 c=l==null?void 0:l.head;return{frameId:e,contentWinDocHead:c,contentWindow:s.contentWindow,hasOverlay:d,iframe:s}},Ke={[i.SprigEvent.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},yt=()=>{Object.entries(Ke).forEach(([r,t])=>{i.eventEmitter.on(r,t)})},vt=()=>{Object.entries(Ke).forEach(([r,t])=>{i.eventEmitter.off(r,t)})},D=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Me=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)},ft=(r,t)=>{const o=t.querySelector(".sprig-question-body");if(!D(o))return r;const a=o.scrollHeight;return a<100?r:r-(a-100)},qe=(r,t)=>{const o=t.querySelector(r);if(!D(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))},Je=(r,t,o)=>{const a=r.querySelector(".ul-card__container"),e=r.querySelector(".ul-app");let n=600,s=360,d=0;if(D(a)&&D(e)){const p=a.querySelector(".ul-card--matrix_grid"),u=!p&&t&&o;try{u&&(e.style.width="360px"),n=a.clientHeight,n+=(g=>{const m=g.querySelector(".sprig-question-body"),w=g.querySelector(".ul-card"),E=g.querySelector(".ul-card-main-content"),y=g.querySelector(".ul-footer"),v=g.querySelector(".sprig-container");let S=0;return D(w)&&(S+=w.scrollHeight-w.clientHeight),D(E)&&(S+=E.scrollHeight-E.clientHeight),D(m)&&(S+=m.scrollHeight-m.clientHeight),D(y)&&D(v)&&v.clientHeight===0&&(S+=y.clientHeight),S})(r);const l=getComputedStyle(a);d=n;const c=parseFloat(l.marginTop)+parseFloat(l.marginBottom);n+=c+(parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth)),p&&(s=p.scrollWidth,s+=qe(".ul-card__container",r),s+=qe(".sprig-question-body",r))}finally{u&&e.style.removeProperty("width")}}return[n+1,s,ft(d,r)]},Qe=()=>f,V=()=>document.getElementById("sprig-feedback-container"),ye=()=>document.getElementById("sprig-feedback-loading-animation"),Ye=()=>!!document.getElementById(Ue);let je=!1,f=null,A=null,Ee=!1,$=null,q=null;const ht=["bottom-left","bottom-right","center-left","center-right"],Z=()=>{var t;const r=window.UserLeap.container;return((t=r==null?void 0:r.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},Xe=()=>document.getElementById("sprig-feedback-error-container"),Ze=()=>{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")},ee=r=>{const t=V();t&&(q!=null&&q.endsWith("right")?t.style.right=`${r}px`:q!=null&&q.endsWith("left")&&(t.style.left=`${r}px`))},we=()=>{if(f&&(Z()||Xe())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,W),ve();const r=Ze();return ee(-r),!0}return!1},W=()=>{if(!f||!A)return;const r=ye();r&&r.remove(),f.style.height="auto",f.style.width="auto",A.disabled=!1,Ee=!1},ve=()=>{if(f&&!ye()){const r=(()=>{if(ye())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=`
|
|
1
|
+
"use strict";var ct=Object.defineProperty;var ut=(r,t,o)=>t in r?ct(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var M=(r,t,o)=>ut(r,typeof t!="symbol"?t+"":t,o);const i=require("./metricsReporter-BvLxSPGb.cjs"),Ce=()=>{try{return window.parent.Intercom}catch{return null}},He=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=Ce();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=Ce();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class We{static disable(){He.forEach(t=>t.disable())}static enable(){He.forEach(t=>t.enable())}}const Te="ul-view-sdk-script",wt=["ios","android"],P="visitors",C="environments";async function x(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"),u=p?p.split(" "):void 0,l=u&&u.length===2?u[1]:void 0,c=(s=e.headers)==null?void 0:s.get("x-ul-visitor-id");if(window.UserLeap.userId&&c===window.UserLeap.visitorId){const g=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");g&&g[window.UserLeap.envId]===c&&(delete g[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",g))}l&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==l)&&(k("token",l),k("vid",c),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=l,window.UserLeap.visitorId=c)}return(d=e.json)!=null&&d.logMessage&&console.warn(`[Sprig] ${e.json.logMessage}`),e}function k(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 Le(){return window.previewMode?"0":window.UserLeap.visitorId??""}function _(r,t,o){const a=[window.UserLeap._API_URL,"sdk",r];return t&&t.forEach(e=>{a.push(e),e===C?a.push(window.UserLeap.envId):e===P&&a.push(Le())}),o&&a.push(o),a.join("/")}const z=async(r,t,o)=>{var xe,Ae,Oe;const{context:a,delay:e,forceBrandedLogo:n,endCard:s,isFeedback:d=!1,heatmap:p,locale:u,previewMode:l,productConfig:c,questions:g,responseGroupUid:m,surveyId:w,uuid:E,vid:y,sessionReplay:v,studyType:S}=r,h=i.getHttpHeaders(window.UserLeap),I=J(h),O=ae(h);if(v)if(I)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:m,hasQuestions:!!(g!=null&&g.length),surveyId:w,uploadId:v.uploadId,replayType:v.replayDurationType??"before",seconds:v.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:m,surveyId:w,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:m,surveyId:w,visitorId:y,replayParams:v,completeUploadHeaders:h,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:g.length===0})}if(p){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:L,replayParams:N,responseGroupUid:pe,surveyId:ce}=p;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 Pe;return(Pe=i.modules.replay)==null?void 0:Pe.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:h,eventId:L,isHeatmap:!0,replayParams:N,responseGroupId:pe,surveyId:ce,triggerTimestamp:Date.now(),visitorId:y})},"Error in scheduling/capturing replay")}if(y==null||!(g!=null&&g.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:y}),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const L="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(y!==window.UserLeap.visitorId&&E!==window.UserLeap.visitorId&&!window.previewMode){const L="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(L)),{success:!1,message:L,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:w}),(xe=i.modules.replay)==null||xe.RecordSurveyShown({id:w,userAgent:window.navigator.userAgent}),We.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":w});let b,R,U,H,T=document.createElement("div");const ke=L=>{const{"view.version":N}=L;N!==h["x-ul-sdk-version"]&&$e(),i.eventEmitter.removeListener("verify.view.version",ke)};i.eventEmitter.on("verify.view.version",ke),window.UserLeap.useMobileStyling=O,i.shouldDirectEmbed(h)?(b="ul-direct-embeded-frame",R=document.head,U=window,H=!1,(()=>{const L=i.getHttpHeaders(window.UserLeap),N=J(L),pe=window.UserLeap.forceDirectEmbed,ce=L["userleap-platform"]==="web";return N||pe&&ce})()&&(ze(w,d),T.id=b,window.UserLeap.container.appendChild(T),Ge(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":w}))):{frameId:b,contentWinDocHead:R,contentWindow:U,hasOverlay:H,iframe:T}=mt({productConfig:c,useMobileStyling:O,surveyId:w,isFeedback:d}),window.UserLeap.frameId=b;const F={apiURL:window.UserLeap._API_URL,cards:g,configureExitOnOverlayClick:L=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,L)},context:a,endCard:s,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:n,frame:T,headers:h,locale:u,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.localStorageHelper.getItem("sprig.previewKey"),previewMode:l,productConfig:{framePosition:c==null?void 0:c.framePosition,desktopDisplay:c==null?void 0:c.desktopDisplay,placement:c==null?void 0:c.placement},responseGroupUid:m,startingQuestionIdx:(Ae=window.UserLeap.config)==null?void 0:Ae.startingQuestionIdx,studyType:S,styleNonce:window.UserLeap.styleNonce,surveyId:w,tabTitle:document.title,trackPageViewUrl:t,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:O,userId:E,viewDocument:U==null?void 0:U.document,viewWindow:U,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},...window.UserLeap._config};(Oe=window.UserLeap._config)!=null&&Oe.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const pt=(d?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??c.customStyles;F.customStyles=pt,U&&(U.__cfg=F);const de=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:F.path,Re=document.getElementById(Te);Re&&Re.remove();const le=function(){const L=document.createElement("script");return window.UserLeap.nonce&&L.setAttribute("nonce",window.UserLeap.nonce),L.id=Te,L}(),_e=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(F.installationMethod==="web-npm"||F.installationMethod==="web-npm-bundled"){const{default:L}=await Promise.resolve().then(()=>require("./view-CCKqaqND.cjs"));L.configure(F),H&&window.UserLeap.container&&_e()}else de&&(le.src=de,H&&le.addEventListener("load",()=>{window.UserLeap.container&&_e()}),U==null||U.addEventListener("error",L=>{L.target instanceof HTMLScriptElement&&L.target.src===de&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));R==null||R.appendChild(le);const De={success:!0,surveyState:"ready",surveyId:w,responseGroupUid:m};return window.UserLeap.isMobileSDK&&e&&(De.delay=e),De};function ae(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 wt.includes(r["userleap-platform"])}const Ue="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 ue="0px",ze=(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=Qe();o&&a&&!window.UserLeap.useMobileStyling?a.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},$e=(r,t)=>{var a;vt();const o=window.UserLeap.container;if(o)try{(a=o.parentNode)==null||a.removeChild(o),window.UserLeap.container=null,k("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)}},Ge=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:t})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),$e(r,t)})},gt=(r,t,o,a)=>{var l,c;const e={position:"fixed",bottom:"0px",right:ue,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"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 u=!1;if(o)(l=window.UserLeap.windowDimensions)!=null&&l.width?e.width=`${window.UserLeap.windowDimensions.width}px`:e.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.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)&&(u=!0);else{e.width="360px",e.maxHeight=window.UserLeap.maxHeight||"66vh";const g=()=>{u=!0,p={margin:"auto",position:"static"}};if(a)d?g():p={position:"relative",height:"300px"};else switch(n.framePosition){case"bottomLeft":p={left:ue};break;case"topLeft":p={left:ue,top:0};break;case"topRight":p={top:0};break;case"center":g()}}return u&&((g,m)=>{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},E=m?g.overlayStyleMobile:g.overlayStyle;w["background-color"]=E==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",m||(w.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,w)})(n,o),Object.assign(r.style,e,p),u},mt=({productConfig:r,useMobileStyling:t,surveyId:o,isFeedback:a})=>{var g,m;const e=Ue,n=a&&r.desktopDisplay==="slider";ze(o,a,n),yt();const s=document.createElement("iframe");s.id=e,s.setAttribute("title","Sprig User Feedback Dialog");const d=gt(s,r,t,a);Ge();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 u=!1;s.setWidth=w=>{parseInt(s.style.width)==w&&u||(u=!0,s.style.width=`${w}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:w,"survey.id":o}))},(g=window.UserLeap.container)==null||g.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=(m=s.contentWindow)==null?void 0:m.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 c=l==null?void 0:l.head;return{frameId:e,contentWinDocHead:c,contentWindow:s.contentWindow,hasOverlay:d,iframe:s}},Ke={[i.SprigEvent.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},yt=()=>{Object.entries(Ke).forEach(([r,t])=>{i.eventEmitter.on(r,t)})},vt=()=>{Object.entries(Ke).forEach(([r,t])=>{i.eventEmitter.off(r,t)})},D=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Me=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)},ft=(r,t)=>{const o=t.querySelector(".sprig-question-body");if(!D(o))return r;const a=o.scrollHeight;return a<100?r:r-(a-100)},qe=(r,t)=>{const o=t.querySelector(r);if(!D(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))},Je=(r,t,o)=>{const a=r.querySelector(".ul-card__container"),e=r.querySelector(".ul-app");let n=600,s=360,d=0;if(D(a)&&D(e)){const p=a.querySelector(".ul-card--matrix_grid"),u=!p&&t&&o;try{u&&(e.style.width="360px"),n=a.clientHeight,n+=(g=>{const m=g.querySelector(".sprig-question-body"),w=g.querySelector(".ul-card"),E=g.querySelector(".ul-card-main-content"),y=g.querySelector(".ul-footer"),v=g.querySelector(".sprig-container");let S=0;return D(w)&&(S+=w.scrollHeight-w.clientHeight),D(E)&&(S+=E.scrollHeight-E.clientHeight),D(m)&&(S+=m.scrollHeight-m.clientHeight),D(y)&&D(v)&&v.clientHeight===0&&(S+=y.clientHeight),S})(r);const l=getComputedStyle(a);d=n;const c=parseFloat(l.marginTop)+parseFloat(l.marginBottom);n+=c+(parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth)),p&&(s=p.scrollWidth,s+=qe(".ul-card__container",r),s+=qe(".sprig-question-body",r))}finally{u&&e.style.removeProperty("width")}}return[n+1,s,ft(d,r)]},Qe=()=>f,V=()=>document.getElementById("sprig-feedback-container"),ye=()=>document.getElementById("sprig-feedback-loading-animation"),Ye=()=>!!document.getElementById(Ue);let je=!1,f=null,A=null,Ee=!1,$=null,q=null;const ht=["bottom-left","bottom-right","center-left","center-right"],Z=()=>{var t;const r=window.UserLeap.container;return((t=r==null?void 0:r.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},Xe=()=>document.getElementById("sprig-feedback-error-container"),Ze=()=>{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")},ee=r=>{const t=V();t&&(q!=null&&q.endsWith("right")?t.style.right=`${r}px`:q!=null&&q.endsWith("left")&&(t.style.left=`${r}px`))},we=()=>{if(f&&(Z()||Xe())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,W),ve();const r=Ze();return ee(-r),!0}return!1},W=()=>{if(!f||!A)return;const r=ye();r&&r.remove(),f.style.height="auto",f.style.width="auto",A.disabled=!1,Ee=!1},ve=()=>{if(f&&!ye()){const r=(()=>{if(ye())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
2
|
<div class="ul-loading-spinner">
|
|
3
3
|
<div class="first"></div>
|
|
4
4
|
<div class="second"></div>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
10
10
|
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
11
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},fe=new class{constructor(){M(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(fe);const X=new class{constructor(){M(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(X);class bt{constructor(t,o){M(this,"paused");M(this,"queue");M(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 tt,rt;const he=r=>{let t=0,o=r.firstElementChild;for(;o;)t+=he(o),o.shadowRoot&&(t+=he(o.shadowRoot)),o=o.nextElementSibling,t++;return t},Ve=()=>{tt.report(he(document.body)),rt.report(document.documentElement.innerHTML.length)},Se=(r,t)=>{const o=performance.now();document.hidden?setTimeout(()=>Se(r,t),r):setTimeout(()=>{const a=performance.now()-o;t.report(a/1e3),setTimeout(()=>Se(r,t),r)},0)};let te,re,ie,ne,Ne,j={};const Y=(r,t=1)=>{const{name:o}=r;j[o]=(j[o]||0)+t},it=r=>{let t=1;return r.childNodes.forEach(o=>{t+=it(o)}),t},Be=r=>{let t=0;return r.forEach(o=>{t+=it(o)}),t},Lt=r=>{switch(r.type){case"childList":return Y(te,Be(r.addedNodes)),void Y(re,Be(r.removedNodes));case"attributes":return void Y(ie);case"characterData":return void Y(ne)}},Ut=r=>r.forEach(Lt),Et=()=>{te.report(j[te.name]||0),re.report(j[re.name]||0),ie.report(j[ie.name]||0),ne.report(j[ne.name]||0),j={}},It=(r=1e3)=>{te=i.registerMetric("sdk_mutations_nodes_added"),re=i.registerMetric("sdk_mutations_nodes_removed"),ie=i.registerMetric("sdk_mutations_attributes_changed"),ne=i.registerMetric("sdk_mutations_character_data"),Ne=new MutationObserver(Ut),Ne.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(Et,r)},kt=({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");Se(e,n)})(),((e=1e4)=>{tt=i.registerMetric("sdk_dom_nodes_count"),rt=i.registerMetric("sdk_page_html_characters"),Ve(),setInterval(Ve,e)})(),It())},Rt="test",_t=["popState","pushState","replaceState"];let Ie,G;const oe={},B="!email",nt="pageUrl";let ge=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;ge!==window.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:ge,to:window.location.href}),ge=window.location.href;const n=at().trackStartUrl,s=n?String(n):null;t&<(window.location.href),o&&(st(),Dt()),Qe()&&(()=>{if(Z())return;const u=V();u&&(i.checkUrlStillMatching($)||(u.remove(),$=null,f=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((p=(d=i.modules.replay)==null?void 0:d.checkPendingHeatmapsUrl())==null||p.then(u=>{var l;u&&((l=i.modules.replay)==null||l.uploadReadyPendingCaptures(!0))})),!Z()&&a&&s&&s!==window.location.href&&r&&_t.includes(r.type)&&window.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ot={capture:!0},Dt=()=>{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(Me(d.target))try{d.target.closest(n)&&window.UserLeap("track",a)}catch{}return!1}:d=>(Me(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,ot)},st=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ot),delete window.UserLeap._config.interactiveEventsHandler};function at(){const r=i.localStorageHelper.getItemObject("userleap.ids");return r&&r[window.UserLeap.envId]||{}}function dt(){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}),k("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 lt(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 u={url:r};a&&(u.trackPageView=!0),window.UserLeap._queue.push(["track",nt,t,u,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 xt(){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 me(r,t){const o=Le();r&&!t&&(window.UserLeap._config.mode=Rt);const a=ae(i.getHttpHeaders(window.UserLeap)),e=await x(function(n){const s=new URL(_("1",[C],"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,Ie);{const{feedbackLabel:n,productConfig:s,surveyUuid:d,feedbackCustomStyles:p}=e.json,{buttonTheme:u,placement:l,desktopDisplay:c}=s;et({customStyles:p,buttonTheme:u,desktopDisplay:c,eventId:0,feedbackLabel:n,placement:l,surveyUuid:d,surveyId:r==null?void 0:r.surveyId},e.json)}}function At(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)&&(xt(),K())}const Ot=function(r){if(!window.UserLeap)return;const t=async(e={})=>{var v,S,h,I,O;const{userId:n,anonymousId:s,metadata:d={},properties:p,showSurveyCallback:u}=e;let{eventName:l}=e;if(window.UserLeap.debugMode&&l!==nt&&console.info("[DEBUG] Sprig track",e),r.mode==="test")return;const c=i.localStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:"no survey"}}if(!l||l.trim().length===0){l=l?String(l):"";const b="[Sprig] - Invalid event name "+l;return console.warn(b),{success:!1,message:b,surveyState:"no survey"}}const g=G??window.location.href;d.url||(d.url=g),k("trackStartUrl",g),(S=(v=window.UserLeap)==null?void 0:v._config)!=null&&S.optimizelyEnabled&&(J(i.getHttpHeaders(window.UserLeap))||X.getAndSetWebOptimizelyExperiments(),d.optimizelyExperiments=Object.assign({},X.getAllOptimizelyExperiments())),(I=(h=window.UserLeap)==null?void 0:h._config)!=null&&I.launchDarklyEnabled&&(d.launchDarklyFlags=fe.getAllLaunchDarklyVariations()),n&&(window.UserLeap.userId=n),s&&(window.UserLeap.partnerAnonymousId=s),p&&(d.eventProperties=p),(O=i.modules.replay)==null||O.RecordEvent({name:l,url:d.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:l});const m=window.UserLeap.delayingSurvey||Ye()?await x(_("1",[P],"events/batch"),{body:JSON.stringify({events:[{event:l,metadata:d}],previewKey:c}),method:"POST",shouldDropOnRateLimit:!0}):await x(_("1",[P],"events"),{body:JSON.stringify({event:l,metadata:d,previewKey:c}),method:"POST",shouldDropOnRateLimit:!0});if(!m.ok){const b="[Sprig] (ERR-421) Failed to track event";return m.reportError&&(console.warn(b,m.error),m.error&&window.UserLeap.reportError("track",m.error)),{success:!1,message:b,error:m.error,surveyState:"no survey"}}n&&k("uid",n),s&&k("aid",s);const w=m.json;w.invalidPreviewKey&&i.localStorageHelper.removeItem("sprig.previewKey");const E=d.trackPageView?d.url:void 0;return w!=null&&w.feedbackButton&&et(w.feedbackButton,void 0,E),await async function(b,R){var H,T;let U=!0;return!(R&&((H=b==null?void 0:b.json)!=null&&H.surveyId)&&(window.UserLeap.delayingSurvey=!0,U=await R(b.json.surveyId),window.UserLeap.delayingSurvey=!1,!U))&&((T=b==null?void 0:b.json)!=null&&T.delay&&!window.UserLeap.isMobileSDK&&(window.UserLeap.delayingSurvey=!0,await i.delay(b.json.delay),window.UserLeap.delayingSurvey=!1),U)}(m,u)?function(b){if(!window.UserLeap._config.dismissOnPageChange)return!0;const R=new URL(b),U=new URL(G??window.location.href);return R.hostname===U.hostname&&R.pathname===U.pathname}(g)?z(w,E,Ie):{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="${Ue}"]`))==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),me({surveyId:e},!0)),_previewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),me({surveyTemplateId:e},!1)},_reviewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),me({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 c of l)d[c]===oe[c]&&delete d[c]}if(!(d&&Object.keys(d).length!==0||n&&window.UserLeap.userId!==n||s&&window.UserLeap.partnerAnonymousId!==s))return{success:!0};const p={};let u;return n&&(p.userId=window.UserLeap.userId=n),s&&(p.partnerAnonymousId=window.UserLeap.partnerAnonymousId=s),d&&Object.keys(d).length>0?(u=await x(_("1",[C,P],"attributes"),{body:JSON.stringify(d),method:"PUT"}),u.ok?Object.assign(oe,d):u.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",u.error),u.error&&window.UserLeap.reportError("identifyAndSetAttributes",u.error))):u=await x(_("1",[C,P]),{body:JSON.stringify(p),method:"PUT"}),d&&d[B]&&(window.UserLeap.email=d[B]),u.ok&&(n&&k("uid",n),s&&k("aid",s)),{success:!!u.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 x(_("1",[C,P],"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 x(_("1",[C,P]),{body:JSON.stringify({userId:e}),method:"PUT"});s.ok?(n!==window.UserLeap.visitorId&&((d=i.modules.replay)==null||d.clearUserReplayData()),k("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,k("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,lt(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 g,m;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),u=ae(p),l=p["userleap-platform"]==="web";if(!window.UserLeap.frameId)return;const c=document.getElementById(window.UserLeap.frameId);c&&(window.UserLeap.useMobileStyling&&((g=window.UserLeap.windowDimensions)!=null&&g.width&&(c.style.width=`${window.UserLeap.windowDimensions.width}px`),(m=window.UserLeap.windowDimensions)!=null&&m.height&&(c.style.maxHeight=window.UserLeap.windowDimensions.height-20+"px"),c.contentDocument&&(c.style.height=String(Je(c.contentDocument,l&&!u,i.shouldDirectEmbed(p))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:c.clientWidth,contentFrameHeight:c.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(),dt(),(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&&st(),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;X.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 u={experiments:[{id:d.id,variation:p.key}]};window.UserLeap("integrateOptimizely",u,!1)})},importLaunchDarklyData(e){var n,s;(s=(n=window.UserLeap)==null?void 0:n._config)!=null&&s.launchDarklyEnabled?fe.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 u=await p.json();return(d=u==null?void 0:u.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,u;(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),(u=(p=i.modules.replay)==null?void 0:p.recordFullSnapshot)==null||u.call(p))}};Object.assign(window.UserLeap,a)};async function Pt(r,t,o={},a={}){const e=window.__cfg&&window.__cfg.mode,n=Le(),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},u={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 x(_("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(u),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Ct(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 c,g,m,w,E;if(window.UserLeap.loaded)return;if((c=window.SprigLoggerCallback)==null||c.call(window,"Loading Sprig"),window.UserLeap.reportError=Pt,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=at(),n=window.UserLeap.sampleRate;let s=e.sampled;if(n){if(s===null&&(s=Math.random()<n,k("sampled",s)),!s)return}else s!==null&&k("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const d=[...window.UserLeap._queue];window.UserLeap._queue=new bt(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):dt();const u=J(i.getHttpHeaders(window.UserLeap));(g=window.SprigLoggerCallback)==null||g.call(window,"Sprig fetching config");const l=await async function(y){var I,O;const v=i.getHttpHeaders(window.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const S=await i.sprigFetch(_("1",[C],"config"),{headers:v});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!S.ok)return(I=window.SprigLoggerCallback)==null||I.call(window,"Sprig config fetch failed"),S.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",S.error),S.error&&window.UserLeap.reportError("applyRemoteConfig",S.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),y;const h=S.json;return h!=null&&h.disabled?((O=window.SprigLoggerCallback)==null||O.call(window,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${h.disabled}`),{disabled:h.disabled}):Object.assign({},h,y)}(r);if((m=window.SprigLoggerCallback)==null||m.call(window,"Sprig fetched config"),kt({isWeb:!u,reportingIntervalSeconds:l.metricsReportingEnabled||l.mobileMetricsReportingEnabled?l.metricsReportingIntervalSeconds:0,thresholds:l.metricThresholds,postMetrics:async y=>{var v;await x(_("1",[C],"metrics"),{body:y,method:"POST",headers:{"x-ul-replay-enabled":`${!!((v=i.modules.replay)!=null&&v.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!u){const y=l.alwaysOnReplay?{userAgent:window.navigator.userAgent,surveyId:l.alwaysOnReplay.surveyId,responseGroupUuid:l.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.34.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})),Ie=l.replaySettings}Ot(l),await At(l),window.UserLeap._queue.unpause(),(E=window.SprigLoggerCallback)==null||E.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 oe)delete oe[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 se{constructor(){M(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 be={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(se.prototype).map(o=>{o!=="constructor"&&(window.Sprig[o]=se.prototype[o])});const t=window.Sprig;return t.appId=r.envId,t._queue=[],window.UserLeap=t,Ct(r),window.Sprig}},Ht={sprig:be,SprigAPI:se,configure:be.configure};exports.APP_ID="ul-app",exports.ConflictingWidgets=We,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.SprigAPI=se,exports.calculateFrameDimensions=Je,exports.core=Ht,exports.isHTMLElement=D,exports.resetScrollPosition=r=>{const t=r.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=Q,exports.sprig=be;
|
|
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},fe=new class{constructor(){M(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(fe);const X=new class{constructor(){M(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(X);class bt{constructor(t,o){M(this,"paused");M(this,"queue");M(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 tt,rt;const he=r=>{let t=0,o=r.firstElementChild;for(;o;)t+=he(o),o.shadowRoot&&(t+=he(o.shadowRoot)),o=o.nextElementSibling,t++;return t},Ve=()=>{tt.report(he(document.body)),rt.report(document.documentElement.innerHTML.length)},Se=(r,t)=>{const o=performance.now();document.hidden?setTimeout(()=>Se(r,t),r):setTimeout(()=>{const a=performance.now()-o;t.report(a/1e3),setTimeout(()=>Se(r,t),r)},0)};let te,re,ie,ne,Ne,j={};const Y=(r,t=1)=>{const{name:o}=r;j[o]=(j[o]||0)+t},it=r=>{let t=1;return r.childNodes.forEach(o=>{t+=it(o)}),t},Be=r=>{let t=0;return r.forEach(o=>{t+=it(o)}),t},Lt=r=>{switch(r.type){case"childList":return Y(te,Be(r.addedNodes)),void Y(re,Be(r.removedNodes));case"attributes":return void Y(ie);case"characterData":return void Y(ne)}},Ut=r=>r.forEach(Lt),Et=()=>{te.report(j[te.name]||0),re.report(j[re.name]||0),ie.report(j[ie.name]||0),ne.report(j[ne.name]||0),j={}},It=(r=1e3)=>{te=i.registerMetric("sdk_mutations_nodes_added"),re=i.registerMetric("sdk_mutations_nodes_removed"),ie=i.registerMetric("sdk_mutations_attributes_changed"),ne=i.registerMetric("sdk_mutations_character_data"),Ne=new MutationObserver(Ut),Ne.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(Et,r)},kt=({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");Se(e,n)})(),((e=1e4)=>{tt=i.registerMetric("sdk_dom_nodes_count"),rt=i.registerMetric("sdk_page_html_characters"),Ve(),setInterval(Ve,e)})(),It())},Rt="test",_t=["popState","pushState","replaceState"];let Ie,G;const oe={},B="!email",nt="pageUrl";let ge=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;ge!==window.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:ge,to:window.location.href}),ge=window.location.href;const n=at().trackStartUrl,s=n?String(n):null;t&<(window.location.href),o&&(st(),Dt()),Qe()&&(()=>{if(Z())return;const u=V();u&&(i.checkUrlStillMatching($)||(u.remove(),$=null,f=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((p=(d=i.modules.replay)==null?void 0:d.checkPendingHeatmapsUrl())==null||p.then(u=>{var l;u&&((l=i.modules.replay)==null||l.uploadReadyPendingCaptures(!0))})),!Z()&&a&&s&&s!==window.location.href&&r&&_t.includes(r.type)&&window.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ot={capture:!0},Dt=()=>{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(Me(d.target))try{d.target.closest(n)&&window.UserLeap("track",a)}catch{}return!1}:d=>(Me(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,ot)},st=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ot),delete window.UserLeap._config.interactiveEventsHandler};function at(){const r=i.localStorageHelper.getItemObject("userleap.ids");return r&&r[window.UserLeap.envId]||{}}function dt(){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}),k("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 lt(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 u={url:r};a&&(u.trackPageView=!0),window.UserLeap._queue.push(["track",nt,t,u,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 xt(){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 me(r,t){const o=Le();r&&!t&&(window.UserLeap._config.mode=Rt);const a=ae(i.getHttpHeaders(window.UserLeap)),e=await x(function(n){const s=new URL(_("1",[C],"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,Ie);{const{feedbackLabel:n,productConfig:s,surveyUuid:d,feedbackCustomStyles:p}=e.json,{buttonTheme:u,placement:l,desktopDisplay:c}=s;et({customStyles:p,buttonTheme:u,desktopDisplay:c,eventId:0,feedbackLabel:n,placement:l,surveyUuid:d,surveyId:r==null?void 0:r.surveyId},e.json)}}function At(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)&&(xt(),K())}const Ot=function(r){if(!window.UserLeap)return;const t=async(e={})=>{var v,S,h,I,O;const{userId:n,anonymousId:s,metadata:d={},properties:p,showSurveyCallback:u}=e;let{eventName:l}=e;if(window.UserLeap.debugMode&&l!==nt&&console.info("[DEBUG] Sprig track",e),r.mode==="test")return;const c=i.localStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:"no survey"}}if(!l||l.trim().length===0){l=l?String(l):"";const b="[Sprig] - Invalid event name "+l;return console.warn(b),{success:!1,message:b,surveyState:"no survey"}}const g=G??window.location.href;d.url||(d.url=g),k("trackStartUrl",g),(S=(v=window.UserLeap)==null?void 0:v._config)!=null&&S.optimizelyEnabled&&(J(i.getHttpHeaders(window.UserLeap))||X.getAndSetWebOptimizelyExperiments(),d.optimizelyExperiments=Object.assign({},X.getAllOptimizelyExperiments())),(I=(h=window.UserLeap)==null?void 0:h._config)!=null&&I.launchDarklyEnabled&&(d.launchDarklyFlags=fe.getAllLaunchDarklyVariations()),n&&(window.UserLeap.userId=n),s&&(window.UserLeap.partnerAnonymousId=s),p&&(d.eventProperties=p),(O=i.modules.replay)==null||O.RecordEvent({name:l,url:d.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:l});const m=window.UserLeap.delayingSurvey||Ye()?await x(_("1",[P],"events/batch"),{body:JSON.stringify({events:[{event:l,metadata:d}],previewKey:c}),method:"POST",shouldDropOnRateLimit:!0}):await x(_("1",[P],"events"),{body:JSON.stringify({event:l,metadata:d,previewKey:c}),method:"POST",shouldDropOnRateLimit:!0});if(!m.ok){const b="[Sprig] (ERR-421) Failed to track event";return m.reportError&&(console.warn(b,m.error),m.error&&window.UserLeap.reportError("track",m.error)),{success:!1,message:b,error:m.error,surveyState:"no survey"}}n&&k("uid",n),s&&k("aid",s);const w=m.json;w.invalidPreviewKey&&i.localStorageHelper.removeItem("sprig.previewKey");const E=d.trackPageView?d.url:void 0;return w!=null&&w.feedbackButton&&et(w.feedbackButton,void 0,E),await async function(b,R){var H,T;let U=!0;return!(R&&((H=b==null?void 0:b.json)!=null&&H.surveyId)&&(window.UserLeap.delayingSurvey=!0,U=await R(b.json.surveyId),window.UserLeap.delayingSurvey=!1,!U))&&((T=b==null?void 0:b.json)!=null&&T.delay&&!window.UserLeap.isMobileSDK&&(window.UserLeap.delayingSurvey=!0,await i.delay(b.json.delay),window.UserLeap.delayingSurvey=!1),U)}(m,u)?function(b){if(!window.UserLeap._config.dismissOnPageChange)return!0;const R=new URL(b),U=new URL(G??window.location.href);return R.hostname===U.hostname&&R.pathname===U.pathname}(g)?z(w,E,Ie):{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="${Ue}"]`))==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),me({surveyId:e},!0)),_previewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),me({surveyTemplateId:e},!1)},_reviewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),me({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 c of l)d[c]===oe[c]&&delete d[c]}if(!(d&&Object.keys(d).length!==0||n&&window.UserLeap.userId!==n||s&&window.UserLeap.partnerAnonymousId!==s))return{success:!0};const p={};let u;return n&&(p.userId=window.UserLeap.userId=n),s&&(p.partnerAnonymousId=window.UserLeap.partnerAnonymousId=s),d&&Object.keys(d).length>0?(u=await x(_("1",[C,P],"attributes"),{body:JSON.stringify(d),method:"PUT"}),u.ok?Object.assign(oe,d):u.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",u.error),u.error&&window.UserLeap.reportError("identifyAndSetAttributes",u.error))):u=await x(_("1",[C,P]),{body:JSON.stringify(p),method:"PUT"}),d&&d[B]&&(window.UserLeap.email=d[B]),u.ok&&(n&&k("uid",n),s&&k("aid",s)),{success:!!u.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 x(_("1",[C,P],"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 x(_("1",[C,P]),{body:JSON.stringify({userId:e}),method:"PUT"});s.ok?(n!==window.UserLeap.visitorId&&((d=i.modules.replay)==null||d.clearUserReplayData()),k("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,k("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,lt(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 g,m;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),u=ae(p),l=p["userleap-platform"]==="web";if(!window.UserLeap.frameId)return;const c=document.getElementById(window.UserLeap.frameId);c&&(window.UserLeap.useMobileStyling&&((g=window.UserLeap.windowDimensions)!=null&&g.width&&(c.style.width=`${window.UserLeap.windowDimensions.width}px`),(m=window.UserLeap.windowDimensions)!=null&&m.height&&(c.style.maxHeight=window.UserLeap.windowDimensions.height-20+"px"),c.contentDocument&&(c.style.height=String(Je(c.contentDocument,l&&!u,i.shouldDirectEmbed(p))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:c.clientWidth,contentFrameHeight:c.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(),dt(),(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&&st(),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;X.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 u={experiments:[{id:d.id,variation:p.key}]};window.UserLeap("integrateOptimizely",u,!1)})},importLaunchDarklyData(e){var n,s;(s=(n=window.UserLeap)==null?void 0:n._config)!=null&&s.launchDarklyEnabled?fe.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 u=await p.json();return(d=u==null?void 0:u.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,u;(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),(u=(p=i.modules.replay)==null?void 0:p.recordFullSnapshot)==null||u.call(p))}};Object.assign(window.UserLeap,a)};async function Pt(r,t,o={},a={}){const e=window.__cfg&&window.__cfg.mode,n=Le(),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},u={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 x(_("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(u),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Ct(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 c,g,m,w,E;if(window.UserLeap.loaded)return;if((c=window.SprigLoggerCallback)==null||c.call(window,"Loading Sprig"),window.UserLeap.reportError=Pt,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=at(),n=window.UserLeap.sampleRate;let s=e.sampled;if(n){if(s===null&&(s=Math.random()<n,k("sampled",s)),!s)return}else s!==null&&k("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const d=[...window.UserLeap._queue];window.UserLeap._queue=new bt(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):dt();const u=J(i.getHttpHeaders(window.UserLeap));(g=window.SprigLoggerCallback)==null||g.call(window,"Sprig fetching config");const l=await async function(y){var I,O;const v=i.getHttpHeaders(window.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const S=await i.sprigFetch(_("1",[C],"config"),{headers:v});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!S.ok)return(I=window.SprigLoggerCallback)==null||I.call(window,"Sprig config fetch failed"),S.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",S.error),S.error&&window.UserLeap.reportError("applyRemoteConfig",S.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),y;const h=S.json;return h!=null&&h.disabled?((O=window.SprigLoggerCallback)==null||O.call(window,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${h.disabled}`),{disabled:h.disabled}):Object.assign({},h,y)}(r);if((m=window.SprigLoggerCallback)==null||m.call(window,"Sprig fetched config"),kt({isWeb:!u,reportingIntervalSeconds:l.metricsReportingEnabled||l.mobileMetricsReportingEnabled?l.metricsReportingIntervalSeconds:0,thresholds:l.metricThresholds,postMetrics:async y=>{var v;await x(_("1",[C],"metrics"),{body:y,method:"POST",headers:{"x-ul-replay-enabled":`${!!((v=i.modules.replay)!=null&&v.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!u){const y=l.alwaysOnReplay?{userAgent:window.navigator.userAgent,surveyId:l.alwaysOnReplay.surveyId,responseGroupUuid:l.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.35.0",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})),Ie=l.replaySettings}Ot(l),await At(l),window.UserLeap._queue.unpause(),(E=window.SprigLoggerCallback)==null||E.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 oe)delete oe[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 se{constructor(){M(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 be={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(se.prototype).map(o=>{o!=="constructor"&&(window.Sprig[o]=se.prototype[o])});const t=window.Sprig;return t.appId=r.envId,t._queue=[],window.UserLeap=t,Ct(r),window.Sprig}},Ht={sprig:be,SprigAPI:se,configure:be.configure};exports.APP_ID="ul-app",exports.ConflictingWidgets=We,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.SprigAPI=se,exports.calculateFrameDimensions=Je,exports.core=Ht,exports.isHTMLElement=D,exports.resetScrollPosition=r=>{const t=r.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=Q,exports.sprig=be;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var It = Object.defineProperty;
|
|
2
2
|
var kt = (r, t, n) => t in r ? It(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
3
|
var W = (r, t, n) => kt(r, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { l as x, g as P, s as et, e as y, S as w, v as tt, m as S, b as q, h as rt, E as re, D as M, c as Et, r as $, i as _t, j as Rt, k as xt, n as He, o as Ve, d as Dt, a as At, p as it, q as nt } from "./metricsReporter-
|
|
4
|
+
import { l as x, g as P, s as et, e as y, S as w, v as tt, m as S, b as q, h as rt, E as re, D as M, c as Et, r as $, i as _t, j as Rt, k as xt, n as He, o as Ve, d as Dt, a as At, p as it, q as nt } from "./metricsReporter-BJVpNufn.js";
|
|
5
5
|
const nr = 360, or = "ul-app", sr = "#e6e6e6", ar = "#bd282a", dr = 1030, We = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
@@ -104,7 +104,7 @@ const X = async (r, t, n) => {
|
|
|
104
104
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
105
105
|
};
|
|
106
106
|
if (G.installationMethod === "web-npm" || G.installationMethod === "web-npm-bundled") {
|
|
107
|
-
const { default: I } = await import("./view-
|
|
107
|
+
const { default: I } = await import("./view-kh2hxG3p.js");
|
|
108
108
|
I.configure(G), H && window.UserLeap.container && Te();
|
|
109
109
|
} else ye && (me.src = ye, H && me.addEventListener("load", () => {
|
|
110
110
|
window.UserLeap.container && Te();
|
|
@@ -850,7 +850,7 @@ function tr(r = {}) {
|
|
|
850
850
|
var v;
|
|
851
851
|
await O(A("1", [z], "metrics"), { body: f, method: "POST", headers: { "x-ul-replay-enabled": `${!!((v = S.replay) != null && v.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
852
852
|
} }), !p) {
|
|
853
|
-
const f = d.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.
|
|
853
|
+
const f = d.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.35.0", maxDurationSeconds: d.alwaysOnReplay.maxDurationSeconds } : void 0;
|
|
854
854
|
await ((u = S.replay) == null ? void 0 : u.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings, apiUrl: window.UserLeap._API_URL, alwaysOnConfig: f })), Oe = d.replaySettings;
|
|
855
855
|
}
|
|
856
856
|
Zt(d), await Xt(d), window.UserLeap._queue.unpause(), (E = window.SprigLoggerCallback) == null || E.call(window, "SdkReady"), y.emit(w.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), y.emit(w.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), y.on(w.VisitorIDUpdated, () => {
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-BvLxSPGb.cjs"),e=require("./core-CGgKmpNf.cjs");exports.DismissReason=i.DismissReason,exports.SprigEvent=i.SprigEvent,exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig;
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as r, S as e } from "./metricsReporter-
|
|
2
|
-
import { S as o, c as p, s as t } from "./core-
|
|
1
|
+
import { D as r, S as e } from "./metricsReporter-BJVpNufn.js";
|
|
2
|
+
import { S as o, c as p, s as t } from "./core-De2JxeSJ.js";
|
|
3
3
|
export {
|
|
4
4
|
r as DismissReason,
|
|
5
5
|
o as SprigAPI,
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core-CGgKmpNf.cjs");require("./replay.cjs");const r=require("./metricsReporter-BvLxSPGb.cjs");exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig,exports.DismissReason=r.DismissReason,exports.SprigEvent=r.SprigEvent;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as i, c as o, s as p } from "./core-
|
|
1
|
+
import { S as i, c as o, s as p } from "./core-De2JxeSJ.js";
|
|
2
2
|
import "./replay.js";
|
|
3
|
-
import { D as t, S as m } from "./metricsReporter-
|
|
3
|
+
import { D as t, S as m } from "./metricsReporter-BJVpNufn.js";
|
|
4
4
|
export {
|
|
5
5
|
t as DismissReason,
|
|
6
6
|
i as SprigAPI,
|
|
@@ -217,7 +217,7 @@ const J = (e) => e._config && e._config.installationMethod ? e._config.installat
|
|
|
217
217
|
U = !0, A = e;
|
|
218
218
|
};
|
|
219
219
|
function ce(e = {}) {
|
|
220
|
-
const t = { "Content-Type": "application/json", "userleap-platform": "web", "x-ul-sdk-version": "2.
|
|
220
|
+
const t = { "Content-Type": "application/json", "userleap-platform": "web", "x-ul-sdk-version": "2.35.0", "x-ul-installation-method": J(e), "sprig-modules": B() };
|
|
221
221
|
if (e.envId && (t["x-ul-environment-id"] = e.envId), e.token && (t.Authorization = "Bearer " + e.token), e.userId && (t["x-ul-user-id"] = e.userId), e.visitorId && (t["x-ul-visitor-id"] = e.visitorId), e.partnerAnonymousId && (t["x-ul-anonymous-id"] = e.partnerAnonymousId), e.mobileHeadersJSON) {
|
|
222
222
|
const s = JSON.parse(e.mobileHeadersJSON);
|
|
223
223
|
Object.assign(t, s);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=Object.defineProperty;var j=(e,t,r)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t,r)=>j(e,typeof t!="symbol"?t+"":t,r);var U=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.FeedbackClosed="feedback.closed",e.PageChange="page.change",e.API="api",e.Override="override",e))(U||{}),A=(e=>(e.ReplayCapture="replay.capture",e.ReplayPaused="replay.paused",e.ReplayResumed="replay.resumed",e.FeedbackButtonLoaded="feedback.button.loaded",e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyCloseRequested="survey.closeRequested",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(A||{});let m;const F=new Uint8Array(16);function H(){if(!m&&(m=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(F)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));const w={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},b=new class{constructor(){l(this,"breadcrumbs",[])}getTimeStamp(){return new Date().toISOString()}addBreadcrumb(e){this.breadcrumbs.push(e),this.breadcrumbs.length>300&&this.breadcrumbs.shift()}debug(e,t="debug"){this.addBreadcrumb({category:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"debug"})}error(e,t={}){this.addBreadcrumb({category:"error",data:t,level:"error",message:e,timestamp:this.getTimeStamp(),type:"error"})}http(e,t){this.addBreadcrumb({category:"xhr",data:t,message:e,timestamp:this.getTimeStamp(),type:"http"})}info(e,t={}){this.addBreadcrumb({category:"info",data:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"info"})}navigation(e,t){this.addBreadcrumb({category:"navigation",data:t,message:e,timestamp:this.getTimeStamp(),type:"navigation"})}};var q=class extends Error{constructor(e,t,r){super(`Possible EventEmitter memory leak detected. ${r} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=r,this.name="MaxListenersExceededWarning"}},C=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=C.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,r){this.emit(e,t,r)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const r=e.indexOf(t);return r>-1&&e.splice(r,1),[]}_wrapOnceListener(e,t){const r=(...s)=>(this.removeListener(e,r),t.apply(this,s));return Object.defineProperty(r,"name",{value:t.name}),r}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const r=this._getListeners(e);return r.forEach(s=>{s.apply(this,t)}),r.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const r=this._getListeners(e).concat(t);if(this.events.set(e,r),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const s=new q(this,e,this.listenerCount(e));console.warn(s)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const r=this._getListeners(e);if(r.length>0){const s=[t].concat(r);this.events.set(e,s)}else this.events.set(e,r.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const r=this._getListeners(e);return r.length>0&&(this._removeListener(r,t),this.events.set(e,r),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},D=C;D.defaultMaxListeners=10;const B=new D,S=async e=>{await new Promise(t=>{setTimeout(t,e)})};class x{constructor(t){l(this,"storage");l(this,"tempStorage",{});l(this,"isStorageAvailable");try{this.storage=window[t];const r="__storage_test__";this.storage.setItem(r,r),this.storage.removeItem(r),this.isStorageAvailable=!0}catch{this.isStorageAvailable=!1}}setItem(t,r){this.isStorageAvailable&&this.storage?this.storage.setItem(t,r):this.tempStorage[t]=r}setItemObject(t,r){try{this.setItem(t,JSON.stringify(r))}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to save to local storage",s))}}getItem(t){return this.isStorageAvailable&&this.storage?this.storage.getItem(t):this.tempStorage[t]}getItemObject(t){const r=this.getItem(t);if(r)try{return JSON.parse(r)}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to parse local storage",s))}return{}}removeItem(t){this.isStorageAvailable&&this.storage?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable&&this.storage?this.storage.clear():this.tempStorage={}}}const J=new x("sessionStorage"),$=new x("localStorage");class K{constructor(t){l(this,"payload");l(this,"promise");l(this,"reject",()=>{});l(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((r,s)=>{this.reject=s,this.resolve=r})}resolveRequest(t){this.resolve(t)}}const E={replay:null},G=()=>{const e=[];return E.replay&&e.push("replay"),e.join(",")},z=10;let T=!1,M="",g=!1,P=!1,y=[];const Q=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?"web-gtm":e._segment?"web-segment":"web-snippet",N=(e="")=>{T=!0,M=e},R=async({shouldDropOnRateLimit:e,...t})=>{if(e)return{status:429};{const r=new K(t);return y.push(r),r.promise}},v=async(e,t)=>{const{retries:r=0,shouldDropOnRateLimit:s=!1,shouldRetryRequest:n=!1,...i}=t,d={url:e,options:i,retries:r,shouldDropOnRateLimit:s};if(g&&!n)return R(d);const u={ok:!1,reportError:!1};if(T)return console.info(`UserLeap - ${M}`),u;try{const c=await fetch(e,i);if(c.status===429){if(!g&&!s||n){g=!0;const a=c.headers.has("ratelimit-reset")?Number(c.headers.get("ratelimit-reset")):z;return await S(1e3*a),v(e,{...i,shouldDropOnRateLimit:s,shouldRetryRequest:!0})}return R(d)}if(g=!1,y.length&&(y.map(a=>{const h=a.payload;v(h.url,{...h.options,retries:h.retries,shouldDropOnRateLimit:h.shouldDropOnRateLimit}).then(W=>{a.resolveRequest(W)})}),y=[]),c.ok){if(c.status===249)return N(),u;const a=await c.text();try{return a&&a!=="OK"&&(c.json=JSON.parse(a)),c}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${a}`)}}}return c}catch(c){const a=r+1;return a>5||P?{ok:!1,reportError:!1,error:c}:(await S(1e3*Math.pow(2,r)),v(e,{...i,retries:a}))}},I=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function k(e,t){const{matchType:r,pattern:s}=e,n=r?I[r]:I.legacy;let i=!1;try{i=n(s,t)}catch(d){const u=`[Sprig] (ERR-445) Failed to check url match with pattern ${s}`;d instanceof Error&&(console.warn(u,d),d.stack=JSON.stringify(e),window.UserLeap.reportError(u,d))}return i}let V=!0,f=!1;const X=["sdk_event_queue_latency_seconds","sdk_replay_add_event_batch_seconds","sdk_replay_cleanup_seconds","sdk_replay_compression_seconds","sdk_replay_get_events_between_seconds","sdk_replay_snapshot_seconds","sdk_mutations_nodes_added","sdk_mutations_nodes_removed","sdk_mutations_attributes_changed","sdk_mutations_character_data","sdk_dom_nodes_count","sdk_page_html_characters"];let L,p={};class Z{constructor(t){l(this,"_values",[]);l(this,"_isWebMetric");this.name=t,this._isWebMetric=X.includes(this.name)}report(t){if(V&&this._values.push({time:Date.now(),value:t}),f||!this._isWebMetric)return;const r=this.findExceededThreshold(t);r&&L&&L(t,r)}collect(){const t=this._values;return this._values=[],t}findExceededThreshold(t){const r=p[this.name];if(r)return r.find(s=>this.valueExceedsThreshold(t,s))}valueExceedsThreshold(t,r){return r.type==="max"?t>r.value:r.type==="min"&&t<r.value}}const _={},O=e=>{const t=new Z(e);return _[e]=t,t};exports.DismissReason=U,exports.EVENTS={FEEDBACK_BUTTON_LOADED:"feedback.button.loaded",SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_WIDTH:"survey.width",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}},exports.PerformanceMetrics=_,exports.SprigEvent=A,exports.breadcrumbsLogger=b,exports.checkUrlMatch=k,exports.checkUrlStillMatching=e=>{const{pageUrlEvents:t}=window.UserLeap._config,r=t==null?void 0:t.find(s=>s.id===e);return!!r&&k(r,window.location.href)},exports.cspViolationHandler=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(P=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`))},exports.delay=S,exports.disableThresholdChecking=()=>f=!0,exports.eventEmitter=B,exports.getHttpHeaders=function(e={}){const t={"Content-Type":"application/json","userleap-platform":"web","x-ul-sdk-version":"2.34.2","x-ul-installation-method":Q(e),"sprig-modules":G()};if(e.envId&&(t["x-ul-environment-id"]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t["x-ul-user-id"]=e.userId),e.visitorId&&(t["x-ul-visitor-id"]=e.visitorId),e.partnerAnonymousId&&(t["x-ul-anonymous-id"]=e.partnerAnonymousId),e.mobileHeadersJSON){const r=JSON.parse(e.mobileHeadersJSON);Object.assign(t,r)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t["x-ul-preview-mode"]="1"),t},exports.groupCards=(e,t)=>{const r=[e[t]],s=e[t].groupId;return s?e.slice(t).reduce((n,i)=>(i.groupId===s&&n.push(i),n),[]):r},exports.initPerformanceReporting=({reportingIntervalSeconds:e,postMetrics:t})=>{e?setInterval(()=>{(async r=>{const s=Object.values(_).map(n=>({name:n.name,values:n.collect()}));if(s.some(n=>n.values.length))try{await r(JSON.stringify(s))}catch(n){n instanceof Error&&b.error("MetricsErr",{error:{message:n.message,name:n.name}})}})(t)},1e3*e):V=!1},exports.isLongFormSurvey=e=>e==="longFormSurvey",exports.killNetworkRequests=N,exports.localStorageHelper=$,exports.modules=E,exports.registerMetric=O,exports.registerReplay=e=>{E.replay=e},exports.registerThresholds=(e,t)=>{p={},f=!1,e==null||e.forEach(r=>{var s;r.metric in p||(p[r.metric]=[]),(s=p[r.metric])==null||s.push(r)}),L=t},exports.reportAndRegister=(e,t)=>{let r=_[e];return r||(r=O(e)),r.report(t)},exports.sessionStorageHelper=J,exports.shouldDirectEmbed=({"userleap-platform":e})=>{var t;return((t=window.UserLeap)==null?void 0:t.forceDirectEmbed)||e!=="web"},exports.sprigFetch=v,exports.v4=function(e,t,r){if(w.randomUUID&&!e)return w.randomUUID();const s=(e=e||{}).random||(e.rng||H)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(n,i=0){return o[n[i+0]]+o[n[i+1]]+o[n[i+2]]+o[n[i+3]]+"-"+o[n[i+4]]+o[n[i+5]]+"-"+o[n[i+6]]+o[n[i+7]]+"-"+o[n[i+8]]+o[n[i+9]]+"-"+o[n[i+10]]+o[n[i+11]]+o[n[i+12]]+o[n[i+13]]+o[n[i+14]]+o[n[i+15]]}(s)};
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var j=(e,t,r)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t,r)=>j(e,typeof t!="symbol"?t+"":t,r);var U=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.FeedbackClosed="feedback.closed",e.PageChange="page.change",e.API="api",e.Override="override",e))(U||{}),A=(e=>(e.ReplayCapture="replay.capture",e.ReplayPaused="replay.paused",e.ReplayResumed="replay.resumed",e.FeedbackButtonLoaded="feedback.button.loaded",e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyCloseRequested="survey.closeRequested",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(A||{});let m;const F=new Uint8Array(16);function H(){if(!m&&(m=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(F)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));const w={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},b=new class{constructor(){l(this,"breadcrumbs",[])}getTimeStamp(){return new Date().toISOString()}addBreadcrumb(e){this.breadcrumbs.push(e),this.breadcrumbs.length>300&&this.breadcrumbs.shift()}debug(e,t="debug"){this.addBreadcrumb({category:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"debug"})}error(e,t={}){this.addBreadcrumb({category:"error",data:t,level:"error",message:e,timestamp:this.getTimeStamp(),type:"error"})}http(e,t){this.addBreadcrumb({category:"xhr",data:t,message:e,timestamp:this.getTimeStamp(),type:"http"})}info(e,t={}){this.addBreadcrumb({category:"info",data:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"info"})}navigation(e,t){this.addBreadcrumb({category:"navigation",data:t,message:e,timestamp:this.getTimeStamp(),type:"navigation"})}};var q=class extends Error{constructor(e,t,r){super(`Possible EventEmitter memory leak detected. ${r} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=r,this.name="MaxListenersExceededWarning"}},C=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=C.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,r){this.emit(e,t,r)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const r=e.indexOf(t);return r>-1&&e.splice(r,1),[]}_wrapOnceListener(e,t){const r=(...s)=>(this.removeListener(e,r),t.apply(this,s));return Object.defineProperty(r,"name",{value:t.name}),r}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const r=this._getListeners(e);return r.forEach(s=>{s.apply(this,t)}),r.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const r=this._getListeners(e).concat(t);if(this.events.set(e,r),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const s=new q(this,e,this.listenerCount(e));console.warn(s)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const r=this._getListeners(e);if(r.length>0){const s=[t].concat(r);this.events.set(e,s)}else this.events.set(e,r.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const r=this._getListeners(e);return r.length>0&&(this._removeListener(r,t),this.events.set(e,r),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},D=C;D.defaultMaxListeners=10;const B=new D,S=async e=>{await new Promise(t=>{setTimeout(t,e)})};class x{constructor(t){l(this,"storage");l(this,"tempStorage",{});l(this,"isStorageAvailable");try{this.storage=window[t];const r="__storage_test__";this.storage.setItem(r,r),this.storage.removeItem(r),this.isStorageAvailable=!0}catch{this.isStorageAvailable=!1}}setItem(t,r){this.isStorageAvailable&&this.storage?this.storage.setItem(t,r):this.tempStorage[t]=r}setItemObject(t,r){try{this.setItem(t,JSON.stringify(r))}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to save to local storage",s))}}getItem(t){return this.isStorageAvailable&&this.storage?this.storage.getItem(t):this.tempStorage[t]}getItemObject(t){const r=this.getItem(t);if(r)try{return JSON.parse(r)}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to parse local storage",s))}return{}}removeItem(t){this.isStorageAvailable&&this.storage?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable&&this.storage?this.storage.clear():this.tempStorage={}}}const J=new x("sessionStorage"),$=new x("localStorage");class K{constructor(t){l(this,"payload");l(this,"promise");l(this,"reject",()=>{});l(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((r,s)=>{this.reject=s,this.resolve=r})}resolveRequest(t){this.resolve(t)}}const E={replay:null},G=()=>{const e=[];return E.replay&&e.push("replay"),e.join(",")},z=10;let T=!1,M="",g=!1,P=!1,y=[];const Q=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?"web-gtm":e._segment?"web-segment":"web-snippet",N=(e="")=>{T=!0,M=e},R=async({shouldDropOnRateLimit:e,...t})=>{if(e)return{status:429};{const r=new K(t);return y.push(r),r.promise}},v=async(e,t)=>{const{retries:r=0,shouldDropOnRateLimit:s=!1,shouldRetryRequest:n=!1,...i}=t,d={url:e,options:i,retries:r,shouldDropOnRateLimit:s};if(g&&!n)return R(d);const u={ok:!1,reportError:!1};if(T)return console.info(`UserLeap - ${M}`),u;try{const c=await fetch(e,i);if(c.status===429){if(!g&&!s||n){g=!0;const a=c.headers.has("ratelimit-reset")?Number(c.headers.get("ratelimit-reset")):z;return await S(1e3*a),v(e,{...i,shouldDropOnRateLimit:s,shouldRetryRequest:!0})}return R(d)}if(g=!1,y.length&&(y.map(a=>{const h=a.payload;v(h.url,{...h.options,retries:h.retries,shouldDropOnRateLimit:h.shouldDropOnRateLimit}).then(W=>{a.resolveRequest(W)})}),y=[]),c.ok){if(c.status===249)return N(),u;const a=await c.text();try{return a&&a!=="OK"&&(c.json=JSON.parse(a)),c}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${a}`)}}}return c}catch(c){const a=r+1;return a>5||P?{ok:!1,reportError:!1,error:c}:(await S(1e3*Math.pow(2,r)),v(e,{...i,retries:a}))}},I=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function k(e,t){const{matchType:r,pattern:s}=e,n=r?I[r]:I.legacy;let i=!1;try{i=n(s,t)}catch(d){const u=`[Sprig] (ERR-445) Failed to check url match with pattern ${s}`;d instanceof Error&&(console.warn(u,d),d.stack=JSON.stringify(e),window.UserLeap.reportError(u,d))}return i}let V=!0,f=!1;const X=["sdk_event_queue_latency_seconds","sdk_replay_add_event_batch_seconds","sdk_replay_cleanup_seconds","sdk_replay_compression_seconds","sdk_replay_get_events_between_seconds","sdk_replay_snapshot_seconds","sdk_mutations_nodes_added","sdk_mutations_nodes_removed","sdk_mutations_attributes_changed","sdk_mutations_character_data","sdk_dom_nodes_count","sdk_page_html_characters"];let L,p={};class Z{constructor(t){l(this,"_values",[]);l(this,"_isWebMetric");this.name=t,this._isWebMetric=X.includes(this.name)}report(t){if(V&&this._values.push({time:Date.now(),value:t}),f||!this._isWebMetric)return;const r=this.findExceededThreshold(t);r&&L&&L(t,r)}collect(){const t=this._values;return this._values=[],t}findExceededThreshold(t){const r=p[this.name];if(r)return r.find(s=>this.valueExceedsThreshold(t,s))}valueExceedsThreshold(t,r){return r.type==="max"?t>r.value:r.type==="min"&&t<r.value}}const _={},O=e=>{const t=new Z(e);return _[e]=t,t};exports.DismissReason=U,exports.EVENTS={FEEDBACK_BUTTON_LOADED:"feedback.button.loaded",SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_WIDTH:"survey.width",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}},exports.PerformanceMetrics=_,exports.SprigEvent=A,exports.breadcrumbsLogger=b,exports.checkUrlMatch=k,exports.checkUrlStillMatching=e=>{const{pageUrlEvents:t}=window.UserLeap._config,r=t==null?void 0:t.find(s=>s.id===e);return!!r&&k(r,window.location.href)},exports.cspViolationHandler=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(P=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`))},exports.delay=S,exports.disableThresholdChecking=()=>f=!0,exports.eventEmitter=B,exports.getHttpHeaders=function(e={}){const t={"Content-Type":"application/json","userleap-platform":"web","x-ul-sdk-version":"2.35.0","x-ul-installation-method":Q(e),"sprig-modules":G()};if(e.envId&&(t["x-ul-environment-id"]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t["x-ul-user-id"]=e.userId),e.visitorId&&(t["x-ul-visitor-id"]=e.visitorId),e.partnerAnonymousId&&(t["x-ul-anonymous-id"]=e.partnerAnonymousId),e.mobileHeadersJSON){const r=JSON.parse(e.mobileHeadersJSON);Object.assign(t,r)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t["x-ul-preview-mode"]="1"),t},exports.groupCards=(e,t)=>{const r=[e[t]],s=e[t].groupId;return s?e.slice(t).reduce((n,i)=>(i.groupId===s&&n.push(i),n),[]):r},exports.initPerformanceReporting=({reportingIntervalSeconds:e,postMetrics:t})=>{e?setInterval(()=>{(async r=>{const s=Object.values(_).map(n=>({name:n.name,values:n.collect()}));if(s.some(n=>n.values.length))try{await r(JSON.stringify(s))}catch(n){n instanceof Error&&b.error("MetricsErr",{error:{message:n.message,name:n.name}})}})(t)},1e3*e):V=!1},exports.isLongFormSurvey=e=>e==="longFormSurvey",exports.killNetworkRequests=N,exports.localStorageHelper=$,exports.modules=E,exports.registerMetric=O,exports.registerReplay=e=>{E.replay=e},exports.registerThresholds=(e,t)=>{p={},f=!1,e==null||e.forEach(r=>{var s;r.metric in p||(p[r.metric]=[]),(s=p[r.metric])==null||s.push(r)}),L=t},exports.reportAndRegister=(e,t)=>{let r=_[e];return r||(r=O(e)),r.report(t)},exports.sessionStorageHelper=J,exports.shouldDirectEmbed=({"userleap-platform":e})=>{var t;return((t=window.UserLeap)==null?void 0:t.forceDirectEmbed)||e!=="web"},exports.sprigFetch=v,exports.v4=function(e,t,r){if(w.randomUUID&&!e)return w.randomUUID();const s=(e=e||{}).random||(e.rng||H)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(n,i=0){return o[n[i+0]]+o[n[i+1]]+o[n[i+2]]+o[n[i+3]]+"-"+o[n[i+4]]+o[n[i+5]]+"-"+o[n[i+6]]+o[n[i+7]]+"-"+o[n[i+8]]+o[n[i+9]]+"-"+o[n[i+10]]+o[n[i+11]]+o[n[i+12]]+o[n[i+13]]+o[n[i+14]]+o[n[i+15]]}(s)};
|
package/dist/replay.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var et=Object.defineProperty;var tt=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>tt(e,typeof t!="symbol"?t+"":t,r);const o=require("./metricsReporter-Dy3EDEs8.cjs");var L=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(L||{}),P=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(P||{});const Z=(e,t)=>t.some(r=>e instanceof r);let ye,fe;const ee=new WeakMap,q=new WeakMap,$=new WeakMap;let te={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return ee.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return x(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&(t==="done"||t==="store")||t in e};function Ee(e){te=e(te)}function rt(e){return(fe||(fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(re(this),t),x(this.request)}:function(...t){return x(e.apply(re(this),t))}}function nt(e){return typeof e=="function"?rt(e):(e instanceof IDBTransaction&&function(t){if(ee.has(t))return;const r=new Promise((n,a)=>{const s=()=>{a(t.error||new DOMException("AbortError","AbortError"))};t.oncomplete=()=>{n()},t.onerror=s,t.onabort=s});ee.set(t,r)}(e),Z(e,ye||(ye=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,te):e)}function x(e){if(e instanceof IDBRequest)return function(r){const n=new Promise((a,s)=>{r.onsuccess=()=>{a(x(r.result))},r.onerror=()=>{s(r.error)}});return $.set(n,r),n}(e);if(q.has(e))return q.get(e);const t=nt(e);return t!==e&&(q.set(e,t),$.set(t,e)),t}const re=e=>$.get(e);function ne(e,{blocked:t}={}){const r=indexedDB.deleteDatabase(e);return t&&(r.onblocked=n=>t(n.oldVersion,n)),x(r).then(()=>{})}const at=["get","getKey","getAll","getAllKeys","count"],st=["put","add","delete","clear"],z=new Map;function he(e,t){if(!(e instanceof IDBDatabase)||t in e||typeof t!="string")return;if(z.get(t))return z.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,a=st.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!at.includes(r))return;const s=async function(i,...c){const d=this.transaction(i,a?"readwrite":"readonly");let u=d.store;return n&&(u=u.index(c.shift())),(await Promise.all([u[r](...c),a&&d.done]))[0]};return z.set(t,s),s}Ee(e=>({...e,get:(t,r,n)=>he(t,r)||e.get(t,r,n),has:(t,r)=>!!he(t,r)||e.has(t,r)}));const ot=["continue","continuePrimaryKey","advance"],Ie={},ae=new WeakMap,Re=new WeakMap,it={get(e,t){if(!ot.includes(t))return e[t];let r=Ie[t];return r||(r=Ie[t]=function(...n){ae.set(this,Re.get(this)[t](...n))}),r}};async function*dt(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,it);for(Re.set(r,t),$.set(r,re(t));t;)yield r,t=await(ae.get(r)||t.continue()),ae.delete(r)}function ve(e,t){return t===Symbol.asyncIterator&&Z(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Z(e,[IDBIndex,IDBObjectStore])}Ee(e=>({...e,get:(t,r,n)=>ve(t,r)?dt:e.get(t,r,n),has:(t,r)=>ve(t,r)||e.has(t,r)}));const ct="sprigReplayIframeLoaded",ut="sprigReplayIframeSettings",lt="sprigReplayIframeTakeFullSnapshot",pt="sprigReplayTeardown",pe=[],Ce=new class{constructor(e){N(this,"awaitingResolvers",[]);N(this,"activeCount",0);this.capacity=e}async acquire(){if(!(this.activeCount<this.capacity))return new Promise(e=>{this.awaitingResolvers.push(e)});this.activeCount++}release(){const e=this.awaitingResolvers.shift();e&&this.activeCount<=this.capacity?e():this.activeCount--}async execute(e){try{return await this.acquire(),await e()}finally{this.release()}}setLimit(e){this.capacity=e}}(2),Te=async({apiUrl:e,surveyId:t,uploadId:r,etags:n,headers:a,responseGroupUuid:s,replayDuration:i,eventDigest:c},d=!1)=>{var w;if(!d&&!r&&!n)return void o.breadcrumbsLogger.error("UploadErr",{isMobile:d,uploadId:r,etags:n});o.breadcrumbsLogger.info("MarkUploadComplete",{surveyId:t});const u=await o.sprigFetch(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:n,uploadId:r,responseGroupUuid:s,surveyId:t,replayDuration:i,eventDigest:c,userAgent:(w=window==null?void 0:window.navigator)==null?void 0:w.userAgent}),headers:a,shouldRetryRequest:!0});return o.breadcrumbsLogger.info("MarkUploadDone",{surveyId:t}),u},gt=e=>{if(e instanceof Attr)return null;let t=1;for(let r=e.previousSibling;r;r=r.previousSibling)r.nodeName===e.nodeName&&++t;return t},Pe=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let r=e;r&&!(r instanceof Document)&&r!==null;r=r instanceof Attr?r.ownerElement:r.parentElement){const n=t[t.length]={name:void 0,position:null};switch(r.nodeType){case Node.TEXT_NODE:n.name="text()";break;case Node.ATTRIBUTE_NODE:n.name="@"+r.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:n.name="processing-instruction()";break;case Node.COMMENT_NODE:n.name="comment()";break;case Node.ELEMENT_NODE:n.name=r.nodeName}n.position=gt(r)}return"/"+t.reverse().map(r=>r.position!==null?`/${r.name}[${r.position}]`:`/${r.name}`).join("")},ge=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),R={capture:!0,passive:!0},mt=["a","button","input","option","li","link"],wt=["Escape","Enter","Backspace","F5","Tab"];let j=!1,S=null,V=null;const be=e=>{var r;if(((r=e.tagName)==null?void 0:r.toLowerCase())==="html")return{element:"html"};const t={};return t.element=(n=>{if(!n.tagName)return"No tagName";const a=n.getAttribute("type");return a?`${a} ${n.tagName.toLowerCase()}`:n.tagName.toLowerCase()})(e),t},yt=e=>{var n;if(!e)return{};const t={...be(e)},r=e.parentElement;if(r&&mt.includes((n=r.tagName)==null?void 0:n.toLowerCase())){const a=be(r);Object.assign(t,a)}return t},ke=(e,t)=>{var a,s;let r=t.target;var n;t.target===((a=window.document)==null?void 0:a.body)&&window.Sprig.pointerDownTarget&&(r=window.Sprig.pointerDownTarget),n={x:t.x,y:t.y,type:e,elementAttributes:yt(r),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...r instanceof HTMLElement?{rect:r==null?void 0:r.getBoundingClientRect(),xPath:Pe(r)}:{}},(s=n==null?void 0:n.elementAttributes)!=null&&s.text&&(n.elementAttributes.text=ge(n.elementAttributes.text)),S==null||S("Sprig_Click",n)},Ue=e=>{var t;wt.includes(e.key)&&(t={key:e.key},S==null||S("Sprig_Keystroke",t))},ft=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&(e={url:window.location.href,currentPageTitle:document.title},S==null||S("Sprig_Refresh",e))},ht=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&((e={curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title}).currentPageTitle&&(e.currentPageTitle=ge(e.currentPageTitle)),S==null||S("Sprig_BackForward",e))},Le=((e,t)=>{let r;return n=>{clearTimeout(r),r=window.setTimeout(()=>e(n),t)}})(e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),V==null||V({xPath:Pe(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},750),xe=(Se="left_click",e=>ke(Se,e));var Se;const Be=e=>{e.button===2&&ke("right_click",e)},Me=e=>{window.Sprig&&(window.Sprig.pointerDownTarget=e.target)},g={isRecording:!1,scrollEventUuids:{},stopRecording:()=>{}},Ae=()=>window.indexedDB&&window.IDBKeyRange&&window.CompressionStream,h=(()=>{const e=o.sessionStorageHelper.getItem("sprig.sessionId");if(e)return o.breadcrumbsLogger.info("SessionIDFound",{savedSessionId:e}),o.sessionStorageHelper.removeItem("sprig.sessionId"),e;const t=o.v4();return o.breadcrumbsLogger.info("GeneratedSessionID",{uuid:t}),t})(),se=()=>{o.sessionStorageHelper.setItem("sprig.disableReplayRecording","disabled")},C=()=>!!o.sessionStorageHelper.getItem("sprig.disableReplayRecording"),K=()=>!!o.sessionStorageHelper.getItem("sprig.isReplayPaused");window.addEventListener("beforeunload",()=>{o.breadcrumbsLogger.info("BeforeUnload",{sessionId:h}),o.sessionStorageHelper.setItem("sprig.sessionId",h)});const k=(e,t)=>{var r,n;if(!C()&&g.isRecording&&!K())try{(n=(r=window.rrwebRecord)==null?void 0:r.addCustomEvent)==null||n.call(r,e,t)}catch(a){O("Error recording custom event",a)}},It=async e=>{const{x:t,xPath:r,y:n}=e,a=g.scrollEventUuids[r];if(a)return b(async()=>{var c,d,u,w;const s=await l.openDB(),i=await s.get("events",a);if(i!=null&&i.event){const p=JSON.parse(i.event),f=t>((d=(c=p.data)==null?void 0:c.payload)==null?void 0:d.x),m=n>((w=(u=p.data)==null?void 0:u.payload)==null?void 0:w.y);if(!f&&!m)return null;f&&(p.data.payload.x=t),m&&(p.data.payload.y=n),p.data.payload.elementAttributes=e.elementAttributes,i.event=JSON.stringify(p),await s.put("events",i)}else k("Sprig_Scroll",e)},"Error updating scroll event");k("Sprig_Scroll",e)},_e=()=>{g.stopRecording&&(g.stopRecording(),g.stopRecording=void 0),g.isRecording=!1,["cleanupInterval","inactivityInterval","pendingCheckInterval"].forEach(e=>{g[e]&&(clearInterval(g[e]),g[e]=void 0)}),j&&(window.removeEventListener("click",xe,R),window.removeEventListener("pointerdown",Me,R),window.removeEventListener("mousedown",Be,R),window.removeEventListener("keydown",Ue,R),window.removeEventListener("scroll",Le,R),j=!1),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:pt},{targetOrigin:e.origin})})},vt=["did not allow mutations","called in an invalid security context"],bt=(e,t,{reportError:r=!0,extraInfo:n={}})=>{if(!C()&&t instanceof Error){if(se(),t.name==="VersionError")return o.breadcrumbsLogger.error("VersionErr",{message:e}),void l.deleteDB();(a=>{if(!a)return!0;for(const s of vt)if(a.toLowerCase().includes(s))return!1;return!0})(t==null?void 0:t.message)&&(r&&window.UserLeap.reportError(e,t,n),l.clearAll())}},O=(e,t,{reportError:r}={reportError:!0})=>{_e(),o.breadcrumbsLogger.error("ReplayErr",{code:t.code,name:t.name}),bt(e,t,{reportError:r})},b=async(e,t)=>{try{return await e()}catch(r){O(t,r)}},oe=()=>{g.isRecording&&(b(()=>{var e,t;return(t=(e=window.rrwebRecord)==null?void 0:e.takeFullSnapshot)==null?void 0:t.call(e,!0)},"Error recording full snapshot"),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:lt},{targetOrigin:e.origin})}))};let Q=0;(async()=>Ae()&&Promise.allSettled([ne("replayStorage"),ne("sprig.replay")]))();const l=new class{constructor(){N(this,"wrapTransactionWithCounter",e=>{var n,a;const t=(a=(n=window.Sprig)==null?void 0:n._config)==null?void 0:a.outstandingTransactionLimit,r=t===void 0?100:t;if(r&&Q>r){const s="Too many outstanding transactions";O(s,new Error(s),{reportError:!1})}Q++,e.done.finally(()=>{Q--})});N(this,"getTransaction",async e=>{const t=(await this.openDB()).transaction(e,"readwrite");return this.wrapTransactionWithCounter(t),t})}openDB(){return function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:s}={}){const i=indexedDB.open(e,t),c=x(i);return n&&(i.onupgradeneeded=d=>{n(x(i.result),d.oldVersion,d.newVersion,x(i.transaction),d)}),r&&(i.onblocked=d=>r(d.oldVersion,d.newVersion,d)),c.then(d=>{s&&(d.onclose=()=>s()),a&&(d.onversionchange=u=>a(u.oldVersion,u.newVersion,u))}).catch(()=>{}),c}("sprigReplay",1,{upgrade:(e,t,r)=>{if(r===0&&o.sessionStorageHelper.setItem("sprig.pendingCount","0"),!e.objectStoreNames.contains("events")){const n=e.createObjectStore("events",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+timestamp]",["sessionId","timestamp"])}if(!e.objectStoreNames.contains("chunkUploads")){const n=e.createObjectStore("chunkUploads",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+status]",["sessionId","status"]),n.createIndex("[uploadId+status]",["uploadId","status"]),n.createIndex("[sessionId+status+uploadId]",["sessionId","status","uploadId"])}if(!e.objectStoreNames.contains("pendingCaptures")){const n=e.createObjectStore("pendingCaptures",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+targetTimestamp]",["sessionId","targetTimestamp"])}}})}async deleteDB(){try{await ne("sprigReplay")}catch{}}async bulkAdd(e,t){const r=await this.getTransaction(e);return Promise.all([...t.map(n=>r.store.add(n)),r.done])}async clearAll(){const e=(await this.openDB()).transaction(["events","chunkUploads","pendingCaptures"],"readwrite");return this.wrapTransactionWithCounter(e),Promise.all([e.objectStore("events").clear(),e.objectStore("chunkUploads").clear(),e.objectStore("pendingCaptures").clear()])}async deleteBySessionId(e,t){const r=IDBKeyRange.only(t),n=await this.getTransaction(e),a=n.store.index("sessionId");for await(const s of a.iterate(r))await s.delete();await n.done}async updatePartial(e,t,r){const n=await this.getTransaction(e),a=await n.store.get(t);a&&await n.store.put({...a,...r}),await n.done}async deleteRowsBefore(e,t,r=()=>!0){const n=IDBKeyRange.upperBound(t,!0),a=await this.getTransaction(e),s=a.store.index("timestamp");for await(const i of s.iterate(n))r(i.value)&&await i.delete();await a.done}async getEventsBetween(e,t=Date.now()){if(e>=t)return Promise.resolve([]);const r=IDBKeyRange.bound([h,e],[h,t],!1,!0);return(await this.openDB()).getAllFromIndex("events","[sessionId+timestamp]",r)}async updateEventsExpiredAt(e,t,r=30){const n=new Date,a=n.setMinutes(n.getMinutes()+(r??30)),s=await this.getTransaction("events"),i=s.store.index("[sessionId+timestamp]"),c=IDBKeyRange.bound([h,e],[h,t],!1,!0);for await(const d of i.iterate(c))await d.update({...d.value,expiredAt:a});await s.done}async deleteChunkUploads(e,t){const r=IDBKeyRange.only([t,e]),n=await this.getTransaction("chunkUploads");let s=await n.store.index("[uploadId+status]").openCursor(r);for(;s;)s.delete(),s=await s.continue();await n.done}async getChunkUploadsByStatus({sessionId:e,status:t,uploadId:r}){const n=(await this.openDB()).transaction("chunkUploads","readonly");this.wrapTransactionWithCounter(n);const a=r?n.store.index("[uploadId+status]"):n.store.index("[sessionId+status]"),s=r?IDBKeyRange.only([r,t]):IDBKeyRange.only([e,t]);return a.getAll(s)}async getPendingCaptures(e={}){return(await(await this.openDB()).getAllFromIndex("pendingCaptures","sessionId",h)).filter(r=>!e.beforePresent||r.targetTimestamp<Date.now()).filter(r=>!e.isBeforeType||r.captureParams.replayParams.replayDurationType==="before").filter(r=>!e.isHeatmap||(r.captureParams.isHeatmap??!1))}async markPendingCaptureToCanUpload(e){const t=await this.getTransaction("pendingCaptures"),r=t.store.index("sessionId");for await(const n of r.iterate(h)){const a=n.value;a.captureParams.responseGroupId===e&&await n.update({...a,canUpload:!0})}await t.done}async markPendingHeatmapsReady(e){if(parseInt(o.sessionStorageHelper.getItem("sprig.pendingCount")??"0")===0)return null;const t=Date.now(),r=await this.getTransaction("pendingCaptures"),n=r.store.index("sessionId");for await(const a of n.iterate(h)){const s=a.value;!s.captureParams.isHeatmap||e&&!e.includes(s.uuid)||await a.update({...s,targetTimestamp:t,captureParams:{...s.captureParams,triggerTimestamp:t,replayParams:{...s.captureParams.replayParams,replayDurationSeconds:Math.floor((t-s.timestamp)/1e3)}}})}await r.done}},U=[];let F,He,J,Ne,G,Oe,M=[],_=!1,A=0,W=!1,Fe=!1,me=[],X=!1;const H=()=>W&&!_&&Date.now()<=J,St=({apiUrl:e,config:t,triggerSnapshot:r,forceInit:n=!1})=>{W&&!n||(o.sessionStorageHelper.isStorageAvailable?(M=[],me.splice(0),U.splice(0),A=0,G=r,He=e,F={responseGroupUuid:t.responseGroupUuid,surveyId:t.surveyId,userAgent:t.userAgent,sdkVersion:t.sdkVersion},Ne=t.maxDurationSeconds,Ct(),W||(Oe=window.setInterval(Rt,500)),W=!0):_=!0)},Dt=[P.Drag,P.Input,P.MediaInteraction,P.MouseInteraction,P.MouseMove,P.Scroll,P.Selection,P.TouchMove],Et=e=>e.type===L.Custom||e.type===L.IncrementalSnapshot&&Dt.includes(e.data.source),we=e=>e.some(Et),Rt=async()=>{if(!H())return void window.clearInterval(Oe);if(Ve(),!we(U))return;const e=U[0].timestamp;Date.now()-e>35e3&&(G==null||G())},Ve=async()=>{if(M.length||X)return;X=!0;const e=await Pt();if(!e)return void(_=!0);me.splice(0,e.length).forEach(t=>t(e.shift())),e.forEach(t=>M.push(t)),X=!1},Ct=()=>{const e=o.sessionStorageHelper.getItem("sprig.alwayson.info");if(e){o.breadcrumbsLogger.info("Read stored session state",e);const t=JSON.parse(e);_=t.disabled,F=t.metadata,M=t.uploadUrls,A=t.currentIndex,J=t.expirationTimestamp,t.pendingEventTimestamp&&(o.breadcrumbsLogger.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`),Tt(t.pendingEventTimestamp))}else J=1e3*Ne+Date.now()},Tt=async e=>{const t=Date.now(),r=(await l.getEventsBetween(e,t)).map(a=>JSON.parse(a.event));if(!we(r))return;je(r);const n=await $e();n&&await We(n,r)},Ge=async(e,t)=>{try{const r=await e();if(!r.ok)throw new Error(`Error ${t}`);return r}catch{_=!0}},We=async(e,t)=>{if(!H()||!e)return;const r=await(async n=>{const a=new TextEncoder,s=new CompressionStream("gzip"),i=s.writable.getWriter(),c=a.encode(JSON.stringify(n));return i.write(c),i.close(),new Uint8Array(await new Response(s.readable).arrayBuffer())})(t);o.breadcrumbsLogger.info("Uploading always-on events with presigned url"),await Ge(()=>o.sprigFetch(e,{body:r,method:"PUT"}),"uploading always-on with presigned url")},Pt=async()=>{if(!H())return;const{surveyId:e,responseGroupUuid:t}=F,r={responseGroupUuid:t,surveyId:e,index:A+1};o.breadcrumbsLogger.info("Fetching always-on upload urls",r);const n=await Ge(()=>o.sprigFetch(`${He}/sdk/1/replayUrls`,{method:"POST",body:JSON.stringify(r),headers:o.getHttpHeaders(window.UserLeap)}),"fetching always-on signed urls");if(!n)return;const a=n.json.signedUrls;return o.breadcrumbsLogger.info("Fetched more always-on upload urls",{body:r,urls:a}),a},$e=async()=>{if(M.length)return M.shift();const e=new Promise(t=>{me.push(t)});return Ve(),e},je=e=>{var a,s,i;const t=e.length?e[e.length-1].timestamp:Date.now(),r=A,n=((s=(a=window.UserLeap)==null?void 0:a.config)==null?void 0:s.customMetadata)??((i=window.__cfg)==null?void 0:i.customMetadata);A++,e.push({timestamp:t,type:L.Custom,data:{tag:"Sprig_Meta",payload:{...F,index:r,visitorId:window.UserLeap.visitorId??"",timestamp:t,customMetadata:n}}})},kt=(e,t)=>{H()&&!Fe&&(e||U.length)&&(e&&U.length&&(async()=>{const r=U.splice(0);if(!we(r))return;o.breadcrumbsLogger.info("Capturing always-on event array to upload"),je(r);const n=await $e();n&&await We(n,r)})(),U.push(t))};window.addEventListener("beforeunload",async()=>{Fe=!0,H()&&(o.breadcrumbsLogger.info("Always On handle page unload"),(()=>{let e;U.length&&(e=U[0].timestamp);const t={disabled:_,metadata:F,uploadUrls:M,currentIndex:A,pendingEventTimestamp:e,expirationTimestamp:J};o.breadcrumbsLogger.info("Storing session state on unload",t),o.sessionStorageHelper.setItem("sprig.alwayson.info",JSON.stringify(t))})())});const Ke=async(e,t)=>{const r=performance.now();let n;try{n=await e()}finally{const a=performance.now()-r;let s=o.PerformanceMetrics[t];s||(s=o.registerMetric(t)),s.report(a/1e3)}return n},Je=(e,t)=>{const r=performance.now();try{e()}finally{const n=performance.now()-r;let a=o.PerformanceMetrics[t];a||(a=o.registerMetric(t)),a.report(n/1e3)}};let qe=5e3,ie=6e4,de=0,B,ce=!1,ue=[];const Ut=e=>{var t,r,n,a;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const s=(a=(n=(r=JSON.parse(e.event))==null?void 0:r.data)==null?void 0:n.payload)==null?void 0:a.xPath;if(!s)return;g.scrollEventUuids[s]=e.uuid}ue.push(e),ce||Lt()},Lt=()=>{ce=!0,setTimeout(async()=>{if(C()||K())return;const e=ue;ue=[],ce=!1,Je(async()=>{await(async t=>{const r=t.map(n=>({...n,sessionId:n.sessionId??h}));if(r.length!==0)return b(()=>l.bulkAdd("events",r),"Error storing replay events")})(e)},"sdk_replay_add_event_batch_seconds")},500)},xt=(e,t,r)=>{g.cleanupInterval=window.setInterval(()=>{const n=Date.now();Ke(()=>b(async()=>{C()||await Promise.all([l.deleteRowsBefore("events",n-1e3*e,a=>a.expiredAt===void 0||a.expiredAt<n-1e3*e),l.deleteRowsBefore("chunkUploads",n-1e3*t),l.deleteRowsBefore("pendingCaptures",n-1e3*r,a=>!a.canUpload)])},"Error deleting table rows"),"sdk_replay_cleanup_seconds"),o.breadcrumbsLogger.debug("CleanupComplete")},3e4)},Bt=()=>{g.pendingCheckInterval=window.setInterval(async()=>{b(async()=>{await le()},"Error initiating pending captures")},5e3)};let Y=!1;const le=async(e=!1)=>{if(!Y)try{Y=!0;const t=parseInt(B??"0");if(t===0)return;const r=await l.getPendingCaptures({beforePresent:!0,isBeforeType:e}),n=await l.openDB();await Promise.all(r.map(async a=>(await n.delete("pendingCaptures",a.uuid),Xe(a.captureParams,a.canUpload)))),B=(t-r.length).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B)}finally{Y=!1}},Mt=async(e,t,r,n,a)=>{const s=Math.min(e+a,r),i=await Ke(()=>l.getEventsBetween(e,s),"sdk_replay_get_events_between_seconds");if(!(i!=null&&i.length))return o.breadcrumbsLogger.debug("NoEventsFound"),{validStartFound:n,events:[]};if(!n){o.breadcrumbsLogger.debug("ValidStartSearch");let c=-1;return i==null||i.forEach((d,u)=>{if(!d.isValidStart)return;const w=d.timestamp<=t;(c<0||w)&&(c=u)}),c<0?(o.breadcrumbsLogger.debug("ValidStartNotFound"),{validStartFound:n,events:[]}):{validStartFound:!0,events:i==null?void 0:i.slice(c)}}return{validStartFound:n,events:i}},ze=e=>Promise.all(e.map(async t=>{const r=await(async n=>Ce.execute(async()=>{var i;o.breadcrumbsLogger.info("UploadChunkStart",{chunkIndex:n.chunkIndex,surveyId:n.surveyId});const a=await o.sprigFetch(n.uploadUrl,{body:n.data,method:"PUT"});o.breadcrumbsLogger.http("UploadChunkEnd",{url:n.uploadUrl,method:"PUT",status_code:a.status,reason:a.statusText??"OK",chunkIndex:n.chunkIndex,surveyId:n.surveyId});const s=(i=a.headers)==null?void 0:i.get("ETag");if(!s)throw new Error(`Upload response did not include etag for upload ${n.uploadId}, part ${n.chunkIndex}`);return s}))(t);return await l.updatePartial("chunkUploads",t.uuid,{data:null,etag:r,status:"UploadComplete"}),t.uploadId})),Qe=async e=>{const t=await l.getChunkUploadsByStatus({status:"UploadComplete",uploadId:e});if(!(t!=null&&t.length))return void o.breadcrumbsLogger.info("NoChunksForUpload",{uploadId:e});const r=t.reduce((s,i)=>(s.find(c=>c.chunkIndex===i.chunkIndex)||s.push(i),s),[]);r.sort((s,i)=>s.chunkIndex-i.chunkIndex);const n=r.map(s=>({ETag:s.etag,PartNumber:s.chunkIndex})).filter(s=>s.ETag!==null),a=r[0];await Te({apiUrl:a.apiUrl,surveyId:a.surveyId,uploadId:e,responseGroupUuid:a.responseGroupId,etags:n,headers:a.completeUploadHeaders,replayDuration:a.replayDuration}),await l.deleteChunkUploads("UploadComplete",e)},At=()=>{b(async()=>{const e=await l.getChunkUploadsByStatus({sessionId:h,status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await ze(e);t!=null&&t.length&&await Promise.all(t.map(r=>{if(r)return Qe(r)}))},"Error uploading unfinished chunks")},_t=async(e,t)=>{const r=t??Date.now();return(async(n,a)=>{const s=new TextEncoder;let i=null;const c=new CompressionStream("gzip"),d=c.writable.getWriter();let u=!1,w=!1,[p,f]=[0,0],m=[];for(let T=n-35e3;T<a;T+=ie){if({validStartFound:w,events:m}=await Mt(T,n,a,w,ie),!(m!=null&&m.length)){o.breadcrumbsLogger.debug("NoEventsFound");continue}p===0&&(p=m[0].timestamp),f=m[m.length-1].timestamp;const y=m.map(E=>E.event);y.push(`{"timestamp":${a}}`);const I=`${u?",":"["}${y}`,v=s.encode(I);Je(()=>{d.write(v)},"sdk_replay_compression_seconds"),u=!0}if(f-p<qe)return o.breadcrumbsLogger.debug("ReplayTooShort"),null;const D=s.encode("]");return d.write(D),d.close(),i=new Uint8Array(await new Response(c.readable).arrayBuffer()),i})(r-e,r)},De=async e=>{const{surveyId:t,responseGroupId:r,visitorId:n,apiUrl:a,completeUploadHeaders:s,replayParams:i,triggerTimestamp:c}=e,d=await _t(1e3*i.replayDurationSeconds,c);if(!(d!=null&&d.length))return void o.breadcrumbsLogger.info("FileDataEmpty",{surveyId:t});const u=((p,f,m)=>{const D=p.length,T=1024*f*1024,y=Math.ceil(D/m),I=Math.max(T,y),v=[];let E=0;for(;E<D;)v.push(p.slice(E,E+I)),E+=I;return v})(d,i.minimumChunkSizeMb,i.signedUrls.length),w=await Promise.all(u.map(async(p,f)=>{const m=o.v4(),D={apiUrl:a,chunkIndex:f+1,completeUploadHeaders:s,etag:null,responseGroupId:r,status:"ReadyForUpload",surveyId:t,timestamp:c,totalChunks:u.length,data:p,uploadId:i.uploadId,uploadUrl:i.signedUrls[f].url,uuid:m,visitorId:n};return await(await l.openDB()).add("chunkUploads",{...D,sessionId:D.sessionId??h}),D}));await(async(p,f)=>{await ze(f),await Promise.all(p.map(m=>Qe(m)))})([i.uploadId],w)},Xe=async(e,t)=>{if(C())return o.breadcrumbsLogger.debug("ReplayDisabled-ScheduleOrCapture");const{isHeatmap:r,isStandalone:n,replayParams:a,triggerTimestamp:s,responseGroupId:i}=e,c=async()=>{setTimeout(()=>o.eventEmitter.removeListener(o.SprigEvent.QuestionAnswered,c),0),b(async()=>{a.replayDurationType==="before"?await De(e):await l.markPendingCaptureToCanUpload(i)},"Error in schedule/capture callback")};b(async()=>{if(a.replayDurationType==="after"||a.replayDurationType==="beforeAndAfter")return!n&&!r&&o.eventEmitter.on(o.SprigEvent.QuestionAnswered,c),void await Ze(e);if(n||r||t)await De(e),r&&Ht();else{const d=35+a.replayDurationSeconds,u=s-1e3*d,w=s;await l.updateEventsExpiredAt(u,w,a.expirationTimeLimitMinutes),o.eventEmitter.on(o.SprigEvent.QuestionAnswered,c)}},"Error in scheduling/capturing replay")},Ht=async()=>{parseInt(B??"0")||o.sessionStorageHelper.removeItem("sprig.isCapturingHeatmap"),o.sessionStorageHelper.getItem("sprig.teardownAfterCapture")&&(_e(),Ye(),o.sessionStorageHelper.removeItem("sprig.teardownAfterCapture"))},Ye=async()=>C()?o.breadcrumbsLogger.debug("ReplayDisabled-ClearData"):Promise.all([l.deleteBySessionId("events",h),l.deleteBySessionId("pendingCaptures",h)]).catch(e=>{O("Error clearing user replay data",e)}),Ze=async e=>{if(C())return;const{isHeatmap:t,surveyId:r}=e,n=await l.getPendingCaptures(),a=n==null?void 0:n.filter(d=>d.captureParams.surveyId===r);if(a!=null&&a.length)return void o.breadcrumbsLogger.info("PendingCaptureExists",{surveyId:r});t&&(oe(),o.sessionStorageHelper.setItem("sprig.isCapturingHeatmap","true"),de=Date.now(),g.inactivityInterval||(g.inactivityInterval=window.setInterval(()=>{var d;d=de,Date.now()-d>=3e4&&b(()=>l.markPendingHeatmapsReady(),"Error in heatmap inactivity")},1e3)));const s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const i=e.triggerTimestamp+1e3*e.replayParams.replayDurationSeconds;s.triggerTimestamp=i,B=(parseInt(B??"0")+1).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B),await(await l.openDB()).add("pendingCaptures",{canUpload:!1,captureParams:s,sessionId:h,targetTimestamp:i,timestamp:Date.now(),uuid:o.v4()})},Nt=Object.freeze(Object.defineProperty({__proto__:null,RecordEvent:e=>{k("Sprig_TrackEvent",e)},RecordPageView:e=>{e.description&&(e.description=ge(e.description)),k("Sprig_PageView",e)},RecordSurveyShown:e=>{k("Sprig_ShowSurvey",e)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:t,eventDigest:r,headers:n})=>{if(!e||!t)return!1;const a=window.UserLeap._API_URL,s=await Te({surveyId:e,responseGroupUuid:t,eventDigest:r,apiUrl:a,headers:n},!0);return!(s!=null&&s.error)},checkPendingHeatmapsUrl:()=>C()?o.breadcrumbsLogger.debug("ReplayDisabled-PendingHeatmaps"):b(async()=>{const e=(await l.getPendingCaptures({isHeatmap:!0})).map(t=>({eventId:t.captureParams.eventId,uuid:t.uuid})).filter(({eventId:t})=>!o.checkUrlStillMatching(t)).map(({uuid:t})=>t);return o.breadcrumbsLogger.info("PendingHeatmapsToComplete",{count:e.length}),e.length&&(await l.markPendingHeatmapsReady(e),o.breadcrumbsLogger.info("MarkedPendingHeatmapsReady")),e.length},"Error marking pending heatmaps ready"),clearUserReplayData:Ye,disableRecording:O,initializeReplay:async({maxReplayDurationSeconds:e,maxInflightRequests:t=2,replaySettings:r,teardownAfter:n=!1,apiUrl:a,alwaysOnConfig:s})=>{if(s&&St({apiUrl:a,config:s,triggerSnapshot:()=>{oe()}}),B=o.sessionStorageHelper.getItem("sprig.pendingCount"),g.isRecording)return;if(n&&o.sessionStorageHelper.setItem("sprig.teardownAfterCapture","true"),C())return o.breadcrumbsLogger.debug("ReplayDisabled");if(await(async()=>{var d;if(!Ae())return!0;if((d=window.navigator.storage)!=null&&d.estimate)try{const{quota:u=0,usage:w=0}=await window.navigator.storage.estimate(),p=(u-w)/1024**3;return o.breadcrumbsLogger.info("Storage",{availableGb:p}),p<.5}catch{return!0}return!1})())return o.breadcrumbsLogger.debug("IDBNotSupported"),se();try{const d=await l.openDB();o.breadcrumbsLogger.info("DBVersion",{version:d.version})}catch(d){return o.breadcrumbsLogger.error("ReplayOpenErr",{name:d.name}),d.name==="VersionError"&&l.deleteDB(),se()}b(async()=>{await le(!0)},"Error uploading ready pending captures");const i=H()?30:0,c=Math.max(e??0,i);if(!c)return o.breadcrumbsLogger.debug("MissingDuration");o.breadcrumbsLogger.debug("ReplayInit"),await b(async()=>{var d;r!=null&&r.minDuration&&(qe=r.minDuration),r!=null&&r.batchDuration&&(ie=r.batchDuration),d=t,Ce.setLimit(d),At(),xt(c+35,1800,c+35),Bt();const u=window.UserLeap.replayLibraryURL??"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.17.min.js";if(!window.rrwebRecord){const{record:y}=await import(u);window.rrwebRecord=y}const w=window.rrwebRecord;if(!w)return o.breadcrumbsLogger.error("RecordScriptFailed");let p=!0,f=0;const m={checkoutEveryNms:3e4,sampling:{input:"last",scroll:250,media:800},...r};var D,T;g.stopRecording=w({emit:(y,I)=>{if(y.type===L.Custom&&(de=Date.now()),C()||K())return;if(I&&y.type===L.Meta)f=performance.now();else if(I&&f&&y.type===L.FullSnapshot){const E=performance.now()-f;o.reportAndRegister("sdk_replay_snapshot_seconds",E/1e3)}const v=p||!!I&&y.type===L.Meta;p=!1,kt(v,y),Ut({uuid:o.v4(),event:JSON.stringify(y),isValidStart:v,timestamp:Date.now()})},...m}),g.isRecording=!!g.stopRecording,g.isRecording&&(((y,I)=>{window.addEventListener("message",v=>{var E;v.data.type===ct&&(pe.push({source:v.source,origin:v.origin}),(E=v.source)==null||E.postMessage({type:ut,settings:y,replayLibraryUrl:I},{targetOrigin:v.origin}))})})(m,u),o.eventEmitter.on("survey.complete",y=>{var I;I={id:y,userAgent:window.navigator.userAgent},k("Sprig_SubmitSurvey",I)}),D=k,T=It,j||(S=D,V=T,window.addEventListener("click",xe,R),window.addEventListener("pointerdown",Me,R),window.addEventListener("mousedown",Be,R),window.addEventListener("keydown",Ue,R),window.addEventListener("scroll",Le,R),j=!0,ft(),ht()))},"Error initializing replay")},isReplayPaused:K,isReplayRecording:()=>g.isRecording,recordFullSnapshot:oe,recordReplayPaused:()=>{k("Sprig_ReplayPaused",{timestamp:Date.now()}),o.sessionStorageHelper.setItem("sprig.isReplayPaused","true")},recordReplayResumed:()=>{o.sessionStorageHelper.removeItem("sprig.isReplayPaused"),k("Sprig_ReplayResumed",{timestamp:Date.now()})},scheduleCapture:Ze,scheduleOrCaptureReplay:Xe,tryReplayAction:b,uploadReadyPendingCaptures:le},Symbol.toStringTag,{value:"Module"}));o.registerReplay(Nt);
|
|
1
|
+
"use strict";var et=Object.defineProperty;var tt=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>tt(e,typeof t!="symbol"?t+"":t,r);const o=require("./metricsReporter-BvLxSPGb.cjs");var L=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(L||{}),P=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(P||{});const Z=(e,t)=>t.some(r=>e instanceof r);let ye,fe;const ee=new WeakMap,q=new WeakMap,$=new WeakMap;let te={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return ee.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return x(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&(t==="done"||t==="store")||t in e};function Ee(e){te=e(te)}function rt(e){return(fe||(fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(re(this),t),x(this.request)}:function(...t){return x(e.apply(re(this),t))}}function nt(e){return typeof e=="function"?rt(e):(e instanceof IDBTransaction&&function(t){if(ee.has(t))return;const r=new Promise((n,a)=>{const s=()=>{a(t.error||new DOMException("AbortError","AbortError"))};t.oncomplete=()=>{n()},t.onerror=s,t.onabort=s});ee.set(t,r)}(e),Z(e,ye||(ye=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,te):e)}function x(e){if(e instanceof IDBRequest)return function(r){const n=new Promise((a,s)=>{r.onsuccess=()=>{a(x(r.result))},r.onerror=()=>{s(r.error)}});return $.set(n,r),n}(e);if(q.has(e))return q.get(e);const t=nt(e);return t!==e&&(q.set(e,t),$.set(t,e)),t}const re=e=>$.get(e);function ne(e,{blocked:t}={}){const r=indexedDB.deleteDatabase(e);return t&&(r.onblocked=n=>t(n.oldVersion,n)),x(r).then(()=>{})}const at=["get","getKey","getAll","getAllKeys","count"],st=["put","add","delete","clear"],z=new Map;function he(e,t){if(!(e instanceof IDBDatabase)||t in e||typeof t!="string")return;if(z.get(t))return z.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,a=st.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!at.includes(r))return;const s=async function(i,...c){const d=this.transaction(i,a?"readwrite":"readonly");let u=d.store;return n&&(u=u.index(c.shift())),(await Promise.all([u[r](...c),a&&d.done]))[0]};return z.set(t,s),s}Ee(e=>({...e,get:(t,r,n)=>he(t,r)||e.get(t,r,n),has:(t,r)=>!!he(t,r)||e.has(t,r)}));const ot=["continue","continuePrimaryKey","advance"],Ie={},ae=new WeakMap,Re=new WeakMap,it={get(e,t){if(!ot.includes(t))return e[t];let r=Ie[t];return r||(r=Ie[t]=function(...n){ae.set(this,Re.get(this)[t](...n))}),r}};async function*dt(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,it);for(Re.set(r,t),$.set(r,re(t));t;)yield r,t=await(ae.get(r)||t.continue()),ae.delete(r)}function ve(e,t){return t===Symbol.asyncIterator&&Z(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Z(e,[IDBIndex,IDBObjectStore])}Ee(e=>({...e,get:(t,r,n)=>ve(t,r)?dt:e.get(t,r,n),has:(t,r)=>ve(t,r)||e.has(t,r)}));const ct="sprigReplayIframeLoaded",ut="sprigReplayIframeSettings",lt="sprigReplayIframeTakeFullSnapshot",pt="sprigReplayTeardown",pe=[],Ce=new class{constructor(e){N(this,"awaitingResolvers",[]);N(this,"activeCount",0);this.capacity=e}async acquire(){if(!(this.activeCount<this.capacity))return new Promise(e=>{this.awaitingResolvers.push(e)});this.activeCount++}release(){const e=this.awaitingResolvers.shift();e&&this.activeCount<=this.capacity?e():this.activeCount--}async execute(e){try{return await this.acquire(),await e()}finally{this.release()}}setLimit(e){this.capacity=e}}(2),Te=async({apiUrl:e,surveyId:t,uploadId:r,etags:n,headers:a,responseGroupUuid:s,replayDuration:i,eventDigest:c},d=!1)=>{var w;if(!d&&!r&&!n)return void o.breadcrumbsLogger.error("UploadErr",{isMobile:d,uploadId:r,etags:n});o.breadcrumbsLogger.info("MarkUploadComplete",{surveyId:t});const u=await o.sprigFetch(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:n,uploadId:r,responseGroupUuid:s,surveyId:t,replayDuration:i,eventDigest:c,userAgent:(w=window==null?void 0:window.navigator)==null?void 0:w.userAgent}),headers:a,shouldRetryRequest:!0});return o.breadcrumbsLogger.info("MarkUploadDone",{surveyId:t}),u},gt=e=>{if(e instanceof Attr)return null;let t=1;for(let r=e.previousSibling;r;r=r.previousSibling)r.nodeName===e.nodeName&&++t;return t},Pe=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let r=e;r&&!(r instanceof Document)&&r!==null;r=r instanceof Attr?r.ownerElement:r.parentElement){const n=t[t.length]={name:void 0,position:null};switch(r.nodeType){case Node.TEXT_NODE:n.name="text()";break;case Node.ATTRIBUTE_NODE:n.name="@"+r.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:n.name="processing-instruction()";break;case Node.COMMENT_NODE:n.name="comment()";break;case Node.ELEMENT_NODE:n.name=r.nodeName}n.position=gt(r)}return"/"+t.reverse().map(r=>r.position!==null?`/${r.name}[${r.position}]`:`/${r.name}`).join("")},ge=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),R={capture:!0,passive:!0},mt=["a","button","input","option","li","link"],wt=["Escape","Enter","Backspace","F5","Tab"];let j=!1,S=null,V=null;const be=e=>{var r;if(((r=e.tagName)==null?void 0:r.toLowerCase())==="html")return{element:"html"};const t={};return t.element=(n=>{if(!n.tagName)return"No tagName";const a=n.getAttribute("type");return a?`${a} ${n.tagName.toLowerCase()}`:n.tagName.toLowerCase()})(e),t},yt=e=>{var n;if(!e)return{};const t={...be(e)},r=e.parentElement;if(r&&mt.includes((n=r.tagName)==null?void 0:n.toLowerCase())){const a=be(r);Object.assign(t,a)}return t},ke=(e,t)=>{var a,s;let r=t.target;var n;t.target===((a=window.document)==null?void 0:a.body)&&window.Sprig.pointerDownTarget&&(r=window.Sprig.pointerDownTarget),n={x:t.x,y:t.y,type:e,elementAttributes:yt(r),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...r instanceof HTMLElement?{rect:r==null?void 0:r.getBoundingClientRect(),xPath:Pe(r)}:{}},(s=n==null?void 0:n.elementAttributes)!=null&&s.text&&(n.elementAttributes.text=ge(n.elementAttributes.text)),S==null||S("Sprig_Click",n)},Ue=e=>{var t;wt.includes(e.key)&&(t={key:e.key},S==null||S("Sprig_Keystroke",t))},ft=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&(e={url:window.location.href,currentPageTitle:document.title},S==null||S("Sprig_Refresh",e))},ht=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&((e={curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title}).currentPageTitle&&(e.currentPageTitle=ge(e.currentPageTitle)),S==null||S("Sprig_BackForward",e))},Le=((e,t)=>{let r;return n=>{clearTimeout(r),r=window.setTimeout(()=>e(n),t)}})(e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),V==null||V({xPath:Pe(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},750),xe=(Se="left_click",e=>ke(Se,e));var Se;const Be=e=>{e.button===2&&ke("right_click",e)},Me=e=>{window.Sprig&&(window.Sprig.pointerDownTarget=e.target)},g={isRecording:!1,scrollEventUuids:{},stopRecording:()=>{}},Ae=()=>window.indexedDB&&window.IDBKeyRange&&window.CompressionStream,h=(()=>{const e=o.sessionStorageHelper.getItem("sprig.sessionId");if(e)return o.breadcrumbsLogger.info("SessionIDFound",{savedSessionId:e}),o.sessionStorageHelper.removeItem("sprig.sessionId"),e;const t=o.v4();return o.breadcrumbsLogger.info("GeneratedSessionID",{uuid:t}),t})(),se=()=>{o.sessionStorageHelper.setItem("sprig.disableReplayRecording","disabled")},C=()=>!!o.sessionStorageHelper.getItem("sprig.disableReplayRecording"),K=()=>!!o.sessionStorageHelper.getItem("sprig.isReplayPaused");window.addEventListener("beforeunload",()=>{o.breadcrumbsLogger.info("BeforeUnload",{sessionId:h}),o.sessionStorageHelper.setItem("sprig.sessionId",h)});const k=(e,t)=>{var r,n;if(!C()&&g.isRecording&&!K())try{(n=(r=window.rrwebRecord)==null?void 0:r.addCustomEvent)==null||n.call(r,e,t)}catch(a){O("Error recording custom event",a)}},It=async e=>{const{x:t,xPath:r,y:n}=e,a=g.scrollEventUuids[r];if(a)return b(async()=>{var c,d,u,w;const s=await l.openDB(),i=await s.get("events",a);if(i!=null&&i.event){const p=JSON.parse(i.event),f=t>((d=(c=p.data)==null?void 0:c.payload)==null?void 0:d.x),m=n>((w=(u=p.data)==null?void 0:u.payload)==null?void 0:w.y);if(!f&&!m)return null;f&&(p.data.payload.x=t),m&&(p.data.payload.y=n),p.data.payload.elementAttributes=e.elementAttributes,i.event=JSON.stringify(p),await s.put("events",i)}else k("Sprig_Scroll",e)},"Error updating scroll event");k("Sprig_Scroll",e)},_e=()=>{g.stopRecording&&(g.stopRecording(),g.stopRecording=void 0),g.isRecording=!1,["cleanupInterval","inactivityInterval","pendingCheckInterval"].forEach(e=>{g[e]&&(clearInterval(g[e]),g[e]=void 0)}),j&&(window.removeEventListener("click",xe,R),window.removeEventListener("pointerdown",Me,R),window.removeEventListener("mousedown",Be,R),window.removeEventListener("keydown",Ue,R),window.removeEventListener("scroll",Le,R),j=!1),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:pt},{targetOrigin:e.origin})})},vt=["did not allow mutations","called in an invalid security context"],bt=(e,t,{reportError:r=!0,extraInfo:n={}})=>{if(!C()&&t instanceof Error){if(se(),t.name==="VersionError")return o.breadcrumbsLogger.error("VersionErr",{message:e}),void l.deleteDB();(a=>{if(!a)return!0;for(const s of vt)if(a.toLowerCase().includes(s))return!1;return!0})(t==null?void 0:t.message)&&(r&&window.UserLeap.reportError(e,t,n),l.clearAll())}},O=(e,t,{reportError:r}={reportError:!0})=>{_e(),o.breadcrumbsLogger.error("ReplayErr",{code:t.code,name:t.name}),bt(e,t,{reportError:r})},b=async(e,t)=>{try{return await e()}catch(r){O(t,r)}},oe=()=>{g.isRecording&&(b(()=>{var e,t;return(t=(e=window.rrwebRecord)==null?void 0:e.takeFullSnapshot)==null?void 0:t.call(e,!0)},"Error recording full snapshot"),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:lt},{targetOrigin:e.origin})}))};let Q=0;(async()=>Ae()&&Promise.allSettled([ne("replayStorage"),ne("sprig.replay")]))();const l=new class{constructor(){N(this,"wrapTransactionWithCounter",e=>{var n,a;const t=(a=(n=window.Sprig)==null?void 0:n._config)==null?void 0:a.outstandingTransactionLimit,r=t===void 0?100:t;if(r&&Q>r){const s="Too many outstanding transactions";O(s,new Error(s),{reportError:!1})}Q++,e.done.finally(()=>{Q--})});N(this,"getTransaction",async e=>{const t=(await this.openDB()).transaction(e,"readwrite");return this.wrapTransactionWithCounter(t),t})}openDB(){return function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:s}={}){const i=indexedDB.open(e,t),c=x(i);return n&&(i.onupgradeneeded=d=>{n(x(i.result),d.oldVersion,d.newVersion,x(i.transaction),d)}),r&&(i.onblocked=d=>r(d.oldVersion,d.newVersion,d)),c.then(d=>{s&&(d.onclose=()=>s()),a&&(d.onversionchange=u=>a(u.oldVersion,u.newVersion,u))}).catch(()=>{}),c}("sprigReplay",1,{upgrade:(e,t,r)=>{if(r===0&&o.sessionStorageHelper.setItem("sprig.pendingCount","0"),!e.objectStoreNames.contains("events")){const n=e.createObjectStore("events",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+timestamp]",["sessionId","timestamp"])}if(!e.objectStoreNames.contains("chunkUploads")){const n=e.createObjectStore("chunkUploads",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+status]",["sessionId","status"]),n.createIndex("[uploadId+status]",["uploadId","status"]),n.createIndex("[sessionId+status+uploadId]",["sessionId","status","uploadId"])}if(!e.objectStoreNames.contains("pendingCaptures")){const n=e.createObjectStore("pendingCaptures",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+targetTimestamp]",["sessionId","targetTimestamp"])}}})}async deleteDB(){try{await ne("sprigReplay")}catch{}}async bulkAdd(e,t){const r=await this.getTransaction(e);return Promise.all([...t.map(n=>r.store.add(n)),r.done])}async clearAll(){const e=(await this.openDB()).transaction(["events","chunkUploads","pendingCaptures"],"readwrite");return this.wrapTransactionWithCounter(e),Promise.all([e.objectStore("events").clear(),e.objectStore("chunkUploads").clear(),e.objectStore("pendingCaptures").clear()])}async deleteBySessionId(e,t){const r=IDBKeyRange.only(t),n=await this.getTransaction(e),a=n.store.index("sessionId");for await(const s of a.iterate(r))await s.delete();await n.done}async updatePartial(e,t,r){const n=await this.getTransaction(e),a=await n.store.get(t);a&&await n.store.put({...a,...r}),await n.done}async deleteRowsBefore(e,t,r=()=>!0){const n=IDBKeyRange.upperBound(t,!0),a=await this.getTransaction(e),s=a.store.index("timestamp");for await(const i of s.iterate(n))r(i.value)&&await i.delete();await a.done}async getEventsBetween(e,t=Date.now()){if(e>=t)return Promise.resolve([]);const r=IDBKeyRange.bound([h,e],[h,t],!1,!0);return(await this.openDB()).getAllFromIndex("events","[sessionId+timestamp]",r)}async updateEventsExpiredAt(e,t,r=30){const n=new Date,a=n.setMinutes(n.getMinutes()+(r??30)),s=await this.getTransaction("events"),i=s.store.index("[sessionId+timestamp]"),c=IDBKeyRange.bound([h,e],[h,t],!1,!0);for await(const d of i.iterate(c))await d.update({...d.value,expiredAt:a});await s.done}async deleteChunkUploads(e,t){const r=IDBKeyRange.only([t,e]),n=await this.getTransaction("chunkUploads");let s=await n.store.index("[uploadId+status]").openCursor(r);for(;s;)s.delete(),s=await s.continue();await n.done}async getChunkUploadsByStatus({sessionId:e,status:t,uploadId:r}){const n=(await this.openDB()).transaction("chunkUploads","readonly");this.wrapTransactionWithCounter(n);const a=r?n.store.index("[uploadId+status]"):n.store.index("[sessionId+status]"),s=r?IDBKeyRange.only([r,t]):IDBKeyRange.only([e,t]);return a.getAll(s)}async getPendingCaptures(e={}){return(await(await this.openDB()).getAllFromIndex("pendingCaptures","sessionId",h)).filter(r=>!e.beforePresent||r.targetTimestamp<Date.now()).filter(r=>!e.isBeforeType||r.captureParams.replayParams.replayDurationType==="before").filter(r=>!e.isHeatmap||(r.captureParams.isHeatmap??!1))}async markPendingCaptureToCanUpload(e){const t=await this.getTransaction("pendingCaptures"),r=t.store.index("sessionId");for await(const n of r.iterate(h)){const a=n.value;a.captureParams.responseGroupId===e&&await n.update({...a,canUpload:!0})}await t.done}async markPendingHeatmapsReady(e){if(parseInt(o.sessionStorageHelper.getItem("sprig.pendingCount")??"0")===0)return null;const t=Date.now(),r=await this.getTransaction("pendingCaptures"),n=r.store.index("sessionId");for await(const a of n.iterate(h)){const s=a.value;!s.captureParams.isHeatmap||e&&!e.includes(s.uuid)||await a.update({...s,targetTimestamp:t,captureParams:{...s.captureParams,triggerTimestamp:t,replayParams:{...s.captureParams.replayParams,replayDurationSeconds:Math.floor((t-s.timestamp)/1e3)}}})}await r.done}},U=[];let F,He,J,Ne,G,Oe,M=[],_=!1,A=0,W=!1,Fe=!1,me=[],X=!1;const H=()=>W&&!_&&Date.now()<=J,St=({apiUrl:e,config:t,triggerSnapshot:r,forceInit:n=!1})=>{W&&!n||(o.sessionStorageHelper.isStorageAvailable?(M=[],me.splice(0),U.splice(0),A=0,G=r,He=e,F={responseGroupUuid:t.responseGroupUuid,surveyId:t.surveyId,userAgent:t.userAgent,sdkVersion:t.sdkVersion},Ne=t.maxDurationSeconds,Ct(),W||(Oe=window.setInterval(Rt,500)),W=!0):_=!0)},Dt=[P.Drag,P.Input,P.MediaInteraction,P.MouseInteraction,P.MouseMove,P.Scroll,P.Selection,P.TouchMove],Et=e=>e.type===L.Custom||e.type===L.IncrementalSnapshot&&Dt.includes(e.data.source),we=e=>e.some(Et),Rt=async()=>{if(!H())return void window.clearInterval(Oe);if(Ve(),!we(U))return;const e=U[0].timestamp;Date.now()-e>35e3&&(G==null||G())},Ve=async()=>{if(M.length||X)return;X=!0;const e=await Pt();if(!e)return void(_=!0);me.splice(0,e.length).forEach(t=>t(e.shift())),e.forEach(t=>M.push(t)),X=!1},Ct=()=>{const e=o.sessionStorageHelper.getItem("sprig.alwayson.info");if(e){o.breadcrumbsLogger.info("Read stored session state",e);const t=JSON.parse(e);_=t.disabled,F=t.metadata,M=t.uploadUrls,A=t.currentIndex,J=t.expirationTimestamp,t.pendingEventTimestamp&&(o.breadcrumbsLogger.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`),Tt(t.pendingEventTimestamp))}else J=1e3*Ne+Date.now()},Tt=async e=>{const t=Date.now(),r=(await l.getEventsBetween(e,t)).map(a=>JSON.parse(a.event));if(!we(r))return;je(r);const n=await $e();n&&await We(n,r)},Ge=async(e,t)=>{try{const r=await e();if(!r.ok)throw new Error(`Error ${t}`);return r}catch{_=!0}},We=async(e,t)=>{if(!H()||!e)return;const r=await(async n=>{const a=new TextEncoder,s=new CompressionStream("gzip"),i=s.writable.getWriter(),c=a.encode(JSON.stringify(n));return i.write(c),i.close(),new Uint8Array(await new Response(s.readable).arrayBuffer())})(t);o.breadcrumbsLogger.info("Uploading always-on events with presigned url"),await Ge(()=>o.sprigFetch(e,{body:r,method:"PUT"}),"uploading always-on with presigned url")},Pt=async()=>{if(!H())return;const{surveyId:e,responseGroupUuid:t}=F,r={responseGroupUuid:t,surveyId:e,index:A+1};o.breadcrumbsLogger.info("Fetching always-on upload urls",r);const n=await Ge(()=>o.sprigFetch(`${He}/sdk/1/replayUrls`,{method:"POST",body:JSON.stringify(r),headers:o.getHttpHeaders(window.UserLeap)}),"fetching always-on signed urls");if(!n)return;const a=n.json.signedUrls;return o.breadcrumbsLogger.info("Fetched more always-on upload urls",{body:r,urls:a}),a},$e=async()=>{if(M.length)return M.shift();const e=new Promise(t=>{me.push(t)});return Ve(),e},je=e=>{var a,s,i;const t=e.length?e[e.length-1].timestamp:Date.now(),r=A,n=((s=(a=window.UserLeap)==null?void 0:a.config)==null?void 0:s.customMetadata)??((i=window.__cfg)==null?void 0:i.customMetadata);A++,e.push({timestamp:t,type:L.Custom,data:{tag:"Sprig_Meta",payload:{...F,index:r,visitorId:window.UserLeap.visitorId??"",timestamp:t,customMetadata:n}}})},kt=(e,t)=>{H()&&!Fe&&(e||U.length)&&(e&&U.length&&(async()=>{const r=U.splice(0);if(!we(r))return;o.breadcrumbsLogger.info("Capturing always-on event array to upload"),je(r);const n=await $e();n&&await We(n,r)})(),U.push(t))};window.addEventListener("beforeunload",async()=>{Fe=!0,H()&&(o.breadcrumbsLogger.info("Always On handle page unload"),(()=>{let e;U.length&&(e=U[0].timestamp);const t={disabled:_,metadata:F,uploadUrls:M,currentIndex:A,pendingEventTimestamp:e,expirationTimestamp:J};o.breadcrumbsLogger.info("Storing session state on unload",t),o.sessionStorageHelper.setItem("sprig.alwayson.info",JSON.stringify(t))})())});const Ke=async(e,t)=>{const r=performance.now();let n;try{n=await e()}finally{const a=performance.now()-r;let s=o.PerformanceMetrics[t];s||(s=o.registerMetric(t)),s.report(a/1e3)}return n},Je=(e,t)=>{const r=performance.now();try{e()}finally{const n=performance.now()-r;let a=o.PerformanceMetrics[t];a||(a=o.registerMetric(t)),a.report(n/1e3)}};let qe=5e3,ie=6e4,de=0,B,ce=!1,ue=[];const Ut=e=>{var t,r,n,a;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const s=(a=(n=(r=JSON.parse(e.event))==null?void 0:r.data)==null?void 0:n.payload)==null?void 0:a.xPath;if(!s)return;g.scrollEventUuids[s]=e.uuid}ue.push(e),ce||Lt()},Lt=()=>{ce=!0,setTimeout(async()=>{if(C()||K())return;const e=ue;ue=[],ce=!1,Je(async()=>{await(async t=>{const r=t.map(n=>({...n,sessionId:n.sessionId??h}));if(r.length!==0)return b(()=>l.bulkAdd("events",r),"Error storing replay events")})(e)},"sdk_replay_add_event_batch_seconds")},500)},xt=(e,t,r)=>{g.cleanupInterval=window.setInterval(()=>{const n=Date.now();Ke(()=>b(async()=>{C()||await Promise.all([l.deleteRowsBefore("events",n-1e3*e,a=>a.expiredAt===void 0||a.expiredAt<n-1e3*e),l.deleteRowsBefore("chunkUploads",n-1e3*t),l.deleteRowsBefore("pendingCaptures",n-1e3*r,a=>!a.canUpload)])},"Error deleting table rows"),"sdk_replay_cleanup_seconds"),o.breadcrumbsLogger.debug("CleanupComplete")},3e4)},Bt=()=>{g.pendingCheckInterval=window.setInterval(async()=>{b(async()=>{await le()},"Error initiating pending captures")},5e3)};let Y=!1;const le=async(e=!1)=>{if(!Y)try{Y=!0;const t=parseInt(B??"0");if(t===0)return;const r=await l.getPendingCaptures({beforePresent:!0,isBeforeType:e}),n=await l.openDB();await Promise.all(r.map(async a=>(await n.delete("pendingCaptures",a.uuid),Xe(a.captureParams,a.canUpload)))),B=(t-r.length).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B)}finally{Y=!1}},Mt=async(e,t,r,n,a)=>{const s=Math.min(e+a,r),i=await Ke(()=>l.getEventsBetween(e,s),"sdk_replay_get_events_between_seconds");if(!(i!=null&&i.length))return o.breadcrumbsLogger.debug("NoEventsFound"),{validStartFound:n,events:[]};if(!n){o.breadcrumbsLogger.debug("ValidStartSearch");let c=-1;return i==null||i.forEach((d,u)=>{if(!d.isValidStart)return;const w=d.timestamp<=t;(c<0||w)&&(c=u)}),c<0?(o.breadcrumbsLogger.debug("ValidStartNotFound"),{validStartFound:n,events:[]}):{validStartFound:!0,events:i==null?void 0:i.slice(c)}}return{validStartFound:n,events:i}},ze=e=>Promise.all(e.map(async t=>{const r=await(async n=>Ce.execute(async()=>{var i;o.breadcrumbsLogger.info("UploadChunkStart",{chunkIndex:n.chunkIndex,surveyId:n.surveyId});const a=await o.sprigFetch(n.uploadUrl,{body:n.data,method:"PUT"});o.breadcrumbsLogger.http("UploadChunkEnd",{url:n.uploadUrl,method:"PUT",status_code:a.status,reason:a.statusText??"OK",chunkIndex:n.chunkIndex,surveyId:n.surveyId});const s=(i=a.headers)==null?void 0:i.get("ETag");if(!s)throw new Error(`Upload response did not include etag for upload ${n.uploadId}, part ${n.chunkIndex}`);return s}))(t);return await l.updatePartial("chunkUploads",t.uuid,{data:null,etag:r,status:"UploadComplete"}),t.uploadId})),Qe=async e=>{const t=await l.getChunkUploadsByStatus({status:"UploadComplete",uploadId:e});if(!(t!=null&&t.length))return void o.breadcrumbsLogger.info("NoChunksForUpload",{uploadId:e});const r=t.reduce((s,i)=>(s.find(c=>c.chunkIndex===i.chunkIndex)||s.push(i),s),[]);r.sort((s,i)=>s.chunkIndex-i.chunkIndex);const n=r.map(s=>({ETag:s.etag,PartNumber:s.chunkIndex})).filter(s=>s.ETag!==null),a=r[0];await Te({apiUrl:a.apiUrl,surveyId:a.surveyId,uploadId:e,responseGroupUuid:a.responseGroupId,etags:n,headers:a.completeUploadHeaders,replayDuration:a.replayDuration}),await l.deleteChunkUploads("UploadComplete",e)},At=()=>{b(async()=>{const e=await l.getChunkUploadsByStatus({sessionId:h,status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await ze(e);t!=null&&t.length&&await Promise.all(t.map(r=>{if(r)return Qe(r)}))},"Error uploading unfinished chunks")},_t=async(e,t)=>{const r=t??Date.now();return(async(n,a)=>{const s=new TextEncoder;let i=null;const c=new CompressionStream("gzip"),d=c.writable.getWriter();let u=!1,w=!1,[p,f]=[0,0],m=[];for(let T=n-35e3;T<a;T+=ie){if({validStartFound:w,events:m}=await Mt(T,n,a,w,ie),!(m!=null&&m.length)){o.breadcrumbsLogger.debug("NoEventsFound");continue}p===0&&(p=m[0].timestamp),f=m[m.length-1].timestamp;const y=m.map(E=>E.event);y.push(`{"timestamp":${a}}`);const I=`${u?",":"["}${y}`,v=s.encode(I);Je(()=>{d.write(v)},"sdk_replay_compression_seconds"),u=!0}if(f-p<qe)return o.breadcrumbsLogger.debug("ReplayTooShort"),null;const D=s.encode("]");return d.write(D),d.close(),i=new Uint8Array(await new Response(c.readable).arrayBuffer()),i})(r-e,r)},De=async e=>{const{surveyId:t,responseGroupId:r,visitorId:n,apiUrl:a,completeUploadHeaders:s,replayParams:i,triggerTimestamp:c}=e,d=await _t(1e3*i.replayDurationSeconds,c);if(!(d!=null&&d.length))return void o.breadcrumbsLogger.info("FileDataEmpty",{surveyId:t});const u=((p,f,m)=>{const D=p.length,T=1024*f*1024,y=Math.ceil(D/m),I=Math.max(T,y),v=[];let E=0;for(;E<D;)v.push(p.slice(E,E+I)),E+=I;return v})(d,i.minimumChunkSizeMb,i.signedUrls.length),w=await Promise.all(u.map(async(p,f)=>{const m=o.v4(),D={apiUrl:a,chunkIndex:f+1,completeUploadHeaders:s,etag:null,responseGroupId:r,status:"ReadyForUpload",surveyId:t,timestamp:c,totalChunks:u.length,data:p,uploadId:i.uploadId,uploadUrl:i.signedUrls[f].url,uuid:m,visitorId:n};return await(await l.openDB()).add("chunkUploads",{...D,sessionId:D.sessionId??h}),D}));await(async(p,f)=>{await ze(f),await Promise.all(p.map(m=>Qe(m)))})([i.uploadId],w)},Xe=async(e,t)=>{if(C())return o.breadcrumbsLogger.debug("ReplayDisabled-ScheduleOrCapture");const{isHeatmap:r,isStandalone:n,replayParams:a,triggerTimestamp:s,responseGroupId:i}=e,c=async()=>{setTimeout(()=>o.eventEmitter.removeListener(o.SprigEvent.QuestionAnswered,c),0),b(async()=>{a.replayDurationType==="before"?await De(e):await l.markPendingCaptureToCanUpload(i)},"Error in schedule/capture callback")};b(async()=>{if(a.replayDurationType==="after"||a.replayDurationType==="beforeAndAfter")return!n&&!r&&o.eventEmitter.on(o.SprigEvent.QuestionAnswered,c),void await Ze(e);if(n||r||t)await De(e),r&&Ht();else{const d=35+a.replayDurationSeconds,u=s-1e3*d,w=s;await l.updateEventsExpiredAt(u,w,a.expirationTimeLimitMinutes),o.eventEmitter.on(o.SprigEvent.QuestionAnswered,c)}},"Error in scheduling/capturing replay")},Ht=async()=>{parseInt(B??"0")||o.sessionStorageHelper.removeItem("sprig.isCapturingHeatmap"),o.sessionStorageHelper.getItem("sprig.teardownAfterCapture")&&(_e(),Ye(),o.sessionStorageHelper.removeItem("sprig.teardownAfterCapture"))},Ye=async()=>C()?o.breadcrumbsLogger.debug("ReplayDisabled-ClearData"):Promise.all([l.deleteBySessionId("events",h),l.deleteBySessionId("pendingCaptures",h)]).catch(e=>{O("Error clearing user replay data",e)}),Ze=async e=>{if(C())return;const{isHeatmap:t,surveyId:r}=e,n=await l.getPendingCaptures(),a=n==null?void 0:n.filter(d=>d.captureParams.surveyId===r);if(a!=null&&a.length)return void o.breadcrumbsLogger.info("PendingCaptureExists",{surveyId:r});t&&(oe(),o.sessionStorageHelper.setItem("sprig.isCapturingHeatmap","true"),de=Date.now(),g.inactivityInterval||(g.inactivityInterval=window.setInterval(()=>{var d;d=de,Date.now()-d>=3e4&&b(()=>l.markPendingHeatmapsReady(),"Error in heatmap inactivity")},1e3)));const s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const i=e.triggerTimestamp+1e3*e.replayParams.replayDurationSeconds;s.triggerTimestamp=i,B=(parseInt(B??"0")+1).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B),await(await l.openDB()).add("pendingCaptures",{canUpload:!1,captureParams:s,sessionId:h,targetTimestamp:i,timestamp:Date.now(),uuid:o.v4()})},Nt=Object.freeze(Object.defineProperty({__proto__:null,RecordEvent:e=>{k("Sprig_TrackEvent",e)},RecordPageView:e=>{e.description&&(e.description=ge(e.description)),k("Sprig_PageView",e)},RecordSurveyShown:e=>{k("Sprig_ShowSurvey",e)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:t,eventDigest:r,headers:n})=>{if(!e||!t)return!1;const a=window.UserLeap._API_URL,s=await Te({surveyId:e,responseGroupUuid:t,eventDigest:r,apiUrl:a,headers:n},!0);return!(s!=null&&s.error)},checkPendingHeatmapsUrl:()=>C()?o.breadcrumbsLogger.debug("ReplayDisabled-PendingHeatmaps"):b(async()=>{const e=(await l.getPendingCaptures({isHeatmap:!0})).map(t=>({eventId:t.captureParams.eventId,uuid:t.uuid})).filter(({eventId:t})=>!o.checkUrlStillMatching(t)).map(({uuid:t})=>t);return o.breadcrumbsLogger.info("PendingHeatmapsToComplete",{count:e.length}),e.length&&(await l.markPendingHeatmapsReady(e),o.breadcrumbsLogger.info("MarkedPendingHeatmapsReady")),e.length},"Error marking pending heatmaps ready"),clearUserReplayData:Ye,disableRecording:O,initializeReplay:async({maxReplayDurationSeconds:e,maxInflightRequests:t=2,replaySettings:r,teardownAfter:n=!1,apiUrl:a,alwaysOnConfig:s})=>{if(s&&St({apiUrl:a,config:s,triggerSnapshot:()=>{oe()}}),B=o.sessionStorageHelper.getItem("sprig.pendingCount"),g.isRecording)return;if(n&&o.sessionStorageHelper.setItem("sprig.teardownAfterCapture","true"),C())return o.breadcrumbsLogger.debug("ReplayDisabled");if(await(async()=>{var d;if(!Ae())return!0;if((d=window.navigator.storage)!=null&&d.estimate)try{const{quota:u=0,usage:w=0}=await window.navigator.storage.estimate(),p=(u-w)/1024**3;return o.breadcrumbsLogger.info("Storage",{availableGb:p}),p<.5}catch{return!0}return!1})())return o.breadcrumbsLogger.debug("IDBNotSupported"),se();try{const d=await l.openDB();o.breadcrumbsLogger.info("DBVersion",{version:d.version})}catch(d){return o.breadcrumbsLogger.error("ReplayOpenErr",{name:d.name}),d.name==="VersionError"&&l.deleteDB(),se()}b(async()=>{await le(!0)},"Error uploading ready pending captures");const i=H()?30:0,c=Math.max(e??0,i);if(!c)return o.breadcrumbsLogger.debug("MissingDuration");o.breadcrumbsLogger.debug("ReplayInit"),await b(async()=>{var d;r!=null&&r.minDuration&&(qe=r.minDuration),r!=null&&r.batchDuration&&(ie=r.batchDuration),d=t,Ce.setLimit(d),At(),xt(c+35,1800,c+35),Bt();const u=window.UserLeap.replayLibraryURL??"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.17.min.js";if(!window.rrwebRecord){const{record:y}=await import(u);window.rrwebRecord=y}const w=window.rrwebRecord;if(!w)return o.breadcrumbsLogger.error("RecordScriptFailed");let p=!0,f=0;const m={checkoutEveryNms:3e4,sampling:{input:"last",scroll:250,media:800},...r};var D,T;g.stopRecording=w({emit:(y,I)=>{if(y.type===L.Custom&&(de=Date.now()),C()||K())return;if(I&&y.type===L.Meta)f=performance.now();else if(I&&f&&y.type===L.FullSnapshot){const E=performance.now()-f;o.reportAndRegister("sdk_replay_snapshot_seconds",E/1e3)}const v=p||!!I&&y.type===L.Meta;p=!1,kt(v,y),Ut({uuid:o.v4(),event:JSON.stringify(y),isValidStart:v,timestamp:Date.now()})},...m}),g.isRecording=!!g.stopRecording,g.isRecording&&(((y,I)=>{window.addEventListener("message",v=>{var E;v.data.type===ct&&(pe.push({source:v.source,origin:v.origin}),(E=v.source)==null||E.postMessage({type:ut,settings:y,replayLibraryUrl:I},{targetOrigin:v.origin}))})})(m,u),o.eventEmitter.on("survey.complete",y=>{var I;I={id:y,userAgent:window.navigator.userAgent},k("Sprig_SubmitSurvey",I)}),D=k,T=It,j||(S=D,V=T,window.addEventListener("click",xe,R),window.addEventListener("pointerdown",Me,R),window.addEventListener("mousedown",Be,R),window.addEventListener("keydown",Ue,R),window.addEventListener("scroll",Le,R),j=!0,ft(),ht()))},"Error initializing replay")},isReplayPaused:K,isReplayRecording:()=>g.isRecording,recordFullSnapshot:oe,recordReplayPaused:()=>{k("Sprig_ReplayPaused",{timestamp:Date.now()}),o.sessionStorageHelper.setItem("sprig.isReplayPaused","true")},recordReplayResumed:()=>{o.sessionStorageHelper.removeItem("sprig.isReplayPaused"),k("Sprig_ReplayResumed",{timestamp:Date.now()})},scheduleCapture:Ze,scheduleOrCaptureReplay:Xe,tryReplayAction:b,uploadReadyPendingCaptures:le},Symbol.toStringTag,{value:"Module"}));o.registerReplay(Nt);
|
package/dist/replay.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var it = Object.defineProperty;
|
|
2
2
|
var dt = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var F = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { b as d, s as Q, a as m, v as X, c as ct, g as ut, P as ke, r as Ue, d as lt, e as V, S as Z, f as pt } from "./metricsReporter-
|
|
4
|
+
import { b as d, s as Q, a as m, v as X, c as ct, g as ut, P as ke, r as Ue, d as lt, e as V, S as Z, f as pt } from "./metricsReporter-BJVpNufn.js";
|
|
5
5
|
var B = ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e))(B || {}), k = ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(k || {});
|
|
6
6
|
const re = (e, t) => t.some((n) => e instanceof n);
|
|
7
7
|
let Se, De;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./core-B84vH8bq.cjs"),H=require("./metricsReporter-Dy3EDEs8.cjs");var Me,P,jn,we,Mt,Tn,ut,Ln,Ne={},Dn=[],Qr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ze=Array.isArray;function ge(e,t){for(var n in t)e[n]=t[n];return e}function Rn(e){var t=e.parentNode;t&&t.removeChild(e)}function ie(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?Me.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Re(e,s,r,o,null)}function Re(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++jn,__i:-1,__u:0};return o==null&&P.vnode!=null&&P.vnode(i),i}function Pn(){return{current:null}}function K(e){return e.children}function le(e,t){this.props=e,this.context=t}function je(e,t){if(t==null)return e.__?je(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?je(e):null}function Nn(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Nn(e)}}function pt(e){(!e.__d&&(e.__d=!0)&&we.push(e)&&!ze.__r++||Mt!==P.debounceRendering)&&((Mt=P.debounceRendering)||Tn)(ze)}function ze(){var e,t,n,r,o,i,s,d,l;for(we.sort(ut);e=we.shift();)e.__d&&(t=we.length,r=void 0,i=(o=(n=e).__v).__e,d=[],l=[],(s=n.__P)&&((r=ge({},o)).__v=o.__v+1,P.vnode&&P.vnode(r),yt(s,r,o,n.__n,s.ownerSVGElement!==void 0,32&o.__u?[i]:null,d,i??je(o),!!(32&o.__u),l),r.__.__k[r.__i]=r,Un(d,r,l),r.__e!=i&&Nn(r)),we.length>t&&we.sort(ut));ze.__r=0}function Mn(e,t,n,r,o,i,s,d,l,u,m){var c,p,v,h,y,_=r&&r.__k||Dn,k=t.length;for(n.__d=l,function(x,L,I){var w,S,g,D,T,C=L.length,f=I.length,b=f,j=0;for(x.__k=[],w=0;w<C;w++)(S=x.__k[w]=(S=L[w])==null||typeof S=="boolean"||typeof S=="function"?null:typeof S=="string"||typeof S=="number"||typeof S=="bigint"||S.constructor==String?Re(null,S,null,null,S):Ze(S)?Re(K,{children:S},null,null,null):S.constructor===void 0&&S.__b>0?Re(S.type,S.props,S.key,S.ref?S.ref:null,S.__v):S)!=null?(S.__=x,S.__b=x.__b+1,T=Zr(S,I,D=w+j,b),S.__i=T,g=null,T!==-1&&(b--,(g=I[T])&&(g.__u|=131072)),g==null||g.__v===null?(T==-1&&j--,typeof S.type!="function"&&(S.__u|=65536)):T!==D&&(T===D+1?j++:T>D?b>C-D?j+=T-D:j--:j=T<D&&T==D-1?T-D:0,T!==w+j&&(S.__u|=65536))):(g=I[w])&&g.key==null&&g.__e&&(g.__e==x.__d&&(x.__d=je(g)),mt(g,g,!1),I[w]=null,b--);if(b)for(w=0;w<f;w++)(g=I[w])!=null&&!(131072&g.__u)&&(g.__e==x.__d&&(x.__d=je(g)),mt(g,g))}(n,t,_),l=n.__d,c=0;c<k;c++)(v=n.__k[c])!=null&&typeof v!="boolean"&&typeof v!="function"&&(p=v.__i===-1?Ne:_[v.__i]||Ne,v.__i=c,yt(e,v,p,o,i,s,d,l,u,m),h=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&xt(p.ref,null,v),m.push(v.ref,v.__c||h,v)),y==null&&h!=null&&(y=h),65536&v.__u||p.__k===v.__k?l=On(v,l,e):typeof v.type=="function"&&v.__d!==void 0?l=v.__d:h&&(l=h.nextSibling),v.__d=void 0,v.__u&=-196609);n.__d=l,n.__e=y}function On(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=On(r[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function fe(e,t){return t=t||[],e==null||typeof e=="boolean"||(Ze(e)?e.some(function(n){fe(n,t)}):t.push(e)),t}function Zr(e,t,n,r){var o=e.key,i=e.type,s=n-1,d=n+1,l=t[n];if(l===null||l&&o==l.key&&i===l.type)return n;if(r>(l==null||131072&l.__u?0:1))for(;s>=0||d<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s--}if(d<t.length){if((l=t[d])&&!(131072&l.__u)&&o==l.key&&i===l.type)return d;d++}}return-1}function Ot(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Qr.test(t)?n:n+"px"}function He(e,t,n,r,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ot(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Ot(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,i?Ht:Ut,i)):e.removeEventListener(t,i?Ht:Ut,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function Ut(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(P.event?P.event(e):e)}function Ht(e){return this.l[e.type+!0](P.event?P.event(e):e)}function yt(e,t,n,r,o,i,s,d,l,u){var m,c,p,v,h,y,_,k,x,L,I,w,S,g,D,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[d=t.__e=n.__e]),(m=P.__b)&&m(t);e:if(typeof T=="function")try{if(k=t.props,x=(m=T.contextType)&&r[m.__c],L=m?x?x.props.value:m.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in T&&T.prototype.render?t.__c=c=new T(k,L):(t.__c=c=new le(k,L),c.constructor=T,c.render=Kr),x&&x.sub(c),c.props=k,c.state||(c.state={}),c.context=L,c.__n=r,p=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),T.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ge({},c.__s)),ge(c.__s,T.getDerivedStateFromProps(k,c.__s))),v=c.props,h=c.state,c.__v=t,p)T.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(T.getDerivedStateFromProps==null&&k!==v&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(k,L),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(k,c.__s,L)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(c.props=k,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(C){C&&(C.__=t)}),I=0;I<c._sb.length;I++)c.__h.push(c._sb[I]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(k,c.__s,L),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(v,h,y)})}if(c.context=L,c.props=k,c.__P=e,c.__e=!1,w=P.__r,S=0,"prototype"in T&&T.prototype.render){for(c.state=c.__s,c.__d=!1,w&&w(t),m=c.render(c.props,c.state,c.context),g=0;g<c._sb.length;g++)c.__h.push(c._sb[g]);c._sb=[]}else do c.__d=!1,w&&w(t),m=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++S<25);c.state=c.__s,c.getChildContext!=null&&(r=ge(ge({},r),c.getChildContext())),p||c.getSnapshotBeforeUpdate==null||(y=c.getSnapshotBeforeUpdate(v,h)),Mn(e,Ze(D=m!=null&&m.type===K&&m.key==null?m.props.children:m)?D:[D],t,n,r,o,i,s,d,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),_&&(c.__E=c.__=null)}catch(C){t.__v=null,l||i!=null?(t.__e=d,t.__u|=l?160:32,i[i.indexOf(d)]=null):(t.__e=n.__e,t.__k=n.__k),P.__e(C,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Gr(n.__e,t,n,r,o,i,s,l,u);(m=P.diffed)&&m(t)}function Un(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)xt(n[r],n[++r],n[++r]);P.__c&&P.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){P.__e(i,o.__v)}})}function Gr(e,t,n,r,o,i,s,d,l){var u,m,c,p,v,h,y,_=n.props,k=t.props,x=t.type;if(x==="svg"&&(o=!0),i!=null){for(u=0;u<i.length;u++)if((v=i[u])&&"setAttribute"in v==!!x&&(x?v.localName===x:v.nodeType===3)){e=v,i[u]=null;break}}if(e==null){if(x===null)return document.createTextNode(k);e=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,k.is&&k),i=null,d=!1}if(x===null)_===k||d&&e.data===k||(e.data=k);else{if(i=i&&Me.call(e.childNodes),_=n.props||Ne,!d&&i!=null)for(_={},u=0;u<e.attributes.length;u++)_[(v=e.attributes[u]).name]=v.value;for(u in _)v=_[u],u=="children"||(u=="dangerouslySetInnerHTML"?c=v:u==="key"||u in k||He(e,u,null,v,o));for(u in k)v=k[u],u=="children"?p=v:u=="dangerouslySetInnerHTML"?m=v:u=="value"?h=v:u=="checked"?y=v:u==="key"||d&&typeof v!="function"||_[u]===v||He(e,u,v,_[u],o);if(m)d||c&&(m.__html===c.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(c&&(e.innerHTML=""),Mn(e,Ze(p)?p:[p],t,n,r,o&&x!=="foreignObject",i,s,i?i[0]:n.__k&&je(n,0),d,l),i!=null)for(u=i.length;u--;)i[u]!=null&&Rn(i[u]);d||(u="value",h!==void 0&&(h!==e[u]||x==="progress"&&!h||x==="option"&&h!==_[u])&&He(e,u,h,_[u],!1),u="checked",y!==void 0&&y!==e[u]&&He(e,u,y,_[u],!1))}return e}function xt(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function mt(e,t,n){var r,o;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||xt(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){P.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&mt(r[o],t,n||typeof e.type!="function");n||e.__e==null||Rn(e.__e),e.__=e.__e=e.__d=void 0}function Kr(e,t,n){return this.constructor(e,n)}function Te(e,t,n){var r,o,i,s;P.__&&P.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],yt(t,e=(!r&&n||t).__k=ie(K,null,[e]),o||Ne,Ne,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?Me.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Un(i,e,s)}function Hn(e,t){Te(e,t,Hn)}function Yr(e,t,n){var r,o,i,s,d=ge({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?o=t[i]:d[i]=t[i]===void 0&&s!==void 0?s[i]:t[i];return arguments.length>2&&(d.children=arguments.length>3?Me.call(arguments,2):n),Re(e.type,d,r||e.key,o||e.ref,null)}function Bn(e,t){var n={__c:t="__cC"+Ln++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(d){d.__e=!0,pt(d)})},this.sub=function(s){o.push(s);var d=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),d&&d.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Me=Dn.slice,P={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(d){e=d}throw e}},jn=0,le.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ge({},this.state),typeof e=="function"&&(e=e(ge({},n),this.props)),e&&ge(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pt(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pt(this))},le.prototype.render=K,we=[],Tn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ut=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,Ln=0;var Jr=0;function a(e,t,n,r,o,i){var s,d,l={};for(d in t)d=="ref"?s=t[d]:l[d]=t[d];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Jr,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(d in s)l[d]===void 0&&(l[d]=s[d]);return P.vnode&&P.vnode(u),u}var ve,W,et,Bt,Le=0,qn=[],Be=[],qt=P.__b,Ft=P.__r,At=P.diffed,Vt=P.__c,zt=P.unmount;function Ee(e,t){P.__h&&P.__h(W,e,Le||t),Le=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Be}),n.__[e]}function z(e){return Le=1,kt(zn,e)}function kt(e,t,n){var r=Ee(ve++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):zn(void 0,t),function(d){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,d);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(d,l,u){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(p){return p.__c});if(m.every(function(p){return!p.__N}))return!i||i.call(this,d,l,u);var c=!1;return m.forEach(function(p){if(p.__N){var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(c=!0)}}),!(!c&&r.__c.props===d)&&(!i||i.call(this,d,l,u))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(d,l,u){if(this.__e){var m=i;i=void 0,o(d,l,u),i=m}s&&s.call(this,d,l,u)},W.shouldComponentUpdate=o}return r.__N||r.__}function Q(e,t){var n=Ee(ve++,3);!P.__s&&Ct(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function Oe(e,t){var n=Ee(ve++,4);!P.__s&&Ct(n.__H,t)&&(n.__=e,n.i=t,W.__h.push(n))}function ee(e){return Le=5,ue(function(){return{current:e}},[])}function Fn(e,t,n){Le=6,Oe(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function ue(e,t){var n=Ee(ve++,7);return Ct(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Se(e,t){return Le=8,ue(function(){return e},t)}function An(e){var t=W.context[e.__c],n=Ee(ve++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(W)),t.props.value):e.__}function wt(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function Vn(){var e=Ee(ve++,11);if(!e.__){for(var t=W.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Xr(){for(var e;e=qn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(qe),e.__H.__h.forEach(ht),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){W=null,qt&&qt(e)},P.__r=function(e){Ft&&Ft(e),ve=0;var t=(W=e.__c).__H;t&&(et===W?(t.__h=[],W.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Be,n.__N=n.i=void 0})):(t.__h.forEach(qe),t.__h.forEach(ht),t.__h=[],ve=0)),et=W},P.diffed=function(e){At&&At(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qn.push(t)!==1&&Bt===P.requestAnimationFrame||((Bt=P.requestAnimationFrame)||eo)(Xr)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Be&&(n.__=n.__V),n.i=void 0,n.__V=Be})),et=W=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(qe),n.__h=n.__h.filter(function(r){return!r.__||ht(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],P.__e(r,n.__v)}}),Vt&&Vt(e,t)},P.unmount=function(e){zt&&zt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{qe(r)}catch(o){t=o}}),n.__H=void 0,t&&P.__e(t,n.__v))};var $t=typeof requestAnimationFrame=="function";function eo(e){var t,n=function(){clearTimeout(r),$t&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);$t&&(t=requestAnimationFrame(n))}function qe(e){var t=W,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),W=t}function ht(e){var t=W;e.__c=e.__(),W=t}function Ct(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function zn(e,t){return typeof t=="function"?t(e):t}function $n(e,t){for(var n in t)e[n]=t[n];return e}function gt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function $e(e){this.props=e}function Wn(e,t){function n(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:gt(this.props,o)}function r(o){return this.shouldComponentUpdate=n,ie(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}($e.prototype=new le).isPureReactComponent=!0,$e.prototype.shouldComponentUpdate=function(e,t){return gt(this.props,e)||gt(this.state,t)};var Wt=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Wt&&Wt(e)};var to=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function St(e){function t(n){var r=$n({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=to,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Qt=function(e,t){return e==null?null:fe(fe(e).map(t))},Qn={map:Qt,forEach:Qt,count:function(e){return e?fe(e).length:0},only:function(e){var t=fe(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fe},no=P.__e;P.__e=function(e,t,n,r){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}no(e,t,n,r)};var Zt=P.unmount;function Zn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=$n({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Zn(r,t,n)})),e}function Gn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Gn(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Pe(){this.__u=0,this.t=null,this.__b=null}function Kn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Yn(e){var t,n,r;function o(i){if(t||(t=e()).then(function(s){n=s.default||s},function(s){r=s}),r)throw r;if(!n)throw t;return ie(n,i)}return o.displayName="Lazy",o.__f=!0,o}function Ie(){this.u=null,this.o=null}P.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Zt&&Zt(e)},(Pe.prototype=new le).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=Kn(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(d):d())};n.__R=s;var d=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Gn(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.t.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Pe.prototype.componentWillUnmount=function(){this.t=[]},Pe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Zn(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&ie(K,null,e.fallback);return o&&(o.__u&=-33),[ie(K,null,t.__a?null:e.children),o]};var Gt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function ro(e){return this.getChildContext=function(){return e.context},e.children}function oo(e){var t=this,n=e.i;t.componentWillUnmount=function(){Te(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,o){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Te(ie(ro,{context:t.context},e.__v),t.l)}function Jn(e,t){var n=ie(oo,{__v:e,i:t});return n.containerInfo=t,n}(Ie.prototype=new le).__a=function(e){var t=this,n=Kn(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),Gt(t,e,r)):o()};n?n(i):i()}},Ie.prototype.render=function(e){this.u=null,this.o=new Map;var t=fe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Ie.prototype.componentDidUpdate=Ie.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Gt(e,n,t)})};var Xn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,io=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,so=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ao=/[A-Z0-9]/g,lo=typeof document<"u",co=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function er(e,t,n){return t.__k==null&&(t.textContent=""),Te(e,t),typeof n=="function"&&n(),e?e.__c:null}function tr(e,t,n){return Hn(e,t),typeof n=="function"&&n(),e?e.__c:null}le.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(le.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Kt=P.event;function uo(){}function po(){return this.cancelBubble}function mo(){return this.defaultPrevented}P.event=function(e){return Kt&&(e=Kt(e)),e.persist=uo,e.isPropagationStopped=po,e.isDefaultPrevented=mo,e.nativeEvent=e};var Et,ho={enumerable:!1,configurable:!0,get:function(){return this.class}},Yt=P.vnode;P.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={};for(var i in n){var s=n[i];if(!(i==="value"&&"defaultValue"in n&&s==null||lo&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":d==="ondoubleclick"?i="ondblclick":d!=="onchange"||r!=="input"&&r!=="textarea"||co(n.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":so.test(i)?i=d:r.indexOf("-")===-1&&io.test(i)?i=i.replace(ao,"-$&").toLowerCase():s===null&&(s=void 0):d=i="oninput",d==="oninput"&&o[i=d]&&(i="oninputCapture"),o[i]=s}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=fe(n.children).forEach(function(l){l.props.selected=o.value.indexOf(l.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=fe(n.children).forEach(function(l){l.props.selected=o.multiple?o.defaultValue.indexOf(l.props.value)!=-1:o.defaultValue==l.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",ho)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=Xn,Yt&&Yt(e)};var Jt=P.__r;P.__r=function(e){Jt&&Jt(e),Et=e.__c};var Xt=P.diffed;P.diffed=function(e){Xt&&Xt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Et=null};var nr={ReactCurrentDispatcher:{current:{readContext:function(e){return Et.__n[e.__c].props.value}}}};function rr(e){return ie.bind(null,e)}function Ue(e){return!!e&&e.$$typeof===Xn}function or(e){return Ue(e)&&e.type===K}function ir(e){return Ue(e)?Yr.apply(null,arguments):e}function It(e){return!!e.__k&&(Te(null,e),!0)}function sr(e){return e&&(e.base||e.nodeType===1&&e)||null}var ar=function(e,t){return e(t)},lr=function(e,t){return e(t)},dr=K;function jt(e){e()}function cr(e){return e}function ur(){return[!1,jt]}var pr=Oe,mr=Ue;function hr(e,t){var n=t(),r=z({h:{__:n,v:t}}),o=r[0].h,i=r[1];return Oe(function(){o.__=n,o.v=t,tt(o)&&i({h:o})},[e,n,t]),Q(function(){return tt(o)&&i({h:o}),e(function(){tt(o)&&i({h:o})})},[e]),n}function tt(e){var t,n,r=e.v,o=e.__;try{var i=r();return!((t=o)===(n=i)&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}}var go={useState:z,useId:Vn,useReducer:kt,useEffect:Q,useLayoutEffect:Oe,useInsertionEffect:pr,useTransition:ur,useDeferredValue:cr,useSyncExternalStore:hr,startTransition:jt,useRef:ee,useImperativeHandle:Fn,useMemo:ue,useCallback:Se,useContext:An,useDebugValue:wt,version:"17.0.2",Children:Qn,render:er,hydrate:tr,unmountComponentAtNode:It,createPortal:Jn,createElement:ie,createContext:Bn,createFactory:rr,cloneElement:ir,createRef:Pn,Fragment:K,isValidElement:Ue,isElement:mr,isFragment:or,findDOMNode:sr,Component:le,PureComponent:$e,memo:Wn,forwardRef:St,flushSync:lr,unstable_batchedUpdates:ar,StrictMode:dr,Suspense:Pe,SuspenseList:Ie,lazy:Yn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nr};const fo=Object.freeze(Object.defineProperty({__proto__:null,Children:Qn,Component:le,Fragment:K,PureComponent:$e,StrictMode:dr,Suspense:Pe,SuspenseList:Ie,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nr,cloneElement:ir,createContext:Bn,createElement:ie,createFactory:rr,createPortal:Jn,createRef:Pn,default:go,findDOMNode:sr,flushSync:lr,forwardRef:St,hydrate:tr,isElement:mr,isFragment:or,isValidElement:Ue,lazy:Yn,memo:Wn,render:er,startTransition:jt,unmountComponentAtNode:It,unstable_batchedUpdates:ar,useCallback:Se,useContext:An,useDebugValue:wt,useDeferredValue:cr,useEffect:Q,useErrorBoundary:function(e){var t=Ee(ve++,10),n=z();return t.__=e,W.componentDidCatch||(W.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]},useId:Vn,useImperativeHandle:Fn,useInsertionEffect:pr,useLayoutEffect:Oe,useMemo:ue,useReducer:kt,useRef:ee,useState:z,useSyncExternalStore:hr,useTransition:ur,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),en=e=>{let t;const n=new Set,r=(s,d)=>{const l=typeof s=="function"?s(t):s;if(!Object.is(l,t)){const u=t;t=d??typeof l!="object"?l:Object.assign({},t,l),n.forEach(m=>m(t,u))}},o=()=>t,i={setState:r,getState:o,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>n.clear()};return t=e(r,o,i),i};function vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _o(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var tn={exports:{}},nt={};const gr=_o(fo);var nn,rn,on,sn,an={exports:{}},rt={};function bo(){return rn||(rn=1,an.exports=function(){if(nn)return rt;nn=1;var e=gr,t=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},n=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(l){var u=l.getSnapshot;l=l.value;try{var m=u();return!t(l,m)}catch{return!0}}var d=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,u){return u()}:function(l,u){var m=u(),c=n({inst:{value:m,getSnapshot:u}}),p=c[0].inst,v=c[1];return o(function(){p.value=m,p.getSnapshot=u,s(p)&&v({inst:p})},[l,m,u]),r(function(){return s(p)&&v({inst:p}),l(function(){s(p)&&v({inst:p})})},[l]),i(m),m};return rt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,rt}()),an.exports}var yo=(sn||(sn=1,tn.exports=function(){if(on)return nt;on=1;var e=gr,t=bo(),n=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},r=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,s=e.useMemo,d=e.useDebugValue;return nt.useSyncExternalStoreWithSelector=function(l,u,m,c,p){var v=o(null);if(v.current===null){var h={hasValue:!1,value:null};v.current=h}else h=v.current;v=s(function(){function _(w){if(!L){if(L=!0,k=w,w=c(w),p!==void 0&&h.hasValue){var S=h.value;if(p(S,w))return x=S}return x=w}if(S=x,n(k,w))return S;var g=c(w);return p!==void 0&&p(S,g)?S:(k=w,x=g)}var k,x,L=!1,I=m===void 0?null:m;return[function(){return _(u())},I===null?void 0:function(){return _(I())}]},[u,m,c,p]);var y=r(l,v[0],v[1]);return i(function(){h.hasValue=!0,h.value=y},[y]),d(y),y},nt}()),tn.exports);const xo=vo(yo),{useSyncExternalStoreWithSelector:ko}=xo,ln=e=>{const t=typeof e=="function"?(r=>r?en(r):en)(e):e,n=(r,o)=>function(i,s=i.getState,d){const l=ko(i.subscribe,i.getState,i.getServerState||i.getState,s,d);return wt(l),l}(t,r,o);return Object.assign(n,t),n},fr=e=>e?ln(e):ln,wo=1,Co=2,Tt={eq:(e,t)=>e==t,neq(e,t){return!this.eq(e,t)},gt:(e,t)=>e>t,gte:(e,t)=>e>=t,lt:(e,t)=>e<t,lte:(e,t)=>e<=t,list_exact:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&e.slice().sort().join(",")===t.slice().sort().join(","),list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(n=>e.indexOf(n)===-1),list_alo(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(o=>r.has(o))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(o=>!r.has(o))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},So=(e,t,n)=>{switch(t){case"videovoice":return!!(e&&e.value);case"open":return!!n;case"multipleselect":return!!(n&&Object.keys(n).length);case"recordedtask":return(n==null?void 0:n.taskStatus)==="completed";case"texturlprompt":return!e.value;case"consentlegal":case"nps":case"likert":return n!==null;case"multiplechoice":return n!==void 0;case"matrix":return!!(n&&Object.values(n).every(r=>r!==null));default:return!0}},vr=(e,t)=>{if(t==="matrix"){const n=Object.keys(e).length,r=Object.values(e).filter(o=>o!==null).length;return r>0&&r<n}return!1},_r=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:o={}})=>{if(t>=e.length||t<0)return null;const i=e[t];let s=t+1;const d=i.props.routingOptions||[];for(let m=0;m<d.length;m++){const{group:c,target:p}=d[m];if(!(c!=null&&c.length))continue;const v=c[0];if(v.questionIndex===void 0||v.questionIndex>r.length)continue;let h=dn({comparator:v.comparator,response:r[v.questionIndex],type:i.type,value:v.value});for(let y=1;y<c.length;y+=2){const _=c[y],k=c[y+1],x=dn({comparator:k.comparator,response:r[k.questionIndex],type:e[k.questionIndex].type,value:k.value});_===wo?h&&(h=x):_===Co&&(h||(h=x))}if(h){s=p===-1&&n?e.length-1:p;break}}const l=e.findIndex(m=>m.type==="uploading");let u;return u=l>0?n?e.length-3:e.length-2:e.length-1,t>=u||s===-1||s!==null&&s>u?l>0&&Object.values(o).some(c=>c.isSubmitted&&!c.isComplete)?l:n?e.length-1:null:s===-1?null:s},dn=({comparator:e,response:t,type:n,value:r})=>{if(e==="answered")switch(n){case"texturlprompt":return t===void 0;case"consentlegal":return t&&t.submitted===!0;case"recordedtask":return"taskStatus"in t&&t.taskStatus==="completed";case"likert":case"nps":return Number.isInteger(t);case"rankorder":case"matrix":return Object.values(t).every(o=>o!==null);case"multiplechoice":return t!==void 0;case"multipleselect":return(t==null?void 0:t.length)>0;case"open":return t&&t.length>0;case"videovoice":return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e==="given_up")return n!=="recordedtask"||"taskStatus"in t&&t.taskStatus==="given.up";if(e==="partial")return n==="matrix"&&vr(t,n);if(e==="skipped")switch(n){case"texturlprompt":return t==null?void 0:t.skipped;case"consentlegal":case"likert":case"nps":case"videovoice":return t===null;case"recordedtask":return"taskStatus"in t&&t.taskStatus==="abandoned";case"open":case"multipleselect":return(t==null?void 0:t.length)===0;case"multiplechoice":return t===void 0;case"matrix":return Object.values(t).every(o=>o===null);case"rankorder":return t===null||Object.values(t).some(o=>o===null);default:return!1}return Tt[e](t,r)},Eo=e=>{var r,o,i;switch(e.type){case"multipleselect":return e&&e.props&&e.props.options?e.props.options.length>13?e.props.options.map(s=>[s.value]):(t=e.props.options.map(s=>s.value),n=!e.props.properties.required,t.reduce((s,d)=>s.concat(s.map(l=>[...l,d])),[[]]).filter(s=>n||s.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const s=e.props.options.map(d=>d.value);return e.props.properties.required||s.push(void 0),s}case"matrix":{if(!((r=e==null?void 0:e.props)!=null&&r.options))return null;const s=e.props.properties.matrixColumn,d=e.props.options,l=d.reduce((m,c)=>(m[c.id]=null,m),{}),u=[{...l,[d[0].id]:s[0].value},d.reduce((m,c)=>(m[c.id]=s[0].value,m),{})];return e.props.properties.required||u.push(l),u}case"likert":{const s=Number((i=(o=e.props)==null?void 0:o.properties)==null?void 0:i.range)||5;return[...Array.from(Array(s).keys()).map(l=>l+1),...e.props.properties.required?[]:[null]]}case"nps":return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case"videovoice":case"open":return["1",...e.props.properties.required?[]:[""]];case"recordedtask":{const s=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||s.push({taskStatus:"abandoned"}),s}case"texturlprompt":return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case"consentlegal":return[1,...e.props.properties.required?[]:[null]];default:return[1]}var t,n},Io=e=>e in Tt,jo=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,To=(e,t=[])=>t.reduce((n,r)=>{const{group:o,target:i}=r;if(!(o!=null&&o.length))return[...n];const s=o.filter(d=>!!Number(d)||typeof d=="object"&&d.questionIndex===e).map(d=>{const{comparator:l,value:u}=d;return{comparator:l,target:i,value:u}});return[...n,...s]},[]),ot=new Set(["thanks","uploading"]),q=fr()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=G.APP_ID)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s,studyType:d}=r;await o(n),it(r)||s({event:"closed"}),H.breadcrumbsLogger.info("SurveyClosing",{surveyId:r.surveyId}),G.ConflictingWidgets.enable(),i({initiator:H.DismissReason.Closed,studyType:d})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i,studyType:s,surveyId:d}=t();r("survey.complete",d),await o(n),G.ConflictingWidgets.enable(),i({initiator:H.DismissReason.Complete,studyType:s})},endCard:{headline:""},envId:"",eventEmitFn:H.eventEmitter.emit.bind(H.eventEmitter),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return H.shouldDirectEmbed(o)?Promise.resolve():(r(H.SprigEvent.SurveyFadingOut),new Promise(s=>{const d=i.getElementById(n);d?(d.addEventListener("transitionend",()=>{s()}),d.classList.remove("ul-app--visible")):s()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{qid:r[i].name,props:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var v,h,y;const{cards:s,destroy:d,index:l,uploadProgress:u}=t(),m=r||((v=u[n])==null?void 0:v.isComplete),c={...u,[n]:{progressPct:m?100:o||((h=u[n])==null?void 0:h.progressPct),isComplete:m,isSubmitted:i||((y=u[n])==null?void 0:y.isSubmitted)}};if(e({uploadProgress:c}),s[l].type!=="uploading")return;const p=Object.entries(u).every(([_,k])=>!k.isSubmitted||k.isComplete||n==_&&r);if(p&&l>=s.length-1)return d(G.APP_ID);e({index:p?l+1:l,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":"web","x-ul-environment-id":"","x-ul-installation-method":"web-snippet","x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:o,eventEmitFn:i,index:s,responseGroupUid:d,submit:l,trackHistory:u,uploadProgress:m,viewedCardCount:c}=t();e({minScrollableHeight:void 0});const p=Array.isArray(n.data)?n.data:[n.data],v=Date.now(),h=[...o],y={response:[],responseGroupUid:d,questionIndex:s};let _=null;const k=r.slice(0);p.forEach((I,w)=>{const S=h[s+w],{type:g,...D}=I,T={...D,answeredAt:v},C=T.value;(b=>b&&!ot.has(b.type))(S)&&(S.value=C),y.response.push(T);let f=C;g!=="multipleselect"&&g!=="multiplechoice"||C===null||(f=g==="multiplechoice"?Object.values(C).find(b=>b!==!1):C,g==="multipleselect"&&(f=h[s+w].props.options.reduce((b,j)=>(C[j.id]&&b.push(j.value),b),[]))),k[s+w]=f,_=_r({cards:h,index:s+w,hasEndCard:!!n.endCard,uploadProgress:m,allResponses:k})}),e({allResponses:k}),(_===null||ot.has(h[_].type))&&(y.completedAt=v);const x=l(y);if(_===null)return void n.completeSurvey();_&&!ot.has(h[_].type)&&x.finally(()=>{u({event:"seen",index:_})});const L=h[_];h[_]&&i&&i("survey.question",{qid:L.name,props:L.props}),e({cards:h,hasViewedEmbed:!1,index:_,viewedCardCount:c+1})},pendingRemoveIframeReason:null,previewKey:null,previewMode:void 0,recorder:()=>{},recorderEventEmitter:H.eventEmitter,resolveTrackedPromise:()=>{const{removeIframeIfReady:n}=t();e(r=>({unresolvedRequestCount:r.unresolvedRequestCount-1})),n()},responseGroupUid:"",remove:({initiator:n,studyType:r})=>{const{eventEmitFn:o,removeIframeIfReady:i,surveyId:s}=t();e({pendingRemoveIframeReason:n,studyType:r}),o(H.SprigEvent.SurveyCloseRequested,{name:H.SprigEvent.SurveyCloseRequested,initiator:n,studyType:r,"survey.id":s}),i()},removeIframeIfReady:()=>{const{eventEmitFn:n,pendingRemoveIframeReason:r,unresolvedRequestCount:o,studyType:i,surveyId:s}=t();r&&o===0&&(n(H.SprigEvent.SurveyWillClose,{name:H.SprigEvent.SurveyWillClose,initiator:r,studyType:i,"survey.id":s}),e({pendingRemoveIframeReason:null,studyType:i}))},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,questionIndex:r,response:o,responseGroupUid:i})=>{const s=t();if(!i||it(s))return;const d={responseGroupUid:i,meta:s.meta,customMetadata:s.customMetadata,responses:o,completedAt:n,previewKey:s.previewKey},l=await s.trackPromise(H.sprigFetch(`${s.apiURL}/sdk/1/environments/${s.envId}/visitors/${s.userId}/responses/submit`,{body:JSON.stringify(d),headers:s.headers,method:"POST"}));l.ok?o.forEach((u,m)=>{s.eventEmitFn(H.SprigEvent.QuestionAnswered,{...u,questionIndex:r?r+m:void 0,"survey.id":s.surveyId})}):l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await s.trackPromise(cn(s,"submitResponse",l.error)))},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(it(i))return;const{cards:s,index:d}=i;let l=r??d,u=s[l];for(;u;){const m={sid:i.surveyId,qid:u.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid,previewKey:i.previewKey},c=await i.trackPromise(H.sprigFetch(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{method:"POST",headers:i.headers,body:JSON.stringify(m)}));!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await i.trackPromise(cn(i,"trackHistory",c.error)));const p=s[l+1];if(!u.groupId||!(p!=null&&p.groupId)||p.groupId!==u.groupId)break;l++,u=p,o=!1}},trackPromise:async n=>{const{resolveTrackedPromise:r}=t();return e(o=>({unresolvedRequestCount:o.unresolvedRequestCount+1})),n.then(o=>(r(),o)).catch(o=>{throw r(),o})},unresolvedRequestCount:0,update:()=>{const{cards:n,index:r,headers:o,eventEmitFn:i,frame:s,useMobileStyling:d,surveyId:l,viewDocument:u}=t(),m=o["userleap-platform"]==="web",c=H.shouldDirectEmbed(o),p=n[r],v=p.type==="matrix"&&!(p.props.properties.displayMatrixAsAccordion||d);e({minScrollableHeight:void 0}),setTimeout(()=>{var k,x,L;!c&&!d&&((k=s==null?void 0:s.setWidth)==null||k.call(s,G.DEFAULT_WIDTH_PX));const[h,y,_]=G.calculateFrameDimensions(u,m&&!d,c);c?(i(H.SprigEvent.SurveyHeight,{name:H.SprigEvent.SurveyHeight,contentFrameHeight:h,"survey.id":l}),i(H.SprigEvent.SurveyWidth,{name:H.SprigEvent.SurveyWidth,contentFrameWidth:y,"survey.id":l})):((x=s.setHeight)==null||x.call(s,h),e({minScrollableHeight:_}),!d&&v&&((L=s.setWidth)==null||L.call(s,y)))},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0,focusedQuestionId:null,setFocusedQuestionId:n=>e({focusedQuestionId:n})})),it=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview||e.previewMode,cn=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:d,viewDocument:l}=e,u=l.documentElement,m={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},c={action:t,err:{message:`${n==null?void 0:n.name} - ${n==null?void 0:n.message}`,stack:n==null?void 0:n.stack},meta:m,vid:o,envId:i};(await H.sprigFetch(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},d),body:JSON.stringify(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},br=e=>ie("svg",{fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...e},ie("path",{d:"M17 10L12 15L7 10",stroke:"#0B2330",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})),yr=e=>ie("svg",{fill:"none",height:10,viewBox:"0 0 10 10",width:10,xmlns:"http://www.w3.org/2000/svg",...e},ie("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:2})),Lo=({visible:e})=>a("div",{className:"sprig-check-background",style:{opacity:e?1:0},children:a(yr,{className:"sprig-check"})}),un="250ms",Do=St(({animate:e,children:t,header:n,isOpen:r,onClick:o,showHeaderCheck:i},s)=>{const d=ee(null),[l,u]=z(0),[m,c]=z("none"),[p,v]=z(!0);return Q(()=>{var y;const h=(y=d.current)==null?void 0:y.getBoundingClientRect();u(r&&h?h.height:0)},[r]),Q(()=>{!l&&r||!p||v(!1),c(e&&!p?`height ${un} ease`:"none")},[e,p,l,r]),a("div",{className:"sprig-accordion",ref:s,children:[a("button",{className:"sprig-accordion-header-container",onClick:o,type:"button",children:[a("div",{className:"sprig-header-label-container",children:[a("span",{className:"sprig-header-label",children:n}),a(Lo,{visible:i})]}),a(br,{className:"sprig-caret",style:{transitionDuration:e?un:"0",transform:r?"rotate(-180deg)":"none"}})]}),a("div",{className:"sprig-accordion-body",style:{transition:m,height:l},children:a("div",{ref:d,children:t})})]})}),Lt=({style:e,stroke:t="black"})=>a("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[a("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),a("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),B=(...e)=>e.filter(Boolean).join(" "),X=(e,t,n)=>{const r=t?"--mobile":"--desktop";return`${e+r} ${e+(n?`${r}_${n}`:"")} ${e}`},Ro=(e,t)=>`${e} ${e}__${t}`,te=e=>a("button",{...e,className:B("ul-card-text__button",e.className),id:"ul-card-text__button"}),xr=()=>{const{viewDocument:e}=q(r=>({viewDocument:r.viewDocument})),[t,n]=z(!1);return Q(()=>{const r=e.querySelector(".sprig-question-body"),o=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{n(!!(r&&G.isHTMLElement(r)&&r.scrollHeight>r.offsetHeight))})});return r&&o.observe(r),()=>{r&&o.disconnect()}},[e]),t},pn=({plainText:e,richText:t,id:n,className:r,isHeader:o})=>t?a("div",{className:r,dangerouslySetInnerHTML:{__html:t},id:n}):e?a(o?"h1":"p",{className:r,id:n,children:e}):null,Po=()=>{const{cards:e,close:t,endCard:n,headers:r,index:o}=q(d=>({cards:d.cards,close:d.close,endCard:d.endCard,headers:d.headers,index:d.index,useMobileStyling:d.useMobileStyling})),i=e.length,s=ue(()=>()=>t(G.APP_ID),[t]);return["email","link"].includes(r["userleap-platform"])||n&&o+1===i?null:a("div",{"aria-label":"Close button",className:"close-btn",onClick:s,onKeyPress:d=>{d.key==="Enter"&&s()},role:"button",tabIndex:0,children:a("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:a("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"})})})},se=({message:e,properties:t})=>{const n=ee(null),r=t==null?void 0:t.captionText,o=xr();return a("div",{className:B("question-header-container","sprig-header-container",o?"sprig-border-bottom":null),ref:n,children:[a("div",{className:"question-header-button-container",children:[a(pn,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:e,richText:t==null?void 0:t.questionHtml}),a(Po,{})]}),a(pn,{className:"ul-caption",id:"ul-caption",plainText:r,richText:t==null?void 0:t.captionHtml})]})},No=()=>a("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:a("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),Ge=({isSubmitDisabled:e,handleSubmit:t})=>a("div",{className:"ul-card-longform__submit-button-container",children:a(te,{className:"ul-card-longform__submit-button",disabled:e,onClick:t,children:["OK ",a(No,{})]})}),mn=({buttonText:e="View Prototype",handleClick:t})=>a("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),pe=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var c;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=q(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),d=(n==null?void 0:n.conceptUrl)||((c=n==null?void 0:n.consentDocument)==null?void 0:c.url),l=window.innerWidth<G.EMBED_MOBILE_MAX_WIDTH,u=i["userleap-platform"],m=(p,v)=>{p.preventDefault(),r(v)};if(!s&&l&&!o&&d&&["email","link"].includes(u)){if(t==="prototype")return a(mn,{handleClick:p=>{m(p,"question.prototype.click")}});if(t==="pdf")return a(mn,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{m(p,"question.agreement.click")}})}return e()},kr=({isSelected:e,id:t,divId:n,themeColor:r})=>a("div",{"aria-checked":e,"aria-labelledby":`label-${t}`,className:"select-checkbox",id:n,role:"checkbox",style:e?{backgroundColor:r,borderColor:r,boxShadow:"none"}:{},tabIndex:0,children:e&&a(yr,{})}),wr=(e,t)=>{const n=ee(0);return()=>{if(e.current){const r=e.current;r.style.height="1px";const o=r.scrollHeight+(r.offsetHeight-r.clientHeight),i=parseInt(window.getComputedStyle(r).getPropertyValue("max-height")),s=o<=i?o:i;n.current!==s&&t(),n.current=s,r.style.height=`${s}px`}}},Ke=({ariaLabel:e,border:t,choiceStyle:n={},label:r,isSelected:o,value:i,text:s,id:d,isRadio:l,useMobileStyling:u,error:m,allowTextEntry:c,noneOfTheAbove:p,promptText:v,onUserInputChanged:h})=>{const{styleNonce:y,viewDocument:_}=q(b=>({styleNonce:b.styleNonce,viewDocument:b.viewDocument})),[k,x]=z(!1);Oo(_,t,y);const L=({isSelected:b,userText:j})=>{h&&h({id:d,selected:b,value:i,userText:j,noneOfTheAbove:p})},I=b=>{b.stopPropagation(),L({isSelected:l||!o,userText:s}),x(!1)},w=()=>{k||x(!0)},S=()=>{k&&x(!1)},g={onClick:b=>I(b),onKeyPress:b=>(j=>{j.key!=="Enter"&&j.key!==" "||I(j)})(b)};"ontouchstart"in _.documentElement?(g.onTouchStart=S,g.onTouchCancel=S,g.onTouchEnd=S):(g.onMouseDown=w,g.onMouseLeave=S);const D=l?`radio-${d}`:`checkbox-${d}`,T=o||k?[Fe]:[],C=[...m?[Cr]:[],...T],f=r?{"aria-labelledby":`label-${d}`}:{"aria-label":e};return a("div",{className:B(X("choice",u),...C),id:`choice-div-${d}`,style:{...n,...m?{borderColor:G.ERROR_BORDER_COLOR}:{}},...g,children:[a("div",{className:B("choice-label-container"),children:[l?a("div",{...f,className:B("select-radio",...T),id:D,role:"radio",tabIndex:0}):a(kr,{divId:D,id:d,isSelected:o,themeColor:t}),r&&a("label",{className:B(X("select-label",u)),htmlFor:D,id:`label-${d}`,children:r})]}),c&&o&&a("div",{className:B("choice-text-entry-container",...T),children:a(Mo,{onTextChange:b=>L({isSelected:o,userText:b}),promptText:v||"Please specify",textValue:s,useMobileStyling:u})})]})},Mo=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=ee(null),{update:i}=q(d=>({update:d.update})),s=wr(o,()=>i());return Q(()=>(s(),o.current&&o.current.focus(),()=>{i()}),[]),a("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:B(X("choice-text-input",r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:d=>{s(),d.stopPropagation(),n(d.currentTarget.value)},onClick:d=>{d.stopPropagation()},onKeyPress:d=>{d.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},hn="ul-select-style-element",Fe="ul-select-active-dynamic-style",Cr="ul-select-error-dynamic-style",Oo=(e,t,n)=>{let r=e.getElementById(hn),o=!1;r||(r=e.createElement("style"),o=!0),r.tagName.toLowerCase()==="style"&&(r.id=hn,n&&(r.nonce=n),r.textContent=Uo(t),o&&e.head.appendChild(r))},Uo=e=>`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./core-CGgKmpNf.cjs"),H=require("./metricsReporter-BvLxSPGb.cjs");var Me,P,jn,we,Mt,Tn,ut,Ln,Ne={},Dn=[],Qr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ze=Array.isArray;function ge(e,t){for(var n in t)e[n]=t[n];return e}function Rn(e){var t=e.parentNode;t&&t.removeChild(e)}function ie(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?Me.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Re(e,s,r,o,null)}function Re(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++jn,__i:-1,__u:0};return o==null&&P.vnode!=null&&P.vnode(i),i}function Pn(){return{current:null}}function K(e){return e.children}function le(e,t){this.props=e,this.context=t}function je(e,t){if(t==null)return e.__?je(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?je(e):null}function Nn(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Nn(e)}}function pt(e){(!e.__d&&(e.__d=!0)&&we.push(e)&&!ze.__r++||Mt!==P.debounceRendering)&&((Mt=P.debounceRendering)||Tn)(ze)}function ze(){var e,t,n,r,o,i,s,d,l;for(we.sort(ut);e=we.shift();)e.__d&&(t=we.length,r=void 0,i=(o=(n=e).__v).__e,d=[],l=[],(s=n.__P)&&((r=ge({},o)).__v=o.__v+1,P.vnode&&P.vnode(r),yt(s,r,o,n.__n,s.ownerSVGElement!==void 0,32&o.__u?[i]:null,d,i??je(o),!!(32&o.__u),l),r.__.__k[r.__i]=r,Un(d,r,l),r.__e!=i&&Nn(r)),we.length>t&&we.sort(ut));ze.__r=0}function Mn(e,t,n,r,o,i,s,d,l,u,m){var c,p,v,h,y,_=r&&r.__k||Dn,k=t.length;for(n.__d=l,function(x,L,I){var w,S,g,D,T,C=L.length,f=I.length,b=f,j=0;for(x.__k=[],w=0;w<C;w++)(S=x.__k[w]=(S=L[w])==null||typeof S=="boolean"||typeof S=="function"?null:typeof S=="string"||typeof S=="number"||typeof S=="bigint"||S.constructor==String?Re(null,S,null,null,S):Ze(S)?Re(K,{children:S},null,null,null):S.constructor===void 0&&S.__b>0?Re(S.type,S.props,S.key,S.ref?S.ref:null,S.__v):S)!=null?(S.__=x,S.__b=x.__b+1,T=Zr(S,I,D=w+j,b),S.__i=T,g=null,T!==-1&&(b--,(g=I[T])&&(g.__u|=131072)),g==null||g.__v===null?(T==-1&&j--,typeof S.type!="function"&&(S.__u|=65536)):T!==D&&(T===D+1?j++:T>D?b>C-D?j+=T-D:j--:j=T<D&&T==D-1?T-D:0,T!==w+j&&(S.__u|=65536))):(g=I[w])&&g.key==null&&g.__e&&(g.__e==x.__d&&(x.__d=je(g)),mt(g,g,!1),I[w]=null,b--);if(b)for(w=0;w<f;w++)(g=I[w])!=null&&!(131072&g.__u)&&(g.__e==x.__d&&(x.__d=je(g)),mt(g,g))}(n,t,_),l=n.__d,c=0;c<k;c++)(v=n.__k[c])!=null&&typeof v!="boolean"&&typeof v!="function"&&(p=v.__i===-1?Ne:_[v.__i]||Ne,v.__i=c,yt(e,v,p,o,i,s,d,l,u,m),h=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&xt(p.ref,null,v),m.push(v.ref,v.__c||h,v)),y==null&&h!=null&&(y=h),65536&v.__u||p.__k===v.__k?l=On(v,l,e):typeof v.type=="function"&&v.__d!==void 0?l=v.__d:h&&(l=h.nextSibling),v.__d=void 0,v.__u&=-196609);n.__d=l,n.__e=y}function On(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=On(r[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function fe(e,t){return t=t||[],e==null||typeof e=="boolean"||(Ze(e)?e.some(function(n){fe(n,t)}):t.push(e)),t}function Zr(e,t,n,r){var o=e.key,i=e.type,s=n-1,d=n+1,l=t[n];if(l===null||l&&o==l.key&&i===l.type)return n;if(r>(l==null||131072&l.__u?0:1))for(;s>=0||d<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s--}if(d<t.length){if((l=t[d])&&!(131072&l.__u)&&o==l.key&&i===l.type)return d;d++}}return-1}function Ot(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Qr.test(t)?n:n+"px"}function He(e,t,n,r,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ot(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Ot(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,i?Ht:Ut,i)):e.removeEventListener(t,i?Ht:Ut,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function Ut(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(P.event?P.event(e):e)}function Ht(e){return this.l[e.type+!0](P.event?P.event(e):e)}function yt(e,t,n,r,o,i,s,d,l,u){var m,c,p,v,h,y,_,k,x,L,I,w,S,g,D,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[d=t.__e=n.__e]),(m=P.__b)&&m(t);e:if(typeof T=="function")try{if(k=t.props,x=(m=T.contextType)&&r[m.__c],L=m?x?x.props.value:m.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in T&&T.prototype.render?t.__c=c=new T(k,L):(t.__c=c=new le(k,L),c.constructor=T,c.render=Kr),x&&x.sub(c),c.props=k,c.state||(c.state={}),c.context=L,c.__n=r,p=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),T.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ge({},c.__s)),ge(c.__s,T.getDerivedStateFromProps(k,c.__s))),v=c.props,h=c.state,c.__v=t,p)T.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(T.getDerivedStateFromProps==null&&k!==v&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(k,L),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(k,c.__s,L)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(c.props=k,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(C){C&&(C.__=t)}),I=0;I<c._sb.length;I++)c.__h.push(c._sb[I]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(k,c.__s,L),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(v,h,y)})}if(c.context=L,c.props=k,c.__P=e,c.__e=!1,w=P.__r,S=0,"prototype"in T&&T.prototype.render){for(c.state=c.__s,c.__d=!1,w&&w(t),m=c.render(c.props,c.state,c.context),g=0;g<c._sb.length;g++)c.__h.push(c._sb[g]);c._sb=[]}else do c.__d=!1,w&&w(t),m=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++S<25);c.state=c.__s,c.getChildContext!=null&&(r=ge(ge({},r),c.getChildContext())),p||c.getSnapshotBeforeUpdate==null||(y=c.getSnapshotBeforeUpdate(v,h)),Mn(e,Ze(D=m!=null&&m.type===K&&m.key==null?m.props.children:m)?D:[D],t,n,r,o,i,s,d,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),_&&(c.__E=c.__=null)}catch(C){t.__v=null,l||i!=null?(t.__e=d,t.__u|=l?160:32,i[i.indexOf(d)]=null):(t.__e=n.__e,t.__k=n.__k),P.__e(C,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Gr(n.__e,t,n,r,o,i,s,l,u);(m=P.diffed)&&m(t)}function Un(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)xt(n[r],n[++r],n[++r]);P.__c&&P.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){P.__e(i,o.__v)}})}function Gr(e,t,n,r,o,i,s,d,l){var u,m,c,p,v,h,y,_=n.props,k=t.props,x=t.type;if(x==="svg"&&(o=!0),i!=null){for(u=0;u<i.length;u++)if((v=i[u])&&"setAttribute"in v==!!x&&(x?v.localName===x:v.nodeType===3)){e=v,i[u]=null;break}}if(e==null){if(x===null)return document.createTextNode(k);e=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,k.is&&k),i=null,d=!1}if(x===null)_===k||d&&e.data===k||(e.data=k);else{if(i=i&&Me.call(e.childNodes),_=n.props||Ne,!d&&i!=null)for(_={},u=0;u<e.attributes.length;u++)_[(v=e.attributes[u]).name]=v.value;for(u in _)v=_[u],u=="children"||(u=="dangerouslySetInnerHTML"?c=v:u==="key"||u in k||He(e,u,null,v,o));for(u in k)v=k[u],u=="children"?p=v:u=="dangerouslySetInnerHTML"?m=v:u=="value"?h=v:u=="checked"?y=v:u==="key"||d&&typeof v!="function"||_[u]===v||He(e,u,v,_[u],o);if(m)d||c&&(m.__html===c.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(c&&(e.innerHTML=""),Mn(e,Ze(p)?p:[p],t,n,r,o&&x!=="foreignObject",i,s,i?i[0]:n.__k&&je(n,0),d,l),i!=null)for(u=i.length;u--;)i[u]!=null&&Rn(i[u]);d||(u="value",h!==void 0&&(h!==e[u]||x==="progress"&&!h||x==="option"&&h!==_[u])&&He(e,u,h,_[u],!1),u="checked",y!==void 0&&y!==e[u]&&He(e,u,y,_[u],!1))}return e}function xt(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function mt(e,t,n){var r,o;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||xt(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){P.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&mt(r[o],t,n||typeof e.type!="function");n||e.__e==null||Rn(e.__e),e.__=e.__e=e.__d=void 0}function Kr(e,t,n){return this.constructor(e,n)}function Te(e,t,n){var r,o,i,s;P.__&&P.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],yt(t,e=(!r&&n||t).__k=ie(K,null,[e]),o||Ne,Ne,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?Me.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Un(i,e,s)}function Hn(e,t){Te(e,t,Hn)}function Yr(e,t,n){var r,o,i,s,d=ge({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?o=t[i]:d[i]=t[i]===void 0&&s!==void 0?s[i]:t[i];return arguments.length>2&&(d.children=arguments.length>3?Me.call(arguments,2):n),Re(e.type,d,r||e.key,o||e.ref,null)}function Bn(e,t){var n={__c:t="__cC"+Ln++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(d){d.__e=!0,pt(d)})},this.sub=function(s){o.push(s);var d=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),d&&d.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Me=Dn.slice,P={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(d){e=d}throw e}},jn=0,le.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ge({},this.state),typeof e=="function"&&(e=e(ge({},n),this.props)),e&&ge(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pt(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pt(this))},le.prototype.render=K,we=[],Tn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ut=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,Ln=0;var Jr=0;function a(e,t,n,r,o,i){var s,d,l={};for(d in t)d=="ref"?s=t[d]:l[d]=t[d];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Jr,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(d in s)l[d]===void 0&&(l[d]=s[d]);return P.vnode&&P.vnode(u),u}var ve,W,et,Bt,Le=0,qn=[],Be=[],qt=P.__b,Ft=P.__r,At=P.diffed,Vt=P.__c,zt=P.unmount;function Ee(e,t){P.__h&&P.__h(W,e,Le||t),Le=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Be}),n.__[e]}function z(e){return Le=1,kt(zn,e)}function kt(e,t,n){var r=Ee(ve++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):zn(void 0,t),function(d){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,d);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(d,l,u){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(p){return p.__c});if(m.every(function(p){return!p.__N}))return!i||i.call(this,d,l,u);var c=!1;return m.forEach(function(p){if(p.__N){var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(c=!0)}}),!(!c&&r.__c.props===d)&&(!i||i.call(this,d,l,u))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(d,l,u){if(this.__e){var m=i;i=void 0,o(d,l,u),i=m}s&&s.call(this,d,l,u)},W.shouldComponentUpdate=o}return r.__N||r.__}function Q(e,t){var n=Ee(ve++,3);!P.__s&&Ct(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function Oe(e,t){var n=Ee(ve++,4);!P.__s&&Ct(n.__H,t)&&(n.__=e,n.i=t,W.__h.push(n))}function ee(e){return Le=5,ue(function(){return{current:e}},[])}function Fn(e,t,n){Le=6,Oe(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function ue(e,t){var n=Ee(ve++,7);return Ct(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Se(e,t){return Le=8,ue(function(){return e},t)}function An(e){var t=W.context[e.__c],n=Ee(ve++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(W)),t.props.value):e.__}function wt(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function Vn(){var e=Ee(ve++,11);if(!e.__){for(var t=W.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Xr(){for(var e;e=qn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(qe),e.__H.__h.forEach(ht),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){W=null,qt&&qt(e)},P.__r=function(e){Ft&&Ft(e),ve=0;var t=(W=e.__c).__H;t&&(et===W?(t.__h=[],W.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Be,n.__N=n.i=void 0})):(t.__h.forEach(qe),t.__h.forEach(ht),t.__h=[],ve=0)),et=W},P.diffed=function(e){At&&At(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qn.push(t)!==1&&Bt===P.requestAnimationFrame||((Bt=P.requestAnimationFrame)||eo)(Xr)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Be&&(n.__=n.__V),n.i=void 0,n.__V=Be})),et=W=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(qe),n.__h=n.__h.filter(function(r){return!r.__||ht(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],P.__e(r,n.__v)}}),Vt&&Vt(e,t)},P.unmount=function(e){zt&&zt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{qe(r)}catch(o){t=o}}),n.__H=void 0,t&&P.__e(t,n.__v))};var $t=typeof requestAnimationFrame=="function";function eo(e){var t,n=function(){clearTimeout(r),$t&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);$t&&(t=requestAnimationFrame(n))}function qe(e){var t=W,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),W=t}function ht(e){var t=W;e.__c=e.__(),W=t}function Ct(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function zn(e,t){return typeof t=="function"?t(e):t}function $n(e,t){for(var n in t)e[n]=t[n];return e}function gt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function $e(e){this.props=e}function Wn(e,t){function n(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:gt(this.props,o)}function r(o){return this.shouldComponentUpdate=n,ie(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}($e.prototype=new le).isPureReactComponent=!0,$e.prototype.shouldComponentUpdate=function(e,t){return gt(this.props,e)||gt(this.state,t)};var Wt=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Wt&&Wt(e)};var to=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function St(e){function t(n){var r=$n({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=to,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Qt=function(e,t){return e==null?null:fe(fe(e).map(t))},Qn={map:Qt,forEach:Qt,count:function(e){return e?fe(e).length:0},only:function(e){var t=fe(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fe},no=P.__e;P.__e=function(e,t,n,r){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}no(e,t,n,r)};var Zt=P.unmount;function Zn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=$n({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Zn(r,t,n)})),e}function Gn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Gn(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Pe(){this.__u=0,this.t=null,this.__b=null}function Kn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Yn(e){var t,n,r;function o(i){if(t||(t=e()).then(function(s){n=s.default||s},function(s){r=s}),r)throw r;if(!n)throw t;return ie(n,i)}return o.displayName="Lazy",o.__f=!0,o}function Ie(){this.u=null,this.o=null}P.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Zt&&Zt(e)},(Pe.prototype=new le).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=Kn(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(d):d())};n.__R=s;var d=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Gn(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.t.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Pe.prototype.componentWillUnmount=function(){this.t=[]},Pe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Zn(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&ie(K,null,e.fallback);return o&&(o.__u&=-33),[ie(K,null,t.__a?null:e.children),o]};var Gt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function ro(e){return this.getChildContext=function(){return e.context},e.children}function oo(e){var t=this,n=e.i;t.componentWillUnmount=function(){Te(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,o){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Te(ie(ro,{context:t.context},e.__v),t.l)}function Jn(e,t){var n=ie(oo,{__v:e,i:t});return n.containerInfo=t,n}(Ie.prototype=new le).__a=function(e){var t=this,n=Kn(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),Gt(t,e,r)):o()};n?n(i):i()}},Ie.prototype.render=function(e){this.u=null,this.o=new Map;var t=fe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Ie.prototype.componentDidUpdate=Ie.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Gt(e,n,t)})};var Xn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,io=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,so=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ao=/[A-Z0-9]/g,lo=typeof document<"u",co=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function er(e,t,n){return t.__k==null&&(t.textContent=""),Te(e,t),typeof n=="function"&&n(),e?e.__c:null}function tr(e,t,n){return Hn(e,t),typeof n=="function"&&n(),e?e.__c:null}le.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(le.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Kt=P.event;function uo(){}function po(){return this.cancelBubble}function mo(){return this.defaultPrevented}P.event=function(e){return Kt&&(e=Kt(e)),e.persist=uo,e.isPropagationStopped=po,e.isDefaultPrevented=mo,e.nativeEvent=e};var Et,ho={enumerable:!1,configurable:!0,get:function(){return this.class}},Yt=P.vnode;P.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={};for(var i in n){var s=n[i];if(!(i==="value"&&"defaultValue"in n&&s==null||lo&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":d==="ondoubleclick"?i="ondblclick":d!=="onchange"||r!=="input"&&r!=="textarea"||co(n.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":so.test(i)?i=d:r.indexOf("-")===-1&&io.test(i)?i=i.replace(ao,"-$&").toLowerCase():s===null&&(s=void 0):d=i="oninput",d==="oninput"&&o[i=d]&&(i="oninputCapture"),o[i]=s}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=fe(n.children).forEach(function(l){l.props.selected=o.value.indexOf(l.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=fe(n.children).forEach(function(l){l.props.selected=o.multiple?o.defaultValue.indexOf(l.props.value)!=-1:o.defaultValue==l.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",ho)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=Xn,Yt&&Yt(e)};var Jt=P.__r;P.__r=function(e){Jt&&Jt(e),Et=e.__c};var Xt=P.diffed;P.diffed=function(e){Xt&&Xt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Et=null};var nr={ReactCurrentDispatcher:{current:{readContext:function(e){return Et.__n[e.__c].props.value}}}};function rr(e){return ie.bind(null,e)}function Ue(e){return!!e&&e.$$typeof===Xn}function or(e){return Ue(e)&&e.type===K}function ir(e){return Ue(e)?Yr.apply(null,arguments):e}function It(e){return!!e.__k&&(Te(null,e),!0)}function sr(e){return e&&(e.base||e.nodeType===1&&e)||null}var ar=function(e,t){return e(t)},lr=function(e,t){return e(t)},dr=K;function jt(e){e()}function cr(e){return e}function ur(){return[!1,jt]}var pr=Oe,mr=Ue;function hr(e,t){var n=t(),r=z({h:{__:n,v:t}}),o=r[0].h,i=r[1];return Oe(function(){o.__=n,o.v=t,tt(o)&&i({h:o})},[e,n,t]),Q(function(){return tt(o)&&i({h:o}),e(function(){tt(o)&&i({h:o})})},[e]),n}function tt(e){var t,n,r=e.v,o=e.__;try{var i=r();return!((t=o)===(n=i)&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}}var go={useState:z,useId:Vn,useReducer:kt,useEffect:Q,useLayoutEffect:Oe,useInsertionEffect:pr,useTransition:ur,useDeferredValue:cr,useSyncExternalStore:hr,startTransition:jt,useRef:ee,useImperativeHandle:Fn,useMemo:ue,useCallback:Se,useContext:An,useDebugValue:wt,version:"17.0.2",Children:Qn,render:er,hydrate:tr,unmountComponentAtNode:It,createPortal:Jn,createElement:ie,createContext:Bn,createFactory:rr,cloneElement:ir,createRef:Pn,Fragment:K,isValidElement:Ue,isElement:mr,isFragment:or,findDOMNode:sr,Component:le,PureComponent:$e,memo:Wn,forwardRef:St,flushSync:lr,unstable_batchedUpdates:ar,StrictMode:dr,Suspense:Pe,SuspenseList:Ie,lazy:Yn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nr};const fo=Object.freeze(Object.defineProperty({__proto__:null,Children:Qn,Component:le,Fragment:K,PureComponent:$e,StrictMode:dr,Suspense:Pe,SuspenseList:Ie,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nr,cloneElement:ir,createContext:Bn,createElement:ie,createFactory:rr,createPortal:Jn,createRef:Pn,default:go,findDOMNode:sr,flushSync:lr,forwardRef:St,hydrate:tr,isElement:mr,isFragment:or,isValidElement:Ue,lazy:Yn,memo:Wn,render:er,startTransition:jt,unmountComponentAtNode:It,unstable_batchedUpdates:ar,useCallback:Se,useContext:An,useDebugValue:wt,useDeferredValue:cr,useEffect:Q,useErrorBoundary:function(e){var t=Ee(ve++,10),n=z();return t.__=e,W.componentDidCatch||(W.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]},useId:Vn,useImperativeHandle:Fn,useInsertionEffect:pr,useLayoutEffect:Oe,useMemo:ue,useReducer:kt,useRef:ee,useState:z,useSyncExternalStore:hr,useTransition:ur,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),en=e=>{let t;const n=new Set,r=(s,d)=>{const l=typeof s=="function"?s(t):s;if(!Object.is(l,t)){const u=t;t=d??typeof l!="object"?l:Object.assign({},t,l),n.forEach(m=>m(t,u))}},o=()=>t,i={setState:r,getState:o,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>n.clear()};return t=e(r,o,i),i};function vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _o(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var tn={exports:{}},nt={};const gr=_o(fo);var nn,rn,on,sn,an={exports:{}},rt={};function bo(){return rn||(rn=1,an.exports=function(){if(nn)return rt;nn=1;var e=gr,t=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},n=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(l){var u=l.getSnapshot;l=l.value;try{var m=u();return!t(l,m)}catch{return!0}}var d=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,u){return u()}:function(l,u){var m=u(),c=n({inst:{value:m,getSnapshot:u}}),p=c[0].inst,v=c[1];return o(function(){p.value=m,p.getSnapshot=u,s(p)&&v({inst:p})},[l,m,u]),r(function(){return s(p)&&v({inst:p}),l(function(){s(p)&&v({inst:p})})},[l]),i(m),m};return rt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,rt}()),an.exports}var yo=(sn||(sn=1,tn.exports=function(){if(on)return nt;on=1;var e=gr,t=bo(),n=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},r=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,s=e.useMemo,d=e.useDebugValue;return nt.useSyncExternalStoreWithSelector=function(l,u,m,c,p){var v=o(null);if(v.current===null){var h={hasValue:!1,value:null};v.current=h}else h=v.current;v=s(function(){function _(w){if(!L){if(L=!0,k=w,w=c(w),p!==void 0&&h.hasValue){var S=h.value;if(p(S,w))return x=S}return x=w}if(S=x,n(k,w))return S;var g=c(w);return p!==void 0&&p(S,g)?S:(k=w,x=g)}var k,x,L=!1,I=m===void 0?null:m;return[function(){return _(u())},I===null?void 0:function(){return _(I())}]},[u,m,c,p]);var y=r(l,v[0],v[1]);return i(function(){h.hasValue=!0,h.value=y},[y]),d(y),y},nt}()),tn.exports);const xo=vo(yo),{useSyncExternalStoreWithSelector:ko}=xo,ln=e=>{const t=typeof e=="function"?(r=>r?en(r):en)(e):e,n=(r,o)=>function(i,s=i.getState,d){const l=ko(i.subscribe,i.getState,i.getServerState||i.getState,s,d);return wt(l),l}(t,r,o);return Object.assign(n,t),n},fr=e=>e?ln(e):ln,wo=1,Co=2,Tt={eq:(e,t)=>e==t,neq(e,t){return!this.eq(e,t)},gt:(e,t)=>e>t,gte:(e,t)=>e>=t,lt:(e,t)=>e<t,lte:(e,t)=>e<=t,list_exact:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&e.slice().sort().join(",")===t.slice().sort().join(","),list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(n=>e.indexOf(n)===-1),list_alo(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(o=>r.has(o))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(o=>!r.has(o))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},So=(e,t,n)=>{switch(t){case"videovoice":return!!(e&&e.value);case"open":return!!n;case"multipleselect":return!!(n&&Object.keys(n).length);case"recordedtask":return(n==null?void 0:n.taskStatus)==="completed";case"texturlprompt":return!e.value;case"consentlegal":case"nps":case"likert":return n!==null;case"multiplechoice":return n!==void 0;case"matrix":return!!(n&&Object.values(n).every(r=>r!==null));default:return!0}},vr=(e,t)=>{if(t==="matrix"){const n=Object.keys(e).length,r=Object.values(e).filter(o=>o!==null).length;return r>0&&r<n}return!1},_r=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:o={}})=>{if(t>=e.length||t<0)return null;const i=e[t];let s=t+1;const d=i.props.routingOptions||[];for(let m=0;m<d.length;m++){const{group:c,target:p}=d[m];if(!(c!=null&&c.length))continue;const v=c[0];if(v.questionIndex===void 0||v.questionIndex>r.length)continue;let h=dn({comparator:v.comparator,response:r[v.questionIndex],type:i.type,value:v.value});for(let y=1;y<c.length;y+=2){const _=c[y],k=c[y+1],x=dn({comparator:k.comparator,response:r[k.questionIndex],type:e[k.questionIndex].type,value:k.value});_===wo?h&&(h=x):_===Co&&(h||(h=x))}if(h){s=p===-1&&n?e.length-1:p;break}}const l=e.findIndex(m=>m.type==="uploading");let u;return u=l>0?n?e.length-3:e.length-2:e.length-1,t>=u||s===-1||s!==null&&s>u?l>0&&Object.values(o).some(c=>c.isSubmitted&&!c.isComplete)?l:n?e.length-1:null:s===-1?null:s},dn=({comparator:e,response:t,type:n,value:r})=>{if(e==="answered")switch(n){case"texturlprompt":return t===void 0;case"consentlegal":return t&&t.submitted===!0;case"recordedtask":return"taskStatus"in t&&t.taskStatus==="completed";case"likert":case"nps":return Number.isInteger(t);case"rankorder":case"matrix":return Object.values(t).every(o=>o!==null);case"multiplechoice":return t!==void 0;case"multipleselect":return(t==null?void 0:t.length)>0;case"open":return t&&t.length>0;case"videovoice":return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e==="given_up")return n!=="recordedtask"||"taskStatus"in t&&t.taskStatus==="given.up";if(e==="partial")return n==="matrix"&&vr(t,n);if(e==="skipped")switch(n){case"texturlprompt":return t==null?void 0:t.skipped;case"consentlegal":case"likert":case"nps":case"videovoice":return t===null;case"recordedtask":return"taskStatus"in t&&t.taskStatus==="abandoned";case"open":case"multipleselect":return(t==null?void 0:t.length)===0;case"multiplechoice":return t===void 0;case"matrix":return Object.values(t).every(o=>o===null);case"rankorder":return t===null||Object.values(t).some(o=>o===null);default:return!1}return Tt[e](t,r)},Eo=e=>{var r,o,i;switch(e.type){case"multipleselect":return e&&e.props&&e.props.options?e.props.options.length>13?e.props.options.map(s=>[s.value]):(t=e.props.options.map(s=>s.value),n=!e.props.properties.required,t.reduce((s,d)=>s.concat(s.map(l=>[...l,d])),[[]]).filter(s=>n||s.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const s=e.props.options.map(d=>d.value);return e.props.properties.required||s.push(void 0),s}case"matrix":{if(!((r=e==null?void 0:e.props)!=null&&r.options))return null;const s=e.props.properties.matrixColumn,d=e.props.options,l=d.reduce((m,c)=>(m[c.id]=null,m),{}),u=[{...l,[d[0].id]:s[0].value},d.reduce((m,c)=>(m[c.id]=s[0].value,m),{})];return e.props.properties.required||u.push(l),u}case"likert":{const s=Number((i=(o=e.props)==null?void 0:o.properties)==null?void 0:i.range)||5;return[...Array.from(Array(s).keys()).map(l=>l+1),...e.props.properties.required?[]:[null]]}case"nps":return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case"videovoice":case"open":return["1",...e.props.properties.required?[]:[""]];case"recordedtask":{const s=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||s.push({taskStatus:"abandoned"}),s}case"texturlprompt":return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case"consentlegal":return[1,...e.props.properties.required?[]:[null]];default:return[1]}var t,n},Io=e=>e in Tt,jo=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,To=(e,t=[])=>t.reduce((n,r)=>{const{group:o,target:i}=r;if(!(o!=null&&o.length))return[...n];const s=o.filter(d=>!!Number(d)||typeof d=="object"&&d.questionIndex===e).map(d=>{const{comparator:l,value:u}=d;return{comparator:l,target:i,value:u}});return[...n,...s]},[]),ot=new Set(["thanks","uploading"]),q=fr()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=G.APP_ID)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s,studyType:d}=r;await o(n),it(r)||s({event:"closed"}),H.breadcrumbsLogger.info("SurveyClosing",{surveyId:r.surveyId}),G.ConflictingWidgets.enable(),i({initiator:H.DismissReason.Closed,studyType:d})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i,studyType:s,surveyId:d}=t();r("survey.complete",d),await o(n),G.ConflictingWidgets.enable(),i({initiator:H.DismissReason.Complete,studyType:s})},endCard:{headline:""},envId:"",eventEmitFn:H.eventEmitter.emit.bind(H.eventEmitter),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return H.shouldDirectEmbed(o)?Promise.resolve():(r(H.SprigEvent.SurveyFadingOut),new Promise(s=>{const d=i.getElementById(n);d?(d.addEventListener("transitionend",()=>{s()}),d.classList.remove("ul-app--visible")):s()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{qid:r[i].name,props:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var v,h,y;const{cards:s,destroy:d,index:l,uploadProgress:u}=t(),m=r||((v=u[n])==null?void 0:v.isComplete),c={...u,[n]:{progressPct:m?100:o||((h=u[n])==null?void 0:h.progressPct),isComplete:m,isSubmitted:i||((y=u[n])==null?void 0:y.isSubmitted)}};if(e({uploadProgress:c}),s[l].type!=="uploading")return;const p=Object.entries(u).every(([_,k])=>!k.isSubmitted||k.isComplete||n==_&&r);if(p&&l>=s.length-1)return d(G.APP_ID);e({index:p?l+1:l,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":"web","x-ul-environment-id":"","x-ul-installation-method":"web-snippet","x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:o,eventEmitFn:i,index:s,responseGroupUid:d,submit:l,trackHistory:u,uploadProgress:m,viewedCardCount:c}=t();e({minScrollableHeight:void 0});const p=Array.isArray(n.data)?n.data:[n.data],v=Date.now(),h=[...o],y={response:[],responseGroupUid:d,questionIndex:s};let _=null;const k=r.slice(0);p.forEach((I,w)=>{const S=h[s+w],{type:g,...D}=I,T={...D,answeredAt:v},C=T.value;(b=>b&&!ot.has(b.type))(S)&&(S.value=C),y.response.push(T);let f=C;g!=="multipleselect"&&g!=="multiplechoice"||C===null||(f=g==="multiplechoice"?Object.values(C).find(b=>b!==!1):C,g==="multipleselect"&&(f=h[s+w].props.options.reduce((b,j)=>(C[j.id]&&b.push(j.value),b),[]))),k[s+w]=f,_=_r({cards:h,index:s+w,hasEndCard:!!n.endCard,uploadProgress:m,allResponses:k})}),e({allResponses:k}),(_===null||ot.has(h[_].type))&&(y.completedAt=v);const x=l(y);if(_===null)return void n.completeSurvey();_&&!ot.has(h[_].type)&&x.finally(()=>{u({event:"seen",index:_})});const L=h[_];h[_]&&i&&i("survey.question",{qid:L.name,props:L.props}),e({cards:h,hasViewedEmbed:!1,index:_,viewedCardCount:c+1})},pendingRemoveIframeReason:null,previewKey:null,previewMode:void 0,recorder:()=>{},recorderEventEmitter:H.eventEmitter,resolveTrackedPromise:()=>{const{removeIframeIfReady:n}=t();e(r=>({unresolvedRequestCount:r.unresolvedRequestCount-1})),n()},responseGroupUid:"",remove:({initiator:n,studyType:r})=>{const{eventEmitFn:o,removeIframeIfReady:i,surveyId:s}=t();e({pendingRemoveIframeReason:n,studyType:r}),o(H.SprigEvent.SurveyCloseRequested,{name:H.SprigEvent.SurveyCloseRequested,initiator:n,studyType:r,"survey.id":s}),i()},removeIframeIfReady:()=>{const{eventEmitFn:n,pendingRemoveIframeReason:r,unresolvedRequestCount:o,studyType:i,surveyId:s}=t();r&&o===0&&(n(H.SprigEvent.SurveyWillClose,{name:H.SprigEvent.SurveyWillClose,initiator:r,studyType:i,"survey.id":s}),e({pendingRemoveIframeReason:null,studyType:i}))},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,questionIndex:r,response:o,responseGroupUid:i})=>{const s=t();if(!i||it(s))return;const d={responseGroupUid:i,meta:s.meta,customMetadata:s.customMetadata,responses:o,completedAt:n,previewKey:s.previewKey},l=await s.trackPromise(H.sprigFetch(`${s.apiURL}/sdk/1/environments/${s.envId}/visitors/${s.userId}/responses/submit`,{body:JSON.stringify(d),headers:s.headers,method:"POST"}));l.ok?o.forEach((u,m)=>{s.eventEmitFn(H.SprigEvent.QuestionAnswered,{...u,questionIndex:r?r+m:void 0,"survey.id":s.surveyId})}):l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await s.trackPromise(cn(s,"submitResponse",l.error)))},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(it(i))return;const{cards:s,index:d}=i;let l=r??d,u=s[l];for(;u;){const m={sid:i.surveyId,qid:u.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid,previewKey:i.previewKey},c=await i.trackPromise(H.sprigFetch(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{method:"POST",headers:i.headers,body:JSON.stringify(m)}));!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await i.trackPromise(cn(i,"trackHistory",c.error)));const p=s[l+1];if(!u.groupId||!(p!=null&&p.groupId)||p.groupId!==u.groupId)break;l++,u=p,o=!1}},trackPromise:async n=>{const{resolveTrackedPromise:r}=t();return e(o=>({unresolvedRequestCount:o.unresolvedRequestCount+1})),n.then(o=>(r(),o)).catch(o=>{throw r(),o})},unresolvedRequestCount:0,update:()=>{const{cards:n,index:r,headers:o,eventEmitFn:i,frame:s,useMobileStyling:d,surveyId:l,viewDocument:u}=t(),m=o["userleap-platform"]==="web",c=H.shouldDirectEmbed(o),p=n[r],v=p.type==="matrix"&&!(p.props.properties.displayMatrixAsAccordion||d);e({minScrollableHeight:void 0}),setTimeout(()=>{var k,x,L;!c&&!d&&((k=s==null?void 0:s.setWidth)==null||k.call(s,G.DEFAULT_WIDTH_PX));const[h,y,_]=G.calculateFrameDimensions(u,m&&!d,c);c?(i(H.SprigEvent.SurveyHeight,{name:H.SprigEvent.SurveyHeight,contentFrameHeight:h,"survey.id":l}),i(H.SprigEvent.SurveyWidth,{name:H.SprigEvent.SurveyWidth,contentFrameWidth:y,"survey.id":l})):((x=s.setHeight)==null||x.call(s,h),e({minScrollableHeight:_}),!d&&v&&((L=s.setWidth)==null||L.call(s,y)))},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0,focusedQuestionId:null,setFocusedQuestionId:n=>e({focusedQuestionId:n})})),it=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview||e.previewMode,cn=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:d,viewDocument:l}=e,u=l.documentElement,m={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},c={action:t,err:{message:`${n==null?void 0:n.name} - ${n==null?void 0:n.message}`,stack:n==null?void 0:n.stack},meta:m,vid:o,envId:i};(await H.sprigFetch(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},d),body:JSON.stringify(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},br=e=>ie("svg",{fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...e},ie("path",{d:"M17 10L12 15L7 10",stroke:"#0B2330",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})),yr=e=>ie("svg",{fill:"none",height:10,viewBox:"0 0 10 10",width:10,xmlns:"http://www.w3.org/2000/svg",...e},ie("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:2})),Lo=({visible:e})=>a("div",{className:"sprig-check-background",style:{opacity:e?1:0},children:a(yr,{className:"sprig-check"})}),un="250ms",Do=St(({animate:e,children:t,header:n,isOpen:r,onClick:o,showHeaderCheck:i},s)=>{const d=ee(null),[l,u]=z(0),[m,c]=z("none"),[p,v]=z(!0);return Q(()=>{var y;const h=(y=d.current)==null?void 0:y.getBoundingClientRect();u(r&&h?h.height:0)},[r]),Q(()=>{!l&&r||!p||v(!1),c(e&&!p?`height ${un} ease`:"none")},[e,p,l,r]),a("div",{className:"sprig-accordion",ref:s,children:[a("button",{className:"sprig-accordion-header-container",onClick:o,type:"button",children:[a("div",{className:"sprig-header-label-container",children:[a("span",{className:"sprig-header-label",children:n}),a(Lo,{visible:i})]}),a(br,{className:"sprig-caret",style:{transitionDuration:e?un:"0",transform:r?"rotate(-180deg)":"none"}})]}),a("div",{className:"sprig-accordion-body",style:{transition:m,height:l},children:a("div",{ref:d,children:t})})]})}),Lt=({style:e,stroke:t="black"})=>a("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[a("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),a("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),B=(...e)=>e.filter(Boolean).join(" "),X=(e,t,n)=>{const r=t?"--mobile":"--desktop";return`${e+r} ${e+(n?`${r}_${n}`:"")} ${e}`},Ro=(e,t)=>`${e} ${e}__${t}`,te=e=>a("button",{...e,className:B("ul-card-text__button",e.className),id:"ul-card-text__button"}),xr=()=>{const{viewDocument:e}=q(r=>({viewDocument:r.viewDocument})),[t,n]=z(!1);return Q(()=>{const r=e.querySelector(".sprig-question-body"),o=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{n(!!(r&&G.isHTMLElement(r)&&r.scrollHeight>r.offsetHeight))})});return r&&o.observe(r),()=>{r&&o.disconnect()}},[e]),t},pn=({plainText:e,richText:t,id:n,className:r,isHeader:o})=>t?a("div",{className:r,dangerouslySetInnerHTML:{__html:t},id:n}):e?a(o?"h1":"p",{className:r,id:n,children:e}):null,Po=()=>{const{cards:e,close:t,endCard:n,headers:r,index:o}=q(d=>({cards:d.cards,close:d.close,endCard:d.endCard,headers:d.headers,index:d.index,useMobileStyling:d.useMobileStyling})),i=e.length,s=ue(()=>()=>t(G.APP_ID),[t]);return["email","link"].includes(r["userleap-platform"])||n&&o+1===i?null:a("div",{"aria-label":"Close button",className:"close-btn",onClick:s,onKeyPress:d=>{d.key==="Enter"&&s()},role:"button",tabIndex:0,children:a("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:a("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"})})})},se=({message:e,properties:t})=>{const n=ee(null),r=t==null?void 0:t.captionText,o=xr();return a("div",{className:B("question-header-container","sprig-header-container",o?"sprig-border-bottom":null),ref:n,children:[a("div",{className:"question-header-button-container",children:[a(pn,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:e,richText:t==null?void 0:t.questionHtml}),a(Po,{})]}),a(pn,{className:"ul-caption",id:"ul-caption",plainText:r,richText:t==null?void 0:t.captionHtml})]})},No=()=>a("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:a("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),Ge=({isSubmitDisabled:e,handleSubmit:t})=>a("div",{className:"ul-card-longform__submit-button-container",children:a(te,{className:"ul-card-longform__submit-button",disabled:e,onClick:t,children:["OK ",a(No,{})]})}),mn=({buttonText:e="View Prototype",handleClick:t})=>a("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),pe=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var c;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=q(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),d=(n==null?void 0:n.conceptUrl)||((c=n==null?void 0:n.consentDocument)==null?void 0:c.url),l=window.innerWidth<G.EMBED_MOBILE_MAX_WIDTH,u=i["userleap-platform"],m=(p,v)=>{p.preventDefault(),r(v)};if(!s&&l&&!o&&d&&["email","link"].includes(u)){if(t==="prototype")return a(mn,{handleClick:p=>{m(p,"question.prototype.click")}});if(t==="pdf")return a(mn,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{m(p,"question.agreement.click")}})}return e()},kr=({isSelected:e,id:t,divId:n,themeColor:r})=>a("div",{"aria-checked":e,"aria-labelledby":`label-${t}`,className:"select-checkbox",id:n,role:"checkbox",style:e?{backgroundColor:r,borderColor:r,boxShadow:"none"}:{},tabIndex:0,children:e&&a(yr,{})}),wr=(e,t)=>{const n=ee(0);return()=>{if(e.current){const r=e.current;r.style.height="1px";const o=r.scrollHeight+(r.offsetHeight-r.clientHeight),i=parseInt(window.getComputedStyle(r).getPropertyValue("max-height")),s=o<=i?o:i;n.current!==s&&t(),n.current=s,r.style.height=`${s}px`}}},Ke=({ariaLabel:e,border:t,choiceStyle:n={},label:r,isSelected:o,value:i,text:s,id:d,isRadio:l,useMobileStyling:u,error:m,allowTextEntry:c,noneOfTheAbove:p,promptText:v,onUserInputChanged:h})=>{const{styleNonce:y,viewDocument:_}=q(b=>({styleNonce:b.styleNonce,viewDocument:b.viewDocument})),[k,x]=z(!1);Oo(_,t,y);const L=({isSelected:b,userText:j})=>{h&&h({id:d,selected:b,value:i,userText:j,noneOfTheAbove:p})},I=b=>{b.stopPropagation(),L({isSelected:l||!o,userText:s}),x(!1)},w=()=>{k||x(!0)},S=()=>{k&&x(!1)},g={onClick:b=>I(b),onKeyPress:b=>(j=>{j.key!=="Enter"&&j.key!==" "||I(j)})(b)};"ontouchstart"in _.documentElement?(g.onTouchStart=S,g.onTouchCancel=S,g.onTouchEnd=S):(g.onMouseDown=w,g.onMouseLeave=S);const D=l?`radio-${d}`:`checkbox-${d}`,T=o||k?[Fe]:[],C=[...m?[Cr]:[],...T],f=r?{"aria-labelledby":`label-${d}`}:{"aria-label":e};return a("div",{className:B(X("choice",u),...C),id:`choice-div-${d}`,style:{...n,...m?{borderColor:G.ERROR_BORDER_COLOR}:{}},...g,children:[a("div",{className:B("choice-label-container"),children:[l?a("div",{...f,className:B("select-radio",...T),id:D,role:"radio",tabIndex:0}):a(kr,{divId:D,id:d,isSelected:o,themeColor:t}),r&&a("label",{className:B(X("select-label",u)),htmlFor:D,id:`label-${d}`,children:r})]}),c&&o&&a("div",{className:B("choice-text-entry-container",...T),children:a(Mo,{onTextChange:b=>L({isSelected:o,userText:b}),promptText:v||"Please specify",textValue:s,useMobileStyling:u})})]})},Mo=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=ee(null),{update:i}=q(d=>({update:d.update})),s=wr(o,()=>i());return Q(()=>(s(),o.current&&o.current.focus(),()=>{i()}),[]),a("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:B(X("choice-text-input",r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:d=>{s(),d.stopPropagation(),n(d.currentTarget.value)},onClick:d=>{d.stopPropagation()},onKeyPress:d=>{d.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},hn="ul-select-style-element",Fe="ul-select-active-dynamic-style",Cr="ul-select-error-dynamic-style",Oo=(e,t,n)=>{let r=e.getElementById(hn),o=!1;r||(r=e.createElement("style"),o=!0),r.tagName.toLowerCase()==="style"&&(r.id=hn,n&&(r.nonce=n),r.textContent=Uo(t),o&&e.head.appendChild(r))},Uo=e=>`
|
|
2
2
|
.${Fe} {
|
|
3
3
|
border-color: ${e};
|
|
4
4
|
}
|
|
@@ -666,4 +666,4 @@ span.ul-button-text {
|
|
|
666
666
|
.vjs-poster {
|
|
667
667
|
background-size: cover;
|
|
668
668
|
}
|
|
669
|
-
`}],qr="-video-player",bn="-secondary-video-player",yn="-video-recorder";let de,xn;const ye=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=O.document.documentElement;if(!r||!o)return;const d={event:`SDK - ${e}`,visitorId:r,environmentId:o,metadata:{...i||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},he=async(e,t,n,r,o,i)=>{ye({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=O.document.documentElement,d={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:d,vid:o,envId:i};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},Fr=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(((o,{type:i,content:s})=>new Promise(function(d,l){let u;i==="script"?(u=O.document.createElement("script"),u.src=s):i==="link"?(u=O.document.createElement("link"),u.rel="stylesheet",u.href=s,u.type="text/css"):(u=O.document.createElement("style"),u.innerHTML=s),u.onload=function(){d(s)},u.onerror=function(){l(s)},u.async=!1,u.id=btoa(s),o.appendChild(u)}))(O.document.head,r)),n),[])).then(()=>{O.videojs=O.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},kn=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=ne;else if(t==="success")e.style.visibility=ne,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},dt=(e,t)=>{const n=O.videojs(e.id());return n==null?void 0:n.payload[t]},Ar=(e,t)=>{const n=new(O.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),vi(n),n},vi=e=>{e.children().forEach(t=>{if(ae[t.name_]){const n=Ae(ae[t.name_],`ul-${ae[t.name_]}`);t.el_.appendChild(n)}})},Ae=(e,t="")=>{const n=O.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},Vr=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(O.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(O.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const d=n&&n.src?xi(n.src):null;!n||!o&&d?(e.audioPlayerPlaceholder.hide(),O.document.getElementById(`${e.id()}_html5_api`).style.height="100%",d&&e.poster(d)):(e.children()[0].classList.add("vjs-hidden"),O.document.getElementById(`${e.id()}_html5_api`).style.height="0px"),e.on("play",()=>{o||!n||d||bi(e),i==null||i.play()}),e.on("pause",()=>{i==null||i.pause()}),e.on("seeked",()=>{i==null||i.currentTime(e.currentTime())}),e.on("ratechange",()=>{i==null||i.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),s.addChild(t),e.addChild(s),r&&r(e)},_i=(e,t,n,r,o,i,s,d=!1)=>{xn=Date.now();const l=Qe(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!l)return;l.payload=n;const{surveyId:u,questionId:m,responseGroupUid:c,visitorId:p,envId:v}=n;let h;const y=C=>{const f=at,b=at+"-audio-only";kn(l.uploadProgressLabel,"none"),de&&de.startTime>=xn&&de.abort();const j=O.document.getElementById("ul-camera-button");C?(l.children()[0].classList.add("vjs-hidden"),L.removeClass(f),L.addClass(b),j.innerHTML=ae.TurnOnCamera,l.audioPlayerPlaceholder.removeClass("vjs-hidden"),h==null||h.getTracks().forEach(R=>{R.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(R=>{h=R,R.getVideoTracks().forEach(E=>{E.enabled=!1}),l.record().onDeviceReady(R)}).catch(l.record().onDeviceError.bind(l.record()))):(h==null||h.getVideoTracks().forEach(R=>{R.enabled=!0}),l.children()[0].classList.remove("vjs-hidden"),l.record().getDevice(),L.removeClass(b),L.addClass(f),j.innerHTML=ae.TurnOffCamera,l.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{_.hasClass(ne)||(ye({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:p,envId:v,metadata:{questionId:m,responseGroupUid:c,surveyId:u}}),y(l.cameraOff),o(A.DELETE,{}),L.removeClass(ne),_.addClass(ne))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(Ae(ae.DeleteButton,"ul-delete-button"));const k=O.document.getElementById(t),x=()=>{k.classList.contains("vjs-fullscreen")&&l.cameraOff?k.style.display="table":k.style.display="flex"};x();const L=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{l.record().isRecording()||(l.cameraOff=!l.cameraOff,ye({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:m,responseGroupUid:c,surveyId:u,cameraOff:l.cameraOff}}),y(l.cameraOff),!_.hasClass(ne)&&_.addClass(ne),o(A.DELETE,{}),x())}});L.addClass(at),L.el_.appendChild(Ae(ae.TurnOffCamera,"ul-camera-button"));const I=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{const C=O.document.getElementById("ul-recorder-toggle");if(l.record().isRecording())l.record().stop(),C&&(C.innerHTML=ae.RecordButton),I.removeClass(lt),_.removeClass(ne);else{const f=O.document.getElementById("ul-recording-countdown-screen");if(f)f.remove(),C&&(C.innerHTML=ae.RecordButton),y(l.cameraOff),o(A.DELETE,{}),L.removeClass(ne),_.addClass(ne),I.removeClass(lt),g.show();else{I.addClass(lt),g.hide(),L.addClass(ne),_.addClass(ne),C&&(C.innerHTML=ae.StopButton);const b=O.document.createElement("div");b.id="ul-recording-countdown-screen",k.insertBefore(b,k.children[1]),b.style.height=`${k.offsetHeight}px`,zr(l,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(Ae(ae.RecordButton,"ul-recorder-toggle"));const w=O.document.createElement("p");w.style.visibility="hidden",w.className="ul-upload-progress-label",e.appendChild(w),l.uploadProgressLabel=w;const S=Ar(l,[_,L,"PlayToggle",I,"FullscreenToggle"]),g=S.children().find(C=>C.name_==="FullscreenToggle");g.hasClass("vjs-disabled")&&g.hide();const D=S.children().find(C=>C.name_==="PlayToggle");D.hide(),_.addClass(ne),Vr(l,S,i,!1,d),l.on("stopRecord",()=>{I.hide(),D.show(),g.show(),_.removeClass(ne)}),l.on("deviceReady",()=>{I.show(),D.hide(),_.addClass(ne)}),((C,f,b,j,R)=>{const{surveyId:E,responseGroupUid:F,visitorId:N,envId:M}=C.payload;C.on("deviceError",function(){console.warn("device error: ",C.deviceErrorCode),C.deviceErrorCode.message==="Permission denied"?(C.deviceButton.addClass("permission-denied"),b&&b(A.ERROR,{type:A.PERMISSION_DENIED}),ye({event:"Video Permission Denied",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{questionId:dt(C,st),responseGroupUid:F,surveyId:E}})):(b&&b(A.ERROR,{type:A.OTHER}),he(new Error(C.deviceErrorCode.message),"recorderDeviceError",f,R,N,M))}),C.on("error",function($,U){he(U||C.error(),"recorderError",f,R,N,M)}),C.on("startRecord",function($,U){j(C.uploadProgressLabel,"none"),ye({event:"Video Record Start",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{questionId:dt(C,st),responseGroupUid:F,surveyId:E}})}),C.on("finishRecord",async function(){j(C.uploadProgressLabel,"start",0);const $=dt(C,st);if(!E){const J="internal error: missing fields in payload";return b&&b(A.ERROR,{type:A.OTHER}),he(new Error(J),"finishRecord",f,R,N,M),null}C.record().stopDevice();const U=C.cameraOff?A.MEDIA_TYPE_AUDIO:A.MEDIA_TYPE_VIDEO,V=H.v4();ye({event:"Video Record Finish",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U}});const re={surveyId:E,updatedAt:new Date().toISOString(),mediaType:U,mediaRecordingUid:V};$&&(re.questionId=$),F&&(re.responseGroupUid=F),N&&(re.visitorId=N);const oe=await(async()=>{const J=await fetch(`${f}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)});if(J.ok){const Y=await J.json();return b&&b(A.UPLOAD_STARTED,{[A.UPLOAD_ID]:Y.upload.id,[A.MEDIA_TYPE]:U,[A.MEDIA_RECORDING_UID]:V}),Y.upload.url}return b&&b(A.ERROR,{type:A.OTHER,response:J}),he(new Error("failed to get upload response with url"),"finishRecord",f,R,N,M),null})();oe&&(de=O.document.defaultView.UpChunk.createUpload({endpoint:oe,file:new O.document.defaultView.File([C.recordedData],`recording ${U} ${Date.now()}`),chunkSize:5120}),de.startTime=Date.now(),ye({event:"Video Upload Start",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U,url:oe}}),de.on("error",J=>{j(C.uploadProgressLabel,"none"),b&&b(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:V}),he(J,"finishRecord",f,R,N,M)}),de.on("progress",J=>{b&&b(A.UPLOAD_PROGRESS,{[A.MEDIA_RECORDING_UID]:V,[A.UPLOAD_PROGRESS_PCT]:J.detail}),j(C.uploadProgressLabel,"progress",J.detail)}),de.on("success",()=>{j(C.uploadProgressLabel,"success"),b&&b(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:V}),ye({event:"Video Upload Success",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U,url:oe,elapsedMs:de.startTime&&Date.now()-de.startTime}})}))})})(l,r,o,kn,s);const T=[{name:"microphone"}];!l.cameraOff&&T.push({name:"camera"}),Promise.all(T.map(C=>{var f;return(f=navigator==null?void 0:navigator.permissions)==null?void 0:f.query(C)})).then(C=>{C.reduce((f,b)=>f&b.state==="granted",!0)&&l&&(l.deviceButton&&l.deviceButton.hide(),l.record().getDevice())}).catch(C=>{})},zr=(e,t=3)=>{const n=O.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{zr(e,t-1)},1e3))},$r=e=>{const t=O.document.createElement("div");return t.className="ul-video-container",t.appendChild((n=>{const r=O.document.createElement("div");return r.className="ul-video-player-loading",r.id=Nt(n),["first","second","third","fourth"].map(o=>{const i=O.document.createElement("div");i.className=o,r.appendChild(i)}),r})(e)),t},bt=(e,t)=>{const n=O.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=O.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const o=O.document.createElement("a");return o.href="https://videojs.com/html5-video-support/",o.target="_blank",o.innerHTML="supports HTML5 video",r.appendChild(o),n.appendChild(r),t.appendChild(n),t},bi=(e,t)=>{e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),O.document.getElementById(`${e.id()}_html5_api`).style.height="100%"},Qe=(e,t)=>O.document.getElementById(e)?t?O.videojs(e,t):O.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),yi=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,d=null)=>{O.document=i;const l=e+qr,u=$r(l);return O.document.addEventListener("securitypolicyviolation",m=>{he(new Error(`Voice & Video feature violates ${m.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),Fr(Br,()=>{O.document.getElementById(Nt(l)).remove(),bt(l,u);const m={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=e+bn;bt(c,u);const p=Qe(l,m),v=Qe(c,{muted:!0,...m});if(!p||!v)return;((_,k,x)=>{_.addClass(`ul${bn}`);const L=new(O.videojs.getComponent("Component"))(_);k&&_.src(k),_.addChild(L),x&&x(_)})(v,s,d),s||v.addClass(ne);const h=Ar(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),y=h.children().find(_=>_.name_==="FullscreenToggle");y.hasClass("vjs-disabled")&&y.hide(),Vr(p,h,t,n,r,v)}catch(c){return void he(new Error(`Error when creating video player object ${c}`),"playerDeviceError",o,{})}}),u},xi=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(_n)&&(n=n.replace(_n,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},A={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},ae={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},ke="ul-card-video__player_recorder",wn="ul-video-btn",ct=0,Cn=1,ki=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:d,handleUploadUpdate:l,headers:u,responseGroupUid:m,surveyId:c,update:p,viewDocument:v,visitorId:h}=q(f=>({apiURL:f.apiURL,envId:f.envId,handleUploadUpdate:f.handleUploadUpdate,headers:f.headers,responseGroupUid:f.responseGroupUid,surveyId:f.surveyId,update:f.update,viewDocument:f.viewDocument,visitorId:f.userId})),[y,_]=z(!1),[k,x]=z(null),[L,I]=z(null),[w,S]=z(ct),g=ee(null),D=r&&r.videoUrl;Q(()=>{const f=g.current,b=new ResizeObserver(()=>{p()});return f&&b.observe(f),()=>{f&&b.unobserve(f)}},[p]);const T=(f,b)=>{f===A.UPLOAD_STARTED?(x(b[A.UPLOAD_ID]),I(b[A.MEDIA_RECORDING_UID]),_(!0)):f===A.DELETE?(x(null),I(null),_(!1)):f===A.UPLOAD_PROGRESS?isNaN(b[A.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],progressPct:b[A.UPLOAD_PROGRESS_PCT]}):f===A.UPLOAD_FINISHED&&l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],isComplete:!0})},C=f=>{f.preventDefault(),f.stopPropagation(),document.getElementById(ke)&&(b=>{const j=b+yn;if(O.document.getElementById(j)&&O.videojs){try{if(!O.videojs(j).record().stream)return}catch{return}O.videojs(j).record().stop(),O.videojs(j).record().stopDevice()}})(ke),k&&L?(l({mediaRecordingUid:L,isSubmitted:!0}),n({value:{mediaRecordingUid:L},questionId:o,type:i},!0)):n({value:null,questionId:o,type:i},!0)};return a("form",{className:B(e,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[a(se,{message:t,properties:r}),a(me,{children:[a("div",{id:"ul-question-player-container",ref:g,style:{display:w===ct?"":"none"},children:[a("div",{id:ke,ref:f=>{if(f&&f.children.length===0&&!r.hideRecordedPrompt){const b=yi(ke,{src:D,type:"application/x-mpegURL"},void 0,r.mediaType===A.MEDIA_TYPE_AUDIO,s,v);f.appendChild(b)}}}),a(pe,{defaultBody:()=>a("button",{className:`${wn} ul-record-response-btn`,onClick:f=>{f.preventDefault(),f.stopPropagation(),document.getElementById(ke)&&(b=>{const j=Qe(b+qr);j==null||j.pause()})(ke),S(Cn)}}),properties:r})]}),a("div",{style:{display:w===Cn?"block":"none"},children:[a("button",{className:`${wn} ul-back-question-btn`,onClick:f=>{f.preventDefault(),f.stopPropagation(),S(ct)},style:{display:r.hideRecordedPrompt?"none":"block"}}),a("div",{id:"ul-recorder-player-container",ref:f=>{if(f&&f.children.length===0){const b=((j,R={},E="https://api.userleap.com",F,N,M,$=!1,U=document)=>{O.document=U;const V=j+yn,re=$r(V);return O.document.addEventListener("securitypolicyviolation",oe=>{he(new Error(`Voice & Video feature violates ${oe.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",E,M,R.visitorId,R.envId)}),Fr(Br.concat(fi),()=>{bt(V,re),O.document.getElementById(Nt(V)).remove();try{_i(re,V,R,E,F,N,M,$)}catch(oe){return void he(new Error(`Error when creating video recorder player object ${oe}`),"recorderDeviceError",E,M,R.visitorId,R.envId)}}),re})(ke,{surveyId:c,responseGroupUid:m,questionId:o,visitorId:h,envId:d},s,T,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===A.MEDIA_TYPE_AUDIO,v);f.appendChild(b)}}})]})]}),a(_e,{children:[a(te,{disabled:!y,onClick:C,children:xe(r)}),a("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:C,style:{display:r.required?"none":"block",...y?{display:"none"}:{}},children:Dt(r)})]})]})},wi=({className:e})=>{const{uploadProgress:t}=q(i=>({uploadProgress:i.uploadProgress}));let n,r;Object.values(t).filter(i=>i.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(t).filter(i=>i.isSubmitted).map(i=>i.progressPct||0)));return a("div",{className:B(e,"ul-card--uploading","fade-in-transition"),children:[a("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:a("div",{className:"ul-loading-spinner",children:[a("div",{className:"first"}),a("div",{className:"second"}),a("div",{className:"third"}),a("div",{className:"fourth"})]})}),a(se,{message:`${n} (${o}% complete)`}),a("p",{className:"ul-caption",children:r})]})},Ci=()=>{var k;const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:o,marketingUrl:i,showSurveyBrand:s,slugName:d,surveyId:l,viewedCardCount:u}=q(x=>({border:x.border,cards:x.cards,forceBrandedLogo:x.forceBrandedLogo,headers:x.headers,index:x.index,marketingUrl:x.marketingUrl,showSurveyBrand:x.showSurveyBrand,slugName:x.slugName,surveyId:x.surveyId,viewedCardCount:x.viewedCardCount})),m=ee(null),c=t.filter(x=>x.type!=="uploading"&&x.type!=="thanks"),p=((x,L)=>{const I=new Set(["thanks","uploading"]);if(L>=x.length||L<0||I.has(x[L].type))return 0;const w=x.filter(g=>!I.has(g.type));if(L===w.length-1)return 1;const S={[w.length-1]:1,[-1]:0};for(let g=w.length-2;g>=L;g--){const D=w[g],T=To(g,D.props.routingOptions);if(T.length===0){S[g]=S[g+1]+1;continue}let C=0,f=Eo(D);if(f===null)return w.length-1-L;for(let b=0;b<T.length&&f.length!==0;b++){const{comparator:j,target:R,value:E}=T[b],F=f.filter(N=>{const M=So({value:N},D.type,N),$=vr(N,D.type);return!(M&&j==="answered"||$&&j==="partial"||!M&&!$&&j==="skipped"||j==="given_up"&&jo(N)&&N.taskStatus==="given.up"||M&&D.type==="open"&&(j==="contains"||j==="notcontains")||M&&Io(j)&&Tt[j](N,E))});if(F.length<f.length){const N=parseInt(String(R),10);if(N!==-1&&N<=g||N>=w.length)return w.length-1-L;C=Math.max(S[N]+1,C)}f=F}f.length>0&&(C=Math.max(S[g+1]+1,C)),S[g]=C}return S[L]})(t,o),v=u+1,h=v/(v+p),y=jr({marketingUrl:i,slugName:d,surveyId:l,forceBrandedLogo:n});Q(()=>{m.current&&(m.current.style.width=100*h+"%")},[h]);const _=((k=t[o])==null?void 0:k.type)==="thanks";return a("footer",{className:"ul-footer "+(r["userleap-platform"]==="link"?"ul-footer__link":""),children:_&&n?a(Ir,{marketingUrlLink:y}):a(K,{children:[c.length>1&&a("div",{className:"ul-progress-bar-container ul-progress-bar-container__footer",children:a("div",{className:"ul-progress-bar-current",ref:m,style:{border:`1px solid ${e||"#000"}`}})}),s?a(Er,{forceBrandedLogo:n,marketingUrlLink:y}):null]})})},Si=()=>{const e=q(s=>s.border),t=q(s=>s.cards),n=q(s=>s.index),r=q(s=>s.focusedQuestionId),{totalQuestions:o,fraction:i}=ue(()=>{var u;const s=t.filter(m=>m.type!=="uploading"&&m.type!=="thanks"),d=s.length;if(d<=1)return{totalQuestions:d,fraction:0};if(((u=t[n])==null?void 0:u.type)==="thanks")return{totalQuestions:d,fraction:1};const l=s.findIndex(m=>m.name===r);return{totalQuestions:d,fraction:(l>=0?l:0)/d}},[t,n,r]);return o<=1?null:a("div",{className:"ul-progress-bar-container ul-progress-bar-container__header",children:a("div",{className:"ul-progress-bar-current",style:{width:100*i+"%",border:`1px solid ${e??"#000"}`}})})},Ei=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:d,fontFamily:l,headers:u,index:m,minScrollableHeight:c,next:p,previewMode:v,productConfig:h,seen:y,showStripes:_,studyType:k,surveyId:x,update:L,useMobileStyling:I,viewDocument:w}=q(E=>({answers:E.answers,border:E.border,cards:E.cards,close:E.close,configureExitOnOverlayClick:E.configureExitOnOverlayClick,destroy:E.destroy,endCard:E.endCard,eventEmitFn:E.eventEmitFn,fontFamily:E.fontFamily,headers:E.headers,index:E.index,previewMode:E.previewMode,productConfig:E.productConfig,minScrollableHeight:E.minScrollableHeight,next:E.next,seen:E.seen,showStripes:E.showStripes,studyType:E.studyType,surveyId:E.surveyId,update:E.update,useMobileStyling:E.useMobileStyling,viewDocument:E.viewDocument})),S=ee(null),g=ee(!1),D=u["userleap-platform"],{props:T,type:C,name:f}=n[m];Q(()=>{if(window.Sprig)return window.Sprig.trackHistory=E=>q.getState().trackHistory(E),()=>{window.Sprig.trackHistory=void 0}},[]),Q(()=>{S.current&&(S.current.classList.contains("ul-app--visible")||S.current.classList.add("ul-app--visible"),!g.current&&d&&(g.current=!0,d(H.SprigEvent.SurveyAppeared,{name:H.SprigEvent.SurveyAppeared,"survey.id":x})))},[d,x]),Q(()=>{const E=()=>{w.visibilityState==="visible"&&(y(),w.removeEventListener("visibilitychange",E))};return w.addEventListener("visibilitychange",E),E(),()=>{w.removeEventListener("visibilitychange",E)}},[y,w]),Q(()=>{L()},[m,L]),Q(()=>{o(()=>r())},[r,o]);const b=ue(()=>H.groupCards(n,m),[n,m]),j=Se(E=>{p({data:E,completeSurvey:()=>i(G.APP_ID),endCard:s}),G.resetScrollPosition(w)},[p,i,s,w]);if(e){for(const E of e)if(E.questionId===f){let F;if(C==="multiplechoice"){const N=T.options.find(({value:M})=>M===E.value);if(!N)break;F={[N.id]:N.value}}else F=E.value;j({value:F,type:C,questionId:E.questionId});break}}const R=!I&&((h==null?void 0:h.framePosition)==="center"||(h==null?void 0:h.desktopDisplay)==="center-modal"||((h==null?void 0:h.placement)||"").includes("center"));return a("div",{className:B("ul-app",H.shouldDirectEmbed(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:G.APP_ID,onClick:E=>{var $;const F=window.sprigAPI,N=E.target;if(!F||!N)return;const M=[N,N.parentElement];for(const U of M)if((($=U==null?void 0:U.tagName)==null?void 0:$.toLowerCase())==="a"){E.preventDefault();try{const V=new URL(U.href);V.protocol!=="http:"&&V.protocol!=="https:"||(F==null||F.openUrl(V.toString()))}catch(V){console.error(V)}return}},ref:S,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{},...R?{position:"relative"}:{}},children:a("div",{className:"ul-app__container",children:a("div",{className:B(X("ul-card__container",I,k)),style:{...k!=="feedbackButton"||(h==null?void 0:h.desktopDisplay)==="center-modal"?{borderColor:t}:{},...(h==null?void 0:h.desktopDisplay)==="slider"?{margin:"0px"}:{}},children:a("div",{className:"sprig-container",style:{minHeight:c},children:[_&&a("div",{className:"ul-header__container",dir:"ltr",children:a("div",{className:"ul-header",children:"For development purposes only"})}),v&&a("div",{className:"ul-header__container",dir:"ltr",children:a("div",{className:"ul-header",children:"Preview Mode: Response will not be recorded."})}),H.isLongFormSurvey(k)&&a(Si,{}),a("div",{className:B(Ro("ul-card-main-content",D)),children:a(ri,{cards:b,next:j})}),!H.isLongFormSurvey(k)&&a(Ci,{})]})})})})},Wr=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",Sn=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Wr()};return new MediaRecorder(e,t)},En=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function In(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{"begin.callback":s}=r,d=e.currentMediaRecordingUid;if(!d)return;s&&s(d),e.onstop=()=>async function(l,u,m,c,p,v,h){const y=q.getState().viewDocument,{"upload.callback":_,"progress.callback":k}=c,x={mediaType:m,updatedAt:new Date().toISOString(),mediaRecordingUid:p,...c["passthrough.data"]},L=await(async(g,D)=>{var C;const T=await fetch(D,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(T.ok){const f=await T.json();return(C=f==null?void 0:f.upload)==null?void 0:C.url}return null})(x,l);if(!L)return void(_&&_(null,{message:"failed to get upload url"}));const I=new Blob(h,{type:Wr()});if(!y.defaultView)return;const w=new y.defaultView.File([I],`recording video ${Date.now()}`),S=v.createUpload({endpoint:L,file:w,chunkSize:5120});S.on("error",g=>{_&&_(null,g)}),S.on("progress",g=>{k&&k(p,g)}),S.on("success",()=>{_&&_(p,!0)})}(t,0,n,r,d,o,i),e.stop()}}const Ii={state:{chunks:{}},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?"video":"audio";this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&In(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&In(r,t,"screen",e,o,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(o=>{o&&(o.state==="recording"&&o.stop(),o.stream.getTracks().map(i=>{i.readyState==="live"&&i.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on("permission.status",this.permissionStatusCallback.bind(this)),e.on("av.permission",async n=>{this.avPermissionCallback(n)}),e.on("begin.recording",this.beginRecordingCallback.bind(this)),e.on("start.task",this.startTaskCallback.bind(this)),e.on("screen.permission",async n=>{this.screenPermissionCallback(n)}),e.on("finish.task",async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{"stream.ready":t,"permission.descriptors":n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(s=>s.readyState==="live"&&s.stop()),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes("camera"),audio:!0}),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(s){return console.warn("Error: failed to get permissions: "+s),void(t&&t(null,null))}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{"screen.permission.requested":t,"stream.ready.callback":n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){return t==null||t(!1),console.warn("Error: failed to get permissions: "+r),void(n&&n(null,null))}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{"recording.media.types":t,"start.recording.callback":n=()=>{}}=e;if(!t)return;const r=[];if(t.includes("video")&&this.state.avStream){this.state.avRecorder=Sn(this.state.avStream);const o=H.v4();En(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes("screen")&&this.state.captureStream){this.state.screenRecorder=Sn(this.state.captureStream);const o=H.v4();En(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{"current.index":t,"task.response":n,"task.complete.callback":r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{"permission.status.callback":t}=e,n=this.state.avStream;t&&t(n,!!n&&(n==null?void 0:n.getVideoTracks().length)>0,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,{allResponses:s}=q.getState(),d=_r({cards:n,index:e,hasEndCard:r,allResponses:s});d!==null&&n[d].type==="recordedtask"||[o,i].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},Ve=Object.create(Ii);Object.freeze(Ve);const ji=({mode:e=null,viewWindow:t,viewDocument:n,trackPageViewUrl:r})=>{const o=n.documentElement;let i;try{i=t.parent.location.href}catch{i=t.location.href}return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:o.clientWidth,ch:o.clientHeight,p:r??i,l:t.navigator.language}},Ti={configure:function(e,t=!0){var k;const{answers:n,apiURL:r,endCard:o,eventEmitFn:i,fontFamilyURL:s,frame:d,previewKey:l,viewDocument:u,viewWindow:m}=e,c=H.shouldDirectEmbed(e.headers)?e.frame:u.body,p=e.UpChunk||window.UpChunk,v=H.eventEmitter,h=((x,L)=>{const I=[...x],w=new Set(["videovoice","recordedtask"]);return x.some(S=>w.has(S.type))&&I.push({name:-2,props:{routingOptions:[]},type:"uploading"}),L&&I.push({name:-1,props:{routingOptions:[]},type:"thanks"}),I})(e.cards,!!o);Ve.configure(v,{cards:h,hasEndCard:!!o,apiURL:r,UpChunk:p}),q.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:i,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:d,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:ji({mode:e.mode,viewWindow:m,viewDocument:u,trackPageViewUrl:e.trackPageViewUrl}),mode:e.mode,previewKey:l,previewMode:e.previewMode,productConfig:e.productConfig,recorder:Ve,recorderEventEmitter:v,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,studyType:e.studyType,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{head:y}=u;if(G.setSurveyStyles({document:u,elementId:"sprig-style",styleString:`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-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}}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;min-width:200px;justify-content:center;animation:enable-transitions 0s .3s forwards;min-height:0}@keyframes enable-transitions{to{transition:opacity .2s ease-in-out}}.ul-focus-transitions-active .ul-card,.ul-card--with-transitions{transition:opacity .2s ease-in-out}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026;margin:15px}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container--desktop_longFormSurvey,.ul-card__container--mobile_longFormSurvey{margin:0}.sprig-container{display:flex;flex-direction:column;width:100%;height:fit-content;flex:1 1 auto;min-height:0;justify-content:center}.ul-card__container{background:#fff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;padding:0;min-height:0;position:relative;text-align:center;word-break:normal;overflow:auto}.ul-card__container--desktop_feedbackButton{box-shadow:unset}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:center;align-self:stretch}.sprig-question-footer-container{align-items:center;width:100%;height:fit-content;display:flex;flex-direction:column;padding:12px 20px 0}.long-form-question-footer-container{position:fixed;bottom:0;left:0;width:100%;display:flex;justify-content:space-between;align-items:center;overflow:visible;z-index:1000;pointer-events:none;padding:32px}.long-form-question-footer-container--mobile{background-color:#fff;border-top:1px solid #e6e6e6;padding:16px 24px}.long-form-question-footer-container-center{justify-content:center}.long-form-question-footer-container .long-form-question-footer-container-logo{width:auto;pointer-events:auto}.long-form-question-footer-container-center .long-form-question-footer-container-logo{margin-left:0}.long-form-question-footer-container .long-form-question-footer-container-actions{display:flex;gap:8px;pointer-events:auto}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button{display:flex;justify-content:center;align-items:center;gap:8px;padding:12px;border-radius:8px;height:40px;width:40px}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button .long-form-button-text-container{display:flex;align-items:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email,.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{display:flex;flex:1 1 auto;min-height:0;flex-direction:column;z-index:2;height:fit-content}.sprig-border-bottom{border-bottom:1px solid rgba(0,0,0,.1)}.sprig-border-top{border-top:1px solid rgba(0,0,0,.1)}.question-header-container{z-index:1}.sprig-header-container{padding:16px}.question-header-button-container{display:grid;grid-template-columns:97fr 3fr;align-items:center;justify-content:space-between;width:100%;height:fit-content}.ul-card--thanks-content .question-header-button-container{justify-content:center}.sprig-question-body{padding:0 20px;min-height:0;flex-shrink:1;overflow:auto;position:relative;align-self:stretch;width:100%}.sprig-stretch{align-self:stretch}.ul-question{color:#343442;display:block;font-size:17px;line-height:125%;font-weight:500;cursor:default;text-align:start}.ul-question ol,.ul-question ul,.ul-caption ol,.ul-caption ul{margin-left:1em}.ul-caption{flex:1 0 auto;font-size:14px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:start;margin-top:4px}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.select-checkbox{height:16px;width:16px;display:flex;box-sizing:border-box;background-color:"transparent";align-items:center;justify-content:center;border-radius:4px;border:1px solid #b0b5b7;flex-shrink:0}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.footer{width:100%;margin-top:12px;font-size:12px;line-height:12px;color:#000000b3}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{align-self:center;box-shadow:unset;border-radius:unset;border:none!important;position:unset;width:100%}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center;align-self:stretch}.sprig-accordion{width:100%;margin-bottom:8px}.sprig-accordion-body{width:100%;overflow:hidden}.sprig-accordion-header-container{background:transparent;border:none;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;cursor:pointer;margin:8px 0 0;padding:0;font-family:inherit}.sprig-header-label-container{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;flex:1 1 0}.sprig-header-label{color:#343442;font-size:15px;font-weight:590;line-height:21px;text-align:start;overflow:hidden}.sprig-check-background{flex:0 0 16px;height:16px;width:16px;border-radius:8px;margin-right:8px;background-color:#efefee;display:flex;align-items:center;justify-content:center}.sprig-check{height:9px;width:9px;margin-left:-1px}.sprig-check path{stroke:#506067;stroke-width:1.5}.sprig-caret{height:20px;width:20px;transition-property:transform}.sprig-caret path{stroke:#000}.ul-card-longform__submit-button-container{display:flex;justify-content:flex-end}.ul-card-longform__submit-button-container .ul-card-longform__submit-button{display:flex;flex-direction:row;align-items:center;white-space:nowrap;gap:4px;border-radius:8px;color:#fff;cursor:pointer}.ul-card-longform__submit-button-container .ul-card-longform__submit-button:disabled{opacity:.5;cursor:not-allowed}.ul-card-list-container--longform{display:flex;flex-direction:column;gap:2rem;width:100%;align-items:center;padding-block-start:calc(40vh - 100px);padding-block-end:calc(50vh - 100px);height:auto}@media (min-height: 1200px){.ul-card-list-container--longform{padding-block-start:calc(50vh - 100px)}}.ul-card-scroll-wrapper{width:100%;max-width:100vw;position:relative;display:flex;justify-content:center}.ul-card--unfocused{opacity:.3;transition:opacity .3s ease-in-out}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:#00000003;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:#fff}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.ul-card--likert__numbers>button{padding:unset}.likert-number--mobile{border:2px solid #e6e6e6}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px;background:unset;border:unset}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px;background:unset;border:unset}.likert-smiley>svg{margin:0 auto}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels>span:last-child{margin-left:auto;flex:1 1 auto;min-width:0;text-align:right}.ul-card--matrix_grid{display:grid;grid-template-columns:max-content repeat(var(--numColumns),minmax(107px,1fr));grid-template-rows:repeat(var(--numRows),min-content);margin:0 auto;row-gap:4px;width:max-content}.ul-card--matrix_grid_longform{width:100%}.ul-matrix-row-options{display:grid;grid-column:2/-1;grid-template-columns:subgrid}.ul-matrix-column-label{font-size:15px;max-width:150px;padding:10px 12px;text-align:center}.ul-card--matrix_container{margin-bottom:16px;overflow:auto}.ul-card--matrix_question_container{display:flex;flex-direction:column}.ul-matrix-scroll-gradient{-webkit-mask-image:linear-gradient(90deg,#000 90%,transparent);mask-image:linear-gradient(90deg,#000 90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl){-webkit-mask-image:linear-gradient(270deg,#000,90%,transparent);mask-image:linear-gradient(270deg,#000,90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl)+.ul-matrix-scroll-arrow{rotate:180deg}.ul-matrix-scroll-arrow{align-self:flex-end;background:none;border:none;color:#000;padding:0;position:absolute;top:45%}.ul-matrix-scroll-arrow:hover{cursor:pointer}.ul-matrix-option-wrapper{align-items:center;background:#f9f9f8;display:flex;justify-content:center;padding:10px 12px}.ul-matrix-last-option{border-start-end-radius:4px;border-end-end-radius:4px}.ul-matrix-row-label{align-items:center;background:#f9f9f8;border-end-start-radius:4px;border-start-start-radius:4px;display:flex;font-size:15px;left:0;right:0;max-width:200px;min-width:100px;padding:10px 12px;position:sticky}.ul-matrix-option-selected{border:6px solid var(--border);box-shadow:none}.ul-card__matrix{max-width:100%}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px;padding:unset}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card-rank__labels{font-size:14px;font-style:normal;font-weight:600;line-height:150%}.ul-card--rank__question-inner-container{padding:0 16px}.ul-card-rank__list{list-style-type:none;padding-inline-start:0;margin:4px 0}.ul-card-rank__option{display:flex;align-items:center;padding:8px;gap:8px;align-self:stretch;border:1px solid #e2e3e1;border-radius:8px;margin-bottom:4px}.ul-card-rank__option:last-child{margin-bottom:0}.ul-card-rank__drag-btn{display:inline-flex;align-items:center;justify-content:center;line-height:0;padding:0;width:25px;height:25px;margin-left:auto;color:#0b2330;cursor:grab;background:transparent;border:0}.ul-card-rank__drag-btn:active,.ul-card-rank__option:active{cursor:grabbing}.ul-card-rank__option svg{display:block}.ul-card-rank__option.is-dragging{opacity:1;box-shadow:0 8px 25px #00000026,0 3px 10px #0000001a;z-index:1000;background:#fff;border-color:#0b2330}.ul-card-rank__option.is-drop-target{background:#0b23301a;border-radius:8px;border-color:#0b23301a}.ul-card-rank__option.is-drop-target select,.ul-card-rank__option.is-drop-target span,.ul-card-rank__option.is-drop-target button{visibility:hidden}.ul-card-rank__option span{font-size:14px;font-weight:400}.ul-card-rank__select{appearance:none;-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;height:25px;min-height:25px;border:1px solid #E2E3E1;border-radius:4px;font-size:14px;line-height:1.4;padding:2px 28px 2px 8px;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='13' viewBox='0 0 12 13' fill='none'><path d='M9.75 5L6 8.75L2.25 5' stroke='%230B2330' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 8px center;background-size:12px 12px;background-color:#fff;cursor:pointer}.ul-card-rank__select.ul-card-rank__select--placeholder{color:#b0b5b7}.ul-card-text{margin-top:2px;margin-bottom:3px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#00000003;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:-webkit-fill-available}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#fff;border-radius:5px;text-align:start;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center;flex-direction:column}.select-button{align-items:center;background-color:transparent;border-radius:8px;border:1px solid #0b2330;box-shadow:0 0 0 2px #c8cccc;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:16px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}form{margin-block-end:0;margin-block-start:0}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;margin-top:auto;flex-grow:0;width:100%;min-height:10px;height:fit-content;flex-shrink:0}.ul-footer>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:#00000003;border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.ul-footer .thank-you-card-link:hover{background:#00000008}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:#f9c600;border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%;height:0}.close-btn{cursor:pointer;height:16px;margin-inline-end:-10px;position:relative;top:-10px;width:16px;z-index:1;align-self:flex-start;justify-self:end;flex-shrink:0}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}.ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px}.ul-progress-bar-container__footer{max-width:250px;margin:16px 0}.ul-progress-bar-container__header{position:fixed;top:80px;max-width:unset;margin:0;z-index:3}.ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{align-self:stretch;background:#00000003;border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:0;height:fit-content;line-height:16.5px;margin:0 20px;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}`}),e.customStyles&&G.setSurveyStyles({document:u,elementId:"ul-custom-style",styleString:e.customStyles,nonce:e.styleNonce}),e.fontFamily&&s&&parent){const x=u.createElement("link");x.rel="stylesheet",x.href=s,y.appendChild(x)}if(!p&&e.cards.some(x=>x.type==="recordedtask")){const x=u.createElement("script");x.src=e.upchunkLibraryURL??"https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{Ve.setUpChunk(m.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},y.appendChild(x)}const _=i||((k=d.eventEmitter)==null?void 0:k.emit);_==null||_("verify.view.version",{"view.version":"2.34.2"}),c&&t&&(Te(a(Ei,{}),c),H.eventEmitter.once(H.SprigEvent.SurveyClosed,()=>{It(c)}))}};exports.default=Ti;
|
|
669
|
+
`}],qr="-video-player",bn="-secondary-video-player",yn="-video-recorder";let de,xn;const ye=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=O.document.documentElement;if(!r||!o)return;const d={event:`SDK - ${e}`,visitorId:r,environmentId:o,metadata:{...i||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},he=async(e,t,n,r,o,i)=>{ye({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=O.document.documentElement,d={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:d,vid:o,envId:i};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},Fr=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(((o,{type:i,content:s})=>new Promise(function(d,l){let u;i==="script"?(u=O.document.createElement("script"),u.src=s):i==="link"?(u=O.document.createElement("link"),u.rel="stylesheet",u.href=s,u.type="text/css"):(u=O.document.createElement("style"),u.innerHTML=s),u.onload=function(){d(s)},u.onerror=function(){l(s)},u.async=!1,u.id=btoa(s),o.appendChild(u)}))(O.document.head,r)),n),[])).then(()=>{O.videojs=O.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},kn=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=ne;else if(t==="success")e.style.visibility=ne,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},dt=(e,t)=>{const n=O.videojs(e.id());return n==null?void 0:n.payload[t]},Ar=(e,t)=>{const n=new(O.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),vi(n),n},vi=e=>{e.children().forEach(t=>{if(ae[t.name_]){const n=Ae(ae[t.name_],`ul-${ae[t.name_]}`);t.el_.appendChild(n)}})},Ae=(e,t="")=>{const n=O.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},Vr=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(O.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(O.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const d=n&&n.src?xi(n.src):null;!n||!o&&d?(e.audioPlayerPlaceholder.hide(),O.document.getElementById(`${e.id()}_html5_api`).style.height="100%",d&&e.poster(d)):(e.children()[0].classList.add("vjs-hidden"),O.document.getElementById(`${e.id()}_html5_api`).style.height="0px"),e.on("play",()=>{o||!n||d||bi(e),i==null||i.play()}),e.on("pause",()=>{i==null||i.pause()}),e.on("seeked",()=>{i==null||i.currentTime(e.currentTime())}),e.on("ratechange",()=>{i==null||i.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),s.addChild(t),e.addChild(s),r&&r(e)},_i=(e,t,n,r,o,i,s,d=!1)=>{xn=Date.now();const l=Qe(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!l)return;l.payload=n;const{surveyId:u,questionId:m,responseGroupUid:c,visitorId:p,envId:v}=n;let h;const y=C=>{const f=at,b=at+"-audio-only";kn(l.uploadProgressLabel,"none"),de&&de.startTime>=xn&&de.abort();const j=O.document.getElementById("ul-camera-button");C?(l.children()[0].classList.add("vjs-hidden"),L.removeClass(f),L.addClass(b),j.innerHTML=ae.TurnOnCamera,l.audioPlayerPlaceholder.removeClass("vjs-hidden"),h==null||h.getTracks().forEach(R=>{R.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(R=>{h=R,R.getVideoTracks().forEach(E=>{E.enabled=!1}),l.record().onDeviceReady(R)}).catch(l.record().onDeviceError.bind(l.record()))):(h==null||h.getVideoTracks().forEach(R=>{R.enabled=!0}),l.children()[0].classList.remove("vjs-hidden"),l.record().getDevice(),L.removeClass(b),L.addClass(f),j.innerHTML=ae.TurnOffCamera,l.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{_.hasClass(ne)||(ye({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:p,envId:v,metadata:{questionId:m,responseGroupUid:c,surveyId:u}}),y(l.cameraOff),o(A.DELETE,{}),L.removeClass(ne),_.addClass(ne))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(Ae(ae.DeleteButton,"ul-delete-button"));const k=O.document.getElementById(t),x=()=>{k.classList.contains("vjs-fullscreen")&&l.cameraOff?k.style.display="table":k.style.display="flex"};x();const L=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{l.record().isRecording()||(l.cameraOff=!l.cameraOff,ye({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:m,responseGroupUid:c,surveyId:u,cameraOff:l.cameraOff}}),y(l.cameraOff),!_.hasClass(ne)&&_.addClass(ne),o(A.DELETE,{}),x())}});L.addClass(at),L.el_.appendChild(Ae(ae.TurnOffCamera,"ul-camera-button"));const I=new(O.videojs.getComponent("Button"))(l,{clickHandler:()=>{const C=O.document.getElementById("ul-recorder-toggle");if(l.record().isRecording())l.record().stop(),C&&(C.innerHTML=ae.RecordButton),I.removeClass(lt),_.removeClass(ne);else{const f=O.document.getElementById("ul-recording-countdown-screen");if(f)f.remove(),C&&(C.innerHTML=ae.RecordButton),y(l.cameraOff),o(A.DELETE,{}),L.removeClass(ne),_.addClass(ne),I.removeClass(lt),g.show();else{I.addClass(lt),g.hide(),L.addClass(ne),_.addClass(ne),C&&(C.innerHTML=ae.StopButton);const b=O.document.createElement("div");b.id="ul-recording-countdown-screen",k.insertBefore(b,k.children[1]),b.style.height=`${k.offsetHeight}px`,zr(l,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(Ae(ae.RecordButton,"ul-recorder-toggle"));const w=O.document.createElement("p");w.style.visibility="hidden",w.className="ul-upload-progress-label",e.appendChild(w),l.uploadProgressLabel=w;const S=Ar(l,[_,L,"PlayToggle",I,"FullscreenToggle"]),g=S.children().find(C=>C.name_==="FullscreenToggle");g.hasClass("vjs-disabled")&&g.hide();const D=S.children().find(C=>C.name_==="PlayToggle");D.hide(),_.addClass(ne),Vr(l,S,i,!1,d),l.on("stopRecord",()=>{I.hide(),D.show(),g.show(),_.removeClass(ne)}),l.on("deviceReady",()=>{I.show(),D.hide(),_.addClass(ne)}),((C,f,b,j,R)=>{const{surveyId:E,responseGroupUid:F,visitorId:N,envId:M}=C.payload;C.on("deviceError",function(){console.warn("device error: ",C.deviceErrorCode),C.deviceErrorCode.message==="Permission denied"?(C.deviceButton.addClass("permission-denied"),b&&b(A.ERROR,{type:A.PERMISSION_DENIED}),ye({event:"Video Permission Denied",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{questionId:dt(C,st),responseGroupUid:F,surveyId:E}})):(b&&b(A.ERROR,{type:A.OTHER}),he(new Error(C.deviceErrorCode.message),"recorderDeviceError",f,R,N,M))}),C.on("error",function($,U){he(U||C.error(),"recorderError",f,R,N,M)}),C.on("startRecord",function($,U){j(C.uploadProgressLabel,"none"),ye({event:"Video Record Start",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{questionId:dt(C,st),responseGroupUid:F,surveyId:E}})}),C.on("finishRecord",async function(){j(C.uploadProgressLabel,"start",0);const $=dt(C,st);if(!E){const J="internal error: missing fields in payload";return b&&b(A.ERROR,{type:A.OTHER}),he(new Error(J),"finishRecord",f,R,N,M),null}C.record().stopDevice();const U=C.cameraOff?A.MEDIA_TYPE_AUDIO:A.MEDIA_TYPE_VIDEO,V=H.v4();ye({event:"Video Record Finish",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U}});const re={surveyId:E,updatedAt:new Date().toISOString(),mediaType:U,mediaRecordingUid:V};$&&(re.questionId=$),F&&(re.responseGroupUid=F),N&&(re.visitorId=N);const oe=await(async()=>{const J=await fetch(`${f}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)});if(J.ok){const Y=await J.json();return b&&b(A.UPLOAD_STARTED,{[A.UPLOAD_ID]:Y.upload.id,[A.MEDIA_TYPE]:U,[A.MEDIA_RECORDING_UID]:V}),Y.upload.url}return b&&b(A.ERROR,{type:A.OTHER,response:J}),he(new Error("failed to get upload response with url"),"finishRecord",f,R,N,M),null})();oe&&(de=O.document.defaultView.UpChunk.createUpload({endpoint:oe,file:new O.document.defaultView.File([C.recordedData],`recording ${U} ${Date.now()}`),chunkSize:5120}),de.startTime=Date.now(),ye({event:"Video Upload Start",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U,url:oe}}),de.on("error",J=>{j(C.uploadProgressLabel,"none"),b&&b(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:V}),he(J,"finishRecord",f,R,N,M)}),de.on("progress",J=>{b&&b(A.UPLOAD_PROGRESS,{[A.MEDIA_RECORDING_UID]:V,[A.UPLOAD_PROGRESS_PCT]:J.detail}),j(C.uploadProgressLabel,"progress",J.detail)}),de.on("success",()=>{j(C.uploadProgressLabel,"success"),b&&b(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:V}),ye({event:"Video Upload Success",apiBase:f,headers:R,visitorId:N,envId:M,metadata:{mediaRecordingUid:V,questionId:$,responseGroupUid:F,surveyId:E,mediaType:U,url:oe,elapsedMs:de.startTime&&Date.now()-de.startTime}})}))})})(l,r,o,kn,s);const T=[{name:"microphone"}];!l.cameraOff&&T.push({name:"camera"}),Promise.all(T.map(C=>{var f;return(f=navigator==null?void 0:navigator.permissions)==null?void 0:f.query(C)})).then(C=>{C.reduce((f,b)=>f&b.state==="granted",!0)&&l&&(l.deviceButton&&l.deviceButton.hide(),l.record().getDevice())}).catch(C=>{})},zr=(e,t=3)=>{const n=O.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{zr(e,t-1)},1e3))},$r=e=>{const t=O.document.createElement("div");return t.className="ul-video-container",t.appendChild((n=>{const r=O.document.createElement("div");return r.className="ul-video-player-loading",r.id=Nt(n),["first","second","third","fourth"].map(o=>{const i=O.document.createElement("div");i.className=o,r.appendChild(i)}),r})(e)),t},bt=(e,t)=>{const n=O.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=O.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const o=O.document.createElement("a");return o.href="https://videojs.com/html5-video-support/",o.target="_blank",o.innerHTML="supports HTML5 video",r.appendChild(o),n.appendChild(r),t.appendChild(n),t},bi=(e,t)=>{e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),O.document.getElementById(`${e.id()}_html5_api`).style.height="100%"},Qe=(e,t)=>O.document.getElementById(e)?t?O.videojs(e,t):O.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),yi=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,d=null)=>{O.document=i;const l=e+qr,u=$r(l);return O.document.addEventListener("securitypolicyviolation",m=>{he(new Error(`Voice & Video feature violates ${m.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),Fr(Br,()=>{O.document.getElementById(Nt(l)).remove(),bt(l,u);const m={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=e+bn;bt(c,u);const p=Qe(l,m),v=Qe(c,{muted:!0,...m});if(!p||!v)return;((_,k,x)=>{_.addClass(`ul${bn}`);const L=new(O.videojs.getComponent("Component"))(_);k&&_.src(k),_.addChild(L),x&&x(_)})(v,s,d),s||v.addClass(ne);const h=Ar(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),y=h.children().find(_=>_.name_==="FullscreenToggle");y.hasClass("vjs-disabled")&&y.hide(),Vr(p,h,t,n,r,v)}catch(c){return void he(new Error(`Error when creating video player object ${c}`),"playerDeviceError",o,{})}}),u},xi=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(_n)&&(n=n.replace(_n,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},A={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},ae={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},ke="ul-card-video__player_recorder",wn="ul-video-btn",ct=0,Cn=1,ki=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:d,handleUploadUpdate:l,headers:u,responseGroupUid:m,surveyId:c,update:p,viewDocument:v,visitorId:h}=q(f=>({apiURL:f.apiURL,envId:f.envId,handleUploadUpdate:f.handleUploadUpdate,headers:f.headers,responseGroupUid:f.responseGroupUid,surveyId:f.surveyId,update:f.update,viewDocument:f.viewDocument,visitorId:f.userId})),[y,_]=z(!1),[k,x]=z(null),[L,I]=z(null),[w,S]=z(ct),g=ee(null),D=r&&r.videoUrl;Q(()=>{const f=g.current,b=new ResizeObserver(()=>{p()});return f&&b.observe(f),()=>{f&&b.unobserve(f)}},[p]);const T=(f,b)=>{f===A.UPLOAD_STARTED?(x(b[A.UPLOAD_ID]),I(b[A.MEDIA_RECORDING_UID]),_(!0)):f===A.DELETE?(x(null),I(null),_(!1)):f===A.UPLOAD_PROGRESS?isNaN(b[A.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],progressPct:b[A.UPLOAD_PROGRESS_PCT]}):f===A.UPLOAD_FINISHED&&l({mediaRecordingUid:b[A.MEDIA_RECORDING_UID],isComplete:!0})},C=f=>{f.preventDefault(),f.stopPropagation(),document.getElementById(ke)&&(b=>{const j=b+yn;if(O.document.getElementById(j)&&O.videojs){try{if(!O.videojs(j).record().stream)return}catch{return}O.videojs(j).record().stop(),O.videojs(j).record().stopDevice()}})(ke),k&&L?(l({mediaRecordingUid:L,isSubmitted:!0}),n({value:{mediaRecordingUid:L},questionId:o,type:i},!0)):n({value:null,questionId:o,type:i},!0)};return a("form",{className:B(e,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[a(se,{message:t,properties:r}),a(me,{children:[a("div",{id:"ul-question-player-container",ref:g,style:{display:w===ct?"":"none"},children:[a("div",{id:ke,ref:f=>{if(f&&f.children.length===0&&!r.hideRecordedPrompt){const b=yi(ke,{src:D,type:"application/x-mpegURL"},void 0,r.mediaType===A.MEDIA_TYPE_AUDIO,s,v);f.appendChild(b)}}}),a(pe,{defaultBody:()=>a("button",{className:`${wn} ul-record-response-btn`,onClick:f=>{f.preventDefault(),f.stopPropagation(),document.getElementById(ke)&&(b=>{const j=Qe(b+qr);j==null||j.pause()})(ke),S(Cn)}}),properties:r})]}),a("div",{style:{display:w===Cn?"block":"none"},children:[a("button",{className:`${wn} ul-back-question-btn`,onClick:f=>{f.preventDefault(),f.stopPropagation(),S(ct)},style:{display:r.hideRecordedPrompt?"none":"block"}}),a("div",{id:"ul-recorder-player-container",ref:f=>{if(f&&f.children.length===0){const b=((j,R={},E="https://api.userleap.com",F,N,M,$=!1,U=document)=>{O.document=U;const V=j+yn,re=$r(V);return O.document.addEventListener("securitypolicyviolation",oe=>{he(new Error(`Voice & Video feature violates ${oe.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",E,M,R.visitorId,R.envId)}),Fr(Br.concat(fi),()=>{bt(V,re),O.document.getElementById(Nt(V)).remove();try{_i(re,V,R,E,F,N,M,$)}catch(oe){return void he(new Error(`Error when creating video recorder player object ${oe}`),"recorderDeviceError",E,M,R.visitorId,R.envId)}}),re})(ke,{surveyId:c,responseGroupUid:m,questionId:o,visitorId:h,envId:d},s,T,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===A.MEDIA_TYPE_AUDIO,v);f.appendChild(b)}}})]})]}),a(_e,{children:[a(te,{disabled:!y,onClick:C,children:xe(r)}),a("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:C,style:{display:r.required?"none":"block",...y?{display:"none"}:{}},children:Dt(r)})]})]})},wi=({className:e})=>{const{uploadProgress:t}=q(i=>({uploadProgress:i.uploadProgress}));let n,r;Object.values(t).filter(i=>i.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(t).filter(i=>i.isSubmitted).map(i=>i.progressPct||0)));return a("div",{className:B(e,"ul-card--uploading","fade-in-transition"),children:[a("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:a("div",{className:"ul-loading-spinner",children:[a("div",{className:"first"}),a("div",{className:"second"}),a("div",{className:"third"}),a("div",{className:"fourth"})]})}),a(se,{message:`${n} (${o}% complete)`}),a("p",{className:"ul-caption",children:r})]})},Ci=()=>{var k;const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:o,marketingUrl:i,showSurveyBrand:s,slugName:d,surveyId:l,viewedCardCount:u}=q(x=>({border:x.border,cards:x.cards,forceBrandedLogo:x.forceBrandedLogo,headers:x.headers,index:x.index,marketingUrl:x.marketingUrl,showSurveyBrand:x.showSurveyBrand,slugName:x.slugName,surveyId:x.surveyId,viewedCardCount:x.viewedCardCount})),m=ee(null),c=t.filter(x=>x.type!=="uploading"&&x.type!=="thanks"),p=((x,L)=>{const I=new Set(["thanks","uploading"]);if(L>=x.length||L<0||I.has(x[L].type))return 0;const w=x.filter(g=>!I.has(g.type));if(L===w.length-1)return 1;const S={[w.length-1]:1,[-1]:0};for(let g=w.length-2;g>=L;g--){const D=w[g],T=To(g,D.props.routingOptions);if(T.length===0){S[g]=S[g+1]+1;continue}let C=0,f=Eo(D);if(f===null)return w.length-1-L;for(let b=0;b<T.length&&f.length!==0;b++){const{comparator:j,target:R,value:E}=T[b],F=f.filter(N=>{const M=So({value:N},D.type,N),$=vr(N,D.type);return!(M&&j==="answered"||$&&j==="partial"||!M&&!$&&j==="skipped"||j==="given_up"&&jo(N)&&N.taskStatus==="given.up"||M&&D.type==="open"&&(j==="contains"||j==="notcontains")||M&&Io(j)&&Tt[j](N,E))});if(F.length<f.length){const N=parseInt(String(R),10);if(N!==-1&&N<=g||N>=w.length)return w.length-1-L;C=Math.max(S[N]+1,C)}f=F}f.length>0&&(C=Math.max(S[g+1]+1,C)),S[g]=C}return S[L]})(t,o),v=u+1,h=v/(v+p),y=jr({marketingUrl:i,slugName:d,surveyId:l,forceBrandedLogo:n});Q(()=>{m.current&&(m.current.style.width=100*h+"%")},[h]);const _=((k=t[o])==null?void 0:k.type)==="thanks";return a("footer",{className:"ul-footer "+(r["userleap-platform"]==="link"?"ul-footer__link":""),children:_&&n?a(Ir,{marketingUrlLink:y}):a(K,{children:[c.length>1&&a("div",{className:"ul-progress-bar-container ul-progress-bar-container__footer",children:a("div",{className:"ul-progress-bar-current",ref:m,style:{border:`1px solid ${e||"#000"}`}})}),s?a(Er,{forceBrandedLogo:n,marketingUrlLink:y}):null]})})},Si=()=>{const e=q(s=>s.border),t=q(s=>s.cards),n=q(s=>s.index),r=q(s=>s.focusedQuestionId),{totalQuestions:o,fraction:i}=ue(()=>{var u;const s=t.filter(m=>m.type!=="uploading"&&m.type!=="thanks"),d=s.length;if(d<=1)return{totalQuestions:d,fraction:0};if(((u=t[n])==null?void 0:u.type)==="thanks")return{totalQuestions:d,fraction:1};const l=s.findIndex(m=>m.name===r);return{totalQuestions:d,fraction:(l>=0?l:0)/d}},[t,n,r]);return o<=1?null:a("div",{className:"ul-progress-bar-container ul-progress-bar-container__header",children:a("div",{className:"ul-progress-bar-current",style:{width:100*i+"%",border:`1px solid ${e??"#000"}`}})})},Ei=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:d,fontFamily:l,headers:u,index:m,minScrollableHeight:c,next:p,previewMode:v,productConfig:h,seen:y,showStripes:_,studyType:k,surveyId:x,update:L,useMobileStyling:I,viewDocument:w}=q(E=>({answers:E.answers,border:E.border,cards:E.cards,close:E.close,configureExitOnOverlayClick:E.configureExitOnOverlayClick,destroy:E.destroy,endCard:E.endCard,eventEmitFn:E.eventEmitFn,fontFamily:E.fontFamily,headers:E.headers,index:E.index,previewMode:E.previewMode,productConfig:E.productConfig,minScrollableHeight:E.minScrollableHeight,next:E.next,seen:E.seen,showStripes:E.showStripes,studyType:E.studyType,surveyId:E.surveyId,update:E.update,useMobileStyling:E.useMobileStyling,viewDocument:E.viewDocument})),S=ee(null),g=ee(!1),D=u["userleap-platform"],{props:T,type:C,name:f}=n[m];Q(()=>{if(window.Sprig)return window.Sprig.trackHistory=E=>q.getState().trackHistory(E),()=>{window.Sprig.trackHistory=void 0}},[]),Q(()=>{S.current&&(S.current.classList.contains("ul-app--visible")||S.current.classList.add("ul-app--visible"),!g.current&&d&&(g.current=!0,d(H.SprigEvent.SurveyAppeared,{name:H.SprigEvent.SurveyAppeared,"survey.id":x})))},[d,x]),Q(()=>{const E=()=>{w.visibilityState==="visible"&&(y(),w.removeEventListener("visibilitychange",E))};return w.addEventListener("visibilitychange",E),E(),()=>{w.removeEventListener("visibilitychange",E)}},[y,w]),Q(()=>{L()},[m,L]),Q(()=>{o(()=>r())},[r,o]);const b=ue(()=>H.groupCards(n,m),[n,m]),j=Se(E=>{p({data:E,completeSurvey:()=>i(G.APP_ID),endCard:s}),G.resetScrollPosition(w)},[p,i,s,w]);if(e){for(const E of e)if(E.questionId===f){let F;if(C==="multiplechoice"){const N=T.options.find(({value:M})=>M===E.value);if(!N)break;F={[N.id]:N.value}}else F=E.value;j({value:F,type:C,questionId:E.questionId});break}}const R=!I&&((h==null?void 0:h.framePosition)==="center"||(h==null?void 0:h.desktopDisplay)==="center-modal"||((h==null?void 0:h.placement)||"").includes("center"));return a("div",{className:B("ul-app",H.shouldDirectEmbed(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:G.APP_ID,onClick:E=>{var $;const F=window.sprigAPI,N=E.target;if(!F||!N)return;const M=[N,N.parentElement];for(const U of M)if((($=U==null?void 0:U.tagName)==null?void 0:$.toLowerCase())==="a"){E.preventDefault();try{const V=new URL(U.href);V.protocol!=="http:"&&V.protocol!=="https:"||(F==null||F.openUrl(V.toString()))}catch(V){console.error(V)}return}},ref:S,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{},...R?{position:"relative"}:{}},children:a("div",{className:"ul-app__container",children:a("div",{className:B(X("ul-card__container",I,k)),style:{...k!=="feedbackButton"||(h==null?void 0:h.desktopDisplay)==="center-modal"?{borderColor:t}:{},...(h==null?void 0:h.desktopDisplay)==="slider"?{margin:"0px"}:{}},children:a("div",{className:"sprig-container",style:{minHeight:c},children:[_&&a("div",{className:"ul-header__container",dir:"ltr",children:a("div",{className:"ul-header",children:"For development purposes only"})}),v&&a("div",{className:"ul-header__container",dir:"ltr",children:a("div",{className:"ul-header",children:"Preview Mode: Response will not be recorded."})}),H.isLongFormSurvey(k)&&a(Si,{}),a("div",{className:B(Ro("ul-card-main-content",D)),children:a(ri,{cards:b,next:j})}),!H.isLongFormSurvey(k)&&a(Ci,{})]})})})})},Wr=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",Sn=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Wr()};return new MediaRecorder(e,t)},En=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function In(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{"begin.callback":s}=r,d=e.currentMediaRecordingUid;if(!d)return;s&&s(d),e.onstop=()=>async function(l,u,m,c,p,v,h){const y=q.getState().viewDocument,{"upload.callback":_,"progress.callback":k}=c,x={mediaType:m,updatedAt:new Date().toISOString(),mediaRecordingUid:p,...c["passthrough.data"]},L=await(async(g,D)=>{var C;const T=await fetch(D,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(T.ok){const f=await T.json();return(C=f==null?void 0:f.upload)==null?void 0:C.url}return null})(x,l);if(!L)return void(_&&_(null,{message:"failed to get upload url"}));const I=new Blob(h,{type:Wr()});if(!y.defaultView)return;const w=new y.defaultView.File([I],`recording video ${Date.now()}`),S=v.createUpload({endpoint:L,file:w,chunkSize:5120});S.on("error",g=>{_&&_(null,g)}),S.on("progress",g=>{k&&k(p,g)}),S.on("success",()=>{_&&_(p,!0)})}(t,0,n,r,d,o,i),e.stop()}}const Ii={state:{chunks:{}},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?"video":"audio";this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&In(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&In(r,t,"screen",e,o,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(o=>{o&&(o.state==="recording"&&o.stop(),o.stream.getTracks().map(i=>{i.readyState==="live"&&i.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on("permission.status",this.permissionStatusCallback.bind(this)),e.on("av.permission",async n=>{this.avPermissionCallback(n)}),e.on("begin.recording",this.beginRecordingCallback.bind(this)),e.on("start.task",this.startTaskCallback.bind(this)),e.on("screen.permission",async n=>{this.screenPermissionCallback(n)}),e.on("finish.task",async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{"stream.ready":t,"permission.descriptors":n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(s=>s.readyState==="live"&&s.stop()),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes("camera"),audio:!0}),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(s){return console.warn("Error: failed to get permissions: "+s),void(t&&t(null,null))}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{"screen.permission.requested":t,"stream.ready.callback":n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){return t==null||t(!1),console.warn("Error: failed to get permissions: "+r),void(n&&n(null,null))}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{"recording.media.types":t,"start.recording.callback":n=()=>{}}=e;if(!t)return;const r=[];if(t.includes("video")&&this.state.avStream){this.state.avRecorder=Sn(this.state.avStream);const o=H.v4();En(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes("screen")&&this.state.captureStream){this.state.screenRecorder=Sn(this.state.captureStream);const o=H.v4();En(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{"current.index":t,"task.response":n,"task.complete.callback":r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{"permission.status.callback":t}=e,n=this.state.avStream;t&&t(n,!!n&&(n==null?void 0:n.getVideoTracks().length)>0,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,{allResponses:s}=q.getState(),d=_r({cards:n,index:e,hasEndCard:r,allResponses:s});d!==null&&n[d].type==="recordedtask"||[o,i].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},Ve=Object.create(Ii);Object.freeze(Ve);const ji=({mode:e=null,viewWindow:t,viewDocument:n,trackPageViewUrl:r})=>{const o=n.documentElement;let i;try{i=t.parent.location.href}catch{i=t.location.href}return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:o.clientWidth,ch:o.clientHeight,p:r??i,l:t.navigator.language}},Ti={configure:function(e,t=!0){var k;const{answers:n,apiURL:r,endCard:o,eventEmitFn:i,fontFamilyURL:s,frame:d,previewKey:l,viewDocument:u,viewWindow:m}=e,c=H.shouldDirectEmbed(e.headers)?e.frame:u.body,p=e.UpChunk||window.UpChunk,v=H.eventEmitter,h=((x,L)=>{const I=[...x],w=new Set(["videovoice","recordedtask"]);return x.some(S=>w.has(S.type))&&I.push({name:-2,props:{routingOptions:[]},type:"uploading"}),L&&I.push({name:-1,props:{routingOptions:[]},type:"thanks"}),I})(e.cards,!!o);Ve.configure(v,{cards:h,hasEndCard:!!o,apiURL:r,UpChunk:p}),q.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:i,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:d,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:ji({mode:e.mode,viewWindow:m,viewDocument:u,trackPageViewUrl:e.trackPageViewUrl}),mode:e.mode,previewKey:l,previewMode:e.previewMode,productConfig:e.productConfig,recorder:Ve,recorderEventEmitter:v,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,studyType:e.studyType,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{head:y}=u;if(G.setSurveyStyles({document:u,elementId:"sprig-style",styleString:`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-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}}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;min-width:200px;justify-content:center;animation:enable-transitions 0s .3s forwards;min-height:0}@keyframes enable-transitions{to{transition:opacity .2s ease-in-out}}.ul-focus-transitions-active .ul-card,.ul-card--with-transitions{transition:opacity .2s ease-in-out}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026;margin:15px}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container--desktop_longFormSurvey,.ul-card__container--mobile_longFormSurvey{margin:0}.sprig-container{display:flex;flex-direction:column;width:100%;height:fit-content;flex:1 1 auto;min-height:0;justify-content:center}.ul-card__container{background:#fff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;padding:0;min-height:0;position:relative;text-align:center;word-break:normal;overflow:auto}.ul-card__container--desktop_feedbackButton{box-shadow:unset}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:center;align-self:stretch}.sprig-question-footer-container{align-items:center;width:100%;height:fit-content;display:flex;flex-direction:column;padding:12px 20px 0}.long-form-question-footer-container{position:fixed;bottom:0;left:0;width:100%;display:flex;justify-content:space-between;align-items:center;overflow:visible;z-index:1000;pointer-events:none;padding:32px}.long-form-question-footer-container--mobile{background-color:#fff;border-top:1px solid #e6e6e6;padding:16px 24px}.long-form-question-footer-container-center{justify-content:center}.long-form-question-footer-container .long-form-question-footer-container-logo{width:auto;pointer-events:auto}.long-form-question-footer-container-center .long-form-question-footer-container-logo{margin-left:0}.long-form-question-footer-container .long-form-question-footer-container-actions{display:flex;gap:8px;pointer-events:auto}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button{display:flex;justify-content:center;align-items:center;gap:8px;padding:12px;border-radius:8px;height:40px;width:40px}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button .long-form-button-text-container{display:flex;align-items:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email,.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{display:flex;flex:1 1 auto;min-height:0;flex-direction:column;z-index:2;height:fit-content}.sprig-border-bottom{border-bottom:1px solid rgba(0,0,0,.1)}.sprig-border-top{border-top:1px solid rgba(0,0,0,.1)}.question-header-container{z-index:1}.sprig-header-container{padding:16px}.question-header-button-container{display:grid;grid-template-columns:97fr 3fr;align-items:center;justify-content:space-between;width:100%;height:fit-content}.ul-card--thanks-content .question-header-button-container{justify-content:center}.sprig-question-body{padding:0 20px;min-height:0;flex-shrink:1;overflow:auto;position:relative;align-self:stretch;width:100%}.sprig-stretch{align-self:stretch}.ul-question{color:#343442;display:block;font-size:17px;line-height:125%;font-weight:500;cursor:default;text-align:start}.ul-question ol,.ul-question ul,.ul-caption ol,.ul-caption ul{margin-left:1em}.ul-caption{flex:1 0 auto;font-size:14px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:start;margin-top:4px}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.select-checkbox{height:16px;width:16px;display:flex;box-sizing:border-box;background-color:"transparent";align-items:center;justify-content:center;border-radius:4px;border:1px solid #b0b5b7;flex-shrink:0}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.footer{width:100%;margin-top:12px;font-size:12px;line-height:12px;color:#000000b3}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{align-self:center;box-shadow:unset;border-radius:unset;border:none!important;position:unset;width:100%}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center;align-self:stretch}.sprig-accordion{width:100%;margin-bottom:8px}.sprig-accordion-body{width:100%;overflow:hidden}.sprig-accordion-header-container{background:transparent;border:none;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;cursor:pointer;margin:8px 0 0;padding:0;font-family:inherit}.sprig-header-label-container{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;flex:1 1 0}.sprig-header-label{color:#343442;font-size:15px;font-weight:590;line-height:21px;text-align:start;overflow:hidden}.sprig-check-background{flex:0 0 16px;height:16px;width:16px;border-radius:8px;margin-right:8px;background-color:#efefee;display:flex;align-items:center;justify-content:center}.sprig-check{height:9px;width:9px;margin-left:-1px}.sprig-check path{stroke:#506067;stroke-width:1.5}.sprig-caret{height:20px;width:20px;transition-property:transform}.sprig-caret path{stroke:#000}.ul-card-longform__submit-button-container{display:flex;justify-content:flex-end}.ul-card-longform__submit-button-container .ul-card-longform__submit-button{display:flex;flex-direction:row;align-items:center;white-space:nowrap;gap:4px;border-radius:8px;color:#fff;cursor:pointer}.ul-card-longform__submit-button-container .ul-card-longform__submit-button:disabled{opacity:.5;cursor:not-allowed}.ul-card-list-container--longform{display:flex;flex-direction:column;gap:2rem;width:100%;align-items:center;padding-block-start:calc(40vh - 100px);padding-block-end:calc(50vh - 100px);height:auto}@media (min-height: 1200px){.ul-card-list-container--longform{padding-block-start:calc(50vh - 100px)}}.ul-card-scroll-wrapper{width:100%;max-width:100vw;position:relative;display:flex;justify-content:center}.ul-card--unfocused{opacity:.3;transition:opacity .3s ease-in-out}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:#00000003;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:#fff}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.ul-card--likert__numbers>button{padding:unset}.likert-number--mobile{border:2px solid #e6e6e6}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px;background:unset;border:unset}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px;background:unset;border:unset}.likert-smiley>svg{margin:0 auto}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels>span:last-child{margin-left:auto;flex:1 1 auto;min-width:0;text-align:right}.ul-card--matrix_grid{display:grid;grid-template-columns:max-content repeat(var(--numColumns),minmax(107px,1fr));grid-template-rows:repeat(var(--numRows),min-content);margin:0 auto;row-gap:4px;width:max-content}.ul-card--matrix_grid_longform{width:100%}.ul-matrix-row-options{display:grid;grid-column:2/-1;grid-template-columns:subgrid}.ul-matrix-column-label{font-size:15px;max-width:150px;padding:10px 12px;text-align:center}.ul-card--matrix_container{margin-bottom:16px;overflow:auto}.ul-card--matrix_question_container{display:flex;flex-direction:column}.ul-matrix-scroll-gradient{-webkit-mask-image:linear-gradient(90deg,#000 90%,transparent);mask-image:linear-gradient(90deg,#000 90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl){-webkit-mask-image:linear-gradient(270deg,#000,90%,transparent);mask-image:linear-gradient(270deg,#000,90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl)+.ul-matrix-scroll-arrow{rotate:180deg}.ul-matrix-scroll-arrow{align-self:flex-end;background:none;border:none;color:#000;padding:0;position:absolute;top:45%}.ul-matrix-scroll-arrow:hover{cursor:pointer}.ul-matrix-option-wrapper{align-items:center;background:#f9f9f8;display:flex;justify-content:center;padding:10px 12px}.ul-matrix-last-option{border-start-end-radius:4px;border-end-end-radius:4px}.ul-matrix-row-label{align-items:center;background:#f9f9f8;border-end-start-radius:4px;border-start-start-radius:4px;display:flex;font-size:15px;left:0;right:0;max-width:200px;min-width:100px;padding:10px 12px;position:sticky}.ul-matrix-option-selected{border:6px solid var(--border);box-shadow:none}.ul-card__matrix{max-width:100%}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px;padding:unset}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card-rank__labels{font-size:14px;font-style:normal;font-weight:600;line-height:150%}.ul-card--rank__question-inner-container{padding:0 16px}.ul-card-rank__list{list-style-type:none;padding-inline-start:0;margin:4px 0}.ul-card-rank__option{display:flex;align-items:center;padding:8px;gap:8px;align-self:stretch;border:1px solid #e2e3e1;border-radius:8px;margin-bottom:4px}.ul-card-rank__option:last-child{margin-bottom:0}.ul-card-rank__drag-btn{display:inline-flex;align-items:center;justify-content:center;line-height:0;padding:0;width:25px;height:25px;margin-left:auto;color:#0b2330;cursor:grab;background:transparent;border:0}.ul-card-rank__drag-btn:active,.ul-card-rank__option:active{cursor:grabbing}.ul-card-rank__option svg{display:block}.ul-card-rank__option.is-dragging{opacity:1;box-shadow:0 8px 25px #00000026,0 3px 10px #0000001a;z-index:1000;background:#fff;border-color:#0b2330}.ul-card-rank__option.is-drop-target{background:#0b23301a;border-radius:8px;border-color:#0b23301a}.ul-card-rank__option.is-drop-target select,.ul-card-rank__option.is-drop-target span,.ul-card-rank__option.is-drop-target button{visibility:hidden}.ul-card-rank__option span{font-size:14px;font-weight:400}.ul-card-rank__select{appearance:none;-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;height:25px;min-height:25px;border:1px solid #E2E3E1;border-radius:4px;font-size:14px;line-height:1.4;padding:2px 28px 2px 8px;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='13' viewBox='0 0 12 13' fill='none'><path d='M9.75 5L6 8.75L2.25 5' stroke='%230B2330' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 8px center;background-size:12px 12px;background-color:#fff;cursor:pointer}.ul-card-rank__select.ul-card-rank__select--placeholder{color:#b0b5b7}.ul-card-text{margin-top:2px;margin-bottom:3px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#00000003;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:-webkit-fill-available}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#fff;border-radius:5px;text-align:start;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center;flex-direction:column}.select-button{align-items:center;background-color:transparent;border-radius:8px;border:1px solid #0b2330;box-shadow:0 0 0 2px #c8cccc;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:16px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}form{margin-block-end:0;margin-block-start:0}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;margin-top:auto;flex-grow:0;width:100%;min-height:10px;height:fit-content;flex-shrink:0}.ul-footer>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:#00000003;border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.ul-footer .thank-you-card-link:hover{background:#00000008}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:#f9c600;border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%;height:0}.close-btn{cursor:pointer;height:16px;margin-inline-end:-10px;position:relative;top:-10px;width:16px;z-index:1;align-self:flex-start;justify-self:end;flex-shrink:0}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}.ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px}.ul-progress-bar-container__footer{max-width:250px;margin:16px 0}.ul-progress-bar-container__header{position:fixed;top:80px;max-width:unset;margin:0;z-index:3}.ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{align-self:stretch;background:#00000003;border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:0;height:fit-content;line-height:16.5px;margin:0 20px;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}`}),e.customStyles&&G.setSurveyStyles({document:u,elementId:"ul-custom-style",styleString:e.customStyles,nonce:e.styleNonce}),e.fontFamily&&s&&parent){const x=u.createElement("link");x.rel="stylesheet",x.href=s,y.appendChild(x)}if(!p&&e.cards.some(x=>x.type==="recordedtask")){const x=u.createElement("script");x.src=e.upchunkLibraryURL??"https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{Ve.setUpChunk(m.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},y.appendChild(x)}const _=i||((k=d.eventEmitter)==null?void 0:k.emit);_==null||_("verify.view.version",{"view.version":"2.35.0"}),c&&t&&(Te(a(Ei,{}),c),H.eventEmitter.once(H.SprigEvent.SurveyClosed,()=>{It(c)}))}};exports.default=Ti;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as je, D as ro, a as oo, C as Ft, i as io, E as so, b as Pe, d as Et, r as ao, e as Vt } from "./core-
|
|
2
|
-
import { e as Re, h as We, S as ie, s as gt, D as zt, b as lo, t as re, v as ft, u as co } from "./metricsReporter-
|
|
1
|
+
import { A as je, D as ro, a as oo, C as Ft, i as io, E as so, b as Pe, d as Et, r as ao, e as Vt } from "./core-De2JxeSJ.js";
|
|
2
|
+
import { e as Re, h as We, S as ie, s as gt, D as zt, b as lo, t as re, v as ft, u as co } from "./metricsReporter-BJVpNufn.js";
|
|
3
3
|
var He, P, Hn, we, $t, Bn, vt, qn, Ue = {}, An = [], uo = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Je = Array.isArray;
|
|
4
4
|
function ge(e, t) {
|
|
5
5
|
for (var n in t) e[n] = t[n];
|
|
@@ -2970,7 +2970,7 @@ const $i = ({ mode: e = null, viewWindow: t, viewDocument: n, trackPageViewUrl:
|
|
|
2970
2970
|
}, y.appendChild(x);
|
|
2971
2971
|
}
|
|
2972
2972
|
const _ = i || ((k = d.eventEmitter) == null ? void 0 : k.emit);
|
|
2973
|
-
_ == null || _("verify.view.version", { "view.version": "2.
|
|
2973
|
+
_ == null || _("verify.view.version", { "view.version": "2.35.0" }), c && t && (Le(a(Vi, {}), c), Re.once(ie.SurveyClosed, () => {
|
|
2974
2974
|
Rt(c);
|
|
2975
2975
|
}));
|
|
2976
2976
|
} };
|
package/package.json
CHANGED