@sprig-technologies/sprig-bundled 1.0.0-beta → 2.24.7

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.
Files changed (3) hide show
  1. package/dist/index.cjs +22 -38
  2. package/dist/index.js +3368 -3520
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var dp=Object.defineProperty;var fp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>(fp(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var pp=Object.create,Uu=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,mp=Object.getOwnPropertyNames,gp=Object.getPrototypeOf,vp=Object.prototype.hasOwnProperty,xr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yp=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mp(t))!vp.call(e,i)&&i!==n&&Uu(e,i,{get:()=>t[i],enumerable:!(r=hp(t,i))||r.enumerable});return e},_p=(e,t,n)=>(n=e!=null?pp(gp(e)):{},yp(t||!e||!e.__esModule?Uu(n,"default",{value:e,enumerable:!0}):n,e)),bp=xr((e,t)=>{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n={},t.exports=n}),wp=xr((e,t)=>{t.exports=r;var n=Object.prototype.toString;function r(i){if(!i)return!1;var o=n.call(i);return o==="[object Function]"||typeof i=="function"&&o!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}}),Cp=xr((e,t)=>{var n=function(i){return i.replace(/^\s+|\s+$/g,"")},r=function(i){return Object.prototype.toString.call(i)==="[object Array]"};t.exports=function(i){if(!i)return{};for(var o={},a=n(i).split(`
2
- `),s=0;s<a.length;s++){var l=a[s],u=l.indexOf(":"),c=n(l.slice(0,u)).toLowerCase(),d=n(l.slice(u+1));typeof o[c]>"u"?o[c]=d:r(o[c])?o[c].push(d):o[c]=[o[c],d]}return o}}),Ep=xr((e,t)=>{t.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var i={},o=0;o<arguments.length;o++){var a=arguments[o];for(var s in a)n.call(a,s)&&(i[s]=a[s])}return i}}),Sp=xr((e,t)=>{var n=bp(),r=wp(),i=Cp(),o=Ep();t.exports=u,t.exports.default=u,u.XMLHttpRequest=n.XMLHttpRequest||p,u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:n.XDomainRequest,a(["get","put","post","patch","head","delete"],function(f){u[f==="delete"?"del":f]=function(h,m,g){return m=l(h,m,g),m.method=f.toUpperCase(),c(m)}});function a(f,h){for(var m=0;m<f.length;m++)h(f[m])}function s(f){for(var h in f)if(f.hasOwnProperty(h))return!1;return!0}function l(f,h,m){var g=f;return r(h)?(m=h,typeof f=="string"&&(g={uri:f})):g=o(h,{uri:f}),g.callback=m,g}function u(f,h,m){return h=l(f,h,m),c(h)}function c(f){if(typeof f.callback>"u")throw new Error("callback argument missing");var h=!1,m=function(R,V,K){h||(h=!0,f.callback(R,V,K))};function g(){v.readyState===4&&setTimeout(_,0)}function b(){var R=void 0;if(v.response?R=v.response:R=v.responseText||d(v),L)try{R=JSON.parse(R)}catch{}return R}function y(R){return clearTimeout(k),R instanceof Error||(R=new Error(""+(R||"Unknown XMLHttpRequest Error"))),R.statusCode=0,m(R,U)}function _(){if(!E){var R;clearTimeout(k),f.useXDR&&v.status===void 0?R=200:R=v.status===1223?204:v.status;var V=U,K=null;return R!==0?(V={body:b(),statusCode:R,method:S,headers:{},url:I,rawRequest:v},v.getAllResponseHeaders&&(V.headers=i(v.getAllResponseHeaders()))):K=new Error("Internal XMLHttpRequest Error"),m(K,V,V.body)}}var v=f.xhr||null;v||(f.cors||f.useXDR?v=new u.XDomainRequest:v=new u.XMLHttpRequest);var w,E,I=v.url=f.uri||f.url,S=v.method=f.method||"GET",x=f.body||f.data,T=v.headers=f.headers||{},A=!!f.sync,L=!1,k,U={body:void 0,headers:{},statusCode:0,method:S,url:I,rawRequest:v};if("json"in f&&f.json!==!1&&(L=!0,T.accept||T.Accept||(T.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(T["content-type"]||T["Content-Type"]||(T["Content-Type"]="application/json"),x=JSON.stringify(f.json===!0?x:f.json))),v.onreadystatechange=g,v.onload=_,v.onerror=y,v.onprogress=function(){},v.onabort=function(){E=!0},v.ontimeout=y,v.open(S,I,!A,f.username,f.password),A||(v.withCredentials=!!f.withCredentials),!A&&f.timeout>0&&(k=setTimeout(function(){if(!E){E=!0,v.abort("timeout");var R=new Error("XMLHttpRequest timeout");R.code="ETIMEDOUT",y(R)}},f.timeout)),v.setRequestHeader)for(w in T)T.hasOwnProperty(w)&&v.setRequestHeader(w,T[w]);else if(f.headers&&!s(f.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in f&&(v.responseType=f.responseType),"beforeSend"in f&&typeof f.beforeSend=="function"&&f.beforeSend(v),v.send(x||null),v}function d(f){try{if(f.responseType==="document")return f.responseXML;var h=f.responseXML&&f.responseXML.documentElement.nodeName==="parsererror";if(f.responseType===""&&!h)return f.responseXML}catch{}return null}function p(){}});function Ba(e,t,...n){if(!e)throw new TypeError(Pu(t,n))}function Pu(e,t){let n=0;return e.replace(/%[os]/gu,()=>Mu(t[n++]))}function Mu(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var Ip;function kp(e){try{let t=e instanceof Error?e:new Error(Mu(e));if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}));else if(typeof process<"u"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)}catch{}}var it=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,xp,Ut=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{let n=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,`
3
- `);console.warn(this.message,...e,n)}catch{}}},Ap=new Ut("W01","Unable to initialize event under dispatching."),Tp=new Ut("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Rp=new Ut("W03","Assigning any truthy value to 'returnValue' property has no effect."),Lp=new Ut("W04","Unable to preventDefault on non-cancelable events."),Op=new Ut("W05","Unable to preventDefault inside passive event listener invocation."),Np=new Ut("W06","An event listener wasn't added because it has been added already: %o, %o"),lo=new Ut("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Vs=new Ut("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");new Ut("W09","Event attribute handler must be a function: %o");var Pt=class{static get NONE(){return Fs}static get CAPTURING_PHASE(){return Bs}static get AT_TARGET(){return js}static get BUBBLING_PHASE(){return Hs}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let n=t!=null?t:{};Go.set(this,{type:String(e),bubbles:Boolean(n.bubbles),cancelable:Boolean(n.cancelable),composed:Boolean(n.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return me(this).type}get target(){return me(this).target}get srcElement(){return me(this).target}get currentTarget(){return me(this).currentTarget}composedPath(){let e=me(this).currentTarget;return e?[e]:[]}get NONE(){return Fs}get CAPTURING_PHASE(){return Bs}get AT_TARGET(){return js}get BUBBLING_PHASE(){return Hs}get eventPhase(){return me(this).dispatchFlag?2:0}stopPropagation(){me(this).stopPropagationFlag=!0}get cancelBubble(){return me(this).stopPropagationFlag}set cancelBubble(e){e?me(this).stopPropagationFlag=!0:Tp.warn()}stopImmediatePropagation(){let e=me(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return me(this).bubbles}get cancelable(){return me(this).cancelable}get returnValue(){return!me(this).canceledFlag}set returnValue(e){e?Rp.warn():zs(me(this))}preventDefault(){zs(me(this))}get defaultPrevented(){return me(this).canceledFlag}get composed(){return me(this).composed}get isTrusted(){return!1}get timeStamp(){return me(this).timeStamp}initEvent(e,t=!1,n=!1){let r=me(this);if(r.dispatchFlag){Ap.warn();return}Go.set(this,{...r,type:String(e),bubbles:Boolean(t),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},Fs=0,Bs=1,js=2,Hs=3,Go=new WeakMap;function me(e,t="this"){let n=Go.get(e);return Ba(n!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),n}function zs(e){if(e.inPassiveListenerFlag){Op.warn();return}if(!e.cancelable){Lp.warn();return}e.canceledFlag=!0}Object.defineProperty(Pt,"NONE",{enumerable:!0});Object.defineProperty(Pt,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(Pt,"AT_TARGET",{enumerable:!0});Object.defineProperty(Pt,"BUBBLING_PHASE",{enumerable:!0});var uo=Object.getOwnPropertyNames(Pt.prototype);for(let e=0;e<uo.length;++e)uo[e]!=="constructor"&&Object.defineProperty(Pt.prototype,uo[e],{enumerable:!0});typeof it<"u"&&typeof it.Event<"u"&&Object.setPrototypeOf(Pt.prototype,it.Event.prototype);function Dp(e){return it.DOMException?new it.DOMException(e,"InvalidStateError"):(Cn==null&&(Cn=class Vu extends Error{constructor(n){super(n),Error.captureStackTrace&&Error.captureStackTrace(this,Vu)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(Cn.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Ks(Cn),Ks(Cn.prototype)),new Cn(e))}var Cn,Gs={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function Ks(e){let t=Object.keys(Gs);for(let n=0;n<t.length;++n){let r=t[n],i=Gs[r];Object.defineProperty(e,r,{get(){return i},configurable:!0,enumerable:!0})}}var Ki=class extends Pt{static wrap(e){return new(Bu(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),Fu.set(this,{original:e});let t=Object.keys(e);for(let n=0;n<t.length;++n){let r=t[n];r in this||Object.defineProperty(this,r,ju(e,r))}}stopPropagation(){super.stopPropagation();let{original:e}=Vt(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=Vt(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=Vt(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=Vt(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=Vt(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=Vt(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},Fu=new WeakMap;function Vt(e){let t=Fu.get(e);return Ba(t!=null,"'this' is expected an Event object, but got",e),t}var vi=new WeakMap;vi.set(Object.prototype,Ki);typeof it<"u"&&typeof it.Event<"u"&&vi.set(it.Event.prototype,Ki);function Bu(e){let t=Object.getPrototypeOf(e);if(t==null)return Ki;let n=vi.get(t);return n==null&&(n=Up(Bu(t),t),vi.set(t,n)),n}function Up(e,t){class n extends e{}let r=Object.keys(t);for(let i=0;i<r.length;++i)Object.defineProperty(n.prototype,r[i],ju(t,r[i]));return n}function ju(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return{get(){let r=Vt(this).original,i=r[t];return typeof i=="function"?i.bind(r):i},set(r){let i=Vt(this).original;i[t]=r},configurable:n.configurable,enumerable:n.enumerable}}function Pp(e,t,n,r,i,o){return{callback:e,flags:(t?1:0)|(n?2:0)|(r?4:0),signal:i,signalListener:o}}function Mp(e){e.flags|=8}function Hu(e){return(e.flags&1)===1}function zu(e){return(e.flags&2)===2}function Gu(e){return(e.flags&4)===4}function Vp(e){return(e.flags&8)===8}function Fp({callback:e},t,n){try{typeof e=="function"?e.call(t,n):typeof e.handleEvent=="function"&&e.handleEvent(n)}catch(r){kp(r)}}function Ku({listeners:e},t,n){for(let r=0;r<e.length;++r)if(e[r].callback===t&&Hu(e[r])===n)return r;return-1}function Bp(e,t,n,r,i,o){let a;o&&(a=Wu.bind(null,e,t,n),o.addEventListener("abort",a));let s=Pp(t,n,r,i,o,a);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,s]):e.listeners.push(s),s}function Wu(e,t,n){let r=Ku(e,t,n);return r!==-1?qu(e,r):!1}function qu(e,t,n=!1){let r=e.listeners[t];return Mp(r),r.signal&&r.signal.removeEventListener("abort",r.signalListener),e.cow&&!n?(e.cow=!1,e.listeners=e.listeners.filter((i,o)=>o!==t),!1):(e.listeners.splice(t,1),!0)}function jp(){return Object.create(null)}function Hp(e,t){var n;return(n=e[t])!==null&&n!==void 0?n:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var Wi=class{constructor(){$u.set(this,jp())}addEventListener(e,t,n){let r=co(this),{callback:i,capture:o,once:a,passive:s,signal:l,type:u}=zp(e,t,n);if(i==null||(l==null?void 0:l.aborted))return;let c=Hp(r,u),d=Ku(c,i,o);if(d!==-1){Kp(c.listeners[d],s,a,l);return}Bp(c,i,o,s,a,l)}removeEventListener(e,t,n){let r=co(this),{callback:i,capture:o,type:a}=Gp(e,t,n),s=r[a];i!=null&&s&&Wu(s,i,o)}dispatchEvent(e){let t=co(this)[String(e.type)];if(t==null)return!0;let n=e instanceof Pt?e:Ki.wrap(e),r=me(n,"event");if(r.dispatchFlag)throw Dp("This event has been in dispatching.");if(r.dispatchFlag=!0,r.target=r.currentTarget=this,!r.stopPropagationFlag){let{cow:i,listeners:o}=t;t.cow=!0;for(let a=0;a<o.length;++a){let s=o[a];if(!Vp(s)&&(Gu(s)&&qu(t,a,!i)&&(a-=1),r.inPassiveListenerFlag=zu(s),Fp(s,this,n),r.inPassiveListenerFlag=!1,r.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return r.target=null,r.currentTarget=null,r.stopImmediatePropagationFlag=!1,r.stopPropagationFlag=!1,r.dispatchFlag=!1,!r.canceledFlag}},$u=new WeakMap;function co(e,t="this"){let n=$u.get(e);return Ba(n!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),n}function zp(e,t,n){var r;return Yu(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:(r=n.signal)!==null&&r!==void 0?r:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}function Gp(e,t,n){return Yu(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture)}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n)}}function Yu(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){Vs.warn(e);return}throw new TypeError(Pu(Vs.message,[e]))}}function Kp(e,t,n,r){Np.warn(Hu(e)?"capture":"bubble",e.callback),zu(e)!==t&&lo.warn("passive"),Gu(e)!==n&&lo.warn("once"),e.signal!==r&&lo.warn("signal")}var fo=Object.getOwnPropertyNames(Wi.prototype);for(let e=0;e<fo.length;++e)fo[e]!=="constructor"&&Object.defineProperty(Wi.prototype,fo[e],{enumerable:!0});typeof it<"u"&&typeof it.EventTarget<"u"&&Object.setPrototypeOf(Wi.prototype,it.EventTarget.prototype);var Wp=_p(Sp()),Zu=30720,qi=512e3,$i=256,Ko=(e,{minChunkSize:t=$i,maxChunkSize:n=qi}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=n,Wo=(e,{minChunkSize:t=$i,maxChunkSize:n=qi}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${n}`),qp=class{constructor(e,t={}){this.readableStream=e;var n,r,i;if(!Ko(t.defaultChunkSize,t))throw Wo(t.defaultChunkSize,t);this.defaultChunkSize=(n=t.defaultChunkSize)!=null?n:Zu,this.minChunkSize=(r=t.minChunkSize)!=null?r:$i,this.maxChunkSize=(i=t.maxChunkSize)!=null?i:qi}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Ko(e,this))throw Wo(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n){if(e){let o=e;e=void 0,yield o}break}let i=r instanceof Uint8Array?new Blob([r],{type:"application/octet-stream"}):r;for(e=e?new Blob([e,i]):i;e;)if(e.size===this.chunkByteSize){let o=e;e=void 0,yield o;break}else{if(e.size<this.chunkByteSize)break;{let o=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield o}}}}finally{if(e){let n=e;e=void 0,yield n}t.releaseLock();return}}},$p=[200,201,202,204,308],Qu=[408,502,503,504],Ju=(e,t)=>!!e&&$p.includes(e.statusCode),Yp=(e,{retryCodes:t=Qu})=>!e||t.includes(e.statusCode),Zp=(e,t)=>t.attemptCount>=t.attempts||!(Ju(e)||Yp(e,t)),Xu=class{static createUpload(e){return new Xu(e)}constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||Qu,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this.offline=!1,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,this.chunkedStreamIterable=new qp(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedStreamIterator=this.chunkedStreamIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.eventTarget=new Wi,this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window<"u"&&(window.addEventListener("online",()=>{!this.offline||(this.offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline=!0,this.dispatch("offline")}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.maxChunkSize)!=null?t:qi}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:$i}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:Zu}set chunkSize(e){this.chunkedStreamIterable.chunkSize=e}get chunkByteSize(){return this.chunkedStreamIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}dispatch(e,t){let n=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(n)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!Ko(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw Wo(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=n=>{n.upload.onprogress=r=>{var i;let o=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/o,s=this.nextChunkRangeStart/this.file.size,l=r.loaded/((i=r.total)!=null?i:this.chunkByteSize)*a;this.dispatch("progress",Math.min((s+l)*100,100))}};return new Promise((n,r)=>{this.currentXhr=(0,Wp.default)({...e,beforeSend:t},(i,o)=>(this.currentXhr=void 0,i?r(i):n(o)))})}async sendChunk(e){let t=this.nextChunkRangeStart,n=t+e.size-1,r={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${n}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:r,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(a,s)=>{var l;let u=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:u,response:a}),this.attemptCount=0,this.chunkCount=((l=this.chunkCount)!=null?l:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let c=this.chunkSize;u<10?c=Math.min(this.chunkSize*2,this.maxChunkSize):u>30&&(c=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(c/256)*256;let d=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+d)}return!0},n=async(a,s)=>(this.dispatch("error",{message:`Server responded with ${a.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount}),!1),r=async(a,s)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount}),new Promise(l=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,l(!1);return}let u=await this.sendChunkWithRetries(e);l(u)},this.delayBeforeAttempt*1e3)})),i;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,i=await this.sendChunk(e)}catch{}let o={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts};return Ju(i)?t(i):Zp(i,o)?n(i):r()}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedStreamIterator.next(),n=!e&&t;if(e&&(n=await this.sendChunkWithRetries(e)),this.success=!!t,this.success&&n&&this.dispatch("success"),!n)return}}},Qp=Xu.createUpload,be;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(be||(be={}));function Jp(e){return e.nodeType===e.ELEMENT_NODE}function or(e){var t=e==null?void 0:e.host;return Boolean((t==null?void 0:t.shadowRoot)===e)}function ar(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xp(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function eh(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function yi(e){try{var t=e.rules||e.cssRules;return t?Xp(Array.from(t).map(ec).join("")):null}catch{return null}}function ec(e){var t;if(nh(e))try{t=yi(e.styleSheet)||eh(e)}catch{}return th(t||e.cssText)}function th(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}function nh(e){return"styleSheet"in e}var tc=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var n;if(!t)return-1;var r=(n=this.getMeta(t))===null||n===void 0?void 0:n.id;return r!=null?r:-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var n=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(i){return n.removeNodeFromMap(i)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,n){var r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)},e.prototype.replace=function(t,n){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function rh(){return new tc}function ja(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,s=o||"",l=i&&hn(i);return(n[r.toLowerCase()]||l&&n[l])&&(a?s=a(s,t):s="*".repeat(s.length)),s}function hn(e){return e.toLowerCase()}var Ws="__rrweb_original__";function ih(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=Ws in o?o[Ws]:o,s=new Uint32Array(a.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(s.some(function(l){return l!==0}))return!1}return!0}function Ha(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?hn(t):null}var oh=1,ah=new RegExp("[^a-z0-9-_:]"),mr=-2;function nc(){return oh++}function sh(e){if(e instanceof HTMLFormElement)return"form";var t=hn(e.tagName);return ah.test(t)?"div":t}function lh(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var En,qs,uh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ch=/^(?:[a-z+]+:)?\/\//i,dh=/^www\..*/i,fh=/^(data:)([^,]*),(.*)/i;function _i(e,t){return(e||"").replace(uh,function(n,r,i,o,a,s){var l=i||a||s,u=r||o||"";if(!l)return n;if(ch.test(l)||dh.test(l)||fh.test(l))return"url(".concat(u).concat(l).concat(u,")");if(l[0]==="/")return"url(".concat(u).concat(lh(t)+l).concat(u,")");var c=t.split("/"),d=l.split("/");c.pop();for(var p=0,f=d;p<f.length;p++){var h=f[p];h!=="."&&(h===".."?c.pop():c.push(h))}return"url(".concat(u).concat(c.join("/")).concat(u,")")})}var ph=/^[^ \t\n\r\u000c]+/,hh=/^[, \t\n\r\u000c]+/;function mh(e,t){if(t.trim()==="")return t;var n=0;function r(u){var c,d=u.exec(t.substring(n));return d?(c=d[0],n+=c.length,c):""}for(var i=[];r(hh),!(n>=t.length);){var o=r(ph);if(o.slice(-1)===",")o=Tn(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Tn(e,o);for(var s=!1;;){var l=t.charAt(n);if(l===""){i.push((o+a).trim());break}else if(s)l===")"&&(s=!1);else if(l===","){n+=1,i.push((o+a).trim());break}else l==="("&&(s=!0);a+=l,n+=1}}}return i.join(", ")}function Tn(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function gh(e){return Boolean(e.tagName==="svg"||e.ownerSVGElement)}function za(){var e=document.createElement("a");return e.href="",e.href}function rc(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?Tn(e,r):n==="srcset"?mh(e,r):n==="style"?_i(r,za()):t==="object"&&n==="data"?Tn(e,r):r)}function ic(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function vh(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function bi(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?bi(e.parentNode,t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?bi(e.parentNode,t,n):!1}function oc(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(r===null)return!1;if(typeof t=="string"){if(r.classList.contains(t)||r.closest(".".concat(t)))return!0}else if(bi(r,t,!0))return!0;if(n&&(r.matches(n)||r.closest(n)))return!0}catch{}return!1}function yh(e,t,n){var r=e.contentWindow;if(!!r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function _h(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function bh(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=u===void 0?{}:u,d=t.maskTextFn,p=t.maskInputFn,f=t.dataURLOptions,h=f===void 0?{}:f,m=t.inlineImages,g=t.recordCanvas,b=t.keepIframeSrcFn,y=t.newlyAddedElement,_=y===void 0?!1:y,v=wh(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:be.Document,childNodes:[],compatMode:e.compatMode}:{type:be.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:be.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return Eh(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:h,inlineImages:m,recordCanvas:g,keepIframeSrcFn:b,newlyAddedElement:_,rootId:v});case e.TEXT_NODE:return Ch(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:v});case e.CDATA_SECTION_NODE:return{type:be.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:be.Comment,textContent:e.textContent||"",rootId:v};default:return!1}}function wh(e,t){if(!!t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function Ch(e,t){var n,r=t.maskTextClass,i=t.maskTextSelector,o=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,l=e.textContent,u=s==="STYLE"?!0:void 0,c=s==="SCRIPT"?!0:void 0;if(u&&l){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(l=yi(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}l=_i(l,za())}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&oc(e,r,i)&&(l=o?o(l):l.replace(/[\S]/g,"*")),{type:be.Text,textContent:l||"",isStyle:u,rootId:a}}function Eh(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,l=t.maskInputFn,u=t.dataURLOptions,c=u===void 0?{}:u,d=t.inlineImages,p=t.recordCanvas,f=t.keepIframeSrcFn,h=t.newlyAddedElement,m=h===void 0?!1:h,g=t.rootId,b=vh(e,r,i),y=sh(e),_={},v=e.attributes.length,w=0;w<v;w++){var E=e.attributes[w];ic(y,E.name,E.value)||(_[E.name]=rc(n,y,hn(E.name),E.value))}if(y==="link"&&o){var I=Array.from(n.styleSheets).find(function(fe){return fe.href===e.href}),S=null;I&&(S=yi(I)),S&&(delete _.rel,delete _.href,_._cssText=_i(S,I.href))}if(y==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var S=yi(e.sheet);S&&(_._cssText=_i(S,za()))}if(y==="input"||y==="textarea"||y==="select"){var x=e.value,T=e.checked;if(_.type!=="radio"&&_.type!=="checkbox"&&_.type!=="submit"&&_.type!=="button"&&x){var A=Ha(e);_.value=ja({element:e,type:A,tagName:y,value:x,maskInputOptions:s,maskInputFn:l})}else T&&(_.checked=T)}if(y==="option"&&(e.selected&&!s.select?_.selected=!0:delete _.selected),y==="canvas"&&p){if(e.__context==="2d")ih(e)||(_.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var L=e.toDataURL(c.type,c.quality),k=document.createElement("canvas");k.width=e.width,k.height=e.height;var U=k.toDataURL(c.type,c.quality);L!==U&&(_.rr_dataURL=L)}}if(y==="img"&&d){En||(En=n.createElement("canvas"),qs=En.getContext("2d"));var R=e,V=R.crossOrigin;R.crossOrigin="anonymous";var K=function(){R.removeEventListener("load",K);try{En.width=R.naturalWidth,En.height=R.naturalHeight,qs.drawImage(R,0,0),_.rr_dataURL=En.toDataURL(c.type,c.quality)}catch(fe){console.warn("Cannot inline img src=".concat(R.currentSrc,"! Error: ").concat(fe))}V?_.crossOrigin=V:R.removeAttribute("crossorigin")};R.complete&&R.naturalWidth!==0?K():R.addEventListener("load",K)}if((y==="audio"||y==="video")&&(_.rr_mediaState=e.paused?"paused":"played",_.rr_mediaCurrentTime=e.currentTime),m||(e.scrollLeft&&(_.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(_.rr_scrollTop=e.scrollTop)),b){var z=e.getBoundingClientRect(),ie=z.width,oe=z.height;_={class:_.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(oe,"px")}}return y==="iframe"&&!f(_.src)&&(e.contentDocument||(_.rr_src=_.src),delete _.src),{type:be.Element,tagName:y,attributes:_,childNodes:[],isSVG:gh(e)||void 0,needBlock:b,rootId:g}}function re(e){return e==null?"":e.toLowerCase()}function Sh(e,t){if(t.comment&&e.type===be.Comment)return!0;if(e.type===be.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||re(e.attributes.name)==="application-name"||re(e.attributes.rel)==="icon"||re(e.attributes.rel)==="apple-touch-icon"||re(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||re(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(re(e.attributes.name)==="robots"||re(e.attributes.name)==="googlebot"||re(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(re(e.attributes.name)==="author"||re(e.attributes.name)==="generator"||re(e.attributes.name)==="framework"||re(e.attributes.name)==="publisher"||re(e.attributes.name)==="progid"||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(re(e.attributes.name)==="google-site-verification"||re(e.attributes.name)==="yandex-verification"||re(e.attributes.name)==="csrf-token"||re(e.attributes.name)==="p:domain_verify"||re(e.attributes.name)==="verify-v1"||re(e.attributes.name)==="verification"||re(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Rn(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.skipChild,u=l===void 0?!1:l,c=t.inlineStylesheet,d=c===void 0?!0:c,p=t.maskInputOptions,f=p===void 0?{}:p,h=t.maskTextFn,m=t.maskInputFn,g=t.slimDOMOptions,b=t.dataURLOptions,y=b===void 0?{}:b,_=t.inlineImages,v=_===void 0?!1:_,w=t.recordCanvas,E=w===void 0?!1:w,I=t.onSerialize,S=t.onIframeLoad,x=t.iframeLoadTimeout,T=x===void 0?5e3:x,A=t.onStylesheetLoad,L=t.stylesheetLoadTimeout,k=L===void 0?5e3:L,U=t.keepIframeSrcFn,R=U===void 0?function(){return!1}:U,V=t.newlyAddedElement,K=V===void 0?!1:V,z=t.preserveWhiteSpace,ie=z===void 0?!0:z,oe=bh(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,dataURLOptions:y,inlineImages:v,recordCanvas:E,keepIframeSrcFn:R,newlyAddedElement:K});if(!oe)return console.warn(e,"not serialized"),null;var fe;r.hasNode(e)?fe=r.getId(e):Sh(oe,g)||!ie&&oe.type===be.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=mr:fe=nc();var Q=Object.assign(oe,{id:fe});if(r.add(e,Q),fe===mr)return null;I&&I(e);var Ke=!u;if(Q.type===be.Element){Ke=Ke&&!Q.needBlock,delete Q.needBlock;var Ie=e.shadowRoot;Ie&&ar(Ie)&&(Q.isShadowHost=!0)}if((Q.type===be.Document||Q.type===be.Element)&&Ke){g.headWhitespace&&Q.type===be.Element&&Q.tagName==="head"&&(ie=!1);for(var yt={doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:u,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:I,onIframeLoad:S,iframeLoadTimeout:T,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:R},Fe=0,st=Array.from(e.childNodes);Fe<st.length;Fe++){var Xt=st[Fe],Xe=Rn(Xt,yt);Xe&&Q.childNodes.push(Xe)}if(Jp(e)&&e.shadowRoot)for(var j=0,Pe=Array.from(e.shadowRoot.childNodes);j<Pe.length;j++){var Xt=Pe[j],Xe=Rn(Xt,yt);Xe&&(ar(e.shadowRoot)&&(Xe.isShadow=!0),Q.childNodes.push(Xe))}}return e.parentNode&&or(e.parentNode)&&ar(e.parentNode)&&(Q.isShadow=!0),Q.type===be.Element&&Q.tagName==="iframe"&&yh(e,function(){var ee=e.contentDocument;if(ee&&S){var Ce=Rn(ee,{doc:ee,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:I,onIframeLoad:S,iframeLoadTimeout:T,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:R});Ce&&S(e,Ce)}},T),Q.type===be.Element&&Q.tagName==="link"&&Q.attributes.rel==="stylesheet"&&_h(e,function(){if(A){var ee=Rn(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:I,onIframeLoad:S,iframeLoadTimeout:T,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:R});ee&&A(e,ee)}},k),Q}function Ih(e,t){var n=t||{},r=n.mirror,i=r===void 0?new tc:r,o=n.blockClass,a=o===void 0?"rr-block":o,s=n.blockSelector,l=s===void 0?null:s,u=n.maskTextClass,c=u===void 0?"rr-mask":u,d=n.maskTextSelector,p=d===void 0?null:d,f=n.inlineStylesheet,h=f===void 0?!0:f,m=n.inlineImages,g=m===void 0?!1:m,b=n.recordCanvas,y=b===void 0?!1:b,_=n.maskAllInputs,v=_===void 0?!1:_,w=n.maskTextFn,E=n.maskInputFn,I=n.slimDOM,S=I===void 0?!1:I,x=n.dataURLOptions,T=n.preserveWhiteSpace,A=n.onSerialize,L=n.onIframeLoad,k=n.iframeLoadTimeout,U=n.onStylesheetLoad,R=n.stylesheetLoadTimeout,V=n.keepIframeSrcFn,K=V===void 0?function(){return!1}:V,z=v===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:v===!1?{password:!0}:v,ie=S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:S==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:S===!1?{}:S;return Rn(e,{doc:e,mirror:i,blockClass:a,blockSelector:l,maskTextClass:c,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:z,maskTextFn:w,maskInputFn:E,slimDOMOptions:ie,dataURLOptions:x,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:A,onIframeLoad:L,iframeLoadTimeout:k,onStylesheetLoad:U,stylesheetLoadTimeout:R,keepIframeSrcFn:K,newlyAddedElement:!1})}function Oe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const xn=`Please stop import mirror directly. Instead of that,\r
1
+ "use strict";var ap=Object.defineProperty;var sp=(e,t,n)=>t in e?ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>(sp(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var lp=Object.create,xu=Object.defineProperty,up=Object.getOwnPropertyDescriptor,cp=Object.getOwnPropertyNames,dp=Object.getPrototypeOf,fp=Object.prototype.hasOwnProperty,Ar=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pp=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cp(t))!fp.call(e,i)&&i!==n&&xu(e,i,{get:()=>t[i],enumerable:!(r=up(t,i))||r.enumerable});return e},hp=(e,t,n)=>(n=e!=null?lp(dp(e)):{},pp(t||!e||!e.__esModule?xu(n,"default",{value:e,enumerable:!0}):n,e)),mp=Ar((e,t)=>{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n={},t.exports=n}),gp=Ar((e,t)=>{t.exports=r;var n=Object.prototype.toString;function r(i){if(!i)return!1;var o=n.call(i);return o==="[object Function]"||typeof i=="function"&&o!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}}),vp=Ar((e,t)=>{var n=function(i){return i.replace(/^\s+|\s+$/g,"")},r=function(i){return Object.prototype.toString.call(i)==="[object Array]"};t.exports=function(i){if(!i)return{};for(var o={},a=n(i).split(`
2
+ `),s=0;s<a.length;s++){var l=a[s],u=l.indexOf(":"),c=n(l.slice(0,u)).toLowerCase(),d=n(l.slice(u+1));typeof o[c]>"u"?o[c]=d:r(o[c])?o[c].push(d):o[c]=[o[c],d]}return o}}),yp=Ar((e,t)=>{t.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var i={},o=0;o<arguments.length;o++){var a=arguments[o];for(var s in a)n.call(a,s)&&(i[s]=a[s])}return i}}),_p=Ar((e,t)=>{var n=mp(),r=gp(),i=vp(),o=yp();t.exports=u,t.exports.default=u,u.XMLHttpRequest=n.XMLHttpRequest||p,u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:n.XDomainRequest,a(["get","put","post","patch","head","delete"],function(f){u[f==="delete"?"del":f]=function(h,m,g){return m=l(h,m,g),m.method=f.toUpperCase(),c(m)}});function a(f,h){for(var m=0;m<f.length;m++)h(f[m])}function s(f){for(var h in f)if(f.hasOwnProperty(h))return!1;return!0}function l(f,h,m){var g=f;return r(h)?(m=h,typeof f=="string"&&(g={uri:f})):g=o(h,{uri:f}),g.callback=m,g}function u(f,h,m){return h=l(f,h,m),c(h)}function c(f){if(typeof f.callback>"u")throw new Error("callback argument missing");var h=!1,m=function(T,B,Z){h||(h=!0,f.callback(T,B,Z))};function g(){y.readyState===4&&setTimeout(_,0)}function b(){var T=void 0;if(y.response?T=y.response:T=y.responseText||d(y),O)try{T=JSON.parse(T)}catch{}return T}function v(T){return clearTimeout(k),T instanceof Error||(T=new Error(""+(T||"Unknown XMLHttpRequest Error"))),T.statusCode=0,m(T,U)}function _(){if(!E){var T;clearTimeout(k),f.useXDR&&y.status===void 0?T=200:T=y.status===1223?204:y.status;var B=U,Z=null;return T!==0?(B={body:b(),statusCode:T,method:I,headers:{},url:S,rawRequest:y},y.getAllResponseHeaders&&(B.headers=i(y.getAllResponseHeaders()))):Z=new Error("Internal XMLHttpRequest Error"),m(Z,B,B.body)}}var y=f.xhr||null;y||(f.cors||f.useXDR?y=new u.XDomainRequest:y=new u.XMLHttpRequest);var C,E,S=y.url=f.uri||f.url,I=y.method=f.method||"GET",x=f.body||f.data,R=y.headers=f.headers||{},A=!!f.sync,O=!1,k,U={body:void 0,headers:{},statusCode:0,method:I,url:S,rawRequest:y};if("json"in f&&f.json!==!1&&(O=!0,R.accept||R.Accept||(R.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(R["content-type"]||R["Content-Type"]||(R["Content-Type"]="application/json"),x=JSON.stringify(f.json===!0?x:f.json))),y.onreadystatechange=g,y.onload=_,y.onerror=v,y.onprogress=function(){},y.onabort=function(){E=!0},y.ontimeout=v,y.open(I,S,!A,f.username,f.password),A||(y.withCredentials=!!f.withCredentials),!A&&f.timeout>0&&(k=setTimeout(function(){if(!E){E=!0,y.abort("timeout");var T=new Error("XMLHttpRequest timeout");T.code="ETIMEDOUT",v(T)}},f.timeout)),y.setRequestHeader)for(C in R)R.hasOwnProperty(C)&&y.setRequestHeader(C,R[C]);else if(f.headers&&!s(f.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in f&&(y.responseType=f.responseType),"beforeSend"in f&&typeof f.beforeSend=="function"&&f.beforeSend(y),y.send(x||null),y}function d(f){try{if(f.responseType==="document")return f.responseXML;var h=f.responseXML&&f.responseXML.documentElement.nodeName==="parsererror";if(f.responseType===""&&!h)return f.responseXML}catch{}return null}function p(){}});function Ma(e,t,...n){if(!e)throw new TypeError(Au(t,n))}function Au(e,t){let n=0;return e.replace(/%[os]/gu,()=>Tu(t[n++]))}function Tu(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var bp;function wp(e){try{let t=e instanceof Error?e:new Error(Tu(e));if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}));else if(typeof process<"u"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)}catch{}}var it=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,Cp,Ut=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{let n=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,`
3
+ `);console.warn(this.message,...e,n)}catch{}}},Ep=new Ut("W01","Unable to initialize event under dispatching."),Ip=new Ut("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Sp=new Ut("W03","Assigning any truthy value to 'returnValue' property has no effect."),kp=new Ut("W04","Unable to preventDefault on non-cancelable events."),xp=new Ut("W05","Unable to preventDefault inside passive event listener invocation."),Ap=new Ut("W06","An event listener wasn't added because it has been added already: %o, %o"),uo=new Ut("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Us=new Ut("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");new Ut("W09","Event attribute handler must be a function: %o");var Pt=class{static get NONE(){return Ps}static get CAPTURING_PHASE(){return Ms}static get AT_TARGET(){return Fs}static get BUBBLING_PHASE(){return Vs}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let n=t!=null?t:{};jo.set(this,{type:String(e),bubbles:Boolean(n.bubbles),cancelable:Boolean(n.cancelable),composed:Boolean(n.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return me(this).type}get target(){return me(this).target}get srcElement(){return me(this).target}get currentTarget(){return me(this).currentTarget}composedPath(){let e=me(this).currentTarget;return e?[e]:[]}get NONE(){return Ps}get CAPTURING_PHASE(){return Ms}get AT_TARGET(){return Fs}get BUBBLING_PHASE(){return Vs}get eventPhase(){return me(this).dispatchFlag?2:0}stopPropagation(){me(this).stopPropagationFlag=!0}get cancelBubble(){return me(this).stopPropagationFlag}set cancelBubble(e){e?me(this).stopPropagationFlag=!0:Ip.warn()}stopImmediatePropagation(){let e=me(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return me(this).bubbles}get cancelable(){return me(this).cancelable}get returnValue(){return!me(this).canceledFlag}set returnValue(e){e?Sp.warn():Bs(me(this))}preventDefault(){Bs(me(this))}get defaultPrevented(){return me(this).canceledFlag}get composed(){return me(this).composed}get isTrusted(){return!1}get timeStamp(){return me(this).timeStamp}initEvent(e,t=!1,n=!1){let r=me(this);if(r.dispatchFlag){Ep.warn();return}jo.set(this,{...r,type:String(e),bubbles:Boolean(t),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},Ps=0,Ms=1,Fs=2,Vs=3,jo=new WeakMap;function me(e,t="this"){let n=jo.get(e);return Ma(n!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),n}function Bs(e){if(e.inPassiveListenerFlag){xp.warn();return}if(!e.cancelable){kp.warn();return}e.canceledFlag=!0}Object.defineProperty(Pt,"NONE",{enumerable:!0});Object.defineProperty(Pt,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(Pt,"AT_TARGET",{enumerable:!0});Object.defineProperty(Pt,"BUBBLING_PHASE",{enumerable:!0});var co=Object.getOwnPropertyNames(Pt.prototype);for(let e=0;e<co.length;++e)co[e]!=="constructor"&&Object.defineProperty(Pt.prototype,co[e],{enumerable:!0});typeof it<"u"&&typeof it.Event<"u"&&Object.setPrototypeOf(Pt.prototype,it.Event.prototype);function Tp(e){return it.DOMException?new it.DOMException(e,"InvalidStateError"):(Cn==null&&(Cn=class Ru extends Error{constructor(n){super(n),Error.captureStackTrace&&Error.captureStackTrace(this,Ru)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(Cn.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Hs(Cn),Hs(Cn.prototype)),new Cn(e))}var Cn,js={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function Hs(e){let t=Object.keys(js);for(let n=0;n<t.length;++n){let r=t[n],i=js[r];Object.defineProperty(e,r,{get(){return i},configurable:!0,enumerable:!0})}}var Wi=class extends Pt{static wrap(e){return new(Ou(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),Lu.set(this,{original:e});let t=Object.keys(e);for(let n=0;n<t.length;++n){let r=t[n];r in this||Object.defineProperty(this,r,Nu(e,r))}}stopPropagation(){super.stopPropagation();let{original:e}=Ft(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=Ft(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=Ft(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=Ft(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=Ft(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=Ft(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},Lu=new WeakMap;function Ft(e){let t=Lu.get(e);return Ma(t!=null,"'this' is expected an Event object, but got",e),t}var yi=new WeakMap;yi.set(Object.prototype,Wi);typeof it<"u"&&typeof it.Event<"u"&&yi.set(it.Event.prototype,Wi);function Ou(e){let t=Object.getPrototypeOf(e);if(t==null)return Wi;let n=yi.get(t);return n==null&&(n=Rp(Ou(t),t),yi.set(t,n)),n}function Rp(e,t){class n extends e{}let r=Object.keys(t);for(let i=0;i<r.length;++i)Object.defineProperty(n.prototype,r[i],Nu(t,r[i]));return n}function Nu(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return{get(){let r=Ft(this).original,i=r[t];return typeof i=="function"?i.bind(r):i},set(r){let i=Ft(this).original;i[t]=r},configurable:n.configurable,enumerable:n.enumerable}}function Lp(e,t,n,r,i,o){return{callback:e,flags:(t?1:0)|(n?2:0)|(r?4:0),signal:i,signalListener:o}}function Op(e){e.flags|=8}function Du(e){return(e.flags&1)===1}function Uu(e){return(e.flags&2)===2}function Pu(e){return(e.flags&4)===4}function Np(e){return(e.flags&8)===8}function Dp({callback:e},t,n){try{typeof e=="function"?e.call(t,n):typeof e.handleEvent=="function"&&e.handleEvent(n)}catch(r){wp(r)}}function Mu({listeners:e},t,n){for(let r=0;r<e.length;++r)if(e[r].callback===t&&Du(e[r])===n)return r;return-1}function Up(e,t,n,r,i,o){let a;o&&(a=Fu.bind(null,e,t,n),o.addEventListener("abort",a));let s=Lp(t,n,r,i,o,a);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,s]):e.listeners.push(s),s}function Fu(e,t,n){let r=Mu(e,t,n);return r!==-1?Vu(e,r):!1}function Vu(e,t,n=!1){let r=e.listeners[t];return Op(r),r.signal&&r.signal.removeEventListener("abort",r.signalListener),e.cow&&!n?(e.cow=!1,e.listeners=e.listeners.filter((i,o)=>o!==t),!1):(e.listeners.splice(t,1),!0)}function Pp(){return Object.create(null)}function Mp(e,t){var n;return(n=e[t])!==null&&n!==void 0?n:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var $i=class{constructor(){Bu.set(this,Pp())}addEventListener(e,t,n){let r=fo(this),{callback:i,capture:o,once:a,passive:s,signal:l,type:u}=Fp(e,t,n);if(i==null||(l==null?void 0:l.aborted))return;let c=Mp(r,u),d=Mu(c,i,o);if(d!==-1){Bp(c.listeners[d],s,a,l);return}Up(c,i,o,s,a,l)}removeEventListener(e,t,n){let r=fo(this),{callback:i,capture:o,type:a}=Vp(e,t,n),s=r[a];i!=null&&s&&Fu(s,i,o)}dispatchEvent(e){let t=fo(this)[String(e.type)];if(t==null)return!0;let n=e instanceof Pt?e:Wi.wrap(e),r=me(n,"event");if(r.dispatchFlag)throw Tp("This event has been in dispatching.");if(r.dispatchFlag=!0,r.target=r.currentTarget=this,!r.stopPropagationFlag){let{cow:i,listeners:o}=t;t.cow=!0;for(let a=0;a<o.length;++a){let s=o[a];if(!Np(s)&&(Pu(s)&&Vu(t,a,!i)&&(a-=1),r.inPassiveListenerFlag=Uu(s),Dp(s,this,n),r.inPassiveListenerFlag=!1,r.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return r.target=null,r.currentTarget=null,r.stopImmediatePropagationFlag=!1,r.stopPropagationFlag=!1,r.dispatchFlag=!1,!r.canceledFlag}},Bu=new WeakMap;function fo(e,t="this"){let n=Bu.get(e);return Ma(n!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),n}function Fp(e,t,n){var r;return ju(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:(r=n.signal)!==null&&r!==void 0?r:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}function Vp(e,t,n){return ju(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture)}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n)}}function ju(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){Us.warn(e);return}throw new TypeError(Au(Us.message,[e]))}}function Bp(e,t,n,r){Ap.warn(Du(e)?"capture":"bubble",e.callback),Uu(e)!==t&&uo.warn("passive"),Pu(e)!==n&&uo.warn("once"),e.signal!==r&&uo.warn("signal")}var po=Object.getOwnPropertyNames($i.prototype);for(let e=0;e<po.length;++e)po[e]!=="constructor"&&Object.defineProperty($i.prototype,po[e],{enumerable:!0});typeof it<"u"&&typeof it.EventTarget<"u"&&Object.setPrototypeOf($i.prototype,it.EventTarget.prototype);var jp=hp(_p()),Hu=30720,qi=512e3,Yi=256,Ho=(e,{minChunkSize:t=Yi,maxChunkSize:n=qi}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=n,zo=(e,{minChunkSize:t=Yi,maxChunkSize:n=qi}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${n}`),Hp=class{constructor(e,t={}){this.readableStream=e;var n,r,i;if(!Ho(t.defaultChunkSize,t))throw zo(t.defaultChunkSize,t);this.defaultChunkSize=(n=t.defaultChunkSize)!=null?n:Hu,this.minChunkSize=(r=t.minChunkSize)!=null?r:Yi,this.maxChunkSize=(i=t.maxChunkSize)!=null?i:qi}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Ho(e,this))throw zo(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n){if(e){let o=e;e=void 0,yield o}break}let i=r instanceof Uint8Array?new Blob([r],{type:"application/octet-stream"}):r;for(e=e?new Blob([e,i]):i;e;)if(e.size===this.chunkByteSize){let o=e;e=void 0,yield o;break}else{if(e.size<this.chunkByteSize)break;{let o=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield o}}}}finally{if(e){let n=e;e=void 0,yield n}t.releaseLock();return}}},zp=[200,201,202,204,308],zu=[408,502,503,504],Gu=(e,t)=>!!e&&zp.includes(e.statusCode),Gp=(e,{retryCodes:t=zu})=>!e||t.includes(e.statusCode),Kp=(e,t)=>t.attemptCount>=t.attempts||!(Gu(e)||Gp(e,t)),Ku=class{static createUpload(e){return new Ku(e)}constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||zu,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this.offline=!1,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,this.chunkedStreamIterable=new Hp(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedStreamIterator=this.chunkedStreamIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.eventTarget=new $i,this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window<"u"&&(window.addEventListener("online",()=>{!this.offline||(this.offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline=!0,this.dispatch("offline")}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.maxChunkSize)!=null?t:qi}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:Yi}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:Hu}set chunkSize(e){this.chunkedStreamIterable.chunkSize=e}get chunkByteSize(){return this.chunkedStreamIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}dispatch(e,t){let n=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(n)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!Ho(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw zo(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=n=>{n.upload.onprogress=r=>{var i;let o=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/o,s=this.nextChunkRangeStart/this.file.size,l=r.loaded/((i=r.total)!=null?i:this.chunkByteSize)*a;this.dispatch("progress",Math.min((s+l)*100,100))}};return new Promise((n,r)=>{this.currentXhr=(0,jp.default)({...e,beforeSend:t},(i,o)=>(this.currentXhr=void 0,i?r(i):n(o)))})}async sendChunk(e){let t=this.nextChunkRangeStart,n=t+e.size-1,r={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${n}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:r,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(a,s)=>{var l;let u=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:u,response:a}),this.attemptCount=0,this.chunkCount=((l=this.chunkCount)!=null?l:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let c=this.chunkSize;u<10?c=Math.min(this.chunkSize*2,this.maxChunkSize):u>30&&(c=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(c/256)*256;let d=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+d)}return!0},n=async(a,s)=>(this.dispatch("error",{message:`Server responded with ${a.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount}),!1),r=async(a,s)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount}),new Promise(l=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,l(!1);return}let u=await this.sendChunkWithRetries(e);l(u)},this.delayBeforeAttempt*1e3)})),i;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,i=await this.sendChunk(e)}catch{}let o={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts};return Gu(i)?t(i):Kp(i,o)?n(i):r()}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedStreamIterator.next(),n=!e&&t;if(e&&(n=await this.sendChunkWithRetries(e)),this.success=!!t,this.success&&n&&this.dispatch("success"),!n)return}}},Wp=Ku.createUpload,be;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(be||(be={}));function $p(e){return e.nodeType===e.ELEMENT_NODE}function ar(e){var t=e==null?void 0:e.host;return Boolean((t==null?void 0:t.shadowRoot)===e)}function sr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function qp(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Yp(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function _i(e){try{var t=e.rules||e.cssRules;return t?qp(Array.from(t).map(Wu).join("")):null}catch{return null}}function Wu(e){var t;if(Qp(e))try{t=_i(e.styleSheet)||Yp(e)}catch{}return Zp(t||e.cssText)}function Zp(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}function Qp(e){return"styleSheet"in e}var $u=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var n;if(!t)return-1;var r=(n=this.getMeta(t))===null||n===void 0?void 0:n.id;return r!=null?r:-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var n=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(i){return n.removeNodeFromMap(i)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,n){var r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)},e.prototype.replace=function(t,n){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Jp(){return new $u}function Fa(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,s=o||"",l=i&&hn(i);return(n[r.toLowerCase()]||l&&n[l])&&(a?s=a(s,t):s="*".repeat(s.length)),s}function hn(e){return e.toLowerCase()}var zs="__rrweb_original__";function Xp(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=zs in o?o[zs]:o,s=new Uint32Array(a.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(s.some(function(l){return l!==0}))return!1}return!0}function Va(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?hn(t):null}var eh=1,th=new RegExp("[^a-z0-9-_:]"),gr=-2;function qu(){return eh++}function nh(e){if(e instanceof HTMLFormElement)return"form";var t=hn(e.tagName);return th.test(t)?"div":t}function rh(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var En,Gs,ih=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,oh=/^(?:[a-z+]+:)?\/\//i,ah=/^www\..*/i,sh=/^(data:)([^,]*),(.*)/i;function bi(e,t){return(e||"").replace(ih,function(n,r,i,o,a,s){var l=i||a||s,u=r||o||"";if(!l)return n;if(oh.test(l)||ah.test(l)||sh.test(l))return"url(".concat(u).concat(l).concat(u,")");if(l[0]==="/")return"url(".concat(u).concat(rh(t)+l).concat(u,")");var c=t.split("/"),d=l.split("/");c.pop();for(var p=0,f=d;p<f.length;p++){var h=f[p];h!=="."&&(h===".."?c.pop():c.push(h))}return"url(".concat(u).concat(c.join("/")).concat(u,")")})}var lh=/^[^ \t\n\r\u000c]+/,uh=/^[, \t\n\r\u000c]+/;function ch(e,t){if(t.trim()==="")return t;var n=0;function r(u){var c,d=u.exec(t.substring(n));return d?(c=d[0],n+=c.length,c):""}for(var i=[];r(uh),!(n>=t.length);){var o=r(lh);if(o.slice(-1)===",")o=Tn(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Tn(e,o);for(var s=!1;;){var l=t.charAt(n);if(l===""){i.push((o+a).trim());break}else if(s)l===")"&&(s=!1);else if(l===","){n+=1,i.push((o+a).trim());break}else l==="("&&(s=!0);a+=l,n+=1}}}return i.join(", ")}function Tn(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function dh(e){return Boolean(e.tagName==="svg"||e.ownerSVGElement)}function Ba(){var e=document.createElement("a");return e.href="",e.href}function Yu(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?Tn(e,r):n==="srcset"?ch(e,r):n==="style"?bi(r,Ba()):t==="object"&&n==="data"?Tn(e,r):r)}function Zu(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function fh(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function wi(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?wi(e.parentNode,t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?wi(e.parentNode,t,n):!1}function Qu(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(r===null)return!1;if(typeof t=="string"){if(r.classList.contains(t)||r.closest(".".concat(t)))return!0}else if(wi(r,t,!0))return!0;if(n&&(r.matches(n)||r.closest(n)))return!0}catch{}return!1}function ph(e,t,n){var r=e.contentWindow;if(!!r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function hh(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function mh(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=u===void 0?{}:u,d=t.maskTextFn,p=t.maskInputFn,f=t.dataURLOptions,h=f===void 0?{}:f,m=t.inlineImages,g=t.recordCanvas,b=t.keepIframeSrcFn,v=t.newlyAddedElement,_=v===void 0?!1:v,y=gh(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:be.Document,childNodes:[],compatMode:e.compatMode}:{type:be.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:be.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return yh(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:h,inlineImages:m,recordCanvas:g,keepIframeSrcFn:b,newlyAddedElement:_,rootId:y});case e.TEXT_NODE:return vh(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:y});case e.CDATA_SECTION_NODE:return{type:be.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:be.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function gh(e,t){if(!!t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function vh(e,t){var n,r=t.maskTextClass,i=t.maskTextSelector,o=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,l=e.textContent,u=s==="STYLE"?!0:void 0,c=s==="SCRIPT"?!0:void 0;if(u&&l){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(l=_i(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}l=bi(l,Ba())}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&Qu(e,r,i)&&(l=o?o(l):l.replace(/[\S]/g,"*")),{type:be.Text,textContent:l||"",isStyle:u,rootId:a}}function yh(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,l=t.maskInputFn,u=t.dataURLOptions,c=u===void 0?{}:u,d=t.inlineImages,p=t.recordCanvas,f=t.keepIframeSrcFn,h=t.newlyAddedElement,m=h===void 0?!1:h,g=t.rootId,b=fh(e,r,i),v=nh(e),_={},y=e.attributes.length,C=0;C<y;C++){var E=e.attributes[C];Zu(v,E.name,E.value)||(_[E.name]=Yu(n,v,hn(E.name),E.value))}if(v==="link"&&o){var S=Array.from(n.styleSheets).find(function(fe){return fe.href===e.href}),I=null;S&&(I=_i(S)),I&&(delete _.rel,delete _.href,_._cssText=bi(I,S.href))}if(v==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var I=_i(e.sheet);I&&(_._cssText=bi(I,Ba()))}if(v==="input"||v==="textarea"||v==="select"){var x=e.value,R=e.checked;if(_.type!=="radio"&&_.type!=="checkbox"&&_.type!=="submit"&&_.type!=="button"&&x){var A=Va(e);_.value=Fa({element:e,type:A,tagName:v,value:x,maskInputOptions:s,maskInputFn:l})}else R&&(_.checked=R)}if(v==="option"&&(e.selected&&!s.select?_.selected=!0:delete _.selected),v==="canvas"&&p){if(e.__context==="2d")Xp(e)||(_.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var O=e.toDataURL(c.type,c.quality),k=document.createElement("canvas");k.width=e.width,k.height=e.height;var U=k.toDataURL(c.type,c.quality);O!==U&&(_.rr_dataURL=O)}}if(v==="img"&&d){En||(En=n.createElement("canvas"),Gs=En.getContext("2d"));var T=e,B=T.crossOrigin;T.crossOrigin="anonymous";var Z=function(){T.removeEventListener("load",Z);try{En.width=T.naturalWidth,En.height=T.naturalHeight,Gs.drawImage(T,0,0),_.rr_dataURL=En.toDataURL(c.type,c.quality)}catch(fe){console.warn("Cannot inline img src=".concat(T.currentSrc,"! Error: ").concat(fe))}B?_.crossOrigin=B:T.removeAttribute("crossorigin")};T.complete&&T.naturalWidth!==0?Z():T.addEventListener("load",Z)}if((v==="audio"||v==="video")&&(_.rr_mediaState=e.paused?"paused":"played",_.rr_mediaCurrentTime=e.currentTime),m||(e.scrollLeft&&(_.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(_.rr_scrollTop=e.scrollTop)),b){var z=e.getBoundingClientRect(),ie=z.width,oe=z.height;_={class:_.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(oe,"px")}}return v==="iframe"&&!f(_.src)&&(e.contentDocument||(_.rr_src=_.src),delete _.src),{type:be.Element,tagName:v,attributes:_,childNodes:[],isSVG:dh(e)||void 0,needBlock:b,rootId:g}}function re(e){return e==null?"":e.toLowerCase()}function _h(e,t){if(t.comment&&e.type===be.Comment)return!0;if(e.type===be.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||re(e.attributes.name)==="application-name"||re(e.attributes.rel)==="icon"||re(e.attributes.rel)==="apple-touch-icon"||re(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||re(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(re(e.attributes.name)==="robots"||re(e.attributes.name)==="googlebot"||re(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(re(e.attributes.name)==="author"||re(e.attributes.name)==="generator"||re(e.attributes.name)==="framework"||re(e.attributes.name)==="publisher"||re(e.attributes.name)==="progid"||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(re(e.attributes.name)==="google-site-verification"||re(e.attributes.name)==="yandex-verification"||re(e.attributes.name)==="csrf-token"||re(e.attributes.name)==="p:domain_verify"||re(e.attributes.name)==="verify-v1"||re(e.attributes.name)==="verification"||re(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Rn(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.skipChild,u=l===void 0?!1:l,c=t.inlineStylesheet,d=c===void 0?!0:c,p=t.maskInputOptions,f=p===void 0?{}:p,h=t.maskTextFn,m=t.maskInputFn,g=t.slimDOMOptions,b=t.dataURLOptions,v=b===void 0?{}:b,_=t.inlineImages,y=_===void 0?!1:_,C=t.recordCanvas,E=C===void 0?!1:C,S=t.onSerialize,I=t.onIframeLoad,x=t.iframeLoadTimeout,R=x===void 0?5e3:x,A=t.onStylesheetLoad,O=t.stylesheetLoadTimeout,k=O===void 0?5e3:O,U=t.keepIframeSrcFn,T=U===void 0?function(){return!1}:U,B=t.newlyAddedElement,Z=B===void 0?!1:B,z=t.preserveWhiteSpace,ie=z===void 0?!0:z,oe=mh(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,dataURLOptions:v,inlineImages:y,recordCanvas:E,keepIframeSrcFn:T,newlyAddedElement:Z});if(!oe)return console.warn(e,"not serialized"),null;var fe;r.hasNode(e)?fe=r.getId(e):_h(oe,g)||!ie&&oe.type===be.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=gr:fe=qu();var Q=Object.assign(oe,{id:fe});if(r.add(e,Q),fe===gr)return null;S&&S(e);var Ke=!u;if(Q.type===be.Element){Ke=Ke&&!Q.needBlock,delete Q.needBlock;var Se=e.shadowRoot;Se&&sr(Se)&&(Q.isShadowHost=!0)}if((Q.type===be.Document||Q.type===be.Element)&&Ke){g.headWhitespace&&Q.type===be.Element&&Q.tagName==="head"&&(ie=!1);for(var yt={doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:u,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:T},Ve=0,st=Array.from(e.childNodes);Ve<st.length;Ve++){var Xt=st[Ve],Xe=Rn(Xt,yt);Xe&&Q.childNodes.push(Xe)}if($p(e)&&e.shadowRoot)for(var j=0,Pe=Array.from(e.shadowRoot.childNodes);j<Pe.length;j++){var Xt=Pe[j],Xe=Rn(Xt,yt);Xe&&(sr(e.shadowRoot)&&(Xe.isShadow=!0),Q.childNodes.push(Xe))}}return e.parentNode&&ar(e.parentNode)&&sr(e.parentNode)&&(Q.isShadow=!0),Q.type===be.Element&&Q.tagName==="iframe"&&ph(e,function(){var ee=e.contentDocument;if(ee&&I){var Ce=Rn(ee,{doc:ee,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:T});Ce&&I(e,Ce)}},R),Q.type===be.Element&&Q.tagName==="link"&&Q.attributes.rel==="stylesheet"&&hh(e,function(){if(A){var ee=Rn(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:E,preserveWhiteSpace:ie,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:A,stylesheetLoadTimeout:k,keepIframeSrcFn:T});ee&&A(e,ee)}},k),Q}function bh(e,t){var n=t||{},r=n.mirror,i=r===void 0?new $u:r,o=n.blockClass,a=o===void 0?"rr-block":o,s=n.blockSelector,l=s===void 0?null:s,u=n.maskTextClass,c=u===void 0?"rr-mask":u,d=n.maskTextSelector,p=d===void 0?null:d,f=n.inlineStylesheet,h=f===void 0?!0:f,m=n.inlineImages,g=m===void 0?!1:m,b=n.recordCanvas,v=b===void 0?!1:b,_=n.maskAllInputs,y=_===void 0?!1:_,C=n.maskTextFn,E=n.maskInputFn,S=n.slimDOM,I=S===void 0?!1:S,x=n.dataURLOptions,R=n.preserveWhiteSpace,A=n.onSerialize,O=n.onIframeLoad,k=n.iframeLoadTimeout,U=n.onStylesheetLoad,T=n.stylesheetLoadTimeout,B=n.keepIframeSrcFn,Z=B===void 0?function(){return!1}:B,z=y===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:y===!1?{password:!0}:y,ie=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I;return Rn(e,{doc:e,mirror:i,blockClass:a,blockSelector:l,maskTextClass:c,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:z,maskTextFn:C,maskInputFn:E,slimDOMOptions:ie,dataURLOptions:x,inlineImages:g,recordCanvas:v,preserveWhiteSpace:R,onSerialize:A,onIframeLoad:O,iframeLoadTimeout:k,onStylesheetLoad:U,stylesheetLoadTimeout:T,keepIframeSrcFn:Z,newlyAddedElement:!1})}function Oe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const xn=`Please stop import mirror directly. Instead of that,\r
4
4
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
5
- or you can use record.mirror to access the mirror instance during recording.`;let $s={map:{},getId(){return console.error(xn),-1},getNode(){return console.error(xn),null},removeNodeFromMap(){console.error(xn)},has(){return console.error(xn),!1},reset(){console.error(xn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&($s=new Proxy($s,{get(e,t,n){return t==="map"&&console.error(xn),Reflect.get(e,t,n)}}));function gr(e,t,n={}){let r=null,i=0;return function(...o){const a=Date.now();!i&&n.leading===!1&&(i=a);const s=t-(a-i),l=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},s))}}function Yi(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(a){setTimeout(()=>{n.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>Yi(e,t,o||{},!0)}function Ar(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}let wi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(wi=()=>new Date().getTime());function ac(e){var t,n,r,i,o,a;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:(s==null?void 0:s.documentElement.scrollLeft)||((n=(t=s==null?void 0:s.body)===null||t===void 0?void 0:t.parentElement)===null||n===void 0?void 0:n.scrollLeft)||((r=s==null?void 0:s.body)===null||r===void 0?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(s==null?void 0:s.documentElement.scrollTop)||((o=(i=s==null?void 0:s.body)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.scrollTop)||((a=s==null?void 0:s.body)===null||a===void 0?void 0:a.scrollTop)||0}}function sc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function lc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ne(e,t,n,r){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(bi(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function kh(e,t){return t.getId(e)!==-1}function po(e,t){return t.getId(e)===mr}function uc(e,t){if(or(e))return!1;const n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?uc(e.parentNode,t):!0:!0}function qo(e){return Boolean(e.changedTouches)}function xh(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function cc(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function dc(e,t){return Boolean(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function $o(e){return Boolean(e==null?void 0:e.shadowRoot)}class Ah{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var n;return(n=this.styleIDMap.get(t))!==null&&n!==void 0?n:-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function fc(e){var t,n;let r=null;return((n=(t=e.getRootNode)===null||t===void 0?void 0:t.call(e))===null||n===void 0?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function Th(e){let t=e,n;for(;n=fc(t);)t=n;return t}function Rh(e){const t=e.ownerDocument;if(!t)return!1;const n=Th(e);return t.contains(n)}function pc(e){const t=e.ownerDocument;return t?t.contains(e)||Rh(e):!1}var X=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(X||{}),J=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(J||{}),Me=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Me||{}),bt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(bt||{}),Mn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Mn||{});function Ys(e){return"__ln"in e}class Lh{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=(n==null?void 0:n.next)||null;return n}addNode(t){const n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&Ys(t.previousSibling)){const r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&Ys(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){const n=t.__ln;!this.head||(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Zs=(e,t)=>`${e}@${t}`;class Oh{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],n=new Set,r=new Lh,i=l=>{let u=l,c=mr;for(;c===mr;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=l=>{if(!l.parentNode||!pc(l))return;const u=or(l.parentNode)?this.mirror.getId(fc(l)):this.mirror.getId(l.parentNode),c=i(l);if(u===-1||c===-1)return r.addNode(l);const d=Rn(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:p=>{cc(p,this.mirror)&&this.iframeManager.addIframe(p),dc(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),$o(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(p,f)=>{this.iframeManager.attachIframe(p,f),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,f)=>{this.stylesheetManager.attachLinkElement(p,f)}});d&&(t.push({parentId:u,nextId:c,node:d}),n.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)Qs(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||o(l);for(const l of this.addedSet)!Js(this.droppedSet,l)&&!Qs(this.removes,l,this.mirror)||Js(this.movedSet,l)?o(l):this.droppedSet.add(l);let a=null;for(;r.length;){let l=null;if(a){const u=this.mirror.getId(a.value.parentNode),c=i(a.value);u!==-1&&c!==-1&&(l=a)}if(!l){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const d=this.mirror.getId(c.value.parentNode);if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{const f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=f.parentNode.host;if(this.mirror.getId(h)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),o(l.value)}const s={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:u}=l;if(typeof u.style=="string"){const c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=t=>{if(po(t.target,this.mirror))return;let n;try{n=document.implementation.createHTMLDocument()}catch{n=this.doc}switch(t.type){case"characterData":{const r=t.target.textContent;!Ne(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:oc(t.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let i=t.attributeName,o=t.target.getAttribute(i);if(i==="value"){const s=Ha(r);o=ja({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(Ne(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributes.find(s=>s.node===t.target);if(r.tagName==="IFRAME"&&i==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)i="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a)),i==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!ic(r.tagName,i)&&(a.attributes[i]=rc(this.doc,hn(r.tagName),hn(i),o),i==="style")){const s=n.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(const l of Array.from(r.style)){const u=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);u!==s.style.getPropertyValue(l)||c!==s.style.getPropertyPriority(l)?c===""?a.styleDiff[l]=u:a.styleDiff[l]=[u,c]:a._unchangedStyles[l]=[u,c]}for(const l of Array.from(s.style))r.style.getPropertyValue(l)===""&&(a.styleDiff[l]=!1)}break}case"childList":{if(Ne(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const i=this.mirror.getId(r),o=or(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Ne(t.target,this.blockClass,this.blockSelector,!1)||po(r,this.mirror)||!kh(r,this.mirror)||(this.addedSet.has(r)?(Yo(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&i===-1||uc(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Zs(i,o)]?Yo(this.movedSet,r):this.removes.push({parentId:o,id:i,isShadow:or(t.target)&&ar(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(po(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Zs(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ne(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(r=>this.genAdds(r)),$o(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Yo(e,t){e.delete(t),t.childNodes.forEach(n=>Yo(e,n))}function Qs(e,t,n){return e.length===0?!1:hc(e,t,n)}function hc(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return e.some(o=>o.id===i)?!0:hc(e,r,n)}function Js(e,t){return e.size===0?!1:mc(e,t)}function mc(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:mc(e,n):!1}let sr;function Nh(e){sr=e}function Dh(){sr=void 0}const q=e=>sr?(...n)=>{try{return e(...n)}catch(r){if(sr&&sr(r)===!0)return;throw r}}:e,sn=[];function Tr(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function gc(e,t){var n,r;const i=new Oh;sn.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const a=(r=(n=window==null?void 0:window.Zone)===null||n===void 0?void 0:n.__symbol__)===null||r===void 0?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);const s=new o(q(i.processMutations.bind(i)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Uh({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],s;const l=gr(q(d=>{const p=Date.now()-s;e(a.map(f=>(f.timeOffset-=p,f)),d),a=[],s=null}),o),u=q(gr(q(d=>{const p=Tr(d),{clientX:f,clientY:h}=qo(d)?d.changedTouches[0]:d;s||(s=wi()),a.push({x:f,y:h,id:r.getId(p),timeOffset:wi()-s}),l(typeof DragEvent<"u"&&d instanceof DragEvent?J.Drag:d instanceof MouseEvent?J.MouseMove:J.TouchMove)}),i,{trailing:!1})),c=[Oe("mousemove",u,n),Oe("touchmove",u,n),Oe("drag",u,n)];return q(()=>{c.forEach(d=>d())})}function Ph({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,s=[];let l=null;const u=c=>d=>{const p=Tr(d);if(Ne(p,r,i,!0))return;let f=null,h=c;if("pointerType"in d){switch(d.pointerType){case"mouse":f=bt.Mouse;break;case"touch":f=bt.Touch;break;case"pen":f=bt.Pen;break}f===bt.Touch?Me[c]===Me.MouseDown?h="TouchStart":Me[c]===Me.MouseUp&&(h="TouchEnd"):bt.Pen}else qo(d)&&(f=bt.Touch);f!==null?(l=f,(h.startsWith("Touch")&&f===bt.Touch||h.startsWith("Mouse")&&f===bt.Mouse)&&(f=null)):Me[c]===Me.Click&&(f=l,l=null);const m=qo(d)?d.changedTouches[0]:d;if(!m)return;const g=n.getId(p),{clientX:b,clientY:y}=m;q(e)(Object.assign({type:Me[h],id:g,x:b,y},f!==null&&{pointerType:f}))};return Object.keys(Me).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&a[c]!==!1).forEach(c=>{let d=hn(c);const p=u(c);if(window.PointerEvent)switch(Me[c]){case Me.MouseDown:case Me.MouseUp:d=d.replace("mouse","pointer");break;case Me.TouchStart:case Me.TouchEnd:return}s.push(Oe(d,p,t))}),q(()=>{s.forEach(c=>c())})}function vc({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const a=q(gr(q(s=>{const l=Tr(s);if(!l||Ne(l,r,i,!0))return;const u=n.getId(l);if(l===t&&t.defaultView){const c=ac(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Oe("scroll",a,t)}function Mh({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const i=q(gr(q(()=>{const o=sc(),a=lc();(n!==o||r!==a)&&(e({width:Number(a),height:Number(o)}),n=o,r=a)}),200));return Oe("resize",i,t)}function Xs(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Vh=["INPUT","TEXTAREA","SELECT"],el=new WeakMap;function Fh({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:s,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(y){let _=Tr(y);const v=y.isTrusted,w=_&&_.tagName;if(_&&w==="OPTION"&&(_=_.parentElement),!_||!w||Vh.indexOf(w)<0||Ne(_,r,i,!0)||_.classList.contains(o)||a&&_.matches(a))return;let E=_.value,I=!1;const S=Ha(_)||"";S==="radio"||S==="checkbox"?I=_.checked:(s[w.toLowerCase()]||s[S])&&(E=ja({element:_,maskInputOptions:s,tagName:w,type:S,value:E,maskInputFn:l})),p(_,q(Xs)({text:E,isChecked:I,userTriggered:v},c));const x=_.name;S==="radio"&&x&&I&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(T=>{T!==_&&p(T,q(Xs)({text:T.value,isChecked:!I,userTriggered:!1},c))})}function p(y,_){const v=el.get(y);if(!v||v.text!==_.text||v.isChecked!==_.isChecked){el.set(y,_);const w=n.getId(y);q(e)(Object.assign(Object.assign({},_),{id:w}))}}const h=(u.input==="last"?["change"]:["input","change"]).map(y=>Oe(y,q(d),t)),m=t.defaultView;if(!m)return()=>{h.forEach(y=>y())};const g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),b=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&h.push(...b.map(y=>Yi(y[0],y[1],{set(){q(d)({target:this,isTrusted:!1})}},!1,m))),q(()=>{h.forEach(y=>y())})}function Ci(e){const t=[];function n(r,i){if(Hr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Hr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Hr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Hr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return n(e,t)}function Ft(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Bh({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:q((c,d,p)=>{const[f,h]=p,{id:m,styleId:g}=Ft(d,t,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:f,index:h}]}),c.apply(d,p)})});const o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:q((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Ft(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:f}]}),c.apply(d,p)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:q((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Ft(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:f}),c.apply(d,p)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:q((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Ft(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:f}),c.apply(d,p)})}));const l={};zr("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(zr("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),zr("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),zr("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:q((p,f,h)=>{const[m,g]=h,{id:b,styleId:y}=Ft(f.parentStyleSheet,t,n.styleMirror);return(b&&b!==-1||y&&y!==-1)&&e({id:b,styleId:y,adds:[{rule:m,index:[...Ci(f),g||0]}]}),p.apply(f,h)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:q((p,f,h)=>{const[m]=h,{id:g,styleId:b}=Ft(f.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||b&&b!==-1)&&e({id:g,styleId:b,removes:[{index:[...Ci(f),m]}]}),p.apply(f,h)})})}),q(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function yc({mirror:e,stylesheetManager:t},n){var r,i,o;let a=null;n.nodeName==="#document"?a=e.getId(n):a=e.getId(n.host);const s=n.nodeName==="#document"?(r=n.defaultView)===null||r===void 0?void 0:r.Document:(o=(i=n.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,l=Object.getOwnPropertyDescriptor(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)===null||u===void 0?void 0:u.call(this)},set(u){var c;const d=(c=l.set)===null||c===void 0?void 0:c.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return d}}),q(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function jh({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:q((s,l,u)=>{var c;const[d,p,f]=u;if(n.has(d))return o.apply(l,[d,p,f]);const{id:h,styleId:m}=Ft((c=l.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,set:{property:d,value:p,priority:f},index:Ci(l.parentRule)}),s.apply(l,u)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:q((s,l,u)=>{var c;const[d]=u;if(n.has(d))return a.apply(l,[d]);const{id:p,styleId:f}=Ft((c=l.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,remove:{property:d},index:Ci(l.parentRule)}),s.apply(l,u)})}),q(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Hh({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const a=q(l=>gr(q(u=>{const c=Tr(u);if(!c||Ne(c,t,n,!0))return;const{currentTime:d,volume:p,muted:f,playbackRate:h}=c;e({type:l,id:r.getId(c),currentTime:d,volume:p,muted:f,playbackRate:h})}),i.media||500)),s=[Oe("play",a(0),o),Oe("pause",a(1),o),Oe("seeked",a(2),o),Oe("volumechange",a(3),o),Oe("ratechange",a(4),o)];return q(()=>{s.forEach(l=>l())})}function zh({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){const d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=Ar(t.fonts,"add",function(s){return function(l){return setTimeout(q(()=>{const u=i.get(l);u&&(e(u),i.delete(l))}),0),s.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(a),q(()=>{r.forEach(s=>s())})}function Gh(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=q(()=>{const l=t.getSelection();if(!l||a&&(l==null?void 0:l.isCollapsed))return;a=l.isCollapsed||!1;const u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){const p=l.getRangeAt(d),{startContainer:f,startOffset:h,endContainer:m,endOffset:g}=p;Ne(f,r,i,!0)||Ne(m,r,i,!0)||u.push({start:n.getId(f),startOffset:h,end:n.getId(m),endOffset:g})}o({ranges:u})});return s(),Oe("selectionchange",s)}function Kh(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:p,selectionCb:f}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),n(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),r(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),i(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),o(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),s(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),c(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),d(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),p(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),f(...h)}}function Wh(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};Kh(e,t);const r=gc(e,e.doc),i=Uh(e),o=Ph(e),a=vc(e),s=Mh(e,{win:n}),l=Fh(e),u=Hh(e),c=Bh(e,{win:n}),d=yc(e,e.doc),p=jh(e,{win:n}),f=e.collectFonts?zh(e):()=>{},h=Gh(e),m=[];for(const g of e.plugins)m.push(g.observer(g.callback,n,g.options));return q(()=>{sn.forEach(g=>g.reset()),r.disconnect(),i(),o(),a(),s(),l(),u(),c(),d(),p(),f(),h(),m.forEach(g=>g())})}function Hr(e){return typeof window[e]<"u"}function zr(e){return Boolean(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class tl{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,i){const o=r||this.getIdToRemoteIdMap(t),a=i||this.getRemoteIdToIdMap(t);let s=o.get(n);return s||(s=this.generateIdFn(),o.set(n,s),a.set(s,n)),s}getIds(t,n){const r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){const i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;const o=i.get(n);return o||-1}getRemoteIds(t,n){const r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}}class qh{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new tl(nc),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new tl(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(r=this.loadListener)===null||r===void 0||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case X.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);const i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:X.IncrementalSnapshot,data:{source:J.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case X.Meta:case X.Load:case X.DomContentLoaded:return!1;case X.Plugin:return n;case X.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case X.IncrementalSnapshot:switch(n.data.source){case J.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case J.Drag:case J.TouchMove:case J.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case J.ViewportResize:return!1;case J.MediaInteraction:case J.MouseInteraction:case J.Scroll:case J.CanvasMutation:case J.Input:return this.replaceIds(n.data,t,["id"]),n;case J.StyleSheetRule:case J.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case J.Font:return n;case J.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case J.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)===null||r===void 0||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}}replace(t,n,r,i){for(const o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==be.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class $h{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!ar(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const r=gc(Object.assign(Object.assign({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(vc(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(yc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(Ar(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o);return this.shadowRoot&&pc(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
5
+ or you can use record.mirror to access the mirror instance during recording.`;let Ks={map:{},getId(){return console.error(xn),-1},getNode(){return console.error(xn),null},removeNodeFromMap(){console.error(xn)},has(){return console.error(xn),!1},reset(){console.error(xn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ks=new Proxy(Ks,{get(e,t,n){return t==="map"&&console.error(xn),Reflect.get(e,t,n)}}));function vr(e,t,n={}){let r=null,i=0;return function(...o){const a=Date.now();!i&&n.leading===!1&&(i=a);const s=t-(a-i),l=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},s))}}function Zi(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(a){setTimeout(()=>{n.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>Zi(e,t,o||{},!0)}function Tr(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}let Ci=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ci=()=>new Date().getTime());function Ju(e){var t,n,r,i,o,a;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:(s==null?void 0:s.documentElement.scrollLeft)||((n=(t=s==null?void 0:s.body)===null||t===void 0?void 0:t.parentElement)===null||n===void 0?void 0:n.scrollLeft)||((r=s==null?void 0:s.body)===null||r===void 0?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(s==null?void 0:s.documentElement.scrollTop)||((o=(i=s==null?void 0:s.body)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.scrollTop)||((a=s==null?void 0:s.body)===null||a===void 0?void 0:a.scrollTop)||0}}function Xu(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ec(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ne(e,t,n,r){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(wi(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function wh(e,t){return t.getId(e)!==-1}function ho(e,t){return t.getId(e)===gr}function tc(e,t){if(ar(e))return!1;const n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?tc(e.parentNode,t):!0:!0}function Go(e){return Boolean(e.changedTouches)}function Ch(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function nc(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function rc(e,t){return Boolean(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ko(e){return Boolean(e==null?void 0:e.shadowRoot)}class Eh{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var n;return(n=this.styleIDMap.get(t))!==null&&n!==void 0?n:-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function ic(e){var t,n;let r=null;return((n=(t=e.getRootNode)===null||t===void 0?void 0:t.call(e))===null||n===void 0?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function Ih(e){let t=e,n;for(;n=ic(t);)t=n;return t}function Sh(e){const t=e.ownerDocument;if(!t)return!1;const n=Ih(e);return t.contains(n)}function oc(e){const t=e.ownerDocument;return t?t.contains(e)||Sh(e):!1}var X=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(X||{}),J=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(J||{}),Me=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Me||{}),bt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(bt||{}),Mn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Mn||{});function Ws(e){return"__ln"in e}class kh{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=(n==null?void 0:n.next)||null;return n}addNode(t){const n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&Ws(t.previousSibling)){const r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&Ws(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){const n=t.__ln;!this.head||(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const $s=(e,t)=>`${e}@${t}`;class xh{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],n=new Set,r=new kh,i=l=>{let u=l,c=gr;for(;c===gr;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=l=>{if(!l.parentNode||!oc(l))return;const u=ar(l.parentNode)?this.mirror.getId(ic(l)):this.mirror.getId(l.parentNode),c=i(l);if(u===-1||c===-1)return r.addNode(l);const d=Rn(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:p=>{nc(p,this.mirror)&&this.iframeManager.addIframe(p),rc(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),Ko(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(p,f)=>{this.iframeManager.attachIframe(p,f),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,f)=>{this.stylesheetManager.attachLinkElement(p,f)}});d&&(t.push({parentId:u,nextId:c,node:d}),n.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)qs(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||o(l);for(const l of this.addedSet)!Ys(this.droppedSet,l)&&!qs(this.removes,l,this.mirror)||Ys(this.movedSet,l)?o(l):this.droppedSet.add(l);let a=null;for(;r.length;){let l=null;if(a){const u=this.mirror.getId(a.value.parentNode),c=i(a.value);u!==-1&&c!==-1&&(l=a)}if(!l){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const d=this.mirror.getId(c.value.parentNode);if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{const f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=f.parentNode.host;if(this.mirror.getId(h)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),o(l.value)}const s={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:u}=l;if(typeof u.style=="string"){const c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=t=>{if(ho(t.target,this.mirror))return;let n;try{n=document.implementation.createHTMLDocument()}catch{n=this.doc}switch(t.type){case"characterData":{const r=t.target.textContent;!Ne(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Qu(t.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let i=t.attributeName,o=t.target.getAttribute(i);if(i==="value"){const s=Va(r);o=Fa({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(Ne(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributes.find(s=>s.node===t.target);if(r.tagName==="IFRAME"&&i==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)i="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a)),i==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Zu(r.tagName,i)&&(a.attributes[i]=Yu(this.doc,hn(r.tagName),hn(i),o),i==="style")){const s=n.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(const l of Array.from(r.style)){const u=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);u!==s.style.getPropertyValue(l)||c!==s.style.getPropertyPriority(l)?c===""?a.styleDiff[l]=u:a.styleDiff[l]=[u,c]:a._unchangedStyles[l]=[u,c]}for(const l of Array.from(s.style))r.style.getPropertyValue(l)===""&&(a.styleDiff[l]=!1)}break}case"childList":{if(Ne(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const i=this.mirror.getId(r),o=ar(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Ne(t.target,this.blockClass,this.blockSelector,!1)||ho(r,this.mirror)||!wh(r,this.mirror)||(this.addedSet.has(r)?(Wo(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&i===-1||tc(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[$s(i,o)]?Wo(this.movedSet,r):this.removes.push({parentId:o,id:i,isShadow:ar(t.target)&&sr(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(ho(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[$s(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ne(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(r=>this.genAdds(r)),Ko(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Wo(e,t){e.delete(t),t.childNodes.forEach(n=>Wo(e,n))}function qs(e,t,n){return e.length===0?!1:ac(e,t,n)}function ac(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return e.some(o=>o.id===i)?!0:ac(e,r,n)}function Ys(e,t){return e.size===0?!1:sc(e,t)}function sc(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:sc(e,n):!1}let lr;function Ah(e){lr=e}function Th(){lr=void 0}const W=e=>lr?(...n)=>{try{return e(...n)}catch(r){if(lr&&lr(r)===!0)return;throw r}}:e,sn=[];function Rr(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function lc(e,t){var n,r;const i=new xh;sn.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const a=(r=(n=window==null?void 0:window.Zone)===null||n===void 0?void 0:n.__symbol__)===null||r===void 0?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);const s=new o(W(i.processMutations.bind(i)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Rh({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],s;const l=vr(W(d=>{const p=Date.now()-s;e(a.map(f=>(f.timeOffset-=p,f)),d),a=[],s=null}),o),u=W(vr(W(d=>{const p=Rr(d),{clientX:f,clientY:h}=Go(d)?d.changedTouches[0]:d;s||(s=Ci()),a.push({x:f,y:h,id:r.getId(p),timeOffset:Ci()-s}),l(typeof DragEvent<"u"&&d instanceof DragEvent?J.Drag:d instanceof MouseEvent?J.MouseMove:J.TouchMove)}),i,{trailing:!1})),c=[Oe("mousemove",u,n),Oe("touchmove",u,n),Oe("drag",u,n)];return W(()=>{c.forEach(d=>d())})}function Lh({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,s=[];let l=null;const u=c=>d=>{const p=Rr(d);if(Ne(p,r,i,!0))return;let f=null,h=c;if("pointerType"in d){switch(d.pointerType){case"mouse":f=bt.Mouse;break;case"touch":f=bt.Touch;break;case"pen":f=bt.Pen;break}f===bt.Touch?Me[c]===Me.MouseDown?h="TouchStart":Me[c]===Me.MouseUp&&(h="TouchEnd"):bt.Pen}else Go(d)&&(f=bt.Touch);f!==null?(l=f,(h.startsWith("Touch")&&f===bt.Touch||h.startsWith("Mouse")&&f===bt.Mouse)&&(f=null)):Me[c]===Me.Click&&(f=l,l=null);const m=Go(d)?d.changedTouches[0]:d;if(!m)return;const g=n.getId(p),{clientX:b,clientY:v}=m;W(e)(Object.assign({type:Me[h],id:g,x:b,y:v},f!==null&&{pointerType:f}))};return Object.keys(Me).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&a[c]!==!1).forEach(c=>{let d=hn(c);const p=u(c);if(window.PointerEvent)switch(Me[c]){case Me.MouseDown:case Me.MouseUp:d=d.replace("mouse","pointer");break;case Me.TouchStart:case Me.TouchEnd:return}s.push(Oe(d,p,t))}),W(()=>{s.forEach(c=>c())})}function uc({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const a=W(vr(W(s=>{const l=Rr(s);if(!l||Ne(l,r,i,!0))return;const u=n.getId(l);if(l===t&&t.defaultView){const c=Ju(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Oe("scroll",a,t)}function Oh({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const i=W(vr(W(()=>{const o=Xu(),a=ec();(n!==o||r!==a)&&(e({width:Number(a),height:Number(o)}),n=o,r=a)}),200));return Oe("resize",i,t)}function Zs(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Nh=["INPUT","TEXTAREA","SELECT"],Qs=new WeakMap;function Dh({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:s,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(v){let _=Rr(v);const y=v.isTrusted,C=_&&_.tagName;if(_&&C==="OPTION"&&(_=_.parentElement),!_||!C||Nh.indexOf(C)<0||Ne(_,r,i,!0)||_.classList.contains(o)||a&&_.matches(a))return;let E=_.value,S=!1;const I=Va(_)||"";I==="radio"||I==="checkbox"?S=_.checked:(s[C.toLowerCase()]||s[I])&&(E=Fa({element:_,maskInputOptions:s,tagName:C,type:I,value:E,maskInputFn:l})),p(_,W(Zs)({text:E,isChecked:S,userTriggered:y},c));const x=_.name;I==="radio"&&x&&S&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(R=>{R!==_&&p(R,W(Zs)({text:R.value,isChecked:!S,userTriggered:!1},c))})}function p(v,_){const y=Qs.get(v);if(!y||y.text!==_.text||y.isChecked!==_.isChecked){Qs.set(v,_);const C=n.getId(v);W(e)(Object.assign(Object.assign({},_),{id:C}))}}const h=(u.input==="last"?["change"]:["input","change"]).map(v=>Oe(v,W(d),t)),m=t.defaultView;if(!m)return()=>{h.forEach(v=>v())};const g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),b=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&h.push(...b.map(v=>Zi(v[0],v[1],{set(){W(d)({target:this,isTrusted:!1})}},!1,m))),W(()=>{h.forEach(v=>v())})}function Ei(e){const t=[];function n(r,i){if(zr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||zr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||zr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||zr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return n(e,t)}function Vt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Uh({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:W((c,d,p)=>{const[f,h]=p,{id:m,styleId:g}=Vt(d,t,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:f,index:h}]}),c.apply(d,p)})});const o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:W((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Vt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:f}]}),c.apply(d,p)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:W((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Vt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:f}),c.apply(d,p)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:W((c,d,p)=>{const[f]=p,{id:h,styleId:m}=Vt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:f}),c.apply(d,p)})}));const l={};Gr("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Gr("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Gr("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Gr("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:W((p,f,h)=>{const[m,g]=h,{id:b,styleId:v}=Vt(f.parentStyleSheet,t,n.styleMirror);return(b&&b!==-1||v&&v!==-1)&&e({id:b,styleId:v,adds:[{rule:m,index:[...Ei(f),g||0]}]}),p.apply(f,h)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:W((p,f,h)=>{const[m]=h,{id:g,styleId:b}=Vt(f.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||b&&b!==-1)&&e({id:g,styleId:b,removes:[{index:[...Ei(f),m]}]}),p.apply(f,h)})})}),W(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function cc({mirror:e,stylesheetManager:t},n){var r,i,o;let a=null;n.nodeName==="#document"?a=e.getId(n):a=e.getId(n.host);const s=n.nodeName==="#document"?(r=n.defaultView)===null||r===void 0?void 0:r.Document:(o=(i=n.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,l=Object.getOwnPropertyDescriptor(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)===null||u===void 0?void 0:u.call(this)},set(u){var c;const d=(c=l.set)===null||c===void 0?void 0:c.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return d}}),W(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function Ph({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:W((s,l,u)=>{var c;const[d,p,f]=u;if(n.has(d))return o.apply(l,[d,p,f]);const{id:h,styleId:m}=Vt((c=l.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,set:{property:d,value:p,priority:f},index:Ei(l.parentRule)}),s.apply(l,u)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:W((s,l,u)=>{var c;const[d]=u;if(n.has(d))return a.apply(l,[d]);const{id:p,styleId:f}=Vt((c=l.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,remove:{property:d},index:Ei(l.parentRule)}),s.apply(l,u)})}),W(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Mh({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const a=W(l=>vr(W(u=>{const c=Rr(u);if(!c||Ne(c,t,n,!0))return;const{currentTime:d,volume:p,muted:f,playbackRate:h}=c;e({type:l,id:r.getId(c),currentTime:d,volume:p,muted:f,playbackRate:h})}),i.media||500)),s=[Oe("play",a(0),o),Oe("pause",a(1),o),Oe("seeked",a(2),o),Oe("volumechange",a(3),o),Oe("ratechange",a(4),o)];return W(()=>{s.forEach(l=>l())})}function Fh({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){const d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=Tr(t.fonts,"add",function(s){return function(l){return setTimeout(W(()=>{const u=i.get(l);u&&(e(u),i.delete(l))}),0),s.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(a),W(()=>{r.forEach(s=>s())})}function Vh(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=W(()=>{const l=t.getSelection();if(!l||a&&(l==null?void 0:l.isCollapsed))return;a=l.isCollapsed||!1;const u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){const p=l.getRangeAt(d),{startContainer:f,startOffset:h,endContainer:m,endOffset:g}=p;Ne(f,r,i,!0)||Ne(m,r,i,!0)||u.push({start:n.getId(f),startOffset:h,end:n.getId(m),endOffset:g})}o({ranges:u})});return s(),Oe("selectionchange",s)}function Bh(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:p,selectionCb:f}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),n(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),r(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),i(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),o(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),s(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),c(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),d(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),p(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),f(...h)}}function jh(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};Bh(e,t);const r=lc(e,e.doc),i=Rh(e),o=Lh(e),a=uc(e),s=Oh(e,{win:n}),l=Dh(e),u=Mh(e),c=Uh(e,{win:n}),d=cc(e,e.doc),p=Ph(e,{win:n}),f=e.collectFonts?Fh(e):()=>{},h=Vh(e),m=[];for(const g of e.plugins)m.push(g.observer(g.callback,n,g.options));return W(()=>{sn.forEach(g=>g.reset()),r.disconnect(),i(),o(),a(),s(),l(),u(),c(),d(),p(),f(),h(),m.forEach(g=>g())})}function zr(e){return typeof window[e]<"u"}function Gr(e){return Boolean(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Js{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,i){const o=r||this.getIdToRemoteIdMap(t),a=i||this.getRemoteIdToIdMap(t);let s=o.get(n);return s||(s=this.generateIdFn(),o.set(n,s),a.set(s,n)),s}getIds(t,n){const r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){const i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;const o=i.get(n);return o||-1}getRemoteIds(t,n){const r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}}class Hh{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Js(qu),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Js(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(r=this.loadListener)===null||r===void 0||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case X.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);const i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:X.IncrementalSnapshot,data:{source:J.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case X.Meta:case X.Load:case X.DomContentLoaded:return!1;case X.Plugin:return n;case X.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case X.IncrementalSnapshot:switch(n.data.source){case J.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case J.Drag:case J.TouchMove:case J.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case J.ViewportResize:return!1;case J.MediaInteraction:case J.MouseInteraction:case J.Scroll:case J.CanvasMutation:case J.Input:return this.replaceIds(n.data,t,["id"]),n;case J.StyleSheetRule:case J.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case J.Font:return n;case J.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case J.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)===null||r===void 0||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}}replace(t,n,r,i){for(const o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==be.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class zh{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!sr(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const r=lc(Object.assign(Object.assign({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(uc(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(cc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(Tr(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o);return this.shadowRoot&&oc(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
7
7
 
8
8
  Permission to use, copy, modify, and/or distribute this software for any
@@ -15,9 +15,9 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
15
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
16
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
17
  PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */function Yh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Zh(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})}var Ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Gr=0;Gr<Ln.length;Gr++)Qh[Ln.charCodeAt(Gr)]=Gr;var Jh=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=Ln[t[n]>>2],i+=Ln[(t[n]&3)<<4|t[n+1]>>4],i+=Ln[(t[n+1]&15)<<2|t[n+2]>>6],i+=Ln[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const nl=new Map;function Xh(e,t){let n=nl.get(e);return n||(n=new Map,nl.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const _c=(e,t,n)=>{if(!e||!(wc(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=Xh(n,r);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function ti(e,t,n){if(e instanceof Array)return e.map(r=>ti(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,i=Jh(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ti(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ti(e.data,t,n),e.width,e.height]};if(wc(e,t)||typeof e=="object"){const r=e.constructor.name,i=_c(e,t,n);return{rr_type:r,index:i}}}}return e}const bc=(e,t,n)=>[...e].map(r=>ti(r,t,n)),wc=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function");return Boolean(r.find(i=>e instanceof t[i]))};function em(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const s=Ar(t.CanvasRenderingContext2D.prototype,a,function(l){return function(...u){return Ne(this.canvas,n,r,!0)||setTimeout(()=>{const c=bc([...u],t,this);e(this.canvas,{type:Mn["2D"],property:a,args:c})},0),l.apply(this,u)}});i.push(s)}catch{const l=Yi(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:Mn["2D"],property:a,args:[u],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function tm(e){return e==="experimental-webgl"?"webgl":e}function rl(e,t,n,r){const i=[];try{const o=Ar(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(s,...l){if(!Ne(this,t,n,!0)){const u=tm(s);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(l[0]&&typeof l[0]=="object"){const c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[s,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function il(e,t,n,r,i,o,a){const s=[],l=Object.getOwnPropertyNames(e);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const c=Ar(e,u,function(d){return function(...p){const f=d.apply(this,p);if(_c(f,a,this),"tagName"in this.canvas&&!Ne(this.canvas,r,i,!0)){const h=bc([...p],a,this),m={type:t,property:u,args:h};n(this.canvas,m)}return f}});s.push(c)}catch{const d=Yi(e,u,{set(p){n(this.canvas,{type:t,property:u,args:[p],setter:!0})}});s.push(d)}return s}function nm(e,t,n,r,i){const o=[];return o.push(...il(t.WebGLRenderingContext.prototype,Mn.WebGL,e,n,r,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...il(t.WebGL2RenderingContext.prototype,Mn.WebGL2,e,n,r,i,t)),()=>{o.forEach(a=>a())}}function rm(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function im(e,t,n){var r=t===void 0?null:t,i=n===void 0?!1:n,o=rm(e,i),a=o.indexOf(`
19
- `,10)+1,s=o.substring(a)+(r?"//# sourceMappingURL="+r:""),l=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(l)}function om(e,t,n){var r;return function(o){return r=r||im(e,t,n),new Worker(r,o)}}var am=om("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);class sm{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)};const{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:s}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&n==="all"&&this.initCanvasMutationObserver(r,i,o),a&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:s})}initCanvasFPSObserver(t,n,r,i,o){const a=rl(n,r,i,!0),s=new Map,l=new am;l.onmessage=h=>{const{id:m}=h.data;if(s.set(m,!1),!("base64"in h.data))return;const{base64:g,type:b,width:y,height:_}=h.data;this.mutationCb({id:m,type:Mn["2D"],commands:[{property:"clearRect",args:[0,0,y,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:b}]},0,0]}]})};const u=1e3/t;let c=0,d;const p=()=>{const h=[];return n.document.querySelectorAll("canvas").forEach(m=>{Ne(m,r,i,!0)||h.push(m)}),h},f=h=>{if(c&&h-c<u){d=requestAnimationFrame(f);return}c=h,p().forEach(m=>Zh(this,void 0,void 0,function*(){var g;const b=this.mirror.getId(m);if(s.get(b))return;if(s.set(b,!0),["webgl","webgl2"].includes(m.__context)){const _=m.getContext(m.__context);((g=_==null?void 0:_.getContextAttributes())===null||g===void 0?void 0:g.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const y=yield createImageBitmap(m);l.postMessage({id:b,bitmap:y,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[y])})),d=requestAnimationFrame(f)};d=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=rl(t,n,r,!1),o=em(this.processMutation.bind(this),t,n,r),a=nm(this.processMutation.bind(this),t,n,r,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;const i=r.map(a=>Yh(a,["type"])),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class lm{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ah,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;const r={id:n,styleIds:[]},i=[];for(const o of t){let a;if(this.styleMirror.has(o))a=this.styleMirror.getId(o);else{a=this.styleMirror.add(o);const s=Array.from(o.rules||CSSRule);i.push({styleId:a,rules:s.map((l,u)=>({rule:ec(l),index:u}))})}r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class um{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,n){const r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function ye(e){return Object.assign(Object.assign({},e),{timestamp:wi()})}let pe,ni,ho,Ei=!1;const et=rh();function Rr(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:s=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:h,maskTextFn:m,hooks:g,packFn:b,sampling:y={},dataURLOptions:_={},mousemoveWait:v,recordCanvas:w=!1,recordCrossOriginIframes:E=!1,recordAfter:I=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:S=!1,collectFonts:x=!1,inlineImages:T=!1,plugins:A,keepIframeSrcFn:L=()=>!1,ignoreCSSAttributes:k=new Set([]),errorHandler:U}=e;Nh(U);const R=E?window.parent===window:!0;let V=!1;if(!R)try{window.parent.document&&(V=!1)}catch{V=!0}if(R&&!t)throw new Error("emit function is required");v!==void 0&&y.mousemove===void 0&&(y.mousemove=v),et.reset();const K=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},z=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};xh();let ie,oe=0;const fe=j=>{for(const Pe of A||[])Pe.eventProcessor&&(j=Pe.eventProcessor(j));return b&&!V&&(j=b(j)),j};pe=(j,Pe)=>{var ee;if(((ee=sn[0])===null||ee===void 0?void 0:ee.isFrozen())&&j.type!==X.FullSnapshot&&!(j.type===X.IncrementalSnapshot&&j.data.source===J.Mutation)&&sn.forEach(Ce=>Ce.unfreeze()),R)t==null||t(fe(j),Pe);else if(V){const Ce={type:"rrweb",event:fe(j),origin:window.location.origin,isCheckout:Pe};window.parent.postMessage(Ce,"*")}if(j.type===X.FullSnapshot)ie=j,oe=0;else if(j.type===X.IncrementalSnapshot){if(j.data.source===J.Mutation&&j.data.isAttachIframe)return;oe++;const Ce=r&&oe>=r,en=n&&j.timestamp-ie.timestamp>n;(Ce||en)&&ni(!0)}};const Q=j=>{pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Mutation},j)}))},Ke=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Scroll},j)})),Ie=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.CanvasMutation},j)})),yt=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.AdoptedStyleSheet},j)})),Fe=new lm({mutationCb:Q,adoptedStyleSheetCb:yt}),st=new qh({mirror:et,mutationCb:Q,stylesheetManager:Fe,recordCrossOriginIframes:E,wrappedEmit:pe});for(const j of A||[])j.getMirror&&j.getMirror({nodeMirror:et,crossOriginIframeMirror:st.crossOriginIframeMirror,crossOriginIframeStyleMirror:st.crossOriginIframeStyleMirror});const Xt=new um;ho=new sm({recordCanvas:w,mutationCb:Ie,win:window,blockClass:i,blockSelector:o,mirror:et,sampling:y.canvas,dataURLOptions:_});const Xe=new $h({mutationCb:Q,scrollCb:Ke,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:K,dataURLOptions:_,maskTextFn:m,maskInputFn:h,recordCanvas:w,inlineImages:T,sampling:y,slimDOMOptions:z,iframeManager:st,stylesheetManager:Fe,canvasManager:ho,keepIframeSrcFn:L,processedNodeManager:Xt},mirror:et});ni=(j=!1)=>{pe(ye({type:X.Meta,data:{href:window.location.href,width:lc(),height:sc()}}),j),Fe.reset(),Xe.init(),sn.forEach(ee=>ee.lock());const Pe=Ih(document,{mirror:et,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:K,maskTextFn:m,slimDOM:z,dataURLOptions:_,recordCanvas:w,inlineImages:T,onSerialize:ee=>{cc(ee,et)&&st.addIframe(ee),dc(ee,et)&&Fe.trackLinkElement(ee),$o(ee)&&Xe.addShadowRoot(ee.shadowRoot,document)},onIframeLoad:(ee,Ce)=>{st.attachIframe(ee,Ce),Xe.observeAttachShadow(ee)},onStylesheetLoad:(ee,Ce)=>{Fe.attachLinkElement(ee,Ce)},keepIframeSrcFn:L});if(!Pe)return console.warn("Failed to snapshot the document");pe(ye({type:X.FullSnapshot,data:{node:Pe,initialOffset:ac(window)}}),j),sn.forEach(ee=>ee.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Fe.adoptStyleSheets(document.adoptedStyleSheets,et.getId(document))};try{const j=[],Pe=Ce=>{var en;return q(Wh)({mutationCb:Q,mousemoveCb:(de,so)=>pe(ye({type:X.IncrementalSnapshot,data:{source:so,positions:de}})),mouseInteractionCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.MouseInteraction},de)})),scrollCb:Ke,viewportResizeCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.ViewportResize},de)})),inputCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Input},de)})),mediaInteractionCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.MediaInteraction},de)})),styleSheetRuleCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleSheetRule},de)})),styleDeclarationCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleDeclaration},de)})),canvasMutationCb:Ie,fontCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Font},de)})),selectionCb:de=>{pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Selection},de)}))},blockClass:i,ignoreClass:a,ignoreSelector:s,maskTextClass:l,maskTextSelector:u,maskInputOptions:K,inlineStylesheet:c,sampling:y,recordCanvas:w,inlineImages:T,userTriggeredOnInput:S,collectFonts:x,doc:Ce,maskInputFn:h,maskTextFn:m,keepIframeSrcFn:L,blockSelector:o,slimDOMOptions:z,dataURLOptions:_,mirror:et,iframeManager:st,stylesheetManager:Fe,shadowDomManager:Xe,processedNodeManager:Xt,canvasManager:ho,ignoreCSSAttributes:k,plugins:((en=A==null?void 0:A.filter(de=>de.observer))===null||en===void 0?void 0:en.map(de=>({observer:de.observer,options:de.options,callback:so=>pe(ye({type:X.Plugin,data:{plugin:de.name,payload:so}}))})))||[]},g)};st.addLoadListener(Ce=>{try{j.push(Pe(Ce.contentDocument))}catch(en){console.warn(en)}});const ee=()=>{ni(),j.push(Pe(document)),Ei=!0};return document.readyState==="interactive"||document.readyState==="complete"?ee():(j.push(Oe("DOMContentLoaded",()=>{pe(ye({type:X.DomContentLoaded,data:{}})),I==="DOMContentLoaded"&&ee()})),j.push(Oe("load",()=>{pe(ye({type:X.Load,data:{}})),I==="load"&&ee()},window))),()=>{j.forEach(Ce=>Ce()),Xt.destroy(),Ei=!1,Dh()}}catch(j){console.warn(j)}}Rr.addCustomEvent=(e,t)=>{if(!Ei)throw new Error("please add custom event after start recording");pe(ye({type:X.Custom,data:{tag:e,payload:t}}))};Rr.freezePage=()=>{sn.forEach(e=>e.freeze())};Rr.takeFullSnapshot=e=>{if(!Ei)throw new Error("please take full snapshot after start recording");ni(e)};Rr.mirror=et;var dt=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(dt||{}),G=(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.QuestionAnswered="question.answered",e))(G||{}),Cc=(e=>(e.SurveyId="survey.id",e))(Cc||{});const Ga={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",QUESTION_ANSWERED:"question.answered",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 Qe=(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))(Qe||{}),ln=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(ln||{}),le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dm(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 i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Se={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});var Ka=function(){function e(){}return e.prototype.handleError=function(t){},e}();_n.NoopErrorHandler=Ka;var Wa=new Ka;function fm(e){Wa=e}_n.setErrorHandler=fm;function pm(){return Wa}_n.getErrorHandler=pm;function hm(){Wa=new Ka}_n.resetErrorHandler=hm;var qa={};(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={}))})(qa);var Zt={},Wn={},Si={exports:{}},ol=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ol){var al=new Uint8Array(16);Si.exports=function(){return ol(al),al}}else{var sl=new Array(16);Si.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),sl[t]=n>>>((t&3)<<3)&255;return sl}}var Ec=[];for(var Kr=0;Kr<256;++Kr)Ec[Kr]=(Kr+256).toString(16).substr(1);function mm(e,t){var n=t||0,r=Ec;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 Sc=mm,gm=Si.exports,vm=Sc,ll,mo,go=0,vo=0;function ym(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ll,a=e.clockseq!==void 0?e.clockseq:mo;if(o==null||a==null){var s=gm();o==null&&(o=ll=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=mo=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:vo+1,c=l-go+(u-vo)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>go)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");go=l,vo=u,mo=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=l/4294967296*1e4&268435455;i[r++]=p>>>8&255,i[r++]=p&255,i[r++]=p>>>24&15|16,i[r++]=p>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var f=0;f<6;++f)i[r+f]=o[f];return t||vm(i)}var _m=ym,bm=Si.exports,wm=Sc;function Cm(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||bm)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||wm(i)}var Em=Cm,Sm=_m,Ic=Em,$a=Ic;$a.v1=Sm;$a.v4=Ic;var Im=$a;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Im;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,p){for(var f=!1,h=Object.keys(d),m=0;m<h.length;m++)if(p===d[h[m]]){f=!0;break}return f}e.isValidEnum=i;function o(d,p){var f={};return d.forEach(function(h){var m=p(h);f[m]=f[m]||[],f[m].push(h)}),a(f)}e.groupBy=o;function a(d){return Object.keys(d).map(function(p){return d[p]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(p){return[p,d[p]]})}e.objectEntries=s;function l(d,p){for(var f,h=0,m=d;h<m.length;h++){var g=m[h];if(p(g)){f=g;break}}return f}e.find=l;function u(d,p){var f={};return d.forEach(function(h){var m=p(h);f[m]=h}),f}e.keyBy=u;function c(d){for(var p=[],f=1;f<arguments.length;f++)p[f-1]=arguments[f];var h=0;return d.replace(/%s/g,function(){var m=p[h++],g=typeof m;return g==="function"?m():g==="string"?m:String(m)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(Wn);var km=le&&le.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(Zt,"__esModule",{value:!0});var xm=_n,Ii=Wn,ge=qa,ul={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function Ya(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!ul[e])?e:ul[e]}var kc=function(){function e(){this.defaultLoggerFacade=new cl,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new cl({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),Am=function(){function e(t){t===void 0&&(t={}),this.logLevel=ge.LogLevel.NOTSET,t.logLevel!==void 0&&Ii.isValidEnum(ge.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=Ya(t),!Ii.isValidEnum(ge.LogLevel,t)||t===void 0?this.logLevel=ge.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 ge.LogLevel.DEBUG:return"DEBUG";case ge.LogLevel.INFO:return"INFO ";case ge.LogLevel.WARNING:return"WARN ";case ge.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case ge.LogLevel.DEBUG:console.log.apply(console,n);break;case ge.LogLevel.INFO:console.info.apply(console,n);break;case ge.LogLevel.WARNING:console.warn.apply(console,n);break;case ge.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();Zt.ConsoleLogHandler=Am;var vr=ge.LogLevel.NOTSET,Zo=null,cl=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=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(Ya(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(ge.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(ge.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(ge.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(ge.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+Ii.sprintf.apply(void 0,km([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Zo||t<vr||(Zo.log(t,this.format(n)),n.error&&n.error instanceof Error&&xm.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var i;if(n instanceof Error){i=n,n=i.message,this.internalLog(t,{error:i,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var o=r[r.length-1];o instanceof Error&&(i=o,r.splice(-1)),this.internalLog(t,{message:n,error:i,splat:r})},e}(),xc=new kc;function Tm(e){return xc.getLogger(e)}Zt.getLogger=Tm;function Rm(e){Zo=e}Zt.setLogHandler=Rm;function Lm(e){e=Ya(e),!Ii.isValidEnum(ge.LogLevel,e)||e===void 0?vr=ge.LogLevel.ERROR:vr=e}Zt.setLogLevel=Lm;function Om(){return vr}Zt.getLogLevel=Om;function Nm(){xc=new kc,vr=ge.LogLevel.NOTSET}Zt.resetLogger=Nm;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(_n),t(qa),t(Zt)})(Se);var Dm={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.areEventContextsEqual=void 0;function Um(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}Lr.areEventContextsEqual=Um;var Za={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.DefaultEventQueue=Vn.SingleEventQueue=void 0;var Pm=Se,Mm=Pm.getLogger("EventProcessor"),Vm=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}(),Fm=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}();Vn.SingleEventQueue=Fm;var Bm=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,i=t.sink,o=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.batchComparator=o,this.timer=new Vm({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){Mm.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}();Vn.DefaultEventQueue=Bm;(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=Vn,n=Se,r=Wn;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,d,p){var f;return u>1?f=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:p}):f=new t.SingleEventQueue({sink:d}),f}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(Za);var Ac={};Object.defineProperty(Ac,"__esModule",{value:!0});var Tc={};Object.defineProperty(Tc,"__esModule",{value:!0});var Fn={},Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.LocalStorageStore=void 0;var jm=Wn,Hm=Se,dl=Hm.getLogger("EventProcessor"),zm=function(){function e(t){var n=t.key,r=t.maxValues,i=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=i}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 jm.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){dl.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var i=n.map(function(a){return{key:a,value:t[a]}});i.sort(function(a,s){return a.value.timestamp-s.value.timestamp});for(var o=0;o<r;o++)delete t[i[o].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){dl.error(n)}return{}},e}();Zi.LocalStorageStore=zm;var Gm=le&&le.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},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(Fn,"__esModule",{value:!0});Fn.LocalStoragePendingEventsDispatcher=Fn.PendingEventsDispatcher=void 0;var Km=Se,Wm=Zi,fl=Wn,qm=Km.getLogger("EventProcessor"),Rc=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:fl.generateUUID(),timestamp:fl.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();qm.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(i){r.store.remove(t.uuid),n(i)})},e}();Fn.PendingEventsDispatcher=Rc;var $m=function(e){Gm(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new Wm.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Rc);Fn.LocalStoragePendingEventsDispatcher=$m;var rt={},Qo=le&&le.__assign||function(){return Qo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Qo.apply(this,arguments)};Object.defineProperty(rt,"__esModule",{value:!0});rt.formatEvents=rt.buildConversionEventV1=rt.buildImpressionEventV1=rt.makeBatchedEventV1=void 0;var Ym="campaign_activated",Zm="custom",pl="$opt_bot_filtering";function Lc(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=Qa(r);r.type==="impression"?i.snapshots.push(Nc(r)):r.type==="conversion"&&i.snapshots.push(Oc(r)),t.push(i)}}),{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}}rt.makeBatchedEventV1=Lc;function Oc(e){var t=Qo({},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 Nc(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",p=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",f=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:p,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:f,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:Ym,uuid:e.uuid}]}}function Qa(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:pl,key:pl,type:Zm,value:e.context.botFiltering}),t}function Qm(e){var t=Qa(e);return t.snapshots.push(Nc(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]}}rt.buildImpressionEventV1=Qm;function Jm(e){var t=Qa(e);return t.snapshots.push(Oc(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]}}rt.buildConversionEventV1=Jm;function Xm(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Lc(e)}}rt.formatEvents=Xm;var Qi={},Ja={};Object.defineProperty(Ja,"__esModule",{value:!0});var eg=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(i){return i()}),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}();Ja.default=eg;var tg=le&&le.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},ng=le&&le.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(c){u=[6,c],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},rg=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qi,"__esModule",{value:!0});Qi.LogTierV1EventProcessor=void 0;var ig=Se,Sn=Za,og=rg(Ja),ag=Lr,sg=rt,hl=ig.getLogger("LogTierV1EventProcessor"),lg=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?Sn.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?Sn.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new og.default,i=Sn.validateAndGetFlushInterval(i),a=Sn.validateAndGetBatchSize(a),this.queue=Sn.getQueue(a,i,this.drainQueue.bind(this),ag.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(hl.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=sg.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),Sn.sendEventNotification(n.notificationCenter,o)});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){hl.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return tg(this,void 0,void 0,function(){return ng(this,function(t){return this.queue.start(),[2]})})},e}();Qi.LogTierV1EventProcessor=lg;(function(e){var t=le&&le.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o),Object.defineProperty(r,a,{enumerable:!0,get:function(){return i[o]}})}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=le&&le.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Lr,e),n(Za,e),n(Ac,e),n(Tc,e),n(Fn,e),n(rt,e),n(Qi,e)})(Dm);var ki={exports:{}},ml=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ml){var gl=new Uint8Array(16);ki.exports=function(){return ml(gl),gl}}else{var vl=new Array(16);ki.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),vl[t]=n>>>((t&3)<<3)&255;return vl}}var Dc=[];for(var Wr=0;Wr<256;++Wr)Dc[Wr]=(Wr+256).toString(16).substr(1);function ug(e,t){var n=t||0,r=Dc;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 Uc=ug,cg=ki.exports,dg=Uc,yl,yo,_o=0,bo=0;function fg(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||yl,a=e.clockseq!==void 0?e.clockseq:yo;if(o==null||a==null){var s=cg();o==null&&(o=yl=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=yo=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:bo+1,c=l-_o+(u-bo)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>_o)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_o=l,bo=u,yo=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=l/4294967296*1e4&268435455;i[r++]=p>>>8&255,i[r++]=p&255,i[r++]=p>>>24&15|16,i[r++]=p>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var f=0;f<6;++f)i[r+f]=o[f];return t||dg(i)}var pg=fg,hg=ki.exports,mg=Uc;function gg(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||hg)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||mg(i)}var vg=gg,yg=pg,Pc=vg,Mc=Pc;Mc.v1=yg;Mc.v4=Pc;var _g={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,d,p,f;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,f=0;f<s;)p=i.charCodeAt(f)&255|(i.charCodeAt(++f)&255)<<8|(i.charCodeAt(++f)&255)<<16|(i.charCodeAt(++f)&255)<<24,++f,p=(p&65535)*c+(((p>>>16)*c&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,l^=p,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(p=0,a){case 3:p^=(i.charCodeAt(f+2)&255)<<16;case 2:p^=(i.charCodeAt(f+1)&255)<<8;case 1:p^=i.charCodeAt(f)&255,p=(p&65535)*c+(((p>>>16)*c&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,l^=p}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(_g);var Vc={},Xa={},es={},ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.DEFAULT_UPDATE_INTERVAL=5*60*1e3;ht.MIN_UPDATE_INTERVAL=1e3;ht.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";ht.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";ht.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];ht.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(es,"__esModule",{value:!0});var bg=ht,wg=Se,Cg=wg.getLogger("DatafileManager"),Eg="GET",Sg=4;function Ig(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
20
- `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function kg(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function xg(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Eg,e,!0),kg(t,n),n.onreadystatechange=function(){if(n.readyState===Sg){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Ig(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=bg.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Cg.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}es.makeGetRequest=xg;var ts={},ns={};Object.defineProperty(ns,"__esModule",{value:!0});var Ag=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 i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();ns.default=Ag;var rs={};Object.defineProperty(rs,"__esModule",{value:!0});var wo=ht;function Tg(){return Math.round(Math.random()*1e3)}var Rg=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=wo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(wo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Tg()},e.prototype.countError=function(){this.errorCount<wo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();rs.default=Rg;var xi=le&&le.__assign||function(){return xi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},xi.apply(this,arguments)},Fc=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ts,"__esModule",{value:!0});var Lg=Se,Og=Wn,Ng=Fc(ns),tr=ht,Dg=Fc(rs),We=Lg.getLogger("DatafileManager"),Ug="update";function Pg(e){return e>=tr.MIN_UPDATE_INTERVAL}function _l(e){return e>=200&&e<400}var Mg={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Vg=function(){function e(t){var n=this,r=xi(xi({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?tr.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?tr.DEFAULT_URL_TEMPLATE:c,p=r.cache,f=p===void 0?Mg:p;this.cache=f,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,m){n.readyPromiseResolver=h,n.readyPromiseRejecter=m}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Og.sprintf(d,s),this.emitter=new Ng.default,this.autoUpdate=a,Pg(u)?this.updateInterval=u:(We.warn("Invalid updateInterval %s, defaulting to %s",u,tr.DEFAULT_UPDATE_INTERVAL),this.updateInterval=tr.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Dg.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(We.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return We.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?We.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?We.error("Error fetching datafile: %s",t):We.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&_l(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(We.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(Ug,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),We.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()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).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);We.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 We.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":_l(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,We.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!==""&&(We.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();ts.default=Vg;var Fg=le&&le.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},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)}}(),Bg=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xa,"__esModule",{value:!0});var jg=es,Hg=Bg(ts),zg=function(e){Fg(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return jg.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(Hg.default);Xa.default=zg;Object.defineProperty(Vc,"__esModule",{value:!0});var Gg=Xa;Vc.HttpPollingDatafileManager=Gg.default;var Kg={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Wg={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."},qg={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"'},$g={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"},Yg="javascript-sdk",Zg="node-sdk",Qg="react-sdk",Jg="react-native-sdk",Xg="react-native-js-sdk",ev="4.9.4",tv="4.9.4",nv={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},rv={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},iv={RULE:"rule",EXPERIMENT:"experiment"},ov={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ri={V2:"2",V3:"3",V4:"4"},av={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.'},Jo;(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"})(Jo||(Jo={}));var sv=Object.freeze({__proto__:null,LOG_LEVEL:Kg,ERROR_MESSAGES:Wg,LOG_MESSAGES:qg,CONTROL_ATTRIBUTES:$g,JAVASCRIPT_CLIENT_ENGINE:Yg,NODE_CLIENT_ENGINE:Zg,REACT_CLIENT_ENGINE:Qg,REACT_NATIVE_CLIENT_ENGINE:Jg,REACT_NATIVE_JS_CLIENT_ENGINE:Xg,BROWSER_CLIENT_VERSION:ev,NODE_CLIENT_VERSION:tv,DECISION_NOTIFICATION_TYPES:nv,DECISION_SOURCES:rv,AUDIENCE_EVALUATION_TYPES:iv,FEATURE_VARIABLE_TYPES:ov,DATAFILE_VERSIONS:ri,DECISION_MESSAGES:av,get NOTIFICATION_TYPES(){return Jo}});ri.V2,ri.V3,ri.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function lv(e){return new Se.ConsoleLogHandler(e)}var bl;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(bl||(bl={}));var wl;(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"})(wl||(wl={}));Se.getLogger();Se.getLogger();Se.getLogger();Se.getLogger();Se.getLogger("EVENT_BUILDER");Se.getLogger();Se.setLogHandler(lv());Se.setLogLevel(Se.LogLevel.INFO);let qr;const uv=new Uint8Array(16);function cv(){if(!qr&&(qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qr(uv)}const ke=[];for(let e=0;e<256;++e)ke.push((e+256).toString(16).slice(1));function dv(e,t=0){return(ke[e[t+0]]+ke[e[t+1]]+ke[e[t+2]]+ke[e[t+3]]+"-"+ke[e[t+4]]+ke[e[t+5]]+"-"+ke[e[t+6]]+ke[e[t+7]]+"-"+ke[e[t+8]]+ke[e[t+9]]+"-"+ke[e[t+10]]+ke[e[t+11]]+ke[e[t+12]]+ke[e[t+13]]+ke[e[t+14]]+ke[e[t+15]]).toLowerCase()}const fv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Cl={randomUUID:fv};function Kt(e,t,n){if(Cl.randomUUID&&!t&&!e)return Cl.randomUUID();e=e||{};const r=e.random||(e.rng||cv)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return dv(r)}const Nn="ul-app";var N=(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.SkipButton="ul-card-skip__button",e))(N||{});const is="#e6e6e6",lr="#bd282a",pv=500,hv=1030;var He=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(He||{});const Bc=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},mv=()=>{const e=Bc();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},gv=()=>{const e=Bc();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},vv=Object.freeze(Object.defineProperty({__proto__:null,enable:mv,disable:gv},Symbol.toStringTag,{value:"Module"})),El=[vv];class Xo{static disable(){El.forEach(t=>t.disable())}static enable(){El.forEach(t=>t.enable())}}const yv=1,Bn=e=>e instanceof HTMLElement,_v=e=>e instanceof HTMLInputElement,ur=e=>e instanceof HTMLTextAreaElement,jc=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=N.CustomStyle,e.head.appendChild(r)},Hc=e=>{const t=e.querySelector(`.${N.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+yv},bv=e=>{const t=e.querySelector(`.${N.CardContainer}`);t&&(t.scrollTop=0)};var wv=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},zc=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=zc.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new wv(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},Gc=zc;Gc.defaultMaxListeners=10;const Z=new Gc;var nr=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(nr||{}),ct=(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))(ct||{}),mn=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(mn||{}),Tt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",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))(Tt||{});const Ai=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Dn=({"userleap-platform":e})=>e!==mn.Web,_e=(e,t)=>{const n=t?N.MobileSuffix:N.DesktopSuffix;return[e+n,e]},mt=(e,t)=>[e,`${e}__${t}`];class Cv{constructor(t){Ae(this,"payload");Ae(this,"promise");Ae(this,"reject",()=>{});Ae(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Ev={RATELIMIT_RESET_DEFAULT:10};let Kc=!1,Wc="",$r=!1,qc=!1,ii=[];const Sv=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?Tt.Gtm:e._segment?Tt.Segment:Tt.Snippet,ea=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(qc=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",ea))},ta=(e="")=>{Kc=!0,Wc=e};function Or(e={}){const t={"Content-Type":"application/json","userleap-platform":mn.Web,"x-ul-sdk-version":__SDK_VERSION__,[ct.InstallationMethod]:Sv(e)};if(e.envId&&(t[ct.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[ct.UserID]=e.userId),e.visitorId&&(t[ct.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[ct.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[ct.PreviewMode]="1"),t}const Sl=async(e,t,n)=>{if(e)return{status:429};{const r=new Cv(n);return ii.push(r),r.promise}},Rt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if($r&&!i)return Sl(r,i,o);const a={ok:!1,reportError:!1};if(Kc)return console.info(`UserLeap - ${Wc}`),a;try{t.headers=Object.assign(Or(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!$r&&!r||i){$r=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Ev.RATELIMIT_RESET_DEFAULT;return await Ai(u*1e3),Rt(e,t,0,r,!0)}else return Sl(r,!1,o);if($r=!1,ii.length&&(ii.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:p}=l.payload;Rt(u,c,d,p).then(f=>{l.resolveRequest(f)})}),ii=[]),s.ok){if(s.status===249)return ta(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||qc?{ok:!1,reportError:!1,error:s}:(await Ai(Math.pow(2,n)*1e3),Rt(e,t,l))}};var $c={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(le,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,p=a.retryDelay,f=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")p=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,m){var g=function(y){var _=typeof Request<"u"&&u instanceof Request?u.clone():u;o(_,c).then(function(v){if(Array.isArray(f)&&f.indexOf(v.status)===-1)h(v);else if(typeof f=="function")try{return Promise.resolve(f(y,null,v)).then(function(w){w?b(y,null,v):h(v)}).catch(m)}catch(w){m(w)}else y<d?b(y,null,v):h(v)}).catch(function(v){if(typeof f=="function")try{Promise.resolve(f(y,v,null)).then(function(w){w?b(y,v,null):m(v)}).catch(function(w){m(w)})}catch(w){m(w)}else y<d?b(y,v,null):m(v)})};function b(y,_,v){var w=typeof p=="function"?p(y,_,v):p;setTimeout(function(){g(++y)},w)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})($c);const Iv=$c.exports;class kv{constructor(t){Ae(this,"awaitingResolvers",[]);Ae(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 Yc=new kv(2),xv=e=>Yc.setLimit(e),Av=Iv(fetch),Tv=async(e,t=3)=>Yc.execute(async()=>{const r=(await Av(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),Zc=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return Rt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
18
+ ***************************************************************************** */function Gh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Kh(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})}var Ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kr=0;Kr<Ln.length;Kr++)Wh[Ln.charCodeAt(Kr)]=Kr;var $h=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=Ln[t[n]>>2],i+=Ln[(t[n]&3)<<4|t[n+1]>>4],i+=Ln[(t[n+1]&15)<<2|t[n+2]>>6],i+=Ln[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const Xs=new Map;function qh(e,t){let n=Xs.get(e);return n||(n=new Map,Xs.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const dc=(e,t,n)=>{if(!e||!(pc(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=qh(n,r);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function ni(e,t,n){if(e instanceof Array)return e.map(r=>ni(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,i=$h(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ni(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ni(e.data,t,n),e.width,e.height]};if(pc(e,t)||typeof e=="object"){const r=e.constructor.name,i=dc(e,t,n);return{rr_type:r,index:i}}}}return e}const fc=(e,t,n)=>[...e].map(r=>ni(r,t,n)),pc=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function");return Boolean(r.find(i=>e instanceof t[i]))};function Yh(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const s=Tr(t.CanvasRenderingContext2D.prototype,a,function(l){return function(...u){return Ne(this.canvas,n,r,!0)||setTimeout(()=>{const c=fc([...u],t,this);e(this.canvas,{type:Mn["2D"],property:a,args:c})},0),l.apply(this,u)}});i.push(s)}catch{const l=Zi(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:Mn["2D"],property:a,args:[u],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function Zh(e){return e==="experimental-webgl"?"webgl":e}function el(e,t,n,r){const i=[];try{const o=Tr(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(s,...l){if(!Ne(this,t,n,!0)){const u=Zh(s);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(l[0]&&typeof l[0]=="object"){const c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[s,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function tl(e,t,n,r,i,o,a){const s=[],l=Object.getOwnPropertyNames(e);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const c=Tr(e,u,function(d){return function(...p){const f=d.apply(this,p);if(dc(f,a,this),"tagName"in this.canvas&&!Ne(this.canvas,r,i,!0)){const h=fc([...p],a,this),m={type:t,property:u,args:h};n(this.canvas,m)}return f}});s.push(c)}catch{const d=Zi(e,u,{set(p){n(this.canvas,{type:t,property:u,args:[p],setter:!0})}});s.push(d)}return s}function Qh(e,t,n,r,i){const o=[];return o.push(...tl(t.WebGLRenderingContext.prototype,Mn.WebGL,e,n,r,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...tl(t.WebGL2RenderingContext.prototype,Mn.WebGL2,e,n,r,i,t)),()=>{o.forEach(a=>a())}}function Jh(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function Xh(e,t,n){var r=t===void 0?null:t,i=n===void 0?!1:n,o=Jh(e,i),a=o.indexOf(`
19
+ `,10)+1,s=o.substring(a)+(r?"//# sourceMappingURL="+r:""),l=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(l)}function em(e,t,n){var r;return function(o){return r=r||Xh(e,t,n),new Worker(r,o)}}var tm=em("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);class nm{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)};const{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:s}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&n==="all"&&this.initCanvasMutationObserver(r,i,o),a&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:s})}initCanvasFPSObserver(t,n,r,i,o){const a=el(n,r,i,!0),s=new Map,l=new tm;l.onmessage=h=>{const{id:m}=h.data;if(s.set(m,!1),!("base64"in h.data))return;const{base64:g,type:b,width:v,height:_}=h.data;this.mutationCb({id:m,type:Mn["2D"],commands:[{property:"clearRect",args:[0,0,v,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:b}]},0,0]}]})};const u=1e3/t;let c=0,d;const p=()=>{const h=[];return n.document.querySelectorAll("canvas").forEach(m=>{Ne(m,r,i,!0)||h.push(m)}),h},f=h=>{if(c&&h-c<u){d=requestAnimationFrame(f);return}c=h,p().forEach(m=>Kh(this,void 0,void 0,function*(){var g;const b=this.mirror.getId(m);if(s.get(b))return;if(s.set(b,!0),["webgl","webgl2"].includes(m.__context)){const _=m.getContext(m.__context);((g=_==null?void 0:_.getContextAttributes())===null||g===void 0?void 0:g.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const v=yield createImageBitmap(m);l.postMessage({id:b,bitmap:v,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[v])})),d=requestAnimationFrame(f)};d=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=el(t,n,r,!1),o=Yh(this.processMutation.bind(this),t,n,r),a=Qh(this.processMutation.bind(this),t,n,r,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;const i=r.map(a=>Gh(a,["type"])),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class rm{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Eh,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;const r={id:n,styleIds:[]},i=[];for(const o of t){let a;if(this.styleMirror.has(o))a=this.styleMirror.getId(o);else{a=this.styleMirror.add(o);const s=Array.from(o.rules||CSSRule);i.push({styleId:a,rules:s.map((l,u)=>({rule:Wu(l),index:u}))})}r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class im{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,n){const r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function ye(e){return Object.assign(Object.assign({},e),{timestamp:Ci()})}let pe,ri,mo,Ii=!1;const et=Jp();function Lr(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:s=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:h,maskTextFn:m,hooks:g,packFn:b,sampling:v={},dataURLOptions:_={},mousemoveWait:y,recordCanvas:C=!1,recordCrossOriginIframes:E=!1,recordAfter:S=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:I=!1,collectFonts:x=!1,inlineImages:R=!1,plugins:A,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:k=new Set([]),errorHandler:U}=e;Ah(U);const T=E?window.parent===window:!0;let B=!1;if(!T)try{window.parent.document&&(B=!1)}catch{B=!0}if(T&&!t)throw new Error("emit function is required");y!==void 0&&v.mousemove===void 0&&(v.mousemove=y),et.reset();const Z=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},z=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};Ch();let ie,oe=0;const fe=j=>{for(const Pe of A||[])Pe.eventProcessor&&(j=Pe.eventProcessor(j));return b&&!B&&(j=b(j)),j};pe=(j,Pe)=>{var ee;if(((ee=sn[0])===null||ee===void 0?void 0:ee.isFrozen())&&j.type!==X.FullSnapshot&&!(j.type===X.IncrementalSnapshot&&j.data.source===J.Mutation)&&sn.forEach(Ce=>Ce.unfreeze()),T)t==null||t(fe(j),Pe);else if(B){const Ce={type:"rrweb",event:fe(j),origin:window.location.origin,isCheckout:Pe};window.parent.postMessage(Ce,"*")}if(j.type===X.FullSnapshot)ie=j,oe=0;else if(j.type===X.IncrementalSnapshot){if(j.data.source===J.Mutation&&j.data.isAttachIframe)return;oe++;const Ce=r&&oe>=r,en=n&&j.timestamp-ie.timestamp>n;(Ce||en)&&ri(!0)}};const Q=j=>{pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Mutation},j)}))},Ke=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Scroll},j)})),Se=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.CanvasMutation},j)})),yt=j=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.AdoptedStyleSheet},j)})),Ve=new rm({mutationCb:Q,adoptedStyleSheetCb:yt}),st=new Hh({mirror:et,mutationCb:Q,stylesheetManager:Ve,recordCrossOriginIframes:E,wrappedEmit:pe});for(const j of A||[])j.getMirror&&j.getMirror({nodeMirror:et,crossOriginIframeMirror:st.crossOriginIframeMirror,crossOriginIframeStyleMirror:st.crossOriginIframeStyleMirror});const Xt=new im;mo=new nm({recordCanvas:C,mutationCb:Se,win:window,blockClass:i,blockSelector:o,mirror:et,sampling:v.canvas,dataURLOptions:_});const Xe=new zh({mutationCb:Q,scrollCb:Ke,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:Z,dataURLOptions:_,maskTextFn:m,maskInputFn:h,recordCanvas:C,inlineImages:R,sampling:v,slimDOMOptions:z,iframeManager:st,stylesheetManager:Ve,canvasManager:mo,keepIframeSrcFn:O,processedNodeManager:Xt},mirror:et});ri=(j=!1)=>{pe(ye({type:X.Meta,data:{href:window.location.href,width:ec(),height:Xu()}}),j),Ve.reset(),Xe.init(),sn.forEach(ee=>ee.lock());const Pe=bh(document,{mirror:et,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:Z,maskTextFn:m,slimDOM:z,dataURLOptions:_,recordCanvas:C,inlineImages:R,onSerialize:ee=>{nc(ee,et)&&st.addIframe(ee),rc(ee,et)&&Ve.trackLinkElement(ee),Ko(ee)&&Xe.addShadowRoot(ee.shadowRoot,document)},onIframeLoad:(ee,Ce)=>{st.attachIframe(ee,Ce),Xe.observeAttachShadow(ee)},onStylesheetLoad:(ee,Ce)=>{Ve.attachLinkElement(ee,Ce)},keepIframeSrcFn:O});if(!Pe)return console.warn("Failed to snapshot the document");pe(ye({type:X.FullSnapshot,data:{node:Pe,initialOffset:Ju(window)}}),j),sn.forEach(ee=>ee.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ve.adoptStyleSheets(document.adoptedStyleSheets,et.getId(document))};try{const j=[],Pe=Ce=>{var en;return W(jh)({mutationCb:Q,mousemoveCb:(de,lo)=>pe(ye({type:X.IncrementalSnapshot,data:{source:lo,positions:de}})),mouseInteractionCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.MouseInteraction},de)})),scrollCb:Ke,viewportResizeCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.ViewportResize},de)})),inputCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Input},de)})),mediaInteractionCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.MediaInteraction},de)})),styleSheetRuleCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleSheetRule},de)})),styleDeclarationCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleDeclaration},de)})),canvasMutationCb:Se,fontCb:de=>pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Font},de)})),selectionCb:de=>{pe(ye({type:X.IncrementalSnapshot,data:Object.assign({source:J.Selection},de)}))},blockClass:i,ignoreClass:a,ignoreSelector:s,maskTextClass:l,maskTextSelector:u,maskInputOptions:Z,inlineStylesheet:c,sampling:v,recordCanvas:C,inlineImages:R,userTriggeredOnInput:I,collectFonts:x,doc:Ce,maskInputFn:h,maskTextFn:m,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:z,dataURLOptions:_,mirror:et,iframeManager:st,stylesheetManager:Ve,shadowDomManager:Xe,processedNodeManager:Xt,canvasManager:mo,ignoreCSSAttributes:k,plugins:((en=A==null?void 0:A.filter(de=>de.observer))===null||en===void 0?void 0:en.map(de=>({observer:de.observer,options:de.options,callback:lo=>pe(ye({type:X.Plugin,data:{plugin:de.name,payload:lo}}))})))||[]},g)};st.addLoadListener(Ce=>{try{j.push(Pe(Ce.contentDocument))}catch(en){console.warn(en)}});const ee=()=>{ri(),j.push(Pe(document)),Ii=!0};return document.readyState==="interactive"||document.readyState==="complete"?ee():(j.push(Oe("DOMContentLoaded",()=>{pe(ye({type:X.DomContentLoaded,data:{}})),S==="DOMContentLoaded"&&ee()})),j.push(Oe("load",()=>{pe(ye({type:X.Load,data:{}})),S==="load"&&ee()},window))),()=>{j.forEach(Ce=>Ce()),Xt.destroy(),Ii=!1,Th()}}catch(j){console.warn(j)}}Lr.addCustomEvent=(e,t)=>{if(!Ii)throw new Error("please add custom event after start recording");pe(ye({type:X.Custom,data:{tag:e,payload:t}}))};Lr.freezePage=()=>{sn.forEach(e=>e.freeze())};Lr.takeFullSnapshot=e=>{if(!Ii)throw new Error("please take full snapshot after start recording");ri(e)};Lr.mirror=et;var dt=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(dt||{}),G=(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.QuestionAnswered="question.answered",e))(G||{}),hc=(e=>(e.SurveyId="survey.id",e))(hc||{});const ja={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",QUESTION_ANSWERED:"question.answered",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 Qe=(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))(Qe||{}),ln=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(ln||{}),le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function om(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function am(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 i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Ie={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});var Ha=function(){function e(){}return e.prototype.handleError=function(t){},e}();_n.NoopErrorHandler=Ha;var za=new Ha;function sm(e){za=e}_n.setErrorHandler=sm;function lm(){return za}_n.getErrorHandler=lm;function um(){za=new Ha}_n.resetErrorHandler=um;var Ga={};(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={}))})(Ga);var Zt={},$n={},Si={exports:{}},nl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(nl){var rl=new Uint8Array(16);Si.exports=function(){return nl(rl),rl}}else{var il=new Array(16);Si.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),il[t]=n>>>((t&3)<<3)&255;return il}}var mc=[];for(var Wr=0;Wr<256;++Wr)mc[Wr]=(Wr+256).toString(16).substr(1);function cm(e,t){var n=t||0,r=mc;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 gc=cm,dm=Si.exports,fm=gc,ol,go,vo=0,yo=0;function pm(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ol,a=e.clockseq!==void 0?e.clockseq:go;if(o==null||a==null){var s=dm();o==null&&(o=ol=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=go=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:yo+1,c=l-vo+(u-yo)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>vo)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");vo=l,yo=u,go=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=l/4294967296*1e4&268435455;i[r++]=p>>>8&255,i[r++]=p&255,i[r++]=p>>>24&15|16,i[r++]=p>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var f=0;f<6;++f)i[r+f]=o[f];return t||fm(i)}var hm=pm,mm=Si.exports,gm=gc;function vm(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||mm)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||gm(i)}var ym=vm,_m=hm,vc=ym,Ka=vc;Ka.v1=_m;Ka.v4=vc;var bm=Ka;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=bm;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,p){for(var f=!1,h=Object.keys(d),m=0;m<h.length;m++)if(p===d[h[m]]){f=!0;break}return f}e.isValidEnum=i;function o(d,p){var f={};return d.forEach(function(h){var m=p(h);f[m]=f[m]||[],f[m].push(h)}),a(f)}e.groupBy=o;function a(d){return Object.keys(d).map(function(p){return d[p]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(p){return[p,d[p]]})}e.objectEntries=s;function l(d,p){for(var f,h=0,m=d;h<m.length;h++){var g=m[h];if(p(g)){f=g;break}}return f}e.find=l;function u(d,p){var f={};return d.forEach(function(h){var m=p(h);f[m]=h}),f}e.keyBy=u;function c(d){for(var p=[],f=1;f<arguments.length;f++)p[f-1]=arguments[f];var h=0;return d.replace(/%s/g,function(){var m=p[h++],g=typeof m;return g==="function"?m():g==="string"?m:String(m)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})($n);var wm=le&&le.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(Zt,"__esModule",{value:!0});var Cm=_n,ki=$n,ge=Ga,al={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function Wa(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!al[e])?e:al[e]}var yc=function(){function e(){this.defaultLoggerFacade=new sl,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new sl({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),Em=function(){function e(t){t===void 0&&(t={}),this.logLevel=ge.LogLevel.NOTSET,t.logLevel!==void 0&&ki.isValidEnum(ge.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=Wa(t),!ki.isValidEnum(ge.LogLevel,t)||t===void 0?this.logLevel=ge.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 ge.LogLevel.DEBUG:return"DEBUG";case ge.LogLevel.INFO:return"INFO ";case ge.LogLevel.WARNING:return"WARN ";case ge.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case ge.LogLevel.DEBUG:console.log.apply(console,n);break;case ge.LogLevel.INFO:console.info.apply(console,n);break;case ge.LogLevel.WARNING:console.warn.apply(console,n);break;case ge.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();Zt.ConsoleLogHandler=Em;var yr=ge.LogLevel.NOTSET,$o=null,sl=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=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(Wa(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(ge.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(ge.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(ge.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(ge.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+ki.sprintf.apply(void 0,wm([t.message],t.splat))},e.prototype.internalLog=function(t,n){!$o||t<yr||($o.log(t,this.format(n)),n.error&&n.error instanceof Error&&Cm.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var i;if(n instanceof Error){i=n,n=i.message,this.internalLog(t,{error:i,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var o=r[r.length-1];o instanceof Error&&(i=o,r.splice(-1)),this.internalLog(t,{message:n,error:i,splat:r})},e}(),_c=new yc;function Im(e){return _c.getLogger(e)}Zt.getLogger=Im;function Sm(e){$o=e}Zt.setLogHandler=Sm;function km(e){e=Wa(e),!ki.isValidEnum(ge.LogLevel,e)||e===void 0?yr=ge.LogLevel.ERROR:yr=e}Zt.setLogLevel=km;function xm(){return yr}Zt.getLogLevel=xm;function Am(){_c=new yc,yr=ge.LogLevel.NOTSET}Zt.resetLogger=Am;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(_n),t(Ga),t(Zt)})(Ie);var Tm={},Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.areEventContextsEqual=void 0;function Rm(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}Or.areEventContextsEqual=Rm;var $a={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.DefaultEventQueue=Fn.SingleEventQueue=void 0;var Lm=Ie,Om=Lm.getLogger("EventProcessor"),Nm=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}(),Dm=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}();Fn.SingleEventQueue=Dm;var Um=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,i=t.sink,o=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.batchComparator=o,this.timer=new Nm({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){Om.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}();Fn.DefaultEventQueue=Um;(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=Fn,n=Ie,r=$n;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,d,p){var f;return u>1?f=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:p}):f=new t.SingleEventQueue({sink:d}),f}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})($a);var bc={};Object.defineProperty(bc,"__esModule",{value:!0});var wc={};Object.defineProperty(wc,"__esModule",{value:!0});var Vn={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0});Qi.LocalStorageStore=void 0;var Pm=$n,Mm=Ie,ll=Mm.getLogger("EventProcessor"),Fm=function(){function e(t){var n=t.key,r=t.maxValues,i=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=i}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 Pm.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){ll.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var i=n.map(function(a){return{key:a,value:t[a]}});i.sort(function(a,s){return a.value.timestamp-s.value.timestamp});for(var o=0;o<r;o++)delete t[i[o].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){ll.error(n)}return{}},e}();Qi.LocalStorageStore=Fm;var Vm=le&&le.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},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(Vn,"__esModule",{value:!0});Vn.LocalStoragePendingEventsDispatcher=Vn.PendingEventsDispatcher=void 0;var Bm=Ie,jm=Qi,ul=$n,Hm=Bm.getLogger("EventProcessor"),Cc=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:ul.generateUUID(),timestamp:ul.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Hm.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(i){r.store.remove(t.uuid),n(i)})},e}();Vn.PendingEventsDispatcher=Cc;var zm=function(e){Vm(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new jm.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Cc);Vn.LocalStoragePendingEventsDispatcher=zm;var rt={},qo=le&&le.__assign||function(){return qo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},qo.apply(this,arguments)};Object.defineProperty(rt,"__esModule",{value:!0});rt.formatEvents=rt.buildConversionEventV1=rt.buildImpressionEventV1=rt.makeBatchedEventV1=void 0;var Gm="campaign_activated",Km="custom",cl="$opt_bot_filtering";function Ec(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=qa(r);r.type==="impression"?i.snapshots.push(Sc(r)):r.type==="conversion"&&i.snapshots.push(Ic(r)),t.push(i)}}),{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}}rt.makeBatchedEventV1=Ec;function Ic(e){var t=qo({},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 Sc(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",p=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",f=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:p,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:f,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:Gm,uuid:e.uuid}]}}function qa(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:cl,key:cl,type:Km,value:e.context.botFiltering}),t}function Wm(e){var t=qa(e);return t.snapshots.push(Sc(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]}}rt.buildImpressionEventV1=Wm;function $m(e){var t=qa(e);return t.snapshots.push(Ic(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]}}rt.buildConversionEventV1=$m;function qm(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Ec(e)}}rt.formatEvents=qm;var Ji={},Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});var Ym=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(i){return i()}),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}();Ya.default=Ym;var Zm=le&&le.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},Qm=le&&le.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(c){u=[6,c],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Jm=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ji,"__esModule",{value:!0});Ji.LogTierV1EventProcessor=void 0;var Xm=Ie,In=$a,eg=Jm(Ya),tg=Or,ng=rt,dl=Xm.getLogger("LogTierV1EventProcessor"),rg=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?In.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?In.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new eg.default,i=In.validateAndGetFlushInterval(i),a=In.validateAndGetBatchSize(a),this.queue=In.getQueue(a,i,this.drainQueue.bind(this),tg.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(dl.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=ng.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),In.sendEventNotification(n.notificationCenter,o)});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){dl.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Zm(this,void 0,void 0,function(){return Qm(this,function(t){return this.queue.start(),[2]})})},e}();Ji.LogTierV1EventProcessor=rg;(function(e){var t=le&&le.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o),Object.defineProperty(r,a,{enumerable:!0,get:function(){return i[o]}})}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=le&&le.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Or,e),n($a,e),n(bc,e),n(wc,e),n(Vn,e),n(rt,e),n(Ji,e)})(Tm);var xi={exports:{}},fl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(fl){var pl=new Uint8Array(16);xi.exports=function(){return fl(pl),pl}}else{var hl=new Array(16);xi.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),hl[t]=n>>>((t&3)<<3)&255;return hl}}var kc=[];for(var $r=0;$r<256;++$r)kc[$r]=($r+256).toString(16).substr(1);function ig(e,t){var n=t||0,r=kc;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 xc=ig,og=xi.exports,ag=xc,ml,_o,bo=0,wo=0;function sg(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ml,a=e.clockseq!==void 0?e.clockseq:_o;if(o==null||a==null){var s=og();o==null&&(o=ml=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=_o=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:wo+1,c=l-bo+(u-wo)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>bo)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");bo=l,wo=u,_o=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=l/4294967296*1e4&268435455;i[r++]=p>>>8&255,i[r++]=p&255,i[r++]=p>>>24&15|16,i[r++]=p>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var f=0;f<6;++f)i[r+f]=o[f];return t||ag(i)}var lg=sg,ug=xi.exports,cg=xc;function dg(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||ug)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||cg(i)}var fg=dg,pg=lg,Ac=fg,Tc=Ac;Tc.v1=pg;Tc.v4=Ac;var hg={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,d,p,f;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,f=0;f<s;)p=i.charCodeAt(f)&255|(i.charCodeAt(++f)&255)<<8|(i.charCodeAt(++f)&255)<<16|(i.charCodeAt(++f)&255)<<24,++f,p=(p&65535)*c+(((p>>>16)*c&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,l^=p,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(p=0,a){case 3:p^=(i.charCodeAt(f+2)&255)<<16;case 2:p^=(i.charCodeAt(f+1)&255)<<8;case 1:p^=i.charCodeAt(f)&255,p=(p&65535)*c+(((p>>>16)*c&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,l^=p}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(hg);var Rc={},Za={},Qa={},ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.DEFAULT_UPDATE_INTERVAL=5*60*1e3;ht.MIN_UPDATE_INTERVAL=1e3;ht.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";ht.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";ht.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];ht.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(Qa,"__esModule",{value:!0});var mg=ht,gg=Ie,vg=gg.getLogger("DatafileManager"),yg="GET",_g=4;function bg(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
20
+ `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function wg(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function Cg(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(yg,e,!0),wg(t,n),n.onreadystatechange=function(){if(n.readyState===_g){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=bg(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=mg.REQUEST_TIMEOUT_MS,n.ontimeout=function(){vg.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Qa.makeGetRequest=Cg;var Ja={},Xa={};Object.defineProperty(Xa,"__esModule",{value:!0});var Eg=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 i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Xa.default=Eg;var es={};Object.defineProperty(es,"__esModule",{value:!0});var Co=ht;function Ig(){return Math.round(Math.random()*1e3)}var Sg=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=Co.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(Co.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Ig()},e.prototype.countError=function(){this.errorCount<Co.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();es.default=Sg;var Ai=le&&le.__assign||function(){return Ai=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ai.apply(this,arguments)},Lc=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ja,"__esModule",{value:!0});var kg=Ie,xg=$n,Ag=Lc(Xa),nr=ht,Tg=Lc(es),We=kg.getLogger("DatafileManager"),Rg="update";function Lg(e){return e>=nr.MIN_UPDATE_INTERVAL}function gl(e){return e>=200&&e<400}var Og={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Ng=function(){function e(t){var n=this,r=Ai(Ai({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?nr.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?nr.DEFAULT_URL_TEMPLATE:c,p=r.cache,f=p===void 0?Og:p;this.cache=f,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,m){n.readyPromiseResolver=h,n.readyPromiseRejecter=m}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=xg.sprintf(d,s),this.emitter=new Ag.default,this.autoUpdate=a,Lg(u)?this.updateInterval=u:(We.warn("Invalid updateInterval %s, defaulting to %s",u,nr.DEFAULT_UPDATE_INTERVAL),this.updateInterval=nr.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Tg.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(We.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return We.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?We.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?We.error("Error fetching datafile: %s",t):We.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&gl(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(We.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(Rg,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),We.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()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).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);We.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 We.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":gl(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,We.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!==""&&(We.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ja.default=Ng;var Dg=le&&le.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},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)}}(),Ug=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Za,"__esModule",{value:!0});var Pg=Qa,Mg=Ug(Ja),Fg=function(e){Dg(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return Pg.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(Mg.default);Za.default=Fg;Object.defineProperty(Rc,"__esModule",{value:!0});var Vg=Za;Rc.HttpPollingDatafileManager=Vg.default;var Bg={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},jg={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."},Hg={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"'},zg={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"},Gg="javascript-sdk",Kg="node-sdk",Wg="react-sdk",$g="react-native-sdk",qg="react-native-js-sdk",Yg="4.9.4",Zg="4.9.4",Qg={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Jg={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Xg={RULE:"rule",EXPERIMENT:"experiment"},ev={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ii={V2:"2",V3:"3",V4:"4"},tv={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.'},Yo;(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"})(Yo||(Yo={}));var nv=Object.freeze({__proto__:null,LOG_LEVEL:Bg,ERROR_MESSAGES:jg,LOG_MESSAGES:Hg,CONTROL_ATTRIBUTES:zg,JAVASCRIPT_CLIENT_ENGINE:Gg,NODE_CLIENT_ENGINE:Kg,REACT_CLIENT_ENGINE:Wg,REACT_NATIVE_CLIENT_ENGINE:$g,REACT_NATIVE_JS_CLIENT_ENGINE:qg,BROWSER_CLIENT_VERSION:Yg,NODE_CLIENT_VERSION:Zg,DECISION_NOTIFICATION_TYPES:Qg,DECISION_SOURCES:Jg,AUDIENCE_EVALUATION_TYPES:Xg,FEATURE_VARIABLE_TYPES:ev,DATAFILE_VERSIONS:ii,DECISION_MESSAGES:tv,get NOTIFICATION_TYPES(){return Yo}});ii.V2,ii.V3,ii.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function rv(e){return new Ie.ConsoleLogHandler(e)}var vl;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(vl||(vl={}));var yl;(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"})(yl||(yl={}));Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger("EVENT_BUILDER");Ie.getLogger();Ie.setLogHandler(rv());Ie.setLogLevel(Ie.LogLevel.INFO);let qr;const iv=new Uint8Array(16);function ov(){if(!qr&&(qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qr(iv)}const ke=[];for(let e=0;e<256;++e)ke.push((e+256).toString(16).slice(1));function av(e,t=0){return(ke[e[t+0]]+ke[e[t+1]]+ke[e[t+2]]+ke[e[t+3]]+"-"+ke[e[t+4]]+ke[e[t+5]]+"-"+ke[e[t+6]]+ke[e[t+7]]+"-"+ke[e[t+8]]+ke[e[t+9]]+"-"+ke[e[t+10]]+ke[e[t+11]]+ke[e[t+12]]+ke[e[t+13]]+ke[e[t+14]]+ke[e[t+15]]).toLowerCase()}const sv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_l={randomUUID:sv};function Kt(e,t,n){if(_l.randomUUID&&!t&&!e)return _l.randomUUID();e=e||{};const r=e.random||(e.rng||ov)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return av(r)}const Nn="ul-app";var N=(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.SkipButton="ul-card-skip__button",e))(N||{});const ts="#e6e6e6",ur="#bd282a",lv=500,uv=1030;var He=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(He||{});const Oc=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},cv=()=>{const e=Oc();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},dv=()=>{const e=Oc();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},fv=Object.freeze(Object.defineProperty({__proto__:null,enable:cv,disable:dv},Symbol.toStringTag,{value:"Module"})),bl=[fv];class Zo{static disable(){bl.forEach(t=>t.disable())}static enable(){bl.forEach(t=>t.enable())}}const pv=1,Bn=e=>e instanceof HTMLElement,hv=e=>e instanceof HTMLInputElement,cr=e=>e instanceof HTMLTextAreaElement,Nc=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=N.CustomStyle,e.head.appendChild(r)},Dc=e=>{const t=e.querySelector(`.${N.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+pv},mv=e=>{const t=e.querySelector(`.${N.CardContainer}`);t&&(t.scrollTop=0)};var gv=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},Uc=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=Uc.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new gv(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},Pc=Uc;Pc.defaultMaxListeners=10;const Y=new Pc;var rr=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(rr||{}),ct=(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))(ct||{}),mn=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(mn||{}),Tt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",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))(Tt||{});const Ti=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Dn=({"userleap-platform":e})=>e!==mn.Web,_e=(e,t)=>{const n=t?N.MobileSuffix:N.DesktopSuffix;return[e+n,e]},mt=(e,t)=>[e,`${e}__${t}`];class vv{constructor(t){Ae(this,"payload");Ae(this,"promise");Ae(this,"reject",()=>{});Ae(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const yv={RATELIMIT_RESET_DEFAULT:10};let Mc=!1,Fc="",Yr=!1,Vc=!1,oi=[];const _v=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?Tt.Gtm:e._segment?Tt.Segment:Tt.Snippet,Qo=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(Vc=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Qo))},Jo=(e="")=>{Mc=!0,Fc=e};function Nr(e={}){const t={"Content-Type":"application/json","userleap-platform":mn.Web,"x-ul-sdk-version":"2.24.7",[ct.InstallationMethod]:_v(e)};if(e.envId&&(t[ct.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[ct.UserID]=e.userId),e.visitorId&&(t[ct.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[ct.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[ct.PreviewMode]="1"),t}const wl=async(e,t,n)=>{if(e)return{status:429};{const r=new vv(n);return oi.push(r),r.promise}},Rt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Yr&&!i)return wl(r,i,o);const a={ok:!1,reportError:!1};if(Mc)return console.info(`UserLeap - ${Fc}`),a;try{t.headers=Object.assign(Nr(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Yr&&!r||i){Yr=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):yv.RATELIMIT_RESET_DEFAULT;return await Ti(u*1e3),Rt(e,t,0,r,!0)}else return wl(r,!1,o);if(Yr=!1,oi.length&&(oi.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:p}=l.payload;Rt(u,c,d,p).then(f=>{l.resolveRequest(f)})}),oi=[]),s.ok){if(s.status===249)return Jo(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||Vc?{ok:!1,reportError:!1,error:s}:(await Ti(Math.pow(2,n)*1e3),Rt(e,t,l))}};var Bc={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(le,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,p=a.retryDelay,f=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")p=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,m){var g=function(v){var _=typeof Request<"u"&&u instanceof Request?u.clone():u;o(_,c).then(function(y){if(Array.isArray(f)&&f.indexOf(y.status)===-1)h(y);else if(typeof f=="function")try{return Promise.resolve(f(v,null,y)).then(function(C){C?b(v,null,y):h(y)}).catch(m)}catch(C){m(C)}else v<d?b(v,null,y):h(y)}).catch(function(y){if(typeof f=="function")try{Promise.resolve(f(v,y,null)).then(function(C){C?b(v,y,null):m(y)}).catch(function(C){m(C)})}catch(C){m(C)}else v<d?b(v,y,null):m(y)})};function b(v,_,y){var C=typeof p=="function"?p(v,_,y):p;setTimeout(function(){g(++v)},C)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(Bc);const bv=Bc.exports;class wv{constructor(t){Ae(this,"awaitingResolvers",[]);Ae(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 jc=new wv(2),Cv=e=>jc.setLimit(e),Ev=bv(fetch),Iv=async(e,t=3)=>jc.execute(async()=>{const r=(await Ev(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),Hc=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return Rt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
21
21
  Copyright (c) Microsoft Corporation.
22
22
  Permission to use, copy, modify, and/or distribute this software for any
23
23
  purpose with or without fee is hereby granted.
@@ -28,13 +28,13 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
28
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
29
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
30
  PERFORMANCE OF THIS SOFTWARE.
31
- ***************************************************************************** */var $=function(){return $=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$.apply(this,arguments)};function na(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ve=Object.keys,Le=Array.isArray;typeof Promise<"u"&&!ae.Promise&&(ae.Promise=Promise);function Ue(e,t){return typeof t!="object"||ve(t).forEach(function(n){e[n]=t[n]}),e}var yr=Object.getPrototypeOf,Rv={}.hasOwnProperty;function ze(e,t){return Rv.call(e,t)}function jn(e,t){typeof t=="function"&&(t=t(yr(e))),(typeof Reflect>"u"?ve:Reflect.ownKeys)(t).forEach(function(n){Nt(e,n,t[n])})}var Qc=Object.defineProperty;function Nt(e,t,n,r){Qc(e,t,Ue(n&&ze(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function qn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),Nt(e.prototype,"constructor",e),{extend:jn.bind(null,e.prototype)}}}}var Lv=Object.getOwnPropertyDescriptor;function os(e,t){var n=Lv(e,t),r;return n||(r=yr(e))&&os(r,t)}var Ov=[].slice;function Ji(e,t,n){return Ov.call(e,t,n)}function Jc(e,t){return t(e)}function rr(e){if(!e)throw new Error("Assertion Failed")}function Xc(e){ae.setImmediate?setImmediate(e):setTimeout(e,0)}function ed(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function Nv(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function Lt(e,t){if(ze(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,i=t.length;r<i;++r){var o=Lt(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(a!==-1){var s=e[t.substr(0,a)];return s===void 0?void 0:Lt(s,t.substr(a+1))}}function ot(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){rr(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)ot(e,t[r],n[r])}else{var o=t.indexOf(".");if(o!==-1){var a=t.substr(0,o),s=t.substr(o+1);if(s==="")n===void 0?Le(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!ze(e,a))&&(l=e[a]={}),ot(l,s,n)}}else n===void 0?Le(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function Dv(e,t){typeof t=="string"?ot(e,t,void 0):"length"in t&&[].map.call(t,function(n){ot(e,n,void 0)})}function td(e){var t={};for(var n in e)ze(e,n)&&(t[n]=e[n]);return t}var Uv=[].concat;function nd(e){return Uv.apply([],e)}var rd="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(nd([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return ae[e]}),Pv=rd.map(function(e){return ae[e]});ed(rd,function(e){return[e,!0]});var Bt=null;function Nr(e){Bt=typeof WeakMap<"u"&&new WeakMap;var t=ra(e);return Bt=null,t}function ra(e){if(!e||typeof e!="object")return e;var t=Bt&&Bt.get(e);if(t)return t;if(Le(e)){t=[],Bt&&Bt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(ra(e[n]))}else if(Pv.indexOf(e.constructor)>=0)t=e;else{var i=yr(e);t=i===Object.prototype?{}:Object.create(i),Bt&&Bt.set(e,t);for(var o in e)ze(e,o)&&(t[o]=ra(e[o]))}return t}var Mv={}.toString;function ia(e){return Mv.call(e).slice(8,-1)}var oa=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Vv=typeof oa=="symbol"?function(e){var t;return e!=null&&(t=e[oa])&&t.apply(e)}:function(){return null},An={};function Et(e){var t,n,r,i;if(arguments.length===1){if(Le(e))return e.slice();if(this===An&&typeof e=="string")return[e];if(i=Vv(e)){for(n=[];r=i.next(),!r.done;)n.push(r.value);return n}if(e==null)return[e];if(t=e.length,typeof t=="number"){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var as=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},gt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function id(e,t){gt=e,od=t}var od=function(){return!0},Fv=!new Error("").stack;function bn(){if(Fv)try{throw bn.arguments,new Error}catch(e){return e}return new Error}function aa(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
31
+ ***************************************************************************** */var $=function(){return $=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$.apply(this,arguments)};function Xo(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ve=Object.keys,Le=Array.isArray;typeof Promise<"u"&&!ae.Promise&&(ae.Promise=Promise);function Ue(e,t){return typeof t!="object"||ve(t).forEach(function(n){e[n]=t[n]}),e}var _r=Object.getPrototypeOf,Sv={}.hasOwnProperty;function ze(e,t){return Sv.call(e,t)}function jn(e,t){typeof t=="function"&&(t=t(_r(e))),(typeof Reflect>"u"?ve:Reflect.ownKeys)(t).forEach(function(n){Nt(e,n,t[n])})}var zc=Object.defineProperty;function Nt(e,t,n,r){zc(e,t,Ue(n&&ze(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function qn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),Nt(e.prototype,"constructor",e),{extend:jn.bind(null,e.prototype)}}}}var kv=Object.getOwnPropertyDescriptor;function ns(e,t){var n=kv(e,t),r;return n||(r=_r(e))&&ns(r,t)}var xv=[].slice;function Xi(e,t,n){return xv.call(e,t,n)}function Gc(e,t){return t(e)}function ir(e){if(!e)throw new Error("Assertion Failed")}function Kc(e){ae.setImmediate?setImmediate(e):setTimeout(e,0)}function Wc(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function Av(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function Lt(e,t){if(ze(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,i=t.length;r<i;++r){var o=Lt(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(a!==-1){var s=e[t.substr(0,a)];return s===void 0?void 0:Lt(s,t.substr(a+1))}}function ot(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){ir(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)ot(e,t[r],n[r])}else{var o=t.indexOf(".");if(o!==-1){var a=t.substr(0,o),s=t.substr(o+1);if(s==="")n===void 0?Le(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!ze(e,a))&&(l=e[a]={}),ot(l,s,n)}}else n===void 0?Le(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function Tv(e,t){typeof t=="string"?ot(e,t,void 0):"length"in t&&[].map.call(t,function(n){ot(e,n,void 0)})}function $c(e){var t={};for(var n in e)ze(e,n)&&(t[n]=e[n]);return t}var Rv=[].concat;function qc(e){return Rv.apply([],e)}var Yc="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(qc([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return ae[e]}),Lv=Yc.map(function(e){return ae[e]});Wc(Yc,function(e){return[e,!0]});var Bt=null;function Dr(e){Bt=typeof WeakMap<"u"&&new WeakMap;var t=ea(e);return Bt=null,t}function ea(e){if(!e||typeof e!="object")return e;var t=Bt&&Bt.get(e);if(t)return t;if(Le(e)){t=[],Bt&&Bt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(ea(e[n]))}else if(Lv.indexOf(e.constructor)>=0)t=e;else{var i=_r(e);t=i===Object.prototype?{}:Object.create(i),Bt&&Bt.set(e,t);for(var o in e)ze(e,o)&&(t[o]=ea(e[o]))}return t}var Ov={}.toString;function ta(e){return Ov.call(e).slice(8,-1)}var na=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Nv=typeof na=="symbol"?function(e){var t;return e!=null&&(t=e[na])&&t.apply(e)}:function(){return null},An={};function Et(e){var t,n,r,i;if(arguments.length===1){if(Le(e))return e.slice();if(this===An&&typeof e=="string")return[e];if(i=Nv(e)){for(n=[];r=i.next(),!r.done;)n.push(r.value);return n}if(e==null)return[e];if(t=e.length,typeof t=="number"){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var rs=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},gt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Zc(e,t){gt=e,Qc=t}var Qc=function(){return!0},Dv=!new Error("").stack;function bn(){if(Dv)try{throw bn.arguments,new Error}catch(e){return e}return new Error}function ra(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
32
32
  `).length),n.split(`
33
- `).slice(t).filter(od).map(function(r){return`
34
- `+r}).join("")):""}var Bv=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],ad=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ss=Bv.concat(ad),jv={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function $n(e,t){this._e=bn(),this.name=e,this.message=t}qn($n).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+aa(this._e,2))}},toString:function(){return this.name+": "+this.message}});function sd(e,t){return e+". Errors: "+Object.keys(t).map(function(n){return t[n].toString()}).filter(function(n,r,i){return i.indexOf(n)===r}).join(`
35
- `)}function Ti(e,t,n,r){this._e=bn(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=sd(e,t)}qn(Ti).from($n);function cr(e,t){this._e=bn(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=sd(e,t)}qn(cr).from($n);var ls=ss.reduce(function(e,t){return e[t]=t+"Error",e},{}),Hv=$n,B=ss.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=bn(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
36
- `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=jv[t]||n,this.inner=null)}return qn(r).from(Hv),e[t]=r,e},{});B.Syntax=SyntaxError;B.Type=TypeError;B.Range=RangeError;var Il=ad.reduce(function(e,t){return e[t+"Error"]=B[t],e},{});function zv(e,t){if(!e||e instanceof $n||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Il[e.name])return e;var n=new Il[e.name](t||e.message,e);return"stack"in e&&Nt(n,"stack",{get:function(){return this.inner.stack}}),n}var Xi=ss.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=B[t]),e},{});Xi.ModifyError=Ti;Xi.DexieError=$n;Xi.BulkError=cr;function ne(){}function Dr(e){return e}function Gv(e,t){return e==null||e===Dr?t:function(n){return t(e(n))}}function gn(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Kv(e,t){return e===ne?t:function(){var n=e.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?gn(r,this.onsuccess):r),i&&(this.onerror=this.onerror?gn(i,this.onerror):i),o!==void 0?o:n}}function Wv(e,t){return e===ne?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?gn(n,this.onsuccess):n),r&&(this.onerror=this.onerror?gn(r,this.onerror):r)}}function qv(e,t){return e===ne?t:function(n){var r=e.apply(this,arguments);Ue(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?gn(i,this.onsuccess):i),o&&(this.onerror=this.onerror?gn(o,this.onerror):o),r===void 0?a===void 0?void 0:a:Ue(r,a)}}function $v(e,t){return e===ne?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function us(e,t){return e===ne?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}var _r={},Yv=100,Zv=20,ld=100,cs=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,yr(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,yr(t),e]}(),sa=cs[0],Ri=cs[1],la=cs[2],ud=Ri&&Ri.then,oi=sa&&sa.constructor,ds=!!la,ua=!1,Qv=la?function(){la.then(Yr)}:ae.setImmediate?setImmediate.bind(null,Yr):ae.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){Yr(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Yr,0)},br=function(e,t){ir.push([e,t]),Li&&(Qv(),Li=!1)},ca=!0,Li=!0,fn=[],ai=[],da=null,fa=Dr,Un={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Al,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Al(e[0],e[1])}catch{}})}},M=Un,ir=[],pn=0,si=[];function D(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ne,this._lib=!1;var t=this._PSD=M;if(gt&&(this._stackHolder=bn(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==_r)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&ha(this,this._value);return}this._state=null,this._value=null,++t.ref,dd(this,e)}var pa={get:function(){var e=M,t=Oi;function n(r,i){var o=this,a=!e.global&&(e!==M||t!==Oi),s=a&&!Dt(),l=new D(function(u,c){fs(o,new cd(Di(r,e,a,s),Di(i,e,a,s),u,c,e))});return gt&&hd(l,this),l}return n.prototype=_r,n},set:function(e){Nt(this,"then",e&&e.prototype===_r?pa:{get:function(){return e},set:pa.set})}};jn(D.prototype,{then:pa,_then:function(e,t){fs(this,new cd(null,null,e,t,M))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],n=arguments[1];return typeof t=="function"?this.then(null,function(r){return r instanceof t?n(r):li(r)}):this.then(null,function(r){return r&&r.name===t?n(r):li(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),li(t)})},stack:{get:function(){if(this._stack)return this._stack;try{ua=!0;var e=pd(this,[],Zv),t=e.join(`
37
- From previous: `);return this._state!==null&&(this._stack=t),t}finally{ua=!1}}},timeout:function(e,t){var n=this;return e<1/0?new D(function(r,i){var o=setTimeout(function(){return i(new B.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&Nt(D.prototype,Symbol.toStringTag,"Dexie.Promise");Un.env=md();function cd(e,t,n,r,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=i}jn(D,{all:function(){var e=Et.apply(null,arguments).map(Ni);return new D(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return D.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof D)return e;if(e&&typeof e.then=="function")return new D(function(n,r){e.then(n,r)});var t=new D(_r,!0,e);return hd(t,da),t},reject:li,race:function(){var e=Et.apply(null,arguments).map(Ni);return new D(function(t,n){e.map(function(r){return D.resolve(r).then(t,n)})})},PSD:{get:function(){return M},set:function(e){return M=e}},totalEchoes:{get:function(){return Oi}},newPSD:Wt,usePSD:Zn,scheduler:{get:function(){return br},set:function(e){br=e}},rejectionMapper:{get:function(){return fa},set:function(e){fa=e}},follow:function(e,t){return new D(function(n,r){return Wt(function(i,o){var a=M;a.unhandleds=[],a.onunhandled=o,a.finalize=gn(function(){var s=this;Xv(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});oi&&(oi.allSettled&&Nt(D,"allSettled",function(){var e=Et.apply(null,arguments).map(Ni);return new D(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return D.resolve(i).then(function(a){return r[o]={status:"fulfilled",value:a}},function(a){return r[o]={status:"rejected",reason:a}}).then(function(){return--n||t(r)})})})}),oi.any&&typeof AggregateError<"u"&&Nt(D,"any",function(){var e=Et.apply(null,arguments).map(Ni);return new D(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return D.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function dd(e,t){try{t(function(n){if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&Ur();n&&typeof n.then=="function"?dd(e,function(i,o){n instanceof D?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,fd(e)),r&&Pr()}},ha.bind(null,e))}catch(n){ha(e,n)}}function ha(e,t){if(ai.push(t),e._state===null){var n=e._lib&&Ur();t=fa(t),e._state=!1,e._value=t,gt&&t!==null&&typeof t=="object"&&!t._promise&&Nv(function(){var r=os(t,"stack");t._promise=e,Nt(t,"stack",{get:function(){return ua?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),ey(e),fd(e),n&&Pr()}}function fd(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)fs(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),pn===0&&(++pn,br(function(){--pn===0&&ps()},[]))}function fs(e,t){if(e._state===null){e._listeners.push(t);return}var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++pn,br(Jv,[n,e,t])}function Jv(e,t,n){try{da=t;var r,i=t._value;t._state?r=e(i):(ai.length&&(ai=[]),r=e(i),ai.indexOf(i)===-1&&ty(t)),n.resolve(r)}catch(o){n.reject(o)}finally{da=null,--pn===0&&ps(),--n.psd.ref||n.psd.finalize()}}function pd(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i=e._value,o,a;i!=null?(o=i.name||"Error",a=i.message||i,r=aa(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return gt&&(r=aa(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&pd(e._prev,t,n)),t}function hd(e,t){var n=t?t._numPrev+1:0;n<Yv&&(e._prev=t,e._numPrev=n)}function Yr(){Ur()&&Pr()}function Ur(){var e=ca;return ca=!1,Li=!1,e}function Pr(){var e,t,n;do for(;ir.length>0;)for(e=ir,ir=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(ir.length>0);ca=!0,Li=!0}function ps(){var e=fn;fn=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=si.slice(0),n=t.length;n;)t[--n]()}function Xv(e){function t(){e(),si.splice(si.indexOf(t),1)}si.push(t),++pn,br(function(){--pn===0&&ps()},[])}function ey(e){fn.some(function(t){return t._value===e._value})||fn.push(e)}function ty(e){for(var t=fn.length;t;)if(fn[--t]._value===e._value){fn.splice(t,1);return}}function li(e){return new D(_r,!1,e)}function ue(e,t){var n=M;return function(){var r=Ur(),i=M;try{return qt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{qt(i,!1),r&&Pr()}}}var Re={awaits:0,echoes:0,id:0},ny=0,ui=[],Co=0,Oi=0,ry=0;function Wt(e,t,n,r){var i=M,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++ry;var a=Un.env;o.env=ds?{Promise:D,PromiseProp:{value:D,configurable:!0,writable:!0},all:D.all,race:D.race,allSettled:D.allSettled,any:D.any,resolve:D.resolve,reject:D.reject,nthen:kl(a.nthen,o),gthen:kl(a.gthen,o)}:{},t&&Ue(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=Zn(o,e,n,r);return o.ref===0&&o.finalize(),s}function Yn(){return Re.id||(Re.id=++ny),++Re.awaits,Re.echoes+=ld,Re.id}function Dt(){return Re.awaits?(--Re.awaits===0&&(Re.id=0),Re.echoes=Re.awaits*ld,!0):!1}(""+ud).indexOf("[native code]")===-1&&(Yn=Dt=ne);function Ni(e){return Re.echoes&&e&&e.constructor===oi?(Yn(),e.then(function(t){return Dt(),t},function(t){return Dt(),we(t)})):e}function iy(e){++Oi,(!Re.echoes||--Re.echoes===0)&&(Re.echoes=Re.id=0),ui.push(M),qt(e,!0)}function oy(){var e=ui[ui.length-1];ui.pop(),qt(e,!1)}function qt(e,t){var n=M;if((t?Re.echoes&&(!Co++||e!==M):Co&&(!--Co||e!==M))&&gd(t?iy.bind(null,e):oy),e!==M&&(M=e,n===Un&&(Un.env=md()),ds)){var r=Un.env.Promise,i=e.env;Ri.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(ae,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function md(){var e=ae.Promise;return ds?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(ae,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Ri.then,gthen:e.prototype.then}:{}}function Zn(e,t,n,r,i){var o=M;try{return qt(e,!0),t(n,r,i)}finally{qt(o,!1)}}function gd(e){ud.call(sa,e)}function Di(e,t,n,r){return typeof e!="function"?e:function(){var i=M;n&&Yn(),qt(t,!0);try{return e.apply(this,arguments)}finally{qt(i,!1),r&&gd(Dt)}}}function kl(e,t){return function(n,r){return e.call(this,Di(n,t),Di(r,t))}}var xl="unhandledrejection";function Al(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(ae.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(xl,!0,!0),Ue(r,i)):ae.CustomEvent&&(r=new CustomEvent(xl,{detail:i}),Ue(r,i)),r&&ae.dispatchEvent&&(dispatchEvent(r),!ae.PromiseRejectionEvent&&ae.onunhandledrejection))try{ae.onunhandledrejection(r)}catch{}gt&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var we=D.reject;function ma(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!M.letThrough&&!e._vip){if(e._state.openComplete)return we(new B.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return we(new B.DatabaseClosed);e.open().catch(ne)}return e._state.dbReadyPromise.then(function(){return ma(e,t,n,r)})}else{var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===ls.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return ma(e,t,n,r)})):we(o)}return i._promise(t,function(o,a){return Wt(function(){return M.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var Tl="3.2.4",un=String.fromCharCode(65535),ga=-1/0,_t="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",vd="String expected.",dr=[],eo=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ay=eo,sy=eo,yd=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},to="__dbnames",Eo="readonly",So="readwrite";function vn(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var _d={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Zr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Nr(t),delete t[e]),t}:function(t){return t}}var ly=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||M.trans,o=this.name;function a(l,u,c){if(!c.schema[o])throw new B.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=Ur();try{return i&&i.db===this.db?i===M.trans?i._promise(t,a,r):Wt(function(){return i._promise(t,a,r)},{trans:i,transless:M.transless||M}):ma(this.db,t,[this.name],a)}finally{s&&Pr()}},e.prototype.get=function(t,n){var r=this;return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",function(i){return r.core.get({trans:i,key:t}).then(function(o){return r.hook.reading.fire(o)})}).then(n)},e.prototype.where=function(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(Le(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ve(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(c){return c.compound&&n.every(function(d){return c.keyPath.indexOf(d)>=0})&&c.keyPath.every(function(d){return n.indexOf(d)>=0})})[0];if(r&&this.db._maxKey!==un)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&gt&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var i=this.schema.idxByName,o=this.db._deps.indexedDB;function a(c,d){try{return o.cmp(c,d)===0}catch{return!1}}var s=n.reduce(function(c,d){var p=c[0],f=c[1],h=i[d],m=t[d];return[p||h,p||!h?vn(f,h&&h.multi?function(g){var b=Lt(g,d);return Le(b)&&b.some(function(y){return a(m,y)})}:function(g){return a(m,Lt(g,d))}):f]},[null,null]),l=s[0],u=s[1];return l?this.where(l.name).equals(t[l.keyPath]).filter(u):r?this.filter(u):this.where(n).equals("")},e.prototype.filter=function(t){return this.toCollection().and(t)},e.prototype.count=function(t){return this.toCollection().count(t)},e.prototype.offset=function(t){return this.toCollection().offset(t)},e.prototype.limit=function(t){return this.toCollection().limit(t)},e.prototype.each=function(t){return this.toCollection().each(t)},e.prototype.toArray=function(t){return this.toCollection().toArray(t)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,Le(t)?"["+t.join("+")+"]":t))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(t){this.schema.mappedClass=t;var n=function(r){if(!r)return r;var i=Object.create(t.prototype);for(var o in r)if(ze(r,o))try{i[o]=r[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t},e.prototype.defineClass=function(){function t(n){Ue(this,n)}return this.mapToClass(t)},e.prototype.add=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=Zr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"add",keys:n!=null?[n]:null,values:[s]})}).then(function(l){return l.numFailures?D.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{ot(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!Le(t)){var r=Lt(t,this.schema.primKey.keyPath);if(r===void 0)return we(new B.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ve(n).forEach(function(i){ot(t,i,n[i])}):n(t,{value:t,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}else return this.where(":id").equals(t).modify(n)},e.prototype.put=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=Zr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"put",values:[s],keys:n!=null?[n]:null})}).then(function(l){return l.numFailures?D.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{ot(t,a,l)}catch{}return l})},e.prototype.delete=function(t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"delete",keys:[t]})}).then(function(r){return r.numFailures?D.reject(r.failures[0]):void 0})},e.prototype.clear=function(){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"deleteRange",range:_d})}).then(function(n){return n.numFailures?D.reject(n.failures[0]):void 0})},e.prototype.bulkGet=function(t){var n=this;return this._trans("readonly",function(r){return n.core.getMany({keys:t,trans:r}).then(function(i){return i.map(function(o){return n.hook.reading.fire(o)})})})},e.prototype.bulkAdd=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new B.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new B.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=c&&u?t.map(Zr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:p,wantResults:a}).then(function(f){var h=f.numFailures,m=f.results,g=f.lastResult,b=f.failures,y=a?m:g;if(h===0)return y;throw new cr(i.name+".bulkAdd(): "+h+" of "+d+" operations failed",b)})})},e.prototype.bulkPut=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new B.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new B.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=c&&u?t.map(Zr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:p,wantResults:a}).then(function(f){var h=f.numFailures,m=f.results,g=f.lastResult,b=f.failures,y=a?m:g;if(h===0)return y;throw new cr(i.name+".bulkPut(): "+h+" of "+d+" operations failed",b)})})},e.prototype.bulkDelete=function(t){var n=this,r=t.length;return this._trans("readwrite",function(i){return n.core.mutate({trans:i,type:"delete",keys:t})}).then(function(i){var o=i.numFailures,a=i.lastResult,s=i.failures;if(o===0)return a;throw new cr(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function Mr(e){var t={},n=function(s,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return t[s].subscribe.apply(null,c),e}else if(typeof s=="string")return t[s]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(s,l,u){if(typeof s=="object")return a(s);l||(l=$v),u||(u=ne);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(p){return p!==d}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){ve(s).forEach(function(l){var u=s[l];if(Le(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Dr,function(){for(var p=arguments.length,f=new Array(p);p--;)f[p]=arguments[p];c.subscribers.forEach(function(h){Xc(function(){h.apply(null,f)})})});else throw new B.InvalidArgument("Invalid event config")})}}function Vr(e,t){return qn(t).from({prototype:e}),t}function uy(e){return Vr(ly.prototype,function(n,r,i){this.db=e,this._tx=i,this.name=n,this.schema=r,this.hook=e._allTables[n]?e._allTables[n].hook:Mr(null,{creating:[Kv,ne],reading:[Gv,Dr],updating:[qv,ne],deleting:[Wv,ne]})})}function In(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Io(e,t){e.filter=vn(e.filter,t)}function ko(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return vn(r(),t())}:t,e.justLimit=n&&!r}function cy(e,t){e.isMatch=vn(e.isMatch,t)}function ci(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new B.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Rl(e,t,n){var r=ci(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function Qr(e,t,n,r){var i=e.replayFilter?vn(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(p){return l.stop(p)},function(p){return l.fail(p)})){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),ze(o,d)||(o[d]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Ll(Rl(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Ll(Rl(e,r,n),vn(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Ll(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=ue(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(l){return s=l},function(l){a.stop(l),s=ne},function(l){a.fail(l),s=ne}))&&o(a.value,a,function(l){return s=l}),s()})})}function De(e,t){try{var n=Ol(e),r=Ol(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return fy(Nl(e),Nl(t));case"Array":return dy(e,t)}}catch{}return NaN}function dy(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=De(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function fy(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}function Ol(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=ia(e);return n==="ArrayBuffer"?"binary":n}function Nl(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var py=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,we.bind(null,r.error)):r.table._trans("readonly",t).then(n)},e.prototype._write=function(t){var n=this._ctx;return n.error?n.table._trans(null,we.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=vn(n.algorithm,t)},e.prototype._iterate=function(t,n){return Qr(this._ctx,t,n,this._ctx.table.core)},e.prototype.clone=function(t){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&Ue(r,t),n._ctx=r,n},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(t){var n=this._ctx;return this._read(function(r){return Qr(n,t,r,n.table.core)})},e.prototype.count=function(t){var n=this;return this._read(function(r){var i=n._ctx,o=i.table.core;if(In(i,!0))return o.count({trans:r,query:{index:ci(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return Qr(i,function(){return++a,!1},r,o).then(function(){return a})}).then(t)},e.prototype.sortBy=function(t,n){var r=t.split(".").reverse(),i=r[0],o=r.length-1;function a(u,c){return c?a(u[r[c]],c-1):u[i]}var s=this._ctx.dir==="next"?1:-1;function l(u,c){var d=a(u,o),p=a(c,o);return d<p?-s:d>p?s:0}return this.toArray(function(u){return u.sort(l)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&In(i,!0)&&i.limit>0){var o=i.valueMapper,a=ci(i,i.table.core.schema);return i.table.core.query({trans:r,limit:i.limit,values:!0,query:{index:a,range:i.range}}).then(function(l){var u=l.result;return o?u.map(o):u})}else{var s=[];return Qr(i,function(l){return s.push(l)},r,i.table.core).then(function(){return s})}},t)},e.prototype.offset=function(t){var n=this._ctx;return t<=0?this:(n.offset+=t,In(n)?ko(n,function(){var r=t;return function(i,o){return r===0?!0:r===1?(--r,!1):(o(function(){i.advance(r),r=0}),!1)}}):ko(n,function(){var r=t;return function(){return--r<0}}),this)},e.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),ko(this._ctx,function(){var n=t;return function(r,i,o){return--n<=0&&i(o),n>=0}},!0),this},e.prototype.until=function(t,n){return Io(this._ctx,function(r,i,o){return t(r.value)?(i(o),n):!0}),this},e.prototype.first=function(t){return this.limit(1).toArray(function(n){return n[0]}).then(t)},e.prototype.last=function(t){return this.reverse().first(t)},e.prototype.filter=function(t){return Io(this._ctx,function(n){return t(n.value)}),cy(this._ctx,t),this},e.prototype.and=function(t){return this.filter(t)},e.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},e.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.key,i)})},e.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},e.prototype.eachPrimaryKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.primaryKey,i)})},e.prototype.keys=function(t){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.key)}).then(function(){return r}).then(t)},e.prototype.primaryKeys=function(t){var n=this._ctx;if(n.dir==="next"&&In(n,!0)&&n.limit>0)return this._read(function(i){var o=ci(n,n.table.core.schema);return n.table.core.query({trans:i,values:!1,limit:n.limit,query:{index:o,range:n.range}})}).then(function(i){var o=i.result;return o}).then(t);n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.primaryKey)}).then(function(){return r}).then(t)},e.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},e.prototype.firstKey=function(t){return this.limit(1).keys(function(n){return n[0]}).then(t)},e.prototype.lastKey=function(t){return this.reverse().firstKey(t)},e.prototype.distinct=function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return Io(this._ctx,function(i){var o=i.primaryKey.toString(),a=ze(r,o);return r[o]=!0,!a}),this},e.prototype.modify=function(t){var n=this,r=this._ctx;return this._write(function(i){var o;if(typeof t=="function")o=t;else{var a=ve(t),s=a.length;o=function(b){for(var y=!1,_=0;_<s;++_){var v=a[_],w=t[v];Lt(b,v)!==w&&(ot(b,v,w),y=!0)}return y}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,d=u.extractKey,p=n.db._options.modifyChunkSize||200,f=[],h=0,m=[],g=function(b,y){var _=y.failures,v=y.numFailures;h+=b-v;for(var w=0,E=ve(_);w<E.length;w++){var I=E[w];f.push(_[I])}};return n.clone().primaryKeys().then(function(b){var y=function(_){var v=Math.min(p,b.length-_);return l.getMany({trans:i,keys:b.slice(_,_+v),cache:"immutable"}).then(function(w){for(var E=[],I=[],S=c?[]:null,x=[],T=0;T<v;++T){var A=w[T],L={value:Nr(A),primKey:b[_+T]};o.call(L,L.value,L)!==!1&&(L.value==null?x.push(b[_+T]):!c&&De(d(A),d(L.value))!==0?(x.push(b[_+T]),E.push(L.value)):(I.push(L.value),c&&S.push(b[_+T])))}var k=In(r)&&r.limit===1/0&&(typeof t!="function"||t===xo)&&{index:r.index,range:r.range};return Promise.resolve(E.length>0&&l.mutate({trans:i,type:"add",values:E}).then(function(U){for(var R in U.failures)x.splice(parseInt(R),1);g(E.length,U)})).then(function(){return(I.length>0||k&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:S,values:I,criteria:k,changeSpec:typeof t!="function"&&t}).then(function(U){return g(I.length,U)})}).then(function(){return(x.length>0||k&&t===xo)&&l.mutate({trans:i,type:"delete",keys:x,criteria:k}).then(function(U){return g(x.length,U)})}).then(function(){return b.length>_+v&&y(_+p)})})};return y(0).then(function(){if(f.length>0)throw new Ti("Error modifying one or more objects",f,h,m);return b.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return In(t)&&(t.isPrimKey&&!sy||n.type===3)?this._write(function(r){var i=t.table.core.schema.primaryKey,o=n;return t.table.core.count({trans:r,query:{index:i,range:o}}).then(function(a){return t.table.core.mutate({trans:r,type:"deleteRange",range:o}).then(function(s){var l=s.failures;s.lastResult,s.results;var u=s.numFailures;if(u)throw new Ti("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(xo)},e}(),xo=function(e,t){return t.value=null};function hy(e){return Vr(py.prototype,function(n,r){this.db=e;var i=_d,o=null;if(r)try{i=r()}catch(u){o=u}var a=n._ctx,s=a.table,l=s.hook.reading.fire;this._ctx={table:s,index:a.index,isPrimKey:!a.index||s.schema.primKey.keyPath&&a.index===s.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:a.or,valueMapper:l!==Dr?l:null}})}function my(e,t){return e<t?-1:e===t?0:1}function gy(e,t){return e>t?-1:e===t?0:1}function Be(e,t,n){var r=e instanceof wd?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function kn(e){return new e.Collection(e,function(){return bd("")}).limit(0)}function vy(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function yy(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function _y(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var u=t[l];if(u!==r[l])return i(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):i(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[l],u)<0&&(s=l)}return a<r.length&&o==="next"?e+n.substr(e.length):a<e.length&&o==="prev"?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}function Jr(e,t,n,r){var i,o,a,s,l,u,c,d=n.length;if(!n.every(function(m){return typeof m=="string"}))return Be(e,vd);function p(m){i=vy(m),o=yy(m),a=m==="next"?my:gy;var g=n.map(function(b){return{lower:o(b),upper:i(b)}}).sort(function(b,y){return a(b.lower,y.lower)});s=g.map(function(b){return b.upper}),l=g.map(function(b){return b.lower}),u=m,c=m==="next"?"":r}p("next");var f=new e.Collection(e,function(){return Mt(s[0],l[d-1]+r)});f._ondirectionchange=function(m){p(m)};var h=0;return f._addAlgorithm(function(m,g,b){var y=m.key;if(typeof y!="string")return!1;var _=o(y);if(t(_,l,h))return!0;for(var v=null,w=h;w<d;++w){var E=_y(y,_,s[w],l[w],a,u);E===null&&v===null?h=w+1:(v===null||a(v,E)>0)&&(v=E)}return g(v!==null?function(){m.continue(v+c)}:b),!1}),f}function Mt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function bd(e){return{type:1,lower:e,upper:e}}var wd=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(t,n,r,i){r=r!==!1,i=i===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(r||i)&&!(r&&i)?kn(this):new this.Collection(this,function(){return Mt(t,n,!r,!i)})}catch{return Be(this,_t)}},e.prototype.equals=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return bd(t)})},e.prototype.above=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(t,void 0,!1)})},e.prototype.below=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?Be(this,vd):this.between(t,t+un,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):Jr(this,function(n,r){return n.indexOf(r[0])===0},[t],un)},e.prototype.equalsIgnoreCase=function(t){return Jr(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Et.apply(An,arguments);return t.length===0?kn(this):Jr(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Et.apply(An,arguments);return t.length===0?kn(this):Jr(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,un)},e.prototype.anyOf=function(){var t=this,n=Et.apply(An,arguments),r=this._cmp;try{n.sort(r)}catch{return Be(this,_t)}if(n.length===0)return kn(this);var i=new this.Collection(this,function(){return Mt(n[0],n[n.length-1])});i._ondirectionchange=function(a){r=a==="next"?t._ascending:t._descending,n.sort(r)};var o=0;return i._addAlgorithm(function(a,s,l){for(var u=a.key;r(u,n[o])>0;)if(++o,o===n.length)return s(l),!1;return r(u,n[o])===0?!0:(s(function(){a.continue(n[o])}),!1)}),i},e.prototype.notEqual=function(t){return this.inAnyRange([[ga,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Et.apply(An,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Be(this,_t)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[ga,i]]},null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(t,n){var r=this,i=this._cmp,o=this._ascending,a=this._descending,s=this._min,l=this._max;if(t.length===0)return kn(this);if(!t.every(function(w){return w[0]!==void 0&&w[1]!==void 0&&o(w[0],w[1])<=0}))return Be(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",B.InvalidArgument);var u=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;function d(w,E){for(var I=0,S=w.length;I<S;++I){var x=w[I];if(i(E[0],x[1])<0&&i(E[1],x[0])>0){x[0]=s(x[0],E[0]),x[1]=l(x[1],E[1]);break}}return I===S&&w.push(E),w}var p=o;function f(w,E){return p(w[0],E[0])}var h;try{h=t.reduce(d,[]),h.sort(f)}catch{return Be(this,_t)}var m=0,g=c?function(w){return o(w,h[m][1])>0}:function(w){return o(w,h[m][1])>=0},b=u?function(w){return a(w,h[m][0])>0}:function(w){return a(w,h[m][0])>=0};function y(w){return!g(w)&&!b(w)}var _=g,v=new this.Collection(this,function(){return Mt(h[0][0],h[h.length-1][1],!u,!c)});return v._ondirectionchange=function(w){w==="next"?(_=g,p=o):(_=b,p=a),h.sort(f)},v._addAlgorithm(function(w,E,I){for(var S=w.key;_(S);)if(++m,m===h.length)return E(I),!1;return y(S)?!0:(r._cmp(S,h[m][1])===0||r._cmp(S,h[m][0])===0||E(function(){p===o?w.continue(h[m][0]):w.continue(h[m][1])}),!1)}),v},e.prototype.startsWithAnyOf=function(){var t=Et.apply(An,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?kn(this):this.inAnyRange(t.map(function(n){return[n,n+un]})):Be(this,"startsWithAnyOf() only works with strings")},e}();function by(e){return Vr(wd.prototype,function(n,r,i){this.db=e,this._ctx={table:n,index:r===":id"?null:r,or:i};var o=e._deps.indexedDB;if(!o)throw new B.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=function(a,s){return o.cmp(s,a)},this._max=function(a,s){return o.cmp(a,s)>0?a:s},this._min=function(a,s){return o.cmp(a,s)<0?a:s},this._IDBKeyRange=e._deps.IDBKeyRange})}function lt(e){return ue(function(t){return wr(t),e(t.target.error),!1})}function wr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Cr="storagemutated",zt="x-storagemutated-1",$t=Mr(null,Cr),wy=function(){function e(){}return e.prototype._lock=function(){return rr(!M.global),++this._reculock,this._reculock===1&&!M.global&&(M.lockOwnerFor=this),this},e.prototype._unlock=function(){if(rr(!M.global),--this._reculock===0)for(M.global||(M.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{Zn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&M.lockOwnerFor!==this},e.prototype.create=function(t){var n=this;if(!this.mode)return this;var r=this.db.idbdb,i=this.db._state.dbOpenError;if(rr(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new B.DatabaseClosed(i);case"MissingAPIError":throw new B.MissingAPI(i.message,i);default:throw new B.OpenFailed(i)}if(!this.active)throw new B.TransactionInactive;return rr(this._completion._state===null),t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),t.onerror=ue(function(o){wr(o),n._reject(t.error)}),t.onabort=ue(function(o){wr(o),n.active&&n._reject(new B.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=ue(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&$t.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return we(new B.ReadOnly("Transaction is readonly"));if(!this.active)return we(new B.TransactionInactive);if(this._locked())return new D(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},M])});if(r)return Wt(function(){var a=new D(function(s,l){i._lock();var u=n(s,l,i);u&&u.then&&u.then(s,l)});return a.finally(function(){return i._unlock()}),a._lib=!0,a});var o=new D(function(a,s){var l=n(a,s,i);l&&l.then&&l.then(a,s)});return o._lib=!0,o},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(t){var n=this._root(),r=D.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then(function(){return r});else{n._waitingFor=r,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);(function a(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=a)})()}var o=n._waitingFor;return new D(function(a,s){r.then(function(l){return n._waitingQueue.push(ue(a.bind(null,l)))},function(l){return n._waitingQueue.push(ue(s.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new B.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(ze(n,t))return n[t];var r=this.schema[t];if(!r)throw new B.NotFound("Table "+t+" not part of transaction");var i=new this.db.Table(t,r,this);return i.core=this.db.core.table(t),n[t]=i,i},e}();function Cy(e){return Vr(wy.prototype,function(n,r,i,o,a){var s=this;this.db=e,this.mode=n,this.storeNames=r,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=Mr(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new D(function(l,u){s._resolve=l,s._reject=u}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(l){var u=s.active;return s.active=!1,s.on.error.fire(l),s.parent?s.parent._reject(l):u&&s.idbtrans&&s.idbtrans.abort(),we(l)})})}function va(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+Cd(t)}}function Cd(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Ed(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:ed(n,function(r){return[r.name,r]})}}function Ey(e){return e.length===1?e[0]:e}var Er=function(e){try{return e.only([[]]),Er=function(){return[[]]},[[]]}catch{return Er=function(){return un},un}};function ya(e){return e==null?function(){}:typeof e=="string"?Sy(e):function(t){return Lt(t,e)}}function Sy(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return Lt(n,e)}}function Dl(e){return[].slice.call(e)}var Iy=0;function fr(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function ky(e,t,n){function r(d,p){var f=Dl(d.objectStoreNames);return{schema:{name:d.name,tables:f.map(function(h){return p.objectStore(h)}).map(function(h){var m=h.keyPath,g=h.autoIncrement,b=Le(m),y=m==null,_={},v={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:b,keyPath:m,autoIncrement:g,unique:!0,extractKey:ya(m)},indexes:Dl(h.indexNames).map(function(w){return h.index(w)}).map(function(w){var E=w.name,I=w.unique,S=w.multiEntry,x=w.keyPath,T=Le(x),A={name:E,compound:T,keyPath:x,unique:I,multiEntry:S,extractKey:ya(x)};return _[fr(x)]=A,A}),getIndexByKeyPath:function(w){return _[fr(w)]}};return _[":id"]=v.primaryKey,m!=null&&(_[fr(m)]=v.primaryKey),v})},hasGetAll:f.length>0&&"getAll"in p.objectStore(f[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(d){if(d.type===3)return null;if(d.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var p=d.lower,f=d.upper,h=d.lowerOpen,m=d.upperOpen,g=p===void 0?f===void 0?null:t.upperBound(f,!!m):f===void 0?t.lowerBound(p,!!h):t.bound(p,f,!!h,!!m);return g}function o(d){var p=d.name;function f(g){var b=g.trans,y=g.type,_=g.keys,v=g.values,w=g.range;return new Promise(function(E,I){E=ue(E);var S=b.objectStore(p),x=S.keyPath==null,T=y==="put"||y==="add";if(!T&&y!=="delete"&&y!=="deleteRange")throw new Error("Invalid operation type: "+y);var A=(_||v||{length:1}).length;if(_&&v&&_.length!==v.length)throw new Error("Given keys array must have same length as given values array.");if(A===0)return E({numFailures:0,failures:{},results:[],lastResult:void 0});var L,k=[],U=[],R=0,V=function(Q){++R,wr(Q)};if(y==="deleteRange"){if(w.type===4)return E({numFailures:R,failures:U,results:[],lastResult:void 0});w.type===3?k.push(L=S.clear()):k.push(L=S.delete(i(w)))}else{var K=T?x?[v,_]:[v,null]:[_,null],z=K[0],ie=K[1];if(T)for(var oe=0;oe<A;++oe)k.push(L=ie&&ie[oe]!==void 0?S[y](z[oe],ie[oe]):S[y](z[oe])),L.onerror=V;else for(var oe=0;oe<A;++oe)k.push(L=S[y](z[oe])),L.onerror=V}var fe=function(Q){var Ke=Q.target.result;k.forEach(function(Ie,yt){return Ie.error!=null&&(U[yt]=Ie.error)}),E({numFailures:R,failures:U,results:y==="delete"?_:k.map(function(Ie){return Ie.result}),lastResult:Ke})};L.onerror=function(Q){V(Q),fe(Q)},L.onsuccess=fe})}function h(g){var b=g.trans,y=g.values,_=g.query,v=g.reverse,w=g.unique;return new Promise(function(E,I){E=ue(E);var S=_.index,x=_.range,T=b.objectStore(p),A=S.isPrimaryKey?T:T.index(S.name),L=v?w?"prevunique":"prev":w?"nextunique":"next",k=y||!("openKeyCursor"in A)?A.openCursor(i(x),L):A.openKeyCursor(i(x),L);k.onerror=lt(I),k.onsuccess=ue(function(U){var R=k.result;if(!R){E(null);return}R.___id=++Iy,R.done=!1;var V=R.continue.bind(R),K=R.continuePrimaryKey;K&&(K=K.bind(R));var z=R.advance.bind(R),ie=function(){throw new Error("Cursor not started")},oe=function(){throw new Error("Cursor not stopped")};R.trans=b,R.stop=R.continue=R.continuePrimaryKey=R.advance=ie,R.fail=ue(I),R.next=function(){var fe=this,Q=1;return this.start(function(){return Q--?fe.continue():fe.stop()}).then(function(){return fe})},R.start=function(fe){var Q=new Promise(function(Ie,yt){Ie=ue(Ie),k.onerror=lt(yt),R.fail=yt,R.stop=function(Fe){R.stop=R.continue=R.continuePrimaryKey=R.advance=oe,Ie(Fe)}}),Ke=function(){if(k.result)try{fe()}catch(Ie){R.fail(Ie)}else R.done=!0,R.start=function(){throw new Error("Cursor behind last entry")},R.stop()};return k.onsuccess=ue(function(Ie){k.onsuccess=Ke,Ke()}),R.continue=V,R.continuePrimaryKey=K,R.advance=z,Ke(),Q},E(R)},I)})}function m(g){return function(b){return new Promise(function(y,_){y=ue(y);var v=b.trans,w=b.values,E=b.limit,I=b.query,S=E===1/0?void 0:E,x=I.index,T=I.range,A=v.objectStore(p),L=x.isPrimaryKey?A:A.index(x.name),k=i(T);if(E===0)return y({result:[]});if(g){var U=w?L.getAll(k,S):L.getAllKeys(k,S);U.onsuccess=function(z){return y({result:z.target.result})},U.onerror=lt(_)}else{var R=0,V=w||!("openKeyCursor"in L)?L.openCursor(k):L.openKeyCursor(k),K=[];V.onsuccess=function(z){var ie=V.result;if(!ie)return y({result:K});if(K.push(w?ie.value:ie.primaryKey),++R===E)return y({result:K});ie.continue()},V.onerror=lt(_)}})}}return{name:p,schema:d,mutate:f,getMany:function(g){var b=g.trans,y=g.keys;return new Promise(function(_,v){_=ue(_);for(var w=b.objectStore(p),E=y.length,I=new Array(E),S=0,x=0,T,A=function(R){var V=R.target;(I[V._pos]=V.result)!=null,++x===S&&_(I)},L=lt(v),k=0;k<E;++k){var U=y[k];U!=null&&(T=w.get(y[k]),T._pos=k,T.onsuccess=A,T.onerror=L,++S)}S===0&&_(I)})},get:function(g){var b=g.trans,y=g.key;return new Promise(function(_,v){_=ue(_);var w=b.objectStore(p),E=w.get(y);E.onsuccess=function(I){return _(I.target.result)},E.onerror=lt(v)})},query:m(l),openCursor:h,count:function(g){var b=g.query,y=g.trans,_=b.index,v=b.range;return new Promise(function(w,E){var I=y.objectStore(p),S=_.isPrimaryKey?I:I.index(_.name),x=i(v),T=x?S.count(x):S.count();T.onsuccess=ue(function(A){return w(A.target.result)}),T.onerror=lt(E)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(d){return o(d)}),c={};return u.forEach(function(d){return c[d.name]=d}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(d){var p=c[d];if(!p)throw new Error("Table '"+d+"' not found");return c[d]},MIN_KEY:-1/0,MAX_KEY:Er(t),schema:s}}function xy(e,t){return t.reduce(function(n,r){var i=r.create;return $($({},n),i(n))},e)}function Ay(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=xy(ky(t,i,r),e.dbcore);return{dbcore:o}}function hs(e,t){var n=e._novip,r=t.db,i=Ay(n._middlewares,r,n._deps,t);n.core=i.dbcore,n.tables.forEach(function(o){var a=o.name;n.core.schema.tables.some(function(s){return s.name===a})&&(o.core=n.core.table(a),n[a]instanceof n.Table&&(n[a].core=o.core))})}function Ui(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=os(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?Nt(s,o,{get:function(){return this.table(o)},set:function(u){Qc(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function _a(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Ty(e,t){return e._cfg.version-t._cfg.version}function Ry(e,t,n,r){var i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var a=o._reject.bind(o),s=M.transless||M;Wt(function(){M.trans=o,M.transless=s,t===0?(ve(i).forEach(function(l){ms(n,l,i[l].primKey,i[l].indexes)}),hs(e,n),D.follow(function(){return e.on.populate.fire(o)}).catch(a)):Ly(e,t,o,n).catch(a)})}function Ly(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=gs(i,i.idbdb,r),l=!1,u=a.filter(function(d){return d._cfg.version>=t});u.forEach(function(d){o.push(function(){var p=s,f=d._cfg.dbschema;wa(i,p,r),wa(i,f,r),s=i._dbSchema=f;var h=Sd(p,f);h.add.forEach(function(v){ms(r,v[0],v[1].primKey,v[1].indexes)}),h.change.forEach(function(v){if(v.recreate)throw new B.Upgrade("Not yet support for changing primary key");var w=r.objectStore(v.name);v.add.forEach(function(E){return ba(w,E)}),v.change.forEach(function(E){w.deleteIndex(E.name),ba(w,E)}),v.del.forEach(function(E){return w.deleteIndex(E)})});var m=d._cfg.contentUpgrade;if(m&&d._cfg.version>t){hs(i,r),n._memoizedTables={},l=!0;var g=td(f);h.del.forEach(function(v){g[v]=p[v]}),_a(i,[i.Transaction.prototype]),Ui(i,[i.Transaction.prototype],ve(g),g),n.schema=g;var b=as(m);b&&Yn();var y,_=D.follow(function(){if(y=m(n),y&&b){var v=Dt.bind(null,null);y.then(v,v)}});return y&&typeof y.then=="function"?D.resolve(y):_.then(function(){return y})}}),o.push(function(p){if(!l||!ay){var f=d._cfg.dbschema;Ny(f,p)}_a(i,[i.Transaction.prototype]),Ui(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?D.resolve(o.shift()(n.idbtrans)).then(c):D.resolve()}return c().then(function(){Oy(s,r)})}function Sd(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],o=t[r];if(!i)n.add.push([r,o]);else{var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!eo)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,l=o.idxByName,u=void 0;for(u in s)l[u]||a.del.push(u);for(u in l){var c=s[u],d=l[u];c?c.src!==d.src&&a.change.push(d):a.add.push(d)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function ms(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(o){return ba(i,o)}),i}function Oy(e,t){ve(e).forEach(function(n){t.db.objectStoreNames.contains(n)||ms(t,n,e[n].primKey,e[n].indexes)})}function Ny(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function ba(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function gs(e,t,n){var r={},i=Ji(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=va(Cd(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var d=a.index(a.indexNames[c]);s=d.keyPath;var p=va(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);u.push(p)}r[o]=Ed(o,l,u)}),r}function Dy(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=gs(r,t,n);r._storeNames=Ji(t.objectStoreNames,0),Ui(r,[r._allTables],ve(i),i)}function Uy(e,t){var n=gs(e,e.idbdb,t),r=Sd(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function wa(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var l=0;l<s.indexNames.length;++l){var u=s.indexNames[l],c=s.index(u).keyPath,d=typeof c=="string"?c:"["+Ji(c).join("+")+"]";if(t[a]){var p=t[a].idxByName[d];p&&(p.name=u,delete t[a].idxByName[d],t[a].idxByName[u]=p)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&ae.WorkerGlobalScope&&ae instanceof ae.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function Py(e){return e.split(",").map(function(t,n){t=t.trim();var r=t.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return va(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),Le(i),n===0)})}var My=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ve(t).forEach(function(r){if(t[r]!==null){var i=Py(t[r]),o=i.shift();if(o.multi)throw new B.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new B.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new B.Schema("Index must have a name and cannot be an empty string")}),n[r]=Ed(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?Ue(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){Ue(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,_a(n,[n._allTables,n,n.Transaction.prototype]),Ui(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ve(o),o),n._storeNames=ve(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=us(this._cfg.contentUpgrade||ne,t),this},e}();function Vy(e){return Vr(My.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function vs(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ws(to,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function ys(e){return e&&typeof e.databases=="function"}function Fy(e){var t=e.indexedDB,n=e.IDBKeyRange;return ys(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==to})}):vs(t,n).toCollection().primaryKeys()}function By(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!ys(n)&&t!==to&&vs(n,r).put({name:t}).catch(ne)}function jy(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!ys(n)&&t!==to&&vs(n,r).delete(t).catch(ne)}function Ca(e){return Wt(function(){return M.letThrough=!0,e()})}function Hy(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise(function(n){var r=function(){return indexedDB.databases().finally(n)};t=setInterval(r,100),r()}).finally(function(){return clearInterval(t)})}function zy(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?we(t.dbOpenError):e});gt&&(t.openCanceller._stackHolder=bn()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new B.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return D.race([r,(typeof navigator>"u"?D.resolve():Hy()).then(function(){return new D(function(l,u){if(i(),!n)throw new B.MissingAPI;var c=e.name,d=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!d)throw new B.MissingAPI;d.onerror=lt(u),d.onblocked=ue(e._fireOnBlocked),d.onupgradeneeded=ue(function(p){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=wr,a.abort(),d.result.close();var f=n.deleteDatabase(c);f.onsuccess=f.onerror=ue(function(){u(new B.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=lt(u);var h=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;s=h<1,e._novip.idbdb=d.result,Ry(e,h/10,a,u)}},u),d.onsuccess=ue(function(){a=null;var p=e._novip.idbdb=d.result,f=Ji(p.objectStoreNames);if(f.length>0)try{var h=p.transaction(Ey(f),"readonly");t.autoSchema?Dy(e,p,h):(wa(e,e._dbSchema,h),Uy(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),hs(e,h)}catch{}dr.push(e),p.onversionchange=ue(function(m){t.vcFired=!0,e.on("versionchange").fire(m)}),p.onclose=ue(function(m){e.on("close").fire(m)}),s&&By(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],D.resolve(Ca(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(us,ne);return t.onReadyBeingFired=[],D.resolve(Ca(function(){return u(e.vip)})).then(l)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(l){t.dbOpenError=l;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),we(l)}).finally(function(){t.openComplete=!0,o()})}function Ea(e){var t=function(a){return e.next(a)},n=function(a){return e.throw(a)},r=o(t),i=o(n);function o(a){return function(s){var l=a(s),u=l.value;return l.done?u:!u||typeof u.then!="function"?Le(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function Gy(e,t,n){var r=arguments.length;if(r<2)throw new B.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=nd(i);return[e,o,n]}function Id(e,t,n,r,i){return D.resolve().then(function(){var o=M.transless||M,a=e._createTransaction(t,n,e._dbSchema,r),s={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(d){return d.name===ls.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Id(e,t,n,null,i)})):we(d)}var l=as(i);l&&Yn();var u,c=D.follow(function(){if(u=i.call(a,a),u)if(l){var d=Dt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Ea(u))},s);return(u&&typeof u.then=="function"?D.resolve(u).then(function(d){return a.active?d:we(new B.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(d){return r&&a._resolve(),a._completion.then(function(){return d})}).catch(function(d){return a._reject(d),we(d)})})}function Xr(e,t,n){for(var r=Le(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Ky(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(m,g,b){var y=fr(m),_=i[y]=i[y]||[],v=m==null?0:typeof m=="string"?1:m.length,w=g>0,E=$($({},b),{isVirtual:w,keyTail:g,keyLength:v,extractKey:ya(m),unique:!w&&b.unique});if(_.push(E),E.isPrimaryKey||o.push(E),v>1){var I=v===2?m[0]:m.slice(0,v-1);a(I,g+1,b)}return _.sort(function(S,x){return S.keyTail-x.keyTail}),E}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var l=0,u=r.indexes;l<u.length;l++){var c=u[l];a(c.keyPath,0,c)}function d(m){var g=i[fr(m)];return g&&g[0]}function p(m,g){return{type:m.type===1?2:m.type,lower:Xr(m.lower,m.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:Xr(m.upper,m.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function f(m){var g=m.query.index;return g.isVirtual?$($({},m),{query:{index:g,range:p(m.query.range,g.keyTail)}}):m}var h=$($({},n),{schema:$($({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:d}),count:function(m){return n.count(f(m))},query:function(m){return n.query(f(m))},openCursor:function(m){var g=m.query.index,b=g.keyTail,y=g.isVirtual,_=g.keyLength;if(!y)return n.openCursor(m);function v(w){function E(S){S!=null?w.continue(Xr(S,m.reverse?e.MAX_KEY:e.MIN_KEY,b)):m.unique?w.continue(w.key.slice(0,_).concat(m.reverse?e.MIN_KEY:e.MAX_KEY,b)):w.continue()}var I=Object.create(w,{continue:{value:E},continuePrimaryKey:{value:function(S,x){w.continuePrimaryKey(Xr(S,e.MAX_KEY,b),x)}},primaryKey:{get:function(){return w.primaryKey}},key:{get:function(){var S=w.key;return _===1?S[0]:S.slice(0,_)}},value:{get:function(){return w.value}}});return I}return n.openCursor(f(m)).then(function(w){return w&&v(w)})}});return h}})}var Wy={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Ky};function _s(e,t,n,r){return n=n||{},r=r||"",ve(e).forEach(function(i){if(!ze(t,i))n[r+i]=void 0;else{var o=e[i],a=t[i];if(typeof o=="object"&&typeof a=="object"&&o&&a){var s=ia(o),l=ia(a);s!==l?n[r+i]=t[i]:s==="Object"?_s(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),ve(t).forEach(function(i){ze(e,i)||(n[r+i]=t[i])}),n}function qy(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var $y={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=$($({},n),{mutate:function(o){var a=M.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"put":if(u.fire===ne&&c.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(l.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(l.fire===ne)break;return a._promise("readwrite",function(){return p(o)},!0)}return n.mutate(o);function d(h){var m=M.trans,g=h.keys||qy(r,h);if(!g)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?$($({},h),{keys:g}):$({},h),h.type!=="delete"&&(h.values=na([],h.values,!0)),h.keys&&(h.keys=na([],h.keys,!0)),Yy(n,h,g).then(function(b){var y=g.map(function(_,v){var w=b[v],E={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(E,_,w,m);else if(h.type==="add"||w===void 0){var I=u.fire.call(E,_,h.values[v],m);_==null&&I!=null&&(_=I,h.keys[v]=_,r.outbound||ot(h.values[v],r.keyPath,_))}else{var S=_s(w,h.values[v]),x=c.fire.call(E,S,_,w,m);if(x){var T=h.values[v];Object.keys(x).forEach(function(A){ze(T,A)?T[A]=x[A]:ot(T,A,x[A])})}}return E});return n.mutate(h).then(function(_){for(var v=_.failures,w=_.results,E=_.numFailures,I=_.lastResult,S=0;S<g.length;++S){var x=w?w[S]:g[S],T=y[S];x==null?T.onerror&&T.onerror(v[S]):T.onsuccess&&T.onsuccess(h.type==="put"&&b[S]?h.values[S]:x)}return{failures:v,results:w,numFailures:E,lastResult:I}}).catch(function(_){return y.forEach(function(v){return v.onerror&&v.onerror(_)}),Promise.reject(_)})})}function p(h){return f(h.trans,h.range,1e4)}function f(h,m,g){return n.query({trans:h,values:!1,query:{index:r,range:m},limit:g}).then(function(b){var y=b.result;return d({type:"delete",keys:y,trans:h}).then(function(_){return _.numFailures>0?Promise.reject(_.failures[0]):y.length<g?{failures:[],numFailures:0,lastResult:void 0}:f(h,$($({},m),{lower:y[y.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function Yy(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function kd(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)De(t.keys[i],e[o])===0&&(r.push(n?Nr(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var Zy={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return $($({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=kd(r.keys,r.trans._cache,r.cache==="clone");return i?D.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Nr(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},Ao;function bs(e){return!("from"in e)}var wt=function(e,t){if(this)Ue(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new wt;return e&&"d"in e&&Ue(n,e),n}};jn(wt.prototype,(Ao={add:function(e){return Pi(this,e),this},addKey:function(e){return Sr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Sr(t,n,n)}),this}},Ao[oa]=function(){return Sa(this)},Ao));function Sr(e,t,n){var r=De(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(bs(e))return Ue(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(De(n,e.from)<0)return i?Sr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ul(e);if(De(t,e.to)>0)return o?Sr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ul(e);De(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),De(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&Pi(e,i),o&&a&&Pi(e,o)}}function Pi(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Sr(r,o,a),s&&n(r,s),l&&n(r,l)}bs(t)||n(e,t)}function Qy(e,t){var n=Sa(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Sa(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(De(s.from,i.to)<=0&&De(s.to,i.from)>=0)return!0;De(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function Sa(e){var t=bs(e)?null:{s:0,n:e};return{next:function(n){for(var r=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&De(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||De(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Ul(e){var t,n,r=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((n=e.l)===null||n===void 0?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){var o=i==="r"?"l":"r",a=$({},e),s=e[i];e.from=s.from,e.to=s.to,e[i]=s[i],a[i]=s[o],e[o]=a,a.d=Pl(a)}e.d=Pl(e)}function Pl(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}var Jy={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new wt(e.MIN_KEY,e.MAX_KEY);return $($({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=$($({},i),{mutate:function(p){var f=p.trans,h=f.mutatedParts||(f.mutatedParts={}),m=function(I){var S="idb://"+t+"/"+r+"/"+I;return h[S]||(h[S]=new wt)},g=m(""),b=m(":dels"),y=p.type,_=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[],v=_[0],w=_[1],E=p.trans._cache;return i.mutate(p).then(function(I){if(Le(v)){y!=="delete"&&(v=I.results),g.addKeys(v);var S=kd(v,E);!S&&y!=="add"&&b.addKeys(v),(S||w)&&Xy(m,o,S,w)}else if(v){var x={from:v.lower,to:v.upper};b.add(x),g.add(x)}else g.add(n),b.add(n),o.indexes.forEach(function(T){return m(T.name).add(n)});return I})}}),c=function(p){var f,h,m=p.query,g=m.index,b=m.range;return[g,new wt((f=b.lower)!==null&&f!==void 0?f:e.MIN_KEY,(h=b.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},d={get:function(p){return[a,new wt(p.key)]},getMany:function(p){return[a,new wt().addKeys(p.keys)]},count:c,query:c,openCursor:c};return ve(d).forEach(function(p){u[p]=function(f){var h=M.subscr;if(h){var m=function(E){var I="idb://"+t+"/"+r+"/"+E;return h[I]||(h[I]=new wt)},g=m(""),b=m(":dels"),y=d[p](f),_=y[0],v=y[1];if(m(_.name||"").add(v),!_.isPrimaryKey)if(p==="count")b.add(n);else{var w=p==="query"&&l&&f.values&&i.query($($({},f),{values:!1}));return i[p].apply(this,arguments).then(function(E){if(p==="query"){if(l&&f.values)return w.then(function(T){var A=T.result;return g.addKeys(A),E});var I=f.values?E.result.map(s):E.result;f.values?g.addKeys(I):b.addKeys(I)}else if(p==="openCursor"){var S=E,x=f.values;return S&&Object.create(S,{key:{get:function(){return b.addKey(S.primaryKey),S.key}},primaryKey:{get:function(){var T=S.primaryKey;return b.addKey(T),T}},value:{get:function(){return x&&g.addKey(S.primaryKey),S.value}}})}return E})}}return i[p].apply(this,arguments)}}),u}})}};function Xy(e,t,n,r){function i(o){var a=e(o.name||"");function s(u){return u!=null?o.extractKey(u):null}var l=function(u){return o.multiEntry&&Le(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var d=n&&s(n[c]),p=r&&s(r[c]);De(d,p)!==0&&(d!=null&&l(d),p!=null&&l(p))})}t.indexes.forEach(i)}var ws=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=$({addons:e.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var o=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ne,dbReadyPromise:null,cancelOpen:ne,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new D(function(s){a.dbReadyResolve=s}),a.openCanceller=new D(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=Mr(this,"populate","blocked","versionchange","close",{ready:[us,ne]}),this.on.ready.subscribe=Jc(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||D.resolve().then(l),u&&s(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&s(l);else{s(l);var d=r;u||s(function p(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(p)})}})}}),this.Collection=hy(this),this.Table=uy(this),this.Transaction=Cy(this),this.Version=Vy(this),this.WhereClause=by(this),this.on("versionchange",function(s){s.newVersion>0?console.warn("Another connection wants to upgrade database '"+r.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+r.name+"'. Closing db now to resume the delete request."),r.close()}),this.on("blocked",function(s){!s.newVersion||s.newVersion<s.oldVersion?console.warn("Dexie.delete('"+r.name+"') was blocked"):console.warn("Upgrade '"+r.name+"' blocked by other connection holding version "+s.oldVersion/10)}),this._maxKey=Er(n.IDBKeyRange),this._createTransaction=function(s,l,u,c){return new r.Transaction(s,l,u,r._options.chromeTransactionDurability,c)},this._fireOnBlocked=function(s){r.on("blocked").fire(s),dr.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(Wy),this.use($y),this.use(Jy),this.use(Zy),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(function(s){return s(r)})}return e.prototype.version=function(t){if(isNaN(t)||t<.1)throw new B.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new B.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var n=this._versions,r=n.filter(function(i){return i._cfg.version===t})[0];return r||(r=new this.Version(t),n.push(r),n.sort(Ty),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||M.letThrough||this._vip)?t():new D(function(r,i){if(n._state.openComplete)return i(new B.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new B.DatabaseClosed);return}n.open().catch(ne)}n._state.dbReadyPromise.then(r,i)}).then(t)},e.prototype.use=function(t){var n=t.stack,r=t.create,i=t.level,o=t.name;o&&this.unuse({stack:n,name:o});var a=this._middlewares[n]||(this._middlewares[n]=[]);return a.push({stack:n,create:r,level:i==null?10:i,name:o}),a.sort(function(s,l){return s.level-l.level}),this},e.prototype.unuse=function(t){var n=t.stack,r=t.name,i=t.create;return n&&this._middlewares[n]&&(this._middlewares[n]=this._middlewares[n].filter(function(o){return i?o.create!==i:r?o.name!==r:!1})),this},e.prototype.open=function(){return zy(this)},e.prototype._close=function(){var t=this._state,n=dr.indexOf(this);if(n>=0&&dr.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new D(function(r){t.dbReadyResolve=r}),t.openCanceller=new D(function(r,i){t.cancelOpen=i})},e.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new B.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},e.prototype.delete=function(){var t=this,n=arguments.length>0,r=this._state;return new D(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=ue(function(){jy(t._deps,t.name),i()}),s.onerror=lt(o),s.onblocked=t._fireOnBlocked};if(n)throw new B.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return this.idbdb!==null},e.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"},e.prototype.hasFailed=function(){return this._state.dbOpenError!==null},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var t=this;return ve(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=Gy.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=M.trans;(!o||o.db!==this||t.indexOf("!")!==-1)&&(o=null);var a=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");var s,l;try{if(l=n.map(function(c){var d=c instanceof i.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),t=="r"||t===Eo)s=Eo;else if(t=="rw"||t==So)s=So;else throw new B.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===Eo&&s===So)if(a)o=null;else throw new B.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o&&l.forEach(function(c){if(o&&o.storeNames.indexOf(c)===-1)if(a)o=null;else throw new B.SubTransaction("Table "+c+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(c){return o?o._promise(null,function(d,p){p(c)}):we(c)}var u=Id.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):M.trans?Zn(M.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!ze(this._allTables,t))throw new B.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),e0=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",t0=function(){function e(t){this._subscribe=t}return e.prototype.subscribe=function(t,n,r){return this._subscribe(!t||typeof t=="function"?{next:t,error:n,complete:r}:t)},e.prototype[e0]=function(){return this},e}();function xd(e,t){return ve(t).forEach(function(n){var r=e[n]||(e[n]=new wt);Pi(r,t[n])}),e}function n0(e){var t=!1,n=void 0,r=new t0(function(i){var o=as(e);function a(g){o&&Yn();var b=function(){return Wt(e,{subscr:g,trans:null})},y=M.trans?Zn(M.transless,b):b();return o&&y.then(Dt,Dt),y}var s=!1,l={},u={},c={get closed(){return s},unsubscribe:function(){s=!0,$t.storagemutated.unsubscribe(h)}};i.start&&i.start(c);var d=!1,p=!1;function f(){return ve(u).some(function(g){return l[g]&&Qy(l[g],u[g])})}var h=function(g){xd(l,g),f()&&m()},m=function(){if(!(d||s)){l={};var g={},b=a(g);p||($t(Cr,h),p=!0),d=!0,Promise.resolve(b).then(function(y){t=!0,n=y,d=!1,!s&&(f()?m():(l={},u=g,i.next&&i.next(y)))},function(y){d=!1,t=!1,i.error&&i.error(y),c.unsubscribe()})}};return m(),c});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var Ia;try{Ia={indexedDB:ae.indexedDB||ae.mozIndexedDB||ae.webkitIndexedDB||ae.msIndexedDB,IDBKeyRange:ae.IDBKeyRange||ae.webkitIDBKeyRange}}catch{Ia={indexedDB:null,IDBKeyRange:null}}var rn=ws;jn(rn,$($({},Xi),{delete:function(e){var t=new rn(e,{addons:[]});return t.delete()},exists:function(e){return new rn(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return Fy(rn.dependencies).then(e)}catch{return we(new B.MissingAPI)}},defineClass:function(){function e(t){Ue(this,t)}return e},ignoreTransaction:function(e){return M.trans?Zn(M.transless,e):e()},vip:Ca,async:function(e){return function(){try{var t=Ea(e.apply(this,arguments));return!t||typeof t.then!="function"?D.resolve(t):t}catch(n){return we(n)}}},spawn:function(e,t,n){try{var r=Ea(e.apply(n,t||[]));return!r||typeof r.then!="function"?D.resolve(r):r}catch(i){return we(i)}},currentTransaction:{get:function(){return M.trans||null}},waitFor:function(e,t){var n=D.resolve(typeof e=="function"?rn.ignoreTransaction(e):e).timeout(t||6e4);return M.trans?M.trans.waitFor(n):n},Promise:D,debug:{get:function(){return gt},set:function(e){id(e,e==="dexie"?function(){return!0}:yd)}},derive:qn,extend:Ue,props:jn,override:Jc,Events:Mr,on:$t,liveQuery:n0,extendObservabilitySet:xd,getByKeyPath:Lt,setByKeyPath:ot,delByKeyPath:Dv,shallowClone:td,deepClone:Nr,getObjectDiff:_s,cmp:De,asap:Xc,minKey:ga,addons:[],connections:dr,errnames:ls,dependencies:Ia,semVer:Tl,version:Tl.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));rn.maxKey=Er(rn.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&($t(Cr,function(e){if(!xt){var t;eo?(t=document.createEvent("CustomEvent"),t.initCustomEvent(zt,!0,!0,e)):t=new CustomEvent(zt,{detail:e}),xt=!0,dispatchEvent(t),xt=!1}}),addEventListener(zt,function(e){var t=e.detail;xt||Mi(t)}));function Mi(e){var t=xt;try{xt=!0,$t.storagemutated.fire(e)}finally{xt=t}}var xt=!1;if(typeof BroadcastChannel<"u"){var ei=new BroadcastChannel(zt);typeof ei.unref=="function"&&ei.unref(),$t(Cr,function(e){xt||ei.postMessage(e)}),ei.onmessage=function(e){e.data&&Mi(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){$t(Cr,function(e){try{xt||(typeof localStorage<"u"&&localStorage.setItem(zt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&na([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:zt,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===zt){var t=JSON.parse(e.newValue);t&&Mi(t.changedParts)}});var Ml=self.document&&navigator.serviceWorker;Ml&&Ml.addEventListener("message",r0)}function r0(e){var t=e.data;t&&t.type===zt&&Mi(t.changedParts)}D.rejectionMapper=zv;id(gt,yd);var Qn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(Qn||{}),Pn=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Pn||{});const ka="sprig.sessionId",Ad="sprig.disableReplayRecording",i0=30,Td=()=>{sessionStorage.setItem(Ad,"disabled")},yn=()=>!!sessionStorage.getItem(Ad),o0=["did not allow mutations","called in an invalid security context"],a0=e=>{if(!e)return!0;for(const t of o0)if(e.toLowerCase().includes(t))return!1;return!0},Vl=(e,t,n)=>{yn()||t instanceof Error&&(Td(),a0(t==null?void 0:t.message)&&(u0(),window.UserLeap.reportError(e,t,n)))},s0=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Vl(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate",i)}):Vl(e,t)},l0=()=>{const e=sessionStorage.getItem(ka);return e?(sessionStorage.removeItem(ka),e):Kt()},Ve=l0();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(ka,Ve)});const u0=()=>{Promise.all([te.events.clear(),te.chunkUploads.clear(),te.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database",e)})},To=(e,t,n=()=>!0)=>te.table(t).where("timestamp").below(e).and(n).delete(),c0=()=>{te.events.where("sessionId").equals(Ve).delete(),te.pendingCaptures.where("sessionId").equals(Ve).delete()},d0=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:Ve}});return te.events.bulkAdd(t)},f0=(e,t)=>te.events.where("[sessionId+timestamp]").between([Ve,e],[Ve,t]).toArray(),p0=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:i0));return te.events.where("[sessionId+timestamp]").between([Ve,e],[Ve,t]).modify({expiredAt:i})},h0=e=>{var t;return te.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:Ve})},m0=(e,t)=>te.chunkUploads.update(e,{data:null,etag:t,status:Qn.UploadComplete}),g0=({status:e,uploadId:t})=>t?te.chunkUploads.where({uploadId:t,status:e}).toArray():te.chunkUploads.where({sessionId:Ve,status:e}).toArray(),v0=e=>te.chunkUploads.where({uploadId:e,status:Qn.UploadComplete}).toArray(),y0=e=>te.chunkUploads.where({uploadId:e,status:Qn.UploadComplete}).delete(),_0=e=>{var t;return te.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:Ve,canUpload:!1})},b0=()=>te.pendingCaptures.where("sessionId").equals(Ve).and(e=>e.targetTimestamp<Date.now()).toArray(),w0=()=>te.pendingCaptures.where("sessionId").equals(Ve).toArray(),C0=e=>te.pendingCaptures.where("sessionId").equals(Ve).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0});class E0 extends ws{constructor(){super("replayStorage",{autoOpen:!1});Ae(this,"events");Ae(this,"chunkUploads");Ae(this,"pendingCaptures")}}const te=new E0;te.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});te.open().catch(()=>{Td()});const S0=async(e,t,n)=>new Promise((r,i)=>{const o=e.createElement("script");o.src=t,o.onload=r,o.onerror=i,n&&(o.nonce=n),e.head.appendChild(o)});let Rd=5e3,xa=6e4;const I0=5,Fl=1e3,Ld=30,Vi=Ld+I0,Cs="sprig.pendingCount";let Bl=0,jl=Date.now(),Es=!1;const k0=async(e,t,n,r=2,i)=>{try{if(yn()||!t)return;i!=null&&i.minDuration&&(Rd=i.minDuration),i!=null&&i.batchDuration&&(xa=i.batchDuration),xv(r),N0(),T0(t+Vi,30*60,t+Vi),R0(),window.rrwebRecord||await S0(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const o=window.rrwebRecord;if(!o)return;let a=!0;o({checkoutEveryNms:Ld*1e3,sampling:{input:"last",scroll:250,media:800},emit:(s,l)=>{if(yn())return;jl=Date.now();const u=a||!!l;a=!1,x0({uuid:Kt(),event:JSON.stringify(s),isValidStart:u,timestamp:Date.now()})},...i}),Es=!0,Bl||(Bl=window.setInterval(()=>{Date.now()-jl>Fl&&Fr("Sprig_Noop",{})},Fl))}catch(o){pt("Error initializing replay",o)}};let Aa=!1,Ta=[];const x0=e=>{Ta.push(e),Aa||A0()},A0=()=>{Aa=!0,setTimeout(async()=>{if(yn())return;const e=Ta;Ta=[],Aa=!1;try{await d0(e)}catch(t){pt("Error storing replay events",t)}},500)},T0=(e=6*60,t=30*60,n=4*60)=>{const r=setInterval(async()=>{const i=Date.now();yn()||await te.transaction("rw",te.events,te.chunkUploads,te.pendingCaptures,()=>{To(i-e*1e3,"events",o=>o.expiredAt===void 0||o.expiredAt<i-e*1e3),To(i-t*1e3,"chunkUploads"),To(i-n*1e3,"pendingCaptures",o=>o.canUpload===void 0||o.canUpload===!1)}).catch(o=>{clearInterval(r),pt("Error deleting table rows",o)})},3e4)},R0=(e=5)=>{setInterval(V0,e*1e3)},L0=async(e,t,n,r,i)=>{try{const o=Math.min(e+i,n),a=await f0(e,o);if(!(a!=null&&a.length))return[r,[]];if(!r){let s=-1;return a==null||a.forEach((l,u)=>{if(!l.isValidStart)return;const c=l.timestamp<=t;(s<0||c)&&(s=u)}),s<0?[]:[!0,a==null?void 0:a.slice(s)]}return[r,a]}catch(o){pt("Error getting events batch",o)}},O0=(e,t,n)=>{const r=e.length,i=t*1024*1024,o=Math.ceil(r/n),a=Math.max(i,o),s=[];let l=0;for(;l<r;)s.push(e.slice(l,l+a)),l+=a;return s},Od=e=>Promise.all(e.map(async t=>{const n=await Tv(t);return await m0(t.uuid,n),t.uploadId})),Nd=async e=>{const t=await v0(e);if(!(t!=null&&t.length))return;t.sort((i,o)=>i.chunkIndex-o.chunkIndex);const n=t.map(i=>({ETag:i.etag,PartNumber:i.chunkIndex})).filter(i=>i.ETag!==null),r=t[0];await Zc({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await y0(e)},N0=async()=>{try{let e=[];if(await te.transaction("rw",te.chunkUploads,async()=>{e=await g0({status:Qn.ReadyForUpload}).catch(n=>{pt("chunkUploads transaction error",n)})}),!(e!=null&&e.length))return;const t=await Od(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Nd(n)}))}catch(e){pt("Error getting chunk upload uuids",e)}},D0=async(e,t)=>{await Od(t),await Promise.all(e.map(n=>Nd(n)))},U0=e=>{let t=0;e.forEach(i=>{t+=i.length});const n=new Uint8Array(t);let r=0;return e.forEach(i=>{n.set(i,r),r+=i.length}),n},Hl=async(e,t,n)=>{const r=new TextEncoder;let i=null,o=null,a=null,s=!1,l=!1,[u,c]=[0,0];const d=e-Vi*1e3,p=[];let f=[];for(let m=d;m<t;m+=xa){if([l,f]=await L0(m,e,t,l,xa),!(f!=null&&f.length))continue;u===0&&(u=f[0].timestamp),c=f[f.length-1].timestamp;const g=`${s?",":"["}${f.map(y=>y.event).join(",")}`,b=r.encode(g);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(b)):p.push(b),s=!0}if(c-u<Rd)return null;const h=r.encode("]");return o&&a?(o.write(h),o.close(),i=new Uint8Array(await new Response(a.readable).arrayBuffer())):(p.push(h),i=U0(p)),i},P0=async(e,t)=>{const n=window.CompressionStream!==void 0;let r=null;const i=t!=null?t:Date.now(),o=i-e;try{r=await Hl(o,i,n)}catch(a){if(a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n)try{r=await Hl(o,i,!1)}catch(s){pt("fileData fallback failed",s)}}return r},zl=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await P0(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=O0(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(d,p)=>{const f=Kt(),h={apiUrl:i,chunkIndex:p+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:Qn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[p].url,uuid:f,visitorId:r};return await h0(h),h}));await D0([a.uploadId],c)},Dd=async(e,t)=>{if(!yn())try{const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>Z.removeListener(G.QuestionAnswered,a),0),r.replayDurationType===Pn.Before?await zl(e):await C0(o)};if(r.replayDurationType===Pn.After||r.replayDurationType===Pn.BeforeAndAfter){n||Z.on(G.QuestionAnswered,a),await M0(e);return}if(n||t)await zl(e);else{const s=Vi+r.replayDurationSeconds;await p0(i-s*1e3,i,r.expirationTimeLimitMinutes),Z.on(G.QuestionAnswered,a)}}catch(n){pt("Error scheduling or capturing replay",n)}},Gl=()=>{if(!yn())try{c0()}catch(e){pt("Error clearing session event data",e)}};let St=sessionStorage.getItem(Cs);const M0=async e=>{const{surveyId:t}=e,n=await w0(),r=n==null?void 0:n.filter(a=>a.captureParams.surveyId===t);if(r!=null&&r.length)return;const i={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Pn.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Pn.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,St=St?(parseInt(St)+1).toString():"1",sessionStorage.setItem(Cs,St),_0({uuid:Kt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},V0=async()=>{try{if(St&&parseInt(St)>0){const e=await b0();e.length&&await Promise.all(e.map(async t=>{await te.pendingCaptures.delete(t.uuid),await Dd(t.captureParams,t.canUpload)})),St=(parseInt(St)-e.length).toString(),sessionStorage.setItem(Cs,St)}}catch(e){pt("Error initiating pending captures",e)}},Fr=(e,t)=>{var n,r;!Es||(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)},Kl=e=>{Fr("Sprig_PageView",e)},F0=e=>{Fr("Sprig_TrackEvent",e)},B0=e=>{Fr("Sprig_ShowSurvey",e)},j0=e=>{Fr("Sprig_SubmitSurvey",e)},pt=(e,t)=>{Es=!1,s0(e,t)};var O=(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))(O||{}),It=(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.DoesNotInclude="list_dni",e.Contains="contains",e.DoesNotContain="notcontains",e))(It||{}),Hn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Hn||{}),$e=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))($e||{}),cn=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(cn||{}),Br,P,Ud,zn,on,Wl,Pd,Md,Fi={},Vd=[],H0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function At(e,t){for(var n in t)e[n]=t[n];return e}function Fd(e){var t=e.parentNode;t&&t.removeChild(e)}function he(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Br.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return pr(e,a,r,i,null)}function pr(e,t,n,r,i){var o={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:i==null?++Ud:i};return i==null&&P.vnode!=null&&P.vnode(o),o}function Bd(){return{current:null}}function Je(e){return e.children}function z0(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Bi(e,o,null,n[o],r);for(o in t)i&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===t[o]||Bi(e,o,t[o],n[o],r)}function ql(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||H0.test(t)?n:n+"px"}function Bi(e,t,n,r,i){var o;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||ql(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||ql(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?Yl:$l,o):e.removeEventListener(t,o?Yl:$l,o);else if(t!=="dangerouslySetInnerHTML"){if(i)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 $l(e){zn=!0;try{return this.l[e.type+!1](P.event?P.event(e):e)}finally{zn=!1}}function Yl(e){zn=!0;try{return this.l[e.type+!0](P.event?P.event(e):e)}finally{zn=!1}}function at(e,t){this.props=e,this.context=t}function Ir(e,t){if(t==null)return e.__?Ir(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"?Ir(e):null}function jd(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 jd(e)}}function G0(e){zn?setTimeout(e):Pd(e)}function Ra(e){(!e.__d&&(e.__d=!0)&&on.push(e)&&!ji.__r++||Wl!==P.debounceRendering)&&((Wl=P.debounceRendering)||G0)(ji)}function ji(){var e,t,n,r,i,o,a,s;for(on.sort(function(l,u){return l.__v.__b-u.__v.__b});e=on.shift();)e.__d&&(t=on.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=At({},o)).__v=o.__v+1,Ss(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?Ir(o):a,o.__h),Wd(r,o),o.__e!=a&&jd(o)),on.length>t&&on.sort(function(l,u){return l.__v.__b-u.__v.__b}));ji.__r=0}function Hd(e,t,n,r,i,o,a,s,l,u){var c,d,p,f,h,m,g,b=r&&r.__k||Vd,y=b.length;for(n.__k=[],c=0;c<t.length;c++)if((f=n.__k[c]=(f=t[c])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?pr(null,f,null,null,f):Array.isArray(f)?pr(Je,{children:f},null,null,null):f.__b>0?pr(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=b[c])===null||p&&f.key==p.key&&f.type===p.type)b[c]=void 0;else for(d=0;d<y;d++){if((p=b[d])&&f.key==p.key&&f.type===p.type){b[d]=void 0;break}p=null}Ss(e,f,p=p||Fi,i,o,a,s,l,u),h=f.__e,(d=f.ref)&&p.ref!=d&&(g||(g=[]),p.ref&&g.push(p.ref,null,f),g.push(d,f.__c||h,f)),h!=null?(m==null&&(m=h),typeof f.type=="function"&&f.__k===p.__k?f.__d=l=zd(f,l,e):l=Gd(e,f,p,b,h,l),typeof n.type=="function"&&(n.__d=l)):l&&p.__e==l&&l.parentNode!=e&&(l=Ir(p))}for(n.__e=m,c=y;c--;)b[c]!=null&&(typeof n.type=="function"&&b[c].__e!=null&&b[c].__e==n.__d&&(n.__d=Kd(r).nextSibling),$d(b[c],b[c]));if(g)for(c=0;c<g.length;c++)qd(g[c],g[++c],g[++c])}function zd(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t=typeof r.type=="function"?zd(r,t,n):Gd(n,r,r,i,r.__e,t));return t}function Ot(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Ot(n,t)}):t.push(e)),t}function Gd(e,t,n,r,i,o){var a,s,l;if(t.__d!==void 0)a=t.__d,t.__d=void 0;else if(n==null||i!=o||i.parentNode==null)e:if(o==null||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<r.length;l+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return a!==void 0?a:i.nextSibling}function Kd(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=Kd(n)))return r}return null}function Ss(e,t,n,r,i,o,a,s,l){var u,c,d,p,f,h,m,g,b,y,_,v,w,E,I,S=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=P.__b)&&u(t);try{e:if(typeof S=="function"){if(g=t.props,b=(u=S.contextType)&&r[u.__c],y=u?b?b.props.value:u.__:r,n.__c?m=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(g,y):(t.__c=c=new at(g,y),c.constructor=S,c.render=W0),b&&b.sub(c),c.props=g,c.state||(c.state={}),c.context=y,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),S.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=At({},c.__s)),At(c.__s,S.getDerivedStateFromProps(g,c.__s))),p=c.props,f=c.state,c.__v=t,d)S.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S.getDerivedStateFromProps==null&&g!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,y),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,y)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(x){x&&(x.__=t)}),_=0;_<c._sb.length;_++)c.__h.push(c._sb[_]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,y),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,f,h)})}if(c.context=y,c.props=g,c.__P=e,v=P.__r,w=0,"prototype"in S&&S.prototype.render){for(c.state=c.__s,c.__d=!1,v&&v(t),u=c.render(c.props,c.state,c.context),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[]}else do c.__d=!1,v&&v(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++w<25);c.state=c.__s,c.getChildContext!=null&&(r=At(At({},r),c.getChildContext())),d||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(p,f)),I=u!=null&&u.type===Je&&u.key==null?u.props.children:u,Hd(e,Array.isArray(I)?I:[I],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),m&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=K0(n.__e,t,n,r,i,o,a,l);(u=P.diffed)&&u(t)}catch(x){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),P.__e(x,t,n)}}function Wd(e,t){P.__c&&P.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){P.__e(r,n.__v)}})}function K0(e,t,n,r,i,o,a,s){var l,u,c,d=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((l=o[h])&&"setAttribute"in l==!!f&&(f?l.localName===f:l.nodeType===3)){e=l,o[h]=null;break}}if(e==null){if(f===null)return document.createTextNode(p);e=i?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,p.is&&p),o=null,s=!1}if(f===null)d===p||s&&e.data===p||(e.data=p);else{if(o=o&&Br.call(e.childNodes),u=(d=n.props||Fi).dangerouslySetInnerHTML,c=p.dangerouslySetInnerHTML,!s){if(o!=null)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(z0(e,p,d,i,s),c)t.__k=[];else if(h=t.props.children,Hd(e,Array.isArray(h)?h:[h],t,n,r,i&&f!=="foreignObject",o,a,o?o[0]:n.__k&&Ir(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&Fd(o[h]);s||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==d.value)&&Bi(e,"value",h,d.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&Bi(e,"checked",h,d.checked,!1))}return e}function qd(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function $d(e,t,n){var r,i;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||qd(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){P.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&$d(r[i],t,n||typeof e.type!="function");n||e.__e==null||Fd(e.__e),e.__=e.__e=e.__d=void 0}function W0(e,t,n){return this.constructor(e,n)}function Gn(e,t,n){var r,i,o;P.__&&P.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],Ss(t,e=(!r&&n||t).__k=he(Je,null,[e]),i||Fi,Fi,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Br.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),Wd(o,e)}function Yd(e,t){Gn(e,t,Yd)}function q0(e,t,n){var r,i,o,a=At({},e.props);for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];return arguments.length>2&&(a.children=arguments.length>3?Br.call(arguments,2):n),pr(e.type,a,r||e.key,i||e.ref,null)}function Zd(e,t){var n={__c:t="__cC"+Md++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(s){s.__e=!0,Ra(s)})},this.sub=function(a){i.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),s&&s.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Br=Vd.slice,P={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},Ud=0,zn=!1,at.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=At({},this.state),typeof e=="function"&&(e=e(At({},n),this.props)),e&&At(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ra(this))},at.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ra(this))},at.prototype.render=Je,on=[],Pd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ji.__r=0,Md=0;var nt=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(nt||{}),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||{}),Ye=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ye||{}),Y=(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))(Y||{});const Zl=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(p=>p(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>n.clear()};return t=e(r,i,s),s},$0=e=>e?Zl(e):Zl;var Qt,se,Ro,Ql,Kn=0,Qd=[],di=[],Jl=P.__b,Xl=P.__r,eu=P.diffed,tu=P.__c,nu=P.unmount;function wn(e,t){P.__h&&P.__h(se,e,Kn||t),Kn=0;var n=se.__H||(se.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:di}),n.__[e]}function xe(e){return Kn=1,Is(nf,e)}function Is(e,t,n){var r=wn(Qt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):nf(void 0,t),function(o){var a=r.__N?r.__N[0]:r.__[0],s=r.t(a,o);a!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=se,!se.u)){se.u=!0;var i=se.shouldComponentUpdate;se.shouldComponentUpdate=function(o,a,s){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(c){return c.__c});if(l.every(function(c){return!c.__N}))return!i||i.call(this,o,a,s);var u=!1;return l.forEach(function(c){if(c.__N){var d=c.__[0];c.__=c.__N,c.__N=void 0,d!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Ze(e,t){var n=wn(Qt++,3);!P.__s&&xs(n.__H,t)&&(n.__=e,n.i=t,se.__H.__h.push(n))}function jr(e,t){var n=wn(Qt++,4);!P.__s&&xs(n.__H,t)&&(n.__=e,n.i=t,se.__h.push(n))}function Yt(e){return Kn=5,no(function(){return{current:e}},[])}function Jd(e,t,n){Kn=6,jr(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 no(e,t){var n=wn(Qt++,7);return xs(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Xd(e,t){return Kn=8,no(function(){return e},t)}function ef(e){var t=se.context[e.__c],n=wn(Qt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(se)),t.props.value):e.__}function ks(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function Y0(e){var t=wn(Qt++,10),n=xe();return t.__=e,se.componentDidCatch||(se.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function tf(){var e=wn(Qt++,11);if(!e.__){for(var t=se.__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 Z0(){for(var e;e=Qd.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(fi),e.__H.__h.forEach(La),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){se=null,Jl&&Jl(e)},P.__r=function(e){Xl&&Xl(e),Qt=0;var t=(se=e.__c).__H;t&&(Ro===se?(t.__h=[],se.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=di,n.__N=n.i=void 0})):(t.__h.forEach(fi),t.__h.forEach(La),t.__h=[])),Ro=se},P.diffed=function(e){eu&&eu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Qd.push(t)!==1&&Ql===P.requestAnimationFrame||((Ql=P.requestAnimationFrame)||Q0)(Z0)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==di&&(n.__=n.__V),n.i=void 0,n.__V=di})),Ro=se=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(fi),n.__h=n.__h.filter(function(r){return!r.__||La(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],P.__e(r,n.__v)}}),tu&&tu(e,t)},P.unmount=function(e){nu&&nu(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{fi(r)}catch(i){t=i}}),n.__H=void 0,t&&P.__e(t,n.__v))};var ru=typeof requestAnimationFrame=="function";function Q0(e){var t,n=function(){clearTimeout(r),ru&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ru&&(t=requestAnimationFrame(n))}function fi(e){var t=se,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),se=t}function La(e){var t=se;e.__c=e.__(),se=t}function xs(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function nf(e,t){return typeof t=="function"?t(e):t}function rf(e,t){for(var n in t)e[n]=t[n];return e}function Oa(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 Lo(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Hi(e){this.props=e}function of(e,t){function n(i){var o=this.props.ref,a=o==i.ref;return!a&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!a:Oa(this.props,i)}function r(i){return this.shouldComponentUpdate=n,he(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Hi.prototype=new at).isPureReactComponent=!0,Hi.prototype.shouldComponentUpdate=function(e,t){return Oa(this.props,e)||Oa(this.state,t)};var iu=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),iu&&iu(e)};var J0=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function af(e){function t(n){var r=rf({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=J0,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ou=function(e,t){return e==null?null:Ot(Ot(e).map(t))},sf={map:ou,forEach:ou,count:function(e){return e?Ot(e).length:0},only:function(e){var t=Ot(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ot},X0=P.__e;P.__e=function(e,t,n,r){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}X0(e,t,n,r)};var au=P.unmount;function lf(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=rf({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return lf(r,t,n)})),e}function uf(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return uf(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 hr(){this.__u=0,this.t=null,this.__b=null}function cf(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function df(e){var t,n,r;function i(o){if(t||(t=e()).then(function(a){n=a.default||a},function(a){r=a}),r)throw r;if(!n)throw t;return he(n,o)}return i.displayName="Lazy",i.__f=!0,i}function On(){this.u=null,this.o=null}P.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),au&&au(e)},(hr.prototype=new at).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=cf(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=uf(u,u.__c.__P,u.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.t.pop();)c.forceUpdate()}},l=t.__h===!0;r.__u++||l||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},hr.prototype.componentWillUnmount=function(){this.t=[]},hr.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]=lf(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&he(Je,null,e.fallback);return i&&(i.__h=null),[he(Je,null,t.__a?null:e.children),i]};var su=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 e_(e){return this.getChildContext=function(){return e.context},e.children}function t_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Gn(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,i){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Gn(he(e_,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function ff(e,t){var n=he(t_,{__v:e,i:t});return n.containerInfo=t,n}(On.prototype=new at).__a=function(e){var t=this,n=cf(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),su(t,e,r)):i()};n?n(o):o()}},On.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ot(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},On.prototype.componentDidUpdate=On.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){su(e,n,t)})};var pf=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,n_=/^(?: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]/,r_=typeof document<"u",i_=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function hf(e,t,n){return t.__k==null&&(t.textContent=""),Gn(e,t),typeof n=="function"&&n(),e?e.__c:null}function mf(e,t,n){return Yd(e,t),typeof n=="function"&&n(),e?e.__c:null}at.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(at.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var lu=P.event;function o_(){}function a_(){return this.cancelBubble}function s_(){return this.defaultPrevented}P.event=function(e){return lu&&(e=lu(e)),e.persist=o_,e.isPropagationStopped=a_,e.isDefaultPrevented=s_,e.nativeEvent=e};var gf,uu={configurable:!0,get:function(){return this.class}},cu=P.vnode;P.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var i=t.indexOf("-")===-1;for(var o in r={},n){var a=n[o];r_&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in n&&a==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&a===!0?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!i_(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():i&&n_.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():a===null&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),r[o]&&(o="oninputCapture")),r[o]=a)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Ot(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Ot(n.children).forEach(function(s){s.props.selected=r.multiple?r.defaultValue.indexOf(s.props.value)!=-1:r.defaultValue==s.props.value})),e.props=r,n.class!=n.className&&(uu.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",uu))}e.$$typeof=pf,cu&&cu(e)};var du=P.__r;P.__r=function(e){du&&du(e),gf=e.__c};var vf={ReactCurrentDispatcher:{current:{readContext:function(e){return gf.__n[e.__c].props.value}}}},l_="17.0.2";function yf(e){return he.bind(null,e)}function As(e){return!!e&&e.$$typeof===pf}function _f(e){return As(e)?q0.apply(null,arguments):e}function bf(e){return!!e.__k&&(Gn(null,e),!0)}function wf(e){return e&&(e.base||e.nodeType===1&&e)||null}var Cf=function(e,t){return e(t)},Ef=function(e,t){return e(t)},Sf=Je;function Ts(e){e()}function If(e){return e}function kf(){return[!1,Ts]}var xf=jr;function Af(e,t){var n=t(),r=xe({h:{__:n,v:t}}),i=r[0].h,o=r[1];return jr(function(){i.__=n,i.v=t,Lo(i.__,t())||o({h:i})},[e,n,t]),Ze(function(){return Lo(i.__,i.v())||o({h:i}),e(function(){Lo(i.__,i.v())||o({h:i})})},[e]),n}var u_={useState:xe,useId:tf,useReducer:Is,useEffect:Ze,useLayoutEffect:jr,useInsertionEffect:xf,useTransition:kf,useDeferredValue:If,useSyncExternalStore:Af,startTransition:Ts,useRef:Yt,useImperativeHandle:Jd,useMemo:no,useCallback:Xd,useContext:ef,useDebugValue:ks,version:"17.0.2",Children:sf,render:hf,hydrate:mf,unmountComponentAtNode:bf,createPortal:ff,createElement:he,createContext:Zd,createFactory:yf,cloneElement:_f,createRef:Bd,Fragment:Je,isValidElement:As,findDOMNode:wf,Component:at,PureComponent:Hi,memo:of,forwardRef:af,flushSync:Ef,unstable_batchedUpdates:Cf,StrictMode:Sf,Suspense:hr,SuspenseList:On,lazy:df,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:vf};const c_=Object.freeze(Object.defineProperty({__proto__:null,Children:sf,PureComponent:Hi,StrictMode:Sf,Suspense:hr,SuspenseList:On,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:vf,cloneElement:_f,createFactory:yf,createPortal:ff,default:u_,findDOMNode:wf,flushSync:Ef,forwardRef:af,hydrate:mf,isValidElement:As,lazy:df,memo:of,render:hf,startTransition:Ts,unmountComponentAtNode:bf,unstable_batchedUpdates:Cf,useDeferredValue:If,useInsertionEffect:xf,useSyncExternalStore:Af,useTransition:kf,version:l_,Component:at,Fragment:Je,createContext:Zd,createElement:he,createRef:Bd,useCallback:Xd,useContext:ef,useDebugValue:ks,useEffect:Ze,useErrorBoundary:Y0,useId:tf,useImperativeHandle:Jd,useLayoutEffect:jr,useMemo:no,useReducer:Is,useRef:Yt,useState:xe},Symbol.toStringTag,{value:"Module"}));var Tf={exports:{}},Oo={};const ro=dm(c_);var No={exports:{}},Do={};/**
33
+ `).slice(t).filter(Qc).map(function(r){return`
34
+ `+r}).join("")):""}var Uv=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Jc=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],is=Uv.concat(Jc),Pv={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function Yn(e,t){this._e=bn(),this.name=e,this.message=t}qn(Yn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+ra(this._e,2))}},toString:function(){return this.name+": "+this.message}});function Xc(e,t){return e+". Errors: "+Object.keys(t).map(function(n){return t[n].toString()}).filter(function(n,r,i){return i.indexOf(n)===r}).join(`
35
+ `)}function Ri(e,t,n,r){this._e=bn(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Xc(e,t)}qn(Ri).from(Yn);function dr(e,t){this._e=bn(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=Xc(e,t)}qn(dr).from(Yn);var os=is.reduce(function(e,t){return e[t]=t+"Error",e},{}),Mv=Yn,V=is.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=bn(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
36
+ `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=Pv[t]||n,this.inner=null)}return qn(r).from(Mv),e[t]=r,e},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;var Cl=Jc.reduce(function(e,t){return e[t+"Error"]=V[t],e},{});function Fv(e,t){if(!e||e instanceof Yn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Cl[e.name])return e;var n=new Cl[e.name](t||e.message,e);return"stack"in e&&Nt(n,"stack",{get:function(){return this.inner.stack}}),n}var eo=is.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=V[t]),e},{});eo.ModifyError=Ri;eo.DexieError=Yn;eo.BulkError=dr;function ne(){}function Ur(e){return e}function Vv(e,t){return e==null||e===Ur?t:function(n){return t(e(n))}}function gn(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Bv(e,t){return e===ne?t:function(){var n=e.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?gn(r,this.onsuccess):r),i&&(this.onerror=this.onerror?gn(i,this.onerror):i),o!==void 0?o:n}}function jv(e,t){return e===ne?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?gn(n,this.onsuccess):n),r&&(this.onerror=this.onerror?gn(r,this.onerror):r)}}function Hv(e,t){return e===ne?t:function(n){var r=e.apply(this,arguments);Ue(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?gn(i,this.onsuccess):i),o&&(this.onerror=this.onerror?gn(o,this.onerror):o),r===void 0?a===void 0?void 0:a:Ue(r,a)}}function zv(e,t){return e===ne?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function as(e,t){return e===ne?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}var br={},Gv=100,Kv=20,ed=100,ss=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,_r(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,_r(t),e]}(),ia=ss[0],Li=ss[1],oa=ss[2],td=Li&&Li.then,ai=ia&&ia.constructor,ls=!!oa,aa=!1,Wv=oa?function(){oa.then(Zr)}:ae.setImmediate?setImmediate.bind(null,Zr):ae.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){Zr(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Zr,0)},wr=function(e,t){or.push([e,t]),Oi&&(Wv(),Oi=!1)},sa=!0,Oi=!0,fn=[],si=[],la=null,ua=Ur,Un={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Sl,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Sl(e[0],e[1])}catch{}})}},M=Un,or=[],pn=0,li=[];function D(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ne,this._lib=!1;var t=this._PSD=M;if(gt&&(this._stackHolder=bn(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==br)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&da(this,this._value);return}this._state=null,this._value=null,++t.ref,rd(this,e)}var ca={get:function(){var e=M,t=Ni;function n(r,i){var o=this,a=!e.global&&(e!==M||t!==Ni),s=a&&!Dt(),l=new D(function(u,c){us(o,new nd(Ui(r,e,a,s),Ui(i,e,a,s),u,c,e))});return gt&&ad(l,this),l}return n.prototype=br,n},set:function(e){Nt(this,"then",e&&e.prototype===br?ca:{get:function(){return e},set:ca.set})}};jn(D.prototype,{then:ca,_then:function(e,t){us(this,new nd(null,null,e,t,M))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],n=arguments[1];return typeof t=="function"?this.then(null,function(r){return r instanceof t?n(r):ui(r)}):this.then(null,function(r){return r&&r.name===t?n(r):ui(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),ui(t)})},stack:{get:function(){if(this._stack)return this._stack;try{aa=!0;var e=od(this,[],Kv),t=e.join(`
37
+ From previous: `);return this._state!==null&&(this._stack=t),t}finally{aa=!1}}},timeout:function(e,t){var n=this;return e<1/0?new D(function(r,i){var o=setTimeout(function(){return i(new V.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&Nt(D.prototype,Symbol.toStringTag,"Dexie.Promise");Un.env=sd();function nd(e,t,n,r,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=i}jn(D,{all:function(){var e=Et.apply(null,arguments).map(Di);return new D(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return D.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof D)return e;if(e&&typeof e.then=="function")return new D(function(n,r){e.then(n,r)});var t=new D(br,!0,e);return ad(t,la),t},reject:ui,race:function(){var e=Et.apply(null,arguments).map(Di);return new D(function(t,n){e.map(function(r){return D.resolve(r).then(t,n)})})},PSD:{get:function(){return M},set:function(e){return M=e}},totalEchoes:{get:function(){return Ni}},newPSD:Wt,usePSD:Qn,scheduler:{get:function(){return wr},set:function(e){wr=e}},rejectionMapper:{get:function(){return ua},set:function(e){ua=e}},follow:function(e,t){return new D(function(n,r){return Wt(function(i,o){var a=M;a.unhandleds=[],a.onunhandled=o,a.finalize=gn(function(){var s=this;qv(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});ai&&(ai.allSettled&&Nt(D,"allSettled",function(){var e=Et.apply(null,arguments).map(Di);return new D(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return D.resolve(i).then(function(a){return r[o]={status:"fulfilled",value:a}},function(a){return r[o]={status:"rejected",reason:a}}).then(function(){return--n||t(r)})})})}),ai.any&&typeof AggregateError<"u"&&Nt(D,"any",function(){var e=Et.apply(null,arguments).map(Di);return new D(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return D.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function rd(e,t){try{t(function(n){if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&Pr();n&&typeof n.then=="function"?rd(e,function(i,o){n instanceof D?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,id(e)),r&&Mr()}},da.bind(null,e))}catch(n){da(e,n)}}function da(e,t){if(si.push(t),e._state===null){var n=e._lib&&Pr();t=ua(t),e._state=!1,e._value=t,gt&&t!==null&&typeof t=="object"&&!t._promise&&Av(function(){var r=ns(t,"stack");t._promise=e,Nt(t,"stack",{get:function(){return aa?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),Yv(e),id(e),n&&Mr()}}function id(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)us(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),pn===0&&(++pn,wr(function(){--pn===0&&cs()},[]))}function us(e,t){if(e._state===null){e._listeners.push(t);return}var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++pn,wr($v,[n,e,t])}function $v(e,t,n){try{la=t;var r,i=t._value;t._state?r=e(i):(si.length&&(si=[]),r=e(i),si.indexOf(i)===-1&&Zv(t)),n.resolve(r)}catch(o){n.reject(o)}finally{la=null,--pn===0&&cs(),--n.psd.ref||n.psd.finalize()}}function od(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i=e._value,o,a;i!=null?(o=i.name||"Error",a=i.message||i,r=ra(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return gt&&(r=ra(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&od(e._prev,t,n)),t}function ad(e,t){var n=t?t._numPrev+1:0;n<Gv&&(e._prev=t,e._numPrev=n)}function Zr(){Pr()&&Mr()}function Pr(){var e=sa;return sa=!1,Oi=!1,e}function Mr(){var e,t,n;do for(;or.length>0;)for(e=or,or=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(or.length>0);sa=!0,Oi=!0}function cs(){var e=fn;fn=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=li.slice(0),n=t.length;n;)t[--n]()}function qv(e){function t(){e(),li.splice(li.indexOf(t),1)}li.push(t),++pn,wr(function(){--pn===0&&cs()},[])}function Yv(e){fn.some(function(t){return t._value===e._value})||fn.push(e)}function Zv(e){for(var t=fn.length;t;)if(fn[--t]._value===e._value){fn.splice(t,1);return}}function ui(e){return new D(br,!1,e)}function ue(e,t){var n=M;return function(){var r=Pr(),i=M;try{return $t(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{$t(i,!1),r&&Mr()}}}var Re={awaits:0,echoes:0,id:0},Qv=0,ci=[],Eo=0,Ni=0,Jv=0;function Wt(e,t,n,r){var i=M,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Jv;var a=Un.env;o.env=ls?{Promise:D,PromiseProp:{value:D,configurable:!0,writable:!0},all:D.all,race:D.race,allSettled:D.allSettled,any:D.any,resolve:D.resolve,reject:D.reject,nthen:El(a.nthen,o),gthen:El(a.gthen,o)}:{},t&&Ue(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=Qn(o,e,n,r);return o.ref===0&&o.finalize(),s}function Zn(){return Re.id||(Re.id=++Qv),++Re.awaits,Re.echoes+=ed,Re.id}function Dt(){return Re.awaits?(--Re.awaits===0&&(Re.id=0),Re.echoes=Re.awaits*ed,!0):!1}(""+td).indexOf("[native code]")===-1&&(Zn=Dt=ne);function Di(e){return Re.echoes&&e&&e.constructor===ai?(Zn(),e.then(function(t){return Dt(),t},function(t){return Dt(),we(t)})):e}function Xv(e){++Ni,(!Re.echoes||--Re.echoes===0)&&(Re.echoes=Re.id=0),ci.push(M),$t(e,!0)}function ey(){var e=ci[ci.length-1];ci.pop(),$t(e,!1)}function $t(e,t){var n=M;if((t?Re.echoes&&(!Eo++||e!==M):Eo&&(!--Eo||e!==M))&&ld(t?Xv.bind(null,e):ey),e!==M&&(M=e,n===Un&&(Un.env=sd()),ls)){var r=Un.env.Promise,i=e.env;Li.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(ae,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function sd(){var e=ae.Promise;return ls?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(ae,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Li.then,gthen:e.prototype.then}:{}}function Qn(e,t,n,r,i){var o=M;try{return $t(e,!0),t(n,r,i)}finally{$t(o,!1)}}function ld(e){td.call(ia,e)}function Ui(e,t,n,r){return typeof e!="function"?e:function(){var i=M;n&&Zn(),$t(t,!0);try{return e.apply(this,arguments)}finally{$t(i,!1),r&&ld(Dt)}}}function El(e,t){return function(n,r){return e.call(this,Ui(n,t),Ui(r,t))}}var Il="unhandledrejection";function Sl(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(ae.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(Il,!0,!0),Ue(r,i)):ae.CustomEvent&&(r=new CustomEvent(Il,{detail:i}),Ue(r,i)),r&&ae.dispatchEvent&&(dispatchEvent(r),!ae.PromiseRejectionEvent&&ae.onunhandledrejection))try{ae.onunhandledrejection(r)}catch{}gt&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var we=D.reject;function fa(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!M.letThrough&&!e._vip){if(e._state.openComplete)return we(new V.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return we(new V.DatabaseClosed);e.open().catch(ne)}return e._state.dbReadyPromise.then(function(){return fa(e,t,n,r)})}else{var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===os.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return fa(e,t,n,r)})):we(o)}return i._promise(t,function(o,a){return Wt(function(){return M.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var kl="3.2.4",un=String.fromCharCode(65535),pa=-1/0,_t="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",ud="String expected.",fr=[],to=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ty=to,ny=to,cd=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},no="__dbnames",Io="readonly",So="readwrite";function vn(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var dd={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Qr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Dr(t),delete t[e]),t}:function(t){return t}}var ry=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||M.trans,o=this.name;function a(l,u,c){if(!c.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=Pr();try{return i&&i.db===this.db?i===M.trans?i._promise(t,a,r):Wt(function(){return i._promise(t,a,r)},{trans:i,transless:M.transless||M}):fa(this.db,t,[this.name],a)}finally{s&&Mr()}},e.prototype.get=function(t,n){var r=this;return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",function(i){return r.core.get({trans:i,key:t}).then(function(o){return r.hook.reading.fire(o)})}).then(n)},e.prototype.where=function(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(Le(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ve(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(c){return c.compound&&n.every(function(d){return c.keyPath.indexOf(d)>=0})&&c.keyPath.every(function(d){return n.indexOf(d)>=0})})[0];if(r&&this.db._maxKey!==un)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&gt&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var i=this.schema.idxByName,o=this.db._deps.indexedDB;function a(c,d){try{return o.cmp(c,d)===0}catch{return!1}}var s=n.reduce(function(c,d){var p=c[0],f=c[1],h=i[d],m=t[d];return[p||h,p||!h?vn(f,h&&h.multi?function(g){var b=Lt(g,d);return Le(b)&&b.some(function(v){return a(m,v)})}:function(g){return a(m,Lt(g,d))}):f]},[null,null]),l=s[0],u=s[1];return l?this.where(l.name).equals(t[l.keyPath]).filter(u):r?this.filter(u):this.where(n).equals("")},e.prototype.filter=function(t){return this.toCollection().and(t)},e.prototype.count=function(t){return this.toCollection().count(t)},e.prototype.offset=function(t){return this.toCollection().offset(t)},e.prototype.limit=function(t){return this.toCollection().limit(t)},e.prototype.each=function(t){return this.toCollection().each(t)},e.prototype.toArray=function(t){return this.toCollection().toArray(t)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,Le(t)?"["+t.join("+")+"]":t))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(t){this.schema.mappedClass=t;var n=function(r){if(!r)return r;var i=Object.create(t.prototype);for(var o in r)if(ze(r,o))try{i[o]=r[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t},e.prototype.defineClass=function(){function t(n){Ue(this,n)}return this.mapToClass(t)},e.prototype.add=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=Qr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"add",keys:n!=null?[n]:null,values:[s]})}).then(function(l){return l.numFailures?D.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{ot(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!Le(t)){var r=Lt(t,this.schema.primKey.keyPath);if(r===void 0)return we(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ve(n).forEach(function(i){ot(t,i,n[i])}):n(t,{value:t,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}else return this.where(":id").equals(t).modify(n)},e.prototype.put=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=Qr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"put",values:[s],keys:n!=null?[n]:null})}).then(function(l){return l.numFailures?D.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{ot(t,a,l)}catch{}return l})},e.prototype.delete=function(t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"delete",keys:[t]})}).then(function(r){return r.numFailures?D.reject(r.failures[0]):void 0})},e.prototype.clear=function(){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"deleteRange",range:dd})}).then(function(n){return n.numFailures?D.reject(n.failures[0]):void 0})},e.prototype.bulkGet=function(t){var n=this;return this._trans("readonly",function(r){return n.core.getMany({keys:t,trans:r}).then(function(i){return i.map(function(o){return n.hook.reading.fire(o)})})})},e.prototype.bulkAdd=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=c&&u?t.map(Qr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:p,wantResults:a}).then(function(f){var h=f.numFailures,m=f.results,g=f.lastResult,b=f.failures,v=a?m:g;if(h===0)return v;throw new dr(i.name+".bulkAdd(): "+h+" of "+d+" operations failed",b)})})},e.prototype.bulkPut=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=c&&u?t.map(Qr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:p,wantResults:a}).then(function(f){var h=f.numFailures,m=f.results,g=f.lastResult,b=f.failures,v=a?m:g;if(h===0)return v;throw new dr(i.name+".bulkPut(): "+h+" of "+d+" operations failed",b)})})},e.prototype.bulkDelete=function(t){var n=this,r=t.length;return this._trans("readwrite",function(i){return n.core.mutate({trans:i,type:"delete",keys:t})}).then(function(i){var o=i.numFailures,a=i.lastResult,s=i.failures;if(o===0)return a;throw new dr(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function Fr(e){var t={},n=function(s,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return t[s].subscribe.apply(null,c),e}else if(typeof s=="string")return t[s]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(s,l,u){if(typeof s=="object")return a(s);l||(l=zv),u||(u=ne);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(p){return p!==d}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){ve(s).forEach(function(l){var u=s[l];if(Le(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Ur,function(){for(var p=arguments.length,f=new Array(p);p--;)f[p]=arguments[p];c.subscribers.forEach(function(h){Kc(function(){h.apply(null,f)})})});else throw new V.InvalidArgument("Invalid event config")})}}function Vr(e,t){return qn(t).from({prototype:e}),t}function iy(e){return Vr(ry.prototype,function(n,r,i){this.db=e,this._tx=i,this.name=n,this.schema=r,this.hook=e._allTables[n]?e._allTables[n].hook:Fr(null,{creating:[Bv,ne],reading:[Vv,Ur],updating:[Hv,ne],deleting:[jv,ne]})})}function Sn(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ko(e,t){e.filter=vn(e.filter,t)}function xo(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return vn(r(),t())}:t,e.justLimit=n&&!r}function oy(e,t){e.isMatch=vn(e.isMatch,t)}function di(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new V.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function xl(e,t,n){var r=di(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function Jr(e,t,n,r){var i=e.replayFilter?vn(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(p){return l.stop(p)},function(p){return l.fail(p)})){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),ze(o,d)||(o[d]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Al(xl(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Al(xl(e,r,n),vn(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Al(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=ue(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(l){return s=l},function(l){a.stop(l),s=ne},function(l){a.fail(l),s=ne}))&&o(a.value,a,function(l){return s=l}),s()})})}function De(e,t){try{var n=Tl(e),r=Tl(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return sy(Rl(e),Rl(t));case"Array":return ay(e,t)}}catch{}return NaN}function ay(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=De(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function sy(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}function Tl(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=ta(e);return n==="ArrayBuffer"?"binary":n}function Rl(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ly=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,we.bind(null,r.error)):r.table._trans("readonly",t).then(n)},e.prototype._write=function(t){var n=this._ctx;return n.error?n.table._trans(null,we.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=vn(n.algorithm,t)},e.prototype._iterate=function(t,n){return Jr(this._ctx,t,n,this._ctx.table.core)},e.prototype.clone=function(t){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&Ue(r,t),n._ctx=r,n},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(t){var n=this._ctx;return this._read(function(r){return Jr(n,t,r,n.table.core)})},e.prototype.count=function(t){var n=this;return this._read(function(r){var i=n._ctx,o=i.table.core;if(Sn(i,!0))return o.count({trans:r,query:{index:di(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return Jr(i,function(){return++a,!1},r,o).then(function(){return a})}).then(t)},e.prototype.sortBy=function(t,n){var r=t.split(".").reverse(),i=r[0],o=r.length-1;function a(u,c){return c?a(u[r[c]],c-1):u[i]}var s=this._ctx.dir==="next"?1:-1;function l(u,c){var d=a(u,o),p=a(c,o);return d<p?-s:d>p?s:0}return this.toArray(function(u){return u.sort(l)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&Sn(i,!0)&&i.limit>0){var o=i.valueMapper,a=di(i,i.table.core.schema);return i.table.core.query({trans:r,limit:i.limit,values:!0,query:{index:a,range:i.range}}).then(function(l){var u=l.result;return o?u.map(o):u})}else{var s=[];return Jr(i,function(l){return s.push(l)},r,i.table.core).then(function(){return s})}},t)},e.prototype.offset=function(t){var n=this._ctx;return t<=0?this:(n.offset+=t,Sn(n)?xo(n,function(){var r=t;return function(i,o){return r===0?!0:r===1?(--r,!1):(o(function(){i.advance(r),r=0}),!1)}}):xo(n,function(){var r=t;return function(){return--r<0}}),this)},e.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),xo(this._ctx,function(){var n=t;return function(r,i,o){return--n<=0&&i(o),n>=0}},!0),this},e.prototype.until=function(t,n){return ko(this._ctx,function(r,i,o){return t(r.value)?(i(o),n):!0}),this},e.prototype.first=function(t){return this.limit(1).toArray(function(n){return n[0]}).then(t)},e.prototype.last=function(t){return this.reverse().first(t)},e.prototype.filter=function(t){return ko(this._ctx,function(n){return t(n.value)}),oy(this._ctx,t),this},e.prototype.and=function(t){return this.filter(t)},e.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},e.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.key,i)})},e.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},e.prototype.eachPrimaryKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.primaryKey,i)})},e.prototype.keys=function(t){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.key)}).then(function(){return r}).then(t)},e.prototype.primaryKeys=function(t){var n=this._ctx;if(n.dir==="next"&&Sn(n,!0)&&n.limit>0)return this._read(function(i){var o=di(n,n.table.core.schema);return n.table.core.query({trans:i,values:!1,limit:n.limit,query:{index:o,range:n.range}})}).then(function(i){var o=i.result;return o}).then(t);n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.primaryKey)}).then(function(){return r}).then(t)},e.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},e.prototype.firstKey=function(t){return this.limit(1).keys(function(n){return n[0]}).then(t)},e.prototype.lastKey=function(t){return this.reverse().firstKey(t)},e.prototype.distinct=function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return ko(this._ctx,function(i){var o=i.primaryKey.toString(),a=ze(r,o);return r[o]=!0,!a}),this},e.prototype.modify=function(t){var n=this,r=this._ctx;return this._write(function(i){var o;if(typeof t=="function")o=t;else{var a=ve(t),s=a.length;o=function(b){for(var v=!1,_=0;_<s;++_){var y=a[_],C=t[y];Lt(b,y)!==C&&(ot(b,y,C),v=!0)}return v}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,d=u.extractKey,p=n.db._options.modifyChunkSize||200,f=[],h=0,m=[],g=function(b,v){var _=v.failures,y=v.numFailures;h+=b-y;for(var C=0,E=ve(_);C<E.length;C++){var S=E[C];f.push(_[S])}};return n.clone().primaryKeys().then(function(b){var v=function(_){var y=Math.min(p,b.length-_);return l.getMany({trans:i,keys:b.slice(_,_+y),cache:"immutable"}).then(function(C){for(var E=[],S=[],I=c?[]:null,x=[],R=0;R<y;++R){var A=C[R],O={value:Dr(A),primKey:b[_+R]};o.call(O,O.value,O)!==!1&&(O.value==null?x.push(b[_+R]):!c&&De(d(A),d(O.value))!==0?(x.push(b[_+R]),E.push(O.value)):(S.push(O.value),c&&I.push(b[_+R])))}var k=Sn(r)&&r.limit===1/0&&(typeof t!="function"||t===Ao)&&{index:r.index,range:r.range};return Promise.resolve(E.length>0&&l.mutate({trans:i,type:"add",values:E}).then(function(U){for(var T in U.failures)x.splice(parseInt(T),1);g(E.length,U)})).then(function(){return(S.length>0||k&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:I,values:S,criteria:k,changeSpec:typeof t!="function"&&t}).then(function(U){return g(S.length,U)})}).then(function(){return(x.length>0||k&&t===Ao)&&l.mutate({trans:i,type:"delete",keys:x,criteria:k}).then(function(U){return g(x.length,U)})}).then(function(){return b.length>_+y&&v(_+p)})})};return v(0).then(function(){if(f.length>0)throw new Ri("Error modifying one or more objects",f,h,m);return b.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return Sn(t)&&(t.isPrimKey&&!ny||n.type===3)?this._write(function(r){var i=t.table.core.schema.primaryKey,o=n;return t.table.core.count({trans:r,query:{index:i,range:o}}).then(function(a){return t.table.core.mutate({trans:r,type:"deleteRange",range:o}).then(function(s){var l=s.failures;s.lastResult,s.results;var u=s.numFailures;if(u)throw new Ri("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(Ao)},e}(),Ao=function(e,t){return t.value=null};function uy(e){return Vr(ly.prototype,function(n,r){this.db=e;var i=dd,o=null;if(r)try{i=r()}catch(u){o=u}var a=n._ctx,s=a.table,l=s.hook.reading.fire;this._ctx={table:s,index:a.index,isPrimKey:!a.index||s.schema.primKey.keyPath&&a.index===s.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:a.or,valueMapper:l!==Ur?l:null}})}function cy(e,t){return e<t?-1:e===t?0:1}function dy(e,t){return e>t?-1:e===t?0:1}function Be(e,t,n){var r=e instanceof pd?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function kn(e){return new e.Collection(e,function(){return fd("")}).limit(0)}function fy(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function py(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function hy(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var u=t[l];if(u!==r[l])return i(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):i(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[l],u)<0&&(s=l)}return a<r.length&&o==="next"?e+n.substr(e.length):a<e.length&&o==="prev"?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}function Xr(e,t,n,r){var i,o,a,s,l,u,c,d=n.length;if(!n.every(function(m){return typeof m=="string"}))return Be(e,ud);function p(m){i=fy(m),o=py(m),a=m==="next"?cy:dy;var g=n.map(function(b){return{lower:o(b),upper:i(b)}}).sort(function(b,v){return a(b.lower,v.lower)});s=g.map(function(b){return b.upper}),l=g.map(function(b){return b.lower}),u=m,c=m==="next"?"":r}p("next");var f=new e.Collection(e,function(){return Mt(s[0],l[d-1]+r)});f._ondirectionchange=function(m){p(m)};var h=0;return f._addAlgorithm(function(m,g,b){var v=m.key;if(typeof v!="string")return!1;var _=o(v);if(t(_,l,h))return!0;for(var y=null,C=h;C<d;++C){var E=hy(v,_,s[C],l[C],a,u);E===null&&y===null?h=C+1:(y===null||a(y,E)>0)&&(y=E)}return g(y!==null?function(){m.continue(y+c)}:b),!1}),f}function Mt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function fd(e){return{type:1,lower:e,upper:e}}var pd=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(t,n,r,i){r=r!==!1,i=i===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(r||i)&&!(r&&i)?kn(this):new this.Collection(this,function(){return Mt(t,n,!r,!i)})}catch{return Be(this,_t)}},e.prototype.equals=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return fd(t)})},e.prototype.above=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(t,void 0,!1)})},e.prototype.below=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?Be(this,_t):new this.Collection(this,function(){return Mt(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?Be(this,ud):this.between(t,t+un,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):Xr(this,function(n,r){return n.indexOf(r[0])===0},[t],un)},e.prototype.equalsIgnoreCase=function(t){return Xr(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Et.apply(An,arguments);return t.length===0?kn(this):Xr(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Et.apply(An,arguments);return t.length===0?kn(this):Xr(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,un)},e.prototype.anyOf=function(){var t=this,n=Et.apply(An,arguments),r=this._cmp;try{n.sort(r)}catch{return Be(this,_t)}if(n.length===0)return kn(this);var i=new this.Collection(this,function(){return Mt(n[0],n[n.length-1])});i._ondirectionchange=function(a){r=a==="next"?t._ascending:t._descending,n.sort(r)};var o=0;return i._addAlgorithm(function(a,s,l){for(var u=a.key;r(u,n[o])>0;)if(++o,o===n.length)return s(l),!1;return r(u,n[o])===0?!0:(s(function(){a.continue(n[o])}),!1)}),i},e.prototype.notEqual=function(t){return this.inAnyRange([[pa,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Et.apply(An,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Be(this,_t)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[pa,i]]},null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(t,n){var r=this,i=this._cmp,o=this._ascending,a=this._descending,s=this._min,l=this._max;if(t.length===0)return kn(this);if(!t.every(function(C){return C[0]!==void 0&&C[1]!==void 0&&o(C[0],C[1])<=0}))return Be(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);var u=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;function d(C,E){for(var S=0,I=C.length;S<I;++S){var x=C[S];if(i(E[0],x[1])<0&&i(E[1],x[0])>0){x[0]=s(x[0],E[0]),x[1]=l(x[1],E[1]);break}}return S===I&&C.push(E),C}var p=o;function f(C,E){return p(C[0],E[0])}var h;try{h=t.reduce(d,[]),h.sort(f)}catch{return Be(this,_t)}var m=0,g=c?function(C){return o(C,h[m][1])>0}:function(C){return o(C,h[m][1])>=0},b=u?function(C){return a(C,h[m][0])>0}:function(C){return a(C,h[m][0])>=0};function v(C){return!g(C)&&!b(C)}var _=g,y=new this.Collection(this,function(){return Mt(h[0][0],h[h.length-1][1],!u,!c)});return y._ondirectionchange=function(C){C==="next"?(_=g,p=o):(_=b,p=a),h.sort(f)},y._addAlgorithm(function(C,E,S){for(var I=C.key;_(I);)if(++m,m===h.length)return E(S),!1;return v(I)?!0:(r._cmp(I,h[m][1])===0||r._cmp(I,h[m][0])===0||E(function(){p===o?C.continue(h[m][0]):C.continue(h[m][1])}),!1)}),y},e.prototype.startsWithAnyOf=function(){var t=Et.apply(An,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?kn(this):this.inAnyRange(t.map(function(n){return[n,n+un]})):Be(this,"startsWithAnyOf() only works with strings")},e}();function my(e){return Vr(pd.prototype,function(n,r,i){this.db=e,this._ctx={table:n,index:r===":id"?null:r,or:i};var o=e._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=function(a,s){return o.cmp(s,a)},this._max=function(a,s){return o.cmp(a,s)>0?a:s},this._min=function(a,s){return o.cmp(a,s)<0?a:s},this._IDBKeyRange=e._deps.IDBKeyRange})}function lt(e){return ue(function(t){return Cr(t),e(t.target.error),!1})}function Cr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Er="storagemutated",zt="x-storagemutated-1",qt=Fr(null,Er),gy=function(){function e(){}return e.prototype._lock=function(){return ir(!M.global),++this._reculock,this._reculock===1&&!M.global&&(M.lockOwnerFor=this),this},e.prototype._unlock=function(){if(ir(!M.global),--this._reculock===0)for(M.global||(M.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{Qn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&M.lockOwnerFor!==this},e.prototype.create=function(t){var n=this;if(!this.mode)return this;var r=this.db.idbdb,i=this.db._state.dbOpenError;if(ir(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new V.DatabaseClosed(i);case"MissingAPIError":throw new V.MissingAPI(i.message,i);default:throw new V.OpenFailed(i)}if(!this.active)throw new V.TransactionInactive;return ir(this._completion._state===null),t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),t.onerror=ue(function(o){Cr(o),n._reject(t.error)}),t.onabort=ue(function(o){Cr(o),n.active&&n._reject(new V.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=ue(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&qt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return we(new V.ReadOnly("Transaction is readonly"));if(!this.active)return we(new V.TransactionInactive);if(this._locked())return new D(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},M])});if(r)return Wt(function(){var a=new D(function(s,l){i._lock();var u=n(s,l,i);u&&u.then&&u.then(s,l)});return a.finally(function(){return i._unlock()}),a._lib=!0,a});var o=new D(function(a,s){var l=n(a,s,i);l&&l.then&&l.then(a,s)});return o._lib=!0,o},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(t){var n=this._root(),r=D.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then(function(){return r});else{n._waitingFor=r,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);(function a(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=a)})()}var o=n._waitingFor;return new D(function(a,s){r.then(function(l){return n._waitingQueue.push(ue(a.bind(null,l)))},function(l){return n._waitingQueue.push(ue(s.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(ze(n,t))return n[t];var r=this.schema[t];if(!r)throw new V.NotFound("Table "+t+" not part of transaction");var i=new this.db.Table(t,r,this);return i.core=this.db.core.table(t),n[t]=i,i},e}();function vy(e){return Vr(gy.prototype,function(n,r,i,o,a){var s=this;this.db=e,this.mode=n,this.storeNames=r,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=Fr(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new D(function(l,u){s._resolve=l,s._reject=u}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(l){var u=s.active;return s.active=!1,s.on.error.fire(l),s.parent?s.parent._reject(l):u&&s.idbtrans&&s.idbtrans.abort(),we(l)})})}function ha(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+hd(t)}}function hd(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function md(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:Wc(n,function(r){return[r.name,r]})}}function yy(e){return e.length===1?e[0]:e}var Ir=function(e){try{return e.only([[]]),Ir=function(){return[[]]},[[]]}catch{return Ir=function(){return un},un}};function ma(e){return e==null?function(){}:typeof e=="string"?_y(e):function(t){return Lt(t,e)}}function _y(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return Lt(n,e)}}function Ll(e){return[].slice.call(e)}var by=0;function pr(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function wy(e,t,n){function r(d,p){var f=Ll(d.objectStoreNames);return{schema:{name:d.name,tables:f.map(function(h){return p.objectStore(h)}).map(function(h){var m=h.keyPath,g=h.autoIncrement,b=Le(m),v=m==null,_={},y={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:v,compound:b,keyPath:m,autoIncrement:g,unique:!0,extractKey:ma(m)},indexes:Ll(h.indexNames).map(function(C){return h.index(C)}).map(function(C){var E=C.name,S=C.unique,I=C.multiEntry,x=C.keyPath,R=Le(x),A={name:E,compound:R,keyPath:x,unique:S,multiEntry:I,extractKey:ma(x)};return _[pr(x)]=A,A}),getIndexByKeyPath:function(C){return _[pr(C)]}};return _[":id"]=y.primaryKey,m!=null&&(_[pr(m)]=y.primaryKey),y})},hasGetAll:f.length>0&&"getAll"in p.objectStore(f[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(d){if(d.type===3)return null;if(d.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var p=d.lower,f=d.upper,h=d.lowerOpen,m=d.upperOpen,g=p===void 0?f===void 0?null:t.upperBound(f,!!m):f===void 0?t.lowerBound(p,!!h):t.bound(p,f,!!h,!!m);return g}function o(d){var p=d.name;function f(g){var b=g.trans,v=g.type,_=g.keys,y=g.values,C=g.range;return new Promise(function(E,S){E=ue(E);var I=b.objectStore(p),x=I.keyPath==null,R=v==="put"||v==="add";if(!R&&v!=="delete"&&v!=="deleteRange")throw new Error("Invalid operation type: "+v);var A=(_||y||{length:1}).length;if(_&&y&&_.length!==y.length)throw new Error("Given keys array must have same length as given values array.");if(A===0)return E({numFailures:0,failures:{},results:[],lastResult:void 0});var O,k=[],U=[],T=0,B=function(Q){++T,Cr(Q)};if(v==="deleteRange"){if(C.type===4)return E({numFailures:T,failures:U,results:[],lastResult:void 0});C.type===3?k.push(O=I.clear()):k.push(O=I.delete(i(C)))}else{var Z=R?x?[y,_]:[y,null]:[_,null],z=Z[0],ie=Z[1];if(R)for(var oe=0;oe<A;++oe)k.push(O=ie&&ie[oe]!==void 0?I[v](z[oe],ie[oe]):I[v](z[oe])),O.onerror=B;else for(var oe=0;oe<A;++oe)k.push(O=I[v](z[oe])),O.onerror=B}var fe=function(Q){var Ke=Q.target.result;k.forEach(function(Se,yt){return Se.error!=null&&(U[yt]=Se.error)}),E({numFailures:T,failures:U,results:v==="delete"?_:k.map(function(Se){return Se.result}),lastResult:Ke})};O.onerror=function(Q){B(Q),fe(Q)},O.onsuccess=fe})}function h(g){var b=g.trans,v=g.values,_=g.query,y=g.reverse,C=g.unique;return new Promise(function(E,S){E=ue(E);var I=_.index,x=_.range,R=b.objectStore(p),A=I.isPrimaryKey?R:R.index(I.name),O=y?C?"prevunique":"prev":C?"nextunique":"next",k=v||!("openKeyCursor"in A)?A.openCursor(i(x),O):A.openKeyCursor(i(x),O);k.onerror=lt(S),k.onsuccess=ue(function(U){var T=k.result;if(!T){E(null);return}T.___id=++by,T.done=!1;var B=T.continue.bind(T),Z=T.continuePrimaryKey;Z&&(Z=Z.bind(T));var z=T.advance.bind(T),ie=function(){throw new Error("Cursor not started")},oe=function(){throw new Error("Cursor not stopped")};T.trans=b,T.stop=T.continue=T.continuePrimaryKey=T.advance=ie,T.fail=ue(S),T.next=function(){var fe=this,Q=1;return this.start(function(){return Q--?fe.continue():fe.stop()}).then(function(){return fe})},T.start=function(fe){var Q=new Promise(function(Se,yt){Se=ue(Se),k.onerror=lt(yt),T.fail=yt,T.stop=function(Ve){T.stop=T.continue=T.continuePrimaryKey=T.advance=oe,Se(Ve)}}),Ke=function(){if(k.result)try{fe()}catch(Se){T.fail(Se)}else T.done=!0,T.start=function(){throw new Error("Cursor behind last entry")},T.stop()};return k.onsuccess=ue(function(Se){k.onsuccess=Ke,Ke()}),T.continue=B,T.continuePrimaryKey=Z,T.advance=z,Ke(),Q},E(T)},S)})}function m(g){return function(b){return new Promise(function(v,_){v=ue(v);var y=b.trans,C=b.values,E=b.limit,S=b.query,I=E===1/0?void 0:E,x=S.index,R=S.range,A=y.objectStore(p),O=x.isPrimaryKey?A:A.index(x.name),k=i(R);if(E===0)return v({result:[]});if(g){var U=C?O.getAll(k,I):O.getAllKeys(k,I);U.onsuccess=function(z){return v({result:z.target.result})},U.onerror=lt(_)}else{var T=0,B=C||!("openKeyCursor"in O)?O.openCursor(k):O.openKeyCursor(k),Z=[];B.onsuccess=function(z){var ie=B.result;if(!ie)return v({result:Z});if(Z.push(C?ie.value:ie.primaryKey),++T===E)return v({result:Z});ie.continue()},B.onerror=lt(_)}})}}return{name:p,schema:d,mutate:f,getMany:function(g){var b=g.trans,v=g.keys;return new Promise(function(_,y){_=ue(_);for(var C=b.objectStore(p),E=v.length,S=new Array(E),I=0,x=0,R,A=function(T){var B=T.target;(S[B._pos]=B.result)!=null,++x===I&&_(S)},O=lt(y),k=0;k<E;++k){var U=v[k];U!=null&&(R=C.get(v[k]),R._pos=k,R.onsuccess=A,R.onerror=O,++I)}I===0&&_(S)})},get:function(g){var b=g.trans,v=g.key;return new Promise(function(_,y){_=ue(_);var C=b.objectStore(p),E=C.get(v);E.onsuccess=function(S){return _(S.target.result)},E.onerror=lt(y)})},query:m(l),openCursor:h,count:function(g){var b=g.query,v=g.trans,_=b.index,y=b.range;return new Promise(function(C,E){var S=v.objectStore(p),I=_.isPrimaryKey?S:S.index(_.name),x=i(y),R=x?I.count(x):I.count();R.onsuccess=ue(function(A){return C(A.target.result)}),R.onerror=lt(E)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(d){return o(d)}),c={};return u.forEach(function(d){return c[d.name]=d}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(d){var p=c[d];if(!p)throw new Error("Table '"+d+"' not found");return c[d]},MIN_KEY:-1/0,MAX_KEY:Ir(t),schema:s}}function Cy(e,t){return t.reduce(function(n,r){var i=r.create;return $($({},n),i(n))},e)}function Ey(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=Cy(wy(t,i,r),e.dbcore);return{dbcore:o}}function ds(e,t){var n=e._novip,r=t.db,i=Ey(n._middlewares,r,n._deps,t);n.core=i.dbcore,n.tables.forEach(function(o){var a=o.name;n.core.schema.tables.some(function(s){return s.name===a})&&(o.core=n.core.table(a),n[a]instanceof n.Table&&(n[a].core=o.core))})}function Pi(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=ns(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?Nt(s,o,{get:function(){return this.table(o)},set:function(u){zc(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function ga(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Iy(e,t){return e._cfg.version-t._cfg.version}function Sy(e,t,n,r){var i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var a=o._reject.bind(o),s=M.transless||M;Wt(function(){M.trans=o,M.transless=s,t===0?(ve(i).forEach(function(l){fs(n,l,i[l].primKey,i[l].indexes)}),ds(e,n),D.follow(function(){return e.on.populate.fire(o)}).catch(a)):ky(e,t,o,n).catch(a)})}function ky(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=ps(i,i.idbdb,r),l=!1,u=a.filter(function(d){return d._cfg.version>=t});u.forEach(function(d){o.push(function(){var p=s,f=d._cfg.dbschema;ya(i,p,r),ya(i,f,r),s=i._dbSchema=f;var h=gd(p,f);h.add.forEach(function(y){fs(r,y[0],y[1].primKey,y[1].indexes)}),h.change.forEach(function(y){if(y.recreate)throw new V.Upgrade("Not yet support for changing primary key");var C=r.objectStore(y.name);y.add.forEach(function(E){return va(C,E)}),y.change.forEach(function(E){C.deleteIndex(E.name),va(C,E)}),y.del.forEach(function(E){return C.deleteIndex(E)})});var m=d._cfg.contentUpgrade;if(m&&d._cfg.version>t){ds(i,r),n._memoizedTables={},l=!0;var g=$c(f);h.del.forEach(function(y){g[y]=p[y]}),ga(i,[i.Transaction.prototype]),Pi(i,[i.Transaction.prototype],ve(g),g),n.schema=g;var b=rs(m);b&&Zn();var v,_=D.follow(function(){if(v=m(n),v&&b){var y=Dt.bind(null,null);v.then(y,y)}});return v&&typeof v.then=="function"?D.resolve(v):_.then(function(){return v})}}),o.push(function(p){if(!l||!ty){var f=d._cfg.dbschema;Ay(f,p)}ga(i,[i.Transaction.prototype]),Pi(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?D.resolve(o.shift()(n.idbtrans)).then(c):D.resolve()}return c().then(function(){xy(s,r)})}function gd(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],o=t[r];if(!i)n.add.push([r,o]);else{var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!to)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,l=o.idxByName,u=void 0;for(u in s)l[u]||a.del.push(u);for(u in l){var c=s[u],d=l[u];c?c.src!==d.src&&a.change.push(d):a.add.push(d)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function fs(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(o){return va(i,o)}),i}function xy(e,t){ve(e).forEach(function(n){t.db.objectStoreNames.contains(n)||fs(t,n,e[n].primKey,e[n].indexes)})}function Ay(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function va(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function ps(e,t,n){var r={},i=Xi(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=ha(hd(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var d=a.index(a.indexNames[c]);s=d.keyPath;var p=ha(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);u.push(p)}r[o]=md(o,l,u)}),r}function Ty(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=ps(r,t,n);r._storeNames=Xi(t.objectStoreNames,0),Pi(r,[r._allTables],ve(i),i)}function Ry(e,t){var n=ps(e,e.idbdb,t),r=gd(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function ya(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var l=0;l<s.indexNames.length;++l){var u=s.indexNames[l],c=s.index(u).keyPath,d=typeof c=="string"?c:"["+Xi(c).join("+")+"]";if(t[a]){var p=t[a].idxByName[d];p&&(p.name=u,delete t[a].idxByName[d],t[a].idxByName[u]=p)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&ae.WorkerGlobalScope&&ae instanceof ae.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function Ly(e){return e.split(",").map(function(t,n){t=t.trim();var r=t.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return ha(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),Le(i),n===0)})}var Oy=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ve(t).forEach(function(r){if(t[r]!==null){var i=Ly(t[r]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),n[r]=md(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?Ue(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){Ue(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,ga(n,[n._allTables,n,n.Transaction.prototype]),Pi(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ve(o),o),n._storeNames=ve(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=as(this._cfg.contentUpgrade||ne,t),this},e}();function Ny(e){return Vr(Oy.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function hs(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ys(no,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function ms(e){return e&&typeof e.databases=="function"}function Dy(e){var t=e.indexedDB,n=e.IDBKeyRange;return ms(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==no})}):hs(t,n).toCollection().primaryKeys()}function Uy(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!ms(n)&&t!==no&&hs(n,r).put({name:t}).catch(ne)}function Py(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!ms(n)&&t!==no&&hs(n,r).delete(t).catch(ne)}function _a(e){return Wt(function(){return M.letThrough=!0,e()})}function My(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise(function(n){var r=function(){return indexedDB.databases().finally(n)};t=setInterval(r,100),r()}).finally(function(){return clearInterval(t)})}function Fy(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?we(t.dbOpenError):e});gt&&(t.openCanceller._stackHolder=bn()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new V.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return D.race([r,(typeof navigator>"u"?D.resolve():My()).then(function(){return new D(function(l,u){if(i(),!n)throw new V.MissingAPI;var c=e.name,d=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!d)throw new V.MissingAPI;d.onerror=lt(u),d.onblocked=ue(e._fireOnBlocked),d.onupgradeneeded=ue(function(p){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=Cr,a.abort(),d.result.close();var f=n.deleteDatabase(c);f.onsuccess=f.onerror=ue(function(){u(new V.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=lt(u);var h=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;s=h<1,e._novip.idbdb=d.result,Sy(e,h/10,a,u)}},u),d.onsuccess=ue(function(){a=null;var p=e._novip.idbdb=d.result,f=Xi(p.objectStoreNames);if(f.length>0)try{var h=p.transaction(yy(f),"readonly");t.autoSchema?Ty(e,p,h):(ya(e,e._dbSchema,h),Ry(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),ds(e,h)}catch{}fr.push(e),p.onversionchange=ue(function(m){t.vcFired=!0,e.on("versionchange").fire(m)}),p.onclose=ue(function(m){e.on("close").fire(m)}),s&&Uy(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],D.resolve(_a(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(as,ne);return t.onReadyBeingFired=[],D.resolve(_a(function(){return u(e.vip)})).then(l)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(l){t.dbOpenError=l;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),we(l)}).finally(function(){t.openComplete=!0,o()})}function ba(e){var t=function(a){return e.next(a)},n=function(a){return e.throw(a)},r=o(t),i=o(n);function o(a){return function(s){var l=a(s),u=l.value;return l.done?u:!u||typeof u.then!="function"?Le(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function Vy(e,t,n){var r=arguments.length;if(r<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=qc(i);return[e,o,n]}function vd(e,t,n,r,i){return D.resolve().then(function(){var o=M.transless||M,a=e._createTransaction(t,n,e._dbSchema,r),s={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(d){return d.name===os.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return vd(e,t,n,null,i)})):we(d)}var l=rs(i);l&&Zn();var u,c=D.follow(function(){if(u=i.call(a,a),u)if(l){var d=Dt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=ba(u))},s);return(u&&typeof u.then=="function"?D.resolve(u).then(function(d){return a.active?d:we(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(d){return r&&a._resolve(),a._completion.then(function(){return d})}).catch(function(d){return a._reject(d),we(d)})})}function ei(e,t,n){for(var r=Le(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function By(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(m,g,b){var v=pr(m),_=i[v]=i[v]||[],y=m==null?0:typeof m=="string"?1:m.length,C=g>0,E=$($({},b),{isVirtual:C,keyTail:g,keyLength:y,extractKey:ma(m),unique:!C&&b.unique});if(_.push(E),E.isPrimaryKey||o.push(E),y>1){var S=y===2?m[0]:m.slice(0,y-1);a(S,g+1,b)}return _.sort(function(I,x){return I.keyTail-x.keyTail}),E}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var l=0,u=r.indexes;l<u.length;l++){var c=u[l];a(c.keyPath,0,c)}function d(m){var g=i[pr(m)];return g&&g[0]}function p(m,g){return{type:m.type===1?2:m.type,lower:ei(m.lower,m.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:ei(m.upper,m.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function f(m){var g=m.query.index;return g.isVirtual?$($({},m),{query:{index:g,range:p(m.query.range,g.keyTail)}}):m}var h=$($({},n),{schema:$($({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:d}),count:function(m){return n.count(f(m))},query:function(m){return n.query(f(m))},openCursor:function(m){var g=m.query.index,b=g.keyTail,v=g.isVirtual,_=g.keyLength;if(!v)return n.openCursor(m);function y(C){function E(I){I!=null?C.continue(ei(I,m.reverse?e.MAX_KEY:e.MIN_KEY,b)):m.unique?C.continue(C.key.slice(0,_).concat(m.reverse?e.MIN_KEY:e.MAX_KEY,b)):C.continue()}var S=Object.create(C,{continue:{value:E},continuePrimaryKey:{value:function(I,x){C.continuePrimaryKey(ei(I,e.MAX_KEY,b),x)}},primaryKey:{get:function(){return C.primaryKey}},key:{get:function(){var I=C.key;return _===1?I[0]:I.slice(0,_)}},value:{get:function(){return C.value}}});return S}return n.openCursor(f(m)).then(function(C){return C&&y(C)})}});return h}})}var jy={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:By};function gs(e,t,n,r){return n=n||{},r=r||"",ve(e).forEach(function(i){if(!ze(t,i))n[r+i]=void 0;else{var o=e[i],a=t[i];if(typeof o=="object"&&typeof a=="object"&&o&&a){var s=ta(o),l=ta(a);s!==l?n[r+i]=t[i]:s==="Object"?gs(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),ve(t).forEach(function(i){ze(e,i)||(n[r+i]=t[i])}),n}function Hy(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var zy={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=$($({},n),{mutate:function(o){var a=M.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"put":if(u.fire===ne&&c.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(l.fire===ne)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(l.fire===ne)break;return a._promise("readwrite",function(){return p(o)},!0)}return n.mutate(o);function d(h){var m=M.trans,g=h.keys||Hy(r,h);if(!g)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?$($({},h),{keys:g}):$({},h),h.type!=="delete"&&(h.values=Xo([],h.values,!0)),h.keys&&(h.keys=Xo([],h.keys,!0)),Gy(n,h,g).then(function(b){var v=g.map(function(_,y){var C=b[y],E={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(E,_,C,m);else if(h.type==="add"||C===void 0){var S=u.fire.call(E,_,h.values[y],m);_==null&&S!=null&&(_=S,h.keys[y]=_,r.outbound||ot(h.values[y],r.keyPath,_))}else{var I=gs(C,h.values[y]),x=c.fire.call(E,I,_,C,m);if(x){var R=h.values[y];Object.keys(x).forEach(function(A){ze(R,A)?R[A]=x[A]:ot(R,A,x[A])})}}return E});return n.mutate(h).then(function(_){for(var y=_.failures,C=_.results,E=_.numFailures,S=_.lastResult,I=0;I<g.length;++I){var x=C?C[I]:g[I],R=v[I];x==null?R.onerror&&R.onerror(y[I]):R.onsuccess&&R.onsuccess(h.type==="put"&&b[I]?h.values[I]:x)}return{failures:y,results:C,numFailures:E,lastResult:S}}).catch(function(_){return v.forEach(function(y){return y.onerror&&y.onerror(_)}),Promise.reject(_)})})}function p(h){return f(h.trans,h.range,1e4)}function f(h,m,g){return n.query({trans:h,values:!1,query:{index:r,range:m},limit:g}).then(function(b){var v=b.result;return d({type:"delete",keys:v,trans:h}).then(function(_){return _.numFailures>0?Promise.reject(_.failures[0]):v.length<g?{failures:[],numFailures:0,lastResult:void 0}:f(h,$($({},m),{lower:v[v.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function Gy(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function yd(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)De(t.keys[i],e[o])===0&&(r.push(n?Dr(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var Ky={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return $($({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=yd(r.keys,r.trans._cache,r.cache==="clone");return i?D.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Dr(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},To;function vs(e){return!("from"in e)}var wt=function(e,t){if(this)Ue(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new wt;return e&&"d"in e&&Ue(n,e),n}};jn(wt.prototype,(To={add:function(e){return Mi(this,e),this},addKey:function(e){return Sr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Sr(t,n,n)}),this}},To[na]=function(){return wa(this)},To));function Sr(e,t,n){var r=De(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(vs(e))return Ue(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(De(n,e.from)<0)return i?Sr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ol(e);if(De(t,e.to)>0)return o?Sr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ol(e);De(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),De(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&Mi(e,i),o&&a&&Mi(e,o)}}function Mi(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Sr(r,o,a),s&&n(r,s),l&&n(r,l)}vs(t)||n(e,t)}function Wy(e,t){var n=wa(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=wa(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(De(s.from,i.to)<=0&&De(s.to,i.from)>=0)return!0;De(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function wa(e){var t=vs(e)?null:{s:0,n:e};return{next:function(n){for(var r=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&De(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||De(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Ol(e){var t,n,r=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((n=e.l)===null||n===void 0?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){var o=i==="r"?"l":"r",a=$({},e),s=e[i];e.from=s.from,e.to=s.to,e[i]=s[i],a[i]=s[o],e[o]=a,a.d=Nl(a)}e.d=Nl(e)}function Nl(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}var $y={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new wt(e.MIN_KEY,e.MAX_KEY);return $($({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=$($({},i),{mutate:function(p){var f=p.trans,h=f.mutatedParts||(f.mutatedParts={}),m=function(S){var I="idb://"+t+"/"+r+"/"+S;return h[I]||(h[I]=new wt)},g=m(""),b=m(":dels"),v=p.type,_=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[],y=_[0],C=_[1],E=p.trans._cache;return i.mutate(p).then(function(S){if(Le(y)){v!=="delete"&&(y=S.results),g.addKeys(y);var I=yd(y,E);!I&&v!=="add"&&b.addKeys(y),(I||C)&&qy(m,o,I,C)}else if(y){var x={from:y.lower,to:y.upper};b.add(x),g.add(x)}else g.add(n),b.add(n),o.indexes.forEach(function(R){return m(R.name).add(n)});return S})}}),c=function(p){var f,h,m=p.query,g=m.index,b=m.range;return[g,new wt((f=b.lower)!==null&&f!==void 0?f:e.MIN_KEY,(h=b.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},d={get:function(p){return[a,new wt(p.key)]},getMany:function(p){return[a,new wt().addKeys(p.keys)]},count:c,query:c,openCursor:c};return ve(d).forEach(function(p){u[p]=function(f){var h=M.subscr;if(h){var m=function(E){var S="idb://"+t+"/"+r+"/"+E;return h[S]||(h[S]=new wt)},g=m(""),b=m(":dels"),v=d[p](f),_=v[0],y=v[1];if(m(_.name||"").add(y),!_.isPrimaryKey)if(p==="count")b.add(n);else{var C=p==="query"&&l&&f.values&&i.query($($({},f),{values:!1}));return i[p].apply(this,arguments).then(function(E){if(p==="query"){if(l&&f.values)return C.then(function(R){var A=R.result;return g.addKeys(A),E});var S=f.values?E.result.map(s):E.result;f.values?g.addKeys(S):b.addKeys(S)}else if(p==="openCursor"){var I=E,x=f.values;return I&&Object.create(I,{key:{get:function(){return b.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var R=I.primaryKey;return b.addKey(R),R}},value:{get:function(){return x&&g.addKey(I.primaryKey),I.value}}})}return E})}}return i[p].apply(this,arguments)}}),u}})}};function qy(e,t,n,r){function i(o){var a=e(o.name||"");function s(u){return u!=null?o.extractKey(u):null}var l=function(u){return o.multiEntry&&Le(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var d=n&&s(n[c]),p=r&&s(r[c]);De(d,p)!==0&&(d!=null&&l(d),p!=null&&l(p))})}t.indexes.forEach(i)}var ys=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=$({addons:e.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var o=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ne,dbReadyPromise:null,cancelOpen:ne,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new D(function(s){a.dbReadyResolve=s}),a.openCanceller=new D(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=Fr(this,"populate","blocked","versionchange","close",{ready:[as,ne]}),this.on.ready.subscribe=Gc(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||D.resolve().then(l),u&&s(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&s(l);else{s(l);var d=r;u||s(function p(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(p)})}})}}),this.Collection=uy(this),this.Table=iy(this),this.Transaction=vy(this),this.Version=Ny(this),this.WhereClause=my(this),this.on("versionchange",function(s){s.newVersion>0?console.warn("Another connection wants to upgrade database '"+r.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+r.name+"'. Closing db now to resume the delete request."),r.close()}),this.on("blocked",function(s){!s.newVersion||s.newVersion<s.oldVersion?console.warn("Dexie.delete('"+r.name+"') was blocked"):console.warn("Upgrade '"+r.name+"' blocked by other connection holding version "+s.oldVersion/10)}),this._maxKey=Ir(n.IDBKeyRange),this._createTransaction=function(s,l,u,c){return new r.Transaction(s,l,u,r._options.chromeTransactionDurability,c)},this._fireOnBlocked=function(s){r.on("blocked").fire(s),fr.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(jy),this.use(zy),this.use($y),this.use(Ky),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(function(s){return s(r)})}return e.prototype.version=function(t){if(isNaN(t)||t<.1)throw new V.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var n=this._versions,r=n.filter(function(i){return i._cfg.version===t})[0];return r||(r=new this.Version(t),n.push(r),n.sort(Iy),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||M.letThrough||this._vip)?t():new D(function(r,i){if(n._state.openComplete)return i(new V.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new V.DatabaseClosed);return}n.open().catch(ne)}n._state.dbReadyPromise.then(r,i)}).then(t)},e.prototype.use=function(t){var n=t.stack,r=t.create,i=t.level,o=t.name;o&&this.unuse({stack:n,name:o});var a=this._middlewares[n]||(this._middlewares[n]=[]);return a.push({stack:n,create:r,level:i==null?10:i,name:o}),a.sort(function(s,l){return s.level-l.level}),this},e.prototype.unuse=function(t){var n=t.stack,r=t.name,i=t.create;return n&&this._middlewares[n]&&(this._middlewares[n]=this._middlewares[n].filter(function(o){return i?o.create!==i:r?o.name!==r:!1})),this},e.prototype.open=function(){return Fy(this)},e.prototype._close=function(){var t=this._state,n=fr.indexOf(this);if(n>=0&&fr.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new D(function(r){t.dbReadyResolve=r}),t.openCanceller=new D(function(r,i){t.cancelOpen=i})},e.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new V.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},e.prototype.delete=function(){var t=this,n=arguments.length>0,r=this._state;return new D(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=ue(function(){Py(t._deps,t.name),i()}),s.onerror=lt(o),s.onblocked=t._fireOnBlocked};if(n)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return this.idbdb!==null},e.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"},e.prototype.hasFailed=function(){return this._state.dbOpenError!==null},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var t=this;return ve(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=Vy.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=M.trans;(!o||o.db!==this||t.indexOf("!")!==-1)&&(o=null);var a=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");var s,l;try{if(l=n.map(function(c){var d=c instanceof i.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),t=="r"||t===Io)s=Io;else if(t=="rw"||t==So)s=So;else throw new V.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===Io&&s===So)if(a)o=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o&&l.forEach(function(c){if(o&&o.storeNames.indexOf(c)===-1)if(a)o=null;else throw new V.SubTransaction("Table "+c+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(c){return o?o._promise(null,function(d,p){p(c)}):we(c)}var u=vd.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):M.trans?Qn(M.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!ze(this._allTables,t))throw new V.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),Yy=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Zy=function(){function e(t){this._subscribe=t}return e.prototype.subscribe=function(t,n,r){return this._subscribe(!t||typeof t=="function"?{next:t,error:n,complete:r}:t)},e.prototype[Yy]=function(){return this},e}();function _d(e,t){return ve(t).forEach(function(n){var r=e[n]||(e[n]=new wt);Mi(r,t[n])}),e}function Qy(e){var t=!1,n=void 0,r=new Zy(function(i){var o=rs(e);function a(g){o&&Zn();var b=function(){return Wt(e,{subscr:g,trans:null})},v=M.trans?Qn(M.transless,b):b();return o&&v.then(Dt,Dt),v}var s=!1,l={},u={},c={get closed(){return s},unsubscribe:function(){s=!0,qt.storagemutated.unsubscribe(h)}};i.start&&i.start(c);var d=!1,p=!1;function f(){return ve(u).some(function(g){return l[g]&&Wy(l[g],u[g])})}var h=function(g){_d(l,g),f()&&m()},m=function(){if(!(d||s)){l={};var g={},b=a(g);p||(qt(Er,h),p=!0),d=!0,Promise.resolve(b).then(function(v){t=!0,n=v,d=!1,!s&&(f()?m():(l={},u=g,i.next&&i.next(v)))},function(v){d=!1,t=!1,i.error&&i.error(v),c.unsubscribe()})}};return m(),c});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var Ca;try{Ca={indexedDB:ae.indexedDB||ae.mozIndexedDB||ae.webkitIndexedDB||ae.msIndexedDB,IDBKeyRange:ae.IDBKeyRange||ae.webkitIDBKeyRange}}catch{Ca={indexedDB:null,IDBKeyRange:null}}var rn=ys;jn(rn,$($({},eo),{delete:function(e){var t=new rn(e,{addons:[]});return t.delete()},exists:function(e){return new rn(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return Dy(rn.dependencies).then(e)}catch{return we(new V.MissingAPI)}},defineClass:function(){function e(t){Ue(this,t)}return e},ignoreTransaction:function(e){return M.trans?Qn(M.transless,e):e()},vip:_a,async:function(e){return function(){try{var t=ba(e.apply(this,arguments));return!t||typeof t.then!="function"?D.resolve(t):t}catch(n){return we(n)}}},spawn:function(e,t,n){try{var r=ba(e.apply(n,t||[]));return!r||typeof r.then!="function"?D.resolve(r):r}catch(i){return we(i)}},currentTransaction:{get:function(){return M.trans||null}},waitFor:function(e,t){var n=D.resolve(typeof e=="function"?rn.ignoreTransaction(e):e).timeout(t||6e4);return M.trans?M.trans.waitFor(n):n},Promise:D,debug:{get:function(){return gt},set:function(e){Zc(e,e==="dexie"?function(){return!0}:cd)}},derive:qn,extend:Ue,props:jn,override:Gc,Events:Fr,on:qt,liveQuery:Qy,extendObservabilitySet:_d,getByKeyPath:Lt,setByKeyPath:ot,delByKeyPath:Tv,shallowClone:$c,deepClone:Dr,getObjectDiff:gs,cmp:De,asap:Kc,minKey:pa,addons:[],connections:fr,errnames:os,dependencies:Ca,semVer:kl,version:kl.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));rn.maxKey=Ir(rn.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(qt(Er,function(e){if(!xt){var t;to?(t=document.createEvent("CustomEvent"),t.initCustomEvent(zt,!0,!0,e)):t=new CustomEvent(zt,{detail:e}),xt=!0,dispatchEvent(t),xt=!1}}),addEventListener(zt,function(e){var t=e.detail;xt||Fi(t)}));function Fi(e){var t=xt;try{xt=!0,qt.storagemutated.fire(e)}finally{xt=t}}var xt=!1;if(typeof BroadcastChannel<"u"){var ti=new BroadcastChannel(zt);typeof ti.unref=="function"&&ti.unref(),qt(Er,function(e){xt||ti.postMessage(e)}),ti.onmessage=function(e){e.data&&Fi(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){qt(Er,function(e){try{xt||(typeof localStorage<"u"&&localStorage.setItem(zt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Xo([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:zt,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===zt){var t=JSON.parse(e.newValue);t&&Fi(t.changedParts)}});var Dl=self.document&&navigator.serviceWorker;Dl&&Dl.addEventListener("message",Jy)}function Jy(e){var t=e.data;t&&t.type===zt&&Fi(t.changedParts)}D.rejectionMapper=Fv;Zc(gt,cd);var Jn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(Jn||{}),Pn=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Pn||{});const Ea="sprig.sessionId",bd="sprig.disableReplayRecording",Xy=30,wd=()=>{sessionStorage.setItem(bd,"disabled")},yn=()=>!!sessionStorage.getItem(bd),e0=["did not allow mutations","called in an invalid security context"],t0=e=>{if(!e)return!0;for(const t of e0)if(e.toLowerCase().includes(t))return!1;return!0},Ul=(e,t,n)=>{yn()||t instanceof Error&&(wd(),t0(t==null?void 0:t.message)&&(i0(),window.UserLeap.reportError(e,t,n)))},n0=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Ul(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate",i)}):Ul(e,t)},r0=()=>{const e=sessionStorage.getItem(Ea);return e?(sessionStorage.removeItem(Ea),e):Kt()},Fe=r0();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(Ea,Fe)});const i0=()=>{Promise.all([te.events.clear(),te.chunkUploads.clear(),te.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database",e)})},Ro=(e,t,n=()=>!0)=>te.table(t).where("timestamp").below(e).and(n).delete(),o0=()=>{te.events.where("sessionId").equals(Fe).delete(),te.pendingCaptures.where("sessionId").equals(Fe).delete()},a0=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:Fe}});return te.events.bulkAdd(t)},s0=(e,t)=>te.events.where("[sessionId+timestamp]").between([Fe,e],[Fe,t]).toArray(),l0=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:Xy));return te.events.where("[sessionId+timestamp]").between([Fe,e],[Fe,t]).modify({expiredAt:i})},u0=e=>{var t;return te.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:Fe})},c0=(e,t)=>te.chunkUploads.update(e,{data:null,etag:t,status:Jn.UploadComplete}),d0=({status:e,uploadId:t})=>t?te.chunkUploads.where({uploadId:t,status:e}).toArray():te.chunkUploads.where({sessionId:Fe,status:e}).toArray(),f0=e=>te.chunkUploads.where({uploadId:e,status:Jn.UploadComplete}).toArray(),p0=e=>te.chunkUploads.where({uploadId:e,status:Jn.UploadComplete}).delete(),h0=e=>{var t;return te.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:Fe,canUpload:!1})},m0=()=>te.pendingCaptures.where("sessionId").equals(Fe).and(e=>e.targetTimestamp<Date.now()).toArray(),g0=()=>te.pendingCaptures.where("sessionId").equals(Fe).toArray(),v0=e=>te.pendingCaptures.where("sessionId").equals(Fe).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0});class y0 extends ys{constructor(){super("replayStorage",{autoOpen:!1});Ae(this,"events");Ae(this,"chunkUploads");Ae(this,"pendingCaptures")}}const te=new y0;te.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});te.open().catch(()=>{wd()});const _0=async(e,t,n)=>new Promise((r,i)=>{const o=e.createElement("script");o.src=t,o.onload=r,o.onerror=i,n&&(o.nonce=n),e.head.appendChild(o)});let Cd=5e3,Ia=6e4;const b0=5,Pl=1e3,Ed=30,Vi=Ed+b0,_s="sprig.pendingCount";let Ml=0,Fl=Date.now(),bs=!1;const w0=async(e,t,n,r=2,i)=>{try{if(yn()||!t)return;i!=null&&i.minDuration&&(Cd=i.minDuration),i!=null&&i.batchDuration&&(Ia=i.batchDuration),Cv(r),A0(),I0(t+Vi,30*60,t+Vi),S0(),window.rrwebRecord||await _0(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const o=window.rrwebRecord;if(!o)return;let a=!0;o({checkoutEveryNms:Ed*1e3,sampling:{input:"last",scroll:250,media:800},emit:(s,l)=>{if(yn())return;Fl=Date.now();const u=a||!!l;a=!1,C0({uuid:Kt(),event:JSON.stringify(s),isValidStart:u,timestamp:Date.now()})},...i}),bs=!0,Ml||(Ml=window.setInterval(()=>{Date.now()-Fl>Pl&&Br("Sprig_Noop",{})},Pl))}catch(o){pt("Error initializing replay",o)}};let Sa=!1,ka=[];const C0=e=>{ka.push(e),Sa||E0()},E0=()=>{Sa=!0,setTimeout(async()=>{if(yn())return;const e=ka;ka=[],Sa=!1;try{await a0(e)}catch(t){pt("Error storing replay events",t)}},500)},I0=(e=6*60,t=30*60,n=4*60)=>{const r=setInterval(async()=>{const i=Date.now();yn()||await te.transaction("rw",te.events,te.chunkUploads,te.pendingCaptures,()=>{Ro(i-e*1e3,"events",o=>o.expiredAt===void 0||o.expiredAt<i-e*1e3),Ro(i-t*1e3,"chunkUploads"),Ro(i-n*1e3,"pendingCaptures",o=>o.canUpload===void 0||o.canUpload===!1)}).catch(o=>{clearInterval(r),pt("Error deleting table rows",o)})},3e4)},S0=(e=5)=>{setInterval(N0,e*1e3)},k0=async(e,t,n,r,i)=>{try{const o=Math.min(e+i,n),a=await s0(e,o);if(!(a!=null&&a.length))return[r,[]];if(!r){let s=-1;return a==null||a.forEach((l,u)=>{if(!l.isValidStart)return;const c=l.timestamp<=t;(s<0||c)&&(s=u)}),s<0?[]:[!0,a==null?void 0:a.slice(s)]}return[r,a]}catch(o){pt("Error getting events batch",o)}},x0=(e,t,n)=>{const r=e.length,i=t*1024*1024,o=Math.ceil(r/n),a=Math.max(i,o),s=[];let l=0;for(;l<r;)s.push(e.slice(l,l+a)),l+=a;return s},Id=e=>Promise.all(e.map(async t=>{const n=await Iv(t);return await c0(t.uuid,n),t.uploadId})),Sd=async e=>{const t=await f0(e);if(!(t!=null&&t.length))return;t.sort((i,o)=>i.chunkIndex-o.chunkIndex);const n=t.map(i=>({ETag:i.etag,PartNumber:i.chunkIndex})).filter(i=>i.ETag!==null),r=t[0];await Hc({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await p0(e)},A0=async()=>{try{let e=[];if(await te.transaction("rw",te.chunkUploads,async()=>{e=await d0({status:Jn.ReadyForUpload}).catch(n=>{pt("chunkUploads transaction error",n)})}),!(e!=null&&e.length))return;const t=await Id(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Sd(n)}))}catch(e){pt("Error getting chunk upload uuids",e)}},T0=async(e,t)=>{await Id(t),await Promise.all(e.map(n=>Sd(n)))},R0=e=>{let t=0;e.forEach(i=>{t+=i.length});const n=new Uint8Array(t);let r=0;return e.forEach(i=>{n.set(i,r),r+=i.length}),n},Vl=async(e,t,n)=>{const r=new TextEncoder;let i=null,o=null,a=null,s=!1,l=!1,[u,c]=[0,0];const d=e-Vi*1e3,p=[];let f=[];for(let m=d;m<t;m+=Ia){if([l,f]=await k0(m,e,t,l,Ia),!(f!=null&&f.length))continue;u===0&&(u=f[0].timestamp),c=f[f.length-1].timestamp;const g=`${s?",":"["}${f.map(v=>v.event).join(",")}`,b=r.encode(g);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(b)):p.push(b),s=!0}if(c-u<Cd)return null;const h=r.encode("]");return o&&a?(o.write(h),o.close(),i=new Uint8Array(await new Response(a.readable).arrayBuffer())):(p.push(h),i=R0(p)),i},L0=async(e,t)=>{const n=window.CompressionStream!==void 0;let r=null;const i=t!=null?t:Date.now(),o=i-e;try{r=await Vl(o,i,n)}catch(a){if(a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n)try{r=await Vl(o,i,!1)}catch(s){pt("fileData fallback failed",s)}}return r},Bl=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await L0(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=x0(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(d,p)=>{const f=Kt(),h={apiUrl:i,chunkIndex:p+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:Jn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[p].url,uuid:f,visitorId:r};return await u0(h),h}));await T0([a.uploadId],c)},kd=async(e,t)=>{if(!yn())try{const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>Y.removeListener(G.QuestionAnswered,a),0),r.replayDurationType===Pn.Before?await Bl(e):await v0(o)};if(r.replayDurationType===Pn.After||r.replayDurationType===Pn.BeforeAndAfter){n||Y.on(G.QuestionAnswered,a),await O0(e);return}if(n||t)await Bl(e);else{const s=Vi+r.replayDurationSeconds;await l0(i-s*1e3,i,r.expirationTimeLimitMinutes),Y.on(G.QuestionAnswered,a)}}catch(n){pt("Error scheduling or capturing replay",n)}},jl=()=>{if(!yn())try{o0()}catch(e){pt("Error clearing session event data",e)}};let It=sessionStorage.getItem(_s);const O0=async e=>{const{surveyId:t}=e,n=await g0(),r=n==null?void 0:n.filter(a=>a.captureParams.surveyId===t);if(r!=null&&r.length)return;const i={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Pn.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Pn.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,It=It?(parseInt(It)+1).toString():"1",sessionStorage.setItem(_s,It),h0({uuid:Kt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},N0=async()=>{try{if(It&&parseInt(It)>0){const e=await m0();e.length&&await Promise.all(e.map(async t=>{await te.pendingCaptures.delete(t.uuid),await kd(t.captureParams,t.canUpload)})),It=(parseInt(It)-e.length).toString(),sessionStorage.setItem(_s,It)}}catch(e){pt("Error initiating pending captures",e)}},Br=(e,t)=>{var n,r;!bs||(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)},Hl=e=>{Br("Sprig_PageView",e)},D0=e=>{Br("Sprig_TrackEvent",e)},U0=e=>{Br("Sprig_ShowSurvey",e)},P0=e=>{Br("Sprig_SubmitSurvey",e)},pt=(e,t)=>{bs=!1,n0(e,t)};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||{}),St=(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.DoesNotInclude="list_dni",e.Contains="contains",e.DoesNotContain="notcontains",e))(St||{}),Hn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Hn||{}),qe=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(qe||{}),cn=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(cn||{}),jr,P,xd,zn,on,zl,Ad,Td,Bi={},Rd=[],M0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function At(e,t){for(var n in t)e[n]=t[n];return e}function Ld(e){var t=e.parentNode;t&&t.removeChild(e)}function he(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?jr.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return hr(e,a,r,i,null)}function hr(e,t,n,r,i){var o={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:i==null?++xd:i};return i==null&&P.vnode!=null&&P.vnode(o),o}function Od(){return{current:null}}function Je(e){return e.children}function F0(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||ji(e,o,null,n[o],r);for(o in t)i&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===t[o]||ji(e,o,t[o],n[o],r)}function Gl(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||M0.test(t)?n:n+"px"}function ji(e,t,n,r,i){var o;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||Gl(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Gl(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?Wl:Kl,o):e.removeEventListener(t,o?Wl:Kl,o);else if(t!=="dangerouslySetInnerHTML"){if(i)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 Kl(e){zn=!0;try{return this.l[e.type+!1](P.event?P.event(e):e)}finally{zn=!1}}function Wl(e){zn=!0;try{return this.l[e.type+!0](P.event?P.event(e):e)}finally{zn=!1}}function at(e,t){this.props=e,this.context=t}function kr(e,t){if(t==null)return e.__?kr(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"?kr(e):null}function Nd(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 Nd(e)}}function V0(e){zn?setTimeout(e):Ad(e)}function xa(e){(!e.__d&&(e.__d=!0)&&on.push(e)&&!Hi.__r++||zl!==P.debounceRendering)&&((zl=P.debounceRendering)||V0)(Hi)}function Hi(){var e,t,n,r,i,o,a,s;for(on.sort(function(l,u){return l.__v.__b-u.__v.__b});e=on.shift();)e.__d&&(t=on.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=At({},o)).__v=o.__v+1,ws(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?kr(o):a,o.__h),Fd(r,o),o.__e!=a&&Nd(o)),on.length>t&&on.sort(function(l,u){return l.__v.__b-u.__v.__b}));Hi.__r=0}function Dd(e,t,n,r,i,o,a,s,l,u){var c,d,p,f,h,m,g,b=r&&r.__k||Rd,v=b.length;for(n.__k=[],c=0;c<t.length;c++)if((f=n.__k[c]=(f=t[c])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?hr(null,f,null,null,f):Array.isArray(f)?hr(Je,{children:f},null,null,null):f.__b>0?hr(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=b[c])===null||p&&f.key==p.key&&f.type===p.type)b[c]=void 0;else for(d=0;d<v;d++){if((p=b[d])&&f.key==p.key&&f.type===p.type){b[d]=void 0;break}p=null}ws(e,f,p=p||Bi,i,o,a,s,l,u),h=f.__e,(d=f.ref)&&p.ref!=d&&(g||(g=[]),p.ref&&g.push(p.ref,null,f),g.push(d,f.__c||h,f)),h!=null?(m==null&&(m=h),typeof f.type=="function"&&f.__k===p.__k?f.__d=l=Ud(f,l,e):l=Pd(e,f,p,b,h,l),typeof n.type=="function"&&(n.__d=l)):l&&p.__e==l&&l.parentNode!=e&&(l=kr(p))}for(n.__e=m,c=v;c--;)b[c]!=null&&(typeof n.type=="function"&&b[c].__e!=null&&b[c].__e==n.__d&&(n.__d=Md(r).nextSibling),Bd(b[c],b[c]));if(g)for(c=0;c<g.length;c++)Vd(g[c],g[++c],g[++c])}function Ud(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t=typeof r.type=="function"?Ud(r,t,n):Pd(n,r,r,i,r.__e,t));return t}function Ot(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Ot(n,t)}):t.push(e)),t}function Pd(e,t,n,r,i,o){var a,s,l;if(t.__d!==void 0)a=t.__d,t.__d=void 0;else if(n==null||i!=o||i.parentNode==null)e:if(o==null||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<r.length;l+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return a!==void 0?a:i.nextSibling}function Md(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=Md(n)))return r}return null}function ws(e,t,n,r,i,o,a,s,l){var u,c,d,p,f,h,m,g,b,v,_,y,C,E,S,I=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=P.__b)&&u(t);try{e:if(typeof I=="function"){if(g=t.props,b=(u=I.contextType)&&r[u.__c],v=u?b?b.props.value:u.__:r,n.__c?m=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(g,v):(t.__c=c=new at(g,v),c.constructor=I,c.render=j0),b&&b.sub(c),c.props=g,c.state||(c.state={}),c.context=v,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),I.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=At({},c.__s)),At(c.__s,I.getDerivedStateFromProps(g,c.__s))),p=c.props,f=c.state,c.__v=t,d)I.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(I.getDerivedStateFromProps==null&&g!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,v),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,v)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(x){x&&(x.__=t)}),_=0;_<c._sb.length;_++)c.__h.push(c._sb[_]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,v),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,f,h)})}if(c.context=v,c.props=g,c.__P=e,y=P.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,y&&y(t),u=c.render(c.props,c.state,c.context),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[]}else do c.__d=!1,y&&y(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++C<25);c.state=c.__s,c.getChildContext!=null&&(r=At(At({},r),c.getChildContext())),d||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(p,f)),S=u!=null&&u.type===Je&&u.key==null?u.props.children:u,Dd(e,Array.isArray(S)?S:[S],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),m&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=B0(n.__e,t,n,r,i,o,a,l);(u=P.diffed)&&u(t)}catch(x){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),P.__e(x,t,n)}}function Fd(e,t){P.__c&&P.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){P.__e(r,n.__v)}})}function B0(e,t,n,r,i,o,a,s){var l,u,c,d=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((l=o[h])&&"setAttribute"in l==!!f&&(f?l.localName===f:l.nodeType===3)){e=l,o[h]=null;break}}if(e==null){if(f===null)return document.createTextNode(p);e=i?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,p.is&&p),o=null,s=!1}if(f===null)d===p||s&&e.data===p||(e.data=p);else{if(o=o&&jr.call(e.childNodes),u=(d=n.props||Bi).dangerouslySetInnerHTML,c=p.dangerouslySetInnerHTML,!s){if(o!=null)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(F0(e,p,d,i,s),c)t.__k=[];else if(h=t.props.children,Dd(e,Array.isArray(h)?h:[h],t,n,r,i&&f!=="foreignObject",o,a,o?o[0]:n.__k&&kr(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&Ld(o[h]);s||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==d.value)&&ji(e,"value",h,d.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&ji(e,"checked",h,d.checked,!1))}return e}function Vd(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function Bd(e,t,n){var r,i;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Vd(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){P.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Bd(r[i],t,n||typeof e.type!="function");n||e.__e==null||Ld(e.__e),e.__=e.__e=e.__d=void 0}function j0(e,t,n){return this.constructor(e,n)}function Gn(e,t,n){var r,i,o;P.__&&P.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],ws(t,e=(!r&&n||t).__k=he(Je,null,[e]),i||Bi,Bi,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?jr.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),Fd(o,e)}function jd(e,t){Gn(e,t,jd)}function H0(e,t,n){var r,i,o,a=At({},e.props);for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];return arguments.length>2&&(a.children=arguments.length>3?jr.call(arguments,2):n),hr(e.type,a,r||e.key,i||e.ref,null)}function Hd(e,t){var n={__c:t="__cC"+Td++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(s){s.__e=!0,xa(s)})},this.sub=function(a){i.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),s&&s.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}jr=Rd.slice,P={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},xd=0,zn=!1,at.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=At({},this.state),typeof e=="function"&&(e=e(At({},n),this.props)),e&&At(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xa(this))},at.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),xa(this))},at.prototype.render=Je,on=[],Ad=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Hi.__r=0,Td=0;var nt=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(nt||{}),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||{}),Ye=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ye||{}),q=(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))(q||{});const $l=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(p=>p(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>n.clear()};return t=e(r,i,s),s},z0=e=>e?$l(e):$l;var Qt,se,Lo,ql,Kn=0,zd=[],fi=[],Yl=P.__b,Zl=P.__r,Ql=P.diffed,Jl=P.__c,Xl=P.unmount;function wn(e,t){P.__h&&P.__h(se,e,Kn||t),Kn=0;var n=se.__H||(se.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:fi}),n.__[e]}function xe(e){return Kn=1,Cs(qd,e)}function Cs(e,t,n){var r=wn(Qt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):qd(void 0,t),function(o){var a=r.__N?r.__N[0]:r.__[0],s=r.t(a,o);a!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=se,!se.u)){se.u=!0;var i=se.shouldComponentUpdate;se.shouldComponentUpdate=function(o,a,s){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(c){return c.__c});if(l.every(function(c){return!c.__N}))return!i||i.call(this,o,a,s);var u=!1;return l.forEach(function(c){if(c.__N){var d=c.__[0];c.__=c.__N,c.__N=void 0,d!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Ze(e,t){var n=wn(Qt++,3);!P.__s&&Is(n.__H,t)&&(n.__=e,n.i=t,se.__H.__h.push(n))}function Hr(e,t){var n=wn(Qt++,4);!P.__s&&Is(n.__H,t)&&(n.__=e,n.i=t,se.__h.push(n))}function Yt(e){return Kn=5,ro(function(){return{current:e}},[])}function Gd(e,t,n){Kn=6,Hr(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 ro(e,t){var n=wn(Qt++,7);return Is(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Kd(e,t){return Kn=8,ro(function(){return e},t)}function Wd(e){var t=se.context[e.__c],n=wn(Qt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(se)),t.props.value):e.__}function Es(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function G0(e){var t=wn(Qt++,10),n=xe();return t.__=e,se.componentDidCatch||(se.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function $d(){var e=wn(Qt++,11);if(!e.__){for(var t=se.__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 K0(){for(var e;e=zd.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pi),e.__H.__h.forEach(Aa),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){se=null,Yl&&Yl(e)},P.__r=function(e){Zl&&Zl(e),Qt=0;var t=(se=e.__c).__H;t&&(Lo===se?(t.__h=[],se.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=fi,n.__N=n.i=void 0})):(t.__h.forEach(pi),t.__h.forEach(Aa),t.__h=[])),Lo=se},P.diffed=function(e){Ql&&Ql(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zd.push(t)!==1&&ql===P.requestAnimationFrame||((ql=P.requestAnimationFrame)||W0)(K0)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==fi&&(n.__=n.__V),n.i=void 0,n.__V=fi})),Lo=se=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(pi),n.__h=n.__h.filter(function(r){return!r.__||Aa(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],P.__e(r,n.__v)}}),Jl&&Jl(e,t)},P.unmount=function(e){Xl&&Xl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{pi(r)}catch(i){t=i}}),n.__H=void 0,t&&P.__e(t,n.__v))};var eu=typeof requestAnimationFrame=="function";function W0(e){var t,n=function(){clearTimeout(r),eu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);eu&&(t=requestAnimationFrame(n))}function pi(e){var t=se,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),se=t}function Aa(e){var t=se;e.__c=e.__(),se=t}function Is(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function qd(e,t){return typeof t=="function"?t(e):t}function Yd(e,t){for(var n in t)e[n]=t[n];return e}function Ta(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 Oo(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function zi(e){this.props=e}function Zd(e,t){function n(i){var o=this.props.ref,a=o==i.ref;return!a&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!a:Ta(this.props,i)}function r(i){return this.shouldComponentUpdate=n,he(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(zi.prototype=new at).isPureReactComponent=!0,zi.prototype.shouldComponentUpdate=function(e,t){return Ta(this.props,e)||Ta(this.state,t)};var tu=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),tu&&tu(e)};var $0=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Qd(e){function t(n){var r=Yd({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=$0,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var nu=function(e,t){return e==null?null:Ot(Ot(e).map(t))},Jd={map:nu,forEach:nu,count:function(e){return e?Ot(e).length:0},only:function(e){var t=Ot(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ot},q0=P.__e;P.__e=function(e,t,n,r){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}q0(e,t,n,r)};var ru=P.unmount;function Xd(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=Yd({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Xd(r,t,n)})),e}function ef(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return ef(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 mr(){this.__u=0,this.t=null,this.__b=null}function tf(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function nf(e){var t,n,r;function i(o){if(t||(t=e()).then(function(a){n=a.default||a},function(a){r=a}),r)throw r;if(!n)throw t;return he(n,o)}return i.displayName="Lazy",i.__f=!0,i}function On(){this.u=null,this.o=null}P.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),ru&&ru(e)},(mr.prototype=new at).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=tf(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=ef(u,u.__c.__P,u.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.t.pop();)c.forceUpdate()}},l=t.__h===!0;r.__u++||l||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},mr.prototype.componentWillUnmount=function(){this.t=[]},mr.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]=Xd(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&he(Je,null,e.fallback);return i&&(i.__h=null),[he(Je,null,t.__a?null:e.children),i]};var iu=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 Y0(e){return this.getChildContext=function(){return e.context},e.children}function Z0(e){var t=this,n=e.i;t.componentWillUnmount=function(){Gn(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,i){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Gn(he(Y0,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function rf(e,t){var n=he(Z0,{__v:e,i:t});return n.containerInfo=t,n}(On.prototype=new at).__a=function(e){var t=this,n=tf(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),iu(t,e,r)):i()};n?n(o):o()}},On.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ot(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},On.prototype.componentDidUpdate=On.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){iu(e,n,t)})};var of=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Q0=/^(?: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]/,J0=typeof document<"u",X0=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function af(e,t,n){return t.__k==null&&(t.textContent=""),Gn(e,t),typeof n=="function"&&n(),e?e.__c:null}function sf(e,t,n){return jd(e,t),typeof n=="function"&&n(),e?e.__c:null}at.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(at.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ou=P.event;function e_(){}function t_(){return this.cancelBubble}function n_(){return this.defaultPrevented}P.event=function(e){return ou&&(e=ou(e)),e.persist=e_,e.isPropagationStopped=t_,e.isDefaultPrevented=n_,e.nativeEvent=e};var lf,au={configurable:!0,get:function(){return this.class}},su=P.vnode;P.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var i=t.indexOf("-")===-1;for(var o in r={},n){var a=n[o];J0&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in n&&a==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&a===!0?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!X0(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():i&&Q0.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():a===null&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),r[o]&&(o="oninputCapture")),r[o]=a)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Ot(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Ot(n.children).forEach(function(s){s.props.selected=r.multiple?r.defaultValue.indexOf(s.props.value)!=-1:r.defaultValue==s.props.value})),e.props=r,n.class!=n.className&&(au.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",au))}e.$$typeof=of,su&&su(e)};var lu=P.__r;P.__r=function(e){lu&&lu(e),lf=e.__c};var uf={ReactCurrentDispatcher:{current:{readContext:function(e){return lf.__n[e.__c].props.value}}}},r_="17.0.2";function cf(e){return he.bind(null,e)}function Ss(e){return!!e&&e.$$typeof===of}function df(e){return Ss(e)?H0.apply(null,arguments):e}function ff(e){return!!e.__k&&(Gn(null,e),!0)}function pf(e){return e&&(e.base||e.nodeType===1&&e)||null}var hf=function(e,t){return e(t)},mf=function(e,t){return e(t)},gf=Je;function ks(e){e()}function vf(e){return e}function yf(){return[!1,ks]}var _f=Hr;function bf(e,t){var n=t(),r=xe({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Hr(function(){i.__=n,i.v=t,Oo(i.__,t())||o({h:i})},[e,n,t]),Ze(function(){return Oo(i.__,i.v())||o({h:i}),e(function(){Oo(i.__,i.v())||o({h:i})})},[e]),n}var i_={useState:xe,useId:$d,useReducer:Cs,useEffect:Ze,useLayoutEffect:Hr,useInsertionEffect:_f,useTransition:yf,useDeferredValue:vf,useSyncExternalStore:bf,startTransition:ks,useRef:Yt,useImperativeHandle:Gd,useMemo:ro,useCallback:Kd,useContext:Wd,useDebugValue:Es,version:"17.0.2",Children:Jd,render:af,hydrate:sf,unmountComponentAtNode:ff,createPortal:rf,createElement:he,createContext:Hd,createFactory:cf,cloneElement:df,createRef:Od,Fragment:Je,isValidElement:Ss,findDOMNode:pf,Component:at,PureComponent:zi,memo:Zd,forwardRef:Qd,flushSync:mf,unstable_batchedUpdates:hf,StrictMode:gf,Suspense:mr,SuspenseList:On,lazy:nf,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:uf};const o_=Object.freeze(Object.defineProperty({__proto__:null,Children:Jd,PureComponent:zi,StrictMode:gf,Suspense:mr,SuspenseList:On,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:uf,cloneElement:df,createFactory:cf,createPortal:rf,default:i_,findDOMNode:pf,flushSync:mf,forwardRef:Qd,hydrate:sf,isValidElement:Ss,lazy:nf,memo:Zd,render:af,startTransition:ks,unmountComponentAtNode:ff,unstable_batchedUpdates:hf,useDeferredValue:vf,useInsertionEffect:_f,useSyncExternalStore:bf,useTransition:yf,version:r_,Component:at,Fragment:Je,createContext:Hd,createElement:he,createRef:Od,useCallback:Kd,useContext:Wd,useDebugValue:Es,useEffect:Ze,useErrorBoundary:G0,useId:$d,useImperativeHandle:Gd,useLayoutEffect:Hr,useMemo:ro,useReducer:Cs,useRef:Yt,useState:xe},Symbol.toStringTag,{value:"Module"}));var wf={exports:{}},Cf={};const Ef=am(o_);var If={exports:{}},Sf={};/**
38
38
  * @license React
39
39
  * use-sync-external-store-shim.production.min.js
40
40
  *
@@ -42,15 +42,7 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{ua=!1}}},
42
42
  *
43
43
  * This source code is licensed under the MIT license found in the
44
44
  * LICENSE file in the root directory of this source tree.
45
- */var fu;function d_(){if(fu)return Do;fu=1;var e=ro;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(d,p){var f=p(),h=r({inst:{value:f,getSnapshot:p}}),m=h[0].inst,g=h[1];return o(function(){m.value=f,m.getSnapshot=p,l(m)&&g({inst:m})},[d,f,p]),i(function(){return l(m)&&g({inst:m}),d(function(){l(m)&&g({inst:m})})},[d]),a(f),f}function l(d){var p=d.getSnapshot;d=d.value;try{var f=p();return!n(d,f)}catch{return!0}}function u(d,p){return p()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return Do.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,Do}var Uo={};/**
46
- * @license React
47
- * use-sync-external-store-shim.development.js
48
- *
49
- * Copyright (c) Facebook, Inc. and its affiliates.
50
- *
51
- * This source code is licensed under the MIT license found in the
52
- * LICENSE file in the root directory of this source tree.
53
- */var pu;function f_(){return pu||(pu=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=ro,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(_){{for(var v=arguments.length,w=new Array(v>1?v-1:0),E=1;E<v;E++)w[E-1]=arguments[E];r("error",_,w)}}function r(_,v,w){{var E=t.ReactDebugCurrentFrame,I=E.getStackAddendum();I!==""&&(v+="%s",w=w.concat([I]));var S=w.map(function(x){return String(x)});S.unshift("Warning: "+v),Function.prototype.apply.call(console[_],console,S)}}function i(_,v){return _===v&&(_!==0||1/_===1/v)||_!==_&&v!==v}var o=typeof Object.is=="function"?Object.is:i,a=e.useState,s=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue,c=!1,d=!1;function p(_,v,w){c||e.startTransition!==void 0&&(c=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var E=v();if(!d){var I=v();o(E,I)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var S=a({inst:{value:E,getSnapshot:v}}),x=S[0].inst,T=S[1];return l(function(){x.value=E,x.getSnapshot=v,f(x)&&T({inst:x})},[_,E,v]),s(function(){f(x)&&T({inst:x});var A=function(){f(x)&&T({inst:x})};return _(A)},[_]),u(E),E}function f(_){var v=_.getSnapshot,w=_.value;try{var E=v();return!o(w,E)}catch{return!0}}function h(_,v,w){return v()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,b=g?h:p,y=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b;Uo.useSyncExternalStore=y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Uo}var hu;function Rf(){return hu||(hu=1,function(e){process.env.NODE_ENV==="production"?e.exports=d_():e.exports=f_()}(No)),No.exports}/**
45
+ */var Wn=Ef;function a_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var s_=typeof Object.is=="function"?Object.is:a_,l_=Wn.useState,u_=Wn.useEffect,c_=Wn.useLayoutEffect,d_=Wn.useDebugValue;function f_(e,t){var n=t(),r=l_({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return c_(function(){i.value=n,i.getSnapshot=t,No(i)&&o({inst:i})},[e,n,t]),u_(function(){return No(i)&&o({inst:i}),e(function(){No(i)&&o({inst:i})})},[e]),d_(n),n}function No(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!s_(e,n)}catch{return!0}}function p_(e,t){return t()}var h_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p_:f_;Sf.useSyncExternalStore=Wn.useSyncExternalStore!==void 0?Wn.useSyncExternalStore:h_;(function(e){e.exports=Sf})(If);/**
54
46
  * @license React
55
47
  * use-sync-external-store-shim/with-selector.production.min.js
56
48
  *
@@ -58,26 +50,18 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{ua=!1}}},
58
50
  *
59
51
  * This source code is licensed under the MIT license found in the
60
52
  * LICENSE file in the root directory of this source tree.
61
- */var mu;function p_(){if(mu)return Oo;mu=1;var e=ro,t=Rf();function n(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return Oo.useSyncExternalStoreWithSelector=function(u,c,d,p,f){var h=o(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=s(function(){function b(E){if(!y){if(y=!0,_=E,E=p(E),f!==void 0&&m.hasValue){var I=m.value;if(f(I,E))return v=I}return v=E}if(I=v,r(_,E))return I;var S=p(E);return f!==void 0&&f(I,S)?I:(_=E,v=S)}var y=!1,_,v,w=d===void 0?null:d;return[function(){return b(c())},w===null?void 0:function(){return b(w())}]},[c,d,p,f]);var g=i(u,h[0],h[1]);return a(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},Oo}var Po={};/**
62
- * @license React
63
- * use-sync-external-store-shim/with-selector.development.js
64
- *
65
- * Copyright (c) Facebook, Inc. and its affiliates.
66
- *
67
- * This source code is licensed under the MIT license found in the
68
- * LICENSE file in the root directory of this source tree.
69
- */var gu;function h_(){return gu||(gu=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=ro,t=Rf();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;function u(c,d,p,f,h){var m=o(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var b=s(function(){var w=!1,E,I,S=function(L){if(!w){w=!0,E=L;var k=f(L);if(h!==void 0&&g.hasValue){var U=g.value;if(h(U,k))return I=U,U}return I=k,k}var R=E,V=I;if(r(R,L))return V;var K=f(L);return h!==void 0&&h(V,K)?V:(E=L,I=K,K)},x=p===void 0?null:p,T=function(){return S(d())},A=x===null?void 0:function(){return S(x())};return[T,A]},[d,p,f,h]),y=b[0],_=b[1],v=i(c,y,_);return a(function(){g.hasValue=!0,g.value=v},[v]),l(v),v}Po.useSyncExternalStoreWithSelector=u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Po}(function(e){process.env.NODE_ENV==="production"?e.exports=p_():e.exports=h_()})(Tf);const m_=cm(Tf.exports),{useSyncExternalStoreWithSelector:g_}=m_;function v_(e,t=e.getState,n){const r=g_(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return ks(r),r}const vu=e=>{const t=typeof e=="function"?$0(e):e,n=(r,i)=>v_(t,r,i);return Object.assign(n,t),n},Lf=e=>e?vu(e):vu;var Na=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(Na||{});const yu=1,Rs={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){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(i=>r.has(i))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(i=>!r.has(i))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},y_=(e,t,n)=>{switch(t){case O.VideoVoice:return Boolean(e&&e.value);case O.Open:return!!n;case O.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case O.RecordedTask:return(n==null?void 0:n.taskStatus)===Ye.Completed;case O.TextUrlPrompt:return!e.value;case O.ConsentLegal:return n!==null;case O.MultipleChoice:return n!==void 0;case O.NPS:return n!==null;case O.Likert:return n!==null;default:return!0}},Of=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const o=e[t];let a=t+1;const s=o.props.routingOptions||[];for(let c=0;c<s.length;c++){const{group:d,target:p}=s[c];if(!(d!=null&&d.length))continue;const f=d[0];if(f.questionIndex===void 0||f.questionIndex>r.length)continue;let h=_u({comparator:f.comparator,response:r[f.questionIndex],type:o.type,value:f.value});for(let m=1;m<d.length;m+=2){const g=d[m],b=d[m+1],y=_u({comparator:b.comparator,response:r[b.questionIndex],type:e[b.questionIndex].type,value:b.value});g===Na.And?h&&(h=y):g===Na.Or&&(h||(h=y))}if(h){a=p===-1&&n?e.length-1:p;break}}const l=e.findIndex(c=>c.type===O.Uploading);let u;return l>0?u=n?e.length-3:e.length-2:u=e.length-1,t>=u||a===-1||a!==null&&a>u?l>0&&Object.values(i).some(d=>d.isSubmitted&&!d.isComplete)?l:n?e.length-1:null:a===-1?null:a},_u=({comparator:e,response:t,type:n,value:r})=>{if(e===It.Answered)switch(n){case O.TextUrlPrompt:return t===void 0;case O.ConsentLegal:return t&&t.submitted===!0;case O.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ye.Completed;case O.Likert:return Number.isInteger(t);case O.Open:return t&&t.length>0;case O.MultipleChoice:case O.MultipleSelect:return Object.keys(t).length>0;case O.NPS:return Number.isInteger(t);case O.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===It.Skipped)switch(n){case O.TextUrlPrompt:return t==null?void 0:t.skipped;case O.ConsentLegal:return t===null;case O.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ye.Abandoned;case O.Likert:return t===null;case O.Open:return(t==null?void 0:t.length)===0;case O.MultipleChoice:return t===void 0;case O.MultipleSelect:return(t==null?void 0:t.length)===0;case O.NPS:return t===null;case O.VideoVoice:return t===null;default:return!1}return e===It.GivenUp?n===O.RecordedTask?"taskStatus"in t&&t.taskStatus===Ye.GivenUp:!0:Rs[e](t,r)},__=13,b_=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),w_=e=>{var t,n;switch(e.type){case O.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>__?e.props.options.map(r=>[r.value]):b_(e.props.options.map(r=>r.value),!e.props.properties.required);case O.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const r=e.props.options.map(i=>i.value);return e.props.properties.required||r.push(void 0),r}case O.Likert:{const r=Number((n=(t=e.props)==null?void 0:t.properties)==null?void 0:n.range)||5;return[...Array.from(Array(r).keys()).map(o=>o+1),...e.props.properties.required?[]:[null]]}case O.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case O.VideoVoice:case O.Open:return["1",...e.props.properties.required?[]:[""]];case O.RecordedTask:return[{taskStatus:Ye.Completed},{taskStatus:Ye.GivenUp},...e.props.properties.required?[]:[{taskStatus:Ye.Abandoned}]];case O.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case O.ConsentLegal:return[yu,...e.props.properties.required?[]:[null]];default:return[yu]}},C_=e=>e in Rs,E_=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,S_=(e,t=[])=>t.reduce((n,r)=>{const{group:i,target:o}=r;if(!(i!=null&&i.length))return[...n];const a=i.filter(s=>Number(s)?!0:typeof s=="object"?s.questionIndex===e:!1).map(s=>{const{comparator:l,value:u}=s;return{comparator:l,target:o,value:u}});return[...n,...a]},[]),I_=(e,t)=>{const n=new Set([O.Thanks,O.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(o=>!n.has(o.type));if(t===r.length-1)return 1;const i={[r.length-1]:1,[-1]:0};for(let o=r.length-2;o>=t;o--){const a=r[o],s=S_(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=w_(a);if(u===null)return r.length-1-t;for(let c=0;c<s.length&&u.length!==0;c++){const{comparator:d,target:p,value:f}=s[c],h=u.filter(m=>{const g=y_({value:m},a.type,m);return!(g&&d===It.Answered||!g&&d===It.Skipped||d===It.GivenUp&&E_(m)&&m.taskStatus===Ye.GivenUp||g&&a.type===O.Open&&(d===It.Contains||d===It.DoesNotContain)||g&&C_(d)&&Rs[d](m,f))});if(h.length<u.length){const m=parseInt(String(p),10);if(m!==-1&&m<=o||m>=r.length)return r.length-1-t;l=Math.max(i[m]+1,l)}u=h}u.length>0&&(l=Math.max(i[o+1]+1,l)),i[o]=l}return i[t]},k_=e=>!(e.type===O.Thanks||e.type===O.Uploading),ce=Lf()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=Nn)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),Mo(r)||a({event:"closed"}),Xo.enable(),o({initiator:dt.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Qe.SurveyComplete),await i(n),Xo.enable(),o({initiator:dt.Complete})},endCard:{headline:""},envId:"",eventEmitFn:Z.emit.bind(Z),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return Dn(i)?Promise.resolve():(r(G.SurveyFadingOut),new Promise(a=>{const s=o.getElementById(n);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:i,index:o}=t();i(n,{[ln.QuestionId]:r[o].name,[ln.Props]:r[o].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:i,isSubmitted:o})=>{var p,f,h;const{cards:a,destroy:s,index:l,uploadProgress:u}=t(),c={...u,[n]:{progressPct:i||i===0?i:(p=u[n])==null?void 0:p.progressPct,isComplete:r||((f=u[n])==null?void 0:f.isComplete),isSubmitted:o||((h=u[n])==null?void 0:h.isSubmitted)}};if(a[l].type!==O.Uploading){e({uploadProgress:c});return}const d=Object.entries(u).every(([m,g])=>!g.isSubmitted||g.isComplete||n==m&&r);if(d&&l>=a.length-1){s(Nn);return}e({index:d?l+1:l,uploadingCardViewed:!0,uploadProgress:c})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":mn.Web,"x-ul-environment-id":"","x-ul-installation-method":Tt.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:i,eventEmitFn:o,index:a,responseGroupUid:s,submit:l,trackHistory:u,uploadProgress:c,viewedCardCount:d}=t(),p=Date.now(),f=[...i],h=f[a],{type:m}=n.data,g={...n.data},b=g.value;k_(h)&&(h.value=b),g.answeredAt=p,delete g.type;const y={response:g,responseGroupUid:s,questionIndex:a};let _=m===O.MultipleChoice?Object.values(b).find(S=>S!==!1):b;m===O.MultipleSelect&&(_=f[a].props.options.reduce((S,x)=>(b[x.id]&&S.push(x.value),S),[]));const v=r.slice(0);v[a]=_,e({allResponses:v});const w=Of({cards:f,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:v});if(w===null){y.completedAt=p,l(y),n.completeSurvey();return}else[O.Thanks,O.Uploading].includes(f[w].type)&&(y.completedAt=p);const E=l(y);[O.Thanks,O.Uploading].includes(f[w].type)||E.finally(()=>{u({event:"seen",index:w})});const I=f[w];f[w]&&o&&o(Qe.CurrentQuestion,{[ln.QuestionId]:I.name,[ln.Props]:I.props}),e({cards:f,hasViewedEmbed:!1,index:w,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:Z,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(G.SurveyWillClose,{name:G.SurveyWillClose,initiator:n}),!Dn(i)&&(o(G.SurveyWillClose,{name:G.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,questionIndex:r,response:i,responseGroupUid:o})=>{const a=t();if(!o||Mo(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&j0({id:a.surveyId});const l=await Rt(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"});if(!l.ok){l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await bu(a,"submitResponse",l.error));return}a.eventEmitFn(G.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(Mo(o))return;const{cards:a,index:s}=o,l=r!==void 0?a[r]:a[s],u={sid:o.surveyId,qid:l.name,action:n,vid:o.userId,eid:o.envId,isNew:i,responseGroupUid:o.responseGroupUid,previewKey:o.previewKey},c=await Rt(`${o.apiURL}/sdk/1/visitors/${o.userId}/surveys/${o.surveyId}/history`,{body:JSON.stringify(u),headers:o.headers,method:"POST"});!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await bu(o,"trackHistory",c.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=Hc(o);Dn(n)?r(G.SurveyHeight,{name:G.SurveyHeight,contentFrameHeight:a}):(s=i.setHeight)==null||s.call(i,a)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),Mo=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,bu=async(e,t,n)=>{const{mode:r,userId:i,envId:o,apiURL:a,headers:s,viewDocument:l}=e,u=l.documentElement,c={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},d={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:c,vid:i,envId:o};(await Rt(`${a}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},s),body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},x_=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 i=await n.json();return(r=i==null?void 0:i.upload)==null?void 0:r.url}else return null},Nf=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",wu=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Nf()};return new MediaRecorder(e,t)},Cu=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function Eu(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[Y.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>A_(t,e,n,r,s,i,o),e.stop()}}async function A_(e,t,n,r,i,o,a){const s=ce.getState().viewDocument,{[Y.UploadCallback]:l,[Y.ProgressCallback]:u}=r,c={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[Y.PassthroughData]},d=await x_(c,e);if(!d){l&&l(null,{message:"failed to get upload url"});return}const p=new Blob(a,{type:Nf()});if(!s.defaultView)return;const f=new s.defaultView.File([p],`recording video ${Date.now()}`),h=o.createUpload({endpoint:d,file:f,chunkSize:5120});h.on("error",m=>{l&&l(null,m)}),h.on("progress",m=>{u&&u(i,m)}),h.on("success",()=>{l&&l(i,!0)})}const T_={chunks:{}},R_={state:{...T_},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?nt.Video:nt.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&Eu(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&Eu(r,t,nt.Screen,e,i,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(i=>{i&&(i.state==="recording"&&i.stop(),i.stream.getTracks().map(o=>{o.readyState==="live"&&o.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,i,o;const{[Y.StreamReadyCallback]:t,[Y.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(a=>a.readyState==="live"&&a.stop()),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(Hn.Camera),audio:!0}),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(a){console.warn("Error: failed to get permissions: "+a),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[Y.ScreenPermissionRequested]:t,[Y.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{[Y.RecordingMediaTypes]:t,[Y.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(nt.Video)&&this.state.avStream){this.state.avRecorder=wu(this.state.avStream);const i=Kt();Cu(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(nt.Screen)&&this.state.captureStream){this.state.screenRecorder=wu(this.state.captureStream);const i=Kt();Cu(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[Y.CurrentIndex]:t,[Y.TaskResponse]:n,[Y.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{[Y.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:i,screenRecorder:o}=this.state,{allResponses:a}=ce.getState(),s=Of({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===O.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},pi=Object.create(R_);Object.freeze(pi);function Df(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=Df(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function H(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Df(e))&&(r&&(r+=" "),r+=t);return r}var L_=0;function C(e,t,n,r,i,o){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--L_,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return P.vnode&&P.vnode(u),u}const Ge=e=>C("button",{...e,className:H("ul-card-text__button",e.className),id:"ul-card-text__button"}),vt=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return C(Je,{children:[e&&C("h1",{className:N.QuestionHeader,id:N.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&C("p",{className:N.Caption,id:N.Caption,children:n})]})},Su=({buttonText:e="View Prototype",handleClick:t})=>C("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Jt=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=ce(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),s=(n==null?void 0:n.conceptUrl)||((d=n==null?void 0:n.consentDocument)==null?void 0:d.url),l=window.innerWidth<hv,u=o["userleap-platform"],c=(p,f)=>{p.preventDefault(),r(f)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return C(Su,{handleClick:p=>{c(p,Qe.ViewPrototypeClick)}});if(t==="pdf")return C(Su,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{c(p,Qe.ViewAgreementClick)}})}return e()},Uf=(e,t)=>{const n=Yt(0),r=()=>{if(e.current){const i=e.current;i.style.height="1px";const o=i.scrollHeight,a=i.offsetHeight-i.clientHeight,s=o+a,l=parseInt(window.getComputedStyle(i).getPropertyValue("max-height")),u=s<=l?s:l;n.current!==u&&t(),n.current=u,i.style.height=`${u}px`}};return Ze(r,[]),r},Pf=({border:e,label:t,isSelected:n,value:r,text:i,id:o,isRadio:a,useMobileStyling:s,error:l,allowTextEntry:u,promptText:c,onUserInputChanged:d})=>{const{styleNonce:p,viewDocument:f}=ce(x=>({styleNonce:x.styleNonce,viewDocument:x.viewDocument})),[h,m]=xe(!1);D_(f,e,p);const g=({isSelected:x,userText:T})=>{d&&d({id:o||"",selected:x,value:r,userText:T})},b=x=>{x.stopPropagation(),g({isSelected:a||!n,userText:i}),m(!1)},y=()=>{h||m(!0)},_=()=>{h&&m(!1)},v=x=>{ur(x.target)||(x.key==="Enter"||x.key===" ")&&b(x)},w={onClick:x=>b(x),onKeyPress:x=>v(x)};"ontouchstart"in f.documentElement?(w.onTouchStart=_,w.onTouchCancel=_,w.onTouchEnd=_):(w.onMouseDown=y,w.onMouseLeave=_);const E=a?`radio-${o}`:`checkbox-${o}`,I=n||h?[hi]:[],S=[...l?[Mf]:[],...I];return C("div",{className:H([..._e(N.Choice,s),...S]),id:`choice-div-${o}`,style:l?{borderColor:lr}:{},...w,children:[C("div",{className:H([N.ChoiceLabelContainer]),children:[a?C("div",{"aria-labelledby":`label-${o}`,className:H([N.ChoiceRadio,...I]),id:E,role:"radio",tabIndex:0}):C("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:N.ChoiceCheckbox,id:E,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&C("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:C("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),C("label",{className:H(_e(N.ChoiceLabel,s)),htmlFor:E,id:`label-${o}`,children:t})]}),u&&n&&C("div",{className:H([N.ChoiceTextEntryContainer,...I]),children:C(O_,{onTextChange:x=>g({isSelected:n,userText:x}),promptText:c||"Please specify",textValue:i,useMobileStyling:s})})]})},O_=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=Yt(null),{update:o}=ce(s=>({update:s.update})),a=Uf(i,()=>o());return Ze(()=>{i.current&&i.current.focus()},[]),C("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:H(_e(N.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),ur(s.target)&&(s.stopPropagation(),n(s.target.value))},onClick:s=>{s.stopPropagation()},onKeyPress:s=>{s.stopPropagation()},placeholder:e,ref:i,role:"textbox",rows:1,value:t})},Iu="ul-select-style-element",hi="ul-select-active-dynamic-style",Mf="ul-select-error-dynamic-style",N_=e=>e.tagName.toLowerCase()==="style",D_=(e,t,n)=>{let r=e.getElementById(Iu),i=!1;r||(r=e.createElement("style"),i=!0),N_(r)&&(r.id=Iu,n&&(r.nonce=n),r.textContent=U_(t),i&&e.head.appendChild(r))},U_=e=>`
70
- .${hi} {
53
+ */var io=Ef,m_=If.exports;function g_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var v_=typeof Object.is=="function"?Object.is:g_,y_=m_.useSyncExternalStore,__=io.useRef,b_=io.useEffect,w_=io.useMemo,C_=io.useDebugValue;Cf.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=__(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=w_(function(){function l(f){if(!u){if(u=!0,c=f,f=r(f),i!==void 0&&a.hasValue){var h=a.value;if(i(h,f))return d=h}return d=f}if(h=d,v_(c,f))return h;var m=r(f);return i!==void 0&&i(h,m)?h:(c=f,d=m)}var u=!1,c,d,p=n===void 0?null:n;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,n,r,i]);var s=y_(e,o[0],o[1]);return b_(function(){a.hasValue=!0,a.value=s},[s]),C_(s),s};(function(e){e.exports=Cf})(wf);const E_=om(wf.exports),{useSyncExternalStoreWithSelector:I_}=E_;function S_(e,t=e.getState,n){const r=I_(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return Es(r),r}const uu=e=>{const t=typeof e=="function"?z0(e):e,n=(r,i)=>S_(t,r,i);return Object.assign(n,t),n},kf=e=>e?uu(e):uu;var Ra=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(Ra||{});const cu=1,xs={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){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(i=>r.has(i))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(i=>!r.has(i))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},k_=(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)===Ye.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}},xf=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const o=e[t];let a=t+1;const s=o.props.routingOptions||[];for(let c=0;c<s.length;c++){const{group:d,target:p}=s[c];if(!(d!=null&&d.length))continue;const f=d[0];if(f.questionIndex===void 0||f.questionIndex>r.length)continue;let h=du({comparator:f.comparator,response:r[f.questionIndex],type:o.type,value:f.value});for(let m=1;m<d.length;m+=2){const g=d[m],b=d[m+1],v=du({comparator:b.comparator,response:r[b.questionIndex],type:e[b.questionIndex].type,value:b.value});g===Ra.And?h&&(h=v):g===Ra.Or&&(h||(h=v))}if(h){a=p===-1&&n?e.length-1:p;break}}const l=e.findIndex(c=>c.type===L.Uploading);let u;return l>0?u=n?e.length-3:e.length-2:u=e.length-1,t>=u||a===-1||a!==null&&a>u?l>0&&Object.values(i).some(d=>d.isSubmitted&&!d.isComplete)?l:n?e.length-1:null:a===-1?null:a},du=({comparator:e,response:t,type:n,value:r})=>{if(e===St.Answered)switch(n){case L.TextUrlPrompt:return t===void 0;case L.ConsentLegal:return t&&t.submitted===!0;case L.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ye.Completed;case L.Likert:return Number.isInteger(t);case L.Open:return t&&t.length>0;case L.MultipleChoice:case L.MultipleSelect:return Object.keys(t).length>0;case L.NPS:return Number.isInteger(t);case L.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===St.Skipped)switch(n){case L.TextUrlPrompt:return t==null?void 0:t.skipped;case L.ConsentLegal:return t===null;case L.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ye.Abandoned;case L.Likert:return t===null;case L.Open:return(t==null?void 0:t.length)===0;case L.MultipleChoice:return t===void 0;case L.MultipleSelect:return(t==null?void 0:t.length)===0;case L.NPS:return t===null;case L.VideoVoice:return t===null;default:return!1}return e===St.GivenUp?n===L.RecordedTask?"taskStatus"in t&&t.taskStatus===Ye.GivenUp:!0:xs[e](t,r)},x_=13,A_=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),T_=e=>{var t,n;switch(e.type){case L.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>x_?e.props.options.map(r=>[r.value]):A_(e.props.options.map(r=>r.value),!e.props.properties.required);case L.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const r=e.props.options.map(i=>i.value);return e.props.properties.required||r.push(void 0),r}case L.Likert:{const r=Number((n=(t=e.props)==null?void 0:t.properties)==null?void 0:n.range)||5;return[...Array.from(Array(r).keys()).map(o=>o+1),...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["1",...e.props.properties.required?[]:[""]];case L.RecordedTask:return[{taskStatus:Ye.Completed},{taskStatus:Ye.GivenUp},...e.props.properties.required?[]:[{taskStatus:Ye.Abandoned}]];case L.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case L.ConsentLegal:return[cu,...e.props.properties.required?[]:[null]];default:return[cu]}},R_=e=>e in xs,L_=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,O_=(e,t=[])=>t.reduce((n,r)=>{const{group:i,target:o}=r;if(!(i!=null&&i.length))return[...n];const a=i.filter(s=>Number(s)?!0:typeof s=="object"?s.questionIndex===e:!1).map(s=>{const{comparator:l,value:u}=s;return{comparator:l,target:o,value:u}});return[...n,...a]},[]),N_=(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(o=>!n.has(o.type));if(t===r.length-1)return 1;const i={[r.length-1]:1,[-1]:0};for(let o=r.length-2;o>=t;o--){const a=r[o],s=O_(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=T_(a);if(u===null)return r.length-1-t;for(let c=0;c<s.length&&u.length!==0;c++){const{comparator:d,target:p,value:f}=s[c],h=u.filter(m=>{const g=k_({value:m},a.type,m);return!(g&&d===St.Answered||!g&&d===St.Skipped||d===St.GivenUp&&L_(m)&&m.taskStatus===Ye.GivenUp||g&&a.type===L.Open&&(d===St.Contains||d===St.DoesNotContain)||g&&R_(d)&&xs[d](m,f))});if(h.length<u.length){const m=parseInt(String(p),10);if(m!==-1&&m<=o||m>=r.length)return r.length-1-t;l=Math.max(i[m]+1,l)}u=h}u.length>0&&(l=Math.max(i[o+1]+1,l)),i[o]=l}return i[t]},D_=e=>!(e.type===L.Thanks||e.type===L.Uploading),ce=kf()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=Nn)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),Do(r)||a({event:"closed"}),Zo.enable(),o({initiator:dt.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Qe.SurveyComplete),await i(n),Zo.enable(),o({initiator:dt.Complete})},endCard:{headline:""},envId:"",eventEmitFn:Y.emit.bind(Y),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return Dn(i)?Promise.resolve():(r(G.SurveyFadingOut),new Promise(a=>{const s=o.getElementById(n);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:i,index:o}=t();i(n,{[ln.QuestionId]:r[o].name,[ln.Props]:r[o].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:i,isSubmitted:o})=>{var p,f,h;const{cards:a,destroy:s,index:l,uploadProgress:u}=t(),c={...u,[n]:{progressPct:i||i===0?i:(p=u[n])==null?void 0:p.progressPct,isComplete:r||((f=u[n])==null?void 0:f.isComplete),isSubmitted:o||((h=u[n])==null?void 0:h.isSubmitted)}};if(a[l].type!==L.Uploading){e({uploadProgress:c});return}const d=Object.entries(u).every(([m,g])=>!g.isSubmitted||g.isComplete||n==m&&r);if(d&&l>=a.length-1){s(Nn);return}e({index:d?l+1:l,uploadingCardViewed:!0,uploadProgress:c})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":mn.Web,"x-ul-environment-id":"","x-ul-installation-method":Tt.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:i,eventEmitFn:o,index:a,responseGroupUid:s,submit:l,trackHistory:u,uploadProgress:c,viewedCardCount:d}=t(),p=Date.now(),f=[...i],h=f[a],{type:m}=n.data,g={...n.data},b=g.value;D_(h)&&(h.value=b),g.answeredAt=p,delete g.type;const v={response:g,responseGroupUid:s,questionIndex:a};let _=m===L.MultipleChoice?Object.values(b).find(I=>I!==!1):b;m===L.MultipleSelect&&(_=f[a].props.options.reduce((I,x)=>(b[x.id]&&I.push(x.value),I),[]));const y=r.slice(0);y[a]=_,e({allResponses:y});const C=xf({cards:f,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:y});if(C===null){v.completedAt=p,l(v),n.completeSurvey();return}else[L.Thanks,L.Uploading].includes(f[C].type)&&(v.completedAt=p);const E=l(v);[L.Thanks,L.Uploading].includes(f[C].type)||E.finally(()=>{u({event:"seen",index:C})});const S=f[C];f[C]&&o&&o(Qe.CurrentQuestion,{[ln.QuestionId]:S.name,[ln.Props]:S.props}),e({cards:f,hasViewedEmbed:!1,index:C,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:Y,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(G.SurveyWillClose,{name:G.SurveyWillClose,initiator:n}),!Dn(i)&&(o(G.SurveyWillClose,{name:G.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,questionIndex:r,response:i,responseGroupUid:o})=>{const a=t();if(!o||Do(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&P0({id:a.surveyId});const l=await Rt(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"});if(!l.ok){l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await fu(a,"submitResponse",l.error));return}a.eventEmitFn(G.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(Do(o))return;const{cards:a,index:s}=o,l=r!==void 0?a[r]:a[s],u={sid:o.surveyId,qid:l.name,action:n,vid:o.userId,eid:o.envId,isNew:i,responseGroupUid:o.responseGroupUid,previewKey:o.previewKey},c=await Rt(`${o.apiURL}/sdk/1/visitors/${o.userId}/surveys/${o.surveyId}/history`,{body:JSON.stringify(u),headers:o.headers,method:"POST"});!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await fu(o,"trackHistory",c.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=Dc(o);Dn(n)?r(G.SurveyHeight,{name:G.SurveyHeight,contentFrameHeight:a}):(s=i.setHeight)==null||s.call(i,a)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),Do=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,fu=async(e,t,n)=>{const{mode:r,userId:i,envId:o,apiURL:a,headers:s,viewDocument:l}=e,u=l.documentElement,c={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},d={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:c,vid:i,envId:o};(await Rt(`${a}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},s),body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},U_=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 i=await n.json();return(r=i==null?void 0:i.upload)==null?void 0:r.url}else return null},Af=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",pu=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Af()};return new MediaRecorder(e,t)},hu=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function mu(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[q.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>P_(t,e,n,r,s,i,o),e.stop()}}async function P_(e,t,n,r,i,o,a){const s=ce.getState().viewDocument,{[q.UploadCallback]:l,[q.ProgressCallback]:u}=r,c={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[q.PassthroughData]},d=await U_(c,e);if(!d){l&&l(null,{message:"failed to get upload url"});return}const p=new Blob(a,{type:Af()});if(!s.defaultView)return;const f=new s.defaultView.File([p],`recording video ${Date.now()}`),h=o.createUpload({endpoint:d,file:f,chunkSize:5120});h.on("error",m=>{l&&l(null,m)}),h.on("progress",m=>{u&&u(i,m)}),h.on("success",()=>{l&&l(i,!0)})}const M_={chunks:{}},F_={state:{...M_},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?nt.Video:nt.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&mu(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&mu(r,t,nt.Screen,e,i,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(i=>{i&&(i.state==="recording"&&i.stop(),i.stream.getTracks().map(o=>{o.readyState==="live"&&o.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,i,o;const{[q.StreamReadyCallback]:t,[q.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(a=>a.readyState==="live"&&a.stop()),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(Hn.Camera),audio:!0}),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(a){console.warn("Error: failed to get permissions: "+a),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[q.ScreenPermissionRequested]:t,[q.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{[q.RecordingMediaTypes]:t,[q.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(nt.Video)&&this.state.avStream){this.state.avRecorder=pu(this.state.avStream);const i=Kt();hu(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(nt.Screen)&&this.state.captureStream){this.state.screenRecorder=pu(this.state.captureStream);const i=Kt();hu(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[q.CurrentIndex]:t,[q.TaskResponse]:n,[q.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{[q.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:i,screenRecorder:o}=this.state,{allResponses:a}=ce.getState(),s=xf({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===L.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},hi=Object.create(F_);Object.freeze(hi);function Tf(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=Tf(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function H(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Tf(e))&&(r&&(r+=" "),r+=t);return r}var V_=0;function w(e,t,n,r,i,o){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--V_,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return P.vnode&&P.vnode(u),u}const Ge=e=>w("button",{...e,className:H("ul-card-text__button",e.className),id:"ul-card-text__button"}),vt=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return w(Je,{children:[e&&w("h1",{className:N.QuestionHeader,id:N.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&w("p",{className:N.Caption,id:N.Caption,children:n})]})},gu=({buttonText:e="View Prototype",handleClick:t})=>w("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Jt=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=ce(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),s=(n==null?void 0:n.conceptUrl)||((d=n==null?void 0:n.consentDocument)==null?void 0:d.url),l=window.innerWidth<uv,u=o["userleap-platform"],c=(p,f)=>{p.preventDefault(),r(f)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return w(gu,{handleClick:p=>{c(p,Qe.ViewPrototypeClick)}});if(t==="pdf")return w(gu,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{c(p,Qe.ViewAgreementClick)}})}return e()},Rf=(e,t)=>{const n=Yt(0),r=()=>{if(e.current){const i=e.current;i.style.height="1px";const o=i.scrollHeight,a=i.offsetHeight-i.clientHeight,s=o+a,l=parseInt(window.getComputedStyle(i).getPropertyValue("max-height")),u=s<=l?s:l;n.current!==u&&t(),n.current=u,i.style.height=`${u}px`}};return Ze(r,[]),r},Lf=({border:e,label:t,isSelected:n,value:r,text:i,id:o,isRadio:a,useMobileStyling:s,error:l,allowTextEntry:u,promptText:c,onUserInputChanged:d})=>{const{styleNonce:p,viewDocument:f}=ce(x=>({styleNonce:x.styleNonce,viewDocument:x.viewDocument})),[h,m]=xe(!1);H_(f,e,p);const g=({isSelected:x,userText:R})=>{d&&d({id:o||"",selected:x,value:r,userText:R})},b=x=>{x.stopPropagation(),g({isSelected:a||!n,userText:i}),m(!1)},v=()=>{h||m(!0)},_=()=>{h&&m(!1)},y=x=>{cr(x.target)||(x.key==="Enter"||x.key===" ")&&b(x)},C={onClick:x=>b(x),onKeyPress:x=>y(x)};"ontouchstart"in f.documentElement?(C.onTouchStart=_,C.onTouchCancel=_,C.onTouchEnd=_):(C.onMouseDown=v,C.onMouseLeave=_);const E=a?`radio-${o}`:`checkbox-${o}`,S=n||h?[mi]:[],I=[...l?[Of]:[],...S];return w("div",{className:H([..._e(N.Choice,s),...I]),id:`choice-div-${o}`,style:l?{borderColor:ur}:{},...C,children:[w("div",{className:H([N.ChoiceLabelContainer]),children:[a?w("div",{"aria-labelledby":`label-${o}`,className:H([N.ChoiceRadio,...S]),id:E,role:"radio",tabIndex:0}):w("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:N.ChoiceCheckbox,id:E,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&w("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:w("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),w("label",{className:H(_e(N.ChoiceLabel,s)),htmlFor:E,id:`label-${o}`,children:t})]}),u&&n&&w("div",{className:H([N.ChoiceTextEntryContainer,...S]),children:w(B_,{onTextChange:x=>g({isSelected:n,userText:x}),promptText:c||"Please specify",textValue:i,useMobileStyling:s})})]})},B_=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=Yt(null),{update:o}=ce(s=>({update:s.update})),a=Rf(i,()=>o());return Ze(()=>{i.current&&i.current.focus()},[]),w("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:H(_e(N.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),cr(s.target)&&(s.stopPropagation(),n(s.target.value))},onClick:s=>{s.stopPropagation()},onKeyPress:s=>{s.stopPropagation()},placeholder:e,ref:i,role:"textbox",rows:1,value:t})},vu="ul-select-style-element",mi="ul-select-active-dynamic-style",Of="ul-select-error-dynamic-style",j_=e=>e.tagName.toLowerCase()==="style",H_=(e,t,n)=>{let r=e.getElementById(vu),i=!1;r||(r=e.createElement("style"),i=!0),j_(r)&&(r.id=vu,n&&(r.nonce=n),r.textContent=z_(t),i&&e.head.appendChild(r))},z_=e=>`
54
+ .${mi} {
71
55
  border-color: ${e};
72
56
  }
73
- .${hi} .${N.ChoiceRadio}, .${hi}.${N.ChoiceRadio} {
57
+ .${mi} .${N.ChoiceRadio}, .${mi}.${N.ChoiceRadio} {
74
58
  border: 6px solid ${e};
75
59
  box-shadow: none;
76
60
  }
77
- .${Mf} {
78
- border-color: ${lr};
61
+ .${Of} {
62
+ border-color: ${ur};
79
63
  }
80
- `,Jn=e=>(e==null?void 0:e.buttonText)||"Next",Ls=e=>(e==null?void 0:e.skipButtonText)||"Skip",P_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,useMobileStyling:s,border:l}=ce(A=>({headers:A.headers,useMobileStyling:A.useMobileStyling,border:A.border})),[u,c]=xe(!1),[d,p]=xe(""),[f,h]=xe(!1),m=a["userleap-platform"],g=r==null?void 0:r.collectName,b=(r==null?void 0:r.nameLabelText)||"Full Name",y=(r==null?void 0:r.consentText)||"I agree to the stated conditions",_=(r==null?void 0:r.submitButtonText)||"Submit",v=!!d.trim(),w=u&&(!g||v),E=(A,L=!1)=>{A.preventDefault(),A.stopPropagation();let k=null;if(!L){if(!w){h(!0);return}k={submitted:!0},g&&(k.name=d)}n({value:k,questionId:i,type:o})},I=A=>{_v(A.target)&&(A.preventDefault(),A.stopPropagation(),p(A.target.value))},S=A=>{Bn(A.target)&&(A.target.style.borderColor=f&&!v?lr:l)},x=A=>{Bn(A.target)&&(A.target.style.borderColor=f&&!v?lr:is)},T=()=>C("div",{children:[C(Pf,{allowTextEntry:!1,border:l,error:f&&!u,index:0,isRadio:!1,isSelected:u,label:y,onUserInputChanged:({selected:A})=>{A!==u&&c(!u)},useMobileStyling:s}),g&&C("input",{"aria-label":b,"aria-placeholder":b,className:H(_e(N.ConsentLegalNameInput,s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:x,onFocus:S,onInput:I,placeholder:b,style:f&&!v?{borderColor:lr}:{},tabIndex:0,value:d}),C("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[C(Ge,{className:w?"":N.ButtonDisabled,onClick:E,children:_}),r.required===!1&&C("button",{className:N.SkipButton,onClick:A=>E(A,!0),children:Ls(r)})]})]});return C("div",{className:H(mt(N.CardMainContent,m)),children:C("div",{className:H([e,"ul-card__consent-legal",N.FadeInTransition]),children:[C(vt,{message:t}),C("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),C(Jt,{properties:r,defaultBody:T,embeddedType:"pdf"})]},i)})},M_=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:l,useMobileStyling:u,value:c})=>{const d=`option-${c}`,p=a===cn.Number,f=a===cn.Star,h=p&&c===e,[m,g]=(()=>c<=e&&f||c===e?r?[t,1]:[t,.3]:["",1])(),b=()=>{switch(a){case cn.Star:return H([..._e(N.LikertStar,u),..._e(`${N.LikertStar}-${c}`,u)]);case cn.Smiley:return H([..._e(N.LikertSmiley,u),..._e(`${N.LikertSmiley}-${c}`,u)]);default:return H(c===o?[..._e(N.LikertNumber,u),..._e(`${N.LikertNumber}-${c}`,u),..._e("likert-last-option",u)]:[..._e(N.LikertNumber,u),..._e(`${N.LikertNumber}-${c}`,u)])}},y=()=>{s(-1),l(!1)};return C("div",{"aria-label":p?void 0:String(c),className:b(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:y,role:"radio",style:{color:p?"":m,borderColor:h?m:"",fillOpacity:h?"":g,zIndex:h?3:"auto"},tabIndex:0})},V_=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(T=>({border:T.border,headers:T.headers,useMobileStyling:T.useMobileStyling})),[c,d]=xe(-1),[p,f]=xe(!1),h=l["userleap-platform"],m=t&&t.left,g=t&&t.right;let b;const{range:y,scaleLabelType:_,ratingIcons:v}=i;y&&(b=Number(y));const w=b||5,E=T=>{var A,L;switch(_){case cn.Star:return(A=v[0])==null?void 0:A.svg;case cn.Smiley:return(L=v[T])==null?void 0:L.svg;default:return String(T+1)}},I=[...Array(w)].map((T,A)=>{const L=A+1;return C(M_,{activeValue:c,border:s,icon:E(A),isPressed:p,onSubmit:()=>r({value:L,questionId:o,type:a}),range:w,scaleLabelType:_,setActiveValue:d,setIsPressed:f,useMobileStyling:u,value:L},A)}),S=T=>{T.preventDefault(),T.stopPropagation(),r({value:null,questionId:o,type:a})},x=()=>C(Je,{children:[C("div",{"aria-label":`Rating (1 - ${w})`,className:"ul-card--likert__numbers",role:"radiogroup",children:I}),C("div",{className:"ul-card--likert__labels",children:[C("span",{children:m}),C("span",{children:g})]}),!i.required&&C("div",{className:"ul-vertical-centered-container",children:C(Ge,{onClick:S,children:Jn(i)})})]});return C("div",{className:H(mt(N.CardMainContent,h)),children:C("form",{className:H([e,"ul-card--likert",N.FadeInTransition]),children:[C(vt,{message:n,properties:i}),C(Jt,{properties:i,defaultBody:x})]},o)})},Vf=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(I=>({border:I.border,headers:I.headers,useMobileStyling:I.useMobileStyling})),c=r.reduce((I,S)=>(I[S.id]={isSelected:!1},I),{}),[d,p]=xe(c),f=l["userleap-platform"],h=a===O.MultipleChoice,m=i.required,g=Object.entries(d).some(([I,S])=>{var A;const x=r.find(L=>`${L.id}`===I),T=S.userText===void 0||S.userText.trim()==="";return((A=x==null?void 0:x.optionProperties)==null?void 0:A.allowsTextEntry)&&T&&S.isSelected}),b=Object.values(d).some(I=>I.isSelected),y=g||m&&!b,_=r.map(({id:I,label:S,value:x,optionProperties:T},A)=>{var U,R;const L=`${I}`,{allowsTextEntry:k}=T||{allowsTextEntry:!1};return C(Pf,{allowTextEntry:k,border:s,error:!1,id:L,index:A,isRadio:h,isSelected:!!((U=d[L])!=null&&U.isSelected),label:S,onUserInputChanged:V=>w(V.id,V.selected,V.userText),promptText:"Please specify",text:(R=d[I])==null?void 0:R.userText,useMobileStyling:u,value:x},L)}),v=I=>{I.preventDefault(),I.stopPropagation(),n(d)},w=(I,S,x)=>{const T=Object.assign({},d);if(h&&S)for(const A of Object.values(T))A.isSelected=!1,delete A.userText;T[I]={isSelected:S,userText:x},p(T)},E=()=>C("div",{children:[C("div",{className:H(_e(N.ChoiceGroup,u)),role:h?"radiogroup":"group",children:_}),C("div",{className:"ul-card__button-wrapper",children:C(Ge,{disabled:y,onClick:v,children:Jn(i)})})]});return C("div",{className:H(mt(N.CardMainContent,f)),children:C("form",{className:H([e,"ul-card--multiple",N.FadeInTransition]),id:"text-form",onSubmit:v,children:[C(vt,{message:t,properties:i}),C(Jt,{properties:i,defaultBody:E})]},o)})},F_=e=>{const{questionId:t,type:n,next:r,options:i}=e;return C(Vf,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,p])=>p.isSelected)||[void 0,void 0],[l,u]=s,c=i.find(p=>`${p.id}`===l),d=u!=null&&u.userText?{[l]:{userText:u.userText}}:null;r({value:c&&l?{[l]:c.value}:{},secondaryValue:d,questionId:t,type:n})}})},B_=e=>{const{questionId:t,type:n,next:r}=e;return C(Vf,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((u,[c,d])=>(u[c]=d.isSelected,u),a),l=Object.entries(o).reduce((u,[c,d])=>{if(!d.userText)return u;const p=u||{};return p[c]={userText:d.userText},p},null);r({value:s,secondaryValue:l,questionId:t,type:n})}})},j_=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(g=>({border:g.border,headers:g.headers,useMobileStyling:g.useMobileStyling})),c=l["userleap-platform"],d=t&&t.left,p=t&&t.right,f=[...Array(11)].map((g,b)=>C("div",{className:H([..._e(N.NPSNumber,u),..._e(`${N.NPSNumber}-${b}`,u)]),id:`option-${b}`,onClick:()=>i({value:b,questionId:o,type:a}),onKeyPress:y=>{y.preventDefault(),(y.key==="Enter"||y.key===" ")&&i({value:b,questionId:o,type:a})},onPointerDown:y=>{Bn(y.target)&&(y.target.style.zIndex="2",y.target.style.borderColor=s)},onPointerLeave:y=>{Bn(y.target)&&(y.target.style.zIndex="auto",y.target.style.borderColor=is)},role:"radio",tabIndex:0,children:b},b)),h=g=>{g.preventDefault(),g.stopPropagation(),i({value:null,questionId:o,type:a})},m=()=>C("div",{children:[C("div",{className:"ul-card--nps__numbers",children:f}),C("div",{className:"ul-card--nps__labels",children:[C("span",{children:d}),C("span",{children:p})]}),!r.required&&C("div",{className:"ul-vertical-centered-container",children:C(Ge,{onClick:h,children:Jn(r)})})]});return C("div",{className:H(mt(N.CardMainContent,c)),children:C("form",{className:H([e,"ul-card--nps",N.FadeInTransition]),children:[C(vt,{message:n,properties:r}),C(Jt,{properties:r,defaultBody:m})]},o)})},H_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,headers:s,useMobileStyling:l,update:u}=ce(I=>({border:I.border,headers:I.headers,useMobileStyling:I.useMobileStyling,update:I.update})),[c,d]=xe(""),p=Yt(null),f=s["userleap-platform"],h=c.trim(),m=r.required===!0&&!h,g=Uf(p,()=>u()),b=I=>{g(),I.preventDefault(),I.stopPropagation(),ur(I.target)&&d(I.target.value)},y=I=>{I.preventDefault(),I.stopPropagation(),n({value:c,questionId:i,type:o})},_=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",v=I=>{ur(I.target)&&(I.target.style.borderColor=a)},w=I=>{ur(I.target)&&(I.target.style.borderColor=is)},E=()=>C("div",{className:"ul-card-text",children:[C("div",{className:"ul-card-text__container",children:C("textarea",{"aria-label":_,"aria-labelledby":N.QuestionHeader,"aria-multiline":"true","aria-placeholder":_,className:H(_e(N.OpenTextInput,l)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:w,onChange:b,onFocus:v,placeholder:_,ref:p,role:"textbox",tabIndex:0})}),C(Ge,{disabled:m,onClick:y,style:{backgroundColor:m?"":a},children:Jn(r)})]});return C("div",{className:H(mt(N.CardMainContent,f)),children:C("form",{className:H([e,"ul-card--text",N.FadeInTransition]),id:"text-form",children:[C(vt,{message:t,properties:r}),C(Jt,{defaultBody:E,properties:r})]},i)})};var Gt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Gt||{});const io=e=>e.type===$e.AvPermission,Ff=e=>e.type===$e.ScreenPermission,z_=(e,t)=>!(io(t)?t.permissionDescriptors:[]).includes(Hn.Camera)||e.getVideoTracks().length>0,Bf=(e,t)=>{if(e===void 0)return Gt.RequestNeeded;if(e){if(!z_(e,t))return Gt.RequestNeeded}else return Gt.TryAgain;return Gt.Ready},ku={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ft=Lf(e=>({...ku,reset:()=>{e(ku)},updatePage:t=>{e(t)}}));function Da({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=ft.getState(),{recorderEventEmitter:o}=ce.getState();o.emit(Te.AvPermission,{[Y.PermissionDescriptors]:e.permissionDescriptors,[Y.StreamReadyCallback]:(a,s)=>{if(n===a)return;let l=e;if(a&&!e.permissionDescriptors.includes(Hn.Camera)){const u=t.indexOf(e),c=s!=null&&s.active?u+2:u+1;(s==null?void 0:s.active)&&r&&o.emit(Te.BeginRecording,{[Y.RecordingMediaTypes]:r,[Y.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),l=t[c]}i({currentPage:l,avStream:a})}})}function G_({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=ft.getState(),{eventEmitFn:s,recorderEventEmitter:l}=ce.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(Qe.RecordedTaskPermissionScreen),s(Qe.RecordedTaskPermissionScreen),l.emit(Te.PermissionStatus,{[Y.PermissionStatusCallback]:(p,f,h,m)=>{const g=e[c],{type:b}=g,y=[nt.Screen];if(io(g)){const{permissionDescriptors:_}=g,v=_==null?void 0:_.includes(Hn.Microphone),w=_==null?void 0:_.includes(Hn.Camera);v&&y.push(nt.Audio),w&&y.push(nt.Video);const E=(p==null?void 0:p.active)&&!w,I=(p==null?void 0:p.active)&&f;(E||I)&&c++}Ff(e[c])&&h&&(c++,l.emit(Te.BeginRecording,{[Y.RecordingMediaTypes]:y,[Y.StartRecordingCallback]:_=>a({mediaRecordingUids:_})})),a({currentPage:e[c],avStream:p,screenPermissionRequested:h,nextQuestion:o,type:b,passthroughData:u,recordingMediaTypes:y,captureStream:m})}});const d=e[c];return d.type===$e.AvPermission&&Da({currentPage:d,pages:e}),d}function Ua({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=ft.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=ce.getState(),l={value:{taskStatus:e},type:O.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(Te.FinishTask,{[Y.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[Y.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[Y.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[Y.PassthroughData]:n,[Y.CurrentIndex]:s,[Y.TaskResponse]:l,[Y.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function Os({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=ce.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=ft.getState();if(!o)return;const l=e.indexOf(o);switch(o.type){case $e.AvPermission:{const u=s?l+2:l+1;s&&a&&n.emit(Te.BeginRecording,{[Y.RecordingMediaTypes]:a,[Y.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case $e.ScreenPermission:n.emit(Te.ScreenPermission,{[Y.ScreenPermissionRequested]:t,[Y.StreamReadyCallback]:(u,c)=>{const d=c?e[l+1]:o;c&&a&&n.emit(Te.BeginRecording,{[Y.RecordingMediaTypes]:a,[Y.StartRecordingCallback]:p=>{i({captureStream:c,mediaRecordingUids:p})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:c})}});return;case $e.StartTask:r(Qe.RecordedTaskStart),n.emit(Qe.RecordedTaskStart),n.emit(Te.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case $e.CompleteTask:return}}const jf="ul-permission-graphics-container",Hf="ul-permission-body",zf=H([jf,"ul_recorded-task-inset-spacing"]),oo=H(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Gf=({richTextBody:e})=>C("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),ao=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:C(Ge,{className:H([n&&"ul-skip-button-below",N.InactiveButton]),onClick:Ua.bind(null,{status:Ye.Abandoned}),children:t||"Skip"}),Ns=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=ft.getState(),o=(r==null?void 0:r.includes(nt.Audio))||(r==null?void 0:r.includes(nt.Video));Ze(()=>{const a=setInterval(()=>{o&&t&&!t.active?i({avStream:null,currentPage:e[0]}):(!n||!n.active)&&i({captureStream:void 0,currentPage:e[o?1:0]})},1e3);return()=>clearInterval(a)},[t,n,o,e,r,i])},K_=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return Ns(t),C("div",{className:"ul-task-page",children:[C(Gf,{richTextBody:o}),C("div",{className:oo,children:[C(Ge,{onClick:Os.bind(null,{pages:t}),children:r}),C(ao,{required:n,skipButtonText:i})]})]},"start-task")},W_=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;Ns(t);const a=C(Jt,{properties:n,defaultBody:()=>C("div",{className:oo,children:[C(Ge,{className:"ul-complete-task-button",onClick:Ua.bind(null,{status:Ye.Completed}),children:r}),C(Ge,{className:H([N.InactiveButton]),onClick:Ua.bind(null,{status:Ye.GivenUp}),children:i})]})});return C("div",{className:"ul-task-page",children:[C(Gf,{richTextBody:e.taskDetail}),a]},"complete-task")},q_=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=ce(l=>[l.tabTitle]),[a,s]=xe(!1);return C("div",{children:[C("div",{className:zf,children:[C("p",{style:{marginTop:"auto"},children:e.selectTabText}),C("div",{className:"ul-select-tab-container",children:C("p",{className:Hf,children:o})})]}),C("div",{className:n?"":oo,children:[C(Ge,{disabled:a,onClick:Os.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),C(ao,{required:n,skipButtonText:i})]})]})},$_=({content:e})=>C("div",{className:H([jf,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),Y_=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=io(t[0])?t[0]:null;return Ze(()=>{const l=setInterval(()=>{s!==null&&Da({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?C("div",{children:[C("div",{className:zf,children:C("p",{className:"ul-av-permission-denied-paragraph",children:[C("span",{className:"ul-av-permission-denied-headline",children:r}),C("span",{className:Hf,children:i})]})}),C("div",{className:oo,children:[C(Ge,{onClick:Da.bind(null,{currentPage:s,pages:t}),children:a}),C(ao,{required:n,skipButtonText:o})]})]}):null},Z_=({stream:e})=>C("video",{autoPlay:!0,className:H(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Q_=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=ft.getState();return Ns(t),C("div",{children:[C(Z_,{stream:i}),C("div",{className:"ul-vertical-button-container-center",children:[C(Ge,{onClick:Os.bind(null,{pages:t}),children:e.buttonText}),C(ao,{bottom:!0,required:n,skipButtonText:r})]})]})},J_=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=ft.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case $e.AvPermission:{const o=Bf(r,i);return o===Gt.RequestNeeded?C($_,{content:i}):o===Gt.TryAgain?C(Y_,{content:i,pages:t,required:n}):C(Q_,{content:i,pages:t,required:n})}case $e.ScreenPermission:return C(q_,{content:i,pages:t,required:n});case $e.StartTask:return C(K_,{content:i,pages:t,required:n});case $e.CompleteTask:return C(W_,{content:i,pages:t,properties:e});default:return null}},X_=({className:e,properties:t,next:n,questionId:r})=>{const i=ce(),{headers:o,surveyId:a,responseGroupUid:s,userId:l}=i,u=ft(),{screenPermissionRequested:c}=u,d=ft(g=>g.avStream);let p=ft(g=>g.currentPage);p||(p=G_({questionId:r,surveyId:a,next:g=>{n(g)},pages:t.pages,responseGroupUid:s,userId:l}));let f=p.headline,h=p.captionText;const m=Bf(d,p);return Ff(p)&&c&&(f=p.permissionDeniedHeadline,h=p.permissionDeniedCaptionText),io(p)&&m===Gt.Ready&&(f=p.permissionGrantedHeadline,h=p.permissionGrantedCaptionText),C("div",{className:H([...mt(N.CardMainContent,o["userleap-platform"])]),children:C("div",{className:H([e,"ul-center-horizontally",N.FadeInTransition]),children:[C(vt,{message:f,properties:{captionText:h}}),C(J_,{properties:t})]})})},e1={"{{user_id}}":"externalUserId","{{email}}":"email"},t1=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(e1))if(n.toLowerCase().includes(l))if(t[u]){const c=new RegExp(l,"gi");n=n.replace(c,t[u])}else r.push(l);if(r.length===0||!n.includes("?"))return n;const i=n.slice(0,n.indexOf("?")),a=n.slice(n.indexOf("?")+1).split("&").map(l=>l.split("=")).filter(l=>!r.includes(l[1]));if(a.length===0)return i;const s=a.map(l=>l.join("=")).join("&");return`${i}?${s}`},n1=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,visitorAttributes:s}=ce(f=>({headers:f.headers,visitorAttributes:f.visitorAttributes})),l=a["userleap-platform"],u=(f,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:i,type:o})},c=f=>{(f.key==="Enter"||f.key===" ")&&n({value:void 0,questionId:i,type:o})},d=()=>C("div",{className:"ul-card-button-group",children:[C("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:t1(r&&r.buttonUrl,s),id:"ul-card-text__button",onClick:u,onKeyPress:c,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:Jn(r)}),r.required===!1&&C("button",{className:N.SkipButton,onClick:f=>u(f,!0),children:Ls(r)})]}),p=(f,h)=>f?C("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:f},id:"ul-card__text-url-body-container"}):C("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((m,g)=>C("p",{children:m},g))});return C("div",{className:H(mt(N.CardMainContent,l)),children:C("div",{className:H([e,"ul-card__text-url-prompt",N.FadeInTransition]),children:[C(vt,{message:t}),p(r&&r.richTextBody,r&&r.body),C(Jt,{defaultBody:d,properties:r})]},i)})},r1=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o,headers:a}=ce(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo,headers:u.headers}));Ze(()=>{setTimeout(()=>{r(Nn)},o?4e3:2e3)},[r,o]);const s=i&&i.subheader?C("p",{className:N.Caption,children:i.subheader}):null,l=i&&i.headline?i.headline:"";return C("div",{className:H(mt(N.CardMainContent,a["userleap-platform"])),children:C("div",{className:H([e,"ul-card--thanks",N.FadeInTransition]),children:C("div",{children:C("div",{className:"ul-card--thanks-content",children:[C("div",{className:"ul-thanks-check",children:C("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[C("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"}),C("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"}),C("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"})]})}),C(vt,{message:l}),s]})})},t)})},an="https://cdn.sprig.com",F={document:void 0,videojs:void 0},i1=`/* progress control styles */
64
+ `,Xn=e=>(e==null?void 0:e.buttonText)||"Next",As=e=>(e==null?void 0:e.skipButtonText)||"Skip",G_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,useMobileStyling:s,border:l}=ce(A=>({headers:A.headers,useMobileStyling:A.useMobileStyling,border:A.border})),[u,c]=xe(!1),[d,p]=xe(""),[f,h]=xe(!1),m=a["userleap-platform"],g=r==null?void 0:r.collectName,b=(r==null?void 0:r.nameLabelText)||"Full Name",v=(r==null?void 0:r.consentText)||"I agree to the stated conditions",_=(r==null?void 0:r.submitButtonText)||"Submit",y=!!d.trim(),C=u&&(!g||y),E=(A,O=!1)=>{A.preventDefault(),A.stopPropagation();let k=null;if(!O){if(!C){h(!0);return}k={submitted:!0},g&&(k.name=d)}n({value:k,questionId:i,type:o})},S=A=>{hv(A.target)&&(A.preventDefault(),A.stopPropagation(),p(A.target.value))},I=A=>{Bn(A.target)&&(A.target.style.borderColor=f&&!y?ur:l)},x=A=>{Bn(A.target)&&(A.target.style.borderColor=f&&!y?ur:ts)},R=()=>w("div",{children:[w(Lf,{allowTextEntry:!1,border:l,error:f&&!u,index:0,isRadio:!1,isSelected:u,label:v,onUserInputChanged:({selected:A})=>{A!==u&&c(!u)},useMobileStyling:s}),g&&w("input",{"aria-label":b,"aria-placeholder":b,className:H(_e(N.ConsentLegalNameInput,s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:x,onFocus:I,onInput:S,placeholder:b,style:f&&!y?{borderColor:ur}:{},tabIndex:0,value:d}),w("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[w(Ge,{className:C?"":N.ButtonDisabled,onClick:E,children:_}),r.required===!1&&w("button",{className:N.SkipButton,onClick:A=>E(A,!0),children:As(r)})]})]});return w("div",{className:H(mt(N.CardMainContent,m)),children:w("div",{className:H([e,"ul-card__consent-legal",N.FadeInTransition]),children:[w(vt,{message:t}),w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),w(Jt,{properties:r,defaultBody:R,embeddedType:"pdf"})]},i)})},K_=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:l,useMobileStyling:u,value:c})=>{const d=`option-${c}`,p=a===cn.Number,f=a===cn.Star,h=p&&c===e,[m,g]=(()=>c<=e&&f||c===e?r?[t,1]:[t,.3]:["",1])(),b=()=>{switch(a){case cn.Star:return H([..._e(N.LikertStar,u),..._e(`${N.LikertStar}-${c}`,u)]);case cn.Smiley:return H([..._e(N.LikertSmiley,u),..._e(`${N.LikertSmiley}-${c}`,u)]);default:return H(c===o?[..._e(N.LikertNumber,u),..._e(`${N.LikertNumber}-${c}`,u),..._e("likert-last-option",u)]:[..._e(N.LikertNumber,u),..._e(`${N.LikertNumber}-${c}`,u)])}},v=()=>{s(-1),l(!1)};return w("div",{"aria-label":p?void 0:String(c),className:b(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:v,role:"radio",style:{color:p?"":m,borderColor:h?m:"",fillOpacity:h?"":g,zIndex:h?3:"auto"},tabIndex:0})},W_=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(R=>({border:R.border,headers:R.headers,useMobileStyling:R.useMobileStyling})),[c,d]=xe(-1),[p,f]=xe(!1),h=l["userleap-platform"],m=t&&t.left,g=t&&t.right;let b;const{range:v,scaleLabelType:_,ratingIcons:y}=i;v&&(b=Number(v));const C=b||5,E=R=>{var A,O;switch(_){case cn.Star:return(A=y[0])==null?void 0:A.svg;case cn.Smiley:return(O=y[R])==null?void 0:O.svg;default:return String(R+1)}},S=[...Array(C)].map((R,A)=>{const O=A+1;return w(K_,{activeValue:c,border:s,icon:E(A),isPressed:p,onSubmit:()=>r({value:O,questionId:o,type:a}),range:C,scaleLabelType:_,setActiveValue:d,setIsPressed:f,useMobileStyling:u,value:O},A)}),I=R=>{R.preventDefault(),R.stopPropagation(),r({value:null,questionId:o,type:a})},x=()=>w(Je,{children:[w("div",{"aria-label":`Rating (1 - ${C})`,className:"ul-card--likert__numbers",role:"radiogroup",children:S}),w("div",{className:"ul-card--likert__labels",children:[w("span",{children:m}),w("span",{children:g})]}),!i.required&&w("div",{className:"ul-vertical-centered-container",children:w(Ge,{onClick:I,children:Xn(i)})})]});return w("div",{className:H(mt(N.CardMainContent,h)),children:w("form",{className:H([e,"ul-card--likert",N.FadeInTransition]),children:[w(vt,{message:n,properties:i}),w(Jt,{properties:i,defaultBody:x})]},o)})},Nf=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(S=>({border:S.border,headers:S.headers,useMobileStyling:S.useMobileStyling})),c=r.reduce((S,I)=>(S[I.id]={isSelected:!1},S),{}),[d,p]=xe(c),f=l["userleap-platform"],h=a===L.MultipleChoice,m=i.required,g=Object.entries(d).some(([S,I])=>{var A;const x=r.find(O=>`${O.id}`===S),R=I.userText===void 0||I.userText.trim()==="";return((A=x==null?void 0:x.optionProperties)==null?void 0:A.allowsTextEntry)&&R&&I.isSelected}),b=Object.values(d).some(S=>S.isSelected),v=g||m&&!b,_=r.map(({id:S,label:I,value:x,optionProperties:R},A)=>{var U,T;const O=`${S}`,{allowsTextEntry:k}=R||{allowsTextEntry:!1};return w(Lf,{allowTextEntry:k,border:s,error:!1,id:O,index:A,isRadio:h,isSelected:!!((U=d[O])!=null&&U.isSelected),label:I,onUserInputChanged:B=>C(B.id,B.selected,B.userText),promptText:"Please specify",text:(T=d[S])==null?void 0:T.userText,useMobileStyling:u,value:x},O)}),y=S=>{S.preventDefault(),S.stopPropagation(),n(d)},C=(S,I,x)=>{const R=Object.assign({},d);if(h&&I)for(const A of Object.values(R))A.isSelected=!1,delete A.userText;R[S]={isSelected:I,userText:x},p(R)},E=()=>w("div",{children:[w("div",{className:H(_e(N.ChoiceGroup,u)),role:h?"radiogroup":"group",children:_}),w("div",{className:"ul-card__button-wrapper",children:w(Ge,{disabled:v,onClick:y,children:Xn(i)})})]});return w("div",{className:H(mt(N.CardMainContent,f)),children:w("form",{className:H([e,"ul-card--multiple",N.FadeInTransition]),id:"text-form",onSubmit:y,children:[w(vt,{message:t,properties:i}),w(Jt,{properties:i,defaultBody:E})]},o)})},$_=e=>{const{questionId:t,type:n,next:r,options:i}=e;return w(Nf,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,p])=>p.isSelected)||[void 0,void 0],[l,u]=s,c=i.find(p=>`${p.id}`===l),d=u!=null&&u.userText?{[l]:{userText:u.userText}}:null;r({value:c&&l?{[l]:c.value}:{},secondaryValue:d,questionId:t,type:n})}})},q_=e=>{const{questionId:t,type:n,next:r}=e;return w(Nf,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((u,[c,d])=>(u[c]=d.isSelected,u),a),l=Object.entries(o).reduce((u,[c,d])=>{if(!d.userText)return u;const p=u||{};return p[c]={userText:d.userText},p},null);r({value:s,secondaryValue:l,questionId:t,type:n})}})},Y_=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ce(g=>({border:g.border,headers:g.headers,useMobileStyling:g.useMobileStyling})),c=l["userleap-platform"],d=t&&t.left,p=t&&t.right,f=[...Array(11)].map((g,b)=>w("div",{className:H([..._e(N.NPSNumber,u),..._e(`${N.NPSNumber}-${b}`,u)]),id:`option-${b}`,onClick:()=>i({value:b,questionId:o,type:a}),onKeyPress:v=>{v.preventDefault(),(v.key==="Enter"||v.key===" ")&&i({value:b,questionId:o,type:a})},onPointerDown:v=>{Bn(v.target)&&(v.target.style.zIndex="2",v.target.style.borderColor=s)},onPointerLeave:v=>{Bn(v.target)&&(v.target.style.zIndex="auto",v.target.style.borderColor=ts)},role:"radio",tabIndex:0,children:b},b)),h=g=>{g.preventDefault(),g.stopPropagation(),i({value:null,questionId:o,type:a})},m=()=>w("div",{children:[w("div",{className:"ul-card--nps__numbers",children:f}),w("div",{className:"ul-card--nps__labels",children:[w("span",{children:d}),w("span",{children:p})]}),!r.required&&w("div",{className:"ul-vertical-centered-container",children:w(Ge,{onClick:h,children:Xn(r)})})]});return w("div",{className:H(mt(N.CardMainContent,c)),children:w("form",{className:H([e,"ul-card--nps",N.FadeInTransition]),children:[w(vt,{message:n,properties:r}),w(Jt,{properties:r,defaultBody:m})]},o)})},Z_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,headers:s,useMobileStyling:l,update:u}=ce(S=>({border:S.border,headers:S.headers,useMobileStyling:S.useMobileStyling,update:S.update})),[c,d]=xe(""),p=Yt(null),f=s["userleap-platform"],h=c.trim(),m=r.required===!0&&!h,g=Rf(p,()=>u()),b=S=>{g(),S.preventDefault(),S.stopPropagation(),cr(S.target)&&d(S.target.value)},v=S=>{S.preventDefault(),S.stopPropagation(),n({value:c,questionId:i,type:o})},_=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",y=S=>{cr(S.target)&&(S.target.style.borderColor=a)},C=S=>{cr(S.target)&&(S.target.style.borderColor=ts)},E=()=>w("div",{className:"ul-card-text",children:[w("div",{className:"ul-card-text__container",children:w("textarea",{"aria-label":_,"aria-labelledby":N.QuestionHeader,"aria-multiline":"true","aria-placeholder":_,className:H(_e(N.OpenTextInput,l)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:C,onChange:b,onFocus:y,placeholder:_,ref:p,role:"textbox",tabIndex:0})}),w(Ge,{disabled:m,onClick:v,style:{backgroundColor:m?"":a},children:Xn(r)})]});return w("div",{className:H(mt(N.CardMainContent,f)),children:w("form",{className:H([e,"ul-card--text",N.FadeInTransition]),id:"text-form",children:[w(vt,{message:t,properties:r}),w(Jt,{defaultBody:E,properties:r})]},i)})};var Gt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Gt||{});const oo=e=>e.type===qe.AvPermission,Df=e=>e.type===qe.ScreenPermission,Q_=(e,t)=>!(oo(t)?t.permissionDescriptors:[]).includes(Hn.Camera)||e.getVideoTracks().length>0,Uf=(e,t)=>{if(e===void 0)return Gt.RequestNeeded;if(e){if(!Q_(e,t))return Gt.RequestNeeded}else return Gt.TryAgain;return Gt.Ready},yu={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ft=kf(e=>({...yu,reset:()=>{e(yu)},updatePage:t=>{e(t)}}));function La({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=ft.getState(),{recorderEventEmitter:o}=ce.getState();o.emit(Te.AvPermission,{[q.PermissionDescriptors]:e.permissionDescriptors,[q.StreamReadyCallback]:(a,s)=>{if(n===a)return;let l=e;if(a&&!e.permissionDescriptors.includes(Hn.Camera)){const u=t.indexOf(e),c=s!=null&&s.active?u+2:u+1;(s==null?void 0:s.active)&&r&&o.emit(Te.BeginRecording,{[q.RecordingMediaTypes]:r,[q.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),l=t[c]}i({currentPage:l,avStream:a})}})}function J_({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=ft.getState(),{eventEmitFn:s,recorderEventEmitter:l}=ce.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(Qe.RecordedTaskPermissionScreen),s(Qe.RecordedTaskPermissionScreen),l.emit(Te.PermissionStatus,{[q.PermissionStatusCallback]:(p,f,h,m)=>{const g=e[c],{type:b}=g,v=[nt.Screen];if(oo(g)){const{permissionDescriptors:_}=g,y=_==null?void 0:_.includes(Hn.Microphone),C=_==null?void 0:_.includes(Hn.Camera);y&&v.push(nt.Audio),C&&v.push(nt.Video);const E=(p==null?void 0:p.active)&&!C,S=(p==null?void 0:p.active)&&f;(E||S)&&c++}Df(e[c])&&h&&(c++,l.emit(Te.BeginRecording,{[q.RecordingMediaTypes]:v,[q.StartRecordingCallback]:_=>a({mediaRecordingUids:_})})),a({currentPage:e[c],avStream:p,screenPermissionRequested:h,nextQuestion:o,type:b,passthroughData:u,recordingMediaTypes:v,captureStream:m})}});const d=e[c];return d.type===qe.AvPermission&&La({currentPage:d,pages:e}),d}function Oa({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=ft.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=ce.getState(),l={value:{taskStatus:e},type:L.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(Te.FinishTask,{[q.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[q.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[q.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[q.PassthroughData]:n,[q.CurrentIndex]:s,[q.TaskResponse]:l,[q.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function Ts({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=ce.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=ft.getState();if(!o)return;const l=e.indexOf(o);switch(o.type){case qe.AvPermission:{const u=s?l+2:l+1;s&&a&&n.emit(Te.BeginRecording,{[q.RecordingMediaTypes]:a,[q.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case qe.ScreenPermission:n.emit(Te.ScreenPermission,{[q.ScreenPermissionRequested]:t,[q.StreamReadyCallback]:(u,c)=>{const d=c?e[l+1]:o;c&&a&&n.emit(Te.BeginRecording,{[q.RecordingMediaTypes]:a,[q.StartRecordingCallback]:p=>{i({captureStream:c,mediaRecordingUids:p})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:c})}});return;case qe.StartTask:r(Qe.RecordedTaskStart),n.emit(Qe.RecordedTaskStart),n.emit(Te.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case qe.CompleteTask:return}}const Pf="ul-permission-graphics-container",Mf="ul-permission-body",Ff=H([Pf,"ul_recorded-task-inset-spacing"]),ao=H(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Vf=({richTextBody:e})=>w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),so=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:w(Ge,{className:H([n&&"ul-skip-button-below",N.InactiveButton]),onClick:Oa.bind(null,{status:Ye.Abandoned}),children:t||"Skip"}),Rs=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=ft.getState(),o=(r==null?void 0:r.includes(nt.Audio))||(r==null?void 0:r.includes(nt.Video));Ze(()=>{const a=setInterval(()=>{o&&t&&!t.active?i({avStream:null,currentPage:e[0]}):(!n||!n.active)&&i({captureStream:void 0,currentPage:e[o?1:0]})},1e3);return()=>clearInterval(a)},[t,n,o,e,r,i])},X_=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return Rs(t),w("div",{className:"ul-task-page",children:[w(Vf,{richTextBody:o}),w("div",{className:ao,children:[w(Ge,{onClick:Ts.bind(null,{pages:t}),children:r}),w(so,{required:n,skipButtonText:i})]})]},"start-task")},e1=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;Rs(t);const a=w(Jt,{properties:n,defaultBody:()=>w("div",{className:ao,children:[w(Ge,{className:"ul-complete-task-button",onClick:Oa.bind(null,{status:Ye.Completed}),children:r}),w(Ge,{className:H([N.InactiveButton]),onClick:Oa.bind(null,{status:Ye.GivenUp}),children:i})]})});return w("div",{className:"ul-task-page",children:[w(Vf,{richTextBody:e.taskDetail}),a]},"complete-task")},t1=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=ce(l=>[l.tabTitle]),[a,s]=xe(!1);return w("div",{children:[w("div",{className:Ff,children:[w("p",{style:{marginTop:"auto"},children:e.selectTabText}),w("div",{className:"ul-select-tab-container",children:w("p",{className:Mf,children:o})})]}),w("div",{className:n?"":ao,children:[w(Ge,{disabled:a,onClick:Ts.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),w(so,{required:n,skipButtonText:i})]})]})},n1=({content:e})=>w("div",{className:H([Pf,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),r1=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=oo(t[0])?t[0]:null;return Ze(()=>{const l=setInterval(()=>{s!==null&&La({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?w("div",{children:[w("div",{className:Ff,children:w("p",{className:"ul-av-permission-denied-paragraph",children:[w("span",{className:"ul-av-permission-denied-headline",children:r}),w("span",{className:Mf,children:i})]})}),w("div",{className:ao,children:[w(Ge,{onClick:La.bind(null,{currentPage:s,pages:t}),children:a}),w(so,{required:n,skipButtonText:o})]})]}):null},i1=({stream:e})=>w("video",{autoPlay:!0,className:H(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),o1=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=ft.getState();return Rs(t),w("div",{children:[w(i1,{stream:i}),w("div",{className:"ul-vertical-button-container-center",children:[w(Ge,{onClick:Ts.bind(null,{pages:t}),children:e.buttonText}),w(so,{bottom:!0,required:n,skipButtonText:r})]})]})},a1=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=ft.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case qe.AvPermission:{const o=Uf(r,i);return o===Gt.RequestNeeded?w(n1,{content:i}):o===Gt.TryAgain?w(r1,{content:i,pages:t,required:n}):w(o1,{content:i,pages:t,required:n})}case qe.ScreenPermission:return w(t1,{content:i,pages:t,required:n});case qe.StartTask:return w(X_,{content:i,pages:t,required:n});case qe.CompleteTask:return w(e1,{content:i,pages:t,properties:e});default:return null}},s1=({className:e,properties:t,next:n,questionId:r})=>{const i=ce(),{headers:o,surveyId:a,responseGroupUid:s,userId:l}=i,u=ft(),{screenPermissionRequested:c}=u,d=ft(g=>g.avStream);let p=ft(g=>g.currentPage);p||(p=J_({questionId:r,surveyId:a,next:g=>{n(g)},pages:t.pages,responseGroupUid:s,userId:l}));let f=p.headline,h=p.captionText;const m=Uf(d,p);return Df(p)&&c&&(f=p.permissionDeniedHeadline,h=p.permissionDeniedCaptionText),oo(p)&&m===Gt.Ready&&(f=p.permissionGrantedHeadline,h=p.permissionGrantedCaptionText),w("div",{className:H([...mt(N.CardMainContent,o["userleap-platform"])]),children:w("div",{className:H([e,"ul-center-horizontally",N.FadeInTransition]),children:[w(vt,{message:f,properties:{captionText:h}}),w(a1,{properties:t})]})})},l1={"{{user_id}}":"externalUserId","{{email}}":"email"},u1=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(l1))if(n.toLowerCase().includes(l))if(t[u]){const c=new RegExp(l,"gi");n=n.replace(c,t[u])}else r.push(l);if(r.length===0||!n.includes("?"))return n;const i=n.slice(0,n.indexOf("?")),a=n.slice(n.indexOf("?")+1).split("&").map(l=>l.split("=")).filter(l=>!r.includes(l[1]));if(a.length===0)return i;const s=a.map(l=>l.join("=")).join("&");return`${i}?${s}`},c1=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,visitorAttributes:s}=ce(f=>({headers:f.headers,visitorAttributes:f.visitorAttributes})),l=a["userleap-platform"],u=(f,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:i,type:o})},c=f=>{(f.key==="Enter"||f.key===" ")&&n({value:void 0,questionId:i,type:o})},d=()=>w("div",{className:"ul-card-button-group",children:[w("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:u1(r&&r.buttonUrl,s),id:"ul-card-text__button",onClick:u,onKeyPress:c,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:Xn(r)}),r.required===!1&&w("button",{className:N.SkipButton,onClick:f=>u(f,!0),children:As(r)})]}),p=(f,h)=>f?w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:f},id:"ul-card__text-url-body-container"}):w("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((m,g)=>w("p",{children:m},g))});return w("div",{className:H(mt(N.CardMainContent,l)),children:w("div",{className:H([e,"ul-card__text-url-prompt",N.FadeInTransition]),children:[w(vt,{message:t}),p(r&&r.richTextBody,r&&r.body),w(Jt,{defaultBody:d,properties:r})]},i)})},d1=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o,headers:a}=ce(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo,headers:u.headers}));Ze(()=>{setTimeout(()=>{r(Nn)},o?4e3:2e3)},[r,o]);const s=i&&i.subheader?w("p",{className:N.Caption,children:i.subheader}):null,l=i&&i.headline?i.headline:"";return w("div",{className:H(mt(N.CardMainContent,a["userleap-platform"])),children:w("div",{className:H([e,"ul-card--thanks",N.FadeInTransition]),children:w("div",{children:w("div",{className:"ul-card--thanks-content",children:[w("div",{className:"ul-thanks-check",children:w("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[w("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"}),w("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"}),w("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"})]})}),w(vt,{message:l}),s]})})},t)})},an="https://cdn.sprig.com",F={document:void 0,videojs:void 0},f1=`/* progress control styles */
81
65
  .video-js .vjs-control {
82
66
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
83
67
  }
@@ -734,5 +718,5 @@ span.ul-button-text {
734
718
  .vjs-poster {
735
719
  background-size: cover;
736
720
  }
737
- `,o1=e=>{const t=F.document.createElement("div");return t.className="ul-video-player-loading",t.id=Ds(e),["first","second","third","fourth"].map(n=>{const r=F.document.createElement("div");r.className=n,t.appendChild(r)}),t},Ds=e=>e+"-loading-spiner",Ee="hidden",xu=".m3u8",Vo="questionId",Fo="ul-video-recorder-camera-off-button",Bo="ul-recording-in-session",a1=[{type:"link",content:`${an}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${an}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${an}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${an}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${an}/userleap-web-upchunk-v2.2.2.js`}],Kf=[{type:"link",content:`${an}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${an}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:i1}],Wf="-video-player",qf="-secondary-video-player",$f="-video-recorder";let ut,Au;const Ht=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=F.document.documentElement;if(!r||!i)return;const s={event:`SDK - ${e}`,visitorId:r,environmentId:i,metadata:{...o||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.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(s)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},kt=async(e,t,n,r,i,o)=>{Ht({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:i,envId:o,metadata:{errorMessage:e.message}});const a=F.document.documentElement,s={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:s,vid:i,envId:o};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},s1=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=F.document.createElement("script"),o.src=n):t==="link"?(o=F.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=F.document.createElement("style"),o.innerHTML=n),o.onload=function(){r(n)},o.onerror=function(){i(n)},o.async=!1,o.id=btoa(n),e.appendChild(o)}),Yf=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(s1(F.document.head,r)),n),[])).then(()=>{F.videojs=F.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},Tu=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=Ee;else if(t==="success")e.style.visibility=Ee,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%)`}},jo=(e,t)=>{const n=F.videojs(e.id());return n==null?void 0:n.payload[t]},l1=(e,t,n,r,i)=>{const{surveyId:o,responseGroupUid:a,visitorId:s,envId:l}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(W.ERROR,{type:W.PERMISSION_DENIED}),Ht({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:jo(e,Vo),responseGroupUid:a,surveyId:o}})):(n&&n(W.ERROR,{type:W.OTHER}),kt(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){kt(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),Ht({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:jo(e,Vo),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=jo(e,Vo);if(!o){const m="internal error: missing fields in payload";return n&&n(W.ERROR,{type:W.OTHER}),kt(new Error(m),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?W.MEDIA_TYPE_AUDIO:W.MEDIA_TYPE_VIDEO,d=Kt();Ht({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const p={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(p.questionId=u),a&&(p.responseGroupUid=a),s&&(p.visitorId=s);const h=await(async()=>{const m=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(m.ok){const g=await m.json();return n&&n(W.UPLOAD_STARTED,{[W.UPLOAD_ID]:g.upload.id,[W.MEDIA_TYPE]:c,[W.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(W.ERROR,{type:W.OTHER,response:m}),kt(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(ut=F.document.defaultView.UpChunk.createUpload({endpoint:h,file:new F.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),ut.startTime=Date.now(),Ht({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),ut.on("error",m=>{r(e.uploadProgressLabel,"none"),n&&n(W.UPLOAD_FINISHED,{[W.MEDIA_RECORDING_UID]:d}),kt(m,"finishRecord",t,i,s,l)}),ut.on("progress",m=>{n&&n(W.UPLOAD_PROGRESS,{[W.MEDIA_RECORDING_UID]:d,[W.UPLOAD_PROGRESS_PCT]:m.detail}),r(e.uploadProgressLabel,"progress",m.detail)}),ut.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(W.UPLOAD_FINISHED,{[W.MEDIA_RECORDING_UID]:d}),Ht({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:ut.startTime&&Date.now()-ut.startTime}})}))})},Zf=(e,t)=>{const n=new(F.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),u1(n),n},u1=e=>{e.children().forEach(t=>{if(tt[t.name_]){const n=mi(tt[t.name_],`ul-${tt[t.name_]}`);t.el_.appendChild(n)}})},mi=(e,t="")=>{const n=F.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},Qf=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(F.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(F.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?v1(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&f1(e,!1),o==null||o.play()}),e.on("pause",()=>{o==null||o.pause()}),e.on("seeked",()=>{o==null||o.currentTime(e.currentTime())}),e.on("ratechange",()=>{o==null||o.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),a.addChild(t),e.addChild(a),r&&r(e)},c1=(e,t,n)=>{e.addClass(`ul${qf}`);const r=new(F.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},d1=(e,t,n,r,i,o,a,s=!1)=>{Au=Date.now();const u=zi(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(!u)return;u.payload=n;const{surveyId:c,questionId:d,responseGroupUid:p,visitorId:f,envId:h}=n;let m;const g=A=>{const L=Fo,k=Fo+"-audio-only";Tu(u.uploadProgressLabel,"none"),ut&&ut.startTime>=Au&&ut.abort();const U=F.document.getElementById("ul-camera-button");A?(u.children()[0].classList.add("vjs-hidden"),v.removeClass(L),v.addClass(k),U.innerHTML=tt.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),m==null||m.getTracks().forEach(R=>{R.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(R=>{m=R,R.getVideoTracks().forEach(V=>{V.enabled=!1}),u.record().onDeviceReady(R)}).catch(u.record().onDeviceError.bind(u.record()))):(m==null||m.getVideoTracks().forEach(R=>{R.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),v.removeClass(k),v.addClass(L),U.innerHTML=tt.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},b=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{b.hasClass(Ee)||(Ht({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:f,envId:h,metadata:{questionId:d,responseGroupUid:p,surveyId:c}}),g(u.cameraOff),i(W.DELETE,{}),v.removeClass(Ee),b.addClass(Ee))}});b.addClass("ul-video-recorder-delete-button"),b.el_.appendChild(mi(tt.DeleteButton,"ul-delete-button"));const y=F.document.getElementById(t),_=()=>{y.classList.contains("vjs-fullscreen")&&u.cameraOff?y.style.display="table":y.style.display="flex"};_();const v=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,Ht({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:p,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!b.hasClass(Ee)&&b.addClass(Ee),i(W.DELETE,{}),_())}});v.addClass(Fo),v.el_.appendChild(mi(tt.TurnOffCamera,"ul-camera-button"));const w=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{const A=F.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),A&&(A.innerHTML=tt.RecordButton),w.removeClass(Bo),b.removeClass(Ee);else{const L=F.document.getElementById("ul-recording-countdown-screen");if(L)L.remove(),A&&(A.innerHTML=tt.RecordButton),g(u.cameraOff),i(W.DELETE,{}),v.removeClass(Ee),b.addClass(Ee),w.removeClass(Bo),S.show();else{w.addClass(Bo),S.hide(),v.addClass(Ee),b.addClass(Ee),A&&(A.innerHTML=tt.StopButton);const k=F.document.createElement("div");k.id="ul-recording-countdown-screen",y.insertBefore(k,y.children[1]),k.style.height=`${y.offsetHeight}px`,Jf(u,3)}}}});w.addClass("ul-video-recorder-toggle-button"),w.el_.appendChild(mi(tt.RecordButton,"ul-recorder-toggle"));const E=F.document.createElement("p");E.style.visibility="hidden",E.className="ul-upload-progress-label",e.appendChild(E),u.uploadProgressLabel=E;const I=Zf(u,[b,v,"PlayToggle",w,"FullscreenToggle"]),S=I.children().find(A=>A.name_==="FullscreenToggle");S.hasClass("vjs-disabled")&&S.hide();const x=I.children().find(A=>A.name_==="PlayToggle");x.hide(),o&&v.addClass(Ee),!o&&b.addClass(Ee),Qf(u,I,o,!1,s),u.on("stopRecord",()=>{w.hide(),x.show(),S.show(),b.removeClass(Ee)}),u.on("deviceReady",()=>{w.show(),x.hide(),b.addClass(Ee)}),l1(u,r,i,Tu,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),x.show(),w.hide(),b.removeClass(Ee));const T=[{name:"microphone"}];!u.cameraOff&&T.push({name:"camera"}),Promise.all(T.map(A=>{var L;return(L=navigator==null?void 0:navigator.permissions)==null?void 0:L.query(A)})).then(A=>{A.reduce((k,U)=>k&U.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(A=>{})},Jf=(e,t=3)=>{const n=F.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(()=>{Jf(e,t-1)},1e3))},Xf=e=>{const t=F.document.createElement("div");return t.className="ul-video-container",t.appendChild(o1(e)),t},Pa=(e,t)=>{const n=F.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=F.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=F.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),n.appendChild(r),t.appendChild(n),t},f1=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},zi=(e,t)=>F.document.getElementById(e)?t?F.videojs(e,t):F.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),p1=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{F.document=o;const l=e+Wf,u=Xf(l);return F.document.addEventListener("securitypolicyviolation",c=>{kt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Yf(Kf,()=>{F.document.getElementById(Ds(l)).remove(),Pa(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+qf;Pa(d,u);const p=zi(l,c),f=zi(d,{muted:!0,...c});if(!p||!f)return;c1(f,a,s),a||f.addClass(Ee);const h=Zf(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),m=h.children().find(g=>g.name_==="FullscreenToggle");m.hasClass("vjs-disabled")&&m.hide(),Qf(p,h,t,n,r,f)}catch(d){kt(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},h1=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{F.document=s;const l=e+$f,u=Xf(l);return F.document.addEventListener("securitypolicyviolation",c=>{kt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Yf(Kf.concat(a1),()=>{Pa(l,u),F.document.getElementById(Ds(l)).remove();try{d1(u,l,t,n,r,i,o,a)}catch(c){kt(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},m1=e=>{const t=e+$f;if(!!F.document.getElementById(t)&&!!F.videojs){try{if(!F.videojs(t).record().stream)return}catch{return}F.videojs(t).record().stop(),F.videojs(t).record().stopDevice()}},g1=e=>{const t=zi(e+Wf);t==null||t.pause()},v1=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(xu)&&(n=n.replace(xu,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},W={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"},tt={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},Xn="ul-card-video__player_recorder",y1="ul-card-video__skip_button",_1="ul-video-interview-form",Ru="ul-video-btn",b1=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:p,visitorId:f}=ce(k=>({apiURL:k.apiURL,envId:k.envId,handleUploadUpdate:k.handleUploadUpdate,headers:k.headers,responseGroupUid:k.responseGroupUid,surveyId:k.surveyId,viewDocument:k.viewDocument,visitorId:k.userId})),[h,m]=xe(!1),[g,b]=xe(null),[y,_]=xe(null),[v,w]=xe(0),E=u["userleap-platform"],I=r&&r.videoUrl,S=(k,U)=>{k===W.UPLOAD_STARTED?(b(U[W.UPLOAD_ID]),_(U[W.MEDIA_RECORDING_UID]),m(!0)):k===W.DELETE?(b(null),_(null),m(!1)):k===W.UPLOAD_PROGRESS?isNaN(U[W.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:U[W.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:U[W.MEDIA_RECORDING_UID],progressPct:U[W.UPLOAD_PROGRESS_PCT]}):k===W.UPLOAD_FINISHED&&l({mediaRecordingUid:U[W.MEDIA_RECORDING_UID],isComplete:!0})},x=k=>{if(k&&k.children.length===0){const U=p1(Xn,{src:I,type:"application/x-mpegURL"},void 0,r.mediaType===W.MEDIA_TYPE_AUDIO,a,p);k.appendChild(U)}},T=k=>{if(k&&k.children.length===0){const U=h1(Xn,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:f,envId:s},a,S,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===W.MEDIA_TYPE_AUDIO,p);k.appendChild(U)}},A=k=>{k.preventDefault(),k.stopPropagation(),m1(Xn),g&&y?(l({mediaRecordingUid:y,isSubmitted:!0}),n({value:{mediaRecordingUid:y},questionId:i,type:o})):n({value:null,questionId:i,type:o})},L=()=>C(Jt,{defaultBody:()=>C("button",{className:`${Ru} ul-record-response-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),g1(Xn),w(1)}}),properties:r});return C("div",{className:H(mt(N.CardMainContent,E)),style:{marginTop:"unset"},children:C("form",{className:H([e,N.VideoCard,N.FadeInTransition]),id:_1,children:[C(vt,{message:t,properties:r}),C("div",{id:"ul-card-voice__video",children:[C("div",{children:[C("div",{id:"ul-question-player-container",style:{display:v===0?"":"none"},children:[C("div",{id:Xn,ref:x}),L()]}),C("div",{style:{display:v===1?"block":"none"},children:[C("button",{className:`${Ru} ul-back-question-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),w(0)}}),C("div",{id:"ul-recorder-player-container",ref:T})]})]}),C(Ge,{disabled:!h,onClick:A,children:Jn(r)}),C("button",{className:`ul-card-text__button ${N.InactiveButton} ${N.SkipButton}`,id:y1,onClick:A,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:Ls(r)})]})]})})},w1=({className:e})=>{const{headers:t,uploadProgress:n}=ce(a=>({headers:a.headers,uploadProgress:a.uploadProgress}));let r,i;Object.values(n).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",i="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",i="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(n).filter(a=>a.isSubmitted).map(a=>a.progressPct)));return C("div",{className:H(mt(N.CardMainContent,t["userleap-platform"])),children:C("div",{className:H([e,"ul-card--uploading",N.FadeInTransition]),children:[C("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:N.LoadingSpinnerContainer,role:"progressbar",children:C("div",{className:N.LoadingSpinner,children:[C("div",{className:N.LoadingSpinnerFirst}),C("div",{className:N.LoadingSpinnerSecond}),C("div",{className:N.LoadingSpinnerThird}),C("div",{className:N.LoadingSpinnerFourth})]})}),C(vt,{message:`${r} (${o}% complete)`}),C("p",{className:N.Caption,children:i})]})})},Lu=({logoOnly:e=!1,style:t={}})=>C("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&C("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),C("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),C("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),C("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),C("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),C("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),C1=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=ce(_=>({border:_.border,cards:_.cards,forceBrandedLogo:_.forceBrandedLogo,headers:_.headers,index:_.index,marketingUrl:_.marketingUrl,showSurveyBrand:_.showSurveyBrand,slugName:_.slugName,surveyId:_.surveyId,viewedCardCount:_.viewedCardCount})),c=Yt(null),d=t.filter(_=>_.type!==O.Uploading&&_.type!==O.Thanks),p=I_(t,i),f=u+1,h=f/(f+p),m=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Ze(()=>{c.current&&(c.current.style.width=`${h*100}%`)},[h]);const g=()=>C(Je,{children:[d.length>1&&C("div",{id:"ul-progress-bar-container",children:C("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?C("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:C("a",{href:m,rel:"noreferrer",target:"_blank",children:C("div",{style:{display:"flex"},children:[C(Lu,{logoOnly:!1}),n&&C(Ou,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),b=()=>C("a",{href:m,rel:"noreferrer",target:"_blank",children:C("div",{className:"thank-you-card-link",children:[C("div",{className:"sprig-box-logo",children:C(Lu,{logoOnly:!0,style:{margin:"auto"}})}),C("div",{children:C("p",{children:["Capture insights about your own product",C(Ou,{style:{margin:"auto 0 auto 4px",display:"inline-flex"}})]})})]})}),y=t[i].type===O.Thanks;return C("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:y&&n?b():g()})},Ou=({style:e})=>C("svg",{width:"12",height:"10",viewBox:"0 0 12 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,children:[C("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),C("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})]}),E1=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:p,update:f,useMobileStyling:h,viewDocument:m}=ce(k=>({answers:k.answers,border:k.border,cards:k.cards,close:k.close,configureExitOnOverlayClick:k.configureExitOnOverlayClick,destroy:k.destroy,endCard:k.endCard,eventEmitFn:k.eventEmitFn,fontFamily:k.fontFamily,headers:k.headers,index:k.index,next:k.next,showStripes:k.showStripes,update:k.update,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),g=Yt(null),b=Yt(!1),{props:y,type:_,name:v}=n[c],w=n.length;Ze(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!b.current&&s&&(b.current=!0,s(G.SurveyAppeared)))},[s]),Ze(()=>{f()},[c,f]),Ze(()=>{i(()=>r())},[r,i]);const E=()=>r(Nn),I=k=>{k.key==="Enter"&&E()},S=async function(k){d({data:k,completeSurvey:()=>{o(Nn)},endCard:a}),bv(m)};if(e){for(const k of e)if(k.questionId===v){let U;if(_===O.MultipleChoice){const R=y.options.find(({value:V})=>V===k.value);if(!R)break;U={[R.id]:R.value}}else U=k.value;S({value:U,type:_,questionId:k.questionId});break}}const x=()=>[mn.Email,mn.Link].includes(u["userleap-platform"])?!1:!a||c+1!==w,T=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},A=()=>{const k={className:"ul-card",next:S,questionId:v,type:_};switch(_){case O.ConsentLegal:return he(P_,{...k,...y,key:v});case O.Likert:return he(V_,{...k,...y,key:v});case O.MultipleChoice:return he(F_,{...k,...y,key:v});case O.MultipleSelect:return he(B_,{...k,...y,key:v});case O.NPS:return he(j_,{...k,key:v,props:y});case O.Open:return he(H_,{...k,...y,key:v});case O.RecordedTask:return he(X_,{...k,...y,key:v});case O.TextUrlPrompt:return he(n1,{...k,...y,key:v});case O.Thanks:return he(r1,{...k,...y,key:v});case O.Uploading:return he(w1,{...k,...y,key:v});case O.VideoVoice:return he(b1,{...k,...y,key:v});default:return null}},L=k=>{var K;const U=window.sprigAPI,R=k.target;if(!U||!R)return;const V=[R,R.parentElement];for(const z of V)if(((K=z==null?void 0:z.tagName)==null?void 0:K.toLowerCase())==="a"){k.preventDefault(),U==null||U.openUrl(z.href);return}};return C("div",{className:H("ul-app",Dn(u)?"ul-app--visible":"ul-app--overlay"),id:Nn,onClick:L,ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:C("div",{className:"ul-app__container",children:[C("div",{className:H(_e(N.CardContainer,h)),style:T(),children:[p&&C("div",{className:"ul-header__container",children:C("div",{className:"ul-header",children:"For development purposes only"})}),A(),C(C1,{})]}),x()&&C("div",{className:H(_e(N.CloseContainer,h)),children:C("div",{"aria-label":"Close button",className:N.CloseButton,onClick:E,onKeyPress:I,role:"button",tabIndex:0,children:C("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:C("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"})})})})]})})},S1=`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;justify-content:center}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%;margin-bottom:8px}.ul-footer>.yellow-footer-logo{background:#FAD133;border:1px solid #F9C600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#F9C600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #E6E6E6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;margin-bottom:15px;padding:12px;text-align:left}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;margin-right:8px;padding:4px}.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}
738
- `,I1=(e,t)=>{const n=[...e],r=new Set([O.VideoVoice,O.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:O.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:O.Thanks}),n},k1=({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 x1(e,t=!0){var w;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,p=Dn(e.headers)?e.frame:c.body,f=e.UpChunk||window.UpChunk,h=Z,m=I1(e.cards,!!o);pi.configure(h,{cards:m,hasEndCard:!!o,apiURL:r,UpChunk:f}),ce.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:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:k1({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:pi,recorderEventEmitter:h,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}=ce.getState();g();const{head:b}=c,y=c.createElement("style");if(y.id="sprig-style",y.textContent=S1,y.nonce=e.styleNonce,b.appendChild(y),e.fontFamily&&s&&parent){const E=c.createElement("link");E.rel="stylesheet",E.href=s,b.appendChild(E)}if(e.customStyles&&jc(c,i,e.styleNonce),!f)if(e.installationMethod!==Tt.Npm){const E=c.createElement("script");E.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",E.onload=()=>{pi.setUpChunk(d.UpChunk)},E.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},b.appendChild(E)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const _=__SDK_VERSION__,v=a||((w=l.eventEmitter)==null?void 0:w.emit);v==null||v(Qe.VerifyViewVersion,{[ln.ViewVersion]:_}),p&&t&&Gn(C(E1,{}),p)}const A1={configure:x1};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 T1="rgba(255,255,255, 0.95)",R1="rgba(0,0,0,0.9)",L1="360px",Ho="0px",ep=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},tp=e=>{P1();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,je("trackStartUrl",null),Z.emit(G.SurveyLifeCycle,{state:"dismissed"}),Z.emit(G.SurveyClosed,{name:G.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)}},np=()=>{Z.on(G.SurveyWillClose,({initiator:e})=>{tp(e)})},O1=(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}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?T1:R1,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},N1=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:Ho,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.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(i.overlayStyleMobile)&&(a=!0)):(r.width=L1,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===nr.BottomLeft?o={left:Ho}:i.framePosition===nr.TopLeft?o={left:Ho,top:"0px"}:i.framePosition===nr.TopRight?o={top:"0px"}:i.framePosition===nr.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&O1(i,n),Object.assign(e.style,r,o),a},D1=(e,t)=>{var s,l;const n="ul-frame";ep(),U1();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=N1(r,e,t);np(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,Z.emit(G.SurveyHeight,{name:G.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{Z.emit(G.CloseSurveyOnOverlayClick)}),Z.emit(G.SurveyLifeCycle,{state:"presented"}),Z.emit(G.SurveyPresented,{name:G.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},rp={[G.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},U1=()=>{Object.entries(rp).forEach(([e,t])=>{Z.on(e,t)})},P1=()=>{Object.entries(rp).forEach(([e,t])=>{Z.off(e,t)})},M1="!launch_darkly_";class V1{constructor(){Ae(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=>{var r;return this._ldData[`${M1}${n}`]=((r=t[n])!=null?r:0)+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 Ma=new V1;Object.freeze(Ma);const F1="!optimizely_experiments_";class B1{constructor(){Ae(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(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return F1+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(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,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 gi=new B1;Object.freeze(gi);class j1{constructor(t,n){Ae(this,"paused");Ae(this,"queue");Ae(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],i=this.ul[r];i instanceof Function?i.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(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var qe=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(qe||{}),ip=(e=>(e.Preview="sprigPreviewKey",e))(ip||{});const H1=["popState","pushState","replaceState"],z1={test:"test"},er="!email",G1=["ios","android"],dn="environments",Va="pageUrl",tn="visitors",Nu="ul-view-sdk-script",Du=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 Us(e,t){const{matchType:n,pattern:r}=e,i=n?Du[n]:Du.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function K1(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?Us(a,window.location.href):t===window.location.href}function kr(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==mn.Web)return;const o=nn("trackStartUrl"),a=o?String(o):null;t&&up(window.location.href),n&&(ap(),W1()),r&&a&&a!==window.location.href&&e&&H1.includes(e.type)&&window.UserLeap("dismissActiveSurvey",dt.PageChange)}const op={capture:!0},W1=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Us(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Bn(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Bn(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,op)},ap=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,op),delete window.UserLeap._config.interactiveEventsHandler};function q1(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,kr,!0))}function $1(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,kr,!0)),window.UserLeap._config.interactiveEvents&&ap()}function Ct(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===dn?r.push(window.UserLeap.envId):i===tn&&r.push(Ps())}),n&&r.push(n),r.join("/")}function Y1(e,t){let n=Ct("1",[dn],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function sp(){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 nn(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(He.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 je(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(He.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(He.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function lp(){window.previewMode||(window.UserLeap.visitorId=Kt(),je("vid",window.UserLeap.visitorId),Z.emit(G.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Ps(){return window.previewMode?"0":window.UserLeap.visitorId||""}function up(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;if(r&&r.length){let u=!1;for(let c=0;c<r.length&&(u=Us(r[c],e),!u);c++);if(!u)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const i=10,o=1;let a=[];const s={viewedAt:Date.now(),location:e},l=localStorage.getItem(He.PageViews);try{if(a=l?JSON.parse(l):[],Array.isArray(a)||(a=[]),a.length>0){const u=a[a.length-1],c=(Date.now()-u.viewedAt)/1e3;u.location!=e&&c>o&&Kl({url:e}),(u.location!=e&&c>o||c>i)&&(window.UserLeap._queue.push(["track",Va,t,{url:e},n]),a.push(s))}else window.UserLeap._queue.push(["track",Va,t,{url:e},n]),a.push(s),Kl({url:e});a.length>5&&a.splice(0,a.length-5);try{localStorage.setItem(He.PageViews,JSON.stringify(a))}catch(u){u instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${u.message}`)}}catch(u){u instanceof Error&&window.UserLeap.reportError("trackPageView",u,{pageViewsStorage:l}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Z1(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),kr(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),kr(o),i})(e.replaceState)),q1()}async function zo(e,t){const n=Ps();e&&!t&&(window.UserLeap._config.mode=z1.test);const r=await jt(Y1(n,e),{},0,!0);return r.ok?(r.json.delay&&await Ai(r.json.delay),cp(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:qe.NoSurvey})}const Q1=e=>e.some(t=>t.type===O.VideoVoice),cp=async e=>{var L,k,U,R,V,K;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,p=Or(window.UserLeap),f=Ms(p),h=J1(p);if(d&&Dd({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:p,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:qe.NoSurvey};if(((k=(L=window.UserLeap)==null?void 0:L._config)==null?void 0:k.installationMethod)===Tt.NpmBundled&&Q1(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:qe.NoSurvey};if(window.UserLeap.container){const z="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(z),{success:!1,message:z,surveyState:qe.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const z="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(z)),{success:!1,message:z,surveyState:qe.NoSurvey}}B0({id:l}),Xo.disable(),Z.emit(G.SurveyWillPresent,{name:G.SurveyWillPresent,[Cc.SurveyId]:l});let m,g=document.createElement("div"),b,y,_;const v=z=>{const{[ln.ViewVersion]:ie}=z;ie!==p["x-ul-sdk-version"]&&tp(),Z.removeListener(Qe.VerifyViewVersion,v)};Z.on(Qe.VerifyViewVersion,v),Dn(p)?(m="ul-direct-embeded-frame",b=document.head,y=window,_=!1,f&&(ep(),g.id=m,window.UserLeap.container.appendChild(g),np(),Z.emit(G.SurveyLifeCycle,{state:"presented"}),Z.emit(G.SurveyPresented,{name:G.SurveyPresented}))):{frameId:m,contentWinDocHead:b,contentWindow:y,hasOverlay:_,iframe:g}=D1(o,h),window.UserLeap.frameId=m,window.UserLeap.useMobileStyling=h;const w=z=>{Z.on(G.CloseSurveyOnOverlayClick,z)},E=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:p,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:w,eventEmitFn:Z.emit.bind(Z),ulEvents:Ga,viewDocument:y==null?void 0:y.document,viewWindow:y,tabTitle:document.title,startingQuestionIdx:(U=window.UserLeap.config)==null?void 0:U.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(R=window.UserLeap)!=null&&R.localStorageAvailable?(V=window.localStorage)==null?void 0:V.getItem(He.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(K=window.UserLeap.config)!=null&&K.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(E.customStyles=window.UserLeap.customStyles),y&&(y.__cfg=E);function I(){const z=document.createElement("script");return window.UserLeap.nonce&&z.setAttribute("nonce",window.UserLeap.nonce),z.id=Nu,z}const S=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:E.path,x=document.getElementById(Nu);x&&x.remove();const T=I(),A=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return E.installationMethod===Tt.Npm||E.installationMethod===Tt.NpmBundled?(A1.configure(E),_&&window.UserLeap.container&&A()):S&&(T.src=S,_&&T.addEventListener("load",()=>{window.UserLeap.container&&A()}),y==null||y.addEventListener("error",z=>{z.target instanceof HTMLScriptElement&&z.target.src===S&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),b==null||b.appendChild(T),{success:!0,surveyState:qe.Ready,surveyId:l,responseGroupUid:s}};function J1(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Ms(e)||t>10&&t<pv}function Ms(e){return G1.includes(e[ct.Platform])}function X1(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 eb(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&X1(t),(t||n||r)&&(Z1(),kr())}async function jt(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Or(window.UserLeap),t.headers);const i=await Rt(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(ct.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(je("token",u),je("vid",c),Z.emit(G.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function tb(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Ai(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const nb=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var m,g,b,y,_;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==Va&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(m=localStorage.getItem(He.Preview))!=null?m:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const v="[Sprig] - Skipping tracking without userId";return console.warn(v),{success:!1,message:v,surveyState:qe.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const v="[Sprig] - Invalid event name "+u;return console.warn(v),{success:!1,message:v,surveyState:qe.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),je("trackStartUrl",d),(b=(g=window.UserLeap)==null?void 0:g._config)!=null&&b.optimizelyEnabled){const v=Or(window.UserLeap);Ms(v)||gi.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},gi.getAllOptimizelyExperiments())}(_=(y=window.UserLeap)==null?void 0:y._config)!=null&&_.launchDarklyEnabled&&(a.launchDarklyFlags=Ma.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),F0({name:u});const p=window.UserLeap.delayingSurvey?await jt(Ct("1",[tn],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await jt(Ct("1",[tn],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!p.ok){const v="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(v,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:v,error:p.error,surveyState:qe.NoSurvey}}i&&je("uid",i),o&&je("aid",o);const f=p.json;return f.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(He.Preview),await tb(p,l)?K1(f.eventId,d)?cp(f):{success:!1,message:"Study should not be displayed after page navigation",surveyState:qe.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:qe.NoSurvey}},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",dt.Override),zo({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",dt.Override),zo({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",dt.Override),zo({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=dt.API){Z.emit(G.SurveyWillClose,{name:G.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}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 u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,er)&&(a[er]=a.email,delete a.email),l=await jt(Ct("1",[dn,tn],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await jt(Ct("1",[dn,tn]),{body:JSON.stringify(s),method:"PUT"}),a&&a[er]&&(window.UserLeap.email=a[er]),l.ok&&(i&&je("uid",i),o&&je("aid",o)),{success:!!l.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 o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await jt(Ct("1",[dn,tn],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){Z.on(G.SurveyLifeCycle,r)},async removeSurveyListener(r){Z.removeListener(G.SurveyLifeCycle,r)},async addListener(r,i){Z.on(r,i)},async removeListener(r,i){Z.removeListener(r,i)},async removeAllListeners(){Z.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=sp();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(He.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await jt(Ct("1",[dn,tn]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&Gl(),je("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,je("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){up(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(N.CustomStyle);o?o.textContent=r:jc(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(Hc(s.contentDocument))+"px")),Z.emit(G.SurveyDimensions,{name:G.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.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(He.Credentials),localStorage.removeItem(He.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),lp(),Gl(),window.UserLeap._queue.unpause()},teardown(){$1(),window.UserLeap("dismissActiveSurvey",dt.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;gi.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(sv.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}Ma.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(er,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return ob(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await Zc({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function rb(e){const t=Or(window.UserLeap);document.addEventListener("securitypolicyviolation",ea);let n=await Rt(Ct("1",[dn],"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)):document.removeEventListener("securitypolicyviolation",ea),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),ta("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(ta(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function ib(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=Ps(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await jt(Ct("1",null,"errors"),{method:"POST",headers:{[ct.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function ob(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function ab(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(ip.Preview))!=null?i:"",n=sp();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=Ga,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=ib,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 u in window.UserLeap._config)window.UserLeap[u]=window.UserLeap._config[u];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 u=nn("sampled");if(u===null&&(u=Math.random()<o,je("sampled",u)),!u)return}else n&&nn("sampled")!==null&&je("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new j1(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=nn("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=nn("vid"),window.UserLeap.userId=nn("uid"),window.UserLeap.partnerAnonymousId=nn("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(He.Credentials),lp());const l=await rb(e);k0(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),nb(l),await eb(l),window.UserLeap._queue.unpause(),Z.emit(G.SDKReady),Z.emit(G.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Gi{constructor(){Ae(this,"UPDATES",Ga)}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)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const Fa={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="web-npm-bundled",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Gi.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Gi.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,ab(e),window.Sprig}};Fa.configure;window.UpChunk={createUpload:Qp};window.rrwebRecord=Rr;exports.DismissReason=dt;exports.SprigAPI=Gi;exports.SprigEvent=G;exports.sprig=Fa;
721
+ `,p1=e=>{const t=F.document.createElement("div");return t.className="ul-video-player-loading",t.id=Ls(e),["first","second","third","fourth"].map(n=>{const r=F.document.createElement("div");r.className=n,t.appendChild(r)}),t},Ls=e=>e+"-loading-spiner",Ee="hidden",_u=".m3u8",Uo="questionId",Po="ul-video-recorder-camera-off-button",Mo="ul-recording-in-session",h1=[{type:"link",content:`${an}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${an}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${an}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${an}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${an}/userleap-web-upchunk-v2.2.2.js`}],Bf=[{type:"link",content:`${an}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${an}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:f1}],jf="-video-player",Hf="-secondary-video-player",zf="-video-recorder";let ut,bu;const Ht=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=F.document.documentElement;if(!r||!i)return;const s={event:`SDK - ${e}`,visitorId:r,environmentId:i,metadata:{...o||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.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(s)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},kt=async(e,t,n,r,i,o)=>{Ht({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:i,envId:o,metadata:{errorMessage:e.message}});const a=F.document.documentElement,s={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:s,vid:i,envId:o};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},m1=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=F.document.createElement("script"),o.src=n):t==="link"?(o=F.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=F.document.createElement("style"),o.innerHTML=n),o.onload=function(){r(n)},o.onerror=function(){i(n)},o.async=!1,o.id=btoa(n),e.appendChild(o)}),Gf=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(m1(F.document.head,r)),n),[])).then(()=>{F.videojs=F.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},wu=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=Ee;else if(t==="success")e.style.visibility=Ee,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%)`}},Fo=(e,t)=>{const n=F.videojs(e.id());return n==null?void 0:n.payload[t]},g1=(e,t,n,r,i)=>{const{surveyId:o,responseGroupUid:a,visitorId:s,envId:l}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(K.ERROR,{type:K.PERMISSION_DENIED}),Ht({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Fo(e,Uo),responseGroupUid:a,surveyId:o}})):(n&&n(K.ERROR,{type:K.OTHER}),kt(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){kt(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),Ht({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Fo(e,Uo),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=Fo(e,Uo);if(!o){const m="internal error: missing fields in payload";return n&&n(K.ERROR,{type:K.OTHER}),kt(new Error(m),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?K.MEDIA_TYPE_AUDIO:K.MEDIA_TYPE_VIDEO,d=Kt();Ht({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const p={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(p.questionId=u),a&&(p.responseGroupUid=a),s&&(p.visitorId=s);const h=await(async()=>{const m=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(m.ok){const g=await m.json();return n&&n(K.UPLOAD_STARTED,{[K.UPLOAD_ID]:g.upload.id,[K.MEDIA_TYPE]:c,[K.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(K.ERROR,{type:K.OTHER,response:m}),kt(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(ut=F.document.defaultView.UpChunk.createUpload({endpoint:h,file:new F.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),ut.startTime=Date.now(),Ht({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),ut.on("error",m=>{r(e.uploadProgressLabel,"none"),n&&n(K.UPLOAD_FINISHED,{[K.MEDIA_RECORDING_UID]:d}),kt(m,"finishRecord",t,i,s,l)}),ut.on("progress",m=>{n&&n(K.UPLOAD_PROGRESS,{[K.MEDIA_RECORDING_UID]:d,[K.UPLOAD_PROGRESS_PCT]:m.detail}),r(e.uploadProgressLabel,"progress",m.detail)}),ut.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(K.UPLOAD_FINISHED,{[K.MEDIA_RECORDING_UID]:d}),Ht({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:ut.startTime&&Date.now()-ut.startTime}})}))})},Kf=(e,t)=>{const n=new(F.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),v1(n),n},v1=e=>{e.children().forEach(t=>{if(tt[t.name_]){const n=gi(tt[t.name_],`ul-${tt[t.name_]}`);t.el_.appendChild(n)}})},gi=(e,t="")=>{const n=F.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},Wf=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(F.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(F.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?S1(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&b1(e,!1),o==null||o.play()}),e.on("pause",()=>{o==null||o.pause()}),e.on("seeked",()=>{o==null||o.currentTime(e.currentTime())}),e.on("ratechange",()=>{o==null||o.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),a.addChild(t),e.addChild(a),r&&r(e)},y1=(e,t,n)=>{e.addClass(`ul${Hf}`);const r=new(F.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},_1=(e,t,n,r,i,o,a,s=!1)=>{bu=Date.now();const u=Gi(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(!u)return;u.payload=n;const{surveyId:c,questionId:d,responseGroupUid:p,visitorId:f,envId:h}=n;let m;const g=A=>{const O=Po,k=Po+"-audio-only";wu(u.uploadProgressLabel,"none"),ut&&ut.startTime>=bu&&ut.abort();const U=F.document.getElementById("ul-camera-button");A?(u.children()[0].classList.add("vjs-hidden"),y.removeClass(O),y.addClass(k),U.innerHTML=tt.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),m==null||m.getTracks().forEach(T=>{T.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(T=>{m=T,T.getVideoTracks().forEach(B=>{B.enabled=!1}),u.record().onDeviceReady(T)}).catch(u.record().onDeviceError.bind(u.record()))):(m==null||m.getVideoTracks().forEach(T=>{T.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),y.removeClass(k),y.addClass(O),U.innerHTML=tt.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},b=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{b.hasClass(Ee)||(Ht({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:f,envId:h,metadata:{questionId:d,responseGroupUid:p,surveyId:c}}),g(u.cameraOff),i(K.DELETE,{}),y.removeClass(Ee),b.addClass(Ee))}});b.addClass("ul-video-recorder-delete-button"),b.el_.appendChild(gi(tt.DeleteButton,"ul-delete-button"));const v=F.document.getElementById(t),_=()=>{v.classList.contains("vjs-fullscreen")&&u.cameraOff?v.style.display="table":v.style.display="flex"};_();const y=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,Ht({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:p,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!b.hasClass(Ee)&&b.addClass(Ee),i(K.DELETE,{}),_())}});y.addClass(Po),y.el_.appendChild(gi(tt.TurnOffCamera,"ul-camera-button"));const C=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{const A=F.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),A&&(A.innerHTML=tt.RecordButton),C.removeClass(Mo),b.removeClass(Ee);else{const O=F.document.getElementById("ul-recording-countdown-screen");if(O)O.remove(),A&&(A.innerHTML=tt.RecordButton),g(u.cameraOff),i(K.DELETE,{}),y.removeClass(Ee),b.addClass(Ee),C.removeClass(Mo),I.show();else{C.addClass(Mo),I.hide(),y.addClass(Ee),b.addClass(Ee),A&&(A.innerHTML=tt.StopButton);const k=F.document.createElement("div");k.id="ul-recording-countdown-screen",v.insertBefore(k,v.children[1]),k.style.height=`${v.offsetHeight}px`,$f(u,3)}}}});C.addClass("ul-video-recorder-toggle-button"),C.el_.appendChild(gi(tt.RecordButton,"ul-recorder-toggle"));const E=F.document.createElement("p");E.style.visibility="hidden",E.className="ul-upload-progress-label",e.appendChild(E),u.uploadProgressLabel=E;const S=Kf(u,[b,y,"PlayToggle",C,"FullscreenToggle"]),I=S.children().find(A=>A.name_==="FullscreenToggle");I.hasClass("vjs-disabled")&&I.hide();const x=S.children().find(A=>A.name_==="PlayToggle");x.hide(),o&&y.addClass(Ee),!o&&b.addClass(Ee),Wf(u,S,o,!1,s),u.on("stopRecord",()=>{C.hide(),x.show(),I.show(),b.removeClass(Ee)}),u.on("deviceReady",()=>{C.show(),x.hide(),b.addClass(Ee)}),g1(u,r,i,wu,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),x.show(),C.hide(),b.removeClass(Ee));const R=[{name:"microphone"}];!u.cameraOff&&R.push({name:"camera"}),Promise.all(R.map(A=>{var O;return(O=navigator==null?void 0:navigator.permissions)==null?void 0:O.query(A)})).then(A=>{A.reduce((k,U)=>k&U.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(A=>{})},$f=(e,t=3)=>{const n=F.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(()=>{$f(e,t-1)},1e3))},qf=e=>{const t=F.document.createElement("div");return t.className="ul-video-container",t.appendChild(p1(e)),t},Na=(e,t)=>{const n=F.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=F.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=F.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),n.appendChild(r),t.appendChild(n),t},b1=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Gi=(e,t)=>F.document.getElementById(e)?t?F.videojs(e,t):F.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),w1=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{F.document=o;const l=e+jf,u=qf(l);return F.document.addEventListener("securitypolicyviolation",c=>{kt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Gf(Bf,()=>{F.document.getElementById(Ls(l)).remove(),Na(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+Hf;Na(d,u);const p=Gi(l,c),f=Gi(d,{muted:!0,...c});if(!p||!f)return;y1(f,a,s),a||f.addClass(Ee);const h=Kf(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),m=h.children().find(g=>g.name_==="FullscreenToggle");m.hasClass("vjs-disabled")&&m.hide(),Wf(p,h,t,n,r,f)}catch(d){kt(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},C1=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{F.document=s;const l=e+zf,u=qf(l);return F.document.addEventListener("securitypolicyviolation",c=>{kt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Gf(Bf.concat(h1),()=>{Na(l,u),F.document.getElementById(Ls(l)).remove();try{_1(u,l,t,n,r,i,o,a)}catch(c){kt(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},E1=e=>{const t=e+zf;if(!!F.document.getElementById(t)&&!!F.videojs){try{if(!F.videojs(t).record().stream)return}catch{return}F.videojs(t).record().stop(),F.videojs(t).record().stopDevice()}},I1=e=>{const t=Gi(e+jf);t==null||t.pause()},S1=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(_u)&&(n=n.replace(_u,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},K={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"},tt={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},er="ul-card-video__player_recorder",k1="ul-card-video__skip_button",x1="ul-video-interview-form",Cu="ul-video-btn",A1=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:p,visitorId:f}=ce(k=>({apiURL:k.apiURL,envId:k.envId,handleUploadUpdate:k.handleUploadUpdate,headers:k.headers,responseGroupUid:k.responseGroupUid,surveyId:k.surveyId,viewDocument:k.viewDocument,visitorId:k.userId})),[h,m]=xe(!1),[g,b]=xe(null),[v,_]=xe(null),[y,C]=xe(0),E=u["userleap-platform"],S=r&&r.videoUrl,I=(k,U)=>{k===K.UPLOAD_STARTED?(b(U[K.UPLOAD_ID]),_(U[K.MEDIA_RECORDING_UID]),m(!0)):k===K.DELETE?(b(null),_(null),m(!1)):k===K.UPLOAD_PROGRESS?isNaN(U[K.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:U[K.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:U[K.MEDIA_RECORDING_UID],progressPct:U[K.UPLOAD_PROGRESS_PCT]}):k===K.UPLOAD_FINISHED&&l({mediaRecordingUid:U[K.MEDIA_RECORDING_UID],isComplete:!0})},x=k=>{if(k&&k.children.length===0){const U=w1(er,{src:S,type:"application/x-mpegURL"},void 0,r.mediaType===K.MEDIA_TYPE_AUDIO,a,p);k.appendChild(U)}},R=k=>{if(k&&k.children.length===0){const U=C1(er,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:f,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===K.MEDIA_TYPE_AUDIO,p);k.appendChild(U)}},A=k=>{k.preventDefault(),k.stopPropagation(),E1(er),g&&v?(l({mediaRecordingUid:v,isSubmitted:!0}),n({value:{mediaRecordingUid:v},questionId:i,type:o})):n({value:null,questionId:i,type:o})},O=()=>w(Jt,{defaultBody:()=>w("button",{className:`${Cu} ul-record-response-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),I1(er),C(1)}}),properties:r});return w("div",{className:H(mt(N.CardMainContent,E)),style:{marginTop:"unset"},children:w("form",{className:H([e,N.VideoCard,N.FadeInTransition]),id:x1,children:[w(vt,{message:t,properties:r}),w("div",{id:"ul-card-voice__video",children:[w("div",{children:[w("div",{id:"ul-question-player-container",style:{display:y===0?"":"none"},children:[w("div",{id:er,ref:x}),O()]}),w("div",{style:{display:y===1?"block":"none"},children:[w("button",{className:`${Cu} ul-back-question-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),C(0)}}),w("div",{id:"ul-recorder-player-container",ref:R})]})]}),w(Ge,{disabled:!h,onClick:A,children:Xn(r)}),w("button",{className:`ul-card-text__button ${N.InactiveButton} ${N.SkipButton}`,id:k1,onClick:A,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:As(r)})]})]})})},T1=({className:e})=>{const{headers:t,uploadProgress:n}=ce(a=>({headers:a.headers,uploadProgress:a.uploadProgress}));let r,i;Object.values(n).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",i="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",i="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(n).filter(a=>a.isSubmitted).map(a=>a.progressPct)));return w("div",{className:H(mt(N.CardMainContent,t["userleap-platform"])),children:w("div",{className:H([e,"ul-card--uploading",N.FadeInTransition]),children:[w("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:N.LoadingSpinnerContainer,role:"progressbar",children:w("div",{className:N.LoadingSpinner,children:[w("div",{className:N.LoadingSpinnerFirst}),w("div",{className:N.LoadingSpinnerSecond}),w("div",{className:N.LoadingSpinnerThird}),w("div",{className:N.LoadingSpinnerFourth})]})}),w(vt,{message:`${r} (${o}% complete)`}),w("p",{className:N.Caption,children:i})]})})},Eu=({logoOnly:e=!1,style:t={}})=>w("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&w("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),w("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),w("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),w("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),w("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),w("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),R1=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=ce(_=>({border:_.border,cards:_.cards,forceBrandedLogo:_.forceBrandedLogo,headers:_.headers,index:_.index,marketingUrl:_.marketingUrl,showSurveyBrand:_.showSurveyBrand,slugName:_.slugName,surveyId:_.surveyId,viewedCardCount:_.viewedCardCount})),c=Yt(null),d=t.filter(_=>_.type!==L.Uploading&&_.type!==L.Thanks),p=N_(t,i),f=u+1,h=f/(f+p),m=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Ze(()=>{c.current&&(c.current.style.width=`${h*100}%`)},[h]);const g=()=>w(Je,{children:[d.length>1&&w("div",{id:"ul-progress-bar-container",children:w("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?w("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:w("a",{href:m,rel:"noreferrer",target:"_blank",children:w("div",{style:{display:"flex"},children:[w(Eu,{logoOnly:!1}),n&&w(Iu,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),b=()=>w("a",{href:m,rel:"noreferrer",target:"_blank",children:w("div",{className:"thank-you-card-link",children:[w("div",{className:"sprig-box-logo",children:w(Eu,{logoOnly:!0,style:{margin:"auto"}})}),w("div",{children:w("p",{children:["Capture insights about your own product",w(Iu,{style:{margin:"auto 0 auto 4px",display:"inline-flex"}})]})})]})}),v=t[i].type===L.Thanks;return w("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:v&&n?b():g()})},Iu=({style:e})=>w("svg",{width:"12",height:"10",viewBox:"0 0 12 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,children:[w("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),w("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})]}),L1=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:p,update:f,useMobileStyling:h,viewDocument:m}=ce(k=>({answers:k.answers,border:k.border,cards:k.cards,close:k.close,configureExitOnOverlayClick:k.configureExitOnOverlayClick,destroy:k.destroy,endCard:k.endCard,eventEmitFn:k.eventEmitFn,fontFamily:k.fontFamily,headers:k.headers,index:k.index,next:k.next,showStripes:k.showStripes,update:k.update,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),g=Yt(null),b=Yt(!1),{props:v,type:_,name:y}=n[c],C=n.length;Ze(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!b.current&&s&&(b.current=!0,s(G.SurveyAppeared)))},[s]),Ze(()=>{f()},[c,f]),Ze(()=>{i(()=>r())},[r,i]);const E=()=>r(Nn),S=k=>{k.key==="Enter"&&E()},I=async function(k){d({data:k,completeSurvey:()=>{o(Nn)},endCard:a}),mv(m)};if(e){for(const k of e)if(k.questionId===y){let U;if(_===L.MultipleChoice){const T=v.options.find(({value:B})=>B===k.value);if(!T)break;U={[T.id]:T.value}}else U=k.value;I({value:U,type:_,questionId:k.questionId});break}}const x=()=>[mn.Email,mn.Link].includes(u["userleap-platform"])?!1:!a||c+1!==C,R=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},A=()=>{const k={className:"ul-card",next:I,questionId:y,type:_};switch(_){case L.ConsentLegal:return he(G_,{...k,...v,key:y});case L.Likert:return he(W_,{...k,...v,key:y});case L.MultipleChoice:return he($_,{...k,...v,key:y});case L.MultipleSelect:return he(q_,{...k,...v,key:y});case L.NPS:return he(Y_,{...k,key:y,props:v});case L.Open:return he(Z_,{...k,...v,key:y});case L.RecordedTask:return he(s1,{...k,...v,key:y});case L.TextUrlPrompt:return he(c1,{...k,...v,key:y});case L.Thanks:return he(d1,{...k,...v,key:y});case L.Uploading:return he(T1,{...k,...v,key:y});case L.VideoVoice:return he(A1,{...k,...v,key:y});default:return null}},O=k=>{var Z;const U=window.sprigAPI,T=k.target;if(!U||!T)return;const B=[T,T.parentElement];for(const z of B)if(((Z=z==null?void 0:z.tagName)==null?void 0:Z.toLowerCase())==="a"){k.preventDefault(),U==null||U.openUrl(z.href);return}};return w("div",{className:H("ul-app",Dn(u)?"ul-app--visible":"ul-app--overlay"),id:Nn,onClick:O,ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:w("div",{className:"ul-app__container",children:[w("div",{className:H(_e(N.CardContainer,h)),style:R(),children:[p&&w("div",{className:"ul-header__container",children:w("div",{className:"ul-header",children:"For development purposes only"})}),A(),w(R1,{})]}),x()&&w("div",{className:H(_e(N.CloseContainer,h)),children:w("div",{"aria-label":"Close button",className:N.CloseButton,onClick:E,onKeyPress:S,role:"button",tabIndex:0,children:w("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:w("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"})})})})]})})},O1=`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;justify-content:center}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%;margin-bottom:8px}.ul-footer>.yellow-footer-logo{background:#FAD133;border:1px solid #F9C600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#F9C600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #E6E6E6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;margin-bottom:15px;padding:12px;text-align:left}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;margin-right:8px;padding:4px}.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}
722
+ `,N1=(e,t)=>{const n=[...e],r=new Set([L.VideoVoice,L.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:L.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:L.Thanks}),n},D1=({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 U1(e,t=!0){var C;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,p=Dn(e.headers)?e.frame:c.body,f=e.UpChunk||window.UpChunk,h=Y,m=N1(e.cards,!!o);hi.configure(h,{cards:m,hasEndCard:!!o,apiURL:r,UpChunk:f}),ce.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:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:D1({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:hi,recorderEventEmitter:h,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}=ce.getState();g();const{head:b}=c,v=c.createElement("style");if(v.id="sprig-style",v.textContent=O1,v.nonce=e.styleNonce,b.appendChild(v),e.fontFamily&&s&&parent){const E=c.createElement("link");E.rel="stylesheet",E.href=s,b.appendChild(E)}if(e.customStyles&&Nc(c,i,e.styleNonce),!f)if(e.installationMethod!==Tt.Npm){const E=c.createElement("script");E.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",E.onload=()=>{hi.setUpChunk(d.UpChunk)},E.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},b.appendChild(E)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const _="2.24.7",y=a||((C=l.eventEmitter)==null?void 0:C.emit);y==null||y(Qe.VerifyViewVersion,{[ln.ViewVersion]:_}),p&&t&&Gn(w(L1,{}),p)}const P1={configure:U1};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 M1="rgba(255,255,255, 0.95)",F1="rgba(0,0,0,0.9)",V1="360px",Vo="0px",Yf=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},Zf=e=>{G1();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,je("trackStartUrl",null),Y.emit(G.SurveyLifeCycle,{state:"dismissed"}),Y.emit(G.SurveyClosed,{name:G.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)}},Qf=()=>{Y.on(G.SurveyWillClose,({initiator:e})=>{Zf(e)})},B1=(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}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?M1:F1,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},j1=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:Vo,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.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(i.overlayStyleMobile)&&(a=!0)):(r.width=V1,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===rr.BottomLeft?o={left:Vo}:i.framePosition===rr.TopLeft?o={left:Vo,top:"0px"}:i.framePosition===rr.TopRight?o={top:"0px"}:i.framePosition===rr.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&B1(i,n),Object.assign(e.style,r,o),a},H1=(e,t)=>{var s,l;const n="ul-frame";Yf(),z1();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=j1(r,e,t);Qf(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,Y.emit(G.SurveyHeight,{name:G.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{Y.emit(G.CloseSurveyOnOverlayClick)}),Y.emit(G.SurveyLifeCycle,{state:"presented"}),Y.emit(G.SurveyPresented,{name:G.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},Jf={[G.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},z1=()=>{Object.entries(Jf).forEach(([e,t])=>{Y.on(e,t)})},G1=()=>{Object.entries(Jf).forEach(([e,t])=>{Y.off(e,t)})},K1="!launch_darkly_";class W1{constructor(){Ae(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=>{var r;return this._ldData[`${K1}${n}`]=((r=t[n])!=null?r:0)+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 Da=new W1;Object.freeze(Da);const $1="!optimizely_experiments_";class q1{constructor(){Ae(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(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return $1+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(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,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 vi=new q1;Object.freeze(vi);class Y1{constructor(t,n){Ae(this,"paused");Ae(this,"queue");Ae(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],i=this.ul[r];i instanceof Function?i.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(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var $e=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))($e||{}),Xf=(e=>(e.Preview="sprigPreviewKey",e))(Xf||{});const Z1=["popState","pushState","replaceState"],Q1={test:"test"},tr="!email",J1=["ios","android"],dn="environments",Ua="pageUrl",tn="visitors",Su="ul-view-sdk-script",ku=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 Os(e,t){const{matchType:n,pattern:r}=e,i=n?ku[n]:ku.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function X1(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?Os(a,window.location.href):t===window.location.href}function xr(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==mn.Web)return;const o=nn("trackStartUrl"),a=o?String(o):null;t&&ip(window.location.href),n&&(tp(),eb()),r&&a&&a!==window.location.href&&e&&Z1.includes(e.type)&&window.UserLeap("dismissActiveSurvey",dt.PageChange)}const ep={capture:!0},eb=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Os(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Bn(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Bn(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,ep)},tp=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ep),delete window.UserLeap._config.interactiveEventsHandler};function tb(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,xr,!0))}function nb(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,xr,!0)),window.UserLeap._config.interactiveEvents&&tp()}function Ct(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===dn?r.push(window.UserLeap.envId):i===tn&&r.push(Ns())}),n&&r.push(n),r.join("/")}function rb(e,t){let n=Ct("1",[dn],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function np(){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 nn(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(He.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 je(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(He.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(He.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function rp(){window.previewMode||(window.UserLeap.visitorId=Kt(),je("vid",window.UserLeap.visitorId),Y.emit(G.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Ns(){return window.previewMode?"0":window.UserLeap.visitorId||""}function ip(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;if(r&&r.length){let u=!1;for(let c=0;c<r.length&&(u=Os(r[c],e),!u);c++);if(!u)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const i=10,o=1;let a=[];const s={viewedAt:Date.now(),location:e},l=localStorage.getItem(He.PageViews);try{if(a=l?JSON.parse(l):[],Array.isArray(a)||(a=[]),a.length>0){const u=a[a.length-1],c=(Date.now()-u.viewedAt)/1e3;u.location!=e&&c>o&&Hl({url:e}),(u.location!=e&&c>o||c>i)&&(window.UserLeap._queue.push(["track",Ua,t,{url:e},n]),a.push(s))}else window.UserLeap._queue.push(["track",Ua,t,{url:e},n]),a.push(s),Hl({url:e});a.length>5&&a.splice(0,a.length-5);try{localStorage.setItem(He.PageViews,JSON.stringify(a))}catch(u){u instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${u.message}`)}}catch(u){u instanceof Error&&window.UserLeap.reportError("trackPageView",u,{pageViewsStorage:l}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ib(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),xr(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),xr(o),i})(e.replaceState)),tb()}async function Bo(e,t){const n=Ns();e&&!t&&(window.UserLeap._config.mode=Q1.test);const r=await jt(rb(n,e),{},0,!0);return r.ok?(r.json.delay&&await Ti(r.json.delay),op(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:$e.NoSurvey})}const ob=e=>e.some(t=>t.type===L.VideoVoice),op=async e=>{var O,k,U,T,B,Z;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,p=Nr(window.UserLeap),f=Ds(p),h=ab(p);if(d&&kd({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:p,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:$e.NoSurvey};if(((k=(O=window.UserLeap)==null?void 0:O._config)==null?void 0:k.installationMethod)===Tt.NpmBundled&&ob(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:$e.NoSurvey};if(window.UserLeap.container){const z="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(z),{success:!1,message:z,surveyState:$e.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const z="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(z)),{success:!1,message:z,surveyState:$e.NoSurvey}}U0({id:l}),Zo.disable(),Y.emit(G.SurveyWillPresent,{name:G.SurveyWillPresent,[hc.SurveyId]:l});let m,g=document.createElement("div"),b,v,_;const y=z=>{const{[ln.ViewVersion]:ie}=z;ie!==p["x-ul-sdk-version"]&&Zf(),Y.removeListener(Qe.VerifyViewVersion,y)};Y.on(Qe.VerifyViewVersion,y),Dn(p)?(m="ul-direct-embeded-frame",b=document.head,v=window,_=!1,f&&(Yf(),g.id=m,window.UserLeap.container.appendChild(g),Qf(),Y.emit(G.SurveyLifeCycle,{state:"presented"}),Y.emit(G.SurveyPresented,{name:G.SurveyPresented}))):{frameId:m,contentWinDocHead:b,contentWindow:v,hasOverlay:_,iframe:g}=H1(o,h),window.UserLeap.frameId=m,window.UserLeap.useMobileStyling=h;const C=z=>{Y.on(G.CloseSurveyOnOverlayClick,z)},E=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:p,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:C,eventEmitFn:Y.emit.bind(Y),ulEvents:ja,viewDocument:v==null?void 0:v.document,viewWindow:v,tabTitle:document.title,startingQuestionIdx:(U=window.UserLeap.config)==null?void 0:U.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(T=window.UserLeap)!=null&&T.localStorageAvailable?(B=window.localStorage)==null?void 0:B.getItem(He.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(Z=window.UserLeap.config)!=null&&Z.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(E.customStyles=window.UserLeap.customStyles),v&&(v.__cfg=E);function S(){const z=document.createElement("script");return window.UserLeap.nonce&&z.setAttribute("nonce",window.UserLeap.nonce),z.id=Su,z}const I=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:E.path,x=document.getElementById(Su);x&&x.remove();const R=S(),A=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return E.installationMethod===Tt.Npm||E.installationMethod===Tt.NpmBundled?(P1.configure(E),_&&window.UserLeap.container&&A()):I&&(R.src=I,_&&R.addEventListener("load",()=>{window.UserLeap.container&&A()}),v==null||v.addEventListener("error",z=>{z.target instanceof HTMLScriptElement&&z.target.src===I&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),b==null||b.appendChild(R),{success:!0,surveyState:$e.Ready,surveyId:l,responseGroupUid:s}};function ab(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Ds(e)||t>10&&t<lv}function Ds(e){return J1.includes(e[ct.Platform])}function sb(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 lb(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&sb(t),(t||n||r)&&(ib(),xr())}async function jt(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Nr(window.UserLeap),t.headers);const i=await Rt(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(ct.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(je("token",u),je("vid",c),Y.emit(G.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function ub(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Ti(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const cb=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var m,g,b,v,_;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==Ua&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(m=localStorage.getItem(He.Preview))!=null?m:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const y="[Sprig] - Skipping tracking without userId";return console.warn(y),{success:!1,message:y,surveyState:$e.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const y="[Sprig] - Invalid event name "+u;return console.warn(y),{success:!1,message:y,surveyState:$e.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),je("trackStartUrl",d),(b=(g=window.UserLeap)==null?void 0:g._config)!=null&&b.optimizelyEnabled){const y=Nr(window.UserLeap);Ds(y)||vi.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},vi.getAllOptimizelyExperiments())}(_=(v=window.UserLeap)==null?void 0:v._config)!=null&&_.launchDarklyEnabled&&(a.launchDarklyFlags=Da.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),D0({name:u});const p=window.UserLeap.delayingSurvey?await jt(Ct("1",[tn],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await jt(Ct("1",[tn],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!p.ok){const y="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(y,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:y,error:p.error,surveyState:$e.NoSurvey}}i&&je("uid",i),o&&je("aid",o);const f=p.json;return f.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(He.Preview),await ub(p,l)?X1(f.eventId,d)?op(f):{success:!1,message:"Study should not be displayed after page navigation",surveyState:$e.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:$e.NoSurvey}},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",dt.Override),Bo({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",dt.Override),Bo({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",dt.Override),Bo({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=dt.API){Y.emit(G.SurveyWillClose,{name:G.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}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 u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,tr)&&(a[tr]=a.email,delete a.email),l=await jt(Ct("1",[dn,tn],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await jt(Ct("1",[dn,tn]),{body:JSON.stringify(s),method:"PUT"}),a&&a[tr]&&(window.UserLeap.email=a[tr]),l.ok&&(i&&je("uid",i),o&&je("aid",o)),{success:!!l.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 o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await jt(Ct("1",[dn,tn],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){Y.on(G.SurveyLifeCycle,r)},async removeSurveyListener(r){Y.removeListener(G.SurveyLifeCycle,r)},async addListener(r,i){Y.on(r,i)},async removeListener(r,i){Y.removeListener(r,i)},async removeAllListeners(){Y.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=np();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(He.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await jt(Ct("1",[dn,tn]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&jl(),je("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,je("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){ip(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(N.CustomStyle);o?o.textContent=r:Nc(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(Dc(s.contentDocument))+"px")),Y.emit(G.SurveyDimensions,{name:G.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.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(He.Credentials),localStorage.removeItem(He.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),rp(),jl(),window.UserLeap._queue.unpause()},teardown(){nb(),window.UserLeap("dismissActiveSurvey",dt.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;vi.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(nv.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}Da.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(tr,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return pb(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await Hc({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function db(e){const t=Nr(window.UserLeap);document.addEventListener("securitypolicyviolation",Qo);let n=await Rt(Ct("1",[dn],"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)):document.removeEventListener("securitypolicyviolation",Qo),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Jo("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Jo(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function fb(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=Ns(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await jt(Ct("1",null,"errors"),{method:"POST",headers:{[ct.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function pb(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function hb(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(Xf.Preview))!=null?i:"",n=np();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=ja,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=fb,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 u in window.UserLeap._config)window.UserLeap[u]=window.UserLeap._config[u];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 u=nn("sampled");if(u===null&&(u=Math.random()<o,je("sampled",u)),!u)return}else n&&nn("sampled")!==null&&je("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new Y1(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=nn("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=nn("vid"),window.UserLeap.userId=nn("uid"),window.UserLeap.partnerAnonymousId=nn("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(He.Credentials),rp());const l=await db(e);w0(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),cb(l),await lb(l),window.UserLeap._queue.unpause(),Y.emit(G.SDKReady),Y.emit(G.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Ki{constructor(){Ae(this,"UPDATES",ja)}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)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const Pa={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="web-npm-bundled",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Ki.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Ki.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,hb(e),window.Sprig}};Pa.configure;window.UpChunk={createUpload:Wp};window.rrwebRecord=Lr;exports.DismissReason=dt;exports.SprigAPI=Ki;exports.SprigEvent=G;exports.sprig=Pa;