@sprig-technologies/sprig-browser 2.22.4 → 2.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -10
- package/dist/index.d.ts +187 -3
- package/dist/index.js +4068 -2417
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"use strict";var gi=Object.defineProperty;var vi=(e,t,n)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t,n)=>(vi(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var he=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(he||{}),j=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",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.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e))(j||{}),br=(e=>(e.SurveyId="survey.id",e))(br||{});const mn={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_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",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"}};var oe=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(oe||{}),Me=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Me||{});let mt;const wi=new Uint8Array(16);function _i(){if(!mt&&(mt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!mt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mt(wi)}const K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function yi(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+"-"+K[e[t+4]]+K[e[t+5]]+"-"+K[e[t+6]]+K[e[t+7]]+"-"+K[e[t+8]]+K[e[t+9]]+"-"+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}const bi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Dn={randomUUID:bi};function Be(e,t,n){if(Dn.randomUUID&&!t&&!e)return Dn.randomUUID();e=e||{};const r=e.random||(e.rng||_i)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return yi(r)}const ze="ul-app";var C=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(C||{});const hn="#e6e6e6",rt="#bd282a",xi=500,Ci=1030;var J=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(J||{});const xr=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},ki=()=>{const e=xr();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Si=()=>{const e=xr();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Ei=Object.freeze(Object.defineProperty({__proto__:null,enable:ki,disable:Si},Symbol.toStringTag,{value:"Module"})),An=[Ei];class Jt{static disable(){An.forEach(t=>t.disable())}static enable(){An.forEach(t=>t.enable())}}const Li=1,We=e=>e instanceof HTMLElement,Ii=e=>e instanceof HTMLInputElement,ot=e=>e instanceof HTMLTextAreaElement,Cr=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=C.CustomStyle,e.head.appendChild(r)},kr=e=>{const t=e.querySelector(`.${C.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const o=getComputedStyle(t),i=parseFloat(o.marginTop)+parseFloat(o.marginBottom),s=parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth);r=i+s}return n+r+Li},Ui=e=>{const t=e.querySelector(`.${C.CardContainer}`);t&&(t.scrollTop=0)};var tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ti(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pi(e){var t=e.default;if(typeof t=="function"){var n=function(){return 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 Sr={},Pt={},ct={};Object.defineProperty(ct,"__esModule",{value:!0});ct.MemoryLeakError=void 0;class Ri extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}ct.MemoryLeakError=Ri;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Emitter=void 0;const Di=ct;class Rt{constructor(){this.events=new Map,this.maxListeners=Rt.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...o)=>{this.removeListener(t,r),n.apply(this,o)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(o=>{o.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const o=new Di.MemoryLeakError(this,t,this.listenerCount(t));console.warn(o)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const o=[n].concat(r);this.events.set(t,o)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Pt.Emitter=Rt;Rt.defaultMaxListeners=10;(function(e){var t=tt&&tt.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=tt&&tt.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(Pt,e),n(ct,e)})(Sr);const F=new Sr.Emitter;var nt=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(nt||{}),fe=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(fe||{}),Fe=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Fe||{}),Ie=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(Ie||{});const Ct=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),qe=({"userleap-platform":e})=>e!==Fe.Web,W=(e,t)=>{const n=t?C.MobileSuffix:C.DesktopSuffix;return[e+n,e]},_e=(e,t)=>[e,`${e}__${t}`];class Ai{constructor(t){te(this,"payload");te(this,"promise");te(this,"reject",()=>{});te(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const ji={RATELIMIT_RESET_DEFAULT:10};let Er=!1,Lr="",ht=!1,gt=[];const Oi=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?Ie.Gtm:e._segment?Ie.Segment:Ie.Snippet,Xt=(e="")=>{Er=!0,Lr=e};function dt(e={}){const t={"Content-Type":"application/json","userleap-platform":Fe.Web,"x-ul-sdk-version":"2.22.4",[fe.InstallationMethod]:Oi(e)};if(e.envId&&(t[fe.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[fe.UserID]=e.userId),e.visitorId&&(t[fe.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[fe.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[fe.PreviewMode]="1"),t}const jn=async(e,t,n)=>{if(e)return{status:429};{const r=new Ai(n);return gt.push(r),r.promise}},ge=async(e,t,n=0,r=!1,o=!1)=>{const i={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(ht&&!o)return jn(r,o,i);const s={ok:!1,reportError:!1};if(Er)return console.info(`UserLeap - ${Lr}`),s;try{t.headers=Object.assign(dt(),t.headers);const a=await fetch(e,t);if(a.status===429)if(!ht&&!r||o){ht=!0;const d=a.headers.has("ratelimit-reset")?Number(a.headers.get("ratelimit-reset")):ji.RATELIMIT_RESET_DEFAULT;return await Ct(d*1e3),ge(e,t,0,r,!0)}else return jn(r,!1,i);if(ht=!1,gt.length&&(gt.map(c=>{const{url:d,options:l,attempt:m,shouldDropOnRateLimit:p}=c.payload;ge(d,l,m,p).then(f=>{c.resolveRequest(f)})}),gt=[]),a.ok){if(a.status===249)return Xt(),s;const c=await a.text();try{return c&&c!=="OK"&&(a.json=JSON.parse(c)),a}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${c}`)}}}return a}catch(a){const c=n+1;return c>5?{ok:!1,reportError:!1,error:a}:(await Ct(Math.pow(2,n)*1e3),ge(e,t,c))}};var Ir={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(tt,function(){var n=function(i,s){if(s=s||{},typeof i!="function")throw new o("fetch must be a function");if(typeof s!="object")throw new o("defaults must be an object");if(s.retries!==void 0&&!r(s.retries))throw new o("retries must be a positive integer");if(s.retryDelay!==void 0&&!r(s.retryDelay)&&typeof s.retryDelay!="function")throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new o("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(a,s),function(d,l){var m=s.retries,p=s.retryDelay,f=s.retryOn;if(l&&l.retries!==void 0)if(r(l.retries))m=l.retries;else throw new o("retries must be a positive integer");if(l&&l.retryDelay!==void 0)if(r(l.retryDelay)||typeof l.retryDelay=="function")p=l.retryDelay;else throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(l&&l.retryOn)if(Array.isArray(l.retryOn)||typeof l.retryOn=="function")f=l.retryOn;else throw new o("retryOn property expects an array or function");return new Promise(function(h,g){var v=function(_){var S=typeof Request<"u"&&d instanceof Request?d.clone():d;i(S,l).then(function(b){if(Array.isArray(f)&&f.indexOf(b.status)===-1)h(b);else if(typeof f=="function")try{return Promise.resolve(f(_,null,b)).then(function(E){E?w(_,null,b):h(b)}).catch(g)}catch(E){g(E)}else _<m?w(_,null,b):h(b)}).catch(function(b){if(typeof f=="function")try{Promise.resolve(f(_,b,null)).then(function(E){E?w(_,b,null):g(b)}).catch(function(E){g(E)})}catch(E){g(E)}else _<m?w(_,b,null):g(b)})};function w(_,S,b){var E=typeof p=="function"?p(_,S,b):p;setTimeout(function(){v(++_)},E)}v(0)})}};function r(i){return Number.isInteger(i)&&i>=0}function o(i){this.name="ArgumentError",this.message=i}return n})})(Ir);const Mi=Ir.exports;class Ni{constructor(t){te(this,"awaitingResolvers",[]);te(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const Ur=new Ni(2),Vi=e=>Ur.setLimit(e),Bi=Mi(fetch),Fi=async(e,t=3)=>Ur.execute(async()=>{const r=(await Bi(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:o=>Math.pow(2,o)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),$i=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:o,responseGroupUuid:i})=>ge(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:i,surveyId:t}),headers:o}),Hi=(e,t)=>t.some(n=>e instanceof n);let On,Mn;function zi(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function qi(){return Mn||(Mn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Tr=new WeakMap,en=new WeakMap,Pr=new WeakMap,Nt=new WeakMap,gn=new WeakMap;function Wi(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{n(Ue(e.result)),o()},s=()=>{r(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(n=>{n instanceof IDBCursor&&Tr.set(n,e)}).catch(()=>{}),gn.set(t,e),t}function Gi(e){if(en.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{n(),o()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});en.set(e,t)}let tn={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return en.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Pr.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ue(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Ki(e){tn=e(tn)}function Zi(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Vt(this),t,...n);return Pr.set(r,t.sort?t.sort():[t]),Ue(r)}:qi().includes(e)?function(...t){return e.apply(Vt(this),t),Ue(Tr.get(this))}:function(...t){return Ue(e.apply(Vt(this),t))}}function Yi(e){return typeof e=="function"?Zi(e):(e instanceof IDBTransaction&&Gi(e),Hi(e,zi())?new Proxy(e,tn):e)}function Ue(e){if(e instanceof IDBRequest)return Wi(e);if(Nt.has(e))return Nt.get(e);const t=Yi(e);return t!==e&&(Nt.set(e,t),gn.set(t,e)),t}const Vt=e=>gn.get(e);function Qi(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const s=indexedDB.open(e,t),a=Ue(s);return r&&s.addEventListener("upgradeneeded",c=>{r(Ue(s.result),c.oldVersion,c.newVersion,Ue(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),o&&c.addEventListener("versionchange",d=>o(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const Ji=["get","getKey","getAll","getAllKeys","count"],Xi=["put","add","delete","clear"],Bt=new Map;function Nn(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Bt.get(t))return Bt.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=Xi.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||Ji.includes(n)))return;const i=async function(s,...a){const c=this.transaction(s,o?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),o&&c.done]))[0]};return Bt.set(t,i),i}Ki(e=>({...e,get:(t,n,r)=>Nn(t,n)||e.get(t,n,r),has:(t,n)=>!!Nn(t,n)||e.has(t,n)}));var we=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(we||{});const nn="sprig.sessionId",Rr="sprig.disableReplayRecording",N={name:"sprig.replay",version:1,tables:{events:{name:"events",indices:{session_timestamp:"session_timestamp",timestamp:"timestamp"}},chunkUploads:{name:"chunkUploads",indices:{timestamp:"timestamp",upload_status:"upload_status",session_status:"session_status",session_status_upload:"session_status_upload"}}}},es=()=>{sessionStorage.setItem(Rr,"disabled")},Dr=()=>!!sessionStorage.getItem(Rr),ts=()=>{const e=sessionStorage.getItem(nn);return e?(sessionStorage.removeItem(nn),e):Be()},de=ts();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(nn,de)});const ns=async()=>Qi(N.name,N.version,{upgrade:e=>{const t=e.createObjectStore(N.tables.events.name,{keyPath:"uuid"});t.createIndex(N.tables.events.indices.session_timestamp,["sessionId","timestamp"]),t.createIndex(N.tables.events.indices.timestamp,"timestamp");const n=e.createObjectStore(N.tables.chunkUploads.name,{keyPath:"uuid"});n.createIndex(N.tables.chunkUploads.indices.session_status,["sessionId","status"]),n.createIndex(N.tables.chunkUploads.indices.upload_status,["uploadId","status"]),n.createIndex(N.tables.chunkUploads.indices.session_status_upload,["sessionId","status","uploadId"]),n.createIndex(N.tables.chunkUploads.indices.timestamp,"timestamp")}}),ee=ns(),rs=async()=>{const e=await ee;return Promise.all([e.clear(N.tables.events.name),e.clear(N.tables.chunkUploads.name)])},os=async e=>{const n=(await ee).transaction(N.tables.events.name,"readwrite");return Promise.all([...e.map(r=>n.store.put({...r,sessionId:r.sessionId||de})),n.done])},is=async e=>await(await ee).getAllFromIndex(N.tables.events.name,N.tables.events.indices.session_timestamp,IDBKeyRange.bound([de,e],[de,Number.MAX_VALUE])),ss=async(e,t)=>(await ee).getAllKeysFromIndex(t,"timestamp",IDBKeyRange.upperBound(e-1)),Ar=async(e,t)=>{const r=(await ee).transaction(e,"readwrite");return Promise.all([...t.map(async o=>{try{await r.store.delete(o)}catch{}}),r.done])},jr=async(e,t)=>{const n=await ss(e,t);await Ar(t,n)},as=async e=>{await jr(e,N.tables.events.name)},ls=async e=>{await jr(e,N.tables.chunkUploads.name)},cs=async()=>{const t=await(await ee).getAllKeysFromIndex(N.tables.events.name,N.tables.events.indices.session_timestamp,IDBKeyRange.bound([de,Number.MIN_VALUE],[de,Number.MAX_VALUE]));await Promise.all([Ar(N.tables.events.name,t)])},ds=async e=>(await ee).put(N.tables.chunkUploads.name,{...e,sessionId:e.sessionId||de,etag:null}),us=async(e,t)=>{const n=await ee,r=await n.get(N.tables.chunkUploads.name,e);if(r)return n.put(N.tables.chunkUploads.name,{...r,data:null,etag:t,status:we.UploadComplete})},ps=async e=>await(await ee).countFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.ReadyForUpload],[e,we.ReadyForUpload]))>0,fs=async()=>{const n=(await(await ee).getAllFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([de,we.UploadComplete],[de,we.UploadComplete]))).reduce((i,s)=>(i.add(s.uploadId),i),new Set),r=Array.from(n),o=await Promise.all(r.map(async i=>ps(i)));return r.filter((i,s)=>!o[s])},ms=async({status:e,uploadId:t})=>(await ee).getAllKeysFromIndex(N.tables.chunkUploads.name,t?N.tables.chunkUploads.indices.upload_status:N.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([t||de,e],[t||de,e])),hs=async e=>(await ee).get(N.tables.chunkUploads.name,e),gs=async e=>(await ee).getAllFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.UploadComplete],[e,we.UploadComplete])),vs=async(e,t,n)=>new Promise((r,o)=>{const i=e.createElement("script");i.src=t,i.onload=r,i.onerror=o,n&&(i.nonce=n),e.head.appendChild(i)});let Or=5e3;const ws=async(e,t,n,r=2,o)=>{if(!t)return;o!=null&&o.minDuration&&(Or=o.minDuration),Vi(r),Ss(),bs();const i=window;i.rrwebRecord||await vs(e,"https://cdn.sprig.com/dependencies/rrweb-record-2.0.0-alpha.6.min.js",n);const s=i.rrwebRecord;if(!s)return;let a=!0;s({checkoutEveryNms:30*1e3,sampling:{input:"last",scroll:250,media:800},emit:(c,d)=>{if(Dr())return;const l=a||!!d;a=!1,_s({uuid:Be(),event:JSON.stringify(c),isValidStart:l,timestamp:Date.now()})},...o})};let rn=!1,on=[];const _s=e=>{on.push(e),rn||ys()},ys=()=>{rn=!0,setTimeout(async()=>{if(Dr())return;const e=on;on=[],rn=!1;try{await os(e)}catch(t){Mr(t)}},500)},Mr=async e=>{es(),await rs(),e instanceof Error&&window.UserLeap.reportError("Error storing replay data",e)},bs=(e=30,t=6*60,n=30*60)=>{setInterval(async()=>{const r=Date.now();await Promise.all([as(r-t*1e3),ls(r-n*1e3)])},e*1e3)},xs=async e=>{const t=await is(Date.now()-e*1e3),n=t.findIndex(r=>r.isValidStart);return n<0?[]:t.slice(n)},Cs=async e=>{const t=`[${e.map(o=>o.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const o=new CompressionStream("gzip"),i=o.writable.getWriter();return i.write(r),i.close(),new Uint8Array(await new Response(o.readable).arrayBuffer())}catch(o){return o instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",o),r}},ks=(e,t,n)=>{const r=e.length,o=t*1024*1024,i=Math.ceil(r/n),s=Math.max(o,i),a=[];let c=0;for(;c<r;)a.push(e.slice(c,c+s)),c+=s;return a},Nr=async e=>{await Promise.all(e.map(async t=>{const n=await hs(t),r=await Fi(n);await us(n.uuid,r)}))},Vr=async e=>{const t=await gs(e);if(!t.length)return;t.sort((o,i)=>o.chunkIndex-i.chunkIndex);const n=t.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),r=t[0];await $i({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders})},Ss=async()=>{const e=await ms({status:we.ReadyForUpload});if(!e.length)return;await Nr(e);const t=await fs();await Promise.all(t.map(n=>Vr(n)))},Es=async(e,t)=>{await Nr(t),await Promise.all(e.map(n=>Vr(n)))},Ls=async(e,t,n,r,o,i)=>{await Is();const s=await xs(r.replayDurationSeconds);if(!s.length||s[s.length-1].timestamp-s[0].timestamp<=Or)return;const c=await Cs(s),d=ks(c,r.minimumChunkSizeMb,r.signedUrls.length),l=Date.now();let m=[];try{m=await Promise.all(d.map(async(p,f)=>{const h=Be();return await ds({uuid:h,chunkIndex:f+1,totalChunks:d.length,timestamp:l,surveyId:t,responseGroupId:e,status:we.ReadyForUpload,data:p,visitorId:n,uploadId:r.uploadId,uploadUrl:r.signedUrls[f].url,apiUrl:i,completeUploadHeaders:o}),h}))}catch(p){Mr(p);return}await Es([r.uploadId],m)};let kt=null;const Is=async()=>{kt&&await kt},Vn=async()=>(kt=cs(),kt);var ut,L,Br,Ge,je,Bn,Fr,$r,St={},Hr=[],Us=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function xe(e,t){for(var n in t)e[n]=t[n];return e}function zr(e){var t=e.parentNode;t&&t.removeChild(e)}function q(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?ut.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 it(e,s,r,o,null)}function it(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,__h:null,constructor:void 0,__v:o==null?++Br:o};return o==null&&L.vnode!=null&&L.vnode(i),i}function qr(){return{current:null}}function ue(e){return e.children}function Ts(e,t,n,r,o){var i;for(i in n)i==="children"||i==="key"||i in t||Et(e,i,null,n[i],r);for(i in t)o&&typeof t[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||n[i]===t[i]||Et(e,i,t[i],n[i],r)}function Fn(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Us.test(t)?n:n+"px"}function Et(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||Fn(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Fn(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?Hn:$n,i):e.removeEventListener(t,i?Hn:$n,i);else if(t!=="dangerouslySetInnerHTML"){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 in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function $n(e){Ge=!0;try{return this.l[e.type+!1](L.event?L.event(e):e)}finally{Ge=!1}}function Hn(e){Ge=!0;try{return this.l[e.type+!0](L.event?L.event(e):e)}finally{Ge=!1}}function le(e,t){this.props=e,this.context=t}function at(e,t){if(t==null)return e.__?at(e.__,e.__.__k.indexOf(e)+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"?at(e):null}function Wr(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 Wr(e)}}function Ps(e){Ge?setTimeout(e):Fr(e)}function sn(e){(!e.__d&&(e.__d=!0)&&je.push(e)&&!Lt.__r++||Bn!==L.debounceRendering)&&((Bn=L.debounceRendering)||Ps)(Lt)}function Lt(){var e,t,n,r,o,i,s,a;for(je.sort(function(c,d){return c.__v.__b-d.__v.__b});e=je.shift();)e.__d&&(t=je.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=xe({},i)).__v=i.__v+1,vn(a,i,o,n.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,r,s==null?at(i):s,i.__h),Qr(r,i),i.__e!=s&&Wr(i)),je.length>t&&je.sort(function(c,d){return c.__v.__b-d.__v.__b}));Lt.__r=0}function Gr(e,t,n,r,o,i,s,a,c,d){var l,m,p,f,h,g,v,w=r&&r.__k||Hr,_=w.length;for(n.__k=[],l=0;l<t.length;l++)if((f=n.__k[l]=(f=t[l])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?it(null,f,null,null,f):Array.isArray(f)?it(ue,{children:f},null,null,null):f.__b>0?it(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=w[l])===null||p&&f.key==p.key&&f.type===p.type)w[l]=void 0;else for(m=0;m<_;m++){if((p=w[m])&&f.key==p.key&&f.type===p.type){w[m]=void 0;break}p=null}vn(e,f,p=p||St,o,i,s,a,c,d),h=f.__e,(m=f.ref)&&p.ref!=m&&(v||(v=[]),p.ref&&v.push(p.ref,null,f),v.push(m,f.__c||h,f)),h!=null?(g==null&&(g=h),typeof f.type=="function"&&f.__k===p.__k?f.__d=c=Kr(f,c,e):c=Zr(e,f,p,w,h,c),typeof n.type=="function"&&(n.__d=c)):c&&p.__e==c&&c.parentNode!=e&&(c=at(p))}for(n.__e=g,l=_;l--;)w[l]!=null&&(typeof n.type=="function"&&w[l].__e!=null&&w[l].__e==n.__d&&(n.__d=Yr(r).nextSibling),Xr(w[l],w[l]));if(v)for(l=0;l<v.length;l++)Jr(v[l],v[++l],v[++l])}function Kr(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t=typeof r.type=="function"?Kr(r,t,n):Zr(n,r,r,o,r.__e,t));return t}function Ce(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Ce(n,t)}):t.push(e)),t}function Zr(e,t,n,r,o,i){var s,a,c;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(n==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,c=0;(a=a.nextSibling)&&c<r.length;c+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function Yr(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=Yr(n)))return r}return null}function vn(e,t,n,r,o,i,s,a,c){var d,l,m,p,f,h,g,v,w,_,S,b,E,D,x,P=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(d=L.__b)&&d(t);try{e:if(typeof P=="function"){if(v=t.props,w=(d=P.contextType)&&r[d.__c],_=d?w?w.props.value:d.__:r,n.__c?g=(l=t.__c=n.__c).__=l.__E:("prototype"in P&&P.prototype.render?t.__c=l=new P(v,_):(t.__c=l=new le(v,_),l.constructor=P,l.render=Ds),w&&w.sub(l),l.props=v,l.state||(l.state={}),l.context=_,l.__n=r,m=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),P.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=xe({},l.__s)),xe(l.__s,P.getDerivedStateFromProps(v,l.__s))),p=l.props,f=l.state,l.__v=t,m)P.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(P.getDerivedStateFromProps==null&&v!==p&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(v,_),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(v,l.__s,_)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(l.props=v,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(T){T&&(T.__=t)}),S=0;S<l._sb.length;S++)l.__h.push(l._sb[S]);l._sb=[],l.__h.length&&s.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(v,l.__s,_),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(p,f,h)})}if(l.context=_,l.props=v,l.__P=e,b=L.__r,E=0,"prototype"in P&&P.prototype.render){for(l.state=l.__s,l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),D=0;D<l._sb.length;D++)l.__h.push(l._sb[D]);l._sb=[]}else do l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++E<25);l.state=l.__s,l.getChildContext!=null&&(r=xe(xe({},r),l.getChildContext())),m||l.getSnapshotBeforeUpdate==null||(h=l.getSnapshotBeforeUpdate(p,f)),x=d!=null&&d.type===ue&&d.key==null?d.props.children:d,Gr(e,Array.isArray(x)?x:[x],t,n,r,o,i,s,a,c),l.base=t.__e,t.__h=null,l.__h.length&&s.push(l),g&&(l.__E=l.__=null),l.__e=!1}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Rs(n.__e,t,n,r,o,i,s,c);(d=L.diffed)&&d(t)}catch(T){t.__v=null,(c||i!=null)&&(t.__e=a,t.__h=!!c,i[i.indexOf(a)]=null),L.__e(T,t,n)}}function Qr(e,t){L.__c&&L.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){L.__e(r,n.__v)}})}function Rs(e,t,n,r,o,i,s,a){var c,d,l,m=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(o=!0),i!=null){for(;h<i.length;h++)if((c=i[h])&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){e=c,i[h]=null;break}}if(e==null){if(f===null)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,p.is&&p),i=null,a=!1}if(f===null)m===p||a&&e.data===p||(e.data=p);else{if(i=i&&ut.call(e.childNodes),d=(m=n.props||St).dangerouslySetInnerHTML,l=p.dangerouslySetInnerHTML,!a){if(i!=null)for(m={},h=0;h<e.attributes.length;h++)m[e.attributes[h].name]=e.attributes[h].value;(l||d)&&(l&&(d&&l.__html==d.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(Ts(e,p,m,o,a),l)t.__k=[];else if(h=t.props.children,Gr(e,Array.isArray(h)?h:[h],t,n,r,o&&f!=="foreignObject",i,s,i?i[0]:n.__k&&at(n,0),a),i!=null)for(h=i.length;h--;)i[h]!=null&&zr(i[h]);a||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==m.value)&&Et(e,"value",h,m.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&Et(e,"checked",h,m.checked,!1))}return e}function Jr(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){L.__e(r,n)}}function Xr(e,t,n){var r,o;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Jr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){L.__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]&&Xr(r[o],t,n||typeof e.type!="function");n||e.__e==null||zr(e.__e),e.__=e.__e=e.__d=void 0}function Ds(e,t,n){return this.constructor(e,n)}function Ke(e,t,n){var r,o,i;L.__&&L.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],vn(t,e=(!r&&n||t).__k=q(ue,null,[e]),o||St,St,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?ut.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r),Qr(i,e)}function eo(e,t){Ke(e,t,eo)}function As(e,t,n){var r,o,i,s=xe({},e.props);for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?ut.call(arguments,2):n),it(e.type,s,r||e.key,o||e.ref,null)}function to(e,t){var n={__c:t="__cC"+$r++,__: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(a){a.__e=!0,sn(a)})},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}ut=Hr.slice,L={__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(a){e=a}throw e}},Br=0,Ge=!1,le.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=xe({},this.state),typeof e=="function"&&(e=e(xe({},n),this.props)),e&&xe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),sn(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),sn(this))},le.prototype.render=ue,je=[],Fr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lt.__r=0,$r=0;var I=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(I||{}),Ve=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Ve||{}),Ze=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Ze||{}),ne=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(ne||{}),Ne=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Ne||{}),ae=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(ae||{}),Y=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(Y||{}),ce=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(ce||{}),M=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))(M||{});const zn=e=>{let t;const n=new Set,r=(c,d)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const m=t;t=(d!=null?d:typeof l!="object")?l:Object.assign({},t,l),n.forEach(p=>p(t,m))}},o=()=>t,a={setState:r,getState:o,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return t=e(r,o,a),a},js=e=>e?zn(e):zn;var Pe,H,Ft,qn,Ye=0,no=[],vt=[],Wn=L.__b,Gn=L.__r,Kn=L.diffed,Zn=L.__c,Yn=L.unmount;function $e(e,t){L.__h&&L.__h(H,e,Ye||t),Ye=0;var n=H.__H||(H.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vt}),n.__[e]}function Z(e){return Ye=1,wn(ao,e)}function wn(e,t,n){var r=$e(Pe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ao(void 0,t),function(i){var s=r.__N?r.__N[0]:r.__[0],a=r.t(s,i);s!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=H,!H.u)){H.u=!0;var o=H.shouldComponentUpdate;H.shouldComponentUpdate=function(i,s,a){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(l){return l.__c});if(c.every(function(l){return!l.__N}))return!o||o.call(this,i,s,a);var d=!1;return c.forEach(function(l){if(l.__N){var m=l.__[0];l.__=l.__N,l.__N=void 0,m!==l.__[0]&&(d=!0)}}),!(!d&&r.__c.props===i)&&(!o||o.call(this,i,s,a))}}return r.__N||r.__}function re(e,t){var n=$e(Pe++,3);!L.__s&&yn(n.__H,t)&&(n.__=e,n.i=t,H.__H.__h.push(n))}function pt(e,t){var n=$e(Pe++,4);!L.__s&&yn(n.__H,t)&&(n.__=e,n.i=t,H.__h.push(n))}function Te(e){return Ye=5,Dt(function(){return{current:e}},[])}function ro(e,t,n){Ye=6,pt(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 Dt(e,t){var n=$e(Pe++,7);return yn(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function oo(e,t){return Ye=8,Dt(function(){return e},t)}function io(e){var t=H.context[e.__c],n=$e(Pe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(H)),t.props.value):e.__}function _n(e,t){L.useDebugValue&&L.useDebugValue(t?t(e):e)}function Os(e){var t=$e(Pe++,10),n=Z();return t.__=e,H.componentDidCatch||(H.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function so(){var e=$e(Pe++,11);if(!e.__){for(var t=H.__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 Ms(){for(var e;e=no.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wt),e.__H.__h.forEach(an),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}L.__b=function(e){H=null,Wn&&Wn(e)},L.__r=function(e){Gn&&Gn(e),Pe=0;var t=(H=e.__c).__H;t&&(Ft===H?(t.__h=[],H.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=vt,n.__N=n.i=void 0})):(t.__h.forEach(wt),t.__h.forEach(an),t.__h=[])),Ft=H},L.diffed=function(e){Kn&&Kn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(no.push(t)!==1&&qn===L.requestAnimationFrame||((qn=L.requestAnimationFrame)||Ns)(Ms)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vt&&(n.__=n.__V),n.i=void 0,n.__V=vt})),Ft=H=null},L.__c=function(e,t){t.some(function(n){try{n.__h.forEach(wt),n.__h=n.__h.filter(function(r){return!r.__||an(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(r,n.__v)}}),Zn&&Zn(e,t)},L.unmount=function(e){Yn&&Yn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{wt(r)}catch(o){t=o}}),n.__H=void 0,t&&L.__e(t,n.__v))};var Qn=typeof requestAnimationFrame=="function";function Ns(e){var t,n=function(){clearTimeout(r),Qn&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Qn&&(t=requestAnimationFrame(n))}function wt(e){var t=H,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),H=t}function an(e){var t=H;e.__c=e.__(),H=t}function yn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function ao(e,t){return typeof t=="function"?t(e):t}function lo(e,t){for(var n in t)e[n]=t[n];return e}function ln(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 $t(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function It(e){this.props=e}function co(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:ln(this.props,o)}function r(o){return this.shouldComponentUpdate=n,q(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(It.prototype=new le).isPureReactComponent=!0,It.prototype.shouldComponentUpdate=function(e,t){return ln(this.props,e)||ln(this.state,t)};var Jn=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Jn&&Jn(e)};var Vs=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function uo(e){function t(n){var r=lo({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=Vs,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Xn=function(e,t){return e==null?null:Ce(Ce(e).map(t))},po={map:Xn,forEach:Xn,count:function(e){return e?Ce(e).length:0},only:function(e){var t=Ce(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ce},Bs=L.__e;L.__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)}Bs(e,t,n,r)};var er=L.unmount;function fo(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=lo({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return fo(r,t,n)})),e}function mo(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return mo(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function st(){this.__u=0,this.t=null,this.__b=null}function ho(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function go(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 q(n,i)}return o.displayName="Lazy",o.__f=!0,o}function He(){this.u=null,this.o=null}L.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),er&&er(e)},(st.prototype=new le).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=ho(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=mo(d,d.__c.__P,d.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}},c=t.__h===!0;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},st.prototype.componentWillUnmount=function(){this.t=[]},st.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]=fo(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&q(ue,null,e.fallback);return o&&(o.__h=null),[q(ue,null,t.__a?null:e.children),o]};var tr=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 Fs(e){return this.getChildContext=function(){return e.context},e.children}function $s(e){var t=this,n=e.i;t.componentWillUnmount=function(){Ke(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(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)}}),Ke(q(Fs,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function vo(e,t){var n=q($s,{__v:e,i:t});return n.containerInfo=t,n}(He.prototype=new le).__a=function(e){var t=this,n=ho(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),tr(t,e,r)):o()};n?n(i):i()}},He.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ce(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},He.prototype.componentDidUpdate=He.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){tr(e,n,t)})};var wo=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Hs=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|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]/,zs=typeof document<"u",qs=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function _o(e,t,n){return t.__k==null&&(t.textContent=""),Ke(e,t),typeof n=="function"&&n(),e?e.__c:null}function yo(e,t,n){return eo(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 nr=L.event;function Ws(){}function Gs(){return this.cancelBubble}function Ks(){return this.defaultPrevented}L.event=function(e){return nr&&(e=nr(e)),e.persist=Ws,e.isPropagationStopped=Gs,e.isDefaultPrevented=Ks,e.nativeEvent=e};var bo,rr={configurable:!0,get:function(){return this.class}},or=L.vnode;L.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var o=t.indexOf("-")===-1;for(var i in r={},n){var s=n[i];zs&&i==="children"&&t==="noscript"||i==="value"&&"defaultValue"in n&&s==null||(i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!qs(n.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&Hs.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),r[i]&&(i="oninputCapture")),r[i]=s)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.value.indexOf(a.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.multiple?r.defaultValue.indexOf(a.props.value)!=-1:r.defaultValue==a.props.value})),e.props=r,n.class!=n.className&&(rr.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",rr))}e.$$typeof=wo,or&&or(e)};var ir=L.__r;L.__r=function(e){ir&&ir(e),bo=e.__c};var xo={ReactCurrentDispatcher:{current:{readContext:function(e){return bo.__n[e.__c].props.value}}}},Zs="17.0.2";function Co(e){return q.bind(null,e)}function bn(e){return!!e&&e.$$typeof===wo}function ko(e){return bn(e)?As.apply(null,arguments):e}function So(e){return!!e.__k&&(Ke(null,e),!0)}function Eo(e){return e&&(e.base||e.nodeType===1&&e)||null}var Lo=function(e,t){return e(t)},Io=function(e,t){return e(t)},Uo=ue;function xn(e){e()}function To(e){return e}function Po(){return[!1,xn]}var Ro=pt;function Do(e,t){var n=t(),r=Z({h:{__:n,v:t}}),o=r[0].h,i=r[1];return pt(function(){o.__=n,o.v=t,$t(o.__,t())||i({h:o})},[e,n,t]),re(function(){return $t(o.__,o.v())||i({h:o}),e(function(){$t(o.__,o.v())||i({h:o})})},[e]),n}var Ys={useState:Z,useId:so,useReducer:wn,useEffect:re,useLayoutEffect:pt,useInsertionEffect:Ro,useTransition:Po,useDeferredValue:To,useSyncExternalStore:Do,startTransition:xn,useRef:Te,useImperativeHandle:ro,useMemo:Dt,useCallback:oo,useContext:io,useDebugValue:_n,version:"17.0.2",Children:po,render:_o,hydrate:yo,unmountComponentAtNode:So,createPortal:vo,createElement:q,createContext:to,createFactory:Co,cloneElement:ko,createRef:qr,Fragment:ue,isValidElement:bn,findDOMNode:Eo,Component:le,PureComponent:It,memo:co,forwardRef:uo,flushSync:Io,unstable_batchedUpdates:Lo,StrictMode:Uo,Suspense:st,SuspenseList:He,lazy:go,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:xo};const Qs=Object.freeze(Object.defineProperty({__proto__:null,Children:po,PureComponent:It,StrictMode:Uo,Suspense:st,SuspenseList:He,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:xo,cloneElement:ko,createFactory:Co,createPortal:vo,default:Ys,findDOMNode:Eo,flushSync:Io,forwardRef:uo,hydrate:yo,isValidElement:bn,lazy:go,memo:co,render:_o,startTransition:xn,unmountComponentAtNode:So,unstable_batchedUpdates:Lo,useDeferredValue:To,useInsertionEffect:Ro,useSyncExternalStore:Do,useTransition:Po,version:Zs,Component:le,Fragment:ue,createContext:to,createElement:q,createRef:qr,useCallback:oo,useContext:io,useDebugValue:_n,useEffect:re,useErrorBoundary:Os,useId:so,useImperativeHandle:ro,useLayoutEffect:pt,useMemo:Dt,useReducer:wn,useRef:Te,useState:Z},Symbol.toStringTag,{value:"Module"}));var Ao={exports:{}},jo={};const Oo=Pi(Qs);var Mo={exports:{}},No={};/**
|
|
1
|
+
"use strict";var Ws=Object.defineProperty;var Ks=(e,t,n)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>(Ks(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ee=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(Ee||{}),P=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",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.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e))(P||{}),jo=(e=>(e.SurveyId="survey.id",e))(jo||{});const Jn={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_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",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"}};var de=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(de||{}),ze=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(ze||{}),$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ys(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qs(e){var t=e.default;if(typeof t=="function"){var n=function(){return 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 Q={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});var Xn=function(){function e(){}return e.prototype.handleError=function(t){},e}();Qe.NoopErrorHandler=Xn;var er=new Xn;function Zs(e){er=e}Qe.setErrorHandler=Zs;function Js(){return er}Qe.getErrorHandler=Js;function Xs(){er=new Xn}Qe.resetErrorHandler=Xs;var tr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NOTSET=0]="NOTSET",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR"}(e.LogLevel||(e.LogLevel={}))})(tr);var Me={},dt={},Ht={exports:{}},Ur=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Ur){var Ar=new Uint8Array(16);Ht.exports=function(){return Ur(Ar),Ar}}else{var Or=new Array(16);Ht.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Or[t]=n>>>((t&3)<<3)&255;return Or}}var Vo=[];for(var Rt=0;Rt<256;++Rt)Vo[Rt]=(Rt+256).toString(16).substr(1);function ea(e,t){var n=t||0,r=Vo;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Mo=ea,ta=Ht.exports,na=Mo,Nr,un,pn=0,fn=0;function ra(e,t,n){var r=t&&n||0,o=t||[];e=e||{};var i=e.node||Nr,s=e.clockseq!==void 0?e.clockseq:un;if(i==null||s==null){var a=ta();i==null&&(i=Nr=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=un=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:new Date().getTime(),l=e.nsecs!==void 0?e.nsecs:fn+1,d=c-pn+(l-fn)/1e4;if(d<0&&e.clockseq===void 0&&(s=s+1&16383),(d<0||c>pn)&&e.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pn=c,fn=l,un=s,c+=122192928e5;var h=((c&268435455)*1e4+l)%4294967296;o[r++]=h>>>24&255,o[r++]=h>>>16&255,o[r++]=h>>>8&255,o[r++]=h&255;var u=c/4294967296*1e4&268435455;o[r++]=u>>>8&255,o[r++]=u&255,o[r++]=u>>>24&15|16,o[r++]=u>>>16&255,o[r++]=s>>>8|128,o[r++]=s&255;for(var p=0;p<6;++p)o[r+p]=i[p];return t||na(o)}var oa=ra,ia=Ht.exports,sa=Mo;function aa(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var o=e.random||(e.rng||ia)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||sa(o)}var la=aa,ca=oa,Fo=la,nr=Fo;nr.v1=ca;nr.v4=Fo;var da=nr;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=da;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function o(h,u){for(var p=!1,m=Object.keys(h),v=0;v<m.length;v++)if(u===h[m[v]]){p=!0;break}return p}e.isValidEnum=o;function i(h,u){var p={};return h.forEach(function(m){var v=u(m);p[v]=p[v]||[],p[v].push(m)}),s(p)}e.groupBy=i;function s(h){return Object.keys(h).map(function(u){return h[u]})}e.objectValues=s;function a(h){return Object.keys(h).map(function(u){return[u,h[u]]})}e.objectEntries=a;function c(h,u){for(var p,m=0,v=h;m<v.length;m++){var g=v[m];if(u(g)){p=g;break}}return p}e.find=c;function l(h,u){var p={};return h.forEach(function(m){var v=u(m);p[v]=m}),p}e.keyBy=l;function d(h){for(var u=[],p=1;p<arguments.length;p++)u[p-1]=arguments[p];var m=0;return h.replace(/%s/g,function(){var v=u[m++],g=typeof v;return g==="function"?v():g==="string"?v:String(v)})}e.sprintf=d,function(h){h.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",h.DECISION="DECISION:type, userId, attributes, decisionInfo",h.LOG_EVENT="LOG_EVENT:logEvent",h.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",h.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(dt);var ua=$&&$.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};Object.defineProperty(Me,"__esModule",{value:!0});var pa=Qe,$t=dt,W=tr,Dr={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function rr(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!Dr[e])?e:Dr[e]}var Bo=function(){function e(){this.defaultLoggerFacade=new Pr,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new Pr({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),fa=function(){function e(t){t===void 0&&(t={}),this.logLevel=W.LogLevel.NOTSET,t.logLevel!==void 0&&$t.isValidEnum(W.LogLevel,t.logLevel)&&this.setLogLevel(t.logLevel),this.logToConsole=t.logToConsole!==void 0?!!t.logToConsole:!0,this.prefix=t.prefix!==void 0?t.prefix:"[OPTIMIZELY]"}return e.prototype.log=function(t,n){if(!(!this.shouldLog(t)||!this.logToConsole)){var r=this.prefix+" - "+this.getLogLevelName(t)+" "+this.getTime()+" "+n;this.consoleLog(t,[r])}},e.prototype.setLogLevel=function(t){t=rr(t),!$t.isValidEnum(W.LogLevel,t)||t===void 0?this.logLevel=W.LogLevel.ERROR:this.logLevel=t},e.prototype.getTime=function(){return new Date().toISOString()},e.prototype.shouldLog=function(t){return t>=this.logLevel},e.prototype.getLogLevelName=function(t){switch(t){case W.LogLevel.DEBUG:return"DEBUG";case W.LogLevel.INFO:return"INFO ";case W.LogLevel.WARNING:return"WARN ";case W.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case W.LogLevel.DEBUG:console.log.apply(console,n);break;case W.LogLevel.INFO:console.info.apply(console,n);break;case W.LogLevel.WARNING:console.warn.apply(console,n);break;case W.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();Me.ConsoleLogHandler=fa;var wt=W.LogLevel.NOTSET,An=null,Pr=function(){function e(t){t===void 0&&(t={}),this.messagePrefix="",t.messagePrefix&&(this.messagePrefix=t.messagePrefix)}return e.prototype.log=function(t,n){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];this.internalLog(rr(t),{message:n,splat:r})},e.prototype.info=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(W.LogLevel.INFO,t,n)},e.prototype.debug=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(W.LogLevel.DEBUG,t,n)},e.prototype.warn=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(W.LogLevel.WARNING,t,n)},e.prototype.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(W.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+$t.sprintf.apply(void 0,ua([t.message],t.splat))},e.prototype.internalLog=function(t,n){!An||t<wt||(An.log(t,this.format(n)),n.error&&n.error instanceof Error&&pa.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var o;if(n instanceof Error){o=n,n=o.message,this.internalLog(t,{error:o,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var i=r[r.length-1];i instanceof Error&&(o=i,r.splice(-1)),this.internalLog(t,{message:n,error:o,splat:r})},e}(),Ho=new Bo;function ha(e){return Ho.getLogger(e)}Me.getLogger=ha;function ma(e){An=e}Me.setLogHandler=ma;function va(e){e=rr(e),!$t.isValidEnum(W.LogLevel,e)||e===void 0?wt=W.LogLevel.ERROR:wt=e}Me.setLogLevel=va;function ga(){return wt}Me.getLogLevel=ga;function _a(){Ho=new Bo,wt=W.LogLevel.NOTSET}Me.resetLogger=_a;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(Qe),t(tr),t(Me)})(Q);var ya={},xt={};Object.defineProperty(xt,"__esModule",{value:!0});xt.areEventContextsEqual=void 0;function wa(e,t){var n=e.context,r=t.context;return n.accountId===r.accountId&&n.projectId===r.projectId&&n.clientName===r.clientName&&n.clientVersion===r.clientVersion&&n.revision===r.revision&&n.anonymizeIP===r.anonymizeIP&&n.botFiltering===r.botFiltering}xt.areEventContextsEqual=wa;var or={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.DefaultEventQueue=nt.SingleEventQueue=void 0;var Ea=Q,ba=Ea.getLogger("EventProcessor"),Ca=function(){function e(t){var n=t.timeout,r=t.callback;this.timeout=Math.max(n,0),this.callback=r}return e.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},e.prototype.refresh=function(){this.stop(),this.start()},e.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},e}(),xa=function(){function e(t){var n=t.sink;this.sink=n}return e.prototype.start=function(){},e.prototype.stop=function(){return Promise.resolve()},e.prototype.enqueue=function(t){this.sink([t])},e}();nt.SingleEventQueue=xa;var Sa=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,o=t.sink,i=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=o,this.batchComparator=i,this.timer=new Ca({callback:this.flush.bind(this),timeout:n}),this.started=!1}return e.prototype.start=function(){this.started=!0},e.prototype.stop=function(){this.started=!1;var t=this.sink(this.buffer);return this.buffer=[],this.timer.stop(),t},e.prototype.enqueue=function(t){if(!this.started){ba.warn("Queue is stopped, not accepting event");return}var n=this.buffer[0];n&&!this.batchComparator(n,t)&&this.flush(),this.buffer.length===0&&this.timer.refresh(),this.buffer.push(t),this.buffer.length>=this.maxQueueSize&&this.flush()},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}();nt.DefaultEventQueue=Sa;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendEventNotification=e.getQueue=e.validateAndGetBatchSize=e.validateAndGetFlushInterval=e.DEFAULT_BATCH_SIZE=e.DEFAULT_FLUSH_INTERVAL=void 0;var t=nt,n=Q,r=dt;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var o=n.getLogger("EventProcessor");function i(l){return l<=0&&(o.warn("Invalid flushInterval "+l+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),l=e.DEFAULT_FLUSH_INTERVAL),l}e.validateAndGetFlushInterval=i;function s(l){return l=Math.floor(l),l<1&&(o.warn("Invalid batchSize "+l+", defaulting to "+e.DEFAULT_BATCH_SIZE),l=e.DEFAULT_BATCH_SIZE),l=Math.max(1,l),l}e.validateAndGetBatchSize=s;function a(l,d,h,u){var p;return l>1?p=new t.DefaultEventQueue({flushInterval:d,maxQueueSize:l,sink:h,batchComparator:u}):p=new t.SingleEventQueue({sink:h}),p}e.getQueue=a;function c(l,d){l&&l.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,d)}e.sendEventNotification=c})(or);var $o={};Object.defineProperty($o,"__esModule",{value:!0});var qo={};Object.defineProperty(qo,"__esModule",{value:!0});var rt={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.LocalStorageStore=void 0;var Ia=dt,ka=Q,jr=ka.getLogger("EventProcessor"),La=function(){function e(t){var n=t.key,r=t.maxValues,o=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=o}return e.prototype.get=function(t){return this.getMap()[t]||null},e.prototype.set=function(t,n){var r=this.getMap();r[t]=n,this.replace(r)},e.prototype.remove=function(t){var n=this.getMap();delete n[t],this.replace(n)},e.prototype.values=function(){return Ia.objectValues(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(t){try{window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(t)),this.clean()}catch(n){jr.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var o=n.map(function(s){return{key:s,value:t[s]}});o.sort(function(s,a){return s.value.timestamp-a.value.timestamp});for(var i=0;i<r;i++)delete t[o[i].key];this.replace(t)}},e.prototype.getMap=function(){try{var t=window.localStorage&&localStorage.getItem(this.LS_KEY);if(t)return JSON.parse(t)||{}}catch(n){jr.error(n)}return{}},e}();tn.LocalStorageStore=La;var Ta=$&&$.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(rt,"__esModule",{value:!0});rt.LocalStoragePendingEventsDispatcher=rt.PendingEventsDispatcher=void 0;var Ra=Q,Ua=tn,Vr=dt,Aa=Ra.getLogger("EventProcessor"),Go=function(){function e(t){var n=t.eventDispatcher,r=t.store;this.dispatcher=n,this.store=r}return e.prototype.dispatchEvent=function(t,n){this.send({uuid:Vr.generateUUID(),timestamp:Vr.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Aa.debug("Sending %s pending events from previous page",n.length),n.forEach(function(r){try{t.send(r,function(){})}catch{}})},e.prototype.send=function(t,n){var r=this;this.store.set(t.uuid,t),this.dispatcher.dispatchEvent(t.request,function(o){r.store.remove(t.uuid),n(o)})},e}();rt.PendingEventsDispatcher=Go;var Oa=function(e){Ta(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new Ua.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Go);rt.LocalStoragePendingEventsDispatcher=Oa;var he={},On=$&&$.__assign||function(){return On=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},On.apply(this,arguments)};Object.defineProperty(he,"__esModule",{value:!0});he.formatEvents=he.buildConversionEventV1=he.buildImpressionEventV1=he.makeBatchedEventV1=void 0;var Na="campaign_activated",Da="custom",Mr="$opt_bot_filtering";function zo(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var o=ir(r);r.type==="impression"?o.snapshots.push(Ko(r)):r.type==="conversion"&&o.snapshots.push(Wo(r)),t.push(o)}}),{client_name:n.context.clientName,client_version:n.context.clientVersion,account_id:n.context.accountId,project_id:n.context.projectId,revision:n.context.revision,anonymize_ip:n.context.anonymizeIP,enrich_decisions:!0,visitors:t}}he.makeBatchedEventV1=zo;function Wo(e){var t=On({},e.tags);delete t.revenue,delete t.value;var n={entity_id:e.event.id,key:e.event.key,timestamp:e.timestamp,uuid:e.uuid};return e.tags&&(n.tags=e.tags),e.value!=null&&(n.value=e.value),e.revenue!=null&&(n.revenue=e.revenue),{events:[n]}}function Ko(e){var t,n,r=e.layer,o=e.experiment,i=e.variation,s=e.ruleKey,a=e.flagKey,c=e.ruleType,l=e.enabled,d=r?r.id:null,h=(t=o==null?void 0:o.id)!==null&&t!==void 0?t:"",u=(n=i==null?void 0:i.id)!==null&&n!==void 0?n:"",p=i?i.key:"";return{decisions:[{campaign_id:d,experiment_id:h,variation_id:u,metadata:{flag_key:a,rule_key:s,rule_type:c,variation_key:p,enabled:l}}],events:[{entity_id:d,timestamp:e.timestamp,key:Na,uuid:e.uuid}]}}function ir(e){var t={snapshots:[],visitor_id:e.user.id,attributes:[]};return e.user.attributes.forEach(function(n){t.attributes.push({entity_id:n.entityId,key:n.key,type:"custom",value:n.value})}),typeof e.context.botFiltering=="boolean"&&t.attributes.push({entity_id:Mr,key:Mr,type:Da,value:e.context.botFiltering}),t}function Pa(e){var t=ir(e);return t.snapshots.push(Ko(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}he.buildImpressionEventV1=Pa;function ja(e){var t=ir(e);return t.snapshots.push(Wo(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}he.buildConversionEventV1=ja;function Va(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:zo(e)}}he.formatEvents=Va;var nn={},sr={};Object.defineProperty(sr,"__esModule",{value:!0});var Ma=function(){function e(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return e.prototype.trackRequest=function(t){var n=this;this.reqsInFlightCount++;var r=function(){n.reqsInFlightCount--,n.reqsInFlightCount===0&&(n.reqsCompleteResolvers.forEach(function(o){return o()}),n.reqsCompleteResolvers=[])};t.then(r,r)},e.prototype.onRequestsComplete=function(){var t=this;return new Promise(function(n){t.reqsInFlightCount===0?n():t.reqsCompleteResolvers.push(n)})},e}();sr.default=Ma;var Fa=$&&$.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(d){try{l(r.next(d))}catch(h){s(h)}}function c(d){try{l(r.throw(d))}catch(h){s(h)}}function l(d){d.done?i(d.value):o(d.value).then(a,c)}l((r=r.apply(e,t||[])).next())})},Ba=$&&$.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Ha=$&&$.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nn,"__esModule",{value:!0});nn.LogTierV1EventProcessor=void 0;var $a=Q,Je=or,qa=Ha(sr),Ga=xt,za=he,Fr=$a.getLogger("LogTierV1EventProcessor"),Wa=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,o=r===void 0?Je.DEFAULT_FLUSH_INTERVAL:r,i=t.batchSize,s=i===void 0?Je.DEFAULT_BATCH_SIZE:i,a=t.notificationCenter;this.dispatcher=n,this.notificationCenter=a,this.requestTracker=new qa.default,o=Je.validateAndGetFlushInterval(o),s=Je.validateAndGetBatchSize(s),this.queue=Je.getQueue(s,o,this.drainQueue.bind(this),Ga.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(o){if(Fr.debug("draining queue with %s events",t.length),t.length===0){o();return}var i=za.formatEvents(t);n.dispatcher.dispatchEvent(i,function(){o()}),Je.sendEventNotification(n.notificationCenter,i)});return this.requestTracker.trackRequest(r),r},e.prototype.process=function(t){this.queue.enqueue(t)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(t){Fr.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Fa(this,void 0,void 0,function(){return Ba(this,function(t){return this.queue.start(),[2]})})},e}();nn.LogTierV1EventProcessor=Wa;(function(e){var t=$&&$.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return o[i]}})}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=$&&$.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(xt,e),n(or,e),n($o,e),n(qo,e),n(rt,e),n(he,e),n(nn,e)})(ya);var qt={exports:{}},Br=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Br){var Hr=new Uint8Array(16);qt.exports=function(){return Br(Hr),Hr}}else{var $r=new Array(16);qt.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),$r[t]=n>>>((t&3)<<3)&255;return $r}}var Yo=[];for(var Ut=0;Ut<256;++Ut)Yo[Ut]=(Ut+256).toString(16).substr(1);function Ka(e,t){var n=t||0,r=Yo;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Qo=Ka,Ya=qt.exports,Qa=Qo,qr,hn,mn=0,vn=0;function Za(e,t,n){var r=t&&n||0,o=t||[];e=e||{};var i=e.node||qr,s=e.clockseq!==void 0?e.clockseq:hn;if(i==null||s==null){var a=Ya();i==null&&(i=qr=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=hn=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:new Date().getTime(),l=e.nsecs!==void 0?e.nsecs:vn+1,d=c-mn+(l-vn)/1e4;if(d<0&&e.clockseq===void 0&&(s=s+1&16383),(d<0||c>mn)&&e.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");mn=c,vn=l,hn=s,c+=122192928e5;var h=((c&268435455)*1e4+l)%4294967296;o[r++]=h>>>24&255,o[r++]=h>>>16&255,o[r++]=h>>>8&255,o[r++]=h&255;var u=c/4294967296*1e4&268435455;o[r++]=u>>>8&255,o[r++]=u&255,o[r++]=u>>>24&15|16,o[r++]=u>>>16&255,o[r++]=s>>>8|128,o[r++]=s&255;for(var p=0;p<6;++p)o[r+p]=i[p];return t||Qa(o)}var Ja=Za,Xa=qt.exports,el=Qo;function tl(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var o=e.random||(e.rng||Xa)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||el(o)}var nl=tl,rl=Ja,Zo=nl,Jo=Zo;Jo.v1=rl;Jo.v4=Zo;var ol={exports:{}};(function(e){(function(){function t(o,i){for(var s=o.length,a=i^s,c=0,l;s>=4;)l=o.charCodeAt(c)&255|(o.charCodeAt(++c)&255)<<8|(o.charCodeAt(++c)&255)<<16|(o.charCodeAt(++c)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),a=(a&65535)*1540483477+(((a>>>16)*1540483477&65535)<<16)^l,s-=4,++c;switch(s){case 3:a^=(o.charCodeAt(c+2)&255)<<16;case 2:a^=(o.charCodeAt(c+1)&255)<<8;case 1:a^=o.charCodeAt(c)&255,a=(a&65535)*1540483477+(((a>>>16)*1540483477&65535)<<16)}return a^=a>>>13,a=(a&65535)*1540483477+(((a>>>16)*1540483477&65535)<<16),a^=a>>>15,a>>>0}function n(o,i){var s,a,c,l,d,h,u,p;for(s=o.length&3,a=o.length-s,c=i,d=3432918353,h=461845907,p=0;p<a;)u=o.charCodeAt(p)&255|(o.charCodeAt(++p)&255)<<8|(o.charCodeAt(++p)&255)<<16|(o.charCodeAt(++p)&255)<<24,++p,u=(u&65535)*d+(((u>>>16)*d&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(u&65535)*h+(((u>>>16)*h&65535)<<16)&4294967295,c^=u,c=c<<13|c>>>19,l=(c&65535)*5+(((c>>>16)*5&65535)<<16)&4294967295,c=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(u=0,s){case 3:u^=(o.charCodeAt(p+2)&255)<<16;case 2:u^=(o.charCodeAt(p+1)&255)<<8;case 1:u^=o.charCodeAt(p)&255,u=(u&65535)*d+(((u>>>16)*d&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(u&65535)*h+(((u>>>16)*h&65535)<<16)&4294967295,c^=u}return c^=o.length,c^=c>>>16,c=(c&65535)*2246822507+(((c>>>16)*2246822507&65535)<<16)&4294967295,c^=c>>>13,c=(c&65535)*3266489909+(((c>>>16)*3266489909&65535)<<16)&4294967295,c^=c>>>16,c>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(ol);var Xo={},ar={},lr={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.DEFAULT_UPDATE_INTERVAL=5*60*1e3;Se.MIN_UPDATE_INTERVAL=1e3;Se.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";Se.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";Se.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];Se.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(lr,"__esModule",{value:!0});var il=Se,sl=Q,al=sl.getLogger("DatafileManager"),ll="GET",cl=4;function dl(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
|
|
2
|
+
`),r={};return n.forEach(function(o){var i=o.indexOf(": ");if(i>-1){var s=o.slice(0,i),a=o.slice(i+2);a.length>0&&(r[s]=a)}}),r}function ul(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function pl(e,t){var n=new XMLHttpRequest,r=new Promise(function(o,i){n.open(ll,e,!0),ul(t,n),n.onreadystatechange=function(){if(n.readyState===cl){var s=n.status;if(s===0){i(new Error("Request error"));return}var a=dl(n),c={statusCode:n.status,body:n.responseText,headers:a};o(c)}},n.timeout=il.REQUEST_TIMEOUT_MS,n.ontimeout=function(){al.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}lr.makeGetRequest=pl;var cr={},dr={};Object.defineProperty(dr,"__esModule",{value:!0});var fl=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var o=String(this.listenerId);return this.listenerId++,this.listeners[t][o]=n,function(){r.listeners[t]&&delete r.listeners[t][o]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(o){var i=r[o];i(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();dr.default=fl;var ur={};Object.defineProperty(ur,"__esModule",{value:!0});var gn=Se;function hl(){return Math.round(Math.random()*1e3)}var ml=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=gn.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(gn.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+hl()},e.prototype.countError=function(){this.errorCount<gn.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ur.default=ml;var Gt=$&&$.__assign||function(){return Gt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Gt.apply(this,arguments)},ei=$&&$.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cr,"__esModule",{value:!0});var vl=Q,gl=dt,_l=ei(dr),ht=Se,yl=ei(ur),ae=vl.getLogger("DatafileManager"),wl="update";function El(e){return e>=ht.MIN_UPDATE_INTERVAL}function Gr(e){return e>=200&&e<400}var bl={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Cl=function(){function e(t){var n=this,r=Gt(Gt({},this.getConfigDefaults()),t),o=r.datafile,i=r.autoUpdate,s=i===void 0?!1:i,a=r.sdkKey,c=r.updateInterval,l=c===void 0?ht.DEFAULT_UPDATE_INTERVAL:c,d=r.urlTemplate,h=d===void 0?ht.DEFAULT_URL_TEMPLATE:d,u=r.cache,p=u===void 0?bl:u;this.cache=p,this.cacheKey="opt-datafile-"+a,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(m,v){n.readyPromiseResolver=m,n.readyPromiseRejecter=v}),o?(this.currentDatafile=o,a||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=gl.sprintf(h,a),this.emitter=new _l.default,this.autoUpdate=s,El(l)?this.updateInterval=l:(ae.warn("Invalid updateInterval %s, defaulting to %s",l,ht.DEFAULT_UPDATE_INTERVAL),this.updateInterval=ht.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new yl.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ae.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ae.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?ae.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?ae.error("Error fetching datafile: %s",t):ae.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Gr(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(ae.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(wl,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),ae.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},o=function(s){t.onRequestResolved(s)},i=function(s){t.onRequestRejected(s)};this.currentRequest.responsePromise.then(o,i).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);ae.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return ae.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Gr(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,ae.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(ae.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();cr.default=Cl;var xl=$&&$.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Sl=$&&$.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ar,"__esModule",{value:!0});var Il=lr,kl=Sl(cr),Ll=function(e){xl(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return Il.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(kl.default);ar.default=Ll;Object.defineProperty(Xo,"__esModule",{value:!0});var Tl=ar;Xo.HttpPollingDatafileManager=Tl.default;var Rl={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Ul={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},Al={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},Ol={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},Nl="javascript-sdk",Dl="node-sdk",Pl="react-sdk",jl="react-native-sdk",Vl="react-native-js-sdk",Ml="4.9.3",Fl="4.9.3",Bl={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Hl={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},$l={RULE:"rule",EXPERIMENT:"experiment"},ql={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},Nt={V2:"2",V3:"3",V4:"4"},Gl={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Nn;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Nn||(Nn={}));var zl=Object.freeze({__proto__:null,LOG_LEVEL:Rl,ERROR_MESSAGES:Ul,LOG_MESSAGES:Al,CONTROL_ATTRIBUTES:Ol,JAVASCRIPT_CLIENT_ENGINE:Nl,NODE_CLIENT_ENGINE:Dl,REACT_CLIENT_ENGINE:Pl,REACT_NATIVE_CLIENT_ENGINE:jl,REACT_NATIVE_JS_CLIENT_ENGINE:Vl,BROWSER_CLIENT_VERSION:Ml,NODE_CLIENT_VERSION:Fl,DECISION_NOTIFICATION_TYPES:Bl,DECISION_SOURCES:Hl,AUDIENCE_EVALUATION_TYPES:$l,FEATURE_VARIABLE_TYPES:ql,DATAFILE_VERSIONS:Nt,DECISION_MESSAGES:Gl,get NOTIFICATION_TYPES(){return Nn}});Nt.V2,Nt.V3,Nt.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Wl(e){return new Q.ConsoleLogHandler(e)}var zr;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(zr||(zr={}));var Wr;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(Wr||(Wr={}));Q.getLogger();Q.getLogger();Q.getLogger();Q.getLogger();Q.getLogger("EVENT_BUILDER");Q.getLogger();Q.setLogHandler(Wl());Q.setLogLevel(Q.LogLevel.INFO);let At;const Kl=new Uint8Array(16);function Yl(){if(!At&&(At=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!At))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return At(Kl)}const J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));function Ql(e,t=0){return(J[e[t+0]]+J[e[t+1]]+J[e[t+2]]+J[e[t+3]]+"-"+J[e[t+4]]+J[e[t+5]]+"-"+J[e[t+6]]+J[e[t+7]]+"-"+J[e[t+8]]+J[e[t+9]]+"-"+J[e[t+10]]+J[e[t+11]]+J[e[t+12]]+J[e[t+13]]+J[e[t+14]]+J[e[t+15]]).toLowerCase()}const Zl=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Kr={randomUUID:Zl};function je(e,t,n){if(Kr.randomUUID&&!t&&!e)return Kr.randomUUID();e=e||{};const r=e.random||(e.rng||Yl)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Ql(r)}const et="ul-app";var x=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(x||{});const pr="#e6e6e6",vt="#bd282a",Jl=500,Xl=1030;var ie=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(ie||{});const ti=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},ec=()=>{const e=ti();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},tc=()=>{const e=ti();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},nc=Object.freeze(Object.defineProperty({__proto__:null,enable:ec,disable:tc},Symbol.toStringTag,{value:"Module"})),Yr=[nc];class Dn{static disable(){Yr.forEach(t=>t.disable())}static enable(){Yr.forEach(t=>t.enable())}}const rc=1,ot=e=>e instanceof HTMLElement,oc=e=>e instanceof HTMLInputElement,gt=e=>e instanceof HTMLTextAreaElement,ni=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=x.CustomStyle,e.head.appendChild(r)},ri=e=>{const t=e.querySelector(`.${x.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const o=getComputedStyle(t),i=parseFloat(o.marginTop)+parseFloat(o.marginBottom),s=parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth);r=i+s}return n+r+rc},ic=e=>{const t=e.querySelector(`.${x.CardContainer}`);t&&(t.scrollTop=0)};var oi={},rn={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.MemoryLeakError=void 0;class sc extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}St.MemoryLeakError=sc;Object.defineProperty(rn,"__esModule",{value:!0});rn.Emitter=void 0;const ac=St;class on{constructor(){this.events=new Map,this.maxListeners=on.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...o)=>{this.removeListener(t,r),n.apply(this,o)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(o=>{o.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const o=new ac.MemoryLeakError(this,t,this.listenerCount(t));console.warn(o)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const o=[n].concat(r);this.events.set(t,o)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}rn.Emitter=on;on.defaultMaxListeners=10;(function(e){var t=$&&$.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=$&&$.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(rn,e),n(St,e)})(oi);const B=new oi.Emitter;var mt=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(mt||{}),ye=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(ye||{}),Ye=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Ye||{}),De=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(De||{});const zt=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),tt=({"userleap-platform":e})=>e!==Ye.Web,K=(e,t)=>{const n=t?x.MobileSuffix:x.DesktopSuffix;return[e+n,e]},Ie=(e,t)=>[e,`${e}__${t}`];class lc{constructor(t){re(this,"payload");re(this,"promise");re(this,"reject",()=>{});re(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const cc={RATELIMIT_RESET_DEFAULT:10};let ii=!1,si="",Ot=!1,Dt=[];const dc=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?De.Gtm:e._segment?De.Segment:De.Snippet,Pn=(e="")=>{ii=!0,si=e};function It(e={}){const t={"Content-Type":"application/json","userleap-platform":Ye.Web,"x-ul-sdk-version":"2.23.1",[ye.InstallationMethod]:dc(e)};if(e.envId&&(t[ye.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[ye.UserID]=e.userId),e.visitorId&&(t[ye.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[ye.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[ye.PreviewMode]="1"),t}const Qr=async(e,t,n)=>{if(e)return{status:429};{const r=new lc(n);return Dt.push(r),r.promise}},be=async(e,t,n=0,r=!1,o=!1)=>{const i={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Ot&&!o)return Qr(r,o,i);const s={ok:!1,reportError:!1};if(ii)return console.info(`UserLeap - ${si}`),s;try{t.headers=Object.assign(It(),t.headers);const a=await fetch(e,t);if(a.status===429)if(!Ot&&!r||o){Ot=!0;const l=a.headers.has("ratelimit-reset")?Number(a.headers.get("ratelimit-reset")):cc.RATELIMIT_RESET_DEFAULT;return await zt(l*1e3),be(e,t,0,r,!0)}else return Qr(r,!1,i);if(Ot=!1,Dt.length&&(Dt.map(c=>{const{url:l,options:d,attempt:h,shouldDropOnRateLimit:u}=c.payload;be(l,d,h,u).then(p=>{c.resolveRequest(p)})}),Dt=[]),a.ok){if(a.status===249)return Pn(),s;const c=await a.text();try{return c&&c!=="OK"&&(a.json=JSON.parse(c)),a}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${c}`)}}}return a}catch(a){const c=n+1;return c>5?{ok:!1,reportError:!1,error:a}:(await zt(Math.pow(2,n)*1e3),be(e,t,c))}};var ai={exports:{}};(function(e,t){(function(n,r){e.exports=r()})($,function(){var n=function(i,s){if(s=s||{},typeof i!="function")throw new o("fetch must be a function");if(typeof s!="object")throw new o("defaults must be an object");if(s.retries!==void 0&&!r(s.retries))throw new o("retries must be a positive integer");if(s.retryDelay!==void 0&&!r(s.retryDelay)&&typeof s.retryDelay!="function")throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new o("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(a,s),function(l,d){var h=s.retries,u=s.retryDelay,p=s.retryOn;if(d&&d.retries!==void 0)if(r(d.retries))h=d.retries;else throw new o("retries must be a positive integer");if(d&&d.retryDelay!==void 0)if(r(d.retryDelay)||typeof d.retryDelay=="function")u=d.retryDelay;else throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(d&&d.retryOn)if(Array.isArray(d.retryOn)||typeof d.retryOn=="function")p=d.retryOn;else throw new o("retryOn property expects an array or function");return new Promise(function(m,v){var g=function(_){var C=typeof Request<"u"&&l instanceof Request?l.clone():l;i(C,d).then(function(E){if(Array.isArray(p)&&p.indexOf(E.status)===-1)m(E);else if(typeof p=="function")try{return Promise.resolve(p(_,null,E)).then(function(I){I?w(_,null,E):m(E)}).catch(v)}catch(I){v(I)}else _<h?w(_,null,E):m(E)}).catch(function(E){if(typeof p=="function")try{Promise.resolve(p(_,E,null)).then(function(I){I?w(_,E,null):v(E)}).catch(function(I){v(I)})}catch(I){v(I)}else _<h?w(_,E,null):v(E)})};function w(_,C,E){var I=typeof u=="function"?u(_,C,E):u;setTimeout(function(){g(++_)},I)}g(0)})}};function r(i){return Number.isInteger(i)&&i>=0}function o(i){this.name="ArgumentError",this.message=i}return n})})(ai);const uc=ai.exports;class pc{constructor(t){re(this,"awaitingResolvers",[]);re(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const li=new pc(2),fc=e=>li.setLimit(e),hc=uc(fetch),mc=async(e,t=3)=>li.execute(async()=>{const r=(await hc(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:o=>Math.pow(2,o)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),vc=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:o,responseGroupUuid:i,replayDuration:s})=>be(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:i,surveyId:t,replayDuration:s}),headers:o}),gc=(e,t)=>t.some(n=>e instanceof n);let Zr,Jr;function _c(){return Zr||(Zr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function yc(){return Jr||(Jr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ci=new WeakMap,jn=new WeakMap,di=new WeakMap,_n=new WeakMap,fr=new WeakMap;function wc(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{n(Pe(e.result)),o()},s=()=>{r(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(n=>{n instanceof IDBCursor&&ci.set(n,e)}).catch(()=>{}),fr.set(t,e),t}function Ec(e){if(jn.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{n(),o()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});jn.set(e,t)}let Vn={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return jn.get(e);if(t==="objectStoreNames")return e.objectStoreNames||di.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Pe(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function bc(e){Vn=e(Vn)}function Cc(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(yn(this),t,...n);return di.set(r,t.sort?t.sort():[t]),Pe(r)}:yc().includes(e)?function(...t){return e.apply(yn(this),t),Pe(ci.get(this))}:function(...t){return Pe(e.apply(yn(this),t))}}function xc(e){return typeof e=="function"?Cc(e):(e instanceof IDBTransaction&&Ec(e),gc(e,_c())?new Proxy(e,Vn):e)}function Pe(e){if(e instanceof IDBRequest)return wc(e);if(_n.has(e))return _n.get(e);const t=xc(e);return t!==e&&(_n.set(e,t),fr.set(t,e)),t}const yn=e=>fr.get(e);function Sc(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const s=indexedDB.open(e,t),a=Pe(s);return r&&s.addEventListener("upgradeneeded",c=>{r(Pe(s.result),c.oldVersion,c.newVersion,Pe(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),o&&c.addEventListener("versionchange",l=>o(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const Ic=["get","getKey","getAll","getAllKeys","count"],kc=["put","add","delete","clear"],wn=new Map;function Xr(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(wn.get(t))return wn.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=kc.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||Ic.includes(n)))return;const i=async function(s,...a){const c=this.transaction(s,o?"readwrite":"readonly");let l=c.store;return r&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),o&&c.done]))[0]};return wn.set(t,i),i}bc(e=>({...e,get:(t,n,r)=>Xr(t,n)||e.get(t,n,r),has:(t,n)=>!!Xr(t,n)||e.has(t,n)}));var xe=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(xe||{}),Et=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Et||{});const Mn="sprig.sessionId",ui="sprig.disableReplayRecording",A={name:"sprig.replay",version:2,tables:{events:{name:"events",indices:{session_timestamp:"session_timestamp",timestamp:"timestamp"}},chunkUploads:{name:"chunkUploads",indices:{timestamp:"timestamp",upload_status:"upload_status",session_status:"session_status",session_status_upload:"session_status_upload"}},pendingCaptures:{name:"pendingCaptures",indices:{timestamp:"timestamp",session_targetTimestamp:"session_targetTimestamp"}}}},Lc=()=>{sessionStorage.setItem(ui,"disabled")},Wt=()=>!!sessionStorage.getItem(ui),Z=async(e,t)=>{var r,o;const n=(o=(r=window.navigator)==null?void 0:r.storage)!=null&&o.estimate?await window.navigator.storage.estimate():{};await Uc(),ee=Promise.resolve(void 0),Lc(),t instanceof Error&&window.UserLeap.reportError(e,t,n)},Tc=()=>{const e=sessionStorage.getItem(Mn);return e?(sessionStorage.removeItem(Mn),e):je()},ne=Tc();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(Mn,ne)});const Rc=async()=>{if(!Wt())try{return Sc(A.name,A.version,{upgrade:(e,t)=>{if(!t){const n=e.createObjectStore(A.tables.events.name,{keyPath:"uuid"});n.createIndex(A.tables.events.indices.session_timestamp,["sessionId","timestamp"]),n.createIndex(A.tables.events.indices.timestamp,"timestamp");const r=e.createObjectStore(A.tables.chunkUploads.name,{keyPath:"uuid"});r.createIndex(A.tables.chunkUploads.indices.session_status,["sessionId","status"]),r.createIndex(A.tables.chunkUploads.indices.upload_status,["uploadId","status"]),r.createIndex(A.tables.chunkUploads.indices.session_status_upload,["sessionId","status","uploadId"]),r.createIndex(A.tables.chunkUploads.indices.timestamp,"timestamp")}if(!t||t<2){const n=e.createObjectStore(A.tables.pendingCaptures.name,{keyPath:"uuid"});n.createIndex(A.tables.pendingCaptures.indices.session_targetTimestamp,["sessionId","targetTimestamp"]),n.createIndex(A.tables.pendingCaptures.indices.timestamp,"timestamp")}}})}catch(e){await Z("error initializing storage",e)}};let ee=Rc();const Uc=async()=>{const e=await ee;if(!!e)try{return Promise.all([e.clear(A.tables.events.name),e.clear(A.tables.chunkUploads.name),e.clear(A.tables.pendingCaptures.name)])}catch(t){await Z("Error clearing all storage: ",t)}},Ac=async e=>{const t=await ee;try{const n=t==null?void 0:t.transaction(A.tables.events.name,"readwrite");return Promise.all([...e.map(r=>n==null?void 0:n.store.put({...r,sessionId:r.sessionId||ne})),n==null?void 0:n.done])}catch(n){await Z("Error storing replay events: ",n)}},Oc=async e=>{const t=await ee;try{return await(t==null?void 0:t.getAllFromIndex(A.tables.events.name,A.tables.events.indices.session_timestamp,IDBKeyRange.bound([ne,e],[ne,Number.MAX_VALUE])))}catch(n){await Z("Error retrieving events: ",n)}},Nc=async(e,t)=>{const n=await ee;try{return n==null?void 0:n.getAllKeysFromIndex(t,"timestamp",IDBKeyRange.upperBound(e-1))}catch(r){await Z("Error retrieving row keys: ",r)}},Fn=async(e,t)=>{if(!t||!t.length)return;const n=await ee,r=n==null?void 0:n.transaction(e,"readwrite");return Promise.all([...t.map(async o=>{try{await(r==null?void 0:r.store.delete(o))}catch(i){await Z("Error deleting row keys: ",i)}}),r==null?void 0:r.done])},hr=async(e,t)=>{const n=await Nc(e,t);await Fn(t,n)},Dc=async e=>{await hr(e,A.tables.events.name)},Pc=async e=>{await hr(e,A.tables.chunkUploads.name)},jc=async e=>{await hr(e,A.tables.pendingCaptures.name)},Vc=async()=>{const e=await ee;try{const t=await(e==null?void 0:e.getAllKeysFromIndex(A.tables.events.name,A.tables.events.indices.session_timestamp,IDBKeyRange.bound([ne,Number.MIN_VALUE],[ne,Number.MAX_VALUE]))),n=await(e==null?void 0:e.getAllKeysFromIndex(A.tables.pendingCaptures.name,A.tables.pendingCaptures.indices.session_targetTimestamp,IDBKeyRange.bound([ne,Number.MIN_VALUE],[ne,Number.MAX_VALUE])));await Promise.all([Fn(A.tables.events.name,t),Fn(A.tables.pendingCaptures.name,n)])}catch(t){await Z("Error clearing session event data: ",t)}},Mc=async e=>{const t=await ee;try{return t==null?void 0:t.put(A.tables.chunkUploads.name,{...e,sessionId:e.sessionId||ne,etag:null})}catch(n){await Z("Error creating upload event record: ",n)}},Fc=async(e,t)=>{const n=await ee;try{const r=await(n==null?void 0:n.get(A.tables.chunkUploads.name,e));if(r)return n==null?void 0:n.put(A.tables.chunkUploads.name,{...r,data:null,etag:t,status:xe.UploadComplete})}catch(r){await Z("Error marking chunk upload complete: ",r)}},Bc=async e=>{const t=await ee;if(t)try{return await t.countFromIndex(A.tables.chunkUploads.name,A.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,xe.ReadyForUpload],[e,xe.ReadyForUpload]))>0}catch(n){await Z("Error checking incomplete chunk upload: ",n)}},Hc=async()=>{const e=await ee;try{const t=await(e==null?void 0:e.getAllFromIndex(A.tables.chunkUploads.name,A.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([ne,xe.UploadComplete],[ne,xe.UploadComplete]))),n=t==null?void 0:t.reduce((i,s)=>(i.add(s.uploadId),i),new Set),r=Array.from(n),o=await Promise.all(r.map(async i=>Bc(i)));return r.filter((i,s)=>!o[s])}catch(t){await Z("Error getting upload ids: ",t)}},$c=async({status:e,uploadId:t})=>{const n=await ee;try{return n==null?void 0:n.getAllKeysFromIndex(A.tables.chunkUploads.name,t?A.tables.chunkUploads.indices.upload_status:A.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([t||ne,e],[t||ne,e]))}catch(r){await Z("Error getting chunk upload uuids: ",r)}},qc=async e=>{const t=await ee;try{return t==null?void 0:t.get(A.tables.chunkUploads.name,e)}catch(n){await Z("Error getting chunk for uuid: ",n)}},Gc=async e=>{const t=await ee;try{return t==null?void 0:t.getAllFromIndex(A.tables.chunkUploads.name,A.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,xe.UploadComplete],[e,xe.UploadComplete]))}catch(n){await Z("Error getting finished chunk: ",n)}},zc=async e=>{const t=await ee;try{return t==null?void 0:t.put(A.tables.pendingCaptures.name,{...e,sessionId:e.sessionId||ne})}catch(n){await Z("Error creating pending capture: ",n)}},Wc=async e=>{const t=await ee;try{return t==null?void 0:t.delete(A.tables.pendingCaptures.name,e)}catch(n){await Z("Error deleting pending capture record: ",n)}},Kc=async()=>{const e=await ee;try{return await(e==null?void 0:e.getAllFromIndex(A.tables.pendingCaptures.name,A.tables.pendingCaptures.indices.session_targetTimestamp,IDBKeyRange.bound([ne,Number.MIN_VALUE],[ne,Date.now()])))}catch(t){await Z("Error getting pending captures: ",t)}},Yc=async(e,t,n)=>new Promise((r,o)=>{const i=e.createElement("script");i.src=t,i.onload=r,i.onerror=o,n&&(i.nonce=n),e.head.appendChild(i)});let pi=5e3;const Qc=5,fi=30,hi=fi+Qc,Zc=async(e,t,n,r=2,o)=>{if(!t||Wt())return;o!=null&&o.minDuration&&(pi=o.minDuration),fc(r),id(),ed(t+hi),td();const i=window;i.rrwebRecord||await Yc(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const s=i.rrwebRecord;if(!s)return;let a=!0;s({checkoutEveryNms:fi*1e3,sampling:{input:"last",scroll:250,media:800},emit:(c,l)=>{if(Wt())return;const d=a||!!l;a=!1,Jc({uuid:je(),event:JSON.stringify(c),isValidStart:d,timestamp:Date.now()})},...o})};let Bn=!1,Hn=[];const Jc=e=>{Hn.push(e),Bn||Xc()},Xc=()=>{Bn=!0,setTimeout(async()=>{if(Wt())return;const e=Hn;Hn=[],Bn=!1,await Ac(e)},500)},ed=(e=6*60,t=30*60,n=4*60)=>{setInterval(async()=>{const r=Date.now();await Promise.all([Dc(r-e*1e3),Pc(r-t*1e3),jc(r-n*1e3)])},30*1e3)},td=async(e=5)=>{setInterval(cd,e*1e3)},nd=async e=>{const t=await Oc(Date.now()-(e+hi)*1e3);if(!(t!=null&&t.length))return;let n=-1;const r=Date.now()-e*1e3;return t==null||t.forEach((o,i)=>{if(!o.isValidStart)return;const s=o.timestamp<=r;(n<0||s)&&(n=i)}),n<0?[]:t==null?void 0:t.slice(n)},rd=async e=>{const t=`[${e.map(o=>o.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const o=new CompressionStream("gzip"),i=o.writable.getWriter();return i.write(r),i.close(),new Uint8Array(await new Response(o.readable).arrayBuffer())}catch(o){return o instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",o),r}},od=(e,t,n)=>{const r=e.length,o=t*1024*1024,i=Math.ceil(r/n),s=Math.max(o,i),a=[];let c=0;for(;c<r;)a.push(e.slice(c,c+s)),c+=s;return a},mi=async e=>{await Promise.all(e.map(async t=>{const n=await qc(t),r=await mc(n);await Fc(n.uuid,r)}))},vi=async e=>{const t=await Gc(e);if(!(t!=null&&t.length))return;t.sort((o,i)=>o.chunkIndex-i.chunkIndex);const n=t.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),r=t[0];await vc({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration})},id=async()=>{const e=await $c({status:xe.ReadyForUpload});if(!(e!=null&&e.length))return;await mi(e);const t=await Hc();t&&await Promise.all(t.map(n=>vi(n)))},sd=async(e,t)=>{await mi(t),await Promise.all(e.map(n=>vi(n)))},gi=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:o,completeUploadHeaders:i,replayParams:s}=e;if(await ad(),s.replayDurationType===Et.After||s.replayDurationType===Et.BeforeAndAfter)return ld(e);const a=await nd(s.replayDurationSeconds);if(!(a!=null&&a.length))return;const c=a[a.length-1].timestamp-a[0].timestamp;if(c<=pi)return;const l=await rd(a),d=od(l,s.minimumChunkSizeMb,s.signedUrls.length),h=Date.now();let u=[];try{u=await Promise.all(d.map(async(p,m)=>{const v=je();return await Mc({uuid:v,chunkIndex:m+1,totalChunks:d.length,timestamp:h,surveyId:t,responseGroupId:n,status:xe.ReadyForUpload,data:p,visitorId:r,uploadId:s.uploadId,uploadUrl:s.signedUrls[m].url,apiUrl:o,completeUploadHeaders:i,replayDuration:c}),v}))}catch(p){await Z("Error storing replay data",p);return}await sd([s.uploadId],u)};let Kt=null;const ad=async()=>{Kt&&await Kt},eo=async()=>(Kt=Vc(),Kt),ld=async e=>{const t={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Et.BeforeAndAfter&&(t.replayParams.replayDurationSeconds*=2),t.replayParams.replayDurationType=Et.Before;const n=Date.now()+e.replayParams.replayDurationSeconds*1e3;return zc({uuid:je(),targetTimestamp:n,timestamp:Date.now(),captureParams:t})},cd=async()=>{const e=await Kc();e&&await Promise.all(e.map(async t=>{await Wc(t.uuid),await gi(t.captureParams)}))};var kt,k,_i,it,qe,to,yi,wi,Yt={},Ei=[],dd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Te(e,t){for(var n in t)e[n]=t[n];return e}function bi(e){var t=e.parentNode;t&&t.removeChild(e)}function z(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?kt.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 _t(e,s,r,o,null)}function _t(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,__h:null,constructor:void 0,__v:o==null?++_i:o};return o==null&&k.vnode!=null&&k.vnode(i),i}function Ci(){return{current:null}}function ge(e){return e.children}function ud(e,t,n,r,o){var i;for(i in n)i==="children"||i==="key"||i in t||Qt(e,i,null,n[i],r);for(i in t)o&&typeof t[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||n[i]===t[i]||Qt(e,i,t[i],n[i],r)}function no(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||dd.test(t)?n:n+"px"}function Qt(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||no(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||no(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?oo:ro,i):e.removeEventListener(t,i?oo:ro,i);else if(t!=="dangerouslySetInnerHTML"){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 in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function ro(e){it=!0;try{return this.l[e.type+!1](k.event?k.event(e):e)}finally{it=!1}}function oo(e){it=!0;try{return this.l[e.type+!0](k.event?k.event(e):e)}finally{it=!1}}function me(e,t){this.props=e,this.context=t}function bt(e,t){if(t==null)return e.__?bt(e.__,e.__.__k.indexOf(e)+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"?bt(e):null}function xi(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 xi(e)}}function pd(e){it?setTimeout(e):yi(e)}function $n(e){(!e.__d&&(e.__d=!0)&&qe.push(e)&&!Zt.__r++||to!==k.debounceRendering)&&((to=k.debounceRendering)||pd)(Zt)}function Zt(){var e,t,n,r,o,i,s,a;for(qe.sort(function(c,l){return c.__v.__b-l.__v.__b});e=qe.shift();)e.__d&&(t=qe.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=Te({},i)).__v=i.__v+1,mr(a,i,o,n.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,r,s==null?bt(i):s,i.__h),Ti(r,i),i.__e!=s&&xi(i)),qe.length>t&&qe.sort(function(c,l){return c.__v.__b-l.__v.__b}));Zt.__r=0}function Si(e,t,n,r,o,i,s,a,c,l){var d,h,u,p,m,v,g,w=r&&r.__k||Ei,_=w.length;for(n.__k=[],d=0;d<t.length;d++)if((p=n.__k[d]=(p=t[d])==null||typeof p=="boolean"?null:typeof p=="string"||typeof p=="number"||typeof p=="bigint"?_t(null,p,null,null,p):Array.isArray(p)?_t(ge,{children:p},null,null,null):p.__b>0?_t(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)!=null){if(p.__=n,p.__b=n.__b+1,(u=w[d])===null||u&&p.key==u.key&&p.type===u.type)w[d]=void 0;else for(h=0;h<_;h++){if((u=w[h])&&p.key==u.key&&p.type===u.type){w[h]=void 0;break}u=null}mr(e,p,u=u||Yt,o,i,s,a,c,l),m=p.__e,(h=p.ref)&&u.ref!=h&&(g||(g=[]),u.ref&&g.push(u.ref,null,p),g.push(h,p.__c||m,p)),m!=null?(v==null&&(v=m),typeof p.type=="function"&&p.__k===u.__k?p.__d=c=Ii(p,c,e):c=ki(e,p,u,w,m,c),typeof n.type=="function"&&(n.__d=c)):c&&u.__e==c&&c.parentNode!=e&&(c=bt(u))}for(n.__e=v,d=_;d--;)w[d]!=null&&(typeof n.type=="function"&&w[d].__e!=null&&w[d].__e==n.__d&&(n.__d=Li(r).nextSibling),Ui(w[d],w[d]));if(g)for(d=0;d<g.length;d++)Ri(g[d],g[++d],g[++d])}function Ii(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t=typeof r.type=="function"?Ii(r,t,n):ki(n,r,r,o,r.__e,t));return t}function Re(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Re(n,t)}):t.push(e)),t}function ki(e,t,n,r,o,i){var s,a,c;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(n==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,c=0;(a=a.nextSibling)&&c<r.length;c+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function Li(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=Li(n)))return r}return null}function mr(e,t,n,r,o,i,s,a,c){var l,d,h,u,p,m,v,g,w,_,C,E,I,N,b,U=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=k.__b)&&l(t);try{e:if(typeof U=="function"){if(g=t.props,w=(l=U.contextType)&&r[l.__c],_=l?w?w.props.value:l.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:("prototype"in U&&U.prototype.render?t.__c=d=new U(g,_):(t.__c=d=new me(g,_),d.constructor=U,d.render=hd),w&&w.sub(d),d.props=g,d.state||(d.state={}),d.context=_,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),U.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Te({},d.__s)),Te(d.__s,U.getDerivedStateFromProps(g,d.__s))),u=d.props,p=d.state,d.__v=t,h)U.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(U.getDerivedStateFromProps==null&&g!==u&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,_),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,_)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(R){R&&(R.__=t)}),C=0;C<d._sb.length;C++)d.__h.push(d._sb[C]);d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(g,d.__s,_),d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(u,p,m)})}if(d.context=_,d.props=g,d.__P=e,E=k.__r,I=0,"prototype"in U&&U.prototype.render){for(d.state=d.__s,d.__d=!1,E&&E(t),l=d.render(d.props,d.state,d.context),N=0;N<d._sb.length;N++)d.__h.push(d._sb[N]);d._sb=[]}else do d.__d=!1,E&&E(t),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++I<25);d.state=d.__s,d.getChildContext!=null&&(r=Te(Te({},r),d.getChildContext())),h||d.getSnapshotBeforeUpdate==null||(m=d.getSnapshotBeforeUpdate(u,p)),b=l!=null&&l.type===ge&&l.key==null?l.props.children:l,Si(e,Array.isArray(b)?b:[b],t,n,r,o,i,s,a,c),d.base=t.__e,t.__h=null,d.__h.length&&s.push(d),v&&(d.__E=d.__=null),d.__e=!1}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=fd(n.__e,t,n,r,o,i,s,c);(l=k.diffed)&&l(t)}catch(R){t.__v=null,(c||i!=null)&&(t.__e=a,t.__h=!!c,i[i.indexOf(a)]=null),k.__e(R,t,n)}}function Ti(e,t){k.__c&&k.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){k.__e(r,n.__v)}})}function fd(e,t,n,r,o,i,s,a){var c,l,d,h=n.props,u=t.props,p=t.type,m=0;if(p==="svg"&&(o=!0),i!=null){for(;m<i.length;m++)if((c=i[m])&&"setAttribute"in c==!!p&&(p?c.localName===p:c.nodeType===3)){e=c,i[m]=null;break}}if(e==null){if(p===null)return document.createTextNode(u);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,u.is&&u),i=null,a=!1}if(p===null)h===u||a&&e.data===u||(e.data=u);else{if(i=i&&kt.call(e.childNodes),l=(h=n.props||Yt).dangerouslySetInnerHTML,d=u.dangerouslySetInnerHTML,!a){if(i!=null)for(h={},m=0;m<e.attributes.length;m++)h[e.attributes[m].name]=e.attributes[m].value;(d||l)&&(d&&(l&&d.__html==l.__html||d.__html===e.innerHTML)||(e.innerHTML=d&&d.__html||""))}if(ud(e,u,h,o,a),d)t.__k=[];else if(m=t.props.children,Si(e,Array.isArray(m)?m:[m],t,n,r,o&&p!=="foreignObject",i,s,i?i[0]:n.__k&&bt(n,0),a),i!=null)for(m=i.length;m--;)i[m]!=null&&bi(i[m]);a||("value"in u&&(m=u.value)!==void 0&&(m!==e.value||p==="progress"&&!m||p==="option"&&m!==h.value)&&Qt(e,"value",m,h.value,!1),"checked"in u&&(m=u.checked)!==void 0&&m!==e.checked&&Qt(e,"checked",m,h.checked,!1))}return e}function Ri(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){k.__e(r,n)}}function Ui(e,t,n){var r,o;if(k.unmount&&k.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Ri(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){k.__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]&&Ui(r[o],t,n||typeof e.type!="function");n||e.__e==null||bi(e.__e),e.__=e.__e=e.__d=void 0}function hd(e,t,n){return this.constructor(e,n)}function st(e,t,n){var r,o,i;k.__&&k.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],mr(t,e=(!r&&n||t).__k=z(ge,null,[e]),o||Yt,Yt,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?kt.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r),Ti(i,e)}function Ai(e,t){st(e,t,Ai)}function md(e,t,n){var r,o,i,s=Te({},e.props);for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?kt.call(arguments,2):n),_t(e.type,s,r||e.key,o||e.ref,null)}function Oi(e,t){var n={__c:t="__cC"+wi++,__: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(a){a.__e=!0,$n(a)})},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}kt=Ei.slice,k={__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(a){e=a}throw e}},_i=0,it=!1,me.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Te({},this.state),typeof e=="function"&&(e=e(Te({},n),this.props)),e&&Te(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),$n(this))},me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$n(this))},me.prototype.render=ge,qe=[],yi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Zt.__r=0,wi=0;var L=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(L||{}),Ke=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Ke||{}),at=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(at||{}),le=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(le||{}),We=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(We||{}),fe=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(fe||{}),te=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(te||{}),ve=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(ve||{}),V=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))(V||{});const io=e=>{let t;const n=new Set,r=(c,l)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=(l!=null?l:typeof d!="object")?d:Object.assign({},t,d),n.forEach(u=>u(t,h))}},o=()=>t,a={setState:r,getState:o,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return t=e(r,o,a),a},vd=e=>e?io(e):io;var Fe,q,En,so,lt=0,Ni=[],Pt=[],ao=k.__b,lo=k.__r,co=k.diffed,uo=k.__c,po=k.unmount;function Ze(e,t){k.__h&&k.__h(q,e,lt||t),lt=0;var n=q.__H||(q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Pt}),n.__[e]}function X(e){return lt=1,vr(Mi,e)}function vr(e,t,n){var r=Ze(Fe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Mi(void 0,t),function(i){var s=r.__N?r.__N[0]:r.__[0],a=r.t(s,i);s!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=q,!q.u)){q.u=!0;var o=q.shouldComponentUpdate;q.shouldComponentUpdate=function(i,s,a){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(d){return d.__c});if(c.every(function(d){return!d.__N}))return!o||o.call(this,i,s,a);var l=!1;return c.forEach(function(d){if(d.__N){var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(l=!0)}}),!(!l&&r.__c.props===i)&&(!o||o.call(this,i,s,a))}}return r.__N||r.__}function ce(e,t){var n=Ze(Fe++,3);!k.__s&&_r(n.__H,t)&&(n.__=e,n.i=t,q.__H.__h.push(n))}function Lt(e,t){var n=Ze(Fe++,4);!k.__s&&_r(n.__H,t)&&(n.__=e,n.i=t,q.__h.push(n))}function Ve(e){return lt=5,sn(function(){return{current:e}},[])}function Di(e,t,n){lt=6,Lt(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 sn(e,t){var n=Ze(Fe++,7);return _r(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Pi(e,t){return lt=8,sn(function(){return e},t)}function ji(e){var t=q.context[e.__c],n=Ze(Fe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(q)),t.props.value):e.__}function gr(e,t){k.useDebugValue&&k.useDebugValue(t?t(e):e)}function gd(e){var t=Ze(Fe++,10),n=X();return t.__=e,q.componentDidCatch||(q.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function Vi(){var e=Ze(Fe++,11);if(!e.__){for(var t=q.__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 _d(){for(var e;e=Ni.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(jt),e.__H.__h.forEach(qn),e.__H.__h=[]}catch(t){e.__H.__h=[],k.__e(t,e.__v)}}k.__b=function(e){q=null,ao&&ao(e)},k.__r=function(e){lo&&lo(e),Fe=0;var t=(q=e.__c).__H;t&&(En===q?(t.__h=[],q.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Pt,n.__N=n.i=void 0})):(t.__h.forEach(jt),t.__h.forEach(qn),t.__h=[])),En=q},k.diffed=function(e){co&&co(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ni.push(t)!==1&&so===k.requestAnimationFrame||((so=k.requestAnimationFrame)||yd)(_d)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Pt&&(n.__=n.__V),n.i=void 0,n.__V=Pt})),En=q=null},k.__c=function(e,t){t.some(function(n){try{n.__h.forEach(jt),n.__h=n.__h.filter(function(r){return!r.__||qn(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],k.__e(r,n.__v)}}),uo&&uo(e,t)},k.unmount=function(e){po&&po(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{jt(r)}catch(o){t=o}}),n.__H=void 0,t&&k.__e(t,n.__v))};var fo=typeof requestAnimationFrame=="function";function yd(e){var t,n=function(){clearTimeout(r),fo&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);fo&&(t=requestAnimationFrame(n))}function jt(e){var t=q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),q=t}function qn(e){var t=q;e.__c=e.__(),q=t}function _r(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Mi(e,t){return typeof t=="function"?t(e):t}function Fi(e,t){for(var n in t)e[n]=t[n];return e}function Gn(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 bn(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Jt(e){this.props=e}function Bi(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:Gn(this.props,o)}function r(o){return this.shouldComponentUpdate=n,z(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Jt.prototype=new me).isPureReactComponent=!0,Jt.prototype.shouldComponentUpdate=function(e,t){return Gn(this.props,e)||Gn(this.state,t)};var ho=k.__b;k.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ho&&ho(e)};var wd=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Hi(e){function t(n){var r=Fi({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=wd,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var mo=function(e,t){return e==null?null:Re(Re(e).map(t))},$i={map:mo,forEach:mo,count:function(e){return e?Re(e).length:0},only:function(e){var t=Re(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Re},Ed=k.__e;k.__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)}Ed(e,t,n,r)};var vo=k.unmount;function qi(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=Fi({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return qi(r,t,n)})),e}function Gi(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Gi(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function yt(){this.__u=0,this.t=null,this.__b=null}function zi(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Wi(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 z(n,i)}return o.displayName="Lazy",o.__f=!0,o}function Xe(){this.u=null,this.o=null}k.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),vo&&vo(e)},(yt.prototype=new me).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=zi(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Gi(l,l.__c.__P,l.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.t.pop();)d.forceUpdate()}},c=t.__h===!0;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},yt.prototype.componentWillUnmount=function(){this.t=[]},yt.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]=qi(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&z(ge,null,e.fallback);return o&&(o.__h=null),[z(ge,null,t.__a?null:e.children),o]};var go=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 bd(e){return this.getChildContext=function(){return e.context},e.children}function Cd(e){var t=this,n=e.i;t.componentWillUnmount=function(){st(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(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)}}),st(z(bd,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function Ki(e,t){var n=z(Cd,{__v:e,i:t});return n.containerInfo=t,n}(Xe.prototype=new me).__a=function(e){var t=this,n=zi(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),go(t,e,r)):o()};n?n(i):i()}},Xe.prototype.render=function(e){this.u=null,this.o=new Map;var t=Re(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},Xe.prototype.componentDidUpdate=Xe.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){go(e,n,t)})};var Yi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,xd=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|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]/,Sd=typeof document<"u",Id=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Qi(e,t,n){return t.__k==null&&(t.textContent=""),st(e,t),typeof n=="function"&&n(),e?e.__c:null}function Zi(e,t,n){return Ai(e,t),typeof n=="function"&&n(),e?e.__c:null}me.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(me.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var _o=k.event;function kd(){}function Ld(){return this.cancelBubble}function Td(){return this.defaultPrevented}k.event=function(e){return _o&&(e=_o(e)),e.persist=kd,e.isPropagationStopped=Ld,e.isDefaultPrevented=Td,e.nativeEvent=e};var Ji,yo={configurable:!0,get:function(){return this.class}},wo=k.vnode;k.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var o=t.indexOf("-")===-1;for(var i in r={},n){var s=n[i];Sd&&i==="children"&&t==="noscript"||i==="value"&&"defaultValue"in n&&s==null||(i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!Id(n.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&xd.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),r[i]&&(i="oninputCapture")),r[i]=s)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Re(n.children).forEach(function(a){a.props.selected=r.value.indexOf(a.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Re(n.children).forEach(function(a){a.props.selected=r.multiple?r.defaultValue.indexOf(a.props.value)!=-1:r.defaultValue==a.props.value})),e.props=r,n.class!=n.className&&(yo.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",yo))}e.$$typeof=Yi,wo&&wo(e)};var Eo=k.__r;k.__r=function(e){Eo&&Eo(e),Ji=e.__c};var Xi={ReactCurrentDispatcher:{current:{readContext:function(e){return Ji.__n[e.__c].props.value}}}},Rd="17.0.2";function es(e){return z.bind(null,e)}function yr(e){return!!e&&e.$$typeof===Yi}function ts(e){return yr(e)?md.apply(null,arguments):e}function ns(e){return!!e.__k&&(st(null,e),!0)}function rs(e){return e&&(e.base||e.nodeType===1&&e)||null}var os=function(e,t){return e(t)},is=function(e,t){return e(t)},ss=ge;function wr(e){e()}function as(e){return e}function ls(){return[!1,wr]}var cs=Lt;function ds(e,t){var n=t(),r=X({h:{__:n,v:t}}),o=r[0].h,i=r[1];return Lt(function(){o.__=n,o.v=t,bn(o.__,t())||i({h:o})},[e,n,t]),ce(function(){return bn(o.__,o.v())||i({h:o}),e(function(){bn(o.__,o.v())||i({h:o})})},[e]),n}var Ud={useState:X,useId:Vi,useReducer:vr,useEffect:ce,useLayoutEffect:Lt,useInsertionEffect:cs,useTransition:ls,useDeferredValue:as,useSyncExternalStore:ds,startTransition:wr,useRef:Ve,useImperativeHandle:Di,useMemo:sn,useCallback:Pi,useContext:ji,useDebugValue:gr,version:"17.0.2",Children:$i,render:Qi,hydrate:Zi,unmountComponentAtNode:ns,createPortal:Ki,createElement:z,createContext:Oi,createFactory:es,cloneElement:ts,createRef:Ci,Fragment:ge,isValidElement:yr,findDOMNode:rs,Component:me,PureComponent:Jt,memo:Bi,forwardRef:Hi,flushSync:is,unstable_batchedUpdates:os,StrictMode:ss,Suspense:yt,SuspenseList:Xe,lazy:Wi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Xi};const Ad=Object.freeze(Object.defineProperty({__proto__:null,Children:$i,PureComponent:Jt,StrictMode:ss,Suspense:yt,SuspenseList:Xe,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Xi,cloneElement:ts,createFactory:es,createPortal:Ki,default:Ud,findDOMNode:rs,flushSync:is,forwardRef:Hi,hydrate:Zi,isValidElement:yr,lazy:Wi,memo:Bi,render:Qi,startTransition:wr,unmountComponentAtNode:ns,unstable_batchedUpdates:os,useDeferredValue:as,useInsertionEffect:cs,useSyncExternalStore:ds,useTransition:ls,version:Rd,Component:me,Fragment:ge,createContext:Oi,createElement:z,createRef:Ci,useCallback:Pi,useContext:ji,useDebugValue:gr,useEffect:ce,useErrorBoundary:gd,useId:Vi,useImperativeHandle:Di,useLayoutEffect:Lt,useMemo:sn,useReducer:vr,useRef:Ve,useState:X},Symbol.toStringTag,{value:"Module"}));var us={exports:{}},ps={};const fs=Qs(Ad);var hs={exports:{}},ms={};/**
|
|
2
3
|
* @license React
|
|
3
4
|
* use-sync-external-store-shim.production.min.js
|
|
4
5
|
*
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
*
|
|
7
8
|
* This source code is licensed under the MIT license found in the
|
|
8
9
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
10
|
+
*/var ct=fs;function Od(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nd=typeof Object.is=="function"?Object.is:Od,Dd=ct.useState,Pd=ct.useEffect,jd=ct.useLayoutEffect,Vd=ct.useDebugValue;function Md(e,t){var n=t(),r=Dd({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return jd(function(){o.value=n,o.getSnapshot=t,Cn(o)&&i({inst:o})},[e,n,t]),Pd(function(){return Cn(o)&&i({inst:o}),e(function(){Cn(o)&&i({inst:o})})},[e]),Vd(n),n}function Cn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nd(e,n)}catch{return!0}}function Fd(e,t){return t()}var Bd=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Fd:Md;ms.useSyncExternalStore=ct.useSyncExternalStore!==void 0?ct.useSyncExternalStore:Bd;(function(e){e.exports=ms})(hs);/**
|
|
10
11
|
* @license React
|
|
11
12
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
12
13
|
*
|
|
@@ -14,18 +15,18 @@
|
|
|
14
15
|
*
|
|
15
16
|
* This source code is licensed under the MIT license found in the
|
|
16
17
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var At=Oo,aa=Mo.exports;function la(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ca=typeof Object.is=="function"?Object.is:la,da=aa.useSyncExternalStore,ua=At.useRef,pa=At.useEffect,fa=At.useMemo,ma=At.useDebugValue;jo.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=ua(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=fa(function(){function c(f){if(!d){if(d=!0,l=f,f=r(f),o!==void 0&&s.hasValue){var h=s.value;if(o(h,f))return m=h}return m=f}if(h=m,ca(l,f))return h;var g=r(f);return o!==void 0&&o(h,g)?h:(l=f,m=g)}var d=!1,l,m,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,o]);var a=da(e,i[0],i[1]);return pa(function(){s.hasValue=!0,s.value=a},[a]),ma(a),a};(function(e){e.exports=jo})(Ao);const ha=Ti(Ao.exports),{useSyncExternalStoreWithSelector:ga}=ha;function va(e,t=e.getState,n){const r=ga(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return _n(r),r}const sr=e=>{const t=typeof e=="function"?js(e):e,n=(r,o)=>va(t,r,o);return Object.assign(n,t),n},Vo=e=>e?sr(e):sr,zt=1,Cn={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:t.some(n=>e.indexOf(n)!=-1)}},kn=(e,t,n)=>{switch(t){case I.VideoVoice:return Boolean(e&&e.value);case I.Open:return!!n;case I.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case I.RecordedTask:return(n==null?void 0:n.taskStatus)===ce.Completed;case I.TextUrlPrompt:return!e.value;case I.ConsentLegal:return n!==null;case I.MultipleChoice:return n!==void 0;case I.NPS:return n!==null;case I.Likert:return n!==null;default:return!0}},Bo=({cards:e,index:t,hasEndCard:n,selectedValue:r,hasValidAnswer:o=!0,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const a=e[t].props.routingOptions||[];let c=null,d=null;for(let f=0;f<a.length;f++){const{comparator:h,target:g,value:v}=a[f];if(h===Ve.Answered&&o){c=g;break}else if(h===Ve.GivenUp&&r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ce.GivenUp){c=g;break}else if(h===Ve.Skipped&&!o&&!(r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ce.GivenUp)){c=g;break}else if(o&&Fo(h)&&Cn[h](r,v)){c=g;break}}const l=c&&parseInt(String(c),10);c&&l!==null&&!isNaN(l)&&(l===-1||l>t)&&(d=l);const m=e.findIndex(f=>f.type===I.Uploading);let p;return m>0&&n?p=e.length-3:m>0||n?p=e.length-2:p=e.length-1,t>=p||d===-1||d!==null&&d>p?m>0&&Object.values(i).some(h=>h.isSubmitted&&!h.isComplete)?m:n?e.length-1:null:d!==null?d:t+1},wa=13,_a=(e,t)=>e.reduce((n,r)=>n.concat(n.map(o=>[...o,r])),[[]]).filter(n=>t||n.length>0),ya=e=>{switch(e.type){case I.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>wa?e.props.options.map(t=>[t.value]):_a(e.props.options.map(t=>t.value),!e.props.properties.required);case I.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const t=e.props.options.map(n=>n.value);return e.props.properties.required||t.push(void 0),t}case I.Likert:return[1,2,3,4,5,...e.props.properties.required?[]:[null]];case I.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case I.VideoVoice:case I.Open:return[zt,...e.props.properties.required?[]:[""]];case I.RecordedTask:return[{taskStatus:ce.Completed},{taskStatus:ce.GivenUp},...e.props.properties.required?[]:[{taskStatus:ce.Abandoned}]];case I.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case I.ConsentLegal:return[zt,...e.props.properties.required?[]:[null]];default:return[zt]}},Fo=e=>e in Cn,ba=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,xa=(e,t)=>{const n=new Set([I.Thanks,I.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(i=>!n.has(i.type));if(t===r.length-1)return 1;const o={[r.length-1]:1,[-1]:0};for(let i=r.length-2;i>=t;i--){const s=r[i],a=s.props.routingOptions||[];if(a.length===0){o[i]=o[i+1]+1;continue}let c=0,d=ya(s);if(d===null)return r.length-1-t;for(let l=0;l<a.length&&d.length!==0;l++){const{comparator:m,target:p,value:f}=a[l],h=d.filter(g=>{const v=kn({value:g},s.type,g);return!(v&&m===Ve.Answered||!v&&m===Ve.Skipped||m===Ve.GivenUp&&ba(g)&&g.taskStatus===ce.GivenUp||v&&Fo(m)&&Cn[m](g,f))});if(h.length<d.length){const g=parseInt(String(p),10);if(g!==-1&&g<=i||g>=r.length)return r.length-1-t;c=Math.max(o[g]+1,c)}d=h}d.length>0&&(c=Math.max(o[i+1]+1,c)),o[i]=c}return o[t]},Ca=e=>!(e.type===I.Thanks||e.type===I.Uploading),z=Vo()((e,t)=>({answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=ze)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s}=r;await o(n),qt(r)||s({event:"closed"}),Jt.enable(),i({initiator:he.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i}=t();r(oe.SurveyComplete),await o(n),Jt.enable(),i({initiator:he.Complete})},endCard:{headline:""},envId:"",eventEmitFn:F.emit.bind(F),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return qe(o)?Promise.resolve():(r(j.SurveyFadingOut),new Promise(s=>{const a=i.getElementById(n);a?(a.addEventListener("transitionend",()=>{s()}),a.classList.remove("ul-app--visible")):s()}))},frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{[Me.QuestionId]:r[i].name,[Me.Props]:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var p,f,h;const{cards:s,destroy:a,index:c,uploadProgress:d}=t(),l={...d,[n]:{progressPct:o||o===0?o:(p=d[n])==null?void 0:p.progressPct,isComplete:r||((f=d[n])==null?void 0:f.isComplete),isSubmitted:i||((h=d[n])==null?void 0:h.isSubmitted)}};if(s[c].type!==I.Uploading){e({uploadProgress:l});return}const m=Object.entries(d).every(([g,v])=>!v.isSubmitted||v.isComplete||n==g&&r);if(m&&c>=s.length-1){a(ze);return}e({index:m?c+1:c,uploadingCardViewed:!0,uploadProgress:l})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Fe.Web,"x-ul-environment-id":"","x-ul-installation-method":Ie.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{cards:r,eventEmitFn:o,index:i,responseGroupUid:s,submit:a,trackHistory:c,uploadProgress:d,viewedCardCount:l}=t(),m=Date.now(),p=[...r],f=p[i],{type:h}=n.data,g={...n.data},v=g.value;Ca(f)&&(f.value=v),g.answeredAt=m,delete g.type;const w={response:g,responseGroupUid:s};let _=h===I.MultipleChoice?Object.values(v).find(x=>x!==!1):v;h===I.MultipleSelect&&(_=p[i].props.options.reduce((x,P)=>(v[P.id]&&x.push(P.value),x),[]));const S=kn(g,h,_),b=Bo({cards:p,index:i,selectedValue:_,hasEndCard:!!n.endCard,hasValidAnswer:S,uploadProgress:d});if(b===null){w.completedAt=m,a(w),n.completeSurvey();return}else[I.Thanks,I.Uploading].includes(p[b].type)&&(w.completedAt=m);const E=a(w);[I.Thanks,I.Uploading].includes(p[b].type)||E.finally(()=>{c({event:"seen",index:b})});const D=p[b];p[b]&&o&&o(oe.CurrentQuestion,{[Me.QuestionId]:D.name,[Me.Props]:D.props}),e({cards:p,hasViewedEmbed:!1,index:b,viewedCardCount:l+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:F,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:o,eventEmitFn:i}=t();["ios","android"].includes(o["userleap-platform"])&&i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),!qe(o)&&(i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,response:r,responseGroupUid:o})=>{const i=t();if(!o||qt(i))return;const s={responseGroupUid:o,meta:i.meta,customMetadata:i.customMetadata,responses:[r],completedAt:n,previewKey:i.previewKey},a=await ge(`${i.apiURL}/sdk/1/environments/${i.envId}/visitors/${i.userId}/responses/submit`,{body:JSON.stringify(s),headers:i.headers,method:"POST"});if(!a.ok){a.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",a.error),await ar(i,"submitResponse",a.error));return}},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(qt(i))return;const{cards:s,index:a}=i,c=r!==void 0?s[r]:s[a],d={sid:i.surveyId,qid:c.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid},l=await ge(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{body:JSON.stringify(d),headers:i.headers,method:"POST"});!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",l.error),await ar(i,"trackHistory",l.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:o,viewDocument:i}=t();setTimeout(()=>{var a;const s=kr(i);qe(n)?r(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:s}):(a=o.setHeight)==null||a.call(o,s)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),qt=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,ar=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:a,viewDocument:c}=e,d=c.documentElement,l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:window.navigator.language},m={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:l,vid:o,envId:i};(await ge(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},a),body:JSON.stringify(m)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},ka=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const o=await n.json();return(r=o==null?void 0:o.upload)==null?void 0:r.url}else return null},$o=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",lr=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:$o()};return new MediaRecorder(e,t)},cr=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function dr(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{[M.BeginCallback]:s}=r,a=e.currentMediaRecordingUid;if(!a)return;s&&s(a),e.onstop=()=>Sa(t,e,n,r,a,o,i),e.stop()}}async function Sa(e,t,n,r,o,i,s){const a=z.getState().viewDocument,{[M.UploadCallback]:c,[M.ProgressCallback]:d}=r,l={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:o,...r[M.PassthroughData]},m=await ka(l,e);if(!m){c&&c(null,{message:"failed to get upload url"});return}const p=new Blob(s,{type:$o()});if(!a.defaultView)return;const f=new a.defaultView.File([p],`recording video ${Date.now()}`),h=i.createUpload({endpoint:m,file:f,chunkSize:5120});h.startTime=Date.now(),h.on("error",g=>{c&&c(null,g)}),h.on("progress",g=>{d&&d(o,g)}),h.on("success",()=>{c&&c(o,!0)})}const Ea={chunks:{}},La={state:{...Ea},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?ae.Video:ae.Audio;this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&dr(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&dr(r,t,ae.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(Y.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(Y.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(Y.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(Y.StartTask,this.startTaskCallback.bind(this)),e.on(Y.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(Y.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{[M.StreamReadyCallback]:t,[M.PermissionDescriptors]: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(Ze.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){console.warn("Error: failed to get permissions: "+s),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[M.ScreenPermissionRequested]:t,[M.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}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{[M.RecordingMediaTypes]:t,[M.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(ae.Video)&&this.state.avStream){this.state.avRecorder=lr(this.state.avStream);const o=Be();cr(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes(ae.Screen)&&this.state.captureStream){this.state.screenRecorder=lr(this.state.captureStream);const o=Be();cr(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{[M.CurrentIndex]:t,[M.TaskResponse]:n,[M.TaskCompleteCallback]: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{[M.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,s=Bo({cards:n,index:e,selectedValue:t.value,hasEndCard:r,hasValidAnswer:kn(t,t.type,t.value)});s!==null&&n[s].type===I.RecordedTask||[o,i].map(a=>{a&&(a.state==="recording"&&a.stop(),a.stream.getTracks().map(c=>{c.readyState==="live"&&c.stop()}))})}},_t=Object.create(La);Object.freeze(_t);function Ho(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ho(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function R(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ho(e))&&(r&&(r+=" "),r+=t);return r}var Ia=0;function u(e,t,n,r,o,i){var s,a,c={};for(a in t)a=="ref"?s=t[a]:c[a]=t[a];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Ia,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return L.vnode&&L.vnode(d),d}const X=e=>u("button",{...e,className:R("ul-card-text__button",e.className),id:"ul-card-text__button"}),ye=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return u(ue,{children:[e&&u("h1",{className:C.QuestionHeader,id:C.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&u("p",{className:C.Caption,id:C.Caption,children:n})]})},ur=({buttonText:e="View Prototype",handleClick:t})=>u("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Re=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var m;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=z(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),a=(n==null?void 0:n.conceptUrl)||((m=n==null?void 0:n.consentDocument)==null?void 0:m.url),c=window.innerWidth<Ci,d=i["userleap-platform"],l=(p,f)=>{p.preventDefault(),r(f)};if(!s&&c&&!o&&a&&["email","link"].includes(d)){if(t==="prototype")return u(ur,{handleClick:p=>{l(p,oe.ViewPrototypeClick)}});if(t==="pdf")return u(ur,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{l(p,oe.ViewAgreementClick)}})}return e()},zo=(e,t)=>{const n=Te(0),r=()=>{if(e.current){const o=e.current;o.style.height="1px";const i=o.scrollHeight,s=o.offsetHeight-o.clientHeight,a=i+s,c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),d=a<=c?a:c;n.current!==d&&t(),n.current=d,o.style.height=`${d}px`}};return re(r,[]),r},qo=({border:e,label:t,isSelected:n,value:r,text:o,id:i,isRadio:s,useMobileStyling:a,error:c,allowTextEntry:d,promptText:l,onUserInputChanged:m})=>{const{styleNonce:p,viewDocument:f}=z(T=>({styleNonce:T.styleNonce,viewDocument:T.viewDocument})),[h,g]=Z(!1);Pa(f,e,p);const v=({isSelected:T,userText:V})=>{m&&m({id:i||"",selected:T,value:r,userText:V})},w=T=>{T.stopPropagation(),v({isSelected:s||!n,userText:o}),g(!1)},_=()=>{h||g(!0)},S=()=>{h&&g(!1)},b=T=>{ot(T.target)||(T.key==="Enter"||T.key===" ")&&w(T)},E={onClick:T=>w(T),onKeyPress:T=>b(T)};"ontouchstart"in f.documentElement?(E.onTouchStart=S,E.onTouchCancel=S,E.onTouchEnd=S):(E.onMouseDown=_,E.onMouseLeave=S);const D=s?`radio-${i}`:`checkbox-${i}`,x=n||h?[yt]:[],P=[...c?[Wo]:[],...x];return u("div",{className:R([...W(C.Choice,a),...P]),id:`choice-div-${i}`,style:c?{borderColor:rt}:{},...E,children:[u("div",{className:R([C.ChoiceLabelContainer]),children:[s?u("div",{"aria-labelledby":`label-${i}`,className:R([C.ChoiceRadio,...x]),id:D,role:"radio",tabIndex:0}):u("div",{"aria-checked":n,"aria-labelledby":`label-${i}`,className:C.ChoiceCheckbox,id:D,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&u("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),u("label",{className:R(W(C.ChoiceLabel,a)),htmlFor:D,id:`label-${i}`,children:t})]}),d&&n&&u("div",{className:R([C.ChoiceTextEntryContainer,...x]),children:u(Ua,{onTextChange:T=>v({isSelected:n,userText:T}),promptText:l||"Please specify",textValue:o,useMobileStyling:a})})]})},Ua=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=Te(null),{update:i}=z(a=>({update:a.update})),s=zo(o,()=>i());return re(()=>{o.current&&o.current.focus()},[]),u("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:R(W(C.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{s(),ot(a.target)&&(a.stopPropagation(),n(a.target.value))},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},pr="ul-select-style-element",yt="ul-select-active-dynamic-style",Wo="ul-select-error-dynamic-style",Ta=e=>e.tagName.toLowerCase()==="style",Pa=(e,t,n)=>{let r=e.getElementById(pr),o=!1;r||(r=e.createElement("style"),o=!0),Ta(r)&&(r.id=pr,n&&(r.nonce=n),r.textContent=Ra(t),o&&e.head.appendChild(r))},Ra=e=>`
|
|
18
|
-
.${
|
|
18
|
+
*/var an=fs,Hd=hs.exports;function $d(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qd=typeof Object.is=="function"?Object.is:$d,Gd=Hd.useSyncExternalStore,zd=an.useRef,Wd=an.useEffect,Kd=an.useMemo,Yd=an.useDebugValue;ps.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=zd(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=Kd(function(){function c(p){if(!l){if(l=!0,d=p,p=r(p),o!==void 0&&s.hasValue){var m=s.value;if(o(m,p))return h=m}return h=p}if(m=h,qd(d,p))return m;var v=r(p);return o!==void 0&&o(m,v)?m:(d=p,h=v)}var l=!1,d,h,u=n===void 0?null:n;return[function(){return c(t())},u===null?void 0:function(){return c(u())}]},[t,n,r,o]);var a=Gd(e,i[0],i[1]);return Wd(function(){s.hasValue=!0,s.value=a},[a]),Yd(a),a};(function(e){e.exports=ps})(us);const Qd=Ys(us.exports),{useSyncExternalStoreWithSelector:Zd}=Qd;function Jd(e,t=e.getState,n){const r=Zd(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return gr(r),r}const bo=e=>{const t=typeof e=="function"?vd(e):e,n=(r,o)=>Jd(t,r,o);return Object.assign(n,t),n},vs=e=>e?bo(e):bo,xn=1,Er={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:t.some(n=>e.indexOf(n)!=-1)}},br=(e,t,n)=>{switch(t){case L.VideoVoice:return Boolean(e&&e.value);case L.Open:return!!n;case L.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case L.RecordedTask:return(n==null?void 0:n.taskStatus)===ve.Completed;case L.TextUrlPrompt:return!e.value;case L.ConsentLegal:return n!==null;case L.MultipleChoice:return n!==void 0;case L.NPS:return n!==null;case L.Likert:return n!==null;default:return!0}},gs=({cards:e,index:t,hasEndCard:n,selectedValue:r,hasValidAnswer:o=!0,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const a=e[t].props.routingOptions||[];let c=null,l=null;for(let p=0;p<a.length;p++){const{comparator:m,target:v,value:g}=a[p];if(m===Ke.Answered&&o){c=v;break}else if(m===Ke.GivenUp&&r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ve.GivenUp){c=v;break}else if(m===Ke.Skipped&&!o&&!(r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ve.GivenUp)){c=v;break}else if(o&&_s(m)&&Er[m](r,g)){c=v;break}}const d=c&&parseInt(String(c),10);c&&d!==null&&!isNaN(d)&&(d===-1||d>t)&&(l=d);const h=e.findIndex(p=>p.type===L.Uploading);let u;return h>0&&n?u=e.length-3:h>0||n?u=e.length-2:u=e.length-1,t>=u||l===-1||l!==null&&l>u?h>0&&Object.values(i).some(m=>m.isSubmitted&&!m.isComplete)?h:n?e.length-1:null:l!==null?l:t+1},Xd=13,eu=(e,t)=>e.reduce((n,r)=>n.concat(n.map(o=>[...o,r])),[[]]).filter(n=>t||n.length>0),tu=e=>{switch(e.type){case L.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>Xd?e.props.options.map(t=>[t.value]):eu(e.props.options.map(t=>t.value),!e.props.properties.required);case L.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const t=e.props.options.map(n=>n.value);return e.props.properties.required||t.push(void 0),t}case L.Likert:return[1,2,3,4,5,...e.props.properties.required?[]:[null]];case L.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case L.VideoVoice:case L.Open:return[xn,...e.props.properties.required?[]:[""]];case L.RecordedTask:return[{taskStatus:ve.Completed},{taskStatus:ve.GivenUp},...e.props.properties.required?[]:[{taskStatus:ve.Abandoned}]];case L.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case L.ConsentLegal:return[xn,...e.props.properties.required?[]:[null]];default:return[xn]}},_s=e=>e in Er,nu=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,ru=(e,t)=>{const n=new Set([L.Thanks,L.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(i=>!n.has(i.type));if(t===r.length-1)return 1;const o={[r.length-1]:1,[-1]:0};for(let i=r.length-2;i>=t;i--){const s=r[i],a=s.props.routingOptions||[];if(a.length===0){o[i]=o[i+1]+1;continue}let c=0,l=tu(s);if(l===null)return r.length-1-t;for(let d=0;d<a.length&&l.length!==0;d++){const{comparator:h,target:u,value:p}=a[d],m=l.filter(v=>{const g=br({value:v},s.type,v);return!(g&&h===Ke.Answered||!g&&h===Ke.Skipped||h===Ke.GivenUp&&nu(v)&&v.taskStatus===ve.GivenUp||g&&_s(h)&&Er[h](v,p))});if(m.length<l.length){const v=parseInt(String(u),10);if(v!==-1&&v<=i||v>=r.length)return r.length-1-t;c=Math.max(o[v]+1,c)}l=m}l.length>0&&(c=Math.max(o[i+1]+1,c)),o[i]=c}return o[t]},ou=e=>!(e.type===L.Thanks||e.type===L.Uploading),G=vs()((e,t)=>({answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=et)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s}=r;await o(n),Sn(r)||s({event:"closed"}),Dn.enable(),i({initiator:Ee.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i}=t();r(de.SurveyComplete),await o(n),Dn.enable(),i({initiator:Ee.Complete})},endCard:{headline:""},envId:"",eventEmitFn:B.emit.bind(B),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return tt(o)?Promise.resolve():(r(P.SurveyFadingOut),new Promise(s=>{const a=i.getElementById(n);a?(a.addEventListener("transitionend",()=>{s()}),a.classList.remove("ul-app--visible")):s()}))},frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{[ze.QuestionId]:r[i].name,[ze.Props]:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var u,p,m;const{cards:s,destroy:a,index:c,uploadProgress:l}=t(),d={...l,[n]:{progressPct:o||o===0?o:(u=l[n])==null?void 0:u.progressPct,isComplete:r||((p=l[n])==null?void 0:p.isComplete),isSubmitted:i||((m=l[n])==null?void 0:m.isSubmitted)}};if(s[c].type!==L.Uploading){e({uploadProgress:d});return}const h=Object.entries(l).every(([v,g])=>!g.isSubmitted||g.isComplete||n==v&&r);if(h&&c>=s.length-1){a(et);return}e({index:h?c+1:c,uploadingCardViewed:!0,uploadProgress:d})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Ye.Web,"x-ul-environment-id":"","x-ul-installation-method":De.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{cards:r,eventEmitFn:o,index:i,responseGroupUid:s,submit:a,trackHistory:c,uploadProgress:l,viewedCardCount:d}=t(),h=Date.now(),u=[...r],p=u[i],{type:m}=n.data,v={...n.data},g=v.value;ou(p)&&(p.value=g),v.answeredAt=h,delete v.type;const w={response:v,responseGroupUid:s};let _=m===L.MultipleChoice?Object.values(g).find(b=>b!==!1):g;m===L.MultipleSelect&&(_=u[i].props.options.reduce((b,U)=>(g[U.id]&&b.push(U.value),b),[]));const C=br(v,m,_),E=gs({cards:u,index:i,selectedValue:_,hasEndCard:!!n.endCard,hasValidAnswer:C,uploadProgress:l});if(E===null){w.completedAt=h,a(w),n.completeSurvey();return}else[L.Thanks,L.Uploading].includes(u[E].type)&&(w.completedAt=h);const I=a(w);[L.Thanks,L.Uploading].includes(u[E].type)||I.finally(()=>{c({event:"seen",index:E})});const N=u[E];u[E]&&o&&o(de.CurrentQuestion,{[ze.QuestionId]:N.name,[ze.Props]:N.props}),e({cards:u,hasViewedEmbed:!1,index:E,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:B,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:o,eventEmitFn:i}=t();["ios","android"].includes(o["userleap-platform"])&&i(P.SurveyWillClose,{name:P.SurveyWillClose,initiator:n}),!tt(o)&&(i(P.SurveyWillClose,{name:P.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,response:r,responseGroupUid:o})=>{const i=t();if(!o||Sn(i))return;const s={responseGroupUid:o,meta:i.meta,customMetadata:i.customMetadata,responses:[r],completedAt:n,previewKey:i.previewKey},a=await be(`${i.apiURL}/sdk/1/environments/${i.envId}/visitors/${i.userId}/responses/submit`,{body:JSON.stringify(s),headers:i.headers,method:"POST"});if(!a.ok){a.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",a.error),await Co(i,"submitResponse",a.error));return}},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(Sn(i))return;const{cards:s,index:a}=i,c=r!==void 0?s[r]:s[a],l={sid:i.surveyId,qid:c.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid},d=await be(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{body:JSON.stringify(l),headers:i.headers,method:"POST"});!d.ok&&d.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",d.error),await Co(i,"trackHistory",d.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:o,viewDocument:i}=t();setTimeout(()=>{var a;const s=ri(i);tt(n)?r(P.SurveyHeight,{name:P.SurveyHeight,contentFrameHeight:s}):(a=o.setHeight)==null||a.call(o,s)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),Sn=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,Co=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:a,viewDocument:c}=e,l=c.documentElement,d={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:l.clientWidth,clientHeight:l.clientHeight,location:window.location.href,language:window.navigator.language},h={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:d,vid:o,envId:i};(await be(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},a),body:JSON.stringify(h)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},iu=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const o=await n.json();return(r=o==null?void 0:o.upload)==null?void 0:r.url}else return null},ys=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",xo=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:ys()};return new MediaRecorder(e,t)},So=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function Io(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{[V.BeginCallback]:s}=r,a=e.currentMediaRecordingUid;if(!a)return;s&&s(a),e.onstop=()=>su(t,e,n,r,a,o,i),e.stop()}}async function su(e,t,n,r,o,i,s){const a=G.getState().viewDocument,{[V.UploadCallback]:c,[V.ProgressCallback]:l}=r,d={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:o,...r[V.PassthroughData]},h=await iu(d,e);if(!h){c&&c(null,{message:"failed to get upload url"});return}const u=new Blob(s,{type:ys()});if(!a.defaultView)return;const p=new a.defaultView.File([u],`recording video ${Date.now()}`),m=i.createUpload({endpoint:h,file:p,chunkSize:5120});m.startTime=Date.now(),m.on("error",v=>{c&&c(null,v)}),m.on("progress",v=>{l&&l(o,v)}),m.on("success",()=>{c&&c(o,!0)})}const au={chunks:{}},lu={state:{...au},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?fe.Video:fe.Audio;this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&Io(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&Io(r,t,fe.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(te.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(te.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(te.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(te.StartTask,this.startTaskCallback.bind(this)),e.on(te.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(te.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{[V.StreamReadyCallback]:t,[V.PermissionDescriptors]: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(at.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){console.warn("Error: failed to get permissions: "+s),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[V.ScreenPermissionRequested]:t,[V.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}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{[V.RecordingMediaTypes]:t,[V.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(fe.Video)&&this.state.avStream){this.state.avRecorder=xo(this.state.avStream);const o=je();So(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes(fe.Screen)&&this.state.captureStream){this.state.screenRecorder=xo(this.state.captureStream);const o=je();So(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{[V.CurrentIndex]:t,[V.TaskResponse]:n,[V.TaskCompleteCallback]: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{[V.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,s=gs({cards:n,index:e,selectedValue:t.value,hasEndCard:r,hasValidAnswer:br(t,t.type,t.value)});s!==null&&n[s].type===L.RecordedTask||[o,i].map(a=>{a&&(a.state==="recording"&&a.stop(),a.stream.getTracks().map(c=>{c.readyState==="live"&&c.stop()}))})}},Vt=Object.create(lu);Object.freeze(Vt);function ws(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=ws(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function O(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=ws(e))&&(r&&(r+=" "),r+=t);return r}var cu=0;function f(e,t,n,r,o,i){var s,a,c={};for(a in t)a=="ref"?s=t[a]:c[a]=t[a];var l={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--cu,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return k.vnode&&k.vnode(l),l}const se=e=>f("button",{...e,className:O("ul-card-text__button",e.className),id:"ul-card-text__button"}),ke=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return f(ge,{children:[e&&f("h1",{className:x.QuestionHeader,id:x.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&f("p",{className:x.Caption,id:x.Caption,children:n})]})},ko=({buttonText:e="View Prototype",handleClick:t})=>f("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Be=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var h;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=G(u=>({handleClickEmbedButton:u.handleClickEmbedButton,hasViewedEmbed:u.hasViewedEmbed,headers:u.headers,useDesktopPrototype:u.useDesktopPrototype})),a=(n==null?void 0:n.conceptUrl)||((h=n==null?void 0:n.consentDocument)==null?void 0:h.url),c=window.innerWidth<Xl,l=i["userleap-platform"],d=(u,p)=>{u.preventDefault(),r(p)};if(!s&&c&&!o&&a&&["email","link"].includes(l)){if(t==="prototype")return f(ko,{handleClick:u=>{d(u,de.ViewPrototypeClick)}});if(t==="pdf")return f(ko,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:u=>{d(u,de.ViewAgreementClick)}})}return e()},Es=(e,t)=>{const n=Ve(0),r=()=>{if(e.current){const o=e.current;o.style.height="1px";const i=o.scrollHeight,s=o.offsetHeight-o.clientHeight,a=i+s,c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),l=a<=c?a:c;n.current!==l&&t(),n.current=l,o.style.height=`${l}px`}};return ce(r,[]),r},bs=({border:e,label:t,isSelected:n,value:r,text:o,id:i,isRadio:s,useMobileStyling:a,error:c,allowTextEntry:l,promptText:d,onUserInputChanged:h})=>{const{styleNonce:u,viewDocument:p}=G(R=>({styleNonce:R.styleNonce,viewDocument:R.viewDocument})),[m,v]=X(!1);pu(p,e,u);const g=({isSelected:R,userText:M})=>{h&&h({id:i||"",selected:R,value:r,userText:M})},w=R=>{R.stopPropagation(),g({isSelected:s||!n,userText:o}),v(!1)},_=()=>{m||v(!0)},C=()=>{m&&v(!1)},E=R=>{gt(R.target)||(R.key==="Enter"||R.key===" ")&&w(R)},I={onClick:R=>w(R),onKeyPress:R=>E(R)};"ontouchstart"in p.documentElement?(I.onTouchStart=C,I.onTouchCancel=C,I.onTouchEnd=C):(I.onMouseDown=_,I.onMouseLeave=C);const N=s?`radio-${i}`:`checkbox-${i}`,b=n||m?[Mt]:[],U=[...c?[Cs]:[],...b];return f("div",{className:O([...K(x.Choice,a),...U]),id:`choice-div-${i}`,style:c?{borderColor:vt}:{},...I,children:[f("div",{className:O([x.ChoiceLabelContainer]),children:[s?f("div",{"aria-labelledby":`label-${i}`,className:O([x.ChoiceRadio,...b]),id:N,role:"radio",tabIndex:0}):f("div",{"aria-checked":n,"aria-labelledby":`label-${i}`,className:x.ChoiceCheckbox,id:N,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&f("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:f("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),f("label",{className:O(K(x.ChoiceLabel,a)),htmlFor:N,id:`label-${i}`,children:t})]}),l&&n&&f("div",{className:O([x.ChoiceTextEntryContainer,...b]),children:f(du,{onTextChange:R=>g({isSelected:n,userText:R}),promptText:d||"Please specify",textValue:o,useMobileStyling:a})})]})},du=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=Ve(null),{update:i}=G(a=>({update:a.update})),s=Es(o,()=>i());return ce(()=>{o.current&&o.current.focus()},[]),f("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:O(K(x.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{s(),gt(a.target)&&(a.stopPropagation(),n(a.target.value))},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},Lo="ul-select-style-element",Mt="ul-select-active-dynamic-style",Cs="ul-select-error-dynamic-style",uu=e=>e.tagName.toLowerCase()==="style",pu=(e,t,n)=>{let r=e.getElementById(Lo),o=!1;r||(r=e.createElement("style"),o=!0),uu(r)&&(r.id=Lo,n&&(r.nonce=n),r.textContent=fu(t),o&&e.head.appendChild(r))},fu=e=>`
|
|
19
|
+
.${Mt} {
|
|
19
20
|
border-color: ${e};
|
|
20
21
|
}
|
|
21
|
-
.${
|
|
22
|
+
.${Mt} .${x.ChoiceRadio}, .${Mt}.${x.ChoiceRadio} {
|
|
22
23
|
border: 6px solid ${e};
|
|
23
24
|
box-shadow: none;
|
|
24
25
|
}
|
|
25
|
-
.${
|
|
26
|
-
border-color: ${
|
|
26
|
+
.${Cs} {
|
|
27
|
+
border-color: ${vt};
|
|
27
28
|
}
|
|
28
|
-
`,Je=e=>(e==null?void 0:e.buttonText)||"Next",Sn=e=>(e==null?void 0:e.skipButtonText)||"Skip",Da=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,useMobileStyling:a,border:c}=z(k=>({headers:k.headers,useMobileStyling:k.useMobileStyling,border:k.border})),[d,l]=Z(!1),[m,p]=Z(""),[f,h]=Z(!1),g=s["userleap-platform"],v=r==null?void 0:r.collectName,w=(r==null?void 0:r.nameLabelText)||"Full Name",_=(r==null?void 0:r.consentText)||"I agree to the stated conditions",S=(r==null?void 0:r.submitButtonText)||"Submit",b=!!m.trim(),E=d&&(!v||b),D=(k,$=!1)=>{k.preventDefault(),k.stopPropagation();let y=null;if(!$){if(!E){h(!0);return}y={submitted:!0},v&&(y.name=m)}n({value:y,questionId:o,type:i})},x=k=>{Ii(k.target)&&(k.preventDefault(),k.stopPropagation(),p(k.target.value))},P=k=>{We(k.target)&&(k.target.style.borderColor=f&&!b?rt:c)},T=k=>{We(k.target)&&(k.target.style.borderColor=f&&!b?rt:hn)},V=()=>u("div",{children:[u(qo,{allowTextEntry:!1,border:c,error:f&&!d,index:0,isRadio:!1,isSelected:d,label:_,onUserInputChanged:({selected:k})=>{k!==d&&l(!d)},useMobileStyling:a}),v&&u("input",{"aria-label":w,"aria-placeholder":w,className:R(W(C.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:T,onFocus:P,onInput:x,placeholder:w,style:f&&!b?{borderColor:rt}:{},tabIndex:0,value:m}),u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[u(X,{className:E?"":C.ButtonDisabled,onClick:D,children:S}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:k=>D(k,!0),children:Sn(r)})]})]});return u("div",{className:R(_e(C.CardMainContent,g)),children:u("div",{className:R([e,"ul-card__consent-legal",C.FadeInTransition]),children:[u(ye,{message:t}),u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),u(Re,{properties:r,defaultBody:V,embeddedType:"pdf"})]},o)})},Aa=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:o,range:i,scaleLabelType:s,setActiveValue:a,setIsPressed:c,useMobileStyling:d,value:l})=>{const m=`option-${l}`,p=s===Ne.Number,f=s===Ne.Star,h=p&&l===e,[g,v]=(()=>l<=e&&f||l===e?r?[t,1]:[t,.3]:["",1])(),w=()=>{switch(s){case Ne.Star:return R([...W(C.LikertStar,d),...W(`${C.LikertStar}-${l}`,d)]);case Ne.Smiley:return R([...W(C.LikertSmiley,d),...W(`${C.LikertSmiley}-${l}`,d)]);default:return R(l===i?[...W(C.LikertNumber,d),...W(`${C.LikertNumber}-${l}`,d),...W("likert-last-option",d)]:[...W(C.LikertNumber,d),...W(`${C.LikertNumber}-${l}`,d)])}},_=()=>{a(-1),c(!1)};return u("div",{"aria-label":p?void 0:String(l),className:w(),dangerouslySetInnerHTML:{__html:n},id:m,onClick:()=>o(),onPointerDown:()=>c(!0),onPointerEnter:()=>a(l),onPointerLeave:_,role:"radio",style:{color:p?"":g,borderColor:h?g:"",fillOpacity:h?"":v,zIndex:h?3:"auto"},tabIndex:0})},ja=({className:e,labels:t,message:n,next:r,properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(V=>({border:V.border,headers:V.headers,useMobileStyling:V.useMobileStyling})),[l,m]=Z(-1),[p,f]=Z(!1),h=c["userleap-platform"],g=t&&t.left,v=t&&t.right;let w;const{range:_,scaleLabelType:S,ratingIcons:b}=o;_&&(w=Number(_));const E=w||5,D=V=>{var k,$;switch(S){case Ne.Star:return(k=b[0])==null?void 0:k.svg;case Ne.Smiley:return($=b[V])==null?void 0:$.svg;default:return String(V+1)}},x=[...Array(E)].map((V,k)=>{const $=k+1;return u(Aa,{activeValue:l,border:a,icon:D(k),isPressed:p,onSubmit:()=>r({value:$,questionId:i,type:s}),range:E,scaleLabelType:S,setActiveValue:m,setIsPressed:f,useMobileStyling:d,value:$},k)}),P=V=>{V.preventDefault(),V.stopPropagation(),r({value:null,questionId:i,type:s})},T=()=>u(ue,{children:[u("div",{"aria-label":`Rating (1 - ${E})`,className:"ul-card--likert__numbers",role:"radiogroup",children:x}),u("div",{className:"ul-card--likert__labels",children:[u("span",{children:g}),u("span",{children:v})]}),!o.required&&u("div",{className:"ul-vertical-centered-container",children:u(X,{onClick:P,children:Je(o)})})]});return u("div",{className:R(_e(C.CardMainContent,h)),children:u("form",{className:R([e,"ul-card--likert",C.FadeInTransition]),children:[u(ye,{message:n,properties:o}),u(Re,{properties:o,defaultBody:T})]},i)})},Go=({className:e,message:t,onSubmit:n,options:r=[],properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling})),l=r.reduce((x,P)=>(x[P.id]={isSelected:!1},x),{}),[m,p]=Z(l),f=c["userleap-platform"],h=s===I.MultipleChoice,g=o.required,v=Object.entries(m).some(([x,P])=>{var k;const T=r.find($=>`${$.id}`===x),V=P.userText===void 0||P.userText.trim()==="";return((k=T==null?void 0:T.optionProperties)==null?void 0:k.allowsTextEntry)&&V&&P.isSelected}),w=Object.values(m).some(x=>x.isSelected),_=v||g&&!w,S=r.map(({id:x,label:P,value:T,optionProperties:V},k)=>{var B,O;const $=`${x}`,{allowsTextEntry:y}=V||{allowsTextEntry:!1};return u(qo,{allowTextEntry:y,border:a,error:!1,id:$,index:k,isRadio:h,isSelected:!!((B=m[$])!=null&&B.isSelected),label:P,onUserInputChanged:ie=>E(ie.id,ie.selected,ie.userText),promptText:"Please specify",text:(O=m[x])==null?void 0:O.userText,useMobileStyling:d,value:T},$)}),b=x=>{x.preventDefault(),x.stopPropagation(),n(m)},E=(x,P,T)=>{const V=Object.assign({},m);if(h&&P)for(const k of Object.values(V))k.isSelected=!1,delete k.userText;V[x]={isSelected:P,userText:T},p(V)},D=()=>u("div",{children:[u("div",{className:R(W(C.ChoiceGroup,d)),role:h?"radiogroup":"group",children:S}),u("div",{className:"ul-card__button-wrapper",children:u(X,{disabled:_,onClick:b,children:Je(o)})})]});return u("div",{className:R(_e(C.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--multiple",C.FadeInTransition]),id:"text-form",onSubmit:b,children:[u(ye,{message:t,properties:o}),u(Re,{properties:o,defaultBody:D})]},i)})},Oa=e=>{const{questionId:t,type:n,next:r,options:o}=e;return u(Go,{...e,onSubmit:s=>{const a=Object.entries(s).find(([,p])=>p.isSelected)||[void 0,void 0],[c,d]=a,l=o.find(p=>`${p.id}`===c),m=d!=null&&d.userText?{[c]:{userText:d.userText}}:null;r({value:l&&c?{[c]:l.value}:{},secondaryValue:m,questionId:t,type:n})}})},Ma=e=>{const{questionId:t,type:n,next:r}=e;return u(Go,{...e,onSubmit:i=>{const s={},a=Object.entries(i).reduce((d,[l,m])=>(d[l]=m.isSelected,d),s),c=Object.entries(i).reduce((d,[l,m])=>{if(!m.userText)return d;const p=d||{};return p[l]={userText:m.userText},p},null);r({value:a,secondaryValue:c,questionId:t,type:n})}})},Na=({className:e,props:{labels:t,message:n,properties:r},next:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(v=>({border:v.border,headers:v.headers,useMobileStyling:v.useMobileStyling})),l=c["userleap-platform"],m=t&&t.left,p=t&&t.right,f=[...Array(11)].map((v,w)=>u("div",{className:R([...W(C.NPSNumber,d),...W(`${C.NPSNumber}-${w}`,d)]),id:`option-${w}`,onClick:()=>o({value:w,questionId:i,type:s}),onKeyPress:_=>{_.preventDefault(),(_.key==="Enter"||_.key===" ")&&o({value:w,questionId:i,type:s})},onPointerDown:_=>{We(_.target)&&(_.target.style.zIndex="2",_.target.style.borderColor=a)},onPointerLeave:_=>{We(_.target)&&(_.target.style.zIndex="auto",_.target.style.borderColor=hn)},role:"radio",tabIndex:0,children:w},w)),h=v=>{v.preventDefault(),v.stopPropagation(),o({value:null,questionId:i,type:s})},g=()=>u("div",{children:[u("div",{className:"ul-card--nps__numbers",children:f}),u("div",{className:"ul-card--nps__labels",children:[u("span",{children:m}),u("span",{children:p})]}),!r.required&&u("div",{className:"ul-vertical-centered-container",children:u(X,{onClick:h,children:Je(r)})})]});return u("div",{className:R(_e(C.CardMainContent,l)),children:u("form",{className:R([e,"ul-card--nps",C.FadeInTransition]),children:[u(ye,{message:n,properties:r}),u(Re,{properties:r,defaultBody:g})]},i)})},Va=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{border:s,headers:a,useMobileStyling:c,update:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling,update:x.update})),[l,m]=Z(""),p=Te(null),f=a["userleap-platform"],h=l.trim(),g=r.required===!0&&!h,v=zo(p,()=>d()),w=x=>{v(),x.preventDefault(),x.stopPropagation(),ot(x.target)&&m(x.target.value)},_=x=>{x.preventDefault(),x.stopPropagation(),n({value:l,questionId:o,type:i})},S=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",b=x=>{ot(x.target)&&(x.target.style.borderColor=s)},E=x=>{ot(x.target)&&(x.target.style.borderColor=hn)},D=()=>u("div",{className:"ul-card-text",children:[u("div",{className:"ul-card-text__container",children:u("textarea",{"aria-label":S,"aria-labelledby":C.QuestionHeader,"aria-multiline":"true","aria-placeholder":S,className:R(W(C.OpenTextInput,c)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:E,onChange:w,onFocus:b,placeholder:S,ref:p,role:"textbox",tabIndex:0})}),u(X,{disabled:g,onClick:_,style:{backgroundColor:g?"":s},children:Je(r)})]});return u("div",{className:R(_e(C.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--text",C.FadeInTransition]),id:"text-form",children:[u(ye,{message:t,properties:r}),u(Re,{defaultBody:D,properties:r})]},o)})};var Ee=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Ee||{});const jt=e=>e.type===ne.AvPermission,Ko=e=>e.type===ne.ScreenPermission,Ba=(e,t)=>!(jt(t)?t.permissionDescriptors:[]).includes(Ze.Camera)||e.getVideoTracks().length>0,Zo=(e,t)=>{if(e===void 0)return Ee.RequestNeeded;if(e){if(!Ba(e,t))return Ee.RequestNeeded}else return Ee.TryAgain;return Ee.Ready},fr={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ve=Vo(e=>({...fr,reset:()=>{e(fr)},updatePage:t=>{e(t)}}));function cn({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),{recorderEventEmitter:i}=z.getState();i.emit(Y.AvPermission,{[M.PermissionDescriptors]:e.permissionDescriptors,[M.StreamReadyCallback]:(s,a)=>{if(n===s)return;let c=e;if(s&&!e.permissionDescriptors.includes(Ze.Camera)){const d=t.indexOf(e),l=a!=null&&a.active?d+2:d+1;(a==null?void 0:a.active)&&r&&i.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:r,[M.StartRecordingCallback]:m=>o({mediaRecordingUids:m})}),c=t[l]}o({currentPage:c,avStream:s})}})}function Fa({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:o,next:i}){const{updatePage:s}=ve.getState(),{eventEmitFn:a,recorderEventEmitter:c}=z.getState(),d={questionId:o,surveyId:r,visitorId:t,responseGroupUid:n};let l=0;c.emit(oe.RecordedTaskPermissionScreen),a(oe.RecordedTaskPermissionScreen),c.emit(Y.PermissionStatus,{[M.PermissionStatusCallback]:(p,f,h,g)=>{const v=e[l],{type:w}=v,_=[ae.Screen];if(jt(v)){const{permissionDescriptors:S}=v,b=S==null?void 0:S.includes(Ze.Microphone),E=S==null?void 0:S.includes(Ze.Camera);b&&_.push(ae.Audio),E&&_.push(ae.Video);const D=(p==null?void 0:p.active)&&!E,x=(p==null?void 0:p.active)&&f;(D||x)&&l++}Ko(e[l])&&h&&(l++,c.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:_,[M.StartRecordingCallback]:S=>s({mediaRecordingUids:S})})),s({currentPage:e[l],avStream:p,screenPermissionRequested:h,nextQuestion:i,type:w,passthroughData:d,recordingMediaTypes:_,captureStream:g})}});const m=e[l];return m.type===ne.AvPermission&&cn({currentPage:m,pages:e}),m}function dn({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:o}=ve.getState(),{recorderEventEmitter:i,handleUploadUpdate:s,index:a}=z.getState(),c={value:{taskStatus:e},type:I.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||i.emit(Y.FinishTask,{[M.BeginCallback]:d=>{s({mediaRecordingUid:d,isSubmitted:!0,progressPct:0,isComplete:!1})},[M.ProgressCallback]:(d,l)=>{s({mediaRecordingUid:d,progressPct:l.detail,isSubmitted:!1,isComplete:!1})},[M.UploadCallback]:d=>{d&&s({mediaRecordingUid:d,isComplete:!0,isSubmitted:!0,progressPct:100})},[M.PassthroughData]:n,[M.CurrentIndex]:a,[M.TaskResponse]:c,[M.TaskCompleteCallback]:d=>{c.value.taskDurationMillisecond=d,r&&(c.value.mediaRecordingUids=r),o(),t(c)}})}function En({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=z.getState(),{updatePage:o,currentPage:i,recordingMediaTypes:s,screenPermissionRequested:a}=ve.getState();if(!i)return;const c=e.indexOf(i);switch(i.type){case ne.AvPermission:{const d=a?c+2:c+1;a&&s&&n.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:s,[M.StartRecordingCallback]:l=>{o({mediaRecordingUids:l})}}),o({currentPage:e[d]});return}case ne.ScreenPermission:n.emit(Y.ScreenPermission,{[M.ScreenPermissionRequested]:t,[M.StreamReadyCallback]:(d,l)=>{const m=l?e[c+1]:i;l&&s&&n.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:s,[M.StartRecordingCallback]:p=>{o({captureStream:l,mediaRecordingUids:p})}}),o({currentPage:m,screenPermissionRequested:!0,captureStream:l})}});return;case ne.StartTask:r(oe.RecordedTaskStart),n.emit(oe.RecordedTaskStart),n.emit(Y.StartTask),o({currentPage:e[c+1],screenPermissionRequested:!0});return;case ne.CompleteTask:return}}const Yo="ul-permission-graphics-container",Qo="ul-permission-body",Jo=R([Yo,"ul_recorded-task-inset-spacing"]),Ot=R(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Xo=({richTextBody:e})=>u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Mt=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:u(X,{className:R([n&&"ul-skip-button-below",C.InactiveButton]),onClick:dn.bind(null,{status:ce.Abandoned}),children:t||"Skip"}),Ln=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),i=(r==null?void 0:r.includes(ae.Audio))||(r==null?void 0:r.includes(ae.Video));re(()=>{const s=setInterval(()=>{i&&t&&!t.active?o({avStream:null,currentPage:e[0]}):(!n||!n.active)&&o({captureStream:void 0,currentPage:e[i?1:0]})},1e3);return()=>clearInterval(s)},[t,n,i,e,r,o])},$a=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o,taskDetail:i}=e;return Ln(t),u("div",{className:"ul-task-page",children:[u(Xo,{richTextBody:i}),u("div",{className:Ot,children:[u(X,{onClick:En.bind(null,{pages:t}),children:r}),u(Mt,{required:n,skipButtonText:o})]})]},"start-task")},Ha=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:o}=e;Ln(t);const s=u(Re,{properties:n,defaultBody:()=>u("div",{className:Ot,children:[u(X,{className:"ul-complete-task-button",onClick:dn.bind(null,{status:ce.Completed}),children:r}),u(X,{className:R([C.InactiveButton]),onClick:dn.bind(null,{status:ce.GivenUp}),children:o})]})});return u("div",{className:"ul-task-page",children:[u(Xo,{richTextBody:e.taskDetail}),s]},"complete-task")},za=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o}=e,[i]=z(c=>[c.tabTitle]),[s,a]=Z(!1);return u("div",{children:[u("div",{className:Jo,children:[u("p",{style:{marginTop:"auto"},children:e.selectTabText}),u("div",{className:"ul-select-tab-container",children:u("p",{className:Qo,children:i})})]}),u("div",{className:n?"":Ot,children:[u(X,{disabled:s,onClick:En.bind(null,{pages:t,setIsRequestingPermission:a}),children:r}),u(Mt,{required:n,skipButtonText:o})]})]})},qa=({content:e})=>u("div",{className:R([Yo,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),Wa=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:o,skipButtonText:i,tryAgainButtonText:s}=e,a=jt(t[0])?t[0]:null;return re(()=>{const c=setInterval(()=>{a!==null&&cn({currentPage:a,pages:t})},1e3);return()=>clearInterval(c)},[a,t]),a?u("div",{children:[u("div",{className:Jo,children:u("p",{className:"ul-av-permission-denied-paragraph",children:[u("span",{className:"ul-av-permission-denied-headline",children:r}),u("span",{className:Qo,children:o})]})}),u("div",{className:Ot,children:[u(X,{onClick:cn.bind(null,{currentPage:a,pages:t}),children:s}),u(Mt,{required:n,skipButtonText:i})]})]}):null},Ga=({stream:e})=>u("video",{autoPlay:!0,className:R(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Ka=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:o}=ve.getState();return Ln(t),u("div",{children:[u(Ga,{stream:o}),u("div",{className:"ul-vertical-button-container-center",children:[u(X,{onClick:En.bind(null,{pages:t}),children:e.buttonText}),u(Mt,{bottom:!0,required:n,skipButtonText:r})]})]})},Za=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:o}=ve.getState();if(o===void 0)return null;switch(o==null?void 0:o.type){case ne.AvPermission:{const i=Zo(r,o);return i===Ee.RequestNeeded?u(qa,{content:o}):i===Ee.TryAgain?u(Wa,{content:o,pages:t,required:n}):u(Ka,{content:o,pages:t,required:n})}case ne.ScreenPermission:return u(za,{content:o,pages:t,required:n});case ne.StartTask:return u($a,{content:o,pages:t,required:n});case ne.CompleteTask:return u(Ha,{content:o,pages:t,properties:e});default:return null}},Ya=({className:e,properties:t,next:n,questionId:r})=>{const o=z(),{headers:i,surveyId:s,responseGroupUid:a,userId:c}=o,d=ve(),{screenPermissionRequested:l}=d,m=ve(v=>v.avStream);let p=ve(v=>v.currentPage);p||(p=Fa({questionId:r,surveyId:s,next:v=>{n(v)},pages:t.pages,responseGroupUid:a,userId:c}));let f=p.headline,h=p.captionText;const g=Zo(m,p);return Ko(p)&&l&&(f=p.permissionDeniedHeadline,h=p.permissionDeniedCaptionText),jt(p)&&g===Ee.Ready&&(f=p.permissionGrantedHeadline,h=p.permissionGrantedCaptionText),u("div",{className:R([..._e(C.CardMainContent,i["userleap-platform"])]),children:u("div",{className:R([e,"ul-center-horizontally",C.FadeInTransition]),children:[u(ye,{message:f,properties:{captionText:h}}),u(Za,{properties:t})]})})},Qa={"{{user_id}}":"externalUserId","{{email}}":"email"},Ja=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[c,d]of Object.entries(Qa))if(n.toLowerCase().includes(c))if(t[d]){const l=new RegExp(c,"gi");n=n.replace(l,t[d])}else r.push(c);if(r.length===0||!n.includes("?"))return n;const o=n.slice(0,n.indexOf("?")),s=n.slice(n.indexOf("?")+1).split("&").map(c=>c.split("=")).filter(c=>!r.includes(c[1]));if(s.length===0)return o;const a=s.map(c=>c.join("=")).join("&");return`${o}?${a}`},Xa=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,visitorAttributes:a}=z(f=>({headers:f.headers,visitorAttributes:f.visitorAttributes})),c=s["userleap-platform"],d=(f,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:o,type:i})},l=f=>{(f.key==="Enter"||f.key===" ")&&n({value:void 0,questionId:o,type:i})},m=()=>u("div",{className:"ul-card-button-group",children:[u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:Ja(r&&r.buttonUrl,a),id:"ul-card-text__button",onClick:d,onKeyPress:l,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:Je(r)}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:f=>d(f,!0),children:Sn(r)})]}),p=(f,h)=>f?u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:f},id:"ul-card__text-url-body-container"}):u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((g,v)=>u("p",{children:g},v))});return u("div",{className:R(_e(C.CardMainContent,c)),children:u("div",{className:R([e,"ul-card__text-url-prompt",C.FadeInTransition]),children:[u(ye,{message:t}),p(r&&r.richTextBody,r&&r.body),u(Re,{defaultBody:m,properties:r})]},o)})},el=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:o,headers:i}=z(c=>({border:c.border,endCard:c.endCard,destroy:c.destroy,headers:c.headers}));re(()=>{setTimeout(()=>{r(ze)},2e3)},[r]);const s=o&&o.subheader?u("p",{className:C.Caption,children:o.subheader}):null,a=o&&o.headline?o.headline:"";return u("div",{className:R(_e(C.CardMainContent,i["userleap-platform"])),children:u("div",{className:R([e,"ul-card--thanks",C.FadeInTransition]),children:u("div",{children:u("div",{className:"ul-card--thanks-content",children:[u("div",{className:"ul-thanks-check",children:u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),u(ye,{message:a}),s]})})},t)})},Oe="https://cdn.sprig.com",U={document:void 0,videojs:void 0},tl=`/* progress control styles */
|
|
29
|
+
`,ut=e=>(e==null?void 0:e.buttonText)||"Next",Cr=e=>(e==null?void 0:e.skipButtonText)||"Skip",hu=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,useMobileStyling:a,border:c}=G(S=>({headers:S.headers,useMobileStyling:S.useMobileStyling,border:S.border})),[l,d]=X(!1),[h,u]=X(""),[p,m]=X(!1),v=s["userleap-platform"],g=r==null?void 0:r.collectName,w=(r==null?void 0:r.nameLabelText)||"Full Name",_=(r==null?void 0:r.consentText)||"I agree to the stated conditions",C=(r==null?void 0:r.submitButtonText)||"Submit",E=!!h.trim(),I=l&&(!g||E),N=(S,H=!1)=>{S.preventDefault(),S.stopPropagation();let y=null;if(!H){if(!I){m(!0);return}y={submitted:!0},g&&(y.name=h)}n({value:y,questionId:o,type:i})},b=S=>{oc(S.target)&&(S.preventDefault(),S.stopPropagation(),u(S.target.value))},U=S=>{ot(S.target)&&(S.target.style.borderColor=p&&!E?vt:c)},R=S=>{ot(S.target)&&(S.target.style.borderColor=p&&!E?vt:pr)},M=()=>f("div",{children:[f(bs,{allowTextEntry:!1,border:c,error:p&&!l,index:0,isRadio:!1,isSelected:l,label:_,onUserInputChanged:({selected:S})=>{S!==l&&d(!l)},useMobileStyling:a}),g&&f("input",{"aria-label":w,"aria-placeholder":w,className:O(K(x.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:R,onFocus:U,onInput:b,placeholder:w,style:p&&!E?{borderColor:vt}:{},tabIndex:0,value:h}),f("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[f(se,{className:I?"":x.ButtonDisabled,onClick:N,children:C}),r.required===!1&&f("button",{className:"ul-card-skip__button",onClick:S=>N(S,!0),children:Cr(r)})]})]});return f("div",{className:O(Ie(x.CardMainContent,v)),children:f("div",{className:O([e,"ul-card__consent-legal",x.FadeInTransition]),children:[f(ke,{message:t}),f("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),f(Be,{properties:r,defaultBody:M,embeddedType:"pdf"})]},o)})},mu=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:o,range:i,scaleLabelType:s,setActiveValue:a,setIsPressed:c,useMobileStyling:l,value:d})=>{const h=`option-${d}`,u=s===We.Number,p=s===We.Star,m=u&&d===e,[v,g]=(()=>d<=e&&p||d===e?r?[t,1]:[t,.3]:["",1])(),w=()=>{switch(s){case We.Star:return O([...K(x.LikertStar,l),...K(`${x.LikertStar}-${d}`,l)]);case We.Smiley:return O([...K(x.LikertSmiley,l),...K(`${x.LikertSmiley}-${d}`,l)]);default:return O(d===i?[...K(x.LikertNumber,l),...K(`${x.LikertNumber}-${d}`,l),...K("likert-last-option",l)]:[...K(x.LikertNumber,l),...K(`${x.LikertNumber}-${d}`,l)])}},_=()=>{a(-1),c(!1)};return f("div",{"aria-label":u?void 0:String(d),className:w(),dangerouslySetInnerHTML:{__html:n},id:h,onClick:()=>o(),onPointerDown:()=>c(!0),onPointerEnter:()=>a(d),onPointerLeave:_,role:"radio",style:{color:u?"":v,borderColor:m?v:"",fillOpacity:m?"":g,zIndex:m?3:"auto"},tabIndex:0})},vu=({className:e,labels:t,message:n,next:r,properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:l}=G(M=>({border:M.border,headers:M.headers,useMobileStyling:M.useMobileStyling})),[d,h]=X(-1),[u,p]=X(!1),m=c["userleap-platform"],v=t&&t.left,g=t&&t.right;let w;const{range:_,scaleLabelType:C,ratingIcons:E}=o;_&&(w=Number(_));const I=w||5,N=M=>{var S,H;switch(C){case We.Star:return(S=E[0])==null?void 0:S.svg;case We.Smiley:return(H=E[M])==null?void 0:H.svg;default:return String(M+1)}},b=[...Array(I)].map((M,S)=>{const H=S+1;return f(mu,{activeValue:d,border:a,icon:N(S),isPressed:u,onSubmit:()=>r({value:H,questionId:i,type:s}),range:I,scaleLabelType:C,setActiveValue:h,setIsPressed:p,useMobileStyling:l,value:H},S)}),U=M=>{M.preventDefault(),M.stopPropagation(),r({value:null,questionId:i,type:s})},R=()=>f(ge,{children:[f("div",{"aria-label":`Rating (1 - ${I})`,className:"ul-card--likert__numbers",role:"radiogroup",children:b}),f("div",{className:"ul-card--likert__labels",children:[f("span",{children:v}),f("span",{children:g})]}),!o.required&&f("div",{className:"ul-vertical-centered-container",children:f(se,{onClick:U,children:ut(o)})})]});return f("div",{className:O(Ie(x.CardMainContent,m)),children:f("form",{className:O([e,"ul-card--likert",x.FadeInTransition]),children:[f(ke,{message:n,properties:o}),f(Be,{properties:o,defaultBody:R})]},i)})},xs=({className:e,message:t,onSubmit:n,options:r=[],properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:l}=G(b=>({border:b.border,headers:b.headers,useMobileStyling:b.useMobileStyling})),d=r.reduce((b,U)=>(b[U.id]={isSelected:!1},b),{}),[h,u]=X(d),p=c["userleap-platform"],m=s===L.MultipleChoice,v=o.required,g=Object.entries(h).some(([b,U])=>{var S;const R=r.find(H=>`${H.id}`===b),M=U.userText===void 0||U.userText.trim()==="";return((S=R==null?void 0:R.optionProperties)==null?void 0:S.allowsTextEntry)&&M&&U.isSelected}),w=Object.values(h).some(b=>b.isSelected),_=g||v&&!w,C=r.map(({id:b,label:U,value:R,optionProperties:M},S)=>{var F,j;const H=`${b}`,{allowsTextEntry:y}=M||{allowsTextEntry:!1};return f(bs,{allowTextEntry:y,border:a,error:!1,id:H,index:S,isRadio:m,isSelected:!!((F=h[H])!=null&&F.isSelected),label:U,onUserInputChanged:ue=>I(ue.id,ue.selected,ue.userText),promptText:"Please specify",text:(j=h[b])==null?void 0:j.userText,useMobileStyling:l,value:R},H)}),E=b=>{b.preventDefault(),b.stopPropagation(),n(h)},I=(b,U,R)=>{const M=Object.assign({},h);if(m&&U)for(const S of Object.values(M))S.isSelected=!1,delete S.userText;M[b]={isSelected:U,userText:R},u(M)},N=()=>f("div",{children:[f("div",{className:O(K(x.ChoiceGroup,l)),role:m?"radiogroup":"group",children:C}),f("div",{className:"ul-card__button-wrapper",children:f(se,{disabled:_,onClick:E,children:ut(o)})})]});return f("div",{className:O(Ie(x.CardMainContent,p)),children:f("form",{className:O([e,"ul-card--multiple",x.FadeInTransition]),id:"text-form",onSubmit:E,children:[f(ke,{message:t,properties:o}),f(Be,{properties:o,defaultBody:N})]},i)})},gu=e=>{const{questionId:t,type:n,next:r,options:o}=e;return f(xs,{...e,onSubmit:s=>{const a=Object.entries(s).find(([,u])=>u.isSelected)||[void 0,void 0],[c,l]=a,d=o.find(u=>`${u.id}`===c),h=l!=null&&l.userText?{[c]:{userText:l.userText}}:null;r({value:d&&c?{[c]:d.value}:{},secondaryValue:h,questionId:t,type:n})}})},_u=e=>{const{questionId:t,type:n,next:r}=e;return f(xs,{...e,onSubmit:i=>{const s={},a=Object.entries(i).reduce((l,[d,h])=>(l[d]=h.isSelected,l),s),c=Object.entries(i).reduce((l,[d,h])=>{if(!h.userText)return l;const u=l||{};return u[d]={userText:h.userText},u},null);r({value:a,secondaryValue:c,questionId:t,type:n})}})},yu=({className:e,props:{labels:t,message:n,properties:r},next:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:l}=G(g=>({border:g.border,headers:g.headers,useMobileStyling:g.useMobileStyling})),d=c["userleap-platform"],h=t&&t.left,u=t&&t.right,p=[...Array(11)].map((g,w)=>f("div",{className:O([...K(x.NPSNumber,l),...K(`${x.NPSNumber}-${w}`,l)]),id:`option-${w}`,onClick:()=>o({value:w,questionId:i,type:s}),onKeyPress:_=>{_.preventDefault(),(_.key==="Enter"||_.key===" ")&&o({value:w,questionId:i,type:s})},onPointerDown:_=>{ot(_.target)&&(_.target.style.zIndex="2",_.target.style.borderColor=a)},onPointerLeave:_=>{ot(_.target)&&(_.target.style.zIndex="auto",_.target.style.borderColor=pr)},role:"radio",tabIndex:0,children:w},w)),m=g=>{g.preventDefault(),g.stopPropagation(),o({value:null,questionId:i,type:s})},v=()=>f("div",{children:[f("div",{className:"ul-card--nps__numbers",children:p}),f("div",{className:"ul-card--nps__labels",children:[f("span",{children:h}),f("span",{children:u})]}),!r.required&&f("div",{className:"ul-vertical-centered-container",children:f(se,{onClick:m,children:ut(r)})})]});return f("div",{className:O(Ie(x.CardMainContent,d)),children:f("form",{className:O([e,"ul-card--nps",x.FadeInTransition]),children:[f(ke,{message:n,properties:r}),f(Be,{properties:r,defaultBody:v})]},i)})},wu=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{border:s,headers:a,useMobileStyling:c,update:l}=G(b=>({border:b.border,headers:b.headers,useMobileStyling:b.useMobileStyling,update:b.update})),[d,h]=X(""),u=Ve(null),p=a["userleap-platform"],m=d.trim(),v=r.required===!0&&!m,g=Es(u,()=>l()),w=b=>{g(),b.preventDefault(),b.stopPropagation(),gt(b.target)&&h(b.target.value)},_=b=>{b.preventDefault(),b.stopPropagation(),n({value:d,questionId:o,type:i})},C=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",E=b=>{gt(b.target)&&(b.target.style.borderColor=s)},I=b=>{gt(b.target)&&(b.target.style.borderColor=pr)},N=()=>f("div",{className:"ul-card-text",children:[f("div",{className:"ul-card-text__container",children:f("textarea",{"aria-label":C,"aria-labelledby":x.QuestionHeader,"aria-multiline":"true","aria-placeholder":C,className:O(K(x.OpenTextInput,c)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:I,onChange:w,onFocus:E,placeholder:C,ref:u,role:"textbox",tabIndex:0})}),f(se,{disabled:v,onClick:_,style:{backgroundColor:v?"":s},children:ut(r)})]});return f("div",{className:O(Ie(x.CardMainContent,p)),children:f("form",{className:O([e,"ul-card--text",x.FadeInTransition]),id:"text-form",children:[f(ke,{message:t,properties:r}),f(Be,{defaultBody:N,properties:r})]},o)})};var Oe=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Oe||{});const ln=e=>e.type===le.AvPermission,Ss=e=>e.type===le.ScreenPermission,Eu=(e,t)=>!(ln(t)?t.permissionDescriptors:[]).includes(at.Camera)||e.getVideoTracks().length>0,Is=(e,t)=>{if(e===void 0)return Oe.RequestNeeded;if(e){if(!Eu(e,t))return Oe.RequestNeeded}else return Oe.TryAgain;return Oe.Ready},To={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},Ce=vs(e=>({...To,reset:()=>{e(To)},updatePage:t=>{e(t)}}));function zn({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:o}=Ce.getState(),{recorderEventEmitter:i}=G.getState();i.emit(te.AvPermission,{[V.PermissionDescriptors]:e.permissionDescriptors,[V.StreamReadyCallback]:(s,a)=>{if(n===s)return;let c=e;if(s&&!e.permissionDescriptors.includes(at.Camera)){const l=t.indexOf(e),d=a!=null&&a.active?l+2:l+1;(a==null?void 0:a.active)&&r&&i.emit(te.BeginRecording,{[V.RecordingMediaTypes]:r,[V.StartRecordingCallback]:h=>o({mediaRecordingUids:h})}),c=t[d]}o({currentPage:c,avStream:s})}})}function bu({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:o,next:i}){const{updatePage:s}=Ce.getState(),{eventEmitFn:a,recorderEventEmitter:c}=G.getState(),l={questionId:o,surveyId:r,visitorId:t,responseGroupUid:n};let d=0;c.emit(de.RecordedTaskPermissionScreen),a(de.RecordedTaskPermissionScreen),c.emit(te.PermissionStatus,{[V.PermissionStatusCallback]:(u,p,m,v)=>{const g=e[d],{type:w}=g,_=[fe.Screen];if(ln(g)){const{permissionDescriptors:C}=g,E=C==null?void 0:C.includes(at.Microphone),I=C==null?void 0:C.includes(at.Camera);E&&_.push(fe.Audio),I&&_.push(fe.Video);const N=(u==null?void 0:u.active)&&!I,b=(u==null?void 0:u.active)&&p;(N||b)&&d++}Ss(e[d])&&m&&(d++,c.emit(te.BeginRecording,{[V.RecordingMediaTypes]:_,[V.StartRecordingCallback]:C=>s({mediaRecordingUids:C})})),s({currentPage:e[d],avStream:u,screenPermissionRequested:m,nextQuestion:i,type:w,passthroughData:l,recordingMediaTypes:_,captureStream:v})}});const h=e[d];return h.type===le.AvPermission&&zn({currentPage:h,pages:e}),h}function Wn({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:o}=Ce.getState(),{recorderEventEmitter:i,handleUploadUpdate:s,index:a}=G.getState(),c={value:{taskStatus:e},type:L.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||i.emit(te.FinishTask,{[V.BeginCallback]:l=>{s({mediaRecordingUid:l,isSubmitted:!0,progressPct:0,isComplete:!1})},[V.ProgressCallback]:(l,d)=>{s({mediaRecordingUid:l,progressPct:d.detail,isSubmitted:!1,isComplete:!1})},[V.UploadCallback]:l=>{l&&s({mediaRecordingUid:l,isComplete:!0,isSubmitted:!0,progressPct:100})},[V.PassthroughData]:n,[V.CurrentIndex]:a,[V.TaskResponse]:c,[V.TaskCompleteCallback]:l=>{c.value.taskDurationMillisecond=l,r&&(c.value.mediaRecordingUids=r),o(),t(c)}})}function xr({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=G.getState(),{updatePage:o,currentPage:i,recordingMediaTypes:s,screenPermissionRequested:a}=Ce.getState();if(!i)return;const c=e.indexOf(i);switch(i.type){case le.AvPermission:{const l=a?c+2:c+1;a&&s&&n.emit(te.BeginRecording,{[V.RecordingMediaTypes]:s,[V.StartRecordingCallback]:d=>{o({mediaRecordingUids:d})}}),o({currentPage:e[l]});return}case le.ScreenPermission:n.emit(te.ScreenPermission,{[V.ScreenPermissionRequested]:t,[V.StreamReadyCallback]:(l,d)=>{const h=d?e[c+1]:i;d&&s&&n.emit(te.BeginRecording,{[V.RecordingMediaTypes]:s,[V.StartRecordingCallback]:u=>{o({captureStream:d,mediaRecordingUids:u})}}),o({currentPage:h,screenPermissionRequested:!0,captureStream:d})}});return;case le.StartTask:r(de.RecordedTaskStart),n.emit(de.RecordedTaskStart),n.emit(te.StartTask),o({currentPage:e[c+1],screenPermissionRequested:!0});return;case le.CompleteTask:return}}const ks="ul-permission-graphics-container",Ls="ul-permission-body",Ts=O([ks,"ul_recorded-task-inset-spacing"]),cn=O(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Rs=({richTextBody:e})=>f("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),dn=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:f(se,{className:O([n&&"ul-skip-button-below",x.InactiveButton]),onClick:Wn.bind(null,{status:ve.Abandoned}),children:t||"Skip"}),Sr=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:o}=Ce.getState(),i=(r==null?void 0:r.includes(fe.Audio))||(r==null?void 0:r.includes(fe.Video));ce(()=>{const s=setInterval(()=>{i&&t&&!t.active?o({avStream:null,currentPage:e[0]}):(!n||!n.active)&&o({captureStream:void 0,currentPage:e[i?1:0]})},1e3);return()=>clearInterval(s)},[t,n,i,e,r,o])},Cu=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o,taskDetail:i}=e;return Sr(t),f("div",{className:"ul-task-page",children:[f(Rs,{richTextBody:i}),f("div",{className:cn,children:[f(se,{onClick:xr.bind(null,{pages:t}),children:r}),f(dn,{required:n,skipButtonText:o})]})]},"start-task")},xu=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:o}=e;Sr(t);const s=f(Be,{properties:n,defaultBody:()=>f("div",{className:cn,children:[f(se,{className:"ul-complete-task-button",onClick:Wn.bind(null,{status:ve.Completed}),children:r}),f(se,{className:O([x.InactiveButton]),onClick:Wn.bind(null,{status:ve.GivenUp}),children:o})]})});return f("div",{className:"ul-task-page",children:[f(Rs,{richTextBody:e.taskDetail}),s]},"complete-task")},Su=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o}=e,[i]=G(c=>[c.tabTitle]),[s,a]=X(!1);return f("div",{children:[f("div",{className:Ts,children:[f("p",{style:{marginTop:"auto"},children:e.selectTabText}),f("div",{className:"ul-select-tab-container",children:f("p",{className:Ls,children:i})})]}),f("div",{className:n?"":cn,children:[f(se,{disabled:s,onClick:xr.bind(null,{pages:t,setIsRequestingPermission:a}),children:r}),f(dn,{required:n,skipButtonText:o})]})]})},Iu=({content:e})=>f("div",{className:O([ks,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),ku=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:o,skipButtonText:i,tryAgainButtonText:s}=e,a=ln(t[0])?t[0]:null;return ce(()=>{const c=setInterval(()=>{a!==null&&zn({currentPage:a,pages:t})},1e3);return()=>clearInterval(c)},[a,t]),a?f("div",{children:[f("div",{className:Ts,children:f("p",{className:"ul-av-permission-denied-paragraph",children:[f("span",{className:"ul-av-permission-denied-headline",children:r}),f("span",{className:Ls,children:o})]})}),f("div",{className:cn,children:[f(se,{onClick:zn.bind(null,{currentPage:a,pages:t}),children:s}),f(dn,{required:n,skipButtonText:i})]})]}):null},Lu=({stream:e})=>f("video",{autoPlay:!0,className:O(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Tu=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:o}=Ce.getState();return Sr(t),f("div",{children:[f(Lu,{stream:o}),f("div",{className:"ul-vertical-button-container-center",children:[f(se,{onClick:xr.bind(null,{pages:t}),children:e.buttonText}),f(dn,{bottom:!0,required:n,skipButtonText:r})]})]})},Ru=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:o}=Ce.getState();if(o===void 0)return null;switch(o==null?void 0:o.type){case le.AvPermission:{const i=Is(r,o);return i===Oe.RequestNeeded?f(Iu,{content:o}):i===Oe.TryAgain?f(ku,{content:o,pages:t,required:n}):f(Tu,{content:o,pages:t,required:n})}case le.ScreenPermission:return f(Su,{content:o,pages:t,required:n});case le.StartTask:return f(Cu,{content:o,pages:t,required:n});case le.CompleteTask:return f(xu,{content:o,pages:t,properties:e});default:return null}},Uu=({className:e,properties:t,next:n,questionId:r})=>{const o=G(),{headers:i,surveyId:s,responseGroupUid:a,userId:c}=o,l=Ce(),{screenPermissionRequested:d}=l,h=Ce(g=>g.avStream);let u=Ce(g=>g.currentPage);u||(u=bu({questionId:r,surveyId:s,next:g=>{n(g)},pages:t.pages,responseGroupUid:a,userId:c}));let p=u.headline,m=u.captionText;const v=Is(h,u);return Ss(u)&&d&&(p=u.permissionDeniedHeadline,m=u.permissionDeniedCaptionText),ln(u)&&v===Oe.Ready&&(p=u.permissionGrantedHeadline,m=u.permissionGrantedCaptionText),f("div",{className:O([...Ie(x.CardMainContent,i["userleap-platform"])]),children:f("div",{className:O([e,"ul-center-horizontally",x.FadeInTransition]),children:[f(ke,{message:p,properties:{captionText:m}}),f(Ru,{properties:t})]})})},Au={"{{user_id}}":"externalUserId","{{email}}":"email"},Ou=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[c,l]of Object.entries(Au))if(n.toLowerCase().includes(c))if(t[l]){const d=new RegExp(c,"gi");n=n.replace(d,t[l])}else r.push(c);if(r.length===0||!n.includes("?"))return n;const o=n.slice(0,n.indexOf("?")),s=n.slice(n.indexOf("?")+1).split("&").map(c=>c.split("=")).filter(c=>!r.includes(c[1]));if(s.length===0)return o;const a=s.map(c=>c.join("=")).join("&");return`${o}?${a}`},Nu=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,visitorAttributes:a}=G(p=>({headers:p.headers,visitorAttributes:p.visitorAttributes})),c=s["userleap-platform"],l=(p,m=!1)=>{n({value:m?{skipped:!0}:void 0,questionId:o,type:i})},d=p=>{(p.key==="Enter"||p.key===" ")&&n({value:void 0,questionId:o,type:i})},h=()=>f("div",{className:"ul-card-button-group",children:[f("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:Ou(r&&r.buttonUrl,a),id:"ul-card-text__button",onClick:l,onKeyPress:d,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:ut(r)}),r.required===!1&&f("button",{className:"ul-card-skip__button",onClick:p=>l(p,!0),children:Cr(r)})]}),u=(p,m)=>p?f("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:p},id:"ul-card__text-url-body-container"}):f("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(m?m.split(/\n\s*\n/g):[]).map((v,g)=>f("p",{children:v},g))});return f("div",{className:O(Ie(x.CardMainContent,c)),children:f("div",{className:O([e,"ul-card__text-url-prompt",x.FadeInTransition]),children:[f(ke,{message:t}),u(r&&r.richTextBody,r&&r.body),f(Be,{defaultBody:h,properties:r})]},o)})},Du=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:o,headers:i}=G(c=>({border:c.border,endCard:c.endCard,destroy:c.destroy,headers:c.headers}));ce(()=>{setTimeout(()=>{r(et)},2e3)},[r]);const s=o&&o.subheader?f("p",{className:x.Caption,children:o.subheader}):null,a=o&&o.headline?o.headline:"";return f("div",{className:O(Ie(x.CardMainContent,i["userleap-platform"])),children:f("div",{className:O([e,"ul-card--thanks",x.FadeInTransition]),children:f("div",{children:f("div",{className:"ul-card--thanks-content",children:[f("div",{className:"ul-thanks-check",children:f("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[f("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),f("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),f("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),f(ke,{message:a}),s]})})},t)})},Ge="https://cdn.sprig.com",T={document:void 0,videojs:void 0},Pu=`/* progress control styles */
|
|
29
30
|
.video-js .vjs-control {
|
|
30
31
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
31
32
|
}
|
|
@@ -682,5 +683,5 @@ span.ul-button-text {
|
|
|
682
683
|
.vjs-poster {
|
|
683
684
|
background-size: cover;
|
|
684
685
|
}
|
|
685
|
-
`,nl=e=>{const t=U.document.createElement("div");return t.className="ul-video-player-loading",t.id=In(e),["first","second","third","fourth"].map(n=>{const r=U.document.createElement("div");r.className=n,t.appendChild(r)}),t},In=e=>e+"-loading-spiner",G="hidden",mr=".m3u8",Wt="questionId",Gt="ul-video-recorder-camera-off-button",Kt="ul-recording-in-session",rl=[{type:"link",content:`${Oe}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Oe}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Oe}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Oe}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Oe}/userleap-web-upchunk-v2.2.2.js`}],ei=[{type:"link",content:`${Oe}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Oe}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:tl}],ti="-video-player",ni="-secondary-video-player",ri="-video-recorder";let pe,hr;const Se=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=U.document.documentElement;if(!r||!o)return;const a={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(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},be=async(e,t,n,r,o,i)=>{Se({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=U.document.documentElement,a={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},c={action:t,err:{message:e.message,stack:e.stack},meta:a,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(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},ol=(e,{type:t,content:n})=>new Promise(function(r,o){let i;t==="script"?(i=U.document.createElement("script"),i.src=n):t==="link"?(i=U.document.createElement("link"),i.rel="stylesheet",i.href=n,i.type="text/css"):(i=U.document.createElement("style"),i.innerHTML=n),i.onload=function(){r(n)},i.onerror=function(){o(n)},i.async=!1,i.id=btoa(n),e.appendChild(i)}),oi=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(ol(U.document.head,r)),n),[])).then(()=>{U.videojs=U.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},gr=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=G;else if(t==="success")e.style.visibility=G,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%)`}},Zt=(e,t)=>{const n=U.videojs(e.id());return n==null?void 0:n.payload[t]},il=(e,t,n,r,o)=>{const{surveyId:i,responseGroupUid:s,visitorId:a,envId:c}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(A.ERROR,{type:A.PERMISSION_DENIED}),Se({event:"Video Permission Denied",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Zt(e,Wt),responseGroupUid:s,surveyId:i}})):(n&&n(A.ERROR,{type:A.OTHER}),be(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,o,a,c))}),e.on("error",function(d,l){be(l||e.error(),"recorderError",t,o,a,c)}),e.on("startRecord",function(d,l){r(e.uploadProgressLabel,"none"),Se({event:"Video Record Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Zt(e,Wt),responseGroupUid:s,surveyId:i}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const d=Zt(e,Wt);if(!i){const g="internal error: missing fields in payload";return n&&n(A.ERROR,{type:A.OTHER}),be(new Error(g),"finishRecord",t,o,a,c),null}e.record().stopDevice();const l=e.cameraOff?A.MEDIA_TYPE_AUDIO:A.MEDIA_TYPE_VIDEO,m=Be();Se({event:"Video Record Finish",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l}});const p={surveyId:i,updatedAt:new Date().toISOString(),mediaType:l,mediaRecordingUid:m};d&&(p.questionId=d),s&&(p.responseGroupUid=s),a&&(p.visitorId=a);const h=await(async()=>{const g=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(g.ok){const v=await g.json();return n&&n(A.UPLOAD_STARTED,{[A.UPLOAD_ID]:v.upload.id,[A.MEDIA_TYPE]:l,[A.MEDIA_RECORDING_UID]:m}),v.upload.url}else return n&&n(A.ERROR,{type:A.OTHER,response:g}),be(new Error("failed to get upload response with url"),"finishRecord",t,o,a,c),null})();!h||(pe=U.document.defaultView.UpChunk.createUpload({endpoint:h,file:new U.document.defaultView.File([e.recordedData],`recording ${l} ${Date.now()}`),chunkSize:5120}),pe.startTime=Date.now(),Se({event:"Video Upload Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h}}),pe.on("error",g=>{r(e.uploadProgressLabel,"none"),n&&n(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:m}),be(g,"finishRecord",t,o,a,c)}),pe.on("progress",g=>{n&&n(A.UPLOAD_PROGRESS,{[A.MEDIA_RECORDING_UID]:m,[A.UPLOAD_PROGRESS_PCT]:g.detail}),r(e.uploadProgressLabel,"progress",g.detail)}),pe.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:m}),Se({event:"Video Upload Success",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h,elapsedMs:pe.startTime&&Date.now()-pe.startTime}})}))})},ii=(e,t)=>{const n=new(U.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),sl(n),n},sl=e=>{e.children().forEach(t=>{if(se[t.name_]){const n=bt(se[t.name_],`ul-${se[t.name_]}`);t.el_.appendChild(n)}})},bt=(e,t="")=>{const n=U.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},si=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(U.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(U.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const a=n&&n.src?ml(n.src):null;n&&(o||!a)?(e.children()[0].classList.add("vjs-hidden"),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%",a&&e.poster(a)),e.on("play",()=>{!o&&n&&!a&&cl(e,!1),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)},al=(e,t,n)=>{e.addClass(`ul${ni}`);const r=new(U.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},ll=(e,t,n,r,o,i,s,a=!1)=>{hr=Date.now();const d=Ut(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(!d)return;d.payload=n;const{surveyId:l,questionId:m,responseGroupUid:p,visitorId:f,envId:h}=n;let g;const v=k=>{const $=Gt,y=Gt+"-audio-only";gr(d.uploadProgressLabel,"none"),pe&&pe.startTime>=hr&&pe.abort();const B=U.document.getElementById("ul-camera-button");k?(d.children()[0].classList.add("vjs-hidden"),b.removeClass($),b.addClass(y),B.innerHTML=se.TurnOnCamera,d.audioPlayerPlaceholder.removeClass("vjs-hidden"),g==null||g.getTracks().forEach(O=>{O.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(O=>{g=O,O.getVideoTracks().forEach(ie=>{ie.enabled=!1}),d.record().onDeviceReady(O)}).catch(d.record().onDeviceError.bind(d.record()))):(g==null||g.getVideoTracks().forEach(O=>{O.enabled=!0}),d.children()[0].classList.remove("vjs-hidden"),d.record().getDevice(),b.removeClass(y),b.addClass($),B.innerHTML=se.TurnOffCamera,d.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{w.hasClass(G)||(Se({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:f,envId:h,metadata:{questionId:m,responseGroupUid:p,surveyId:l}}),v(d.cameraOff),o(A.DELETE,{}),b.removeClass(G),w.addClass(G))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(bt(se.DeleteButton,"ul-delete-button"));const _=U.document.getElementById(t),S=()=>{_.classList.contains("vjs-fullscreen")&&d.cameraOff?_.style.display="table":_.style.display="flex"};S();const b=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{d.record().isRecording()||(d.cameraOff=!d.cameraOff,Se({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:m,responseGroupUid:p,surveyId:l,cameraOff:d.cameraOff}}),v(d.cameraOff),!w.hasClass(G)&&w.addClass(G),o(A.DELETE,{}),S())}});b.addClass(Gt),b.el_.appendChild(bt(se.TurnOffCamera,"ul-camera-button"));const E=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{const k=U.document.getElementById("ul-recorder-toggle");if(d.record().isRecording())d.record().stop(),k&&(k.innerHTML=se.RecordButton),E.removeClass(Kt),w.removeClass(G);else{const $=U.document.getElementById("ul-recording-countdown-screen");if($)$.remove(),k&&(k.innerHTML=se.RecordButton),v(d.cameraOff),o(A.DELETE,{}),b.removeClass(G),w.addClass(G),E.removeClass(Kt),P.show();else{E.addClass(Kt),P.hide(),b.addClass(G),w.addClass(G),k&&(k.innerHTML=se.StopButton);const y=U.document.createElement("div");y.id="ul-recording-countdown-screen",_.insertBefore(y,_.children[1]),y.style.height=`${_.offsetHeight}px`,ai(d,3)}}}});E.addClass("ul-video-recorder-toggle-button"),E.el_.appendChild(bt(se.RecordButton,"ul-recorder-toggle"));const D=U.document.createElement("p");D.style.visibility="hidden",D.className="ul-upload-progress-label",e.appendChild(D),d.uploadProgressLabel=D;const x=ii(d,[w,b,"PlayToggle",E,"FullscreenToggle"]),P=x.children().find(k=>k.name_==="FullscreenToggle");P.hasClass("vjs-disabled")&&P.hide();const T=x.children().find(k=>k.name_==="PlayToggle");T.hide(),i&&b.addClass(G),!i&&w.addClass(G),si(d,x,i,!1,a),d.on("stopRecord",()=>{E.hide(),T.show(),P.show(),w.removeClass(G)}),d.on("deviceReady",()=>{E.show(),T.hide(),w.addClass(G)}),il(d,r,o,gr,s),i&&(d.deviceButton&&d.deviceButton.hide(),d.src(i),T.show(),E.hide(),w.removeClass(G));const V=[{name:"microphone"}];!d.cameraOff&&V.push({name:"camera"}),Promise.all(V.map(k=>{var $;return($=navigator==null?void 0:navigator.permissions)==null?void 0:$.query(k)})).then(k=>{k.reduce((y,B)=>y&B.state==="granted",!0)&&d&&(d.deviceButton&&d.deviceButton.hide(),!i&&d.record().getDevice())}).catch(k=>{})},ai=(e,t=3)=>{const n=U.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(()=>{ai(e,t-1)},1e3))},li=e=>{const t=U.document.createElement("div");return t.className="ul-video-container",t.appendChild(nl(e)),t},un=(e,t)=>{const n=U.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=U.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=U.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},cl=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Ut=(e,t)=>U.document.getElementById(e)?t?U.videojs(e,t):U.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),dl=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,a=null)=>{U.document=i;const c=e+ti,d=li(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),oi(ei,()=>{U.document.getElementById(In(c)).remove(),un(c,d);const l={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const m=e+ni;un(m,d);const p=Ut(c,l),f=Ut(m,{muted:!0,...l});if(!p||!f)return;al(f,s,a),s||f.addClass(G);const h=ii(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),g=h.children().find(v=>v.name_==="FullscreenToggle");g.hasClass("vjs-disabled")&&g.hide(),si(p,h,t,n,r,f)}catch(m){be(new Error(`Error when creating video player object ${m}`),"playerDeviceError",o,{});return}}),d},ul=(e,t={},n="https://api.userleap.com",r,o,i,s=!1,a=document)=>{U.document=a;const c=e+ri,d=li(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,i,t.visitorId,t.envId)}),oi(ei.concat(rl),()=>{un(c,d),U.document.getElementById(In(c)).remove();try{ll(d,c,t,n,r,o,i,s)}catch(l){be(new Error(`Error when creating video recorder player object ${l}`),"recorderDeviceError",n,i,t.visitorId,t.envId);return}}),d},pl=e=>{const t=e+ri;if(!!U.document.getElementById(t)&&!!U.videojs){try{if(!U.videojs(t).record().stream)return}catch{return}U.videojs(t).record().stop(),U.videojs(t).record().stopDevice()}},fl=e=>{const t=Ut(e+ti);t==null||t.pause()},ml=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(mr)&&(n=n.replace(mr,"")),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"},se={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},Xe="ul-card-video__player_recorder",hl="ul-card-video__skip_button",gl="ul-video-interview-form",vr="ul-video-btn",vl=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:a,handleUploadUpdate:c,headers:d,responseGroupUid:l,surveyId:m,viewDocument:p,visitorId:f}=z(y=>({apiURL:y.apiURL,envId:y.envId,handleUploadUpdate:y.handleUploadUpdate,headers:y.headers,responseGroupUid:y.responseGroupUid,surveyId:y.surveyId,viewDocument:y.viewDocument,visitorId:y.userId})),[h,g]=Z(!1),[v,w]=Z(null),[_,S]=Z(null),[b,E]=Z(0),D=d["userleap-platform"],x=r&&r.videoUrl,P=(y,B)=>{y===A.UPLOAD_STARTED?(w(B[A.UPLOAD_ID]),S(B[A.MEDIA_RECORDING_UID]),g(!0)):y===A.DELETE?(w(null),S(null),g(!1)):y===A.UPLOAD_PROGRESS?isNaN(B[A.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],progressPct:B[A.UPLOAD_PROGRESS_PCT]}):y===A.UPLOAD_FINISHED&&c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],isComplete:!0})},T=y=>{if(y&&y.children.length===0){const B=dl(Xe,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===A.MEDIA_TYPE_AUDIO,s,p);y.appendChild(B)}},V=y=>{if(y&&y.children.length===0){const B=ul(Xe,{surveyId:m,responseGroupUid:l,questionId:o,visitorId:f,envId:a},s,P,void 0,{...d,"x-ul-video-recorder-origin":"sdk"},r.mediaType===A.MEDIA_TYPE_AUDIO,p);y.appendChild(B)}},k=y=>{y.preventDefault(),y.stopPropagation(),pl(Xe),v&&_?(c({mediaRecordingUid:_,isSubmitted:!0}),n({value:{mediaRecordingUid:_},questionId:o,type:i})):n({value:null,questionId:o,type:i})},$=()=>u(Re,{defaultBody:()=>u("button",{className:`${vr} ul-record-response-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),fl(Xe),E(1)}}),properties:r});return u("div",{className:R(_e(C.CardMainContent,D)),style:{marginTop:"unset"},children:u("form",{className:R([e,C.VideoCard,C.FadeInTransition]),id:gl,children:[u(ye,{message:t,properties:r}),u("div",{id:"ul-card-voice__video",children:[u("div",{children:[u("div",{id:"ul-question-player-container",style:{display:b===0?"":"none"},children:[u("div",{id:Xe,ref:T}),$()]}),u("div",{style:{display:b===1?"block":"none"},children:[u("button",{className:`${vr} ul-back-question-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),E(0)}}),u("div",{id:"ul-recorder-player-container",ref:V})]})]}),u(X,{disabled:!h,onClick:k,children:Je(r)}),u("button",{className:`ul-card-text__button ${C.InactiveButton}`,id:hl,onClick:k,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:Sn(r)})]})]})})},wl=({className:e})=>{const{headers:t,uploadProgress:n}=z(s=>({headers:s.headers,uploadProgress:s.uploadProgress}));let r,o;Object.values(n).filter(s=>s.isSubmitted).length>1?(r="Your responses are processing",o="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",o="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(n).filter(s=>s.isSubmitted).map(s=>s.progressPct)));return u("div",{className:R(_e(C.CardMainContent,t["userleap-platform"])),children:u("div",{className:R([e,"ul-card--uploading",C.FadeInTransition]),children:[u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:C.LoadingSpinnerContainer,role:"progressbar",children:u("div",{className:C.LoadingSpinner,children:[u("div",{className:C.LoadingSpinnerFirst}),u("div",{className:C.LoadingSpinnerSecond}),u("div",{className:C.LoadingSpinnerThird}),u("div",{className:C.LoadingSpinnerFourth})]})}),u(ye,{message:`${r} (${i}% complete)`}),u("p",{className:C.Caption,children:o})]})})},wr=()=>u("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),u("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),u("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),u("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),u("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),u("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),u("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),u("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),u("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),u("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),u("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),u("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),u("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),u("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),_l=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:o,showSurveyBrand:i,slugName:s,surveyId:a,viewedCardCount:c}=z(g=>({border:g.border,cards:g.cards,headers:g.headers,index:g.index,marketingUrl:g.marketingUrl,showSurveyBrand:g.showSurveyBrand,slugName:g.slugName,surveyId:g.surveyId,viewedCardCount:g.viewedCardCount})),d=Te(null),l=t.filter(g=>g.type!==I.Uploading&&g.type!==I.Thanks),m=xa(t,r),p=c+1,f=p/(p+m);re(()=>{d.current&&(d.current.style.width=`${f*100}%`)},[f]);const h=()=>i?u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(wr,{})}):null;return!l||l.length===1?u("footer",{className:"ul-footer",style:i?{}:{marginBottom:"10px"},children:h()}):u("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[l.length>1&&u("div",{id:"ul-progress-bar-container",children:u("div",{id:"ul-progress-bar-current",ref:d,style:{border:`1px solid ${e||"#000"}`}})}),i&&u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(wr,{})})]})},yl=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:a,fontFamily:c,headers:d,index:l,next:m,showStripes:p,update:f,useMobileStyling:h,viewDocument:g}=z(y=>({answers:y.answers,border:y.border,cards:y.cards,close:y.close,configureExitOnOverlayClick:y.configureExitOnOverlayClick,destroy:y.destroy,endCard:y.endCard,eventEmitFn:y.eventEmitFn,fontFamily:y.fontFamily,headers:y.headers,index:y.index,next:y.next,showStripes:y.showStripes,update:y.update,useMobileStyling:y.useMobileStyling,viewDocument:y.viewDocument})),v=Te(null),w=Te(!1),{props:_,type:S,name:b}=n[l],E=n.length;re(()=>{v.current&&(v.current.classList.contains("ul-app--visible")||v.current.classList.add("ul-app--visible"),!w.current&&a&&(w.current=!0,a(j.SurveyAppeared)))},[a]),re(()=>{f()},[l,f]),re(()=>{o(()=>r())},[r,o]);const D=()=>r(ze),x=y=>{y.key==="Enter"&&D()},P=async function(y){m({data:y,completeSurvey:()=>{i(ze)},endCard:s}),Ui(g)};if(e){for(const y of e)if(y.questionId===b){let B;if(S===I.MultipleChoice){const O=_.options.find(({value:ie})=>ie===y.value);if(!O)break;B={[O.id]:O.value}}else B=y.value;P({value:B,type:S,questionId:y.questionId});break}}const T=()=>[Fe.Email,Fe.Link].includes(d["userleap-platform"])?!1:!s||l+1!==E,V=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},k=()=>{const y={className:"ul-card",next:P,questionId:b,type:S};switch(S){case I.ConsentLegal:return q(Da,{...y,..._,key:b});case I.Likert:return q(ja,{...y,..._,key:b});case I.MultipleChoice:return q(Oa,{...y,..._,key:b});case I.MultipleSelect:return q(Ma,{...y,..._,key:b});case I.NPS:return q(Na,{...y,key:b,props:_});case I.Open:return q(Va,{...y,..._,key:b});case I.RecordedTask:return q(Ya,{...y,..._,key:b});case I.TextUrlPrompt:return q(Xa,{...y,..._,key:b});case I.Thanks:return q(el,{...y,..._,key:b});case I.Uploading:return q(wl,{...y,..._,key:b});case I.VideoVoice:return q(vl,{...y,..._,key:b});default:return null}},$=y=>{var Rn;const B=window.sprigAPI,O=y.target;if(!B||!O)return;const ie=[O,O.parentElement];for(const ft of ie)if(((Rn=ft==null?void 0:ft.tagName)==null?void 0:Rn.toLowerCase())==="a"){y.preventDefault(),B==null||B.openUrl(ft.href);return}};return u("div",{className:R("ul-app",qe(d)?"ul-app--visible":"ul-app--overlay"),id:ze,onClick:$,ref:v,style:{"--theme":t,...c?{fontFamily:c.replace(";","")}:{}},children:u("div",{className:"ul-app__container",children:[u("div",{className:R(W(C.CardContainer,h)),style:V(),children:[p&&u("div",{className:"ul-header__container",children:u("div",{className:"ul-header",children:"For development purposes only"})}),k(),u(_l,{})]}),T()&&u("div",{className:R(W(C.CloseContainer,h)),children:u("div",{"aria-label":"Close button",className:C.CloseButton,onClick:D,onKeyPress:x,role:"button",tabIndex:0,children:u("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})})]})})},bl=`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}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content: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 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;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{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.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{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.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;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}.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)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.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}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[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{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@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}.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:rgba(0,0,0,.01);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:white}.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}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-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:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-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}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.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{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.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;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-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}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.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--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.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:rgba(0,0,0,.01);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:white}.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}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#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:#ffffff;border-radius:5px;text-align:left;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.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:30px}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}#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;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.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;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
|
|
686
|
-
`,xl=(e,t)=>{const n=[...e],r=new Set([I.VideoVoice,I.RecordedTask]);return e.some(o=>r.has(o.type))&&n.push({name:-2,props:{routingOptions:[]},type:I.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:I.Thanks}),n},Cl=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function kl(e,t=!0){var b,E,D;const{answers:n,apiURL:r,customStyles:o,endCard:i,eventEmitFn:s,fontFamilyURL:a,frame:c,UpChunk:d,viewDocument:l,viewWindow:m}=e,p=qe(e.headers)?e.frame:l.body,f=F,h=xl(e.cards,!!i);_t.configure(f,{cards:h,hasEndCard:!!i,apiURL:r,UpChunk:d}),z.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:s,fontFamily:e.fontFamily,frame:c,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Cl({mode:e.mode,viewWindow:m,viewDocument:l}),mode:e.mode,previewKey:(b=window.UserLeap)!=null&&b.localStorageAvailable?(E=window.localStorage)==null?void 0:E.getItem(J.Preview):null,recorder:_t,recorderEventEmitter:f,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,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{seen:g}=z.getState();g();const{head:v}=l,w=l.createElement("style");if(w.id="sprig-style",w.textContent=bl,w.nonce=e.styleNonce,v.appendChild(w),e.fontFamily&&a&&parent){const x=l.createElement("link");x.rel="stylesheet",x.href=a,v.appendChild(x)}if(e.customStyles&&Cr(l,o,e.styleNonce),!d)if(e.installationMethod!==Ie.Npm){const x=l.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{_t.setUpChunk(m.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},v.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const _="2.22.4",S=s||((D=c.eventEmitter)==null?void 0:D.emit);S==null||S(oe.VerifyViewVersion,{[Me.ViewVersion]:_}),p&&t&&Ke(u(yl,{}),p)}const Sl={configure:kl};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 El="rgba(255,255,255, 0.95)",Ll="rgba(0,0,0,0.9)",Il="360px",Yt="0px",ci=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},di=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,Q("trackStartUrl",null),F.emit(j.SurveyLifeCycle,{state:"dismissed"}),F.emit(j.SurveyClosed,{name:j.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},ui=()=>{F.on(j.SurveyWillClose,({initiator:e})=>{di(e)})},Ul=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},o=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=o==="light"?El:Ll,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Tl=(e,t,n)=>{var a,c;const r={position:"fixed",bottom:"0px",right:Yt,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},o=Object.assign({},t,window.UserLeap);let i,s=!1;return n?((a=window.UserLeap.windowDimensions)!=null&&a.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(o.overlayStyleMobile)&&(s=!0)):(r.width=Il,r.maxHeight=window.UserLeap.maxHeight||"66vh",o.framePosition===nt.BottomLeft?i={left:Yt}:o.framePosition===nt.TopLeft?i={left:Yt,top:"0px"}:o.framePosition===nt.TopRight?i={top:"0px"}:o.framePosition===nt.Center&&(s=!0,i={margin:"auto",position:"static"},r.maxHeight=null)),s&&Ul(o,n),Object.assign(e.style,r,i),s},Pl=(e,t)=>{var a,c;const n="ul-frame";ci();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const o=Tl(r,e,t);F.on(j.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),ui(),r.setHeight=d=>{parseInt(r.style.height)!=d&&(r.style.height=`${d}px`,F.emit(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:d}))},(a=window.UserLeap.container)==null||a.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{F.emit(j.CloseSurveyOnOverlayClick)}),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented});const i=(c=r.contentWindow)==null?void 0:c.document;i&&(i.open("text/html","replace"),i.write("<!doctype html><head></head><body></body></html>"),i.close());const s=i==null?void 0:i.head;return{frameId:n,contentWinDocHead:s,contentWindow:r.contentWindow,hasOverlay:o,iframe:r}},Rl="!optimizely_experiments_";class Dl{constructor(){te(this,"_optimizelyData",{})}setOptimizelyExperiment(t){if(!t||typeof t!="object")return!1;const{experiments:n}=t;try{return Object.keys(this._optimizelyData).map(r=>{delete this._optimizelyData[r]}),n&&n.map(r=>{const{id:o,variation:i}=r,s=this.transformExperimentId(o);i&&typeof i=="string"&&(this._optimizelyData[s]=i)}),!0}catch(r){return r instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",r),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return Rl+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(o=>{var i,s;return(i=n[o].variation)!=null&&i.name?{id:o,variation:(s=n[o].variation)==null?void 0:s.name}:{id:o,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r}),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const xt=new Dl;Object.freeze(xt);class Al{constructor(t,n){te(this,"paused");te(this,"queue");te(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}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 n=Array.prototype.slice.call(t,1),r=t[0],o=this.ul[r];o instanceof Function?o.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(o){n=function(){o(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const jl=["popState","pushState","replaceState"],Ol={test:"test"},et="!email",Ml=["ios","android"],Le="environments",pn="pageUrl",De="visitors",_r="ul-view-sdk-script",yr=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 Un(e,t){const{matchType:n,pattern:r}=e,o=n?yr[n]:yr.legacy;let i=!1;try{i=o(r,t)}catch(s){const a=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;s instanceof Error&&(console.warn(a,s),s.stack=JSON.stringify(e),window.UserLeap.reportError(a,s))}return i}function Nl(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:o}=window.UserLeap._config;if(!o)return!0;const i=[];n&&n.length&&i.push(...n),r&&r.length&&i.push(...r);const s=e&&i.find(a=>a.id===e);return s?Un(s,window.location.href):t===window.location.href}function lt(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:o}=window.UserLeap._config;if(o&&o!==Fe.Web)return;const i=Ae("trackStartUrl"),s=i?String(i):null;t&&zl(window.location.href),n&&(fi(),Vl()),r&&s&&s!==window.location.href&&e&&jl.includes(e.type)&&window.UserLeap("dismissActiveSurvey",he.PageChange)}const pi={capture:!0},Vl=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Un(r,window.location.href)).map(r=>{const{name:o,properties:i}=r,{selector:s,innerText:a}=i;return s?c=>{if(We(c.target))try{c.target.closest(s)&&window.UserLeap("track",o)}catch{}return!1}:c=>(We(c.target)&&c.target.innerText===a&&window.UserLeap("track",o),!1)}),n=r=>t.forEach(o=>o(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,pi)},fi=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,pi),delete window.UserLeap._config.interactiveEventsHandler};function Bl(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,lt,!0))}function Fl(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,lt,!0)),window.UserLeap._config.interactiveEvents&&fi()}function me(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(o=>{r.push(o),o===Le?r.push(window.UserLeap.envId):o===De&&r.push(Tn())}),n&&r.push(n),r.join("/")}function $l(e,t){let n=me("1",[Le],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Hl(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ae(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(J.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function Q(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(J.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(i){i instanceof Error&&(i.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",i)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",i)}let o=r[window.UserLeap.envId];o?o[e]=t:o={[e]:t},r[window.UserLeap.envId]=o;try{localStorage.setItem(J.Credentials,JSON.stringify(r))}catch(i){i instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${i.message}`)}}function mi(){window.previewMode||(window.UserLeap.visitorId=Be(),Q("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Tn(){return window.previewMode?"0":window.UserLeap.visitorId||""}function zl(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let a=!1;for(let c=0;c<t.length&&(a=Un(t[c],e),!a);c++);if(!a)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let o=[];const i={viewedAt:Date.now(),location:e},s=localStorage.getItem(J.PageViews);try{if(o=s?JSON.parse(s):[],Array.isArray(o)||(o=[]),o.length>0){const a=o[o.length-1],c=(Date.now()-a.viewedAt)/1e3;(a.location!=e&&c>r||c>n)&&(window.UserLeap._queue.push(["track",pn,null,{url:e}]),o.push(i))}else window.UserLeap._queue.push(["track",pn,null,{url:e}]),o.push(i);o.length>5&&o.splice(0,o.length-5);try{localStorage.setItem(J.PageViews,JSON.stringify(o))}catch(a){a instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${a.message}`)}}catch(a){a instanceof Error&&(a.stack=s||"",window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ql(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const o=t.apply(this,r),i=new Event("pushState");return window.dispatchEvent(i),lt(i),o})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const o=t.apply(this,r),i=new Event("replaceState");return window.dispatchEvent(i),lt(i),o})(e.replaceState)),Bl()}async function Qt(e,t){const n=Tn();e&&!t&&(window.UserLeap._config.mode=Ol.test);const r=await ke($l(n,e),{},0,!0);return r.ok?(r.json.delay&&await Ct(r.json.delay),hi(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const hi=async(e,t)=>{var y,B;const{context:n,endCard:r,locale:o,productConfig:i,questions:s,responseGroupUid:a,surveyId:c,uuid:d,vid:l,sessionReplay:m}=e,p=dt(window.UserLeap),f=Pn(p),h=Wl(p);if(m&&Ls(a,c,l,m,p,window.UserLeap._API_URL),l==null||!s||!s.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const O="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(O),{success:!1,message:O,surveyState:"no survey"}}if(l!==window.UserLeap.visitorId&&d!==window.UserLeap.visitorId&&!window.previewMode){const O="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(O)),{success:!1,message:O,surveyState:"no survey"}}if(!(t?await t(c):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Jt.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[br.SurveyId]:c});let v,w=document.createElement("div"),_,S,b;const E=O=>{const{[Me.ViewVersion]:ie}=O;ie!==p["x-ul-sdk-version"]&&di(),F.removeListener(oe.VerifyViewVersion,E)};F.on(oe.VerifyViewVersion,E),qe(p)?(v="ul-direct-embeded-frame",_=document.head,S=window,b=!1,f&&(ci(),w.id=v,window.UserLeap.container.appendChild(w),ui(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented}))):{frameId:v,contentWinDocHead:_,contentWindow:S,hasOverlay:b,iframe:w}=Pl(i,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const D=O=>{F.on(j.CloseSurveyOnOverlayClick,O)},x=Object.assign({frame:w,envId:window.UserLeap.envId,surveyId:c,userId:d,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:s,context:n,locale:o,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:a,headers:p,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:D,eventEmitFn:F.emit.bind(F),ulEvents:mn,viewDocument:S==null?void 0:S.document,viewWindow:S,tabTitle:document.title,startingQuestionIdx:(y=window.UserLeap.config)==null?void 0:y.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce},window.UserLeap._config);(B=window.UserLeap.config)!=null&&B.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),S&&(S.__cfg=x);function P(){const O=document.createElement("script");return window.UserLeap.nonce&&O.setAttribute("nonce",window.UserLeap.nonce),O.id=_r,O}const T=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,V=document.getElementById(_r);V&&V.remove();const k=P(),$=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===Ie.Npm?(Sl.configure(x),b&&window.UserLeap.container&&$()):T&&(k.src=T,b&&k.addEventListener("load",()=>{window.UserLeap.container&&$()}),S==null||S.addEventListener("error",O=>{O.target instanceof HTMLScriptElement&&O.target.src===T&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(k),{success:!0,surveyState:"ready"}};function Wl(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Pn(e)||t>10&&t<xi}function Pn(e){return Ml.includes(e[fe.Platform])}function Gl(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Kl(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Gl(t),(t||n||r)&&(ql(),lt())}async function ke(e,t,n=0,r=!1){var i,s;t.headers=Object.assign(dt(window.UserLeap),t.headers);const o=await ge(e,t,n,r);if(o.ok){const a=(i=o.headers)==null?void 0:i.get("Authorization"),c=a?a.split(" "):void 0,d=c&&c.length===2?c[1]:void 0,l=(s=o.headers)==null?void 0:s.get(fe.VisitorID);d&&l&&(l!==window.UserLeap.visitorId||window.UserLeap.token!==d)&&(Q("token",d),Q("vid",l),F.emit(j.VisitorIDUpdated,{visitorId:l}),window.UserLeap.token=d,window.UserLeap.visitorId=l)}return o.json&&o.json.logMessage&&console.warn(`[Sprig] ${o.json.logMessage}`),o}async function Zl(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await Ct(e.json.delay),window.UserLeap.delayingSurvey=!1)}const Yl=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,v;const{userId:o,anonymousId:i,metadata:s={},properties:a,showSurveyCallback:c}=r;let{eventName:d}=r;if(window.UserLeap.debugMode&&d!==pn&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const l=window.UserLeap.localStorageAvailable&&(h=localStorage.getItem(J.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const w="[Sprig] - Skipping tracking without userId";return console.warn(w),{success:!1,message:w,surveyState:"no survey"}}if(!d||d.trim().length===0){d=d?String(d):"";const w="[Sprig] - Invalid event name "+d;return console.warn(w),{success:!1,message:w,surveyState:"no survey"}}const m=window.location.href;if(s.url||(s.url=m),Q("trackStartUrl",m),(v=(g=window.UserLeap)==null?void 0:g._config)!=null&&v.optimizelyEnabled){const w=dt(window.UserLeap);Pn(w)||xt.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},xt.getAllOptimizelyExperiments())}o&&(window.UserLeap.userId=o),i&&(window.UserLeap.partnerAnonymousId=i),a&&(s.eventProperties=a);const p=window.UserLeap.delayingSurvey?await ke(me("1",[De],"events/batch"),{body:JSON.stringify({events:[{event:d,metadata:s}],previewKey:l}),method:"POST"},0,!0):await ke(me("1",[De],"events"),{body:JSON.stringify({event:d,metadata:s,previewKey:l}),method:"POST"},0,!0);if(!p.ok){const w="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(w,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:w,error:p.error,surveyState:"no survey"}}o&&Q("uid",o),i&&Q("aid",i);const f=p.json;return f.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(J.Preview),await Zl(p),Nl(f.eventId,m)?hi(f,c):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=he.API){F.emit(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:r})},async setAttribute(r,o){if(!r||!o&&o!==0){const i="[Sprig] - Disregarding empty attribute / value provided";return console.warn(i),{success:!1,message:i}}return this.setAttributes({[r]:o})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const d="[Sprig] - Disregarding empty payload provided";return console.warn(d),{success:!1,message:d}}const{userId:o,anonymousId:i,attributes:s}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const d="[Sprig] - Skipping tracking without userId";return console.warn(d),{success:!1,message:d}}if(!s&&(!o||window.UserLeap.userId===o)&&(!i||window.UserLeap.partnerAnonymousId===i))return{success:!0};const a={};o&&(a.userId=window.UserLeap.userId=o),i&&(a.partnerAnonymousId=window.UserLeap.partnerAnonymousId=i);let c;return s?(s.email&&!Object.prototype.hasOwnProperty.call(s,et)&&(s[et]=s.email,delete s.email),c=await ke(me("1",[Le,De],"attributes"),{body:JSON.stringify(s),method:"PUT"}),!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await ke(me("1",[Le,De]),{body:JSON.stringify(a),method:"PUT"}),s&&s[et]&&(window.UserLeap.email=s[et]),c.ok&&(o&&Q("uid",o),i&&Q("aid",i)),{success:!!c.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const i="[Sprig] - Skipping tracking without userId";return console.warn(i),{success:!1,message:i}}const o=await ke(me("1",[Le,De],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&window.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(r){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,o){F.on(r,o)},async removeListener(r,o){F.removeListener(r,o)},async removeAllListeners(){F.removeAllListeners()},setVisitorAttribute(r,o){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,o)},async setEmail(r){return n.setAttribute(et,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const s=`[Sprig] - Invalid userId ${r}`;return console.warn(s),{success:!1,message:s}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const o=window.UserLeap.visitorId,i=await ke(me("1",[Le,De]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!i.ok){i.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",i.error),i.error&&window.UserLeap.reportError("setUserId",i.error));return}o!==window.UserLeap.visitorId&&Vn(),Q("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const o=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(o),{success:!1,message:o}}return window.UserLeap.partnerAnonymousId=r,Q("aid",r),{success:!0}},async track(r,o,i={},s=void 0){return t({eventName:r,properties:o,metadata:i,showSurveyCallback:s})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const o=window.UserLeap.container.children[0].contentDocument;if(o){const i=o.getElementById(C.CustomStyle);i?i.textContent=r:Cr(o,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,o){var c,d;const i=typeof r=="string"?parseInt(r,10):r,s=typeof o=="string"?parseInt(o,10):o;if(!isNaN(i)&&!isNaN(s)&&(window.UserLeap.windowDimensions={width:i,height:s}),!window.UserLeap.frameId)return;const a=document.getElementById(window.UserLeap.frameId);!a||(window.UserLeap.useMobileStyling&&((c=window.UserLeap.windowDimensions)!=null&&c.width&&(a.style.width=`${window.UserLeap.windowDimensions.width}px`),(d=window.UserLeap.windowDimensions)!=null&&d.height&&(a.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),a.contentDocument&&(a.style.height=String(kr(a.contentDocument))+"px")),F.emit(j.SurveyDimensions,{name:j.SurveyDimensions,contentFrameWidth:a.clientWidth,contentFrameHeight:a.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(J.Credentials),localStorage.removeItem(J.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),mi(),Vn(),window.UserLeap._queue.unpause()},teardown(){Fl(),window.UserLeap("dismissActiveSurvey",he.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r){const o=JSON.parse(r);xt.setOptimizelyExperiment(o)}};Object.assign(window.UserLeap,n)};async function Ql(e){const t=dt(window.UserLeap);let n=await ge(me("1",[Le],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await ge(me("1",[Le],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Xt("Disabled: failed to fetch configuration"),e;const o=n.json;return o!=null&&o.disabled?(Xt(`Disabled: ${o.disabled}`),{disabled:o.disabled}):Object.assign({},o,e)}async function Jl(e,t){const n=window.__cfg&&window.__cfg.mode,r=Tn(),o=window.UserLeap.envId,i=window.document.documentElement,s={mode:n,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:i.clientWidth,clientHeight:i.clientHeight,location:window.location.href,language:window.navigator.language},a={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:r,envId:o};(await ke(me("1",null,"errors"),{method:"POST",headers:{[fe.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(a)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Xl(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=Hl();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(J.Preview,t),window.UserLeap.UPDATES=mn;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Jl,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const c in window.UserLeap._config)window.UserLeap[c]=window.UserLeap._config[c];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let c=Ae("sampled");if(c===null&&(c=Math.random()<o,Q("sampled",c)),!c)return}else n&&Ae("sampled")!==null&&Q("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const i=[...window.UserLeap._queue];window.UserLeap._queue=new Al(window.UserLeap,[]),window.UserLeap._queue.pause();for(let c=0;c<i.length;c++)window.UserLeap._queue.push(i[c]);const s=Ae("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ae("vid"),window.UserLeap.userId=Ae("uid"),window.UserLeap.partnerAnonymousId=Ae("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(J.Credentials),mi());const a=await Ql(e);ws(window.document,a.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,a.replaySettings),Yl(a),await Kl(a),window.UserLeap._queue.unpause(),F.emit(j.SDKReady),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Tt{constructor(){te(this,"UPDATES",mn)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}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,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const fn={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=Ie.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Tt.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Tt.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Xl(e),window.Sprig}},ec={sprig:fn,SprigAPI:Tt,configure:fn.configure};exports.DismissReason=he;exports.SprigAPI=Tt;exports.SprigEvent=j;exports.default=ec;exports.sprig=fn;
|
|
686
|
+
`,ju=e=>{const t=T.document.createElement("div");return t.className="ul-video-player-loading",t.id=Ir(e),["first","second","third","fourth"].map(n=>{const r=T.document.createElement("div");r.className=n,t.appendChild(r)}),t},Ir=e=>e+"-loading-spiner",Y="hidden",Ro=".m3u8",In="questionId",kn="ul-video-recorder-camera-off-button",Ln="ul-recording-in-session",Vu=[{type:"link",content:`${Ge}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Ge}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Ge}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Ge}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Ge}/userleap-web-upchunk-v2.2.2.js`}],Us=[{type:"link",content:`${Ge}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Ge}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:Pu}],As="-video-player",Os="-secondary-video-player",Ns="-video-recorder";let _e,Uo;const Ae=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=T.document.documentElement;if(!r||!o)return;const a={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(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},Le=async(e,t,n,r,o,i)=>{Ae({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=T.document.documentElement,a={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},c={action:t,err:{message:e.message,stack:e.stack},meta:a,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(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},Mu=(e,{type:t,content:n})=>new Promise(function(r,o){let i;t==="script"?(i=T.document.createElement("script"),i.src=n):t==="link"?(i=T.document.createElement("link"),i.rel="stylesheet",i.href=n,i.type="text/css"):(i=T.document.createElement("style"),i.innerHTML=n),i.onload=function(){r(n)},i.onerror=function(){o(n)},i.async=!1,i.id=btoa(n),e.appendChild(i)}),Ds=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(Mu(T.document.head,r)),n),[])).then(()=>{T.videojs=T.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},Ao=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=Y;else if(t==="success")e.style.visibility=Y,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%)`}},Tn=(e,t)=>{const n=T.videojs(e.id());return n==null?void 0:n.payload[t]},Fu=(e,t,n,r,o)=>{const{surveyId:i,responseGroupUid:s,visitorId:a,envId:c}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(D.ERROR,{type:D.PERMISSION_DENIED}),Ae({event:"Video Permission Denied",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Tn(e,In),responseGroupUid:s,surveyId:i}})):(n&&n(D.ERROR,{type:D.OTHER}),Le(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,o,a,c))}),e.on("error",function(l,d){Le(d||e.error(),"recorderError",t,o,a,c)}),e.on("startRecord",function(l,d){r(e.uploadProgressLabel,"none"),Ae({event:"Video Record Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Tn(e,In),responseGroupUid:s,surveyId:i}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const l=Tn(e,In);if(!i){const v="internal error: missing fields in payload";return n&&n(D.ERROR,{type:D.OTHER}),Le(new Error(v),"finishRecord",t,o,a,c),null}e.record().stopDevice();const d=e.cameraOff?D.MEDIA_TYPE_AUDIO:D.MEDIA_TYPE_VIDEO,h=je();Ae({event:"Video Record Finish",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:h,questionId:l,responseGroupUid:s,surveyId:i,mediaType:d}});const u={surveyId:i,updatedAt:new Date().toISOString(),mediaType:d,mediaRecordingUid:h};l&&(u.questionId=l),s&&(u.responseGroupUid=s),a&&(u.visitorId=a);const m=await(async()=>{const v=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(v.ok){const g=await v.json();return n&&n(D.UPLOAD_STARTED,{[D.UPLOAD_ID]:g.upload.id,[D.MEDIA_TYPE]:d,[D.MEDIA_RECORDING_UID]:h}),g.upload.url}else return n&&n(D.ERROR,{type:D.OTHER,response:v}),Le(new Error("failed to get upload response with url"),"finishRecord",t,o,a,c),null})();!m||(_e=T.document.defaultView.UpChunk.createUpload({endpoint:m,file:new T.document.defaultView.File([e.recordedData],`recording ${d} ${Date.now()}`),chunkSize:5120}),_e.startTime=Date.now(),Ae({event:"Video Upload Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:h,questionId:l,responseGroupUid:s,surveyId:i,mediaType:d,url:m}}),_e.on("error",v=>{r(e.uploadProgressLabel,"none"),n&&n(D.UPLOAD_FINISHED,{[D.MEDIA_RECORDING_UID]:h}),Le(v,"finishRecord",t,o,a,c)}),_e.on("progress",v=>{n&&n(D.UPLOAD_PROGRESS,{[D.MEDIA_RECORDING_UID]:h,[D.UPLOAD_PROGRESS_PCT]:v.detail}),r(e.uploadProgressLabel,"progress",v.detail)}),_e.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(D.UPLOAD_FINISHED,{[D.MEDIA_RECORDING_UID]:h}),Ae({event:"Video Upload Success",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:h,questionId:l,responseGroupUid:s,surveyId:i,mediaType:d,url:m,elapsedMs:_e.startTime&&Date.now()-_e.startTime}})}))})},Ps=(e,t)=>{const n=new(T.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),Bu(n),n},Bu=e=>{e.children().forEach(t=>{if(pe[t.name_]){const n=Ft(pe[t.name_],`ul-${pe[t.name_]}`);t.el_.appendChild(n)}})},Ft=(e,t="")=>{const n=T.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},js=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(T.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(T.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const a=n&&n.src?Yu(n.src):null;n&&(o||!a)?(e.children()[0].classList.add("vjs-hidden"),T.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),T.document.getElementById(`${e.id()}_html5_api`).style.height="100%",a&&e.poster(a)),e.on("play",()=>{!o&&n&&!a&&qu(e,!1),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)},Hu=(e,t,n)=>{e.addClass(`ul${Os}`);const r=new(T.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},$u=(e,t,n,r,o,i,s,a=!1)=>{Uo=Date.now();const l=Xt(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:d,questionId:h,responseGroupUid:u,visitorId:p,envId:m}=n;let v;const g=S=>{const H=kn,y=kn+"-audio-only";Ao(l.uploadProgressLabel,"none"),_e&&_e.startTime>=Uo&&_e.abort();const F=T.document.getElementById("ul-camera-button");S?(l.children()[0].classList.add("vjs-hidden"),E.removeClass(H),E.addClass(y),F.innerHTML=pe.TurnOnCamera,l.audioPlayerPlaceholder.removeClass("vjs-hidden"),v==null||v.getTracks().forEach(j=>{j.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(j=>{v=j,j.getVideoTracks().forEach(ue=>{ue.enabled=!1}),l.record().onDeviceReady(j)}).catch(l.record().onDeviceError.bind(l.record()))):(v==null||v.getVideoTracks().forEach(j=>{j.enabled=!0}),l.children()[0].classList.remove("vjs-hidden"),l.record().getDevice(),E.removeClass(y),E.addClass(H),F.innerHTML=pe.TurnOffCamera,l.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(T.videojs.getComponent("Button"))(l,{clickHandler:()=>{w.hasClass(Y)||(Ae({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:p,envId:m,metadata:{questionId:h,responseGroupUid:u,surveyId:d}}),g(l.cameraOff),o(D.DELETE,{}),E.removeClass(Y),w.addClass(Y))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(Ft(pe.DeleteButton,"ul-delete-button"));const _=T.document.getElementById(t),C=()=>{_.classList.contains("vjs-fullscreen")&&l.cameraOff?_.style.display="table":_.style.display="flex"};C();const E=new(T.videojs.getComponent("Button"))(l,{clickHandler:()=>{l.record().isRecording()||(l.cameraOff=!l.cameraOff,Ae({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:h,responseGroupUid:u,surveyId:d,cameraOff:l.cameraOff}}),g(l.cameraOff),!w.hasClass(Y)&&w.addClass(Y),o(D.DELETE,{}),C())}});E.addClass(kn),E.el_.appendChild(Ft(pe.TurnOffCamera,"ul-camera-button"));const I=new(T.videojs.getComponent("Button"))(l,{clickHandler:()=>{const S=T.document.getElementById("ul-recorder-toggle");if(l.record().isRecording())l.record().stop(),S&&(S.innerHTML=pe.RecordButton),I.removeClass(Ln),w.removeClass(Y);else{const H=T.document.getElementById("ul-recording-countdown-screen");if(H)H.remove(),S&&(S.innerHTML=pe.RecordButton),g(l.cameraOff),o(D.DELETE,{}),E.removeClass(Y),w.addClass(Y),I.removeClass(Ln),U.show();else{I.addClass(Ln),U.hide(),E.addClass(Y),w.addClass(Y),S&&(S.innerHTML=pe.StopButton);const y=T.document.createElement("div");y.id="ul-recording-countdown-screen",_.insertBefore(y,_.children[1]),y.style.height=`${_.offsetHeight}px`,Vs(l,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(Ft(pe.RecordButton,"ul-recorder-toggle"));const N=T.document.createElement("p");N.style.visibility="hidden",N.className="ul-upload-progress-label",e.appendChild(N),l.uploadProgressLabel=N;const b=Ps(l,[w,E,"PlayToggle",I,"FullscreenToggle"]),U=b.children().find(S=>S.name_==="FullscreenToggle");U.hasClass("vjs-disabled")&&U.hide();const R=b.children().find(S=>S.name_==="PlayToggle");R.hide(),i&&E.addClass(Y),!i&&w.addClass(Y),js(l,b,i,!1,a),l.on("stopRecord",()=>{I.hide(),R.show(),U.show(),w.removeClass(Y)}),l.on("deviceReady",()=>{I.show(),R.hide(),w.addClass(Y)}),Fu(l,r,o,Ao,s),i&&(l.deviceButton&&l.deviceButton.hide(),l.src(i),R.show(),I.hide(),w.removeClass(Y));const M=[{name:"microphone"}];!l.cameraOff&&M.push({name:"camera"}),Promise.all(M.map(S=>{var H;return(H=navigator==null?void 0:navigator.permissions)==null?void 0:H.query(S)})).then(S=>{S.reduce((y,F)=>y&F.state==="granted",!0)&&l&&(l.deviceButton&&l.deviceButton.hide(),!i&&l.record().getDevice())}).catch(S=>{})},Vs=(e,t=3)=>{const n=T.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(()=>{Vs(e,t-1)},1e3))},Ms=e=>{const t=T.document.createElement("div");return t.className="ul-video-container",t.appendChild(ju(e)),t},Kn=(e,t)=>{const n=T.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=T.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=T.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},qu=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),T.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),T.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Xt=(e,t)=>T.document.getElementById(e)?t?T.videojs(e,t):T.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),Gu=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,a=null)=>{T.document=i;const c=e+As,l=Ms(c);return T.document.addEventListener("securitypolicyviolation",d=>{Le(new Error(`Voice & Video feature violates ${d.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),Ds(Us,()=>{T.document.getElementById(Ir(c)).remove(),Kn(c,l);const d={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const h=e+Os;Kn(h,l);const u=Xt(c,d),p=Xt(h,{muted:!0,...d});if(!u||!p)return;Hu(p,s,a),s||p.addClass(Y);const m=Ps(u,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),v=m.children().find(g=>g.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide(),js(u,m,t,n,r,p)}catch(h){Le(new Error(`Error when creating video player object ${h}`),"playerDeviceError",o,{});return}}),l},zu=(e,t={},n="https://api.userleap.com",r,o,i,s=!1,a=document)=>{T.document=a;const c=e+Ns,l=Ms(c);return T.document.addEventListener("securitypolicyviolation",d=>{Le(new Error(`Voice & Video feature violates ${d.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,i,t.visitorId,t.envId)}),Ds(Us.concat(Vu),()=>{Kn(c,l),T.document.getElementById(Ir(c)).remove();try{$u(l,c,t,n,r,o,i,s)}catch(d){Le(new Error(`Error when creating video recorder player object ${d}`),"recorderDeviceError",n,i,t.visitorId,t.envId);return}}),l},Wu=e=>{const t=e+Ns;if(!!T.document.getElementById(t)&&!!T.videojs){try{if(!T.videojs(t).record().stream)return}catch{return}T.videojs(t).record().stop(),T.videojs(t).record().stopDevice()}},Ku=e=>{const t=Xt(e+As);t==null||t.pause()},Yu=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(Ro)&&(n=n.replace(Ro,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},D={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"},pe={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},pt="ul-card-video__player_recorder",Qu="ul-card-video__skip_button",Zu="ul-video-interview-form",Oo="ul-video-btn",Ju=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:a,handleUploadUpdate:c,headers:l,responseGroupUid:d,surveyId:h,viewDocument:u,visitorId:p}=G(y=>({apiURL:y.apiURL,envId:y.envId,handleUploadUpdate:y.handleUploadUpdate,headers:y.headers,responseGroupUid:y.responseGroupUid,surveyId:y.surveyId,viewDocument:y.viewDocument,visitorId:y.userId})),[m,v]=X(!1),[g,w]=X(null),[_,C]=X(null),[E,I]=X(0),N=l["userleap-platform"],b=r&&r.videoUrl,U=(y,F)=>{y===D.UPLOAD_STARTED?(w(F[D.UPLOAD_ID]),C(F[D.MEDIA_RECORDING_UID]),v(!0)):y===D.DELETE?(w(null),C(null),v(!1)):y===D.UPLOAD_PROGRESS?isNaN(F[D.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:F[D.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:F[D.MEDIA_RECORDING_UID],progressPct:F[D.UPLOAD_PROGRESS_PCT]}):y===D.UPLOAD_FINISHED&&c({mediaRecordingUid:F[D.MEDIA_RECORDING_UID],isComplete:!0})},R=y=>{if(y&&y.children.length===0){const F=Gu(pt,{src:b,type:"application/x-mpegURL"},void 0,r.mediaType===D.MEDIA_TYPE_AUDIO,s,u);y.appendChild(F)}},M=y=>{if(y&&y.children.length===0){const F=zu(pt,{surveyId:h,responseGroupUid:d,questionId:o,visitorId:p,envId:a},s,U,void 0,{...l,"x-ul-video-recorder-origin":"sdk"},r.mediaType===D.MEDIA_TYPE_AUDIO,u);y.appendChild(F)}},S=y=>{y.preventDefault(),y.stopPropagation(),Wu(pt),g&&_?(c({mediaRecordingUid:_,isSubmitted:!0}),n({value:{mediaRecordingUid:_},questionId:o,type:i})):n({value:null,questionId:o,type:i})},H=()=>f(Be,{defaultBody:()=>f("button",{className:`${Oo} ul-record-response-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),Ku(pt),I(1)}}),properties:r});return f("div",{className:O(Ie(x.CardMainContent,N)),style:{marginTop:"unset"},children:f("form",{className:O([e,x.VideoCard,x.FadeInTransition]),id:Zu,children:[f(ke,{message:t,properties:r}),f("div",{id:"ul-card-voice__video",children:[f("div",{children:[f("div",{id:"ul-question-player-container",style:{display:E===0?"":"none"},children:[f("div",{id:pt,ref:R}),H()]}),f("div",{style:{display:E===1?"block":"none"},children:[f("button",{className:`${Oo} ul-back-question-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),I(0)}}),f("div",{id:"ul-recorder-player-container",ref:M})]})]}),f(se,{disabled:!m,onClick:S,children:ut(r)}),f("button",{className:`ul-card-text__button ${x.InactiveButton}`,id:Qu,onClick:S,style:{display:r.required?"none":"block",...m?{display:"none"}:{}},children:Cr(r)})]})]})})},Xu=({className:e})=>{const{headers:t,uploadProgress:n}=G(s=>({headers:s.headers,uploadProgress:s.uploadProgress}));let r,o;Object.values(n).filter(s=>s.isSubmitted).length>1?(r="Your responses are processing",o="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",o="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(n).filter(s=>s.isSubmitted).map(s=>s.progressPct)));return f("div",{className:O(Ie(x.CardMainContent,t["userleap-platform"])),children:f("div",{className:O([e,"ul-card--uploading",x.FadeInTransition]),children:[f("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:x.LoadingSpinnerContainer,role:"progressbar",children:f("div",{className:x.LoadingSpinner,children:[f("div",{className:x.LoadingSpinnerFirst}),f("div",{className:x.LoadingSpinnerSecond}),f("div",{className:x.LoadingSpinnerThird}),f("div",{className:x.LoadingSpinnerFourth})]})}),f(ke,{message:`${r} (${i}% complete)`}),f("p",{className:x.Caption,children:o})]})})},No=()=>f("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[f("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),f("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),f("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),f("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),f("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),f("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),f("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),f("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),f("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),f("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),f("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),f("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),f("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),f("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),ep=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:o,showSurveyBrand:i,slugName:s,surveyId:a,viewedCardCount:c}=G(v=>({border:v.border,cards:v.cards,headers:v.headers,index:v.index,marketingUrl:v.marketingUrl,showSurveyBrand:v.showSurveyBrand,slugName:v.slugName,surveyId:v.surveyId,viewedCardCount:v.viewedCardCount})),l=Ve(null),d=t.filter(v=>v.type!==L.Uploading&&v.type!==L.Thanks),h=ru(t,r),u=c+1,p=u/(u+h);ce(()=>{l.current&&(l.current.style.width=`${p*100}%`)},[p]);const m=()=>i?f("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:f(No,{})}):null;return!d||d.length===1?f("footer",{className:"ul-footer",style:i?{}:{marginBottom:"10px"},children:m()}):f("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[d.length>1&&f("div",{id:"ul-progress-bar-container",children:f("div",{id:"ul-progress-bar-current",ref:l,style:{border:`1px solid ${e||"#000"}`}})}),i&&f("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:f(No,{})})]})},tp=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:a,fontFamily:c,headers:l,index:d,next:h,showStripes:u,update:p,useMobileStyling:m,viewDocument:v}=G(y=>({answers:y.answers,border:y.border,cards:y.cards,close:y.close,configureExitOnOverlayClick:y.configureExitOnOverlayClick,destroy:y.destroy,endCard:y.endCard,eventEmitFn:y.eventEmitFn,fontFamily:y.fontFamily,headers:y.headers,index:y.index,next:y.next,showStripes:y.showStripes,update:y.update,useMobileStyling:y.useMobileStyling,viewDocument:y.viewDocument})),g=Ve(null),w=Ve(!1),{props:_,type:C,name:E}=n[d],I=n.length;ce(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!w.current&&a&&(w.current=!0,a(P.SurveyAppeared)))},[a]),ce(()=>{p()},[d,p]),ce(()=>{o(()=>r())},[r,o]);const N=()=>r(et),b=y=>{y.key==="Enter"&&N()},U=async function(y){h({data:y,completeSurvey:()=>{i(et)},endCard:s}),ic(v)};if(e){for(const y of e)if(y.questionId===E){let F;if(C===L.MultipleChoice){const j=_.options.find(({value:ue})=>ue===y.value);if(!j)break;F={[j.id]:j.value}}else F=y.value;U({value:F,type:C,questionId:y.questionId});break}}const R=()=>[Ye.Email,Ye.Link].includes(l["userleap-platform"])?!1:!s||d+1!==I,M=()=>m?{borderColor:t}:{borderColor:t,margin:"15px"},S=()=>{const y={className:"ul-card",next:U,questionId:E,type:C};switch(C){case L.ConsentLegal:return z(hu,{...y,..._,key:E});case L.Likert:return z(vu,{...y,..._,key:E});case L.MultipleChoice:return z(gu,{...y,..._,key:E});case L.MultipleSelect:return z(_u,{...y,..._,key:E});case L.NPS:return z(yu,{...y,key:E,props:_});case L.Open:return z(wu,{...y,..._,key:E});case L.RecordedTask:return z(Uu,{...y,..._,key:E});case L.TextUrlPrompt:return z(Nu,{...y,..._,key:E});case L.Thanks:return z(Du,{...y,..._,key:E});case L.Uploading:return z(Xu,{...y,..._,key:E});case L.VideoVoice:return z(Ju,{...y,..._,key:E});default:return null}},H=y=>{var Rr;const F=window.sprigAPI,j=y.target;if(!F||!j)return;const ue=[j,j.parentElement];for(const Tt of ue)if(((Rr=Tt==null?void 0:Tt.tagName)==null?void 0:Rr.toLowerCase())==="a"){y.preventDefault(),F==null||F.openUrl(Tt.href);return}};return f("div",{className:O("ul-app",tt(l)?"ul-app--visible":"ul-app--overlay"),id:et,onClick:H,ref:g,style:{"--theme":t,...c?{fontFamily:c.replace(";","")}:{}},children:f("div",{className:"ul-app__container",children:[f("div",{className:O(K(x.CardContainer,m)),style:M(),children:[u&&f("div",{className:"ul-header__container",children:f("div",{className:"ul-header",children:"For development purposes only"})}),S(),f(ep,{})]}),R()&&f("div",{className:O(K(x.CloseContainer,m)),children:f("div",{"aria-label":"Close button",className:x.CloseButton,onClick:N,onKeyPress:b,role:"button",tabIndex:0,children:f("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:f("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"})})})})]})})},np=`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}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content: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 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;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{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.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{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.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;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}.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)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.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}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[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{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@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}.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:rgba(0,0,0,.01);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:white}.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}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-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:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-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}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.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{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.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;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-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}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.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--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.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:rgba(0,0,0,.01);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:white}.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}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#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:#ffffff;border-radius:5px;text-align:left;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.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:30px}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}#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;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.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;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
|
|
687
|
+
`,rp=(e,t)=>{const n=[...e],r=new Set([L.VideoVoice,L.RecordedTask]);return e.some(o=>r.has(o.type))&&n.push({name:-2,props:{routingOptions:[]},type:L.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:L.Thanks}),n},op=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function ip(e,t=!0){var E,I,N;const{answers:n,apiURL:r,customStyles:o,endCard:i,eventEmitFn:s,fontFamilyURL:a,frame:c,UpChunk:l,viewDocument:d,viewWindow:h}=e,u=tt(e.headers)?e.frame:d.body,p=B,m=rp(e.cards,!!i);Vt.configure(p,{cards:m,hasEndCard:!!i,apiURL:r,UpChunk:l}),G.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:m,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:s,fontFamily:e.fontFamily,frame:c,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:op({mode:e.mode,viewWindow:h,viewDocument:d}),mode:e.mode,previewKey:(E=window.UserLeap)!=null&&E.localStorageAvailable?(I=window.localStorage)==null?void 0:I.getItem(ie.Preview):null,recorder:Vt,recorderEventEmitter:p,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,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{seen:v}=G.getState();v();const{head:g}=d,w=d.createElement("style");if(w.id="sprig-style",w.textContent=np,w.nonce=e.styleNonce,g.appendChild(w),e.fontFamily&&a&&parent){const b=d.createElement("link");b.rel="stylesheet",b.href=a,g.appendChild(b)}if(e.customStyles&&ni(d,o,e.styleNonce),!l)if(e.installationMethod!==De.Npm){const b=d.createElement("script");b.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",b.onload=()=>{Vt.setUpChunk(h.UpChunk)},b.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},g.appendChild(b)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const _="2.23.1",C=s||((N=c.eventEmitter)==null?void 0:N.emit);C==null||C(de.VerifyViewVersion,{[ze.ViewVersion]:_}),u&&t&&st(f(tp,{}),u)}const sp={configure:ip};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 ap="rgba(255,255,255, 0.95)",lp="rgba(0,0,0,0.9)",cp="360px",Rn="0px",Fs=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},Bs=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,oe("trackStartUrl",null),B.emit(P.SurveyLifeCycle,{state:"dismissed"}),B.emit(P.SurveyClosed,{name:P.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},Hs=()=>{B.on(P.SurveyWillClose,({initiator:e})=>{Bs(e)})},dp=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},o=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=o==="light"?ap:lp,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},up=(e,t,n)=>{var a,c;const r={position:"fixed",bottom:"0px",right:Rn,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},o=Object.assign({},t,window.UserLeap);let i,s=!1;return n?((a=window.UserLeap.windowDimensions)!=null&&a.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(o.overlayStyleMobile)&&(s=!0)):(r.width=cp,r.maxHeight=window.UserLeap.maxHeight||"66vh",o.framePosition===mt.BottomLeft?i={left:Rn}:o.framePosition===mt.TopLeft?i={left:Rn,top:"0px"}:o.framePosition===mt.TopRight?i={top:"0px"}:o.framePosition===mt.Center&&(s=!0,i={margin:"auto",position:"static"},r.maxHeight=null)),s&&dp(o,n),Object.assign(e.style,r,i),s},pp=(e,t)=>{var a,c;const n="ul-frame";Fs();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const o=up(r,e,t);B.on(P.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),Hs(),r.setHeight=l=>{parseInt(r.style.height)!=l&&(r.style.height=`${l}px`,B.emit(P.SurveyHeight,{name:P.SurveyHeight,contentFrameHeight:l}))},(a=window.UserLeap.container)==null||a.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{B.emit(P.CloseSurveyOnOverlayClick)}),B.emit(P.SurveyLifeCycle,{state:"presented"}),B.emit(P.SurveyPresented,{name:P.SurveyPresented});const i=(c=r.contentWindow)==null?void 0:c.document;i&&(i.open("text/html","replace"),i.write("<!doctype html><head></head><body></body></html>"),i.close());const s=i==null?void 0:i.head;return{frameId:n,contentWinDocHead:s,contentWindow:r.contentWindow,hasOverlay:o,iframe:r}},fp="!launch_darkly_";class hp{constructor(){re(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>this._ldData[`${fp}${n}`]=t[n]+1),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const Yn=new hp;Object.freeze(Yn);const mp="!optimizely_experiments_";class vp{constructor(){re(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(o=>{delete this._optimizelyData[o]}),r&&r.map(o=>{const{id:i,variation:s}=o,a=this.transformExperimentId(i);s&&typeof s=="string"&&(this._optimizelyData[a]=s)}),!0}catch(o){return o instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",o),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return mp+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(o=>{var i,s;return(i=n[o].variation)!=null&&i.name?{id:o,variation:(s=n[o].variation)==null?void 0:s.name}:{id:o,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const Bt=new vp;Object.freeze(Bt);class gp{constructor(t,n){re(this,"paused");re(this,"queue");re(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}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 n=Array.prototype.slice.call(t,1),r=t[0],o=this.ul[r];o instanceof Function?o.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(o){n=function(){o(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const _p=["popState","pushState","replaceState"],yp={test:"test"},ft="!email",wp=["ios","android"],Ne="environments",Qn="pageUrl",He="visitors",Do="ul-view-sdk-script",Po=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 kr(e,t){const{matchType:n,pattern:r}=e,o=n?Po[n]:Po.legacy;let i=!1;try{i=o(r,t)}catch(s){const a=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;s instanceof Error&&(console.warn(a,s),s.stack=JSON.stringify(e),window.UserLeap.reportError(a,s))}return i}function Ep(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:o}=window.UserLeap._config;if(!o)return!0;const i=[];n&&n.length&&i.push(...n),r&&r.length&&i.push(...r);const s=e&&i.find(a=>a.id===e);return s?kr(s,window.location.href):t===window.location.href}function Ct(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:o}=window.UserLeap._config;if(o&&o!==Ye.Web)return;const i=$e("trackStartUrl"),s=i?String(i):null;t&&kp(window.location.href),n&&(qs(),bp()),r&&s&&s!==window.location.href&&e&&_p.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Ee.PageChange)}const $s={capture:!0},bp=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>kr(r,window.location.href)).map(r=>{const{name:o,properties:i}=r,{selector:s,innerText:a}=i;return s?c=>{if(ot(c.target))try{c.target.closest(s)&&window.UserLeap("track",o)}catch{}return!1}:c=>(ot(c.target)&&c.target.innerText===a&&window.UserLeap("track",o),!1)}),n=r=>t.forEach(o=>o(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,$s)},qs=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,$s),delete window.UserLeap._config.interactiveEventsHandler};function Cp(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Ct,!0))}function xp(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Ct,!0)),window.UserLeap._config.interactiveEvents&&qs()}function we(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(o=>{r.push(o),o===Ne?r.push(window.UserLeap.envId):o===He&&r.push(Lr())}),n&&r.push(n),r.join("/")}function Sp(e,t){let n=we("1",[Ne],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Ip(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function $e(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(ie.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function oe(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(ie.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(i){i instanceof Error&&(i.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",i)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",i)}let o=r[window.UserLeap.envId];o?o[e]=t:o={[e]:t},r[window.UserLeap.envId]=o;try{localStorage.setItem(ie.Credentials,JSON.stringify(r))}catch(i){i instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${i.message}`)}}function Gs(){window.previewMode||(window.UserLeap.visitorId=je(),oe("vid",window.UserLeap.visitorId),B.emit(P.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Lr(){return window.previewMode?"0":window.UserLeap.visitorId||""}function kp(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let a=!1;for(let c=0;c<t.length&&(a=kr(t[c],e),!a);c++);if(!a)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let o=[];const i={viewedAt:Date.now(),location:e},s=localStorage.getItem(ie.PageViews);try{if(o=s?JSON.parse(s):[],Array.isArray(o)||(o=[]),o.length>0){const a=o[o.length-1],c=(Date.now()-a.viewedAt)/1e3;(a.location!=e&&c>r||c>n)&&(window.UserLeap._queue.push(["track",Qn,null,{url:e}]),o.push(i))}else window.UserLeap._queue.push(["track",Qn,null,{url:e}]),o.push(i);o.length>5&&o.splice(0,o.length-5);try{localStorage.setItem(ie.PageViews,JSON.stringify(o))}catch(a){a instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${a.message}`)}}catch(a){a instanceof Error&&(a.stack=s||"",window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Lp(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const o=t.apply(this,r),i=new Event("pushState");return window.dispatchEvent(i),Ct(i),o})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const o=t.apply(this,r),i=new Event("replaceState");return window.dispatchEvent(i),Ct(i),o})(e.replaceState)),Cp()}async function Un(e,t){const n=Lr();e&&!t&&(window.UserLeap._config.mode=yp.test);const r=await Ue(Sp(n,e),{},0,!0);return r.ok?(r.json.delay&&await zt(r.json.delay),zs(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const zs=async(e,t)=>{var y,F;const{context:n,endCard:r,locale:o,productConfig:i,questions:s,responseGroupUid:a,surveyId:c,uuid:l,vid:d,sessionReplay:h}=e,u=It(window.UserLeap),p=Tr(u),m=Tp(u);if(h&&gi({responseGroupId:a,surveyId:c,visitorId:d,replayParams:h,completeUploadHeaders:u,apiUrl:window.UserLeap._API_URL}),d==null||!s||!s.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const j="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(j),{success:!1,message:j,surveyState:"no survey"}}if(d!==window.UserLeap.visitorId&&l!==window.UserLeap.visitorId&&!window.previewMode){const j="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(j)),{success:!1,message:j,surveyState:"no survey"}}if(!(t?await t(c):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Dn.disable(),B.emit(P.SurveyWillPresent,{name:P.SurveyWillPresent,[jo.SurveyId]:c});let g,w=document.createElement("div"),_,C,E;const I=j=>{const{[ze.ViewVersion]:ue}=j;ue!==u["x-ul-sdk-version"]&&Bs(),B.removeListener(de.VerifyViewVersion,I)};B.on(de.VerifyViewVersion,I),tt(u)?(g="ul-direct-embeded-frame",_=document.head,C=window,E=!1,p&&(Fs(),w.id=g,window.UserLeap.container.appendChild(w),Hs(),B.emit(P.SurveyLifeCycle,{state:"presented"}),B.emit(P.SurveyPresented,{name:P.SurveyPresented}))):{frameId:g,contentWinDocHead:_,contentWindow:C,hasOverlay:E,iframe:w}=pp(i,m),window.UserLeap.frameId=g,window.UserLeap.useMobileStyling=m;const N=j=>{B.on(P.CloseSurveyOnOverlayClick,j)},b=Object.assign({frame:w,envId:window.UserLeap.envId,surveyId:c,userId:l,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:s,context:n,locale:o,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:a,headers:u,endCard:r,useMobileStyling:m,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:N,eventEmitFn:B.emit.bind(B),ulEvents:Jn,viewDocument:C==null?void 0:C.document,viewWindow:C,tabTitle:document.title,startingQuestionIdx:(y=window.UserLeap.config)==null?void 0:y.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce},window.UserLeap._config);(F=window.UserLeap.config)!=null&&F.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(b.customStyles=window.UserLeap.customStyles),C&&(C.__cfg=b);function U(){const j=document.createElement("script");return window.UserLeap.nonce&&j.setAttribute("nonce",window.UserLeap.nonce),j.id=Do,j}const R=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:b.path,M=document.getElementById(Do);M&&M.remove();const S=U(),H=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return b.installationMethod===De.Npm?(sp.configure(b),E&&window.UserLeap.container&&H()):R&&(S.src=R,E&&S.addEventListener("load",()=>{window.UserLeap.container&&H()}),C==null||C.addEventListener("error",j=>{j.target instanceof HTMLScriptElement&&j.target.src===R&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(S),{success:!0,surveyState:"ready"}};function Tp(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Tr(e)||t>10&&t<Jl}function Tr(e){return wp.includes(e[ye.Platform])}function Rp(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Up(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Rp(t),(t||n||r)&&(Lp(),Ct())}async function Ue(e,t,n=0,r=!1){var i,s;t.headers=Object.assign(It(window.UserLeap),t.headers);const o=await be(e,t,n,r);if(o.ok){const a=(i=o.headers)==null?void 0:i.get("Authorization"),c=a?a.split(" "):void 0,l=c&&c.length===2?c[1]:void 0,d=(s=o.headers)==null?void 0:s.get(ye.VisitorID);l&&d&&(d!==window.UserLeap.visitorId||window.UserLeap.token!==l)&&(oe("token",l),oe("vid",d),B.emit(P.VisitorIDUpdated,{visitorId:d}),window.UserLeap.token=l,window.UserLeap.visitorId=d)}return o.json&&o.json.logMessage&&console.warn(`[Sprig] ${o.json.logMessage}`),o}async function Ap(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await zt(e.json.delay),window.UserLeap.delayingSurvey=!1)}const Op=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var m,v,g,w,_;const{userId:o,anonymousId:i,metadata:s={},properties:a,showSurveyCallback:c}=r;let{eventName:l}=r;if(window.UserLeap.debugMode&&l!==Qn&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const d=window.UserLeap.localStorageAvailable&&(m=localStorage.getItem(ie.Preview))!=null?m:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const C="[Sprig] - Skipping tracking without userId";return console.warn(C),{success:!1,message:C,surveyState:"no survey"}}if(!l||l.trim().length===0){l=l?String(l):"";const C="[Sprig] - Invalid event name "+l;return console.warn(C),{success:!1,message:C,surveyState:"no survey"}}const h=window.location.href;if(s.url||(s.url=h),oe("trackStartUrl",h),(g=(v=window.UserLeap)==null?void 0:v._config)!=null&&g.optimizelyEnabled){const C=It(window.UserLeap);Tr(C)||Bt.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},Bt.getAllOptimizelyExperiments())}(_=(w=window.UserLeap)==null?void 0:w._config)!=null&&_.launchDarklyEnabled&&(s.launchDarklyFlags=Yn.getAllLaunchDarklyVariations()),o&&(window.UserLeap.userId=o),i&&(window.UserLeap.partnerAnonymousId=i),a&&(s.eventProperties=a);const u=window.UserLeap.delayingSurvey?await Ue(we("1",[He],"events/batch"),{body:JSON.stringify({events:[{event:l,metadata:s}],previewKey:d}),method:"POST"},0,!0):await Ue(we("1",[He],"events"),{body:JSON.stringify({event:l,metadata:s,previewKey:d}),method:"POST"},0,!0);if(!u.ok){const C="[Sprig] (ERR-421) Failed to track event";return u.reportError&&(console.warn(C,u.error),u.error&&window.UserLeap.reportError("track",u.error)),{success:!1,message:C,error:u.error,surveyState:"no survey"}}o&&oe("uid",o),i&&oe("aid",i);const p=u.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(ie.Preview),await Ap(u),Ep(p.eventId,h)?zs(p,c):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",Ee.Override),Un({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Ee.Override),Un({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Ee.Override),Un({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=Ee.API){B.emit(P.SurveyWillClose,{name:P.SurveyWillClose,initiator:r})},async setAttribute(r,o){if(!r||!o&&o!==0){const i="[Sprig] - Disregarding empty attribute / value provided";return console.warn(i),{success:!1,message:i}}return this.setAttributes({[r]:o})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const l="[Sprig] - Disregarding empty payload provided";return console.warn(l),{success:!1,message:l}}const{userId:o,anonymousId:i,attributes:s}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const l="[Sprig] - Skipping tracking without userId";return console.warn(l),{success:!1,message:l}}if(!s&&(!o||window.UserLeap.userId===o)&&(!i||window.UserLeap.partnerAnonymousId===i))return{success:!0};const a={};o&&(a.userId=window.UserLeap.userId=o),i&&(a.partnerAnonymousId=window.UserLeap.partnerAnonymousId=i);let c;return s?(s.email&&!Object.prototype.hasOwnProperty.call(s,ft)&&(s[ft]=s.email,delete s.email),c=await Ue(we("1",[Ne,He],"attributes"),{body:JSON.stringify(s),method:"PUT"}),!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await Ue(we("1",[Ne,He]),{body:JSON.stringify(a),method:"PUT"}),s&&s[ft]&&(window.UserLeap.email=s[ft]),c.ok&&(o&&oe("uid",o),i&&oe("aid",i)),{success:!!c.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const i="[Sprig] - Skipping tracking without userId";return console.warn(i),{success:!1,message:i}}const o=await Ue(we("1",[Ne,He],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&window.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(r){B.on(P.SurveyLifeCycle,r)},async removeSurveyListener(r){B.removeListener(P.SurveyLifeCycle,r)},async addListener(r,o){B.on(r,o)},async removeListener(r,o){B.removeListener(r,o)},async removeAllListeners(){B.removeAllListeners()},setVisitorAttribute(r,o){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,o)},async setEmail(r){return n.setAttribute(ft,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const s=`[Sprig] - Invalid userId ${r}`;return console.warn(s),{success:!1,message:s}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const o=window.UserLeap.visitorId,i=await Ue(we("1",[Ne,He]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!i.ok){i.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",i.error),i.error&&window.UserLeap.reportError("setUserId",i.error));return}o!==window.UserLeap.visitorId&&eo(),oe("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const o=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(o),{success:!1,message:o}}return window.UserLeap.partnerAnonymousId=r,oe("aid",r),{success:!0}},async track(r,o,i={},s=void 0){return t({eventName:r,properties:o,metadata:i,showSurveyCallback:s})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const o=window.UserLeap.container.children[0].contentDocument;if(o){const i=o.getElementById(x.CustomStyle);i?i.textContent=r:ni(o,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,o){var c,l;const i=typeof r=="string"?parseInt(r,10):r,s=typeof o=="string"?parseInt(o,10):o;if(!isNaN(i)&&!isNaN(s)&&(window.UserLeap.windowDimensions={width:i,height:s}),!window.UserLeap.frameId)return;const a=document.getElementById(window.UserLeap.frameId);!a||(window.UserLeap.useMobileStyling&&((c=window.UserLeap.windowDimensions)!=null&&c.width&&(a.style.width=`${window.UserLeap.windowDimensions.width}px`),(l=window.UserLeap.windowDimensions)!=null&&l.height&&(a.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),a.contentDocument&&(a.style.height=String(ri(a.contentDocument))+"px")),B.emit(P.SurveyDimensions,{name:P.SurveyDimensions,contentFrameWidth:a.clientWidth,contentFrameHeight:a.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(ie.Credentials),localStorage.removeItem(ie.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Gs(),eo(),window.UserLeap._queue.unpause()},teardown(){xp(),window.UserLeap("dismissActiveSurvey",Ee.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,o=!0){var i,s;if(!((s=(i=window.UserLeap)==null?void 0:i._config)!=null&&s.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const a=typeof r=="string"?JSON.parse(r):r;Bt.setOptimizelyExperiment(a,o)}catch(a){console.warn("[Sprig] Error with integrating Optimizely data"),a instanceof Error&&window.UserLeap.reportError("integrateOptimizely",a)}},integrateOptimizelyClient(r){var i,s;if(!((s=(i=window.UserLeap)==null?void 0:i._config)!=null&&s.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const o=({experiment:a,variation:c})=>{const l={experiments:[{id:a.id,variation:c.key}]};window.UserLeap("integrateOptimizely",l,!1)};r.notificationCenter.addNotificationListener(zl.NOTIFICATION_TYPES.ACTIVATE,o)},importLaunchDarklyData(r){var o,i;if(!((i=(o=window.UserLeap)==null?void 0:o._config)!=null&&i.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}Yn.setLDFlagsVariations(r)}};Object.assign(window.UserLeap,n)};async function Np(e){const t=It(window.UserLeap);let n=await be(we("1",[Ne],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await be(we("1",[Ne],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Pn("Disabled: failed to fetch configuration"),e;const o=n.json;return o!=null&&o.disabled?(Pn(`Disabled: ${o.disabled}`),{disabled:o.disabled}):Object.assign({},o,e)}async function Dp(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,o=Lr(),i=window.UserLeap.envId,s=window.document.documentElement,a={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:window.navigator.language,...n},c={action:e,err:{message:t.message,stack:t.stack},meta:a,vid:o,envId:i};(await Ue(we("1",null,"errors"),{method:"POST",headers:{[ye.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Pp(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=Ip();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(ie.Preview,t),window.UserLeap.UPDATES=Jn;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Dp,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const c in window.UserLeap._config)window.UserLeap[c]=window.UserLeap._config[c];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let c=$e("sampled");if(c===null&&(c=Math.random()<o,oe("sampled",c)),!c)return}else n&&$e("sampled")!==null&&oe("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const i=[...window.UserLeap._queue];window.UserLeap._queue=new gp(window.UserLeap,[]),window.UserLeap._queue.pause();for(let c=0;c<i.length;c++)window.UserLeap._queue.push(i[c]);const s=$e("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=$e("vid"),window.UserLeap.userId=$e("uid"),window.UserLeap.partnerAnonymousId=$e("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(ie.Credentials),Gs());const a=await Np(e);Zc(window.document,a.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,a.replaySettings),Op(a),await Up(a),window.UserLeap._queue.unpause(),B.emit(P.SDKReady),B.emit(P.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class en{constructor(){re(this,"UPDATES",Jn)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}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,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const Zn={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=De.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(en.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=en.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Pp(e),window.Sprig}},jp={sprig:Zn,SprigAPI:en,configure:Zn.configure};exports.DismissReason=Ee;exports.SprigAPI=en;exports.SprigEvent=P;exports.default=jp;exports.sprig=Zn;
|