@sprig-technologies/sprig-bundled 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs DELETED
@@ -1,65 +0,0 @@
1
- "use strict";var Nf=Object.defineProperty;var Uf=(e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ge=(e,t,n)=>(Uf(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Df=Object.create,al=Object.defineProperty,Pf=Object.getOwnPropertyDescriptor,Mf=Object.getOwnPropertyNames,Ff=Object.getPrototypeOf,Vf=Object.prototype.hasOwnProperty,yr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Mf(t))!Vf.call(e,i)&&i!==n&&al(e,i,{get:()=>t[i],enumerable:!(r=Pf(t,i))||r.enumerable});return e},Hf=(e,t,n)=>(n=e!=null?Df(Ff(e)):{},Bf(t||!e||!e.__esModule?al(n,"default",{value:e,enumerable:!0}):n,e)),Kf=yr((e,t)=>{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n={},t.exports=n}),jf=yr((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)}}),Gf=yr((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 u=a[s],c=u.indexOf(":"),l=n(u.slice(0,c)).toLowerCase(),d=n(u.slice(c+1));typeof o[l]>"u"?o[l]=d:r(o[l])?o[l].push(d):o[l]=[o[l],d]}return o}}),zf=yr((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}}),Wf=yr((e,t)=>{var n=Kf(),r=jf(),i=Gf(),o=zf();t.exports=c,t.exports.default=c,c.XMLHttpRequest=n.XMLHttpRequest||p,c.XDomainRequest="withCredentials"in new c.XMLHttpRequest?c.XMLHttpRequest:n.XDomainRequest,a(["get","put","post","patch","head","delete"],function(f){c[f==="delete"?"del":f]=function(h,m,g){return m=u(h,m,g),m.method=f.toUpperCase(),l(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 u(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 c(f,h,m){return h=u(f,h,m),l(h)}function l(f){if(typeof f.callback>"u")throw new Error("callback argument missing");var h=!1,m=function(k,B,Z){h||(h=!0,f.callback(k,B,Z))};function g(){b.readyState===4&&setTimeout(v,0)}function w(){var k=void 0;if(b.response?k=b.response:k=b.responseText||d(b),M)try{k=JSON.parse(k)}catch{}return k}function y(k){return clearTimeout(D),k instanceof Error||(k=new Error(""+(k||"Unknown XMLHttpRequest Error"))),k.statusCode=0,m(k,T)}function v(){if(!C){var k;clearTimeout(D),f.useXDR&&b.status===void 0?k=200:k=b.status===1223?204:b.status;var B=T,Z=null;return k!==0?(B={body:w(),statusCode:k,method:S,headers:{},url:A,rawRequest:b},b.getAllResponseHeaders&&(B.headers=i(b.getAllResponseHeaders()))):Z=new Error("Internal XMLHttpRequest Error"),m(Z,B,B.body)}}var b=f.xhr||null;b||(f.cors||f.useXDR?b=new c.XDomainRequest:b=new c.XMLHttpRequest);var _,C,A=b.url=f.uri||f.url,S=b.method=f.method||"GET",E=f.body||f.data,x=b.headers=f.headers||{},N=!!f.sync,M=!1,D,T={body:void 0,headers:{},statusCode:0,method:S,url:A,rawRequest:b};if("json"in f&&f.json!==!1&&(M=!0,x.accept||x.Accept||(x.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(x["content-type"]||x["Content-Type"]||(x["Content-Type"]="application/json"),E=JSON.stringify(f.json===!0?E:f.json))),b.onreadystatechange=g,b.onload=v,b.onerror=y,b.onprogress=function(){},b.onabort=function(){C=!0},b.ontimeout=y,b.open(S,A,!N,f.username,f.password),N||(b.withCredentials=!!f.withCredentials),!N&&f.timeout>0&&(D=setTimeout(function(){if(!C){C=!0,b.abort("timeout");var k=new Error("XMLHttpRequest timeout");k.code="ETIMEDOUT",y(k)}},f.timeout)),b.setRequestHeader)for(_ in x)x.hasOwnProperty(_)&&b.setRequestHeader(_,x[_]);else if(f.headers&&!s(f.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in f&&(b.responseType=f.responseType),"beforeSend"in f&&typeof f.beforeSend=="function"&&f.beforeSend(b),b.send(E||null),b}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 Ia(e,t,...n){if(!e)throw new TypeError(sl(t,n))}function sl(e,t){let n=0;return e.replace(/%[os]/gu,()=>ul(t[n++]))}function ul(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var qf;function $f(e){try{let t=e instanceof Error?e:new Error(ul(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 tt=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,Yf,kt=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{}}},Zf=new kt("W01","Unable to initialize event under dispatching."),Qf=new kt("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Jf=new kt("W03","Assigning any truthy value to 'returnValue' property has no effect."),Xf=new kt("W04","Unable to preventDefault on non-cancelable events."),ep=new kt("W05","Unable to preventDefault inside passive event listener invocation."),tp=new kt("W06","An event listener wasn't added because it has been added already: %o, %o"),Qi=new kt("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),ys=new kt("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");new kt("W09","Event attribute handler must be a function: %o");var At=class{static get NONE(){return _s}static get CAPTURING_PHASE(){return bs}static get AT_TARGET(){return ws}static get BUBBLING_PHASE(){return Is}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let n=t!=null?t:{};Eo.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 fe(this).type}get target(){return fe(this).target}get srcElement(){return fe(this).target}get currentTarget(){return fe(this).currentTarget}composedPath(){let e=fe(this).currentTarget;return e?[e]:[]}get NONE(){return _s}get CAPTURING_PHASE(){return bs}get AT_TARGET(){return ws}get BUBBLING_PHASE(){return Is}get eventPhase(){return fe(this).dispatchFlag?2:0}stopPropagation(){fe(this).stopPropagationFlag=!0}get cancelBubble(){return fe(this).stopPropagationFlag}set cancelBubble(e){e?fe(this).stopPropagationFlag=!0:Qf.warn()}stopImmediatePropagation(){let e=fe(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return fe(this).bubbles}get cancelable(){return fe(this).cancelable}get returnValue(){return!fe(this).canceledFlag}set returnValue(e){e?Jf.warn():Ss(fe(this))}preventDefault(){Ss(fe(this))}get defaultPrevented(){return fe(this).canceledFlag}get composed(){return fe(this).composed}get isTrusted(){return!1}get timeStamp(){return fe(this).timeStamp}initEvent(e,t=!1,n=!1){let r=fe(this);if(r.dispatchFlag){Zf.warn();return}Eo.set(this,{...r,type:String(e),bubbles:Boolean(t),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},_s=0,bs=1,ws=2,Is=3,Eo=new WeakMap;function fe(e,t="this"){let n=Eo.get(e);return Ia(n!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),n}function Ss(e){if(e.inPassiveListenerFlag){ep.warn();return}if(!e.cancelable){Xf.warn();return}e.canceledFlag=!0}Object.defineProperty(At,"NONE",{enumerable:!0});Object.defineProperty(At,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(At,"AT_TARGET",{enumerable:!0});Object.defineProperty(At,"BUBBLING_PHASE",{enumerable:!0});var Ji=Object.getOwnPropertyNames(At.prototype);for(let e=0;e<Ji.length;++e)Ji[e]!=="constructor"&&Object.defineProperty(At.prototype,Ji[e],{enumerable:!0});typeof tt<"u"&&typeof tt.Event<"u"&&Object.setPrototypeOf(At.prototype,tt.Event.prototype);function np(e){return tt.DOMException?new tt.DOMException(e,"InvalidStateError"):(gn==null&&(gn=class ll extends Error{constructor(n){super(n),Error.captureStackTrace&&Error.captureStackTrace(this,ll)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(gn.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Es(gn),Es(gn.prototype)),new gn(e))}var gn,Cs={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 Es(e){let t=Object.keys(Cs);for(let n=0;n<t.length;++n){let r=t[n],i=Cs[r];Object.defineProperty(e,r,{get(){return i},configurable:!0,enumerable:!0})}}var Ni=class extends At{static wrap(e){return new(dl(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),cl.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,fl(e,r))}}stopPropagation(){super.stopPropagation();let{original:e}=Rt(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=Rt(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=Rt(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=Rt(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=Rt(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=Rt(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},cl=new WeakMap;function Rt(e){let t=cl.get(e);return Ia(t!=null,"'this' is expected an Event object, but got",e),t}var ai=new WeakMap;ai.set(Object.prototype,Ni);typeof tt<"u"&&typeof tt.Event<"u"&&ai.set(tt.Event.prototype,Ni);function dl(e){let t=Object.getPrototypeOf(e);if(t==null)return Ni;let n=ai.get(t);return n==null&&(n=rp(dl(t),t),ai.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],fl(t,r[i]));return n}function fl(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return{get(){let r=Rt(this).original,i=r[t];return typeof i=="function"?i.bind(r):i},set(r){let i=Rt(this).original;i[t]=r},configurable:n.configurable,enumerable:n.enumerable}}function ip(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 pl(e){return(e.flags&1)===1}function hl(e){return(e.flags&2)===2}function ml(e){return(e.flags&4)===4}function ap(e){return(e.flags&8)===8}function sp({callback:e},t,n){try{typeof e=="function"?e.call(t,n):typeof e.handleEvent=="function"&&e.handleEvent(n)}catch(r){$f(r)}}function gl({listeners:e},t,n){for(let r=0;r<e.length;++r)if(e[r].callback===t&&pl(e[r])===n)return r;return-1}function up(e,t,n,r,i,o){let a;o&&(a=vl.bind(null,e,t,n),o.addEventListener("abort",a));let s=ip(t,n,r,i,o,a);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,s]):e.listeners.push(s),s}function vl(e,t,n){let r=gl(e,t,n);return r!==-1?yl(e,r):!1}function yl(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 lp(){return Object.create(null)}function cp(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 Ui=class{constructor(){_l.set(this,lp())}addEventListener(e,t,n){let r=Xi(this),{callback:i,capture:o,once:a,passive:s,signal:u,type:c}=dp(e,t,n);if(i==null||(u==null?void 0:u.aborted))return;let l=cp(r,c),d=gl(l,i,o);if(d!==-1){pp(l.listeners[d],s,a,u);return}up(l,i,o,s,a,u)}removeEventListener(e,t,n){let r=Xi(this),{callback:i,capture:o,type:a}=fp(e,t,n),s=r[a];i!=null&&s&&vl(s,i,o)}dispatchEvent(e){let t=Xi(this)[String(e.type)];if(t==null)return!0;let n=e instanceof At?e:Ni.wrap(e),r=fe(n,"event");if(r.dispatchFlag)throw np("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(!ap(s)&&(ml(s)&&yl(t,a,!i)&&(a-=1),r.inPassiveListenerFlag=hl(s),sp(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}},_l=new WeakMap;function Xi(e,t="this"){let n=_l.get(e);return Ia(n!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),n}function dp(e,t,n){var r;return bl(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 fp(e,t,n){return bl(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 bl(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){ys.warn(e);return}throw new TypeError(sl(ys.message,[e]))}}function pp(e,t,n,r){tp.warn(pl(e)?"capture":"bubble",e.callback),hl(e)!==t&&Qi.warn("passive"),ml(e)!==n&&Qi.warn("once"),e.signal!==r&&Qi.warn("signal")}var eo=Object.getOwnPropertyNames(Ui.prototype);for(let e=0;e<eo.length;++e)eo[e]!=="constructor"&&Object.defineProperty(Ui.prototype,eo[e],{enumerable:!0});typeof tt<"u"&&typeof tt.EventTarget<"u"&&Object.setPrototypeOf(Ui.prototype,tt.EventTarget.prototype);var hp=Hf(Wf()),wl=30720,Di=512e3,Pi=256,ko=(e,{minChunkSize:t=Pi,maxChunkSize:n=Di}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=n,Ao=(e,{minChunkSize:t=Pi,maxChunkSize:n=Di}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${n}`),mp=class{constructor(e,t={}){this.readableStream=e;var n,r,i;if(!ko(t.defaultChunkSize,t))throw Ao(t.defaultChunkSize,t);this.defaultChunkSize=(n=t.defaultChunkSize)!=null?n:wl,this.minChunkSize=(r=t.minChunkSize)!=null?r:Pi,this.maxChunkSize=(i=t.maxChunkSize)!=null?i:Di}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!ko(e,this))throw Ao(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}}},gp=[200,201,202,204,308],Il=[408,502,503,504],Sl=(e,t)=>!!e&&gp.includes(e.statusCode),vp=(e,{retryCodes:t=Il})=>!e||t.includes(e.statusCode),yp=(e,t)=>t.attemptCount>=t.attempts||!(Sl(e)||vp(e,t)),Cl=class{static createUpload(e){return new Cl(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||Il,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 mp(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 Ui,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:Di}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:Pi}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:wl}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 Ao(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,u=r.loaded/((i=r.total)!=null?i:this.chunkByteSize)*a;this.dispatch("progress",Math.min((s+u)*100,100))}};return new Promise((n,r)=>{this.currentXhr=(0,hp.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 u;let c=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:c,response:a}),this.attemptCount=0,this.chunkCount=((u=this.chunkCount)!=null?u:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let l=this.chunkSize;c<10?l=Math.min(this.chunkSize*2,this.maxChunkSize):c>30&&(l=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(l/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(u=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,u(!1);return}let c=await this.sendChunkWithRetries(e);u(c)},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 Sl(i)?t(i):yp(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}}},_p=Cl.createUpload,_e;(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"})(_e||(_e={}));function bp(e){return e.nodeType===e.ELEMENT_NODE}function Qn(e){var t=e==null?void 0:e.host;return Boolean((t==null?void 0:t.shadowRoot)===e)}function Jn(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function wp(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 Ip(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 si(e){try{var t=e.rules||e.cssRules;return t?wp(Array.from(t).map(El).join("")):null}catch{return null}}function El(e){var t;if(Cp(e))try{t=si(e.styleSheet)||Ip(e)}catch{}return Sp(t||e.cssText)}function Sp(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}function Cp(e){return"styleSheet"in e}var kl=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 Ep(){return new kl}function Sa(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,s=o||"",u=i&&an(i);return(n[r.toLowerCase()]||u&&n[u])&&(a?s=a(s,t):s="*".repeat(s.length)),s}function an(e){return e.toLowerCase()}var ks="__rrweb_original__";function kp(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=ks in o?o[ks]: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(u){return u!==0}))return!1}return!0}function Ca(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?an(t):null}var Ap=1,xp=new RegExp("[^a-z0-9-_:]"),ar=-2;function Al(){return Ap++}function Tp(e){if(e instanceof HTMLFormElement)return"form";var t=an(e.tagName);return xp.test(t)?"div":t}function Rp(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var vn,As,Lp=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Op=/^(?:[a-z+]+:)?\/\//i,Np=/^www\..*/i,Up=/^(data:)([^,]*),(.*)/i;function ui(e,t){return(e||"").replace(Lp,function(n,r,i,o,a,s){var u=i||a||s,c=r||o||"";if(!u)return n;if(Op.test(u)||Np.test(u)||Up.test(u))return"url(".concat(c).concat(u).concat(c,")");if(u[0]==="/")return"url(".concat(c).concat(Rp(t)+u).concat(c,")");var l=t.split("/"),d=u.split("/");l.pop();for(var p=0,f=d;p<f.length;p++){var h=f[p];h!=="."&&(h===".."?l.pop():l.push(h))}return"url(".concat(c).concat(l.join("/")).concat(c,")")})}var Dp=/^[^ \t\n\r\u000c]+/,Pp=/^[, \t\n\r\u000c]+/;function Mp(e,t){if(t.trim()==="")return t;var n=0;function r(c){var l,d=c.exec(t.substring(n));return d?(l=d[0],n+=l.length,l):""}for(var i=[];r(Pp),!(n>=t.length);){var o=r(Dp);if(o.slice(-1)===",")o=Sn(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Sn(e,o);for(var s=!1;;){var u=t.charAt(n);if(u===""){i.push((o+a).trim());break}else if(s)u===")"&&(s=!1);else if(u===","){n+=1,i.push((o+a).trim());break}else u==="("&&(s=!0);a+=u,n+=1}}}return i.join(", ")}function Sn(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function Fp(e){return Boolean(e.tagName==="svg"||e.ownerSVGElement)}function Ea(){var e=document.createElement("a");return e.href="",e.href}function xl(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")?Sn(e,r):n==="srcset"?Mp(e,r):n==="style"?ui(r,Ea()):t==="object"&&n==="data"?Sn(e,r):r)}function Tl(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function Vp(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 li(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?li(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?li(e.parentNode,t,n):!1}function Rl(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(li(r,t,!0))return!0;if(n&&(r.matches(n)||r.closest(n)))return!0}catch{}return!1}function Bp(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 Hp(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 Kp(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,u=t.inlineStylesheet,c=t.maskInputOptions,l=c===void 0?{}:c,d=t.maskTextFn,p=t.maskInputFn,f=t.dataURLOptions,h=f===void 0?{}:f,m=t.inlineImages,g=t.recordCanvas,w=t.keepIframeSrcFn,y=t.newlyAddedElement,v=y===void 0?!1:y,b=jp(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:_e.Document,childNodes:[],compatMode:e.compatMode}:{type:_e.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:_e.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return zp(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:l,maskInputFn:p,dataURLOptions:h,inlineImages:m,recordCanvas:g,keepIframeSrcFn:w,newlyAddedElement:v,rootId:b});case e.TEXT_NODE:return Gp(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:_e.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:_e.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function jp(e,t){if(!!t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function Gp(e,t){var n,r=t.maskTextClass,i=t.maskTextSelector,o=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,u=e.textContent,c=s==="STYLE"?!0:void 0,l=s==="SCRIPT"?!0:void 0;if(c&&u){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(u=si(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}u=ui(u,Ea())}return l&&(u="SCRIPT_PLACEHOLDER"),!c&&!l&&u&&Rl(e,r,i)&&(u=o?o(u):u.replace(/[\S]/g,"*")),{type:_e.Text,textContent:u||"",isStyle:c,rootId:a}}function zp(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,u=t.maskInputFn,c=t.dataURLOptions,l=c===void 0?{}:c,d=t.inlineImages,p=t.recordCanvas,f=t.keepIframeSrcFn,h=t.newlyAddedElement,m=h===void 0?!1:h,g=t.rootId,w=Vp(e,r,i),y=Tp(e),v={},b=e.attributes.length,_=0;_<b;_++){var C=e.attributes[_];Tl(y,C.name,C.value)||(v[C.name]=xl(n,y,an(C.name),C.value))}if(y==="link"&&o){var A=Array.from(n.styleSheets).find(function(ce){return ce.href===e.href}),S=null;A&&(S=si(A)),S&&(delete v.rel,delete v.href,v._cssText=ui(S,A.href))}if(y==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var S=si(e.sheet);S&&(v._cssText=ui(S,Ea()))}if(y==="input"||y==="textarea"||y==="select"){var E=e.value,x=e.checked;if(v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&E){var N=Ca(e);v.value=Sa({element:e,type:N,tagName:y,value:E,maskInputOptions:s,maskInputFn:u})}else x&&(v.checked=x)}if(y==="option"&&(e.selected&&!s.select?v.selected=!0:delete v.selected),y==="canvas"&&p){if(e.__context==="2d")kp(e)||(v.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){var M=e.toDataURL(l.type,l.quality),D=document.createElement("canvas");D.width=e.width,D.height=e.height;var T=D.toDataURL(l.type,l.quality);M!==T&&(v.rr_dataURL=M)}}if(y==="img"&&d){vn||(vn=n.createElement("canvas"),As=vn.getContext("2d"));var k=e,B=k.crossOrigin;k.crossOrigin="anonymous";var Z=function(){k.removeEventListener("load",Z);try{vn.width=k.naturalWidth,vn.height=k.naturalHeight,As.drawImage(k,0,0),v.rr_dataURL=vn.toDataURL(l.type,l.quality)}catch(ce){console.warn("Cannot inline img src=".concat(k.currentSrc,"! Error: ").concat(ce))}B?v.crossOrigin=B:k.removeAttribute("crossorigin")};k.complete&&k.naturalWidth!==0?Z():k.addEventListener("load",Z)}if((y==="audio"||y==="video")&&(v.rr_mediaState=e.paused?"paused":"played",v.rr_mediaCurrentTime=e.currentTime),m||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),w){var se=e.getBoundingClientRect(),X=se.width,ne=se.height;v={class:v.class,rr_width:"".concat(X,"px"),rr_height:"".concat(ne,"px")}}return y==="iframe"&&!f(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src),{type:_e.Element,tagName:y,attributes:v,childNodes:[],isSVG:Fp(e)||void 0,needBlock:w,rootId:g}}function te(e){return e==null?"":e.toLowerCase()}function Wp(e,t){if(t.comment&&e.type===_e.Comment)return!0;if(e.type===_e.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"&&(te(e.attributes.name).match(/^msapplication-tile(image|color)$/)||te(e.attributes.name)==="application-name"||te(e.attributes.rel)==="icon"||te(e.attributes.rel)==="apple-touch-icon"||te(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&te(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(te(e.attributes.property).match(/^(og|twitter|fb):/)||te(e.attributes.name).match(/^(og|twitter):/)||te(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(te(e.attributes.name)==="robots"||te(e.attributes.name)==="googlebot"||te(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(te(e.attributes.name)==="author"||te(e.attributes.name)==="generator"||te(e.attributes.name)==="framework"||te(e.attributes.name)==="publisher"||te(e.attributes.name)==="progid"||te(e.attributes.property).match(/^article:/)||te(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(te(e.attributes.name)==="google-site-verification"||te(e.attributes.name)==="yandex-verification"||te(e.attributes.name)==="csrf-token"||te(e.attributes.name)==="p:domain_verify"||te(e.attributes.name)==="verify-v1"||te(e.attributes.name)==="verification"||te(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Cn(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,u=t.skipChild,c=u===void 0?!1:u,l=t.inlineStylesheet,d=l===void 0?!0:l,p=t.maskInputOptions,f=p===void 0?{}:p,h=t.maskTextFn,m=t.maskInputFn,g=t.slimDOMOptions,w=t.dataURLOptions,y=w===void 0?{}:w,v=t.inlineImages,b=v===void 0?!1:v,_=t.recordCanvas,C=_===void 0?!1:_,A=t.onSerialize,S=t.onIframeLoad,E=t.iframeLoadTimeout,x=E===void 0?5e3:E,N=t.onStylesheetLoad,M=t.stylesheetLoadTimeout,D=M===void 0?5e3:M,T=t.keepIframeSrcFn,k=T===void 0?function(){return!1}:T,B=t.newlyAddedElement,Z=B===void 0?!1:B,se=t.preserveWhiteSpace,X=se===void 0?!0:se,ne=Kp(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,dataURLOptions:y,inlineImages:b,recordCanvas:C,keepIframeSrcFn:k,newlyAddedElement:Z});if(!ne)return console.warn(e,"not serialized"),null;var ce;r.hasNode(e)?ce=r.getId(e):Wp(ne,g)||!X&&ne.type===_e.Text&&!ne.isStyle&&!ne.textContent.replace(/^\s+|\s+$/gm,"").length?ce=ar:ce=Al();var q=Object.assign(ne,{id:ce});if(r.add(e,q),ce===ar)return null;A&&A(e);var Ke=!c;if(q.type===_e.Element){Ke=Ke&&!q.needBlock,delete q.needBlock;var Se=e.shadowRoot;Se&&Jn(Se)&&(q.isShadowHost=!0)}if((q.type===_e.Document||q.type===_e.Element)&&Ke){g.headWhitespace&&q.type===_e.Element&&q.tagName==="head"&&(X=!1);for(var dt={doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:c,inlineStylesheet:d,maskInputOptions:f,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:b,recordCanvas:C,preserveWhiteSpace:X,onSerialize:A,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:N,stylesheetLoadTimeout:D,keepIframeSrcFn:k},De=0,it=Array.from(e.childNodes);De<it.length;De++){var Gt=it[De],Je=Cn(Gt,dt);Je&&q.childNodes.push(Je)}if(bp(e)&&e.shadowRoot)for(var V=0,Oe=Array.from(e.shadowRoot.childNodes);V<Oe.length;V++){var Gt=Oe[V],Je=Cn(Gt,dt);Je&&(Jn(e.shadowRoot)&&(Je.isShadow=!0),q.childNodes.push(Je))}}return e.parentNode&&Qn(e.parentNode)&&Jn(e.parentNode)&&(q.isShadow=!0),q.type===_e.Element&&q.tagName==="iframe"&&Bp(e,function(){var J=e.contentDocument;if(J&&S){var we=Cn(J,{doc:J,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:b,recordCanvas:C,preserveWhiteSpace:X,onSerialize:A,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:N,stylesheetLoadTimeout:D,keepIframeSrcFn:k});we&&S(e,we)}},x),q.type===_e.Element&&q.tagName==="link"&&q.attributes.rel==="stylesheet"&&Hp(e,function(){if(N){var J=Cn(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:b,recordCanvas:C,preserveWhiteSpace:X,onSerialize:A,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:N,stylesheetLoadTimeout:D,keepIframeSrcFn:k});J&&N(e,J)}},D),q}function qp(e,t){var n=t||{},r=n.mirror,i=r===void 0?new kl:r,o=n.blockClass,a=o===void 0?"rr-block":o,s=n.blockSelector,u=s===void 0?null:s,c=n.maskTextClass,l=c===void 0?"rr-mask":c,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,w=n.recordCanvas,y=w===void 0?!1:w,v=n.maskAllInputs,b=v===void 0?!1:v,_=n.maskTextFn,C=n.maskInputFn,A=n.slimDOM,S=A===void 0?!1:A,E=n.dataURLOptions,x=n.preserveWhiteSpace,N=n.onSerialize,M=n.onIframeLoad,D=n.iframeLoadTimeout,T=n.onStylesheetLoad,k=n.stylesheetLoadTimeout,B=n.keepIframeSrcFn,Z=B===void 0?function(){return!1}:B,se=b===!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}:b===!1?{password:!0}:b,X=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 Cn(e,{doc:e,mirror:i,blockClass:a,blockSelector:u,maskTextClass:l,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:se,maskTextFn:_,maskInputFn:C,slimDOMOptions:X,dataURLOptions:E,inlineImages:g,recordCanvas:y,preserveWhiteSpace:x,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:D,onStylesheetLoad:T,stylesheetLoadTimeout:k,keepIframeSrcFn:Z,newlyAddedElement:!1})}function xe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const wn=`Please stop import mirror directly. Instead of that,\r
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 xs={map:{},getId(){return console.error(wn),-1},getNode(){return console.error(wn),null},removeNodeFromMap(){console.error(wn)},has(){return console.error(wn),!1},reset(){console.error(wn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(xs=new Proxy(xs,{get(e,t,n){return t==="map"&&console.error(wn),Reflect.get(e,t,n)}}));function sr(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),u=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(u,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(u,o)},s))}}function Mi(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)}}),()=>Mi(e,t,o||{},!0)}function _r(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 Ll(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 Ol(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Nl(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Te(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(li(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function $p(e,t){return t.getId(e)!==-1}function to(e,t){return t.getId(e)===ar}function Ul(e,t){if(Qn(e))return!1;const n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Ul(e.parentNode,t):!0:!0}function xo(e){return Boolean(e.changedTouches)}function Yp(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 Dl(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function Pl(e,t){return Boolean(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function To(e){return Boolean(e==null?void 0:e.shadowRoot)}class Zp{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 Ml(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 Qp(e){let t=e,n;for(;n=Ml(t);)t=n;return t}function Jp(e){const t=e.ownerDocument;if(!t)return!1;const n=Qp(e);return t.contains(n)}function Fl(e){const t=e.ownerDocument;return t?t.contains(e)||Jp(e):!1}var Q=(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))(Q||{}),$=(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))($||{}),Ne=(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))(Ne||{}),pt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(pt||{}),Rn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Rn||{});function Ts(e){return"__ln"in e}class Xp{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&&Ts(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&&Ts(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 Rs=(e,t)=>`${e}@${t}`;class eh{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 Xp,i=u=>{let c=u,l=ar;for(;l===ar;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},o=u=>{if(!u.parentNode||!Fl(u))return;const c=Qn(u.parentNode)?this.mirror.getId(Ml(u)):this.mirror.getId(u.parentNode),l=i(u);if(c===-1||l===-1)return r.addNode(u);const d=Cn(u,{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=>{Dl(p,this.mirror)&&this.iframeManager.addIframe(p),Pl(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),To(u)&&this.shadowDomManager.addShadowRoot(u.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:c,nextId:l,node:d}),n.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)Ls(this.removes,u,this.mirror)&&!this.movedSet.has(u.parentNode)||o(u);for(const u of this.addedSet)!Os(this.droppedSet,u)&&!Ls(this.removes,u,this.mirror)||Os(this.movedSet,u)?o(u):this.droppedSet.add(u);let a=null;for(;r.length;){let u=null;if(a){const c=this.mirror.getId(a.value.parentNode),l=i(a.value);c!==-1&&l!==-1&&(u=a)}if(!u){let c=r.tail;for(;c;){const l=c;if(c=c.previous,l){const d=this.mirror.getId(l.value.parentNode);if(i(l.value)===-1)continue;if(d!==-1){u=l;break}else{const f=l.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=f.parentNode.host;if(this.mirror.getId(h)!==-1){u=l;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}a=u.previous,r.removeNode(u.value),o(u.value)}const s={texts:this.texts.map(u=>({id:this.mirror.getId(u.node),value:u.value})).filter(u=>!n.has(u.id)).filter(u=>this.mirror.has(u.id)),attributes:this.attributes.map(u=>{const{attributes:c}=u;if(typeof c.style=="string"){const l=JSON.stringify(u.styleDiff),d=JSON.stringify(u._unchangedStyles);l.length<c.style.length&&(l+d).split("var(").length===c.style.split("var(").length&&(c.style=u.styleDiff)}return{id:this.mirror.getId(u.node),attributes:c}}).filter(u=>!n.has(u.id)).filter(u=>this.mirror.has(u.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(to(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;!Te(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Rl(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=Ca(r);o=Sa({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(Te(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"),!Tl(r.tagName,i)&&(a.attributes[i]=xl(this.doc,an(r.tagName),an(i),o),i==="style")){const s=n.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(const u of Array.from(r.style)){const c=r.style.getPropertyValue(u),l=r.style.getPropertyPriority(u);c!==s.style.getPropertyValue(u)||l!==s.style.getPropertyPriority(u)?l===""?a.styleDiff[u]=c:a.styleDiff[u]=[c,l]:a._unchangedStyles[u]=[c,l]}for(const u of Array.from(s.style))r.style.getPropertyValue(u)===""&&(a.styleDiff[u]=!1)}break}case"childList":{if(Te(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=Qn(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Te(t.target,this.blockClass,this.blockSelector,!1)||to(r,this.mirror)||!$p(r,this.mirror)||(this.addedSet.has(r)?(Ro(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&i===-1||Ul(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Rs(i,o)]?Ro(this.movedSet,r):this.removes.push({parentId:o,id:i,isShadow:Qn(t.target)&&Jn(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(to(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[Rs(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Te(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(r=>this.genAdds(r)),To(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 Ro(e,t){e.delete(t),t.childNodes.forEach(n=>Ro(e,n))}function Ls(e,t,n){return e.length===0?!1:Vl(e,t,n)}function Vl(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return e.some(o=>o.id===i)?!0:Vl(e,r,n)}function Os(e,t){return e.size===0?!1:Bl(e,t)}function Bl(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:Bl(e,n):!1}let Xn;function th(e){Xn=e}function nh(){Xn=void 0}const j=e=>Xn?(...n)=>{try{return e(...n)}catch(r){if(Xn&&Xn(r)===!0)return;throw r}}:e,Zt=[];function br(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 Hl(e,t){var n,r;const i=new eh;Zt.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(j(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 u=sr(j(d=>{const p=Date.now()-s;e(a.map(f=>(f.timeOffset-=p,f)),d),a=[],s=null}),o),c=j(sr(j(d=>{const p=br(d),{clientX:f,clientY:h}=xo(d)?d.changedTouches[0]:d;s||(s=ci()),a.push({x:f,y:h,id:r.getId(p),timeOffset:ci()-s}),u(typeof DragEvent<"u"&&d instanceof DragEvent?$.Drag:d instanceof MouseEvent?$.MouseMove:$.TouchMove)}),i,{trailing:!1})),l=[xe("mousemove",c,n),xe("touchmove",c,n),xe("drag",c,n)];return j(()=>{l.forEach(d=>d())})}function ih({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 u=null;const c=l=>d=>{const p=br(d);if(Te(p,r,i,!0))return;let f=null,h=l;if("pointerType"in d){switch(d.pointerType){case"mouse":f=pt.Mouse;break;case"touch":f=pt.Touch;break;case"pen":f=pt.Pen;break}f===pt.Touch?Ne[l]===Ne.MouseDown?h="TouchStart":Ne[l]===Ne.MouseUp&&(h="TouchEnd"):pt.Pen}else xo(d)&&(f=pt.Touch);f!==null?(u=f,(h.startsWith("Touch")&&f===pt.Touch||h.startsWith("Mouse")&&f===pt.Mouse)&&(f=null)):Ne[l]===Ne.Click&&(f=u,u=null);const m=xo(d)?d.changedTouches[0]:d;if(!m)return;const g=n.getId(p),{clientX:w,clientY:y}=m;j(e)(Object.assign({type:Ne[h],id:g,x:w,y},f!==null&&{pointerType:f}))};return Object.keys(Ne).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let d=an(l);const p=c(l);if(window.PointerEvent)switch(Ne[l]){case Ne.MouseDown:case Ne.MouseUp:d=d.replace("mouse","pointer");break;case Ne.TouchStart:case Ne.TouchEnd:return}s.push(xe(d,p,t))}),j(()=>{s.forEach(l=>l())})}function Kl({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const a=j(sr(j(s=>{const u=br(s);if(!u||Te(u,r,i,!0))return;const c=n.getId(u);if(u===t&&t.defaultView){const l=Ll(t.defaultView);e({id:c,x:l.left,y:l.top})}else e({id:c,x:u.scrollLeft,y:u.scrollTop})}),o.scroll||100));return xe("scroll",a,t)}function oh({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const i=j(sr(j(()=>{const o=Ol(),a=Nl();(n!==o||r!==a)&&(e({width:Number(a),height:Number(o)}),n=o,r=a)}),200));return xe("resize",i,t)}function Ns(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const ah=["INPUT","TEXTAREA","SELECT"],Us=new WeakMap;function sh({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:s,maskInputFn:u,sampling:c,userTriggeredOnInput:l}){function d(y){let v=br(y);const b=y.isTrusted,_=v&&v.tagName;if(v&&_==="OPTION"&&(v=v.parentElement),!v||!_||ah.indexOf(_)<0||Te(v,r,i,!0)||v.classList.contains(o)||a&&v.matches(a))return;let C=v.value,A=!1;const S=Ca(v)||"";S==="radio"||S==="checkbox"?A=v.checked:(s[_.toLowerCase()]||s[S])&&(C=Sa({element:v,maskInputOptions:s,tagName:_,type:S,value:C,maskInputFn:u})),p(v,j(Ns)({text:C,isChecked:A,userTriggered:b},l));const E=v.name;S==="radio"&&E&&A&&t.querySelectorAll(`input[type="radio"][name="${E}"]`).forEach(x=>{x!==v&&p(x,j(Ns)({text:x.value,isChecked:!A,userTriggered:!1},l))})}function p(y,v){const b=Us.get(y);if(!b||b.text!==v.text||b.isChecked!==v.isChecked){Us.set(y,v);const _=n.getId(y);j(e)(Object.assign(Object.assign({},v),{id:_}))}}const h=(c.input==="last"?["change"]:["input","change"]).map(y=>xe(y,j(d),t)),m=t.defaultView;if(!m)return()=>{h.forEach(y=>y())};const g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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(...w.map(y=>Mi(y[0],y[1],{set(){j(d)({target:this,isTrusted:!1})}},!1,m))),j(()=>{h.forEach(y=>y())})}function di(e){const t=[];function n(r,i){if(Nr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Nr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Nr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Nr("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 Lt(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:j((l,d,p)=>{const[f,h]=p,{id:m,styleId:g}=Lt(d,t,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:f,index:h}]}),l.apply(d,p)})});const o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:j((l,d,p)=>{const[f]=p,{id:h,styleId:m}=Lt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:f}]}),l.apply(d,p)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:j((l,d,p)=>{const[f]=p,{id:h,styleId:m}=Lt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:f}),l.apply(d,p)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:j((l,d,p)=>{const[f]=p,{id:h,styleId:m}=Lt(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:f}),l.apply(d,p)})}));const u={};Ur("CSSGroupingRule")?u.CSSGroupingRule=r.CSSGroupingRule:(Ur("CSSMediaRule")&&(u.CSSMediaRule=r.CSSMediaRule),Ur("CSSConditionRule")&&(u.CSSConditionRule=r.CSSConditionRule),Ur("CSSSupportsRule")&&(u.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(u).forEach(([l,d])=>{c[l]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[l].insertRule,{apply:j((p,f,h)=>{const[m,g]=h,{id:w,styleId:y}=Lt(f.parentStyleSheet,t,n.styleMirror);return(w&&w!==-1||y&&y!==-1)&&e({id:w,styleId:y,adds:[{rule:m,index:[...di(f),g||0]}]}),p.apply(f,h)})}),d.prototype.deleteRule=new Proxy(c[l].deleteRule,{apply:j((p,f,h)=>{const[m]=h,{id:g,styleId:w}=Lt(f.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[...di(f),m]}]}),p.apply(f,h)})})}),j(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(u).forEach(([l,d])=>{d.prototype.insertRule=c[l].insertRule,d.prototype.deleteRule=c[l].deleteRule})})}function jl({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,u=Object.getOwnPropertyDescriptor(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!u?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var c;return(c=u.get)===null||c===void 0?void 0:c.call(this)},set(c){var l;const d=(l=u.set)===null||l===void 0?void 0:l.call(this,c);if(a!==null&&a!==-1)try{t.adoptStyleSheets(c,a)}catch{}return d}}),j(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))}function lh({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:j((s,u,c)=>{var l;const[d,p,f]=c;if(n.has(d))return o.apply(u,[d,p,f]);const{id:h,styleId:m}=Lt((l=u.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,set:{property:d,value:p,priority:f},index:di(u.parentRule)}),s.apply(u,c)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:j((s,u,c)=>{var l;const[d]=c;if(n.has(d))return a.apply(u,[d]);const{id:p,styleId:f}=Lt((l=u.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,remove:{property:d},index:di(u.parentRule)}),s.apply(u,c)})}),j(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function ch({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const a=j(u=>sr(j(c=>{const l=br(c);if(!l||Te(l,t,n,!0))return;const{currentTime:d,volume:p,muted:f,playbackRate:h}=l;e({type:u,id:r.getId(l),currentTime:d,volume:p,muted:f,playbackRate:h})}),i.media||500)),s=[xe("play",a(0),o),xe("pause",a(1),o),xe("seeked",a(2),o),xe("volumechange",a(3),o),xe("ratechange",a(4),o)];return j(()=>{s.forEach(u=>u())})}function dh({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(u,c,l){const d=new o(u,c,l);return i.set(d,{family:u,buffer:typeof c!="string",descriptors:l,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};const a=_r(t.fonts,"add",function(s){return function(u){return setTimeout(j(()=>{const c=i.get(u);c&&(e(c),i.delete(u))}),0),s.apply(this,[u])}});return r.push(()=>{n.FontFace=o}),r.push(a),j(()=>{r.forEach(s=>s())})}function fh(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=j(()=>{const u=t.getSelection();if(!u||a&&(u==null?void 0:u.isCollapsed))return;a=u.isCollapsed||!1;const c=[],l=u.rangeCount||0;for(let d=0;d<l;d++){const p=u.getRangeAt(d),{startContainer:f,startOffset:h,endContainer:m,endOffset:g}=p;Te(f,r,i,!0)||Te(m,r,i,!0)||c.push({start:n.getId(f),startOffset:h,end:n.getId(m),endOffset:g})}o({ranges:c})});return s(),xe("selectionchange",s)}function ph(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:u,styleSheetRuleCb:c,styleDeclarationCb:l,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),u(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),c(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),l(...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 hh(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};ph(e,t);const r=Hl(e,e.doc),i=rh(e),o=ih(e),a=Kl(e),s=oh(e,{win:n}),u=sh(e),c=ch(e),l=uh(e,{win:n}),d=jl(e,e.doc),p=lh(e,{win:n}),f=e.collectFonts?dh(e):()=>{},h=fh(e),m=[];for(const g of e.plugins)m.push(g.observer(g.callback,n,g.options));return j(()=>{Zt.forEach(g=>g.reset()),r.disconnect(),i(),o(),a(),s(),u(),c(),l(),d(),p(),f(),h(),m.forEach(g=>g())})}function Nr(e){return typeof window[e]<"u"}function Ur(e){return Boolean(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Ds{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 mh{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ds(Al),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ds(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 Q.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:Q.IncrementalSnapshot,data:{source:$.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Q.Meta:case Q.Load:case Q.DomContentLoaded:return!1;case Q.Plugin:return n;case Q.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case Q.IncrementalSnapshot:switch(n.data.source){case $.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 $.Drag:case $.TouchMove:case $.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case $.ViewportResize:return!1;case $.MediaInteraction:case $.MouseInteraction:case $.Scroll:case $.CanvasMutation:case $.Input:return this.replaceIds(n.data,t,["id"]),n;case $.StyleSheetRule:case $.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case $.Font:return n;case $.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case $.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!==_e.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class gh{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(!Jn(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const r=Hl(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(Kl(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(jl({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(_r(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o);return this.shadowRoot&&Fl(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
6
- Copyright (c) Microsoft Corporation.
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any
9
- purpose with or without fee is hereby granted.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
- PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */function vh(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 yh(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(l){try{c(r.next(l))}catch(d){a(d)}}function u(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(s,u)}c((r=r.apply(e,t||[])).next())})}var En="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_h=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Dr=0;Dr<En.length;Dr++)_h[En.charCodeAt(Dr)]=Dr;var bh=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=En[t[n]>>2],i+=En[(t[n]&3)<<4|t[n+1]>>4],i+=En[(t[n+1]&15)<<2|t[n+2]>>6],i+=En[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 Ps=new Map;function wh(e,t){let n=Ps.get(e);return n||(n=new Map,Ps.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const Gl=(e,t,n)=>{if(!e||!(Wl(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=wh(n,r);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Wr(e,t,n){if(e instanceof Array)return e.map(r=>Wr(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=bh(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Wr(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:[Wr(e.data,t,n),e.width,e.height]};if(Wl(e,t)||typeof e=="object"){const r=e.constructor.name,i=Gl(e,t,n);return{rr_type:r,index:i}}}}return e}const zl=(e,t,n)=>[...e].map(r=>Wr(r,t,n)),Wl=(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 Ih(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=_r(t.CanvasRenderingContext2D.prototype,a,function(u){return function(...c){return Te(this.canvas,n,r,!0)||setTimeout(()=>{const l=zl([...c],t,this);e(this.canvas,{type:Rn["2D"],property:a,args:l})},0),u.apply(this,c)}});i.push(s)}catch{const u=Mi(t.CanvasRenderingContext2D.prototype,a,{set(c){e(this.canvas,{type:Rn["2D"],property:a,args:[c],setter:!0})}});i.push(u)}return()=>{i.forEach(a=>a())}}function Sh(e){return e==="experimental-webgl"?"webgl":e}function Ms(e,t,n,r){const i=[];try{const o=_r(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(s,...u){if(!Te(this,t,n,!0)){const c=Sh(s);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(u[0]&&typeof u[0]=="object"){const l=u[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[s,...u])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Fs(e,t,n,r,i,o,a){const s=[],u=Object.getOwnPropertyNames(e);for(const c of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof e[c]!="function")continue;const l=_r(e,c,function(d){return function(...p){const f=d.apply(this,p);if(Gl(f,a,this),"tagName"in this.canvas&&!Te(this.canvas,r,i,!0)){const h=zl([...p],a,this),m={type:t,property:c,args:h};n(this.canvas,m)}return f}});s.push(l)}catch{const d=Mi(e,c,{set(p){n(this.canvas,{type:t,property:c,args:[p],setter:!0})}});s.push(d)}return s}function Ch(e,t,n,r,i){const o=[];return o.push(...Fs(t.WebGLRenderingContext.prototype,Rn.WebGL,e,n,r,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Fs(t.WebGL2RenderingContext.prototype,Rn.WebGL2,e,n,r,i,t)),()=>{o.forEach(a=>a())}}function Eh(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 kh(e,t,n){var r=t===void 0?null:t,i=n===void 0?!1:n,o=Eh(e,i),a=o.indexOf(`
19
- `,10)+1,s=o.substring(a)+(r?"//# sourceMappingURL="+r:""),u=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(u)}function Ah(e,t,n){var r;return function(o){return r=r||kh(e,t,n),new Worker(r,o)}}var xh=Ah("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);class Th{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=(u,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(u)||this.pendingCanvasMutations.set(u,[]),this.pendingCanvasMutations.get(u).push(c)};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=Ms(n,r,i,!0),s=new Map,u=new xh;u.onmessage=h=>{const{id:m}=h.data;if(s.set(m,!1),!("base64"in h.data))return;const{base64:g,type:w,width:y,height:v}=h.data;this.mutationCb({id:m,type:Rn["2D"],commands:[{property:"clearRect",args:[0,0,y,v]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:w}]},0,0]}]})};const c=1e3/t;let l=0,d;const p=()=>{const h=[];return n.document.querySelectorAll("canvas").forEach(m=>{Te(m,r,i,!0)||h.push(m)}),h},f=h=>{if(l&&h-l<c){d=requestAnimationFrame(f);return}l=h,p().forEach(m=>yh(this,void 0,void 0,function*(){var g;const w=this.mirror.getId(m);if(s.get(w))return;if(s.set(w,!0),["webgl","webgl2"].includes(m.__context)){const v=m.getContext(m.__context);((g=v==null?void 0:v.getContextAttributes())===null||g===void 0?void 0:g.preserveDrawingBuffer)===!1&&v.clear(v.COLOR_BUFFER_BIT)}const y=yield createImageBitmap(m);u.postMessage({id:w,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=Ms(t,n,r,!1),o=Ih(this.processMutation.bind(this),t,n,r),a=Ch(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=>vh(a,["type"])),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class Rh{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Zp,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((u,c)=>({rule:El(u),index:c}))})}r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Lh{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 ve(e){return Object.assign(Object.assign({},e),{timestamp:ci()})}let de,qr,no,fi=!1;const Xe=Ep();function wr(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:s=null,maskTextClass:u="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:h,maskTextFn:m,hooks:g,packFn:w,sampling:y={},dataURLOptions:v={},mousemoveWait:b,recordCanvas:_=!1,recordCrossOriginIframes:C=!1,recordAfter:A=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:S=!1,collectFonts:E=!1,inlineImages:x=!1,plugins:N,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:D=new Set([]),errorHandler:T}=e;th(T);const k=C?window.parent===window:!0;let B=!1;if(!k)try{window.parent.document&&(B=!1)}catch{B=!0}if(k&&!t)throw new Error("emit function is required");b!==void 0&&y.mousemove===void 0&&(y.mousemove=b),Xe.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},se=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||{};Yp();let X,ne=0;const ce=V=>{for(const Oe of N||[])Oe.eventProcessor&&(V=Oe.eventProcessor(V));return w&&!B&&(V=w(V)),V};de=(V,Oe)=>{var J;if(((J=Zt[0])===null||J===void 0?void 0:J.isFrozen())&&V.type!==Q.FullSnapshot&&!(V.type===Q.IncrementalSnapshot&&V.data.source===$.Mutation)&&Zt.forEach(we=>we.unfreeze()),k)t==null||t(ce(V),Oe);else if(B){const we={type:"rrweb",event:ce(V),origin:window.location.origin,isCheckout:Oe};window.parent.postMessage(we,"*")}if(V.type===Q.FullSnapshot)X=V,ne=0;else if(V.type===Q.IncrementalSnapshot){if(V.data.source===$.Mutation&&V.data.isAttachIframe)return;ne++;const we=r&&ne>=r,zt=n&&V.timestamp-X.timestamp>n;(we||zt)&&qr(!0)}};const q=V=>{de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.Mutation},V)}))},Ke=V=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.Scroll},V)})),Se=V=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.CanvasMutation},V)})),dt=V=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.AdoptedStyleSheet},V)})),De=new Rh({mutationCb:q,adoptedStyleSheetCb:dt}),it=new mh({mirror:Xe,mutationCb:q,stylesheetManager:De,recordCrossOriginIframes:C,wrappedEmit:de});for(const V of N||[])V.getMirror&&V.getMirror({nodeMirror:Xe,crossOriginIframeMirror:it.crossOriginIframeMirror,crossOriginIframeStyleMirror:it.crossOriginIframeStyleMirror});const Gt=new Lh;no=new Th({recordCanvas:_,mutationCb:Se,win:window,blockClass:i,blockSelector:o,mirror:Xe,sampling:y.canvas,dataURLOptions:v});const Je=new gh({mutationCb:q,scrollCb:Ke,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:Z,dataURLOptions:v,maskTextFn:m,maskInputFn:h,recordCanvas:_,inlineImages:x,sampling:y,slimDOMOptions:se,iframeManager:it,stylesheetManager:De,canvasManager:no,keepIframeSrcFn:M,processedNodeManager:Gt},mirror:Xe});qr=(V=!1)=>{de(ve({type:Q.Meta,data:{href:window.location.href,width:Nl(),height:Ol()}}),V),De.reset(),Je.init(),Zt.forEach(J=>J.lock());const Oe=qp(document,{mirror:Xe,blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:Z,maskTextFn:m,slimDOM:se,dataURLOptions:v,recordCanvas:_,inlineImages:x,onSerialize:J=>{Dl(J,Xe)&&it.addIframe(J),Pl(J,Xe)&&De.trackLinkElement(J),To(J)&&Je.addShadowRoot(J.shadowRoot,document)},onIframeLoad:(J,we)=>{it.attachIframe(J,we),Je.observeAttachShadow(J)},onStylesheetLoad:(J,we)=>{De.attachLinkElement(J,we)},keepIframeSrcFn:M});if(!Oe)return console.warn("Failed to snapshot the document");de(ve({type:Q.FullSnapshot,data:{node:Oe,initialOffset:Ll(window)}}),V),Zt.forEach(J=>J.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&De.adoptStyleSheets(document.adoptedStyleSheets,Xe.getId(document))};try{const V=[],Oe=we=>{var zt;return j(hh)({mutationCb:q,mousemoveCb:(ue,Zi)=>de(ve({type:Q.IncrementalSnapshot,data:{source:Zi,positions:ue}})),mouseInteractionCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.MouseInteraction},ue)})),scrollCb:Ke,viewportResizeCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.ViewportResize},ue)})),inputCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.Input},ue)})),mediaInteractionCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.MediaInteraction},ue)})),styleSheetRuleCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.StyleSheetRule},ue)})),styleDeclarationCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.StyleDeclaration},ue)})),canvasMutationCb:Se,fontCb:ue=>de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.Font},ue)})),selectionCb:ue=>{de(ve({type:Q.IncrementalSnapshot,data:Object.assign({source:$.Selection},ue)}))},blockClass:i,ignoreClass:a,ignoreSelector:s,maskTextClass:u,maskTextSelector:c,maskInputOptions:Z,inlineStylesheet:l,sampling:y,recordCanvas:_,inlineImages:x,userTriggeredOnInput:S,collectFonts:E,doc:we,maskInputFn:h,maskTextFn:m,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:se,dataURLOptions:v,mirror:Xe,iframeManager:it,stylesheetManager:De,shadowDomManager:Je,processedNodeManager:Gt,canvasManager:no,ignoreCSSAttributes:D,plugins:((zt=N==null?void 0:N.filter(ue=>ue.observer))===null||zt===void 0?void 0:zt.map(ue=>({observer:ue.observer,options:ue.options,callback:Zi=>de(ve({type:Q.Plugin,data:{plugin:ue.name,payload:Zi}}))})))||[]},g)};it.addLoadListener(we=>{try{V.push(Oe(we.contentDocument))}catch(zt){console.warn(zt)}});const J=()=>{qr(),V.push(Oe(document)),fi=!0};return document.readyState==="interactive"||document.readyState==="complete"?J():(V.push(xe("DOMContentLoaded",()=>{de(ve({type:Q.DomContentLoaded,data:{}})),A==="DOMContentLoaded"&&J()})),V.push(xe("load",()=>{de(ve({type:Q.Load,data:{}})),A==="load"&&J()},window))),()=>{V.forEach(we=>we()),Gt.destroy(),fi=!1,nh()}}catch(V){console.warn(V)}}wr.addCustomEvent=(e,t)=>{if(!fi)throw new Error("please add custom event after start recording");de(ve({type:Q.Custom,data:{tag:e,payload:t}}))};wr.freezePage=()=>{Zt.forEach(e=>e.freeze())};wr.takeFullSnapshot=e=>{if(!fi)throw new Error("please take full snapshot after start recording");qr(e)};wr.mirror=Xe;var st=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(st||{}),H=(e=>(e.ReplayCapture="replay.capture",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))(H||{}),ql=(e=>(e.SurveyId="survey.id",e))(ql||{});const ka={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",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var Ye=(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))(Ye||{}),Qt=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Qt||{}),oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nh(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={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});var Aa=function(){function e(){}return e.prototype.handleError=function(t){},e}();fn.NoopErrorHandler=Aa;var xa=new Aa;function Uh(e){xa=e}fn.setErrorHandler=Uh;function Dh(){return xa}fn.getErrorHandler=Dh;function Ph(){xa=new Aa}fn.resetErrorHandler=Ph;var Ta={};(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={}))})(Ta);var Kt={},Bn={},pi={exports:{}},Vs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Vs){var Bs=new Uint8Array(16);pi.exports=function(){return Vs(Bs),Bs}}else{var Hs=new Array(16);pi.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Hs[t]=n>>>((t&3)<<3)&255;return Hs}}var $l=[];for(var Pr=0;Pr<256;++Pr)$l[Pr]=(Pr+256).toString(16).substr(1);function Mh(e,t){var n=t||0,r=$l;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 Yl=Mh,Fh=pi.exports,Vh=Yl,Ks,ro,io=0,oo=0;function Bh(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||Ks,a=e.clockseq!==void 0?e.clockseq:ro;if(o==null||a==null){var s=Fh();o==null&&(o=Ks=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ro=(s[6]<<8|s[7])&16383)}var u=e.msecs!==void 0?e.msecs:new Date().getTime(),c=e.nsecs!==void 0?e.nsecs:oo+1,l=u-io+(c-oo)/1e4;if(l<0&&e.clockseq===void 0&&(a=a+1&16383),(l<0||u>io)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");io=u,oo=c,ro=a,u+=122192928e5;var d=((u&268435455)*1e4+c)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=u/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||Vh(i)}var Hh=Bh,Kh=pi.exports,jh=Yl;function Gh(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||Kh)();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||jh(i)}var zh=Gh,Wh=Hh,Zl=zh,Ra=Zl;Ra.v1=Wh;Ra.v4=Zl;var qh=Ra;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=qh;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 u(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=u;function c(d,p){var f={};return d.forEach(function(h){var m=p(h);f[m]=h}),f}e.keyBy=c;function l(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=l,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={}))})(Bn);var $h=oe&&oe.__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(Kt,"__esModule",{value:!0});var Yh=fn,hi=Bn,pe=Ta,js={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function La(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!js[e])?e:js[e]}var Ql=function(){function e(){this.defaultLoggerFacade=new Gs,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new Gs({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),Zh=function(){function e(t){t===void 0&&(t={}),this.logLevel=pe.LogLevel.NOTSET,t.logLevel!==void 0&&hi.isValidEnum(pe.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=La(t),!hi.isValidEnum(pe.LogLevel,t)||t===void 0?this.logLevel=pe.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 pe.LogLevel.DEBUG:return"DEBUG";case pe.LogLevel.INFO:return"INFO ";case pe.LogLevel.WARNING:return"WARN ";case pe.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case pe.LogLevel.DEBUG:console.log.apply(console,n);break;case pe.LogLevel.INFO:console.info.apply(console,n);break;case pe.LogLevel.WARNING:console.warn.apply(console,n);break;case pe.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();Kt.ConsoleLogHandler=Zh;var ur=pe.LogLevel.NOTSET,Lo=null,Gs=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(La(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(pe.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(pe.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(pe.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(pe.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+hi.sprintf.apply(void 0,$h([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Lo||t<ur||(Lo.log(t,this.format(n)),n.error&&n.error instanceof Error&&Yh.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}(),Jl=new Ql;function Qh(e){return Jl.getLogger(e)}Kt.getLogger=Qh;function Jh(e){Lo=e}Kt.setLogHandler=Jh;function Xh(e){e=La(e),!hi.isValidEnum(pe.LogLevel,e)||e===void 0?ur=pe.LogLevel.ERROR:ur=e}Kt.setLogLevel=Xh;function em(){return ur}Kt.getLogLevel=em;function tm(){Jl=new Ql,ur=pe.LogLevel.NOTSET}Kt.resetLogger=tm;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(fn),t(Ta),t(Kt)})(Ie);var nm={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.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}Ir.areEventContextsEqual=rm;var Oa={},Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.DefaultEventQueue=Ln.SingleEventQueue=void 0;var im=Ie,om=im.getLogger("EventProcessor"),am=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}(),sm=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}();Ln.SingleEventQueue=sm;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 am({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}();Ln.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=Ln,n=Ie,r=Bn;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(c){return c<=0&&(i.warn("Invalid flushInterval "+c+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),c=e.DEFAULT_FLUSH_INTERVAL),c}e.validateAndGetFlushInterval=o;function a(c){return c=Math.floor(c),c<1&&(i.warn("Invalid batchSize "+c+", defaulting to "+e.DEFAULT_BATCH_SIZE),c=e.DEFAULT_BATCH_SIZE),c=Math.max(1,c),c}e.validateAndGetBatchSize=a;function s(c,l,d,p){var f;return c>1?f=new t.DefaultEventQueue({flushInterval:l,maxQueueSize:c,sink:d,batchComparator:p}):f=new t.SingleEventQueue({sink:d}),f}e.getQueue=s;function u(c,l){c&&c.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,l)}e.sendEventNotification=u})(Oa);var Xl={};Object.defineProperty(Xl,"__esModule",{value:!0});var ec={};Object.defineProperty(ec,"__esModule",{value:!0});var On={},Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.LocalStorageStore=void 0;var lm=Bn,cm=Ie,zs=cm.getLogger("EventProcessor"),dm=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 lm.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){zs.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){zs.error(n)}return{}},e}();Fi.LocalStorageStore=dm;var fm=oe&&oe.__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(On,"__esModule",{value:!0});On.LocalStoragePendingEventsDispatcher=On.PendingEventsDispatcher=void 0;var pm=Ie,hm=Fi,Ws=Bn,mm=pm.getLogger("EventProcessor"),tc=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:Ws.generateUUID(),timestamp:Ws.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();mm.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}();On.PendingEventsDispatcher=tc;var gm=function(e){fm(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new hm.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(tc);On.LocalStoragePendingEventsDispatcher=gm;var et={},Oo=oe&&oe.__assign||function(){return Oo=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},Oo.apply(this,arguments)};Object.defineProperty(et,"__esModule",{value:!0});et.formatEvents=et.buildConversionEventV1=et.buildImpressionEventV1=et.makeBatchedEventV1=void 0;var vm="campaign_activated",ym="custom",qs="$opt_bot_filtering";function nc(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=Na(r);r.type==="impression"?i.snapshots.push(ic(r)):r.type==="conversion"&&i.snapshots.push(rc(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}}et.makeBatchedEventV1=nc;function rc(e){var t=Oo({},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 ic(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,u=e.ruleType,c=e.enabled,l=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:l,experiment_id:d,variation_id:p,metadata:{flag_key:s,rule_key:a,rule_type:u,variation_key:f,enabled:c}}],events:[{entity_id:l,timestamp:e.timestamp,key:vm,uuid:e.uuid}]}}function Na(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:qs,key:qs,type:ym,value:e.context.botFiltering}),t}function _m(e){var t=Na(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]}}et.buildImpressionEventV1=_m;function bm(e){var t=Na(e);return t.snapshots.push(rc(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]}}et.buildConversionEventV1=bm;function wm(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:nc(e)}}et.formatEvents=wm;var Vi={},Ua={};Object.defineProperty(Ua,"__esModule",{value:!0});var Im=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}();Ua.default=Im;var Sm=oe&&oe.__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(l){try{c(r.next(l))}catch(d){a(d)}}function u(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(s,u)}c((r=r.apply(e,t||[])).next())})},Cm=oe&&oe.__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(c){return function(l){return u([c,l])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Em=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vi,"__esModule",{value:!0});Vi.LogTierV1EventProcessor=void 0;var km=Ie,yn=Oa,Am=Em(Ua),xm=Ir,Tm=et,$s=km.getLogger("LogTierV1EventProcessor"),Rm=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?yn.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?yn.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Am.default,i=yn.validateAndGetFlushInterval(i),a=yn.validateAndGetBatchSize(a),this.queue=yn.getQueue(a,i,this.drainQueue.bind(this),xm.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if($s.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Tm.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),yn.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){$s.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Sm(this,void 0,void 0,function(){return Cm(this,function(t){return this.queue.start(),[2]})})},e}();Vi.LogTierV1EventProcessor=Rm;(function(e){var t=oe&&oe.__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=oe&&oe.__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(Ir,e),n(Oa,e),n(Xl,e),n(ec,e),n(On,e),n(et,e),n(Vi,e)})(nm);var mi={exports:{}},Ys=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Ys){var Zs=new Uint8Array(16);mi.exports=function(){return Ys(Zs),Zs}}else{var Qs=new Array(16);mi.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Qs[t]=n>>>((t&3)<<3)&255;return Qs}}var oc=[];for(var Mr=0;Mr<256;++Mr)oc[Mr]=(Mr+256).toString(16).substr(1);function Lm(e,t){var n=t||0,r=oc;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 ac=Lm,Om=mi.exports,Nm=ac,Js,ao,so=0,uo=0;function Um(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||Js,a=e.clockseq!==void 0?e.clockseq:ao;if(o==null||a==null){var s=Om();o==null&&(o=Js=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ao=(s[6]<<8|s[7])&16383)}var u=e.msecs!==void 0?e.msecs:new Date().getTime(),c=e.nsecs!==void 0?e.nsecs:uo+1,l=u-so+(c-uo)/1e4;if(l<0&&e.clockseq===void 0&&(a=a+1&16383),(l<0||u>so)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");so=u,uo=c,ao=a,u+=122192928e5;var d=((u&268435455)*1e4+c)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var p=u/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||Nm(i)}var Dm=Um,Pm=mi.exports,Mm=ac;function Fm(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||Pm)();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||Mm(i)}var Vm=Fm,Bm=Dm,sc=Vm,uc=sc;uc.v1=Bm;uc.v4=sc;var Hm={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,u=0,c;a>=4;)c=i.charCodeAt(u)&255|(i.charCodeAt(++u)&255)<<8|(i.charCodeAt(++u)&255)<<16|(i.charCodeAt(++u)&255)<<24,c=(c&65535)*1540483477+(((c>>>16)*1540483477&65535)<<16),c^=c>>>24,c=(c&65535)*1540483477+(((c>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^c,a-=4,++u;switch(a){case 3:s^=(i.charCodeAt(u+2)&255)<<16;case 2:s^=(i.charCodeAt(u+1)&255)<<8;case 1:s^=i.charCodeAt(u)&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,u,c,l,d,p,f;for(a=i.length&3,s=i.length-a,u=o,l=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)*l+(((p>>>16)*l&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,u^=p,u=u<<13|u>>>19,c=(u&65535)*5+(((u>>>16)*5&65535)<<16)&4294967295,u=(c&65535)+27492+(((c>>>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)*l+(((p>>>16)*l&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*d+(((p>>>16)*d&65535)<<16)&4294967295,u^=p}return u^=i.length,u^=u>>>16,u=(u&65535)*2246822507+(((u>>>16)*2246822507&65535)<<16)&4294967295,u^=u>>>13,u=(u&65535)*3266489909+(((u>>>16)*3266489909&65535)<<16)&4294967295,u^=u>>>16,u>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(Hm);var lc={},Da={},Pa={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});lt.DEFAULT_UPDATE_INTERVAL=5*60*1e3;lt.MIN_UPDATE_INTERVAL=1e3;lt.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";lt.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";lt.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];lt.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(Pa,"__esModule",{value:!0});var Km=lt,jm=Ie,Gm=jm.getLogger("DatafileManager"),zm="GET",Wm=4;function qm(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 $m(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function Ym(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(zm,e,!0),$m(t,n),n.onreadystatechange=function(){if(n.readyState===Wm){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=qm(n),u={statusCode:n.status,body:n.responseText,headers:s};i(u)}},n.timeout=Km.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Gm.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Pa.makeGetRequest=Ym;var Ma={},Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});var Zm=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}();Fa.default=Zm;var Va={};Object.defineProperty(Va,"__esModule",{value:!0});var lo=lt;function Qm(){return Math.round(Math.random()*1e3)}var Jm=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=lo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(lo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Qm()},e.prototype.countError=function(){this.errorCount<lo.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();Va.default=Jm;var gi=oe&&oe.__assign||function(){return gi=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},gi.apply(this,arguments)},cc=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ma,"__esModule",{value:!0});var Xm=Ie,eg=Bn,tg=cc(Fa),qn=lt,ng=cc(Va),je=Xm.getLogger("DatafileManager"),rg="update";function ig(e){return e>=qn.MIN_UPDATE_INTERVAL}function Xs(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()}},ag=function(){function e(t){var n=this,r=gi(gi({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,u=r.updateInterval,c=u===void 0?qn.DEFAULT_UPDATE_INTERVAL:u,l=r.urlTemplate,d=l===void 0?qn.DEFAULT_URL_TEMPLATE:l,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=eg.sprintf(d,s),this.emitter=new tg.default,this.autoUpdate=a,ig(c)?this.updateInterval=c:(je.warn("Invalid updateInterval %s, defaulting to %s",c,qn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=qn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new ng.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(je.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return je.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?je.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?je.error("Error fetching datafile: %s",t):je.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Xs(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(je.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),je.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);je.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 je.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Xs(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,je.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!==""&&(je.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ma.default=ag;var sg=oe&&oe.__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=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Da,"__esModule",{value:!0});var lg=Pa,cg=ug(Ma),dg=function(e){sg(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return lg.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(cg.default);Da.default=dg;Object.defineProperty(lc,"__esModule",{value:!0});var fg=Da;lc.HttpPollingDatafileManager=fg.default;var pg={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},hg={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."},mg={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"'},gg={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"},vg="javascript-sdk",yg="node-sdk",_g="react-sdk",bg="react-native-sdk",wg="react-native-js-sdk",Ig="4.9.4",Sg="4.9.4",Cg={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Eg={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},kg={RULE:"rule",EXPERIMENT:"experiment"},Ag={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},$r={V2:"2",V3:"3",V4:"4"},xg={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.'},No;(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"})(No||(No={}));var Tg=Object.freeze({__proto__:null,LOG_LEVEL:pg,ERROR_MESSAGES:hg,LOG_MESSAGES:mg,CONTROL_ATTRIBUTES:gg,JAVASCRIPT_CLIENT_ENGINE:vg,NODE_CLIENT_ENGINE:yg,REACT_CLIENT_ENGINE:_g,REACT_NATIVE_CLIENT_ENGINE:bg,REACT_NATIVE_JS_CLIENT_ENGINE:wg,BROWSER_CLIENT_VERSION:Ig,NODE_CLIENT_VERSION:Sg,DECISION_NOTIFICATION_TYPES:Cg,DECISION_SOURCES:Eg,AUDIENCE_EVALUATION_TYPES:kg,FEATURE_VARIABLE_TYPES:Ag,DATAFILE_VERSIONS:$r,DECISION_MESSAGES:xg,get NOTIFICATION_TYPES(){return No}});$r.V2,$r.V3,$r.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Rg(e){return new Ie.ConsoleLogHandler(e)}var eu;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(eu||(eu={}));var tu;(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"})(tu||(tu={}));Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger("EVENT_BUILDER");Ie.getLogger();Ie.setLogHandler(Rg());Ie.setLogLevel(Ie.LogLevel.INFO);let Fr;const Lg=new Uint8Array(16);function Og(){if(!Fr&&(Fr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Fr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fr(Lg)}const Ce=[];for(let e=0;e<256;++e)Ce.push((e+256).toString(16).slice(1));function Ng(e,t=0){return(Ce[e[t+0]]+Ce[e[t+1]]+Ce[e[t+2]]+Ce[e[t+3]]+"-"+Ce[e[t+4]]+Ce[e[t+5]]+"-"+Ce[e[t+6]]+Ce[e[t+7]]+"-"+Ce[e[t+8]]+Ce[e[t+9]]+"-"+Ce[e[t+10]]+Ce[e[t+11]]+Ce[e[t+12]]+Ce[e[t+13]]+Ce[e[t+14]]+Ce[e[t+15]]).toLowerCase()}const Ug=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),nu={randomUUID:Ug};function Pt(e,t,n){if(nu.randomUUID&&!t&&!e)return nu.randomUUID();e=e||{};const r=e.random||(e.rng||Og)();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 Ng(r)}const An="ul-app";var O=(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))(O||{});const Ba="#e6e6e6",er="#bd282a",Dg=500,Pg=1030;var Ge=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Ge||{}),Ee=(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))(Ee||{}),qe=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(qe||{}),G=(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))(G||{}),Ve=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(Ve||{});const dc=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Mg=()=>{const e=dc();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Fg=()=>{const e=dc();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Vg=Object.freeze(Object.defineProperty({__proto__:null,enable:Mg,disable:Fg},Symbol.toStringTag,{value:"Module"})),ru=[Vg];class Uo{static disable(){ru.forEach(t=>t.disable())}static enable(){ru.forEach(t=>t.enable())}}const Bg=1,iu=e=>e instanceof HTMLElement||e instanceof SVGElement,fc=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=O.CustomStyle,e.head.appendChild(r)},pc=e=>{const t=e.querySelector(`.${O.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+Bg},Hg=e=>{const t=e.querySelector(`.${O.CardContainer}`);t&&(t.scrollTop=0)};var Kg=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"}},hc=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=hc.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 Kg(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)}},mc=hc;mc.defaultMaxListeners=10;const K=new mc;var $n=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))($n||{}),at=(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))(at||{}),sn=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(sn||{}),tn=(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))(tn||{});const vi=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),xn=({"userleap-platform":e})=>e!==sn.Web,ye=(e,t)=>{const n=t?O.MobileSuffix:O.DesktopSuffix;return[e+n,e]},jg=(e,t)=>[e,`${e}__${t}`];class gc{constructor(t){ge(this,"storage");ge(this,"tempStorage",{});ge(this,"isStorageAvailable");this.storage=window[t],this.isStorageAvailable=this.checkIfStorageAvailable()}checkIfStorageAvailable(){try{const t="__storage_test__";return this.storage.setItem(t,t),this.storage.removeItem(t),!0}catch{return!1}}setItem(t,n){this.isStorageAvailable?this.storage.setItem(t,n):this.tempStorage[t]=n}getItem(t){return this.isStorageAvailable?this.storage.getItem(t):this.tempStorage[t]}removeItem(t){this.isStorageAvailable?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable?this.storage.clear():this.tempStorage={}}}const Mt=new gc("sessionStorage"),Fe=new gc("localStorage");class Gg{constructor(t){ge(this,"payload");ge(this,"promise");ge(this,"reject",()=>{});ge(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const zg={RATELIMIT_RESET_DEFAULT:10};let vc=!1,yc="",Vr=!1,_c=!1,Yr=[];const Wg=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?tn.Gtm:e._segment?tn.Segment:tn.Snippet,Do=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(_c=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Do))},Po=(e="")=>{vc=!0,yc=e};function Nn(e={}){const t={"Content-Type":"application/json","userleap-platform":sn.Web,"x-ul-sdk-version":"2.24.12-beta.0",[at.InstallationMethod]:Wg(e)};if(t["x-ul-bundled-sdk-version"]="1.0.2",e.envId&&(t[at.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[at.UserID]=e.userId),e.visitorId&&(t[at.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[at.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[at.PreviewMode]="1"),t}const ou=async(e,t,n)=>{if(e)return{status:429};{const r=new Gg(n);return Yr.push(r),r.promise}},wt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Vr&&!i)return ou(r,i,o);const a={ok:!1,reportError:!1};if(vc)return console.info(`UserLeap - ${yc}`),a;try{t.headers=Object.assign(Nn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Vr&&!r||i){Vr=!0;const c=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):zg.RATELIMIT_RESET_DEFAULT;return await vi(c*1e3),wt(e,t,0,r,!0)}else return ou(r,!1,o);if(Vr=!1,Yr.length&&(Yr.map(u=>{const{url:c,options:l,attempt:d,shouldDropOnRateLimit:p}=u.payload;wt(c,l,d,p).then(f=>{u.resolveRequest(f)})}),Yr=[]),s.ok){if(s.status===249)return Po(),a;const u=await s.text();try{return u&&u!=="OK"&&(s.json=JSON.parse(u)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${u}`)}}}return s}catch(s){const u=n+1;return u>5||_c?{ok:!1,reportError:!1,error:s}:(await vi(Math.pow(2,n)*1e3),wt(e,t,u))}};var bc={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(oe,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(c,l){var d=a.retries,p=a.retryDelay,f=a.retryOn;if(l&&l.retries!==void 0)if(r(l.retries))d=l.retries;else throw new i("retries must be a positive integer");if(l&&l.retryDelay!==void 0)if(r(l.retryDelay)||typeof l.retryDelay=="function")p=l.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(l&&l.retryOn)if(Array.isArray(l.retryOn)||typeof l.retryOn=="function")f=l.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,m){var g=function(y){var v=typeof Request<"u"&&c instanceof Request?c.clone():c;o(v,l).then(function(b){if(Array.isArray(f)&&f.indexOf(b.status)===-1)h(b);else if(typeof f=="function")try{return Promise.resolve(f(y,null,b)).then(function(_){_?w(y,null,b):h(b)}).catch(m)}catch(_){m(_)}else y<d?w(y,null,b):h(b)}).catch(function(b){if(typeof f=="function")try{Promise.resolve(f(y,b,null)).then(function(_){_?w(y,b,null):m(b)}).catch(function(_){m(_)})}catch(_){m(_)}else y<d?w(y,b,null):m(b)})};function w(y,v,b){var _=typeof p=="function"?p(y,v,b):p;setTimeout(function(){g(++y)},_)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(bc);const qg=bc.exports;class $g{constructor(t){ge(this,"awaitingResolvers",[]);ge(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 wc=new $g(2),Yg=e=>wc.setLimit(e),Zg=qg(fetch),Qg=async(e,t=3)=>wc.execute(async()=>{const r=(await Zg(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}),Ic=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},u=!1)=>{var c;if(!(!u&&!n&&!r))return wt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(c=window==null?void 0:window.navigator)==null?void 0:c.userAgent}),headers:i})};/*! *****************************************************************************
21
- Copyright (c) Microsoft Corporation.
22
- Permission to use, copy, modify, and/or distribute this software for any
23
- purpose with or without fee is hereby granted.
24
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
25
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
27
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
- PERFORMANCE OF THIS SOFTWARE.
31
- ***************************************************************************** */var z=function(){return z=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},z.apply(this,arguments)};function Mo(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 re=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,me=Object.keys,Ae=Array.isArray;typeof Promise<"u"&&!re.Promise&&(re.Promise=Promise);function Le(e,t){return typeof t!="object"||me(t).forEach(function(n){e[n]=t[n]}),e}var lr=Object.getPrototypeOf,Jg={}.hasOwnProperty;function He(e,t){return Jg.call(e,t)}function Un(e,t){typeof t=="function"&&(t=t(lr(e))),(typeof Reflect>"u"?me:Reflect.ownKeys)(t).forEach(function(n){Ct(e,n,t[n])})}var Sc=Object.defineProperty;function Ct(e,t,n,r){Sc(e,t,Le(n&&He(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function Hn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),Ct(e.prototype,"constructor",e),{extend:Un.bind(null,e.prototype)}}}}var Xg=Object.getOwnPropertyDescriptor;function Ha(e,t){var n=Xg(e,t),r;return n||(r=lr(e))&&Ha(r,t)}var ev=[].slice;function Bi(e,t,n){return ev.call(e,t,n)}function Cc(e,t){return t(e)}function Yn(e){if(!e)throw new Error("Assertion Failed")}function Ec(e){re.setImmediate?setImmediate(e):setTimeout(e,0)}function kc(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function tv(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function It(e,t){if(He(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=It(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:It(s,t.substr(a+1))}}function nt(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){Yn(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)nt(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?Ae(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var u=e[a];(!u||!He(e,a))&&(u=e[a]={}),nt(u,s,n)}}else n===void 0?Ae(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function nv(e,t){typeof t=="string"?nt(e,t,void 0):"length"in t&&[].map.call(t,function(n){nt(e,n,void 0)})}function Ac(e){var t={};for(var n in e)He(e,n)&&(t[n]=e[n]);return t}var rv=[].concat;function xc(e){return rv.apply([],e)}var Tc="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(xc([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return re[e]}),iv=Tc.map(function(e){return re[e]});kc(Tc,function(e){return[e,!0]});var Ot=null;function Sr(e){Ot=typeof WeakMap<"u"&&new WeakMap;var t=Fo(e);return Ot=null,t}function Fo(e){if(!e||typeof e!="object")return e;var t=Ot&&Ot.get(e);if(t)return t;if(Ae(e)){t=[],Ot&&Ot.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Fo(e[n]))}else if(iv.indexOf(e.constructor)>=0)t=e;else{var i=lr(e);t=i===Object.prototype?{}:Object.create(i),Ot&&Ot.set(e,t);for(var o in e)He(e,o)&&(t[o]=Fo(e[o]))}return t}var ov={}.toString;function Vo(e){return ov.call(e).slice(8,-1)}var Bo=typeof Symbol<"u"?Symbol.iterator:"@@iterator",av=typeof Bo=="symbol"?function(e){var t;return e!=null&&(t=e[Bo])&&t.apply(e)}:function(){return null},In={};function gt(e){var t,n,r,i;if(arguments.length===1){if(Ae(e))return e.slice();if(this===In&&typeof e=="string")return[e];if(i=av(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 Ka=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},ct=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Rc(e,t){ct=e,Lc=t}var Lc=function(){return!0},sv=!new Error("").stack;function pn(){if(sv)try{throw pn.arguments,new Error}catch(e){return e}return new Error}function Ho(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
32
- `).length),n.split(`
33
- `).slice(t).filter(Lc).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"],Oc=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ja=uv.concat(Oc),lv={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 Kn(e,t){this._e=pn(),this.name=e,this.message=t}Hn(Kn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Ho(this._e,2))}},toString:function(){return this.name+": "+this.message}});function Nc(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 yi(e,t,n,r){this._e=pn(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Nc(e,t)}Hn(yi).from(Kn);function tr(e,t){this._e=pn(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=Nc(e,t)}Hn(tr).from(Kn);var Ga=ja.reduce(function(e,t){return e[t]=t+"Error",e},{}),cv=Kn,F=ja.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=pn(),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=lv[t]||n,this.inner=null)}return Hn(r).from(cv),e[t]=r,e},{});F.Syntax=SyntaxError;F.Type=TypeError;F.Range=RangeError;var au=Oc.reduce(function(e,t){return e[t+"Error"]=F[t],e},{});function dv(e,t){if(!e||e instanceof Kn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!au[e.name])return e;var n=new au[e.name](t||e.message,e);return"stack"in e&&Ct(n,"stack",{get:function(){return this.inner.stack}}),n}var Hi=ja.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=F[t]),e},{});Hi.ModifyError=yi;Hi.DexieError=Kn;Hi.BulkError=tr;function ee(){}function Cr(e){return e}function fv(e,t){return e==null||e===Cr?t:function(n){return t(e(n))}}function un(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function pv(e,t){return e===ee?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?un(r,this.onsuccess):r),i&&(this.onerror=this.onerror?un(i,this.onerror):i),o!==void 0?o:n}}function hv(e,t){return e===ee?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?un(n,this.onsuccess):n),r&&(this.onerror=this.onerror?un(r,this.onerror):r)}}function mv(e,t){return e===ee?t:function(n){var r=e.apply(this,arguments);Le(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?un(i,this.onsuccess):i),o&&(this.onerror=this.onerror?un(o,this.onerror):o),r===void 0?a===void 0?void 0:a:Le(r,a)}}function gv(e,t){return e===ee?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function za(e,t){return e===ee?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 cr={},vv=100,yv=20,Uc=100,Wa=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,lr(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,lr(t),e]}(),Ko=Wa[0],_i=Wa[1],jo=Wa[2],Dc=_i&&_i.then,Zr=Ko&&Ko.constructor,qa=!!jo,Go=!1,_v=jo?function(){jo.then(Br)}:re.setImmediate?setImmediate.bind(null,Br):re.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){Br(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Br,0)},dr=function(e,t){Zn.push([e,t]),bi&&(_v(),bi=!1)},zo=!0,bi=!0,nn=[],Qr=[],Wo=null,qo=Cr,Tn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:lu,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{lu(e[0],e[1])}catch{}})}},P=Tn,Zn=[],rn=0,Jr=[];function L(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ee,this._lib=!1;var t=this._PSD=P;if(ct&&(this._stackHolder=pn(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==cr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Yo(this,this._value);return}this._state=null,this._value=null,++t.ref,Mc(this,e)}var $o={get:function(){var e=P,t=wi;function n(r,i){var o=this,a=!e.global&&(e!==P||t!==wi),s=a&&!Et(),u=new L(function(c,l){$a(o,new Pc(Si(r,e,a,s),Si(i,e,a,s),c,l,e))});return ct&&Bc(u,this),u}return n.prototype=cr,n},set:function(e){Ct(this,"then",e&&e.prototype===cr?$o:{get:function(){return e},set:$o.set})}};Un(L.prototype,{then:$o,_then:function(e,t){$a(this,new Pc(null,null,e,t,P))},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):Xr(r)}):this.then(null,function(r){return r&&r.name===t?n(r):Xr(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),Xr(t)})},stack:{get:function(){if(this._stack)return this._stack;try{Go=!0;var e=Vc(this,[],yv),t=e.join(`
37
- From previous: `);return this._state!==null&&(this._stack=t),t}finally{Go=!1}}},timeout:function(e,t){var n=this;return e<1/0?new L(function(r,i){var o=setTimeout(function(){return i(new F.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&Ct(L.prototype,Symbol.toStringTag,"Dexie.Promise");Tn.env=Hc();function Pc(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}Un(L,{all:function(){var e=gt.apply(null,arguments).map(Ii);return new L(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return L.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof L)return e;if(e&&typeof e.then=="function")return new L(function(n,r){e.then(n,r)});var t=new L(cr,!0,e);return Bc(t,Wo),t},reject:Xr,race:function(){var e=gt.apply(null,arguments).map(Ii);return new L(function(t,n){e.map(function(r){return L.resolve(r).then(t,n)})})},PSD:{get:function(){return P},set:function(e){return P=e}},totalEchoes:{get:function(){return wi}},newPSD:Ft,usePSD:Gn,scheduler:{get:function(){return dr},set:function(e){dr=e}},rejectionMapper:{get:function(){return qo},set:function(e){qo=e}},follow:function(e,t){return new L(function(n,r){return Ft(function(i,o){var a=P;a.unhandleds=[],a.onunhandled=o,a.finalize=un(function(){var s=this;wv(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});Zr&&(Zr.allSettled&&Ct(L,"allSettled",function(){var e=gt.apply(null,arguments).map(Ii);return new L(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return L.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)})})})}),Zr.any&&typeof AggregateError<"u"&&Ct(L,"any",function(){var e=gt.apply(null,arguments).map(Ii);return new L(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return L.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function Mc(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&&Er();n&&typeof n.then=="function"?Mc(e,function(i,o){n instanceof L?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,Fc(e)),r&&kr()}},Yo.bind(null,e))}catch(n){Yo(e,n)}}function Yo(e,t){if(Qr.push(t),e._state===null){var n=e._lib&&Er();t=qo(t),e._state=!1,e._value=t,ct&&t!==null&&typeof t=="object"&&!t._promise&&tv(function(){var r=Ha(t,"stack");t._promise=e,Ct(t,"stack",{get:function(){return Go?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),Iv(e),Fc(e),n&&kr()}}function Fc(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)$a(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),rn===0&&(++rn,dr(function(){--rn===0&&Ya()},[]))}function $a(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,++rn,dr(bv,[n,e,t])}function bv(e,t,n){try{Wo=t;var r,i=t._value;t._state?r=e(i):(Qr.length&&(Qr=[]),r=e(i),Qr.indexOf(i)===-1&&Sv(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Wo=null,--rn===0&&Ya(),--n.psd.ref||n.psd.finalize()}}function Vc(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=Ho(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return ct&&(r=Ho(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&Vc(e._prev,t,n)),t}function Bc(e,t){var n=t?t._numPrev+1:0;n<vv&&(e._prev=t,e._numPrev=n)}function Br(){Er()&&kr()}function Er(){var e=zo;return zo=!1,bi=!1,e}function kr(){var e,t,n;do for(;Zn.length>0;)for(e=Zn,Zn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(Zn.length>0);zo=!0,bi=!0}function Ya(){var e=nn;nn=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=Jr.slice(0),n=t.length;n;)t[--n]()}function wv(e){function t(){e(),Jr.splice(Jr.indexOf(t),1)}Jr.push(t),++rn,dr(function(){--rn===0&&Ya()},[])}function Iv(e){nn.some(function(t){return t._value===e._value})||nn.push(e)}function Sv(e){for(var t=nn.length;t;)if(nn[--t]._value===e._value){nn.splice(t,1);return}}function Xr(e){return new L(cr,!1,e)}function ae(e,t){var n=P;return function(){var r=Er(),i=P;try{return Vt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{Vt(i,!1),r&&kr()}}}var ke={awaits:0,echoes:0,id:0},Cv=0,ei=[],co=0,wi=0,Ev=0;function Ft(e,t,n,r){var i=P,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ev;var a=Tn.env;o.env=qa?{Promise:L,PromiseProp:{value:L,configurable:!0,writable:!0},all:L.all,race:L.race,allSettled:L.allSettled,any:L.any,resolve:L.resolve,reject:L.reject,nthen:su(a.nthen,o),gthen:su(a.gthen,o)}:{},t&&Le(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=Gn(o,e,n,r);return o.ref===0&&o.finalize(),s}function jn(){return ke.id||(ke.id=++Cv),++ke.awaits,ke.echoes+=Uc,ke.id}function Et(){return ke.awaits?(--ke.awaits===0&&(ke.id=0),ke.echoes=ke.awaits*Uc,!0):!1}(""+Dc).indexOf("[native code]")===-1&&(jn=Et=ee);function Ii(e){return ke.echoes&&e&&e.constructor===Zr?(jn(),e.then(function(t){return Et(),t},function(t){return Et(),be(t)})):e}function kv(e){++wi,(!ke.echoes||--ke.echoes===0)&&(ke.echoes=ke.id=0),ei.push(P),Vt(e,!0)}function Av(){var e=ei[ei.length-1];ei.pop(),Vt(e,!1)}function Vt(e,t){var n=P;if((t?ke.echoes&&(!co++||e!==P):co&&(!--co||e!==P))&&Kc(t?kv.bind(null,e):Av),e!==P&&(P=e,n===Tn&&(Tn.env=Hc()),qa)){var r=Tn.env.Promise,i=e.env;_i.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(re,"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 Hc(){var e=re.Promise;return qa?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(re,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:_i.then,gthen:e.prototype.then}:{}}function Gn(e,t,n,r,i){var o=P;try{return Vt(e,!0),t(n,r,i)}finally{Vt(o,!1)}}function Kc(e){Dc.call(Ko,e)}function Si(e,t,n,r){return typeof e!="function"?e:function(){var i=P;n&&jn(),Vt(t,!0);try{return e.apply(this,arguments)}finally{Vt(i,!1),r&&Kc(Et)}}}function su(e,t){return function(n,r){return e.call(this,Si(n,t),Si(r,t))}}var uu="unhandledrejection";function lu(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(re.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(uu,!0,!0),Le(r,i)):re.CustomEvent&&(r=new CustomEvent(uu,{detail:i}),Le(r,i)),r&&re.dispatchEvent&&(dispatchEvent(r),!re.PromiseRejectionEvent&&re.onunhandledrejection))try{re.onunhandledrejection(r)}catch{}ct&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var be=L.reject;function Zo(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!P.letThrough&&!e._vip){if(e._state.openComplete)return be(new F.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return be(new F.DatabaseClosed);e.open().catch(ee)}return e._state.dbReadyPromise.then(function(){return Zo(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===Ga.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Zo(e,t,n,r)})):be(o)}return i._promise(t,function(o,a){return Ft(function(){return P.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var cu="3.2.4",Jt=String.fromCharCode(65535),Qo=-1/0,ft="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",jc="String expected.",nr=[],Ki=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),xv=Ki,Tv=Ki,Gc=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},ji="__dbnames",fo="readonly",po="readwrite";function ln(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var zc={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Hr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Sr(t),delete t[e]),t}:function(t){return t}}var Rv=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||P.trans,o=this.name;function a(u,c,l){if(!l.schema[o])throw new F.NotFound("Table "+o+" not part of transaction");return n(l.idbtrans,l)}var s=Er();try{return i&&i.db===this.db?i===P.trans?i._promise(t,a,r):Ft(function(){return i._promise(t,a,r)},{trans:i,transless:P.transless||P}):Zo(this.db,t,[this.name],a)}finally{s&&kr()}},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(Ae(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=me(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(l){return l.compound&&n.every(function(d){return l.keyPath.indexOf(d)>=0})&&l.keyPath.every(function(d){return n.indexOf(d)>=0})})[0];if(r&&this.db._maxKey!==Jt)return this.where(r.name).equals(r.keyPath.map(function(l){return t[l]}));!r&&ct&&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(l,d){try{return o.cmp(l,d)===0}catch{return!1}}var s=n.reduce(function(l,d){var p=l[0],f=l[1],h=i[d],m=t[d];return[p||h,p||!h?ln(f,h&&h.multi?function(g){var w=It(g,d);return Ae(w)&&w.some(function(y){return a(m,y)})}:function(g){return a(m,It(g,d))}):f]},[null,null]),u=s[0],c=s[1];return u?this.where(u.name).equals(t[u.keyPath]).filter(c):r?this.filter(c):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,Ae(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(He(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){Le(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=Hr(a)(t)),this._trans("readwrite",function(u){return r.core.mutate({trans:u,type:"add",keys:n!=null?[n]:null,values:[s]})}).then(function(u){return u.numFailures?L.reject(u.failures[0]):u.lastResult}).then(function(u){if(a)try{nt(t,a,u)}catch{}return u})},e.prototype.update=function(t,n){if(typeof t=="object"&&!Ae(t)){var r=It(t,this.schema.primKey.keyPath);if(r===void 0)return be(new F.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?me(n).forEach(function(i){nt(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=Hr(a)(t)),this._trans("readwrite",function(u){return r.core.mutate({trans:u,type:"put",values:[s],keys:n!=null?[n]:null})}).then(function(u){return u.numFailures?L.reject(u.failures[0]):u.lastResult}).then(function(u){if(a)try{nt(t,a,u)}catch{}return u})},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?L.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:zc})}).then(function(n){return n.numFailures?L.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 u=i.schema.primKey,c=u.auto,l=u.keyPath;if(l&&o)throw new F.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new F.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=l&&c?t.map(Hr(l)):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,w=f.failures,y=a?m:g;if(h===0)return y;throw new tr(i.name+".bulkAdd(): "+h+" of "+d+" operations failed",w)})})},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 u=i.schema.primKey,c=u.auto,l=u.keyPath;if(l&&o)throw new F.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new F.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,p=l&&c?t.map(Hr(l)):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,w=f.failures,y=a?m:g;if(h===0)return y;throw new tr(i.name+".bulkPut(): "+h+" of "+d+" operations failed",w)})})},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 tr(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function Ar(e){var t={},n=function(s,u){if(u){for(var c=arguments.length,l=new Array(c-1);--c;)l[c-1]=arguments[c];return t[s].subscribe.apply(null,l),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,u,c){if(typeof s=="object")return a(s);u||(u=gv),c||(c=ee);var l={subscribers:[],fire:c,subscribe:function(d){l.subscribers.indexOf(d)===-1&&(l.subscribers.push(d),l.fire=u(l.fire,d))},unsubscribe:function(d){l.subscribers=l.subscribers.filter(function(p){return p!==d}),l.fire=l.subscribers.reduce(u,c)}};return t[s]=n[s]=l,l}function a(s){me(s).forEach(function(u){var c=s[u];if(Ae(c))o(u,s[u][0],s[u][1]);else if(c==="asap")var l=o(u,Cr,function(){for(var p=arguments.length,f=new Array(p);p--;)f[p]=arguments[p];l.subscribers.forEach(function(h){Ec(function(){h.apply(null,f)})})});else throw new F.InvalidArgument("Invalid event config")})}}function xr(e,t){return Hn(t).from({prototype:e}),t}function Lv(e){return xr(Rv.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:Ar(null,{creating:[pv,ee],reading:[fv,Cr],updating:[mv,ee],deleting:[hv,ee]})})}function _n(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ho(e,t){e.filter=ln(e.filter,t)}function mo(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return ln(r(),t())}:t,e.justLimit=n&&!r}function Ov(e,t){e.isMatch=ln(e.isMatch,t)}function ti(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new F.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function du(e,t,n){var r=ti(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 Kr(e,t,n,r){var i=e.replayFilter?ln(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,u,c){if(!i||i(u,c,function(p){return u.stop(p)},function(p){return u.fail(p)})){var l=u.primaryKey,d=""+l;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(l)),He(o,d)||(o[d]=!0,t(s,u,c))}};return Promise.all([e.or._iterate(a,n),fu(du(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return fu(du(e,r,n),ln(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function fu(e,t,n,r){var i=r?function(a,s,u){return n(r(a),s,u)}:n,o=ae(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(u){return s=u},function(u){a.stop(u),s=ee},function(u){a.fail(u),s=ee}))&&o(a.value,a,function(u){return s=u}),s()})})}function Re(e,t){try{var n=pu(e),r=pu(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 Uv(hu(e),hu(t));case"Array":return Nv(e,t)}}catch{}return NaN}function Nv(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=Re(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function Uv(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 pu(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Vo(e);return n==="ArrayBuffer"?"binary":n}function hu(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var Dv=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,be.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,be.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=ln(n.algorithm,t)},e.prototype._iterate=function(t,n){return Kr(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&&Le(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 Kr(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(_n(i,!0))return o.count({trans:r,query:{index:ti(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return Kr(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(c,l){return l?a(c[r[l]],l-1):c[i]}var s=this._ctx.dir==="next"?1:-1;function u(c,l){var d=a(c,o),p=a(l,o);return d<p?-s:d>p?s:0}return this.toArray(function(c){return c.sort(u)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&_n(i,!0)&&i.limit>0){var o=i.valueMapper,a=ti(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(u){var c=u.result;return o?c.map(o):c})}else{var s=[];return Kr(i,function(u){return s.push(u)},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,_n(n)?mo(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)}}):mo(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),mo(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 ho(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 ho(this._ctx,function(n){return t(n.value)}),Ov(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"&&_n(n,!0)&&n.limit>0)return this._read(function(i){var o=ti(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 ho(this._ctx,function(i){var o=i.primaryKey.toString(),a=He(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=me(t),s=a.length;o=function(w){for(var y=!1,v=0;v<s;++v){var b=a[v],_=t[b];It(w,b)!==_&&(nt(w,b,_),y=!0)}return y}}var u=r.table.core,c=u.schema.primaryKey,l=c.outbound,d=c.extractKey,p=n.db._options.modifyChunkSize||200,f=[],h=0,m=[],g=function(w,y){var v=y.failures,b=y.numFailures;h+=w-b;for(var _=0,C=me(v);_<C.length;_++){var A=C[_];f.push(v[A])}};return n.clone().primaryKeys().then(function(w){var y=function(v){var b=Math.min(p,w.length-v);return u.getMany({trans:i,keys:w.slice(v,v+b),cache:"immutable"}).then(function(_){for(var C=[],A=[],S=l?[]:null,E=[],x=0;x<b;++x){var N=_[x],M={value:Sr(N),primKey:w[v+x]};o.call(M,M.value,M)!==!1&&(M.value==null?E.push(w[v+x]):!l&&Re(d(N),d(M.value))!==0?(E.push(w[v+x]),C.push(M.value)):(A.push(M.value),l&&S.push(w[v+x])))}var D=_n(r)&&r.limit===1/0&&(typeof t!="function"||t===go)&&{index:r.index,range:r.range};return Promise.resolve(C.length>0&&u.mutate({trans:i,type:"add",values:C}).then(function(T){for(var k in T.failures)E.splice(parseInt(k),1);g(C.length,T)})).then(function(){return(A.length>0||D&&typeof t=="object")&&u.mutate({trans:i,type:"put",keys:S,values:A,criteria:D,changeSpec:typeof t!="function"&&t}).then(function(T){return g(A.length,T)})}).then(function(){return(E.length>0||D&&t===go)&&u.mutate({trans:i,type:"delete",keys:E,criteria:D}).then(function(T){return g(E.length,T)})}).then(function(){return w.length>v+b&&y(v+p)})})};return y(0).then(function(){if(f.length>0)throw new yi("Error modifying one or more objects",f,h,m);return w.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return _n(t)&&(t.isPrimKey&&!Tv||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 u=s.failures;s.lastResult,s.results;var c=s.numFailures;if(c)throw new yi("Could not delete some values",Object.keys(u).map(function(l){return u[l]}),a-c);return a-c})})}):this.modify(go)},e}(),go=function(e,t){return t.value=null};function Pv(e){return xr(Dv.prototype,function(n,r){this.db=e;var i=zc,o=null;if(r)try{i=r()}catch(c){o=c}var a=n._ctx,s=a.table,u=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:u!==Cr?u:null}})}function Mv(e,t){return e<t?-1:e===t?0:1}function Fv(e,t){return e>t?-1:e===t?0:1}function Pe(e,t,n){var r=e instanceof qc?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function bn(e){return new e.Collection(e,function(){return Wc("")}).limit(0)}function Vv(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function Bv(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function Hv(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,u=0;u<a;++u){var c=t[u];if(c!==r[u])return i(e[u],n[u])<0?e.substr(0,u)+n[u]+n.substr(u+1):i(e[u],r[u])<0?e.substr(0,u)+r[u]+n.substr(u+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[u],c)<0&&(s=u)}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,u,c,l,d=n.length;if(!n.every(function(m){return typeof m=="string"}))return Pe(e,jc);function p(m){i=Vv(m),o=Bv(m),a=m==="next"?Mv:Fv;var g=n.map(function(w){return{lower:o(w),upper:i(w)}}).sort(function(w,y){return a(w.lower,y.lower)});s=g.map(function(w){return w.upper}),u=g.map(function(w){return w.lower}),c=m,l=m==="next"?"":r}p("next");var f=new e.Collection(e,function(){return Tt(s[0],u[d-1]+r)});f._ondirectionchange=function(m){p(m)};var h=0;return f._addAlgorithm(function(m,g,w){var y=m.key;if(typeof y!="string")return!1;var v=o(y);if(t(v,u,h))return!0;for(var b=null,_=h;_<d;++_){var C=Hv(y,v,s[_],u[_],a,c);C===null&&b===null?h=_+1:(b===null||a(b,C)>0)&&(b=C)}return g(b!==null?function(){m.continue(b+l)}:w),!1}),f}function Tt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Wc(e){return{type:1,lower:e,upper:e}}var qc=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)?bn(this):new this.Collection(this,function(){return Tt(t,n,!r,!i)})}catch{return Pe(this,ft)}},e.prototype.equals=function(t){return t==null?Pe(this,ft):new this.Collection(this,function(){return Wc(t)})},e.prototype.above=function(t){return t==null?Pe(this,ft):new this.Collection(this,function(){return Tt(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?Pe(this,ft):new this.Collection(this,function(){return Tt(t,void 0,!1)})},e.prototype.below=function(t){return t==null?Pe(this,ft):new this.Collection(this,function(){return Tt(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?Pe(this,ft):new this.Collection(this,function(){return Tt(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?Pe(this,jc):this.between(t,t+Jt,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):jr(this,function(n,r){return n.indexOf(r[0])===0},[t],Jt)},e.prototype.equalsIgnoreCase=function(t){return jr(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=gt.apply(In,arguments);return t.length===0?bn(this):jr(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=gt.apply(In,arguments);return t.length===0?bn(this):jr(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Jt)},e.prototype.anyOf=function(){var t=this,n=gt.apply(In,arguments),r=this._cmp;try{n.sort(r)}catch{return Pe(this,ft)}if(n.length===0)return bn(this);var i=new this.Collection(this,function(){return Tt(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,u){for(var c=a.key;r(c,n[o])>0;)if(++o,o===n.length)return s(u),!1;return r(c,n[o])===0?!0:(s(function(){a.continue(n[o])}),!1)}),i},e.prototype.notEqual=function(t){return this.inAnyRange([[Qo,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=gt.apply(In,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Pe(this,ft)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[Qo,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,u=this._max;if(t.length===0)return bn(this);if(!t.every(function(_){return _[0]!==void 0&&_[1]!==void 0&&o(_[0],_[1])<=0}))return Pe(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",F.InvalidArgument);var c=!n||n.includeLowers!==!1,l=n&&n.includeUppers===!0;function d(_,C){for(var A=0,S=_.length;A<S;++A){var E=_[A];if(i(C[0],E[1])<0&&i(C[1],E[0])>0){E[0]=s(E[0],C[0]),E[1]=u(E[1],C[1]);break}}return A===S&&_.push(C),_}var p=o;function f(_,C){return p(_[0],C[0])}var h;try{h=t.reduce(d,[]),h.sort(f)}catch{return Pe(this,ft)}var m=0,g=l?function(_){return o(_,h[m][1])>0}:function(_){return o(_,h[m][1])>=0},w=c?function(_){return a(_,h[m][0])>0}:function(_){return a(_,h[m][0])>=0};function y(_){return!g(_)&&!w(_)}var v=g,b=new this.Collection(this,function(){return Tt(h[0][0],h[h.length-1][1],!c,!l)});return b._ondirectionchange=function(_){_==="next"?(v=g,p=o):(v=w,p=a),h.sort(f)},b._addAlgorithm(function(_,C,A){for(var S=_.key;v(S);)if(++m,m===h.length)return C(A),!1;return y(S)?!0:(r._cmp(S,h[m][1])===0||r._cmp(S,h[m][0])===0||C(function(){p===o?_.continue(h[m][0]):_.continue(h[m][1])}),!1)}),b},e.prototype.startsWithAnyOf=function(){var t=gt.apply(In,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?bn(this):this.inAnyRange(t.map(function(n){return[n,n+Jt]})):Pe(this,"startsWithAnyOf() only works with strings")},e}();function Kv(e){return xr(qc.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 F.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 ot(e){return ae(function(t){return fr(t),e(t.target.error),!1})}function fr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var pr="storagemutated",Ut="x-storagemutated-1",Bt=Ar(null,pr),jv=function(){function e(){}return e.prototype._lock=function(){return Yn(!P.global),++this._reculock,this._reculock===1&&!P.global&&(P.lockOwnerFor=this),this},e.prototype._unlock=function(){if(Yn(!P.global),--this._reculock===0)for(P.global||(P.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{Gn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&P.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(Yn(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new F.DatabaseClosed(i);case"MissingAPIError":throw new F.MissingAPI(i.message,i);default:throw new F.OpenFailed(i)}if(!this.active)throw new F.TransactionInactive;return Yn(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=ae(function(o){fr(o),n._reject(t.error)}),t.onabort=ae(function(o){fr(o),n.active&&n._reject(new F.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=ae(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&Bt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return be(new F.ReadOnly("Transaction is readonly"));if(!this.active)return be(new F.TransactionInactive);if(this._locked())return new L(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},P])});if(r)return Ft(function(){var a=new L(function(s,u){i._lock();var c=n(s,u,i);c&&c.then&&c.then(s,u)});return a.finally(function(){return i._unlock()}),a._lib=!0,a});var o=new L(function(a,s){var u=n(a,s,i);u&&u.then&&u.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=L.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 L(function(a,s){r.then(function(u){return n._waitingQueue.push(ae(a.bind(null,u)))},function(u){return n._waitingQueue.push(ae(s.bind(null,u)))}).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 F.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(He(n,t))return n[t];var r=this.schema[t];if(!r)throw new F.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 Gv(e){return xr(jv.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=Ar(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 L(function(u,c){s._resolve=u,s._reject=c}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(u){var c=s.active;return s.active=!1,s.on.error.fire(u),s.parent?s.parent._reject(u):c&&s.idbtrans&&s.idbtrans.abort(),be(u)})})}function Jo(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?"++":"")+$c(t)}}function $c(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Yc(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:kc(n,function(r){return[r.name,r]})}}function zv(e){return e.length===1?e[0]:e}var hr=function(e){try{return e.only([[]]),hr=function(){return[[]]},[[]]}catch{return hr=function(){return Jt},Jt}};function Xo(e){return e==null?function(){}:typeof e=="string"?Wv(e):function(t){return It(t,e)}}function Wv(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return It(n,e)}}function mu(e){return[].slice.call(e)}var qv=0;function rr(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function $v(e,t,n){function r(d,p){var f=mu(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,w=Ae(m),y=m==null,v={},b={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:w,keyPath:m,autoIncrement:g,unique:!0,extractKey:Xo(m)},indexes:mu(h.indexNames).map(function(_){return h.index(_)}).map(function(_){var C=_.name,A=_.unique,S=_.multiEntry,E=_.keyPath,x=Ae(E),N={name:C,compound:x,keyPath:E,unique:A,multiEntry:S,extractKey:Xo(E)};return v[rr(E)]=N,N}),getIndexByKeyPath:function(_){return v[rr(_)]}};return v[":id"]=b.primaryKey,m!=null&&(v[rr(m)]=b.primaryKey),b})},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 w=g.trans,y=g.type,v=g.keys,b=g.values,_=g.range;return new Promise(function(C,A){C=ae(C);var S=w.objectStore(p),E=S.keyPath==null,x=y==="put"||y==="add";if(!x&&y!=="delete"&&y!=="deleteRange")throw new Error("Invalid operation type: "+y);var N=(v||b||{length:1}).length;if(v&&b&&v.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(N===0)return C({numFailures:0,failures:{},results:[],lastResult:void 0});var M,D=[],T=[],k=0,B=function(q){++k,fr(q)};if(y==="deleteRange"){if(_.type===4)return C({numFailures:k,failures:T,results:[],lastResult:void 0});_.type===3?D.push(M=S.clear()):D.push(M=S.delete(i(_)))}else{var Z=x?E?[b,v]:[b,null]:[v,null],se=Z[0],X=Z[1];if(x)for(var ne=0;ne<N;++ne)D.push(M=X&&X[ne]!==void 0?S[y](se[ne],X[ne]):S[y](se[ne])),M.onerror=B;else for(var ne=0;ne<N;++ne)D.push(M=S[y](se[ne])),M.onerror=B}var ce=function(q){var Ke=q.target.result;D.forEach(function(Se,dt){return Se.error!=null&&(T[dt]=Se.error)}),C({numFailures:k,failures:T,results:y==="delete"?v:D.map(function(Se){return Se.result}),lastResult:Ke})};M.onerror=function(q){B(q),ce(q)},M.onsuccess=ce})}function h(g){var w=g.trans,y=g.values,v=g.query,b=g.reverse,_=g.unique;return new Promise(function(C,A){C=ae(C);var S=v.index,E=v.range,x=w.objectStore(p),N=S.isPrimaryKey?x:x.index(S.name),M=b?_?"prevunique":"prev":_?"nextunique":"next",D=y||!("openKeyCursor"in N)?N.openCursor(i(E),M):N.openKeyCursor(i(E),M);D.onerror=ot(A),D.onsuccess=ae(function(T){var k=D.result;if(!k){C(null);return}k.___id=++qv,k.done=!1;var B=k.continue.bind(k),Z=k.continuePrimaryKey;Z&&(Z=Z.bind(k));var se=k.advance.bind(k),X=function(){throw new Error("Cursor not started")},ne=function(){throw new Error("Cursor not stopped")};k.trans=w,k.stop=k.continue=k.continuePrimaryKey=k.advance=X,k.fail=ae(A),k.next=function(){var ce=this,q=1;return this.start(function(){return q--?ce.continue():ce.stop()}).then(function(){return ce})},k.start=function(ce){var q=new Promise(function(Se,dt){Se=ae(Se),D.onerror=ot(dt),k.fail=dt,k.stop=function(De){k.stop=k.continue=k.continuePrimaryKey=k.advance=ne,Se(De)}}),Ke=function(){if(D.result)try{ce()}catch(Se){k.fail(Se)}else k.done=!0,k.start=function(){throw new Error("Cursor behind last entry")},k.stop()};return D.onsuccess=ae(function(Se){D.onsuccess=Ke,Ke()}),k.continue=B,k.continuePrimaryKey=Z,k.advance=se,Ke(),q},C(k)},A)})}function m(g){return function(w){return new Promise(function(y,v){y=ae(y);var b=w.trans,_=w.values,C=w.limit,A=w.query,S=C===1/0?void 0:C,E=A.index,x=A.range,N=b.objectStore(p),M=E.isPrimaryKey?N:N.index(E.name),D=i(x);if(C===0)return y({result:[]});if(g){var T=_?M.getAll(D,S):M.getAllKeys(D,S);T.onsuccess=function(se){return y({result:se.target.result})},T.onerror=ot(v)}else{var k=0,B=_||!("openKeyCursor"in M)?M.openCursor(D):M.openKeyCursor(D),Z=[];B.onsuccess=function(se){var X=B.result;if(!X)return y({result:Z});if(Z.push(_?X.value:X.primaryKey),++k===C)return y({result:Z});X.continue()},B.onerror=ot(v)}})}}return{name:p,schema:d,mutate:f,getMany:function(g){var w=g.trans,y=g.keys;return new Promise(function(v,b){v=ae(v);for(var _=w.objectStore(p),C=y.length,A=new Array(C),S=0,E=0,x,N=function(k){var B=k.target;(A[B._pos]=B.result)!=null,++E===S&&v(A)},M=ot(b),D=0;D<C;++D){var T=y[D];T!=null&&(x=_.get(y[D]),x._pos=D,x.onsuccess=N,x.onerror=M,++S)}S===0&&v(A)})},get:function(g){var w=g.trans,y=g.key;return new Promise(function(v,b){v=ae(v);var _=w.objectStore(p),C=_.get(y);C.onsuccess=function(A){return v(A.target.result)},C.onerror=ot(b)})},query:m(u),openCursor:h,count:function(g){var w=g.query,y=g.trans,v=w.index,b=w.range;return new Promise(function(_,C){var A=y.objectStore(p),S=v.isPrimaryKey?A:A.index(v.name),E=i(b),x=E?S.count(E):S.count();x.onsuccess=ae(function(N){return _(N.target.result)}),x.onerror=ot(C)})}}}var a=r(e,n),s=a.schema,u=a.hasGetAll,c=s.tables.map(function(d){return o(d)}),l={};return c.forEach(function(d){return l[d.name]=d}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(d){var p=l[d];if(!p)throw new Error("Table '"+d+"' not found");return l[d]},MIN_KEY:-1/0,MAX_KEY:hr(t),schema:s}}function Yv(e,t){return t.reduce(function(n,r){var i=r.create;return z(z({},n),i(n))},e)}function Zv(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=Yv($v(t,i,r),e.dbcore);return{dbcore:o}}function Za(e,t){var n=e._novip,r=t.db,i=Zv(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 Ci(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var u=Ha(s,o);(!u||"value"in u&&u.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?Ct(s,o,{get:function(){return this.table(o)},set:function(c){Sc(this,o,{value:c,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function ea(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Qv(e,t){return e._cfg.version-t._cfg.version}function Jv(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=P.transless||P;Ft(function(){P.trans=o,P.transless=s,t===0?(me(i).forEach(function(u){Qa(n,u,i[u].primKey,i[u].indexes)}),Za(e,n),L.follow(function(){return e.on.populate.fire(o)}).catch(a)):Xv(e,t,o,n).catch(a)})}function Xv(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=Ja(i,i.idbdb,r),u=!1,c=a.filter(function(d){return d._cfg.version>=t});c.forEach(function(d){o.push(function(){var p=s,f=d._cfg.dbschema;na(i,p,r),na(i,f,r),s=i._dbSchema=f;var h=Zc(p,f);h.add.forEach(function(b){Qa(r,b[0],b[1].primKey,b[1].indexes)}),h.change.forEach(function(b){if(b.recreate)throw new F.Upgrade("Not yet support for changing primary key");var _=r.objectStore(b.name);b.add.forEach(function(C){return ta(_,C)}),b.change.forEach(function(C){_.deleteIndex(C.name),ta(_,C)}),b.del.forEach(function(C){return _.deleteIndex(C)})});var m=d._cfg.contentUpgrade;if(m&&d._cfg.version>t){Za(i,r),n._memoizedTables={},u=!0;var g=Ac(f);h.del.forEach(function(b){g[b]=p[b]}),ea(i,[i.Transaction.prototype]),Ci(i,[i.Transaction.prototype],me(g),g),n.schema=g;var w=Ka(m);w&&jn();var y,v=L.follow(function(){if(y=m(n),y&&w){var b=Et.bind(null,null);y.then(b,b)}});return y&&typeof y.then=="function"?L.resolve(y):v.then(function(){return y})}}),o.push(function(p){if(!u||!xv){var f=d._cfg.dbschema;ty(f,p)}ea(i,[i.Transaction.prototype]),Ci(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function l(){return o.length?L.resolve(o.shift()(n.idbtrans)).then(l):L.resolve()}return l().then(function(){ey(s,r)})}function Zc(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&&!Ki)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,u=o.idxByName,c=void 0;for(c in s)u[c]||a.del.push(c);for(c in u){var l=s[c],d=u[c];l?l.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 Qa(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 ta(i,o)}),i}function ey(e,t){me(e).forEach(function(n){t.db.objectStoreNames.contains(n)||Qa(t,n,e[n].primKey,e[n].indexes)})}function ty(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function ta(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Ja(e,t,n){var r={},i=Bi(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,u=Jo($c(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),c=[],l=0;l<a.indexNames.length;++l){var d=a.index(a.indexNames[l]);s=d.keyPath;var p=Jo(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);c.push(p)}r[o]=Yc(o,u,c)}),r}function ny(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=Ja(r,t,n);r._storeNames=Bi(t.objectStoreNames,0),Ci(r,[r._allTables],me(i),i)}function ry(e,t){var n=Ja(e,e.idbdb,t),r=Zc(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function na(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 u=0;u<s.indexNames.length;++u){var c=s.indexNames[u],l=s.index(c).keyPath,d=typeof l=="string"?l:"["+Bi(l).join("+")+"]";if(t[a]){var p=t[a].idxByName[d];p&&(p.name=c,delete t[a].idxByName[d],t[a].idxByName[c]=p)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&re.WorkerGlobalScope&&re instanceof re.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function iy(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 Jo(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),Ae(i),n===0)})}var oy=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){me(t).forEach(function(r){if(t[r]!==null){var i=iy(t[r]),o=i.shift();if(o.multi)throw new F.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new F.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new F.Schema("Index must have a name and cannot be an empty string")}),n[r]=Yc(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?Le(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){Le(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,ea(n,[n._allTables,n,n.Transaction.prototype]),Ci(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],me(o),o),n._storeNames=me(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=za(this._cfg.contentUpgrade||ee,t),this},e}();function ay(e){return xr(oy.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Xa(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new rs(ji,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function es(e){return e&&typeof e.databases=="function"}function sy(e){var t=e.indexedDB,n=e.IDBKeyRange;return es(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==ji})}):Xa(t,n).toCollection().primaryKeys()}function uy(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!es(n)&&t!==ji&&Xa(n,r).put({name:t}).catch(ee)}function ly(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!es(n)&&t!==ji&&Xa(n,r).delete(t).catch(ee)}function ra(e){return Ft(function(){return P.letThrough=!0,e()})}function cy(){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 dy(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?be(t.dbOpenError):e});ct&&(t.openCanceller._stackHolder=pn()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new F.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return L.race([r,(typeof navigator>"u"?L.resolve():cy()).then(function(){return new L(function(u,c){if(i(),!n)throw new F.MissingAPI;var l=e.name,d=t.autoSchema?n.open(l):n.open(l,Math.round(e.verno*10));if(!d)throw new F.MissingAPI;d.onerror=ot(c),d.onblocked=ae(e._fireOnBlocked),d.onupgradeneeded=ae(function(p){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=fr,a.abort(),d.result.close();var f=n.deleteDatabase(l);f.onsuccess=f.onerror=ae(function(){c(new F.NoSuchDatabase("Database "+l+" doesnt exist"))})}else{a.onerror=ot(c);var h=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;s=h<1,e._novip.idbdb=d.result,Jv(e,h/10,a,c)}},c),d.onsuccess=ae(function(){a=null;var p=e._novip.idbdb=d.result,f=Bi(p.objectStoreNames);if(f.length>0)try{var h=p.transaction(zv(f),"readonly");t.autoSchema?ny(e,p,h):(na(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.")),Za(e,h)}catch{}nr.push(e),p.onversionchange=ae(function(m){t.vcFired=!0,e.on("versionchange").fire(m)}),p.onclose=ae(function(m){e.on("close").fire(m)}),s&&uy(e._deps,l),u()},c)})})]).then(function(){return i(),t.onReadyBeingFired=[],L.resolve(ra(function(){return e.on.ready.fire(e.vip)})).then(function u(){if(t.onReadyBeingFired.length>0){var c=t.onReadyBeingFired.reduce(za,ee);return t.onReadyBeingFired=[],L.resolve(ra(function(){return c(e.vip)})).then(u)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(u){t.dbOpenError=u;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),be(u)}).finally(function(){t.openComplete=!0,o()})}function ia(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 u=a(s),c=u.value;return u.done?c:!c||typeof c.then!="function"?Ae(c)?Promise.all(c).then(r,i):r(c):c.then(r,i)}}return o(t)()}function fy(e,t,n){var r=arguments.length;if(r<2)throw new F.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=xc(i);return[e,o,n]}function Qc(e,t,n,r,i){return L.resolve().then(function(){var o=P.transless||P,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===Ga.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Qc(e,t,n,null,i)})):be(d)}var u=Ka(i);u&&jn();var c,l=L.follow(function(){if(c=i.call(a,a),c)if(u){var d=Et.bind(null,null);c.then(d,d)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=ia(c))},s);return(c&&typeof c.then=="function"?L.resolve(c).then(function(d){return a.active?d:be(new F.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):l.then(function(){return c})).then(function(d){return r&&a._resolve(),a._completion.then(function(){return d})}).catch(function(d){return a._reject(d),be(d)})})}function Gr(e,t,n){for(var r=Ae(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function py(e){return z(z({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(m,g,w){var y=rr(m),v=i[y]=i[y]||[],b=m==null?0:typeof m=="string"?1:m.length,_=g>0,C=z(z({},w),{isVirtual:_,keyTail:g,keyLength:b,extractKey:Xo(m),unique:!_&&w.unique});if(v.push(C),C.isPrimaryKey||o.push(C),b>1){var A=b===2?m[0]:m.slice(0,b-1);a(A,g+1,w)}return v.sort(function(S,E){return S.keyTail-E.keyTail}),C}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var u=0,c=r.indexes;u<c.length;u++){var l=c[u];a(l.keyPath,0,l)}function d(m){var g=i[rr(m)];return g&&g[0]}function p(m,g){return{type:m.type===1?2:m.type,lower:Gr(m.lower,m.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:Gr(m.upper,m.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function f(m){var g=m.query.index;return g.isVirtual?z(z({},m),{query:{index:g,range:p(m.query.range,g.keyTail)}}):m}var h=z(z({},n),{schema:z(z({},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,w=g.keyTail,y=g.isVirtual,v=g.keyLength;if(!y)return n.openCursor(m);function b(_){function C(S){S!=null?_.continue(Gr(S,m.reverse?e.MAX_KEY:e.MIN_KEY,w)):m.unique?_.continue(_.key.slice(0,v).concat(m.reverse?e.MIN_KEY:e.MAX_KEY,w)):_.continue()}var A=Object.create(_,{continue:{value:C},continuePrimaryKey:{value:function(S,E){_.continuePrimaryKey(Gr(S,e.MAX_KEY,w),E)}},primaryKey:{get:function(){return _.primaryKey}},key:{get:function(){var S=_.key;return v===1?S[0]:S.slice(0,v)}},value:{get:function(){return _.value}}});return A}return n.openCursor(f(m)).then(function(_){return _&&b(_)})}});return h}})}var hy={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:py};function ts(e,t,n,r){return n=n||{},r=r||"",me(e).forEach(function(i){if(!He(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=Vo(o),u=Vo(a);s!==u?n[r+i]=t[i]:s==="Object"?ts(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),me(t).forEach(function(i){He(e,i)||(n[r+i]=t[i])}),n}function my(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var gy={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return z(z({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=z(z({},n),{mutate:function(o){var a=P.trans,s=a.table(t).hook,u=s.deleting,c=s.creating,l=s.updating;switch(o.type){case"add":if(c.fire===ee)break;return a._promise("readwrite",function(){return d(o)},!0);case"put":if(c.fire===ee&&l.fire===ee)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(u.fire===ee)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(u.fire===ee)break;return a._promise("readwrite",function(){return p(o)},!0)}return n.mutate(o);function d(h){var m=P.trans,g=h.keys||my(r,h);if(!g)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?z(z({},h),{keys:g}):z({},h),h.type!=="delete"&&(h.values=Mo([],h.values,!0)),h.keys&&(h.keys=Mo([],h.keys,!0)),vy(n,h,g).then(function(w){var y=g.map(function(v,b){var _=w[b],C={onerror:null,onsuccess:null};if(h.type==="delete")u.fire.call(C,v,_,m);else if(h.type==="add"||_===void 0){var A=c.fire.call(C,v,h.values[b],m);v==null&&A!=null&&(v=A,h.keys[b]=v,r.outbound||nt(h.values[b],r.keyPath,v))}else{var S=ts(_,h.values[b]),E=l.fire.call(C,S,v,_,m);if(E){var x=h.values[b];Object.keys(E).forEach(function(N){He(x,N)?x[N]=E[N]:nt(x,N,E[N])})}}return C});return n.mutate(h).then(function(v){for(var b=v.failures,_=v.results,C=v.numFailures,A=v.lastResult,S=0;S<g.length;++S){var E=_?_[S]:g[S],x=y[S];E==null?x.onerror&&x.onerror(b[S]):x.onsuccess&&x.onsuccess(h.type==="put"&&w[S]?h.values[S]:E)}return{failures:b,results:_,numFailures:C,lastResult:A}}).catch(function(v){return y.forEach(function(b){return b.onerror&&b.onerror(v)}),Promise.reject(v)})})}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(w){var y=w.result;return d({type:"delete",keys:y,trans:h}).then(function(v){return v.numFailures>0?Promise.reject(v.failures[0]):y.length<g?{failures:[],numFailures:0,lastResult:void 0}:f(h,z(z({},m),{lower:y[y.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function vy(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function Jc(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)Re(t.keys[i],e[o])===0&&(r.push(n?Sr(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var yy={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return z(z({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=Jc(r.keys,r.trans._cache,r.cache==="clone");return i?L.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Sr(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},vo;function ns(e){return!("from"in e)}var ht=function(e,t){if(this)Le(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new ht;return e&&"d"in e&&Le(n,e),n}};Un(ht.prototype,(vo={add:function(e){return Ei(this,e),this},addKey:function(e){return mr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return mr(t,n,n)}),this}},vo[Bo]=function(){return oa(this)},vo));function mr(e,t,n){var r=Re(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(ns(e))return Le(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(Re(n,e.from)<0)return i?mr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},gu(e);if(Re(t,e.to)>0)return o?mr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},gu(e);Re(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Re(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&&Ei(e,i),o&&a&&Ei(e,o)}}function Ei(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,u=i.r;mr(r,o,a),s&&n(r,s),u&&n(r,u)}ns(t)||n(e,t)}function _y(e,t){var n=oa(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=oa(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(Re(s.from,i.to)<=0&&Re(s.to,i.from)>=0)return!0;Re(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function oa(e){var t=ns(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&&Re(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||Re(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 gu(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=z({},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=vu(a)}e.d=vu(e)}function vu(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 by={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new ht(e.MIN_KEY,e.MAX_KEY);return z(z({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,u=a.outbound,c=z(z({},i),{mutate:function(p){var f=p.trans,h=f.mutatedParts||(f.mutatedParts={}),m=function(A){var S="idb://"+t+"/"+r+"/"+A;return h[S]||(h[S]=new ht)},g=m(""),w=m(":dels"),y=p.type,v=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[],b=v[0],_=v[1],C=p.trans._cache;return i.mutate(p).then(function(A){if(Ae(b)){y!=="delete"&&(b=A.results),g.addKeys(b);var S=Jc(b,C);!S&&y!=="add"&&w.addKeys(b),(S||_)&&wy(m,o,S,_)}else if(b){var E={from:b.lower,to:b.upper};w.add(E),g.add(E)}else g.add(n),w.add(n),o.indexes.forEach(function(x){return m(x.name).add(n)});return A})}}),l=function(p){var f,h,m=p.query,g=m.index,w=m.range;return[g,new ht((f=w.lower)!==null&&f!==void 0?f:e.MIN_KEY,(h=w.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},d={get:function(p){return[a,new ht(p.key)]},getMany:function(p){return[a,new ht().addKeys(p.keys)]},count:l,query:l,openCursor:l};return me(d).forEach(function(p){c[p]=function(f){var h=P.subscr;if(h){var m=function(C){var A="idb://"+t+"/"+r+"/"+C;return h[A]||(h[A]=new ht)},g=m(""),w=m(":dels"),y=d[p](f),v=y[0],b=y[1];if(m(v.name||"").add(b),!v.isPrimaryKey)if(p==="count")w.add(n);else{var _=p==="query"&&u&&f.values&&i.query(z(z({},f),{values:!1}));return i[p].apply(this,arguments).then(function(C){if(p==="query"){if(u&&f.values)return _.then(function(x){var N=x.result;return g.addKeys(N),C});var A=f.values?C.result.map(s):C.result;f.values?g.addKeys(A):w.addKeys(A)}else if(p==="openCursor"){var S=C,E=f.values;return S&&Object.create(S,{key:{get:function(){return w.addKey(S.primaryKey),S.key}},primaryKey:{get:function(){var x=S.primaryKey;return w.addKey(x),x}},value:{get:function(){return E&&g.addKey(S.primaryKey),S.value}}})}return C})}}return i[p].apply(this,arguments)}}),c}})}};function wy(e,t,n,r){function i(o){var a=e(o.name||"");function s(c){return c!=null?o.extractKey(c):null}var u=function(c){return o.multiEntry&&Ae(c)?c.forEach(function(l){return a.addKey(l)}):a.addKey(c)};(n||r).forEach(function(c,l){var d=n&&s(n[l]),p=r&&s(r[l]);Re(d,p)!==0&&(d!=null&&u(d),p!=null&&u(p))})}t.indexes.forEach(i)}var rs=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=z({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:ee,dbReadyPromise:null,cancelOpen:ee,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new L(function(s){a.dbReadyResolve=s}),a.openCanceller=new L(function(s,u){a.cancelOpen=u}),this._state=a,this.name=t,this.on=Ar(this,"populate","blocked","versionchange","close",{ready:[za,ee]}),this.on.ready.subscribe=Cc(this.on.ready.subscribe,function(s){return function(u,c){e.vip(function(){var l=r._state;if(l.openComplete)l.dbOpenError||L.resolve().then(u),c&&s(u);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(u),c&&s(u);else{s(u);var d=r;c||s(function p(){d.on.ready.unsubscribe(u),d.on.ready.unsubscribe(p)})}})}}),this.Collection=Pv(this),this.Table=Lv(this),this.Transaction=Gv(this),this.Version=ay(this),this.WhereClause=Kv(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=hr(n.IDBKeyRange),this._createTransaction=function(s,u,c,l){return new r.Transaction(s,u,c,r._options.chromeTransactionDurability,l)},this._fireOnBlocked=function(s){r.on("blocked").fire(s),nr.filter(function(u){return u.name===r.name&&u!==r&&!u._state.vcFired}).map(function(u){return u.on("versionchange").fire(s)})},this.use(hy),this.use(gy),this.use(by),this.use(yy),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 F.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new F.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(Qv),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||P.letThrough||this._vip)?t():new L(function(r,i){if(n._state.openComplete)return i(new F.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new F.DatabaseClosed);return}n.open().catch(ee)}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,u){return s.level-u.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 dy(this)},e.prototype._close=function(){var t=this._state,n=nr.indexOf(this);if(n>=0&&nr.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new L(function(r){t.dbReadyResolve=r}),t.openCanceller=new L(function(r,i){t.cancelOpen=i})},e.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new F.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},e.prototype.delete=function(){var t=this,n=arguments.length>0,r=this._state;return new L(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=ae(function(){ly(t._deps,t.name),i()}),s.onerror=ot(o),s.onblocked=t._fireOnBlocked};if(n)throw new F.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 me(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=fy.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=P.trans;(!o||o.db!==this||t.indexOf("!")!==-1)&&(o=null);var a=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");var s,u;try{if(u=n.map(function(l){var d=l instanceof i.Table?l.name:l;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),t=="r"||t===fo)s=fo;else if(t=="rw"||t==po)s=po;else throw new F.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===fo&&s===po)if(a)o=null;else throw new F.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o&&u.forEach(function(l){if(o&&o.storeNames.indexOf(l)===-1)if(a)o=null;else throw new F.SubTransaction("Table "+l+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(l){return o?o._promise(null,function(d,p){p(l)}):be(l)}var c=Qc.bind(null,this,s,u,o,r);return o?o._promise(s,c,"lock"):P.trans?Gn(P.transless,function(){return i._whenReady(c)}):this._whenReady(c)},e.prototype.table=function(t){if(!He(this._allTables,t))throw new F.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),Iy=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Sy=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[Iy]=function(){return this},e}();function Xc(e,t){return me(t).forEach(function(n){var r=e[n]||(e[n]=new ht);Ei(r,t[n])}),e}function Cy(e){var t=!1,n=void 0,r=new Sy(function(i){var o=Ka(e);function a(g){o&&jn();var w=function(){return Ft(e,{subscr:g,trans:null})},y=P.trans?Gn(P.transless,w):w();return o&&y.then(Et,Et),y}var s=!1,u={},c={},l={get closed(){return s},unsubscribe:function(){s=!0,Bt.storagemutated.unsubscribe(h)}};i.start&&i.start(l);var d=!1,p=!1;function f(){return me(c).some(function(g){return u[g]&&_y(u[g],c[g])})}var h=function(g){Xc(u,g),f()&&m()},m=function(){if(!(d||s)){u={};var g={},w=a(g);p||(Bt(pr,h),p=!0),d=!0,Promise.resolve(w).then(function(y){t=!0,n=y,d=!1,!s&&(f()?m():(u={},c=g,i.next&&i.next(y)))},function(y){d=!1,t=!1,i.error&&i.error(y),l.unsubscribe()})}};return m(),l});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var aa;try{aa={indexedDB:re.indexedDB||re.mozIndexedDB||re.webkitIndexedDB||re.msIndexedDB,IDBKeyRange:re.IDBKeyRange||re.webkitIDBKeyRange}}catch{aa={indexedDB:null,IDBKeyRange:null}}var $t=rs;Un($t,z(z({},Hi),{delete:function(e){var t=new $t(e,{addons:[]});return t.delete()},exists:function(e){return new $t(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return sy($t.dependencies).then(e)}catch{return be(new F.MissingAPI)}},defineClass:function(){function e(t){Le(this,t)}return e},ignoreTransaction:function(e){return P.trans?Gn(P.transless,e):e()},vip:ra,async:function(e){return function(){try{var t=ia(e.apply(this,arguments));return!t||typeof t.then!="function"?L.resolve(t):t}catch(n){return be(n)}}},spawn:function(e,t,n){try{var r=ia(e.apply(n,t||[]));return!r||typeof r.then!="function"?L.resolve(r):r}catch(i){return be(i)}},currentTransaction:{get:function(){return P.trans||null}},waitFor:function(e,t){var n=L.resolve(typeof e=="function"?$t.ignoreTransaction(e):e).timeout(t||6e4);return P.trans?P.trans.waitFor(n):n},Promise:L,debug:{get:function(){return ct},set:function(e){Rc(e,e==="dexie"?function(){return!0}:Gc)}},derive:Hn,extend:Le,props:Un,override:Cc,Events:Ar,on:Bt,liveQuery:Cy,extendObservabilitySet:Xc,getByKeyPath:It,setByKeyPath:nt,delByKeyPath:nv,shallowClone:Ac,deepClone:Sr,getObjectDiff:ts,cmp:Re,asap:Ec,minKey:Qo,addons:[],connections:nr,errnames:Ga,dependencies:aa,semVer:cu,version:cu.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));$t.maxKey=hr($t.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Bt(pr,function(e){if(!_t){var t;Ki?(t=document.createEvent("CustomEvent"),t.initCustomEvent(Ut,!0,!0,e)):t=new CustomEvent(Ut,{detail:e}),_t=!0,dispatchEvent(t),_t=!1}}),addEventListener(Ut,function(e){var t=e.detail;_t||ki(t)}));function ki(e){var t=_t;try{_t=!0,Bt.storagemutated.fire(e)}finally{_t=t}}var _t=!1;if(typeof BroadcastChannel<"u"){var zr=new BroadcastChannel(Ut);typeof zr.unref=="function"&&zr.unref(),Bt(pr,function(e){_t||zr.postMessage(e)}),zr.onmessage=function(e){e.data&&ki(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Bt(pr,function(e){try{_t||(typeof localStorage<"u"&&localStorage.setItem(Ut,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Mo([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:Ut,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===Ut){var t=JSON.parse(e.newValue);t&&ki(t.changedParts)}});var yu=self.document&&navigator.serviceWorker;yu&&yu.addEventListener("message",Ey)}function Ey(e){var t=e.data;t&&t.type===Ut&&ki(t.changedParts)}L.rejectionMapper=dv;Rc(ct,Gc);var zn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(zn||{}),on=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(on||{});const sa="sprig.sessionId",ed="sprig.disableReplayRecording",ky=30,td=()=>{Mt.setItem(ed,"disabled")},cn=()=>!!Mt.getItem(ed),Ay=["did not allow mutations","called in an invalid security context"],xy=e=>{if(!e)return!0;for(const t of Ay)if(e.toLowerCase().includes(t))return!1;return!0},Ty=(e,t,n)=>{cn()||t instanceof Error&&(td(),xy(t==null?void 0:t.message)&&(window.UserLeap.reportError(e,t,n),Oy()))},Ry=async(e,t)=>{var r;let n;try{if((r=window.navigator.storage)!=null&&r.estimate){const{quota:i,usage:o}=await window.navigator.storage.estimate();n={availableSpaceInMB:i&&o?(i-o)/(1024*1024):void 0,quota:i,usage:o}}}catch(i){window.UserLeap.reportError("Error getting storage estimate",i,{originalMessage:e,originalError:t})}Ty(e,t,n)},Ly=()=>{const e=Mt.getItem(sa);return e?(Mt.removeItem(sa),e):Pt()},Ue=Ly();window.addEventListener("beforeunload",()=>{Mt.setItem(sa,Ue)});const Oy=async()=>{W.transaction("rw",W.events,W.chunkUploads,W.pendingCaptures,()=>{W.events.clear(),W.chunkUploads.clear(),W.pendingCaptures.clear()}).catch(()=>{})},yo=(e,t,n=()=>!0)=>W.table(t).where("timestamp").below(e).and(n).delete(),Ny=(e,t)=>W.events.where("[sessionId+timestamp]").between([Ue,e],[Ue,t]).toArray(),Uy=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:ky));return W.events.where("[sessionId+timestamp]").between([Ue,e],[Ue,t]).modify({expiredAt:i})},Dy=e=>{var t;return W.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:Ue})},Py=(e,t)=>W.chunkUploads.update(e,{data:null,etag:t,status:zn.UploadComplete}),My=({status:e,uploadId:t})=>t?W.chunkUploads.where({uploadId:t,status:e}).toArray():W.chunkUploads.where({sessionId:Ue,status:e}).toArray(),Fy=e=>W.chunkUploads.where({uploadId:e,status:zn.UploadComplete}).toArray(),Vy=e=>W.chunkUploads.where({uploadId:e,status:zn.UploadComplete}).delete(),By=e=>{var t;return W.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:Ue,canUpload:!1})},Hy=()=>W.pendingCaptures.where("sessionId").equals(Ue).and(e=>e.targetTimestamp<Date.now()).toArray(),Ky=()=>W.pendingCaptures.where("sessionId").equals(Ue).toArray(),jy=e=>W.pendingCaptures.where("sessionId").equals(Ue).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0}),Gy=async e=>{var t;if((t=window.navigator.storage)!=null&&t.estimate){const{quota:n,usage:r}=await window.navigator.storage.estimate();if(n&&r&&(n-r)/1073741824<e)return!1}return!0};class zy extends rs{constructor(){super("replayStorage",{autoOpen:!1});ge(this,"events");ge(this,"chunkUploads");ge(this,"pendingCaptures")}}const W=new zy;W.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});W.open().catch(()=>{td()});let _u=1,nd=5e3,ua=6e4;const Wy=5,bu=1e3,rd=30,Ai=rd+Wy,is="sprig.pendingCount";let id,la,od,wu=Date.now(),os=!1;const qy=async(e,t,n,r=2,i)=>{dn(async()=>{if(cn()||!t||(i!=null&&i.minAvailableGb&&(_u=i.minAvailableGb),!await Gy(_u)))return;i!=null&&i.minDuration&&(nd=i.minDuration),i!=null&&i.batchDuration&&(ua=i.batchDuration),Yg(r),t_(),Qy(t+Ai,30*60,t+Ai),Jy();const o=window.rrwebRecord;if(!o)return;let a=!0;o({checkoutEveryNms:rd*1e3,sampling:{input:"last",scroll:250,media:800},emit:(s,u)=>{if(cn())return;wu=Date.now();const c=a||!!u;a=!1,$y({uuid:Pt(),event:JSON.stringify(s),isValidStart:c,timestamp:Date.now()})},...i}),os=!0,la||(la=setInterval(()=>{Date.now()-wu>bu&&Tr("Sprig_Noop",{})},bu))},"Error initializing replay")};let ca=!1,da=[];const $y=e=>{da.push(e),ca||Zy()},Yy=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:Ue}});W.transaction("rw",W.events,()=>{W.events.bulkAdd(t)}).catch(n=>{Gi("Error storing replay events",n)})},Zy=()=>{ca=!0,setTimeout(async()=>{if(cn())return;Yy(da),da=[],ca=!1},500)},Qy=(e=6*60,t=30*60,n=4*60)=>{id=setInterval(()=>{const r=Date.now();cn()||W.transaction("rw!",W.events,W.chunkUploads,W.pendingCaptures,()=>{yo(r-e*1e3,"events",i=>i.expiredAt===void 0||i.expiredAt<r-e*1e3),yo(r-t*1e3,"chunkUploads"),yo(r-n*1e3,"pendingCaptures",i=>i.canUpload===void 0||i.canUpload===!1)}).catch(i=>{Gi("Error deleting table rows",i)})},30*1e3)},Jy=(e=5)=>{od=setInterval(async()=>{dn(async()=>{if(vt&&parseInt(vt)>0){const t=await Hy();t.length&&(await Promise.all(t.map(async n=>(await W.pendingCaptures.delete(n.uuid),ud(n.captureParams,n.canUpload)))),vt=(parseInt(vt)-t.length).toString(),Mt.setItem(is,vt))}},"Error initiating pending captures")},e*1e3)},Xy=async(e,t,n,r,i)=>{const o=Math.min(e+i,n),a=await Ny(e,o);if(!(a!=null&&a.length))return{validStartFound:r,events:[]};if(!r){let s=-1;return a==null||a.forEach((u,c)=>{if(!u.isValidStart)return;const l=u.timestamp<=t;(s<0||l)&&(s=c)}),s<0?{validStartFound:r,events:[]}:{validStartFound:!0,events:a==null?void 0:a.slice(s)}}return{validStartFound:r,events:a}},e_=(e,t,n)=>{const r=e.length,i=t*1024*1024,o=Math.ceil(r/n),a=Math.max(i,o),s=[];let u=0;for(;u<r;)s.push(e.slice(u,u+a)),u+=a;return s},ad=e=>Promise.all(e.map(async t=>{const n=await Qg(t);return await Py(t.uuid,n),t.uploadId})),sd=async e=>{const t=await Fy(e);if(!(t!=null&&t.length))return;const n=t.reduce((o,a)=>(o.find(s=>s.chunkIndex===a.chunkIndex)||o.push(a),o),[]);n.sort((o,a)=>o.chunkIndex-a.chunkIndex);const r=n.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),i=n[0];await Ic({apiUrl:i.apiUrl,surveyId:i.surveyId,uploadId:e,responseGroupUuid:i.responseGroupId,etags:r,headers:i.completeUploadHeaders,replayDuration:i.replayDuration}),await Vy(e)},t_=async()=>{dn(async()=>{const e=await My({status:zn.ReadyForUpload});if(!(e!=null&&e.length))return;const t=await ad(e);t!=null&&t.length&&await Promise.all(t.map(n=>{if(n)return sd(n)}))},"Error uploading unfinished chunks")},n_=async(e,t)=>{await ad(t),await sd(e)},r_=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},Iu=async(e,t,n)=>{const r=new TextEncoder;let i=null,o=null,a=null,s=!1,u=!1,[c,l]=[0,0];const d=e-Ai*1e3,p=[];let f=[];for(let m=d;m<t;m+=ua){if({validStartFound:u,events:f}=await Xy(m,e,t,u,ua),!(f!=null&&f.length))continue;c===0&&(c=f[0].timestamp),l=f[f.length-1].timestamp;const g=`${s?",":"["}${f.map(y=>y.event).join(",")}`,w=r.encode(g);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(w)):p.push(w),s=!0}if(l-c<nd)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=r_(p)),i},i_=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 Iu(o,i,n)}catch(a){a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n&&dn(async()=>{await Iu(o,i,!1)},"fileData fallback failed")}return r},Su=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,u=await i_(a.replayDurationSeconds*1e3,s);if(!(u!=null&&u.length))return;const c=e_(u,a.minimumChunkSizeMb,a.signedUrls.length),l=await Promise.all(c.map(async(d,p)=>{const f=Pt(),h={apiUrl:i,chunkIndex:p+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:zn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:c.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[p].url,uuid:f,visitorId:r};return await Dy(h),h}));return n_(a.uploadId,l)},ud=async(e,t)=>{if(cn())return;const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>K.removeListener(H.QuestionAnswered,a),0),dn(async()=>{r.replayDurationType===on.Before?await Su(e):await jy(o)},"Error in schedule/capture callback")};dn(async()=>{if(r.replayDurationType===on.After||r.replayDurationType===on.BeforeAndAfter){n||K.on(H.QuestionAnswered,a),await a_(e);return}if(n||t)await Su(e);else{const s=Ai+r.replayDurationSeconds;await Uy(i-s*1e3,i,r.expirationTimeLimitMinutes),K.on(H.QuestionAnswered,a)}},"Error in scheduling/capturing replay")},o_=()=>{W.transaction("rw",W.events,W.pendingCaptures,()=>{W.events.where("sessionId").equals(Ue).delete(),W.pendingCaptures.where("sessionId").equals(Ue).delete()}).catch(e=>{Gi("Error clearing session event data",e)})},Cu=()=>{cn()||o_()};let vt=Mt.getItem(is);const a_=async e=>{const{surveyId:t}=e,n=await Ky(),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===on.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=on.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,vt=vt?(parseInt(vt)+1).toString():"1",Mt.setItem(is,vt),By({uuid:Pt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},Tr=(e,t)=>{!os||dn(()=>{var n,r;(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)},"Error recording custom event")},dn=async(e,t)=>{try{await e()}catch(n){Gi(t,n)}},Eu=e=>{Tr("Sprig_PageView",e)},s_=e=>{Tr("Sprig_TrackEvent",e)},u_=e=>{Tr("Sprig_ShowSurvey",e)},l_=e=>{Tr("Sprig_SubmitSurvey",e)},Gi=(e,t)=>([id,la,od].forEach(n=>{n&&clearInterval(n)}),os=!1,Ry(e,t));var R=(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))(R||{}),yt=(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))(yt||{}),Dn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Dn||{}),We=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(We||{}),Xt=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Xt||{}),Rr,U,ld,Pn,Yt,ku,cd,dd,xi={},fd=[],c_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function bt(e,t){for(var n in t)e[n]=t[n];return e}function pd(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?Rr.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 ir(e,a,r,i,null)}function ir(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?++ld:i};return i==null&&U.vnode!=null&&U.vnode(o),o}function hd(){return{current:null}}function Ze(e){return e.children}function d_(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Ti(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]||Ti(e,o,t[o],n[o],r)}function Au(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||c_.test(t)?n:n+"px"}function Ti(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||Au(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Au(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?Tu:xu,o):e.removeEventListener(t,o?Tu:xu,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 xu(e){Pn=!0;try{return this.l[e.type+!1](U.event?U.event(e):e)}finally{Pn=!1}}function Tu(e){Pn=!0;try{return this.l[e.type+!0](U.event?U.event(e):e)}finally{Pn=!1}}function rt(e,t){this.props=e,this.context=t}function gr(e,t){if(t==null)return e.__?gr(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"?gr(e):null}function md(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 md(e)}}function f_(e){Pn?setTimeout(e):cd(e)}function fa(e){(!e.__d&&(e.__d=!0)&&Yt.push(e)&&!Ri.__r++||ku!==U.debounceRendering)&&((ku=U.debounceRendering)||f_)(Ri)}function Ri(){var e,t,n,r,i,o,a,s;for(Yt.sort(function(u,c){return u.__v.__b-c.__v.__b});e=Yt.shift();)e.__d&&(t=Yt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=bt({},o)).__v=o.__v+1,as(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?gr(o):a,o.__h),bd(r,o),o.__e!=a&&md(o)),Yt.length>t&&Yt.sort(function(u,c){return u.__v.__b-c.__v.__b}));Ri.__r=0}function gd(e,t,n,r,i,o,a,s,u,c){var l,d,p,f,h,m,g,w=r&&r.__k||fd,y=w.length;for(n.__k=[],l=0;l<t.length;l++)if((f=n.__k[l]=(f=t[l])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?ir(null,f,null,null,f):Array.isArray(f)?ir(Ze,{children:f},null,null,null):f.__b>0?ir(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=w[l])===null||p&&f.key==p.key&&f.type===p.type)w[l]=void 0;else for(d=0;d<y;d++){if((p=w[d])&&f.key==p.key&&f.type===p.type){w[d]=void 0;break}p=null}as(e,f,p=p||xi,i,o,a,s,u,c),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=u=vd(f,u,e):u=yd(e,f,p,w,h,u),typeof n.type=="function"&&(n.__d=u)):u&&p.__e==u&&u.parentNode!=e&&(u=gr(p))}for(n.__e=m,l=y;l--;)w[l]!=null&&(typeof n.type=="function"&&w[l].__e!=null&&w[l].__e==n.__d&&(n.__d=_d(r).nextSibling),Id(w[l],w[l]));if(g)for(l=0;l<g.length;l++)wd(g[l],g[++l],g[++l])}function vd(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"?vd(r,t,n):yd(n,r,r,i,r.__e,t));return t}function St(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){St(n,t)}):t.push(e)),t}function yd(e,t,n,r,i,o){var a,s,u;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,u=0;(s=s.nextSibling)&&u<r.length;u+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return a!==void 0?a:i.nextSibling}function _d(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=_d(n)))return r}return null}function as(e,t,n,r,i,o,a,s,u){var c,l,d,p,f,h,m,g,w,y,v,b,_,C,A,S=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(u=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(c=U.__b)&&c(t);try{e:if(typeof S=="function"){if(g=t.props,w=(c=S.contextType)&&r[c.__c],y=c?w?w.props.value:c.__:r,n.__c?m=(l=t.__c=n.__c).__=l.__E:("prototype"in S&&S.prototype.render?t.__c=l=new S(g,y):(t.__c=l=new rt(g,y),l.constructor=S,l.render=h_),w&&w.sub(l),l.props=g,l.state||(l.state={}),l.context=y,l.__n=r,d=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),S.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=bt({},l.__s)),bt(l.__s,S.getDerivedStateFromProps(g,l.__s))),p=l.props,f=l.state,l.__v=t,d)S.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(S.getDerivedStateFromProps==null&&g!==p&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,y),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,y)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(l.props=g,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(E){E&&(E.__=t)}),v=0;v<l._sb.length;v++)l.__h.push(l._sb[v]);l._sb=[],l.__h.length&&a.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,y),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(p,f,h)})}if(l.context=y,l.props=g,l.__P=e,b=U.__r,_=0,"prototype"in S&&S.prototype.render){for(l.state=l.__s,l.__d=!1,b&&b(t),c=l.render(l.props,l.state,l.context),C=0;C<l._sb.length;C++)l.__h.push(l._sb[C]);l._sb=[]}else do l.__d=!1,b&&b(t),c=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++_<25);l.state=l.__s,l.getChildContext!=null&&(r=bt(bt({},r),l.getChildContext())),d||l.getSnapshotBeforeUpdate==null||(h=l.getSnapshotBeforeUpdate(p,f)),A=c!=null&&c.type===Ze&&c.key==null?c.props.children:c,gd(e,Array.isArray(A)?A:[A],t,n,r,i,o,a,s,u),l.base=t.__e,t.__h=null,l.__h.length&&a.push(l),m&&(l.__E=l.__=null),l.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=p_(n.__e,t,n,r,i,o,a,u);(c=U.diffed)&&c(t)}catch(E){t.__v=null,(u||o!=null)&&(t.__e=s,t.__h=!!u,o[o.indexOf(s)]=null),U.__e(E,t,n)}}function bd(e,t){U.__c&&U.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){U.__e(r,n.__v)}})}function p_(e,t,n,r,i,o,a,s){var u,c,l,d=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((u=o[h])&&"setAttribute"in u==!!f&&(f?u.localName===f:u.nodeType===3)){e=u,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&&Rr.call(e.childNodes),c=(d=n.props||xi).dangerouslySetInnerHTML,l=p.dangerouslySetInnerHTML,!s){if(o!=null)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(l||c)&&(l&&(c&&l.__html==c.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(d_(e,p,d,i,s),l)t.__k=[];else if(h=t.props.children,gd(e,Array.isArray(h)?h:[h],t,n,r,i&&f!=="foreignObject",o,a,o?o[0]:n.__k&&gr(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&pd(o[h]);s||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==d.value)&&Ti(e,"value",h,d.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&Ti(e,"checked",h,d.checked,!1))}return e}function wd(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){U.__e(r,n)}}function Id(e,t,n){var r,i;if(U.unmount&&U.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||wd(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){U.__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]&&Id(r[i],t,n||typeof e.type!="function");n||e.__e==null||pd(e.__e),e.__=e.__e=e.__d=void 0}function h_(e,t,n){return this.constructor(e,n)}function Mn(e,t,n){var r,i,o;U.__&&U.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],as(t,e=(!r&&n||t).__k=he(Ze,null,[e]),i||xi,xi,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Rr.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),bd(o,e)}function Sd(e,t){Mn(e,t,Sd)}function m_(e,t,n){var r,i,o,a=bt({},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?Rr.call(arguments,2):n),ir(e.type,a,r||e.key,i||e.ref,null)}function Cd(e,t){var n={__c:t="__cC"+dd++,__: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,fa(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}Rr=fd.slice,U={__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}},ld=0,Pn=!1,rt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=bt({},this.state),typeof e=="function"&&(e=e(bt({},n),this.props)),e&&bt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fa(this))},rt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fa(this))},rt.prototype.render=Ze,Yt=[],cd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ri.__r=0,dd=0;const Ru=e=>{let t;const n=new Set,r=(u,c)=>{const l=typeof u=="function"?u(t):u;if(!Object.is(l,t)){const d=t;t=(c!=null?c:typeof l!="object")?l:Object.assign({},t,l),n.forEach(p=>p(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>n.clear()};return t=e(r,i,s),s},g_=e=>e?Ru(e):Ru;var jt,ie,_o,Lu,Fn=0,Ed=[],ni=[],Ou=U.__b,Nu=U.__r,Uu=U.diffed,Du=U.__c,Pu=U.unmount;function hn(e,t){U.__h&&U.__h(ie,e,Fn||t),Fn=0;var n=ie.__H||(ie.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:ni}),n.__[e]}function Be(e){return Fn=1,ss(Rd,e)}function ss(e,t,n){var r=hn(jt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Rd(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=ie,!ie.u)){ie.u=!0;var i=ie.shouldComponentUpdate;ie.shouldComponentUpdate=function(o,a,s){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(l){return l.__c});if(u.every(function(l){return!l.__N}))return!i||i.call(this,o,a,s);var c=!1;return u.forEach(function(l){if(l.__N){var d=l.__[0];l.__=l.__N,l.__N=void 0,d!==l.__[0]&&(c=!0)}}),!(!c&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function $e(e,t){var n=hn(jt++,3);!U.__s&&ls(n.__H,t)&&(n.__=e,n.i=t,ie.__H.__h.push(n))}function Lr(e,t){var n=hn(jt++,4);!U.__s&&ls(n.__H,t)&&(n.__=e,n.i=t,ie.__h.push(n))}function Ht(e){return Fn=5,zi(function(){return{current:e}},[])}function kd(e,t,n){Fn=6,Lr(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 zi(e,t){var n=hn(jt++,7);return ls(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Ad(e,t){return Fn=8,zi(function(){return e},t)}function xd(e){var t=ie.context[e.__c],n=hn(jt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(ie)),t.props.value):e.__}function us(e,t){U.useDebugValue&&U.useDebugValue(t?t(e):e)}function v_(e){var t=hn(jt++,10),n=Be();return t.__=e,ie.componentDidCatch||(ie.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function Td(){var e=hn(jt++,11);if(!e.__){for(var t=ie.__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 y_(){for(var e;e=Ed.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ri),e.__H.__h.forEach(pa),e.__H.__h=[]}catch(t){e.__H.__h=[],U.__e(t,e.__v)}}U.__b=function(e){ie=null,Ou&&Ou(e)},U.__r=function(e){Nu&&Nu(e),jt=0;var t=(ie=e.__c).__H;t&&(_o===ie?(t.__h=[],ie.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=ni,n.__N=n.i=void 0})):(t.__h.forEach(ri),t.__h.forEach(pa),t.__h=[])),_o=ie},U.diffed=function(e){Uu&&Uu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ed.push(t)!==1&&Lu===U.requestAnimationFrame||((Lu=U.requestAnimationFrame)||__)(y_)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==ni&&(n.__=n.__V),n.i=void 0,n.__V=ni})),_o=ie=null},U.__c=function(e,t){t.some(function(n){try{n.__h.forEach(ri),n.__h=n.__h.filter(function(r){return!r.__||pa(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],U.__e(r,n.__v)}}),Du&&Du(e,t)},U.unmount=function(e){Pu&&Pu(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{ri(r)}catch(i){t=i}}),n.__H=void 0,t&&U.__e(t,n.__v))};var Mu=typeof requestAnimationFrame=="function";function __(e){var t,n=function(){clearTimeout(r),Mu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Mu&&(t=requestAnimationFrame(n))}function ri(e){var t=ie,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ie=t}function pa(e){var t=ie;e.__c=e.__(),ie=t}function ls(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Rd(e,t){return typeof t=="function"?t(e):t}function Ld(e,t){for(var n in t)e[n]=t[n];return e}function ha(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 bo(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Li(e){this.props=e}function Od(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:ha(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}(Li.prototype=new rt).isPureReactComponent=!0,Li.prototype.shouldComponentUpdate=function(e,t){return ha(this.props,e)||ha(this.state,t)};var Fu=U.__b;U.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Fu&&Fu(e)};var b_=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Nd(e){function t(n){var r=Ld({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=b_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Vu=function(e,t){return e==null?null:St(St(e).map(t))},Ud={map:Vu,forEach:Vu,count:function(e){return e?St(e).length:0},only:function(e){var t=St(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:St},w_=U.__e;U.__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)}w_(e,t,n,r)};var Bu=U.unmount;function Dd(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=Ld({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Dd(r,t,n)})),e}function Pd(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Pd(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 or(){this.__u=0,this.t=null,this.__b=null}function Md(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Fd(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 kn(){this.u=null,this.o=null}U.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),Bu&&Bu(e)},(or.prototype=new rt).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=Md(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 c=r.state.__a;r.__v.__k[0]=Pd(c,c.__c.__P,c.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}},u=t.__h===!0;r.__u++||u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},or.prototype.componentWillUnmount=function(){this.t=[]},or.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]=Dd(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&he(Ze,null,e.fallback);return i&&(i.__h=null),[he(Ze,null,t.__a?null:e.children),i]};var Hu=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 I_(e){return this.getChildContext=function(){return e.context},e.children}function S_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Mn(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)}}),Mn(he(I_,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function Vd(e,t){var n=he(S_,{__v:e,i:t});return n.containerInfo=t,n}(kn.prototype=new rt).__a=function(e){var t=this,n=Md(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Hu(t,e,r)):i()};n?n(o):o()}},kn.prototype.render=function(e){this.u=null,this.o=new Map;var t=St(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},kn.prototype.componentDidUpdate=kn.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Hu(e,n,t)})};var Bd=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,C_=/^(?: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]/,E_=typeof document<"u",k_=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Hd(e,t,n){return t.__k==null&&(t.textContent=""),Mn(e,t),typeof n=="function"&&n(),e?e.__c:null}function Kd(e,t,n){return Sd(e,t),typeof n=="function"&&n(),e?e.__c:null}rt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(rt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ku=U.event;function A_(){}function x_(){return this.cancelBubble}function T_(){return this.defaultPrevented}U.event=function(e){return Ku&&(e=Ku(e)),e.persist=A_,e.isPropagationStopped=x_,e.isDefaultPrevented=T_,e.nativeEvent=e};var jd,ju={configurable:!0,get:function(){return this.class}},Gu=U.vnode;U.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];E_&&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)&&!k_(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&&C_.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=St(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=St(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&&(ju.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",ju))}e.$$typeof=Bd,Gu&&Gu(e)};var zu=U.__r;U.__r=function(e){zu&&zu(e),jd=e.__c};var Gd={ReactCurrentDispatcher:{current:{readContext:function(e){return jd.__n[e.__c].props.value}}}},R_="17.0.2";function zd(e){return he.bind(null,e)}function cs(e){return!!e&&e.$$typeof===Bd}function Wd(e){return cs(e)?m_.apply(null,arguments):e}function qd(e){return!!e.__k&&(Mn(null,e),!0)}function $d(e){return e&&(e.base||e.nodeType===1&&e)||null}var Yd=function(e,t){return e(t)},Zd=function(e,t){return e(t)},Qd=Ze;function ds(e){e()}function Jd(e){return e}function Xd(){return[!1,ds]}var ef=Lr;function tf(e,t){var n=t(),r=Be({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Lr(function(){i.__=n,i.v=t,bo(i.__,t())||o({h:i})},[e,n,t]),$e(function(){return bo(i.__,i.v())||o({h:i}),e(function(){bo(i.__,i.v())||o({h:i})})},[e]),n}var L_={useState:Be,useId:Td,useReducer:ss,useEffect:$e,useLayoutEffect:Lr,useInsertionEffect:ef,useTransition:Xd,useDeferredValue:Jd,useSyncExternalStore:tf,startTransition:ds,useRef:Ht,useImperativeHandle:kd,useMemo:zi,useCallback:Ad,useContext:xd,useDebugValue:us,version:"17.0.2",Children:Ud,render:Hd,hydrate:Kd,unmountComponentAtNode:qd,createPortal:Vd,createElement:he,createContext:Cd,createFactory:zd,cloneElement:Wd,createRef:hd,Fragment:Ze,isValidElement:cs,findDOMNode:$d,Component:rt,PureComponent:Li,memo:Od,forwardRef:Nd,flushSync:Zd,unstable_batchedUpdates:Yd,StrictMode:Qd,Suspense:or,SuspenseList:kn,lazy:Fd,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Gd};const O_=Object.freeze(Object.defineProperty({__proto__:null,Children:Ud,PureComponent:Li,StrictMode:Qd,Suspense:or,SuspenseList:kn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Gd,cloneElement:Wd,createFactory:zd,createPortal:Vd,default:L_,findDOMNode:$d,flushSync:Zd,forwardRef:Nd,hydrate:Kd,isValidElement:cs,lazy:Fd,memo:Od,render:Hd,startTransition:ds,unmountComponentAtNode:qd,unstable_batchedUpdates:Yd,useDeferredValue:Jd,useInsertionEffect:ef,useSyncExternalStore:tf,useTransition:Xd,version:R_,Component:rt,Fragment:Ze,createContext:Cd,createElement:he,createRef:hd,useCallback:Ad,useContext:xd,useDebugValue:us,useEffect:$e,useErrorBoundary:v_,useId:Td,useImperativeHandle:kd,useLayoutEffect:Lr,useMemo:zi,useReducer:ss,useRef:Ht,useState:Be},Symbol.toStringTag,{value:"Module"}));var nf={exports:{}},rf={};const of=Nh(O_);var af={exports:{}},sf={};/**
38
- * @license React
39
- * use-sync-external-store-shim.production.min.js
40
- *
41
- * Copyright (c) Facebook, Inc. and its affiliates.
42
- *
43
- * This source code is licensed under the MIT license found in the
44
- * LICENSE file in the root directory of this source tree.
45
- */var Vn=of;function N_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var U_=typeof Object.is=="function"?Object.is:N_,D_=Vn.useState,P_=Vn.useEffect,M_=Vn.useLayoutEffect,F_=Vn.useDebugValue;function V_(e,t){var n=t(),r=D_({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return M_(function(){i.value=n,i.getSnapshot=t,wo(i)&&o({inst:i})},[e,n,t]),P_(function(){return wo(i)&&o({inst:i}),e(function(){wo(i)&&o({inst:i})})},[e]),F_(n),n}function wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!U_(e,n)}catch{return!0}}function B_(e,t){return t()}var H_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?B_:V_;sf.useSyncExternalStore=Vn.useSyncExternalStore!==void 0?Vn.useSyncExternalStore:H_;(function(e){e.exports=sf})(af);/**
46
- * @license React
47
- * use-sync-external-store-shim/with-selector.production.min.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 Wi=of,K_=af.exports;function j_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var G_=typeof Object.is=="function"?Object.is:j_,z_=K_.useSyncExternalStore,W_=Wi.useRef,q_=Wi.useEffect,$_=Wi.useMemo,Y_=Wi.useDebugValue;rf.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=W_(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=$_(function(){function u(f){if(!c){if(c=!0,l=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,G_(l,f))return h;var m=r(f);return i!==void 0&&i(h,m)?h:(l=f,d=m)}var c=!1,l,d,p=n===void 0?null:n;return[function(){return u(t())},p===null?void 0:function(){return u(p())}]},[t,n,r,i]);var s=z_(e,o[0],o[1]);return q_(function(){a.hasValue=!0,a.value=s},[s]),Y_(s),s};(function(e){e.exports=rf})(nf);const Z_=Oh(nf.exports),{useSyncExternalStoreWithSelector:Q_}=Z_;function J_(e,t=e.getState,n){const r=Q_(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return us(r),r}const Wu=e=>{const t=typeof e=="function"?g_(e):e,n=(r,i)=>J_(t,r,i);return Object.assign(n,t),n},uf=e=>e?Wu(e):Wu;var ma=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(ma||{});const qu=1,fs={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)}},X_=(e,t,n)=>{switch(t){case R.VideoVoice:return Boolean(e&&e.value);case R.Open:return!!n;case R.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case R.RecordedTask:return(n==null?void 0:n.taskStatus)===qe.Completed;case R.TextUrlPrompt:return!e.value;case R.ConsentLegal:return n!==null;case R.MultipleChoice:return n!==void 0;case R.NPS:return n!==null;case R.Likert:return n!==null;default:return!0}},lf=({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 l=0;l<s.length;l++){const{group:d,target:p}=s[l];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],w=d[m+1],y=$u({comparator:w.comparator,response:r[w.questionIndex],type:e[w.questionIndex].type,value:w.value});g===ma.And?h&&(h=y):g===ma.Or&&(h||(h=y))}if(h){a=p===-1&&n?e.length-1:p;break}}const u=e.findIndex(l=>l.type===R.Uploading);let c;return u>0?c=n?e.length-3:e.length-2:c=e.length-1,t>=c||a===-1||a!==null&&a>c?u>0&&Object.values(i).some(d=>d.isSubmitted&&!d.isComplete)?u:n?e.length-1:null:a===-1?null:a},$u=({comparator:e,response:t,type:n,value:r})=>{if(e===yt.Answered)switch(n){case R.TextUrlPrompt:return t===void 0;case R.ConsentLegal:return t&&t.submitted===!0;case R.RecordedTask:return"taskStatus"in t&&t.taskStatus===qe.Completed;case R.Likert:return Number.isInteger(t);case R.Open:return t&&t.length>0;case R.MultipleChoice:case R.MultipleSelect:return Object.keys(t).length>0;case R.NPS:return Number.isInteger(t);case R.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===yt.Skipped)switch(n){case R.TextUrlPrompt:return t==null?void 0:t.skipped;case R.ConsentLegal:return t===null;case R.RecordedTask:return"taskStatus"in t&&t.taskStatus===qe.Abandoned;case R.Likert:return t===null;case R.Open:return(t==null?void 0:t.length)===0;case R.MultipleChoice:return t===void 0;case R.MultipleSelect:return(t==null?void 0:t.length)===0;case R.NPS:return t===null;case R.VideoVoice:return t===null;default:return!1}return e===yt.GivenUp?n===R.RecordedTask?"taskStatus"in t&&t.taskStatus===qe.GivenUp:!0:fs[e](t,r)},e0=13,t0=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),n0=e=>{var t,n;switch(e.type){case R.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>e0?e.props.options.map(r=>[r.value]):t0(e.props.options.map(r=>r.value),!e.props.properties.required);case R.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 R.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 R.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case R.VideoVoice:case R.Open:return["1",...e.props.properties.required?[]:[""]];case R.RecordedTask:return[{taskStatus:qe.Completed},{taskStatus:qe.GivenUp},...e.props.properties.required?[]:[{taskStatus:qe.Abandoned}]];case R.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case R.ConsentLegal:return[qu,...e.props.properties.required?[]:[null]];default:return[qu]}},r0=e=>e in fs,i0=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,o0=(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:u,value:c}=s;return{comparator:u,target:o,value:c}});return[...n,...a]},[]),a0=(e,t)=>{const n=new Set([R.Thanks,R.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=o0(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let u=0,c=n0(a);if(c===null)return r.length-1-t;for(let l=0;l<s.length&&c.length!==0;l++){const{comparator:d,target:p,value:f}=s[l],h=c.filter(m=>{const g=X_({value:m},a.type,m);return!(g&&d===yt.Answered||!g&&d===yt.Skipped||d===yt.GivenUp&&i0(m)&&m.taskStatus===qe.GivenUp||g&&a.type===R.Open&&(d===yt.Contains||d===yt.DoesNotContain)||g&&r0(d)&&fs[d](m,f))});if(h.length<c.length){const m=parseInt(String(p),10);if(m!==-1&&m<=o||m>=r.length)return r.length-1-t;u=Math.max(i[m]+1,u)}c=h}c.length>0&&(u=Math.max(i[o+1]+1,u)),i[o]=u}return i[t]},s0=e=>!(e.type===R.Thanks||e.type===R.Uploading),le=uf()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=An)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),Io(r)||a({event:"closed"}),Uo.enable(),o({initiator:st.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Ye.SurveyComplete),await i(n),Uo.enable(),o({initiator:st.Complete})},endCard:{headline:""},envId:"",eventEmitFn:K.emit.bind(K),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return xn(i)?Promise.resolve():(r(H.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,{[Qt.QuestionId]:r[o].name,[Qt.Props]:r[o].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:i,isSubmitted:o})=>{var f,h,m;const{cards:a,destroy:s,index:u,uploadProgress:c}=t(),l=r||((f=c[n])==null?void 0:f.isComplete),d={...c,[n]:{progressPct:l?100:i||((h=c[n])==null?void 0:h.progressPct),isComplete:l,isSubmitted:o||((m=c[n])==null?void 0:m.isSubmitted)}};if(e({uploadProgress:d}),a[u].type!==R.Uploading)return;const p=Object.entries(c).every(([g,w])=>!w.isSubmitted||w.isComplete||n==g&&r);if(p&&u>=a.length-1)return s(An);e({index:p?u+1:u,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":sn.Web,"x-ul-environment-id":"","x-ul-installation-method":tn.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:u,trackHistory:c,uploadProgress:l,viewedCardCount:d}=t(),p=Date.now(),f=[...i],h=f[a],{type:m}=n.data,g={...n.data},w=g.value;s0(h)&&(h.value=w),g.answeredAt=p,delete g.type;const y={response:g,responseGroupUid:s,questionIndex:a};let v=m===R.MultipleChoice?Object.values(w).find(S=>S!==!1):w;m===R.MultipleSelect&&(v=f[a].props.options.reduce((S,E)=>(w[E.id]&&S.push(E.value),S),[]));const b=r.slice(0);b[a]=v,e({allResponses:b});const _=lf({cards:f,index:a,hasEndCard:!!n.endCard,uploadProgress:l,allResponses:b});if(_===null){y.completedAt=p,u(y),n.completeSurvey();return}else[R.Thanks,R.Uploading].includes(f[_].type)&&(y.completedAt=p);const C=u(y);[R.Thanks,R.Uploading].includes(f[_].type)||C.finally(()=>{c({event:"seen",index:_})});const A=f[_];f[_]&&o&&o(Ye.CurrentQuestion,{[Qt.QuestionId]:A.name,[Qt.Props]:A.props}),e({cards:f,hasViewedEmbed:!1,index:_,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:K,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(H.SurveyWillClose,{name:H.SurveyWillClose,initiator:n}),!xn(i)&&(o(H.SurveyWillClose,{name:H.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||Io(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&l_({id:a.surveyId});const u=await wt(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"});if(!u.ok){u.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",u.error),await Yu(a,"submitResponse",u.error));return}a.eventEmitFn(H.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(Io(o))return;const{cards:a,index:s}=o,u=r!==void 0?a[r]:a[s],c={sid:o.surveyId,qid:u.name,action:n,vid:o.userId,eid:o.envId,isNew:i,responseGroupUid:o.responseGroupUid,previewKey:o.previewKey},l=await wt(`${o.apiURL}/sdk/1/visitors/${o.userId}/surveys/${o.surveyId}/history`,{body:JSON.stringify(c),headers:o.headers,method:"POST"});!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",l.error),await Yu(o,"trackHistory",l.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=pc(o);xn(n)?r(H.SurveyHeight,{name:H.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})),Io=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,Yu=async(e,t,n)=>{const{mode:r,userId:i,envId:o,apiURL:a,headers:s,viewDocument:u}=e,c=u.documentElement,l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:c.clientWidth,clientHeight:c.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:l,vid:i,envId:o};(await wt(`${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)},u0=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},cf=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",Zu=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:cf()};return new MediaRecorder(e,t)},Qu=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function Ju(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[G.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>l0(t,e,n,r,s,i,o),e.stop()}}async function l0(e,t,n,r,i,o,a){const s=le.getState().viewDocument,{[G.UploadCallback]:u,[G.ProgressCallback]:c}=r,l={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[G.PassthroughData]},d=await u0(l,e);if(!d){u&&u(null,{message:"failed to get upload url"});return}const p=new Blob(a,{type:cf()});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=>{u&&u(null,m)}),h.on("progress",m=>{c&&c(i,m)}),h.on("success",()=>{u&&u(i,!0)})}const c0={chunks:{}},d0={state:{...c0},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?Ge.Video:Ge.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&Ju(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&Ju(r,t,Ge.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(Ee.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(Ee.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(Ee.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(Ee.StartTask,this.startTaskCallback.bind(this)),e.on(Ee.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(Ee.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,i,o;const{[G.StreamReadyCallback]:t,[G.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(Dn.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{[G.ScreenPermissionRequested]:t,[G.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{[G.RecordingMediaTypes]:t,[G.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(Ge.Video)&&this.state.avStream){this.state.avRecorder=Zu(this.state.avStream);const i=Pt();Qu(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(Ge.Screen)&&this.state.captureStream){this.state.screenRecorder=Zu(this.state.captureStream);const i=Pt();Qu(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[G.CurrentIndex]:t,[G.TaskResponse]:n,[G.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{[G.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}=le.getState(),s=lf({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===R.RecordedTask||[i,o].map(u=>{u&&(u.state==="recording"&&u.stop(),u.stream.getTracks().map(c=>{c.readyState==="live"&&c.stop()}))})}},ga=Object.create(d0);Object.freeze(ga);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 Y(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=df(e))&&(r&&(r+=" "),r+=t);return r}var f0=0;function I(e,t,n,r,i,o){var a,s,u={};for(s in t)s=="ref"?a=t[s]:u[s]=t[s];var c={type:e,props:u,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--f0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)u[s]===void 0&&(u[s]=a[s]);return U.vnode&&U.vnode(c),c}const Qe=e=>I("button",{...e,className:Y("ul-card-text__button",e.className),id:"ul-card-text__button"}),xt=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return I(Ze,{children:[e&&I("h1",{className:O.QuestionHeader,id:O.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&I("p",{className:O.Caption,id:O.Caption,children:n})]})},Xu=({buttonText:e="View Prototype",handleClick:t})=>I("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),mn=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=le(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),u=window.innerWidth<Pg,c=o["userleap-platform"],l=(p,f)=>{p.preventDefault(),r(f)};if(!a&&u&&!i&&s&&["email","link"].includes(c)){if(t==="prototype")return I(Xu,{handleClick:p=>{l(p,Ye.ViewPrototypeClick)}});if(t==="pdf")return I(Xu,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{l(p,Ye.ViewAgreementClick)}})}return e()},ff=(e,t)=>{const n=Ht(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,u=parseInt(window.getComputedStyle(i).getPropertyValue("max-height")),c=s<=u?s:u;n.current!==c&&t(),n.current=c,i.style.height=`${c}px`}};return $e(r,[]),r},pf=({border:e,label:t,isSelected:n,value:r,text:i,id:o,isRadio:a,useMobileStyling:s,error:u,allowTextEntry:c,promptText:l,onUserInputChanged:d})=>{const{styleNonce:p,viewDocument:f}=le(E=>({styleNonce:E.styleNonce,viewDocument:E.viewDocument})),[h,m]=Be(!1);m0(f,e,p);const g=({isSelected:E,userText:x})=>{d&&d({id:o||"",selected:E,value:r,userText:x})},w=E=>{E.stopPropagation(),g({isSelected:a||!n,userText:i}),m(!1)},y=()=>{h||m(!0)},v=()=>{h&&m(!1)},b=E=>{(E.key==="Enter"||E.key===" ")&&w(E)},_={onClick:E=>w(E),onKeyPress:E=>b(E)};"ontouchstart"in f.documentElement?(_.onTouchStart=v,_.onTouchCancel=v,_.onTouchEnd=v):(_.onMouseDown=y,_.onMouseLeave=v);const C=a?`radio-${o}`:`checkbox-${o}`,A=n||h?[ii]:[],S=[...u?[hf]:[],...A];return I("div",{className:Y([...ye(O.Choice,s),...S]),id:`choice-div-${o}`,style:u?{borderColor:er}:{},..._,children:[I("div",{className:Y([O.ChoiceLabelContainer]),children:[a?I("div",{"aria-labelledby":`label-${o}`,className:Y([O.ChoiceRadio,...A]),id:C,role:"radio",tabIndex:0}):I("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:O.ChoiceCheckbox,id:C,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&I("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:I("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),I("label",{className:Y(ye(O.ChoiceLabel,s)),htmlFor:C,id:`label-${o}`,children:t})]}),c&&n&&I("div",{className:Y([O.ChoiceTextEntryContainer,...A]),children:I(p0,{onTextChange:E=>g({isSelected:n,userText:E}),promptText:l||"Please specify",textValue:i,useMobileStyling:s})})]})},p0=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=Ht(null),{update:o}=le(s=>({update:s.update})),a=ff(i,()=>o());return $e(()=>{i.current&&i.current.focus()},[]),I("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:Y(ye(O.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),s.stopPropagation(),n(s.currentTarget.value)},onClick:s=>{s.stopPropagation()},onKeyPress:s=>{s.stopPropagation()},placeholder:e,ref:i,role:"textbox",rows:1,value:t})},el="ul-select-style-element",ii="ul-select-active-dynamic-style",hf="ul-select-error-dynamic-style",h0=e=>e.tagName.toLowerCase()==="style",m0=(e,t,n)=>{let r=e.getElementById(el),i=!1;r||(r=e.createElement("style"),i=!0),h0(r)&&(r.id=el,n&&(r.nonce=n),r.textContent=g0(t),i&&e.head.appendChild(r))},g0=e=>`
54
- .${ii} {
55
- border-color: ${e};
56
- }
57
- .${ii} .${O.ChoiceRadio}, .${ii}.${O.ChoiceRadio} {
58
- border: 6px solid ${e};
59
- box-shadow: none;
60
- }
61
- .${hf} {
62
- border-color: ${er};
63
- }
64
- `,Or=e=>(e==null?void 0:e.buttonText)||"Next",mf=e=>(e==null?void 0:e.skipButtonText)||"Skip",v0=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{useMobileStyling:a,border:s}=le(E=>({useMobileStyling:E.useMobileStyling,border:E.border})),[u,c]=Be(!1),[l,d]=Be(""),[p,f]=Be(!1),h=r==null?void 0:r.collectName,m=(r==null?void 0:r.nameLabelText)||"Full Name",g=(r==null?void 0:r.consentText)||"I agree to the stated conditions",w=(r==null?void 0:r.submitButtonText)||"Submit",y=!!l.trim(),v=u&&(!h||y),b=(E,x=!1)=>{E.preventDefault(),E.stopPropagation();let N=null;if(!x){if(!v){f(!0);return}N={submitted:!0},h&&(N.name=l)}n({value:N,questionId:i,type:o})},_=E=>{E.preventDefault(),E.stopPropagation(),d(E.currentTarget.value)},C=E=>{E.currentTarget.style.borderColor=p&&!y?er:s},A=E=>{E.currentTarget.style.borderColor=p&&!y?er:Ba},S=()=>I("div",{children:[I(pf,{allowTextEntry:!1,border:s,error:p&&!u,index:0,isRadio:!1,isSelected:u,label:g,onUserInputChanged:({selected:E})=>{E!==u&&c(!u)},useMobileStyling:a}),h&&I("input",{"aria-label":m,"aria-placeholder":m,className:Y(ye(O.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:A,onFocus:C,onInput:_,placeholder:m,style:p&&!y?{borderColor:er}:{},tabIndex:0,value:l}),I("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[I(Qe,{className:v?"":O.ButtonDisabled,onClick:b,children:w}),r.required===!1&&I("button",{className:O.SkipButton,onClick:E=>b(E,!0),children:mf(r)})]})]});return I("div",{className:Y([e,"ul-card__consent-legal",O.FadeInTransition]),children:[I(xt,{message:t}),I("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),I(mn,{properties:r,defaultBody:S,embeddedType:"pdf"})]},i)},y0=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:u,useMobileStyling:c,value:l})=>{const d=`option-${l}`,p=a===Xt.Number,f=a===Xt.Star,h=p&&l===e,[m,g]=(()=>l<=e&&f||l===e?r?[t,1]:[t,.3]:["",1])(),w=()=>{switch(a){case Xt.Star:return Y([...ye(O.LikertStar,c),...ye(`${O.LikertStar}-${l}`,c)]);case Xt.Smiley:return Y([...ye(O.LikertSmiley,c),...ye(`${O.LikertSmiley}-${l}`,c)]);default:return Y(l===o?[...ye(O.LikertNumber,c),...ye(`${O.LikertNumber}-${l}`,c),...ye("likert-last-option",c)]:[...ye(O.LikertNumber,c),...ye(`${O.LikertNumber}-${l}`,c)])}},y=()=>{s(-1),u(!1)};return I("div",{"aria-label":p?void 0:String(l),className:w(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>u(!0),onPointerEnter:()=>s(l),onPointerLeave:y,role:"radio",style:{color:p?"":m,borderColor:h?m:"",fillOpacity:h?"":g,zIndex:h?3:"auto"},tabIndex:0})},_0=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:u}=le(S=>({border:S.border,useMobileStyling:S.useMobileStyling})),[c,l]=Be(-1),[d,p]=Be(!1),f=t&&t.left,h=t&&t.right;let m;const{range:g,scaleLabelType:w,ratingIcons:y}=i;g&&(m=Number(g));const v=m||5,b=S=>{var E,x;switch(w){case Xt.Star:return(E=y[0])==null?void 0:E.svg;case Xt.Smiley:return(x=y[S])==null?void 0:x.svg;default:return String(S+1)}},_=[...Array(v)].map((S,E)=>{const x=E+1;return I(y0,{activeValue:c,border:s,icon:b(E),isPressed:d,onSubmit:()=>r({value:x,questionId:o,type:a}),range:v,scaleLabelType:w,setActiveValue:l,setIsPressed:p,useMobileStyling:u,value:x},E)}),C=S=>{S.preventDefault(),S.stopPropagation(),r({value:null,questionId:o,type:a})},A=()=>I(Ze,{children:[I("div",{"aria-label":`Rating (1 - ${v})`,className:"ul-card--likert__numbers",role:"radiogroup",children:_}),I("div",{className:"ul-card--likert__labels",children:[I("span",{children:f}),I("span",{children:h})]}),!i.required&&I("div",{className:"ul-vertical-centered-container",children:I(Qe,{onClick:C,children:Or(i)})})]});return I("form",{className:Y([e,"ul-card--likert",O.FadeInTransition]),children:[I(xt,{message:n,properties:i}),I(mn,{properties:i,defaultBody:A})]},o)},gf=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:u}=le(_=>({border:_.border,useMobileStyling:_.useMobileStyling})),c=r.reduce((_,C)=>(_[C.id]={isSelected:!1},_),{}),[l,d]=Be(c),p=a===R.MultipleChoice,f=i.required,h=Object.entries(l).some(([_,C])=>{var E;const A=r.find(x=>`${x.id}`===_),S=C.userText===void 0||C.userText.trim()==="";return((E=A==null?void 0:A.optionProperties)==null?void 0:E.allowsTextEntry)&&S&&C.isSelected}),m=Object.values(l).some(_=>_.isSelected),g=h||f&&!m,w=r.map(({id:_,label:C,value:A,optionProperties:S},E)=>{var M,D;const x=`${_}`,{allowsTextEntry:N}=S||{allowsTextEntry:!1};return I(pf,{allowTextEntry:N,border:s,error:!1,id:x,index:E,isRadio:p,isSelected:!!((M=l[x])!=null&&M.isSelected),label:C,onUserInputChanged:T=>v(T.id,T.selected,T.userText),promptText:"Please specify",text:(D=l[_])==null?void 0:D.userText,useMobileStyling:u,value:A},x)}),y=_=>{_.preventDefault(),_.stopPropagation(),n(l)},v=(_,C,A)=>{const S=Object.assign({},l);if(p&&C)for(const E of Object.values(S))E.isSelected=!1,delete E.userText;S[_]={isSelected:C,userText:A},d(S)},b=()=>I("div",{children:[I("div",{className:Y(ye(O.ChoiceGroup,u)),role:p?"radiogroup":"group",children:w}),I("div",{className:"ul-card__button-wrapper",children:I(Qe,{disabled:g,onClick:y,children:Or(i)})})]});return I("form",{className:Y([e,"ul-card--multiple",O.FadeInTransition]),id:"text-form",onSubmit:y,children:[I(xt,{message:t,properties:i}),I(mn,{properties:i,defaultBody:b})]},o)},b0=e=>{const{questionId:t,type:n,next:r,options:i}=e;return I(gf,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,p])=>p.isSelected)||[void 0,void 0],[u,c]=s,l=i.find(p=>`${p.id}`===u),d=c!=null&&c.userText?{[u]:{userText:c.userText}}:null;r({value:l&&u?{[u]:l.value}:{},secondaryValue:d,questionId:t,type:n})}})},w0=e=>{const{questionId:t,type:n,next:r}=e;return I(gf,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((c,[l,d])=>(c[l]=d.isSelected,c),a),u=Object.entries(o).reduce((c,[l,d])=>{if(!d.userText)return c;const p=c||{};return p[l]={userText:d.userText},p},null);r({value:s,secondaryValue:u,questionId:t,type:n})}})},I0=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:u}=le(h=>({border:h.border,useMobileStyling:h.useMobileStyling})),c=t&&t.left,l=t&&t.right,d=[...Array(11)].map((h,m)=>I("div",{className:Y([...ye(O.NPSNumber,u),...ye(`${O.NPSNumber}-${m}`,u)]),id:`option-${m}`,onClick:()=>i({value:m,questionId:o,type:a}),onKeyPress:g=>{g.preventDefault(),(g.key==="Enter"||g.key===" ")&&i({value:m,questionId:o,type:a})},onPointerDown:g=>{g.currentTarget.style.zIndex="2",g.currentTarget.style.borderColor=s},onPointerLeave:g=>{g.currentTarget.style.zIndex="auto",g.currentTarget.style.borderColor=Ba},role:"radio",tabIndex:0,children:m},m)),p=h=>{h.preventDefault(),h.stopPropagation(),i({value:null,questionId:o,type:a})},f=()=>I("div",{children:[I("div",{className:"ul-card--nps__numbers",children:d}),I("div",{className:"ul-card--nps__labels",children:[I("span",{children:c}),I("span",{children:l})]}),!r.required&&I("div",{className:"ul-vertical-centered-container",children:I(Qe,{onClick:p,children:Or(r)})})]});return I("form",{className:Y([e,"ul-card--nps",O.FadeInTransition]),children:[I(xt,{message:n,properties:r}),I(mn,{properties:r,defaultBody:f})]},o)},S0=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,useMobileStyling:s,update:u}=le(_=>({border:_.border,useMobileStyling:_.useMobileStyling,update:_.update})),[c,l]=Be(""),d=Ht(null),p=c.trim(),f=r.required===!0&&!p,h=ff(d,()=>u()),m=_=>{h(),_.preventDefault(),_.stopPropagation(),l(_.currentTarget.value)},g=_=>{_.preventDefault(),_.stopPropagation(),n({value:c,questionId:i,type:o})},w=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",y=_=>{_.currentTarget.style.borderColor=a},v=_=>{_.currentTarget.style.borderColor=Ba},b=()=>I("div",{className:"ul-card-text",children:[I("div",{className:"ul-card-text__container",children:I("textarea",{"aria-label":w,"aria-labelledby":O.QuestionHeader,"aria-multiline":"true","aria-placeholder":w,className:Y(ye(O.OpenTextInput,s)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:v,onChange:m,onFocus:y,placeholder:w,ref:d,role:"textbox",tabIndex:0})}),I(Qe,{disabled:f,onClick:g,style:{backgroundColor:f?"":a},children:Or(r)})]});return I("form",{className:Y([e,"ul-card--text",O.FadeInTransition]),id:"text-form",children:[I(xt,{message:t,properties:r}),I(mn,{defaultBody:b,properties:r})]},i)};var Dt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Dt||{});const qi=e=>e.type===We.AvPermission,vf=e=>e.type===We.ScreenPermission,C0=(e,t)=>!(qi(t)?t.permissionDescriptors:[]).includes(Dn.Camera)||e.getVideoTracks().length>0,yf=(e,t)=>{if(e===void 0)return Dt.RequestNeeded;if(e){if(!C0(e,t))return Dt.RequestNeeded}else return Dt.TryAgain;return Dt.Ready},tl={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ut=uf(e=>({...tl,reset:()=>{e(tl)},updatePage:t=>{e(t)}}));function va({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=ut.getState(),{recorderEventEmitter:o}=le.getState();o.emit(Ee.AvPermission,{[G.PermissionDescriptors]:e.permissionDescriptors,[G.StreamReadyCallback]:(a,s)=>{if(n===a)return;let u=e;if(a&&!e.permissionDescriptors.includes(Dn.Camera)){const c=t.indexOf(e),l=s!=null&&s.active?c+2:c+1;(s==null?void 0:s.active)&&r&&o.emit(Ee.BeginRecording,{[G.RecordingMediaTypes]:r,[G.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),u=t[l]}i({currentPage:u,avStream:a})}})}function E0({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=ut.getState(),{eventEmitFn:s,recorderEventEmitter:u}=le.getState(),c={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let l=0;u.emit(Ye.RecordedTaskPermissionScreen),s(Ye.RecordedTaskPermissionScreen),u.emit(Ee.PermissionStatus,{[G.PermissionStatusCallback]:(p,f,h,m)=>{const g=e[l],{type:w}=g,y=[Ge.Screen];if(qi(g)){const{permissionDescriptors:v}=g,b=v==null?void 0:v.includes(Dn.Microphone),_=v==null?void 0:v.includes(Dn.Camera);b&&y.push(Ge.Audio),_&&y.push(Ge.Video);const C=(p==null?void 0:p.active)&&!_,A=(p==null?void 0:p.active)&&f;(C||A)&&l++}vf(e[l])&&h&&(l++,u.emit(Ee.BeginRecording,{[G.RecordingMediaTypes]:y,[G.StartRecordingCallback]:v=>a({mediaRecordingUids:v})})),a({currentPage:e[l],avStream:p,screenPermissionRequested:h,nextQuestion:o,type:w,passthroughData:c,recordingMediaTypes:y,captureStream:m})}});const d=e[l];return d.type===We.AvPermission&&va({currentPage:d,pages:e}),d}function ya({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=ut.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=le.getState(),u={value:{taskStatus:e},type:R.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(Ee.FinishTask,{[G.BeginCallback]:c=>{a({mediaRecordingUid:c,isSubmitted:!0,progressPct:0,isComplete:!1})},[G.ProgressCallback]:(c,l)=>{a({mediaRecordingUid:c,progressPct:l.detail,isSubmitted:!1,isComplete:!1})},[G.UploadCallback]:c=>{c&&a({mediaRecordingUid:c,isComplete:!0,isSubmitted:!0,progressPct:100})},[G.PassthroughData]:n,[G.CurrentIndex]:s,[G.TaskResponse]:u,[G.TaskCompleteCallback]:c=>{u.value.taskDurationMillisecond=c,r&&(u.value.mediaRecordingUids=r),i(),t(u)}})}function ps({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=le.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=ut.getState();if(!o)return;const u=e.indexOf(o);switch(o.type){case We.AvPermission:{const c=s?u+2:u+1;s&&a&&n.emit(Ee.BeginRecording,{[G.RecordingMediaTypes]:a,[G.StartRecordingCallback]:l=>{i({mediaRecordingUids:l})}}),i({currentPage:e[c]});return}case We.ScreenPermission:n.emit(Ee.ScreenPermission,{[G.ScreenPermissionRequested]:t,[G.StreamReadyCallback]:(c,l)=>{const d=l?e[u+1]:o;l&&a&&n.emit(Ee.BeginRecording,{[G.RecordingMediaTypes]:a,[G.StartRecordingCallback]:p=>{i({captureStream:l,mediaRecordingUids:p})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:l})}});return;case We.StartTask:r(Ye.RecordedTaskStart),n.emit(Ye.RecordedTaskStart),n.emit(Ee.StartTask),i({currentPage:e[u+1],screenPermissionRequested:!0});return;case We.CompleteTask:return}}const _f="ul-permission-graphics-container",bf="ul-permission-body",wf=Y([_f,"ul_recorded-task-inset-spacing"]),$i=Y(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),If=({richTextBody:e})=>I("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Yi=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:I(Qe,{className:Y([n&&"ul-skip-button-below",O.InactiveButton]),onClick:ya.bind(null,{status:qe.Abandoned}),children:t||"Skip"}),hs=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=ut.getState(),o=(r==null?void 0:r.includes(Ge.Audio))||(r==null?void 0:r.includes(Ge.Video));$e(()=>{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])},k0=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return hs(t),I("div",{className:"ul-task-page",children:[I(If,{richTextBody:o}),I("div",{className:$i,children:[I(Qe,{onClick:ps.bind(null,{pages:t}),children:r}),I(Yi,{required:n,skipButtonText:i})]})]},"start-task")},A0=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;hs(t);const a=I(mn,{properties:n,defaultBody:()=>I("div",{className:$i,children:[I(Qe,{className:"ul-complete-task-button",onClick:ya.bind(null,{status:qe.Completed}),children:r}),I(Qe,{className:Y([O.InactiveButton]),onClick:ya.bind(null,{status:qe.GivenUp}),children:i})]})});return I("div",{className:"ul-task-page",children:[I(If,{richTextBody:e.taskDetail}),a]},"complete-task")},x0=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=le(u=>[u.tabTitle]),[a,s]=Be(!1);return I("div",{children:[I("div",{className:wf,children:[I("p",{style:{marginTop:"auto"},children:e.selectTabText}),I("div",{className:"ul-select-tab-container",children:I("p",{className:bf,children:o})})]}),I("div",{className:n?"":$i,children:[I(Qe,{disabled:a,onClick:ps.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),I(Yi,{required:n,skipButtonText:i})]})]})},T0=({content:e})=>I("div",{className:Y([_f,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),R0=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=qi(t[0])?t[0]:null;return $e(()=>{const u=setInterval(()=>{s!==null&&va({currentPage:s,pages:t})},1e3);return()=>clearInterval(u)},[s,t]),s?I("div",{children:[I("div",{className:wf,children:I("p",{className:"ul-av-permission-denied-paragraph",children:[I("span",{className:"ul-av-permission-denied-headline",children:r}),I("span",{className:bf,children:i})]})}),I("div",{className:$i,children:[I(Qe,{onClick:va.bind(null,{currentPage:s,pages:t}),children:a}),I(Yi,{required:n,skipButtonText:o})]})]}):null},L0=({stream:e})=>I("video",{autoPlay:!0,className:Y(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),O0=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=ut.getState();return hs(t),I("div",{children:[I(L0,{stream:i}),I("div",{className:"ul-vertical-button-container-center",children:[I(Qe,{onClick:ps.bind(null,{pages:t}),children:e.buttonText}),I(Yi,{bottom:!0,required:n,skipButtonText:r})]})]})},N0=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=ut.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case We.AvPermission:{const o=yf(r,i);return o===Dt.RequestNeeded?I(T0,{content:i}):o===Dt.TryAgain?I(R0,{content:i,pages:t,required:n}):I(O0,{content:i,pages:t,required:n})}case We.ScreenPermission:return I(x0,{content:i,pages:t,required:n});case We.StartTask:return I(k0,{content:i,pages:t,required:n});case We.CompleteTask:return I(A0,{content:i,pages:t,properties:e});default:return null}},U0=({className:e,properties:t,next:n,questionId:r})=>{const i=le(),{surveyId:o,responseGroupUid:a,userId:s}=i,u=ut(),{screenPermissionRequested:c}=u,l=ut(m=>m.avStream);let d=ut(m=>m.currentPage);d||(d=E0({questionId:r,surveyId:o,next:m=>{n(m)},pages:t.pages,responseGroupUid:a,userId:s}));let p=d.headline,f=d.captionText;const h=yf(l,d);return vf(d)&&c&&(p=d.permissionDeniedHeadline,f=d.permissionDeniedCaptionText),qi(d)&&h===Dt.Ready&&(p=d.permissionGrantedHeadline,f=d.permissionGrantedCaptionText),I("div",{className:Y([e,"ul-center-horizontally",O.FadeInTransition]),children:[I(xt,{message:p,properties:{captionText:f}}),I(N0,{properties:t})]})},D0={"{{user_id}}":"externalUserId","{{email}}":"email"},P0=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[u,c]of Object.entries(D0))if(n.toLowerCase().includes(u))if(t[c]){const l=new RegExp(u,"gi");n=n.replace(l,t[c])}else r.push(u);if(r.length===0||!n.includes("?"))return n;const i=n.slice(0,n.indexOf("?")),a=n.slice(n.indexOf("?")+1).split("&").map(u=>u.split("=")).filter(u=>!r.includes(u[1]));if(a.length===0)return i;const s=a.map(u=>u.join("=")).join("&");return`${i}?${s}`},M0=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{visitorAttributes:a}=le(d=>({visitorAttributes:d.visitorAttributes})),s=(d,p=!1)=>{n({value:p?{skipped:!0}:void 0,questionId:i,type:o})},u=d=>{(d.key==="Enter"||d.key===" ")&&n({value:void 0,questionId:i,type:o})},c=()=>{const d=P0(r&&r.buttonUrl,a);return I("div",{className:"ul-card-button-group",children:[I("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:d,id:"ul-card-text__button",onClick:s,onKeyPress:u,rel:"noreferrer",role:d?"link":"button",tabIndex:0,target:"_blank",children:Or(r)}),r.required===!1&&I("button",{className:O.SkipButton,onClick:p=>s(p,!0),children:mf(r)})]})},l=(d,p)=>d?I("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:d},id:"ul-card__text-url-body-container"}):I("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(p?p.split(/\n\s*\n/g):[]).map((f,h)=>I("p",{children:f},h))});return I("div",{className:Y([e,"ul-card__text-url-prompt",O.FadeInTransition]),children:[I(xt,{message:t}),l(r&&r.richTextBody,r&&r.body),I(mn,{defaultBody:c,properties:r})]},i)},F0=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o}=le(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo}));$e(()=>{setTimeout(()=>{r(An)},o?4e3:2e3)},[r,o]);const a=i&&i.subheader?I("p",{className:O.Caption,children:i.subheader}):null,s=i&&i.headline?i.headline:"";return I("div",{className:Y([e,"ul-card--thanks",O.FadeInTransition]),children:I("div",{children:I("div",{className:"ul-card--thanks-content",children:[I("div",{className:"ul-thanks-check",children:I("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[I("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"}),I("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"}),I("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"})]})}),I(xt,{message:s}),a]})})},t)},V0=({className:e})=>{const{uploadProgress:t}=le(o=>({uploadProgress:o.uploadProgress}));let n,r;Object.values(t).filter(o=>o.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(t).filter(o=>o.isSubmitted).map(o=>o.progressPct||0)));return I("div",{className:Y([e,"ul-card--uploading",O.FadeInTransition]),children:[I("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:O.LoadingSpinnerContainer,role:"progressbar",children:I("div",{className:O.LoadingSpinner,children:[I("div",{className:O.LoadingSpinnerFirst}),I("div",{className:O.LoadingSpinnerSecond}),I("div",{className:O.LoadingSpinnerThird}),I("div",{className:O.LoadingSpinnerFourth})]})}),I(xt,{message:`${n} (${i}% complete)`}),I("p",{className:O.Caption,children:r})]})},nl=({logoOnly:e=!1,style:t={}})=>I("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&&I("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"}),I("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"}),I("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"}),I("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"}),I("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"}),I("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"})]}),B0=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:u,viewedCardCount:c}=le(v=>({border:v.border,cards:v.cards,forceBrandedLogo:v.forceBrandedLogo,headers:v.headers,index:v.index,marketingUrl:v.marketingUrl,showSurveyBrand:v.showSurveyBrand,slugName:v.slugName,surveyId:v.surveyId,viewedCardCount:v.viewedCardCount})),l=Ht(null),d=t.filter(v=>v.type!==R.Uploading&&v.type!==R.Thanks),p=a0(t,i),f=c+1,h=f/(f+p),m=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${u}${n&&"&utm_term=poweredby_pill"}`;$e(()=>{l.current&&(l.current.style.width=`${h*100}%`)},[h]);const g=()=>I(Ze,{children:[d.length>1&&I("div",{id:"ul-progress-bar-container",children:I("div",{id:"ul-progress-bar-current",ref:l,style:{border:`1px solid ${e||"#000"}`}})}),a?I("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:I("a",{href:m,rel:"noreferrer",target:"_blank",children:I("div",{style:{display:"flex"},children:[I(nl,{logoOnly:!1}),n&&I(rl,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),w=()=>I("a",{dir:"ltr",href:m,rel:"noreferrer",target:"_blank",children:I("div",{className:"thank-you-card-link",children:[I("div",{className:"sprig-box-logo",children:I(nl,{logoOnly:!0,style:{margin:"auto"}})}),I("div",{children:I("p",{children:["Capture insights about your own product",I(rl,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),y=t[i].type===R.Thanks;return I("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:y&&n?w():g()})},rl=({style:e})=>I("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[I("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),I("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),H0=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:u,headers:c,index:l,next:d,showStripes:p,update:f,useMobileStyling:h,viewDocument:m}=le(T=>({answers:T.answers,border:T.border,cards:T.cards,close:T.close,configureExitOnOverlayClick:T.configureExitOnOverlayClick,destroy:T.destroy,endCard:T.endCard,eventEmitFn:T.eventEmitFn,fontFamily:T.fontFamily,headers:T.headers,index:T.index,next:T.next,showStripes:T.showStripes,update:T.update,useMobileStyling:T.useMobileStyling,viewDocument:T.viewDocument})),g=Ht(null),w=Ht(!1),y=c["userleap-platform"],{props:v,type:b,name:_}=n[l],C=n.length;$e(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(H.SurveyAppeared)))},[s]),$e(()=>{f()},[l,f]),$e(()=>{i(()=>r())},[r,i]);const A=()=>r(An),S=T=>{T.key==="Enter"&&A()},E=async function(T){d({data:T,completeSurvey:()=>{o(An)},endCard:a}),Hg(m)};if(e){for(const T of e)if(T.questionId===_){let k;if(b===R.MultipleChoice){const B=v.options.find(({value:Z})=>Z===T.value);if(!B)break;k={[B.id]:B.value}}else k=T.value;E({value:k,type:b,questionId:T.questionId});break}}const x=()=>[sn.Email,sn.Link].includes(c["userleap-platform"])?!1:!a||l+1!==C,N=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},M=()=>{const T={className:"ul-card",next:E,questionId:_,type:b};switch(b){case R.ConsentLegal:return he(v0,{...T,...v,key:_});case R.Likert:return he(_0,{...T,...v,key:_});case R.MultipleChoice:return he(b0,{...T,...v,key:_});case R.MultipleSelect:return he(w0,{...T,...v,key:_});case R.NPS:return he(I0,{...T,key:_,props:v});case R.Open:return he(S0,{...T,...v,key:_});case R.RecordedTask:return he(U0,{...T,...v,key:_});case R.TextUrlPrompt:return he(M0,{...T,...v,key:_});case R.Thanks:return he(F0,{...T,...v,key:_});case R.Uploading:return he(V0,{...T,...v,key:_});case R.VideoVoice:return null;default:return null}},D=T=>{var se;const k=window.sprigAPI,B=T.target;if(!k||!B)return;const Z=[B,B.parentElement];for(const X of Z)if(((se=X==null?void 0:X.tagName)==null?void 0:se.toLowerCase())==="a"){T.preventDefault(),k==null||k.openUrl(X.href);return}};return I("div",{className:Y("ul-app",xn(c)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:An,onClick:D,ref:g,style:{"--theme":t,...u?{fontFamily:u.replace(";","")}:{}},children:I("div",{className:"ul-app__container",children:I("div",{className:Y(ye(O.CardContainer,h)),style:N(),children:[x()&&I("div",{className:Y(ye(O.CloseContainer,h)),children:I("div",{"aria-label":"Close button",className:O.CloseButton,onClick:A,onKeyPress:S,role:"button",tabIndex:0,children:I("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:I("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"})})})}),p&&I("div",{className:"ul-header__container",dir:"ltr",children:I("div",{className:"ul-header",children:"For development purposes only"})}),I("div",{className:Y(jg(O.CardMainContent,y)),children:M()}),I(B0,{})]})})})},K0=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;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}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:start}.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:start}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;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}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.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}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card-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:start;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.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%}.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;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.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;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%}.close-btn{cursor:pointer;height:18px;margin-inline-end:-10px;position:relative;top:-10px;width:18px;z-index:1}.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}
65
- `,j0=(e,t)=>{const n=[...e],r=new Set([R.VideoVoice,R.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:R.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:R.Thanks}),n},G0=({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 z0(e,t=!0){var _;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:u,previewKey:c,viewDocument:l,viewWindow:d}=e,p=xn(e.headers)?e.frame:l.body,f=e.UpChunk||window.UpChunk,h=K,m=j0(e.cards,!!o);ga.configure(h,{cards:m,hasEndCard:!!o,apiURL:r,UpChunk:f}),le.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:u,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:G0({mode:e.mode,viewWindow:d,viewDocument:l}),mode:e.mode,previewKey:c,recorder:ga,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}=le.getState();g();const{head:w}=l,y=l.createElement("style");if(y.id="sprig-style",y.textContent=K0,y.nonce=e.styleNonce,w.appendChild(y),e.fontFamily&&s&&parent){const C=l.createElement("link");C.rel="stylesheet",C.href=s,w.appendChild(C)}e.customStyles&&fc(l,i,e.styleNonce);const v="2.24.12-beta.0",b=a||((_=u.eventEmitter)==null?void 0:_.emit);b==null||b(Ye.VerifyViewVersion,{[Qt.ViewVersion]:v}),p&&t&&Mn(I(H0,{}),p)}const W0={configure:z0};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 q0="rgba(255,255,255, 0.95)",$0="rgba(0,0,0,0.9)",Y0="360px",So="0px",Sf=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},Cf=e=>{eb();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,Me("trackStartUrl",null),K.emit(H.SurveyLifeCycle,{state:"dismissed"}),K.emit(H.SurveyClosed,{name:H.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)}},Ef=()=>{K.on(H.SurveyWillClose,({initiator:e})=>{Cf(e)})},Z0=(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"?q0:$0,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Q0=(e,t,n)=>{var s,u;const r={position:"fixed",bottom:"0px",right:So,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%",(u=window.UserLeap.windowDimensions)!=null&&u.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=Y0,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===$n.BottomLeft?o={left:So}:i.framePosition===$n.TopLeft?o={left:So,top:"0px"}:i.framePosition===$n.TopRight?o={top:"0px"}:i.framePosition===$n.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&Z0(i,n),Object.assign(e.style,r,o),a},J0=(e,t)=>{var s,u;const n="ul-frame";Sf(),X0();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=Q0(r,e,t);Ef(),r.setHeight=c=>{parseInt(r.style.height)!=c&&(r.style.height=`${c}px`,K.emit(H.SurveyHeight,{name:H.SurveyHeight,contentFrameHeight:c}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{K.emit(H.CloseSurveyOnOverlayClick)}),K.emit(H.SurveyLifeCycle,{state:"presented"}),K.emit(H.SurveyPresented,{name:H.SurveyPresented});const o=(u=r.contentWindow)==null?void 0:u.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}},kf={[H.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},X0=()=>{Object.entries(kf).forEach(([e,t])=>{K.on(e,t)})},eb=()=>{Object.entries(kf).forEach(([e,t])=>{K.off(e,t)})},tb="!launch_darkly_";class nb{constructor(){ge(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[`${tb}${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 _a=new nb;Object.freeze(_a);const rb="!optimizely_experiments_";class ib{constructor(){ge(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 rb+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 oi=new ib;Object.freeze(oi);class ob{constructor(t,n){ge(this,"paused");ge(this,"queue");ge(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 ze=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(ze||{}),Af=(e=>(e.Preview="sprigPreviewKey",e))(Af||{});const ab=["popState","pushState","replaceState"],sb={test:"test"},Wn="!email",ub=["ios","android"],en="environments",ba="pageUrl",Wt="visitors",il="ul-view-sdk-script",ol=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 ms(e,t){const{matchType:n,pattern:r}=e,i=n?ol[n]:ol.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 lb(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?ms(a,window.location.href):t===window.location.href}function vr(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==sn.Web)return;const o=qt("trackStartUrl"),a=o?String(o):null;t&&Lf(window.location.href),n&&(Tf(),cb()),r&&a&&a!==window.location.href&&e&&ab.includes(e.type)&&window.UserLeap("dismissActiveSurvey",st.PageChange)}const xf={capture:!0},cb=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>ms(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?u=>{if(iu(u.target))try{u.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:u=>(iu(u.target)&&u.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,xf)},Tf=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,xf),delete window.UserLeap._config.interactiveEventsHandler};function db(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,vr,!0))}function fb(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,vr,!0)),window.UserLeap._config.interactiveEvents&&Tf()}function mt(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===en?r.push(window.UserLeap.envId):i===Wt&&r.push(gs())}),n&&r.push(n),r.join("/")}function pb(e,t){let n=mt("1",[en],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function qt(e){const t=Fe.getItem(Ve.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 Me(e,t){const n=Fe.getItem(Ve.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{Fe.setItem(Ve.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function Rf(){window.previewMode||(window.UserLeap.visitorId=Pt(),Me("vid",window.UserLeap.visitorId),K.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function gs(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Lf(e,t,n){if(e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let l=0;l<r.length&&(i=ms(r[l],e),!i);l++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const u={viewedAt:Date.now(),location:e},c=Fe.getItem(Ve.PageViews);try{if(s=c?JSON.parse(c):[],Array.isArray(s)||(s=[]),s.length>0){const l=s[s.length-1],d=(Date.now()-l.viewedAt)/1e3;l.location!=e&&d>a&&Eu({url:e}),(l.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",ba,t,{url:e},n]),s.push(u))}else window.UserLeap._queue.push(["track",ba,t,{url:e},n]),s.push(u),Eu({url:e});s.length>5&&s.splice(0,s.length-5),Fe.setItem(Ve.PageViews,JSON.stringify(s))}catch(l){l instanceof Error&&window.UserLeap.reportError("trackPageView",l,{pageViewsStorage:c}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function hb(){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),vr(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),vr(o),i})(e.replaceState)),db()}async function Co(e,t){const n=gs();e&&!t&&(window.UserLeap._config.mode=sb.test);const r=await Nt(pb(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await vi(r.json.delay),Of(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:ze.NoSurvey})}const mb=e=>e.some(t=>t.type===R.VideoVoice),Of=async e=>{var M,D,T;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:u,uuid:c,vid:l,sessionReplay:d}=e,p=Nn(window.UserLeap),f=vs(p),h=gb(p);if(d)if(f){const k={mediaRecordingUid:Pt(),mediaType:Ge.Screen,questionId:1,responseGroupUid:s,surveyId:u,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0};K.emit(H.ReplayCapture,{responseGroupUid:s,hasQuestions:!!(a!=null&&a.length),surveyId:u,uploadId:d.uploadId,replayType:(M=d.replayDurationType)!=null?M:on.Before,seconds:d.replayDurationSeconds,generateVideoUploadUrlPayload:k})}else ud({responseGroupId:s,surveyId:u,visitorId:l,replayParams:d,completeUploadHeaders:p,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0});if(l==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:ze.NoSurvey};if(mb(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:ze.NoSurvey};if(window.UserLeap.container){const k="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(k),{success:!1,message:k,surveyState:ze.NoSurvey}}if(l!==window.UserLeap.visitorId&&c!==window.UserLeap.visitorId&&!window.previewMode){const k="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(k)),{success:!1,message:k,surveyState:ze.NoSurvey}}u_({id:u}),Uo.disable(),K.emit(H.SurveyWillPresent,{name:H.SurveyWillPresent,[ql.SurveyId]:u});let m,g=document.createElement("div"),w,y,v;const b=k=>{const{[Qt.ViewVersion]:B}=k;B!==p["x-ul-sdk-version"]&&Cf(),K.removeListener(Ye.VerifyViewVersion,b)};K.on(Ye.VerifyViewVersion,b),xn(p)?(m="ul-direct-embeded-frame",w=document.head,y=window,v=!1,f&&(Sf(),g.id=m,window.UserLeap.container.appendChild(g),Ef(),K.emit(H.SurveyLifeCycle,{state:"presented"}),K.emit(H.SurveyPresented,{name:H.SurveyPresented}))):{frameId:m,contentWinDocHead:w,contentWindow:y,hasOverlay:v,iframe:g}=J0(o,h),window.UserLeap.frameId=m,window.UserLeap.useMobileStyling=h;const _=k=>{K.on(H.CloseSurveyOnOverlayClick,k)},C=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:u,userId:c,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:_,eventEmitFn:K.emit.bind(K),ulEvents:ka,viewDocument:y==null?void 0:y.document,viewWindow:y,tabTitle:document.title,startingQuestionIdx:(D=window.UserLeap.config)==null?void 0:D.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:Fe.getItem(Ve.Preview),forceBrandedLogo:n},window.UserLeap._config);(T=window.UserLeap.config)!=null&&T.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(C.customStyles=window.UserLeap.customStyles),y&&(y.__cfg=C);function A(){const k=document.createElement("script");return window.UserLeap.nonce&&k.setAttribute("nonce",window.UserLeap.nonce),k.id=il,k}const S=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:C.path,E=document.getElementById(il);E&&E.remove();const x=A(),N=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return C.installationMethod===tn.Npm||C.installationMethod===tn.NpmBundled?(W0.configure(C),v&&window.UserLeap.container&&N()):S&&(x.src=S,v&&x.addEventListener("load",()=>{window.UserLeap.container&&N()}),y==null||y.addEventListener("error",k=>{k.target instanceof HTMLScriptElement&&k.target.src===S&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),w==null||w.appendChild(x),{success:!0,surveyState:ze.Ready,surveyId:u,responseGroupUid:s}};function gb(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return vs(e)||t>10&&t<Dg}function vs(e){return ub.includes(e[at.Platform])}function vb(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 yb(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&vb(t),(t||n||r)&&(hb(),vr())}async function Nt(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Nn(window.UserLeap),t.headers);const i=await wt(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),u=s?s.split(" "):void 0,c=u&&u.length===2?u[1]:void 0,l=(a=i.headers)==null?void 0:a.get(at.VisitorID);c&&l&&(l!==window.UserLeap.visitorId||window.UserLeap.token!==c)&&(Me("token",c),Me("vid",l),K.emit(H.VisitorIDUpdated,{visitorId:l}),window.UserLeap.token=c,window.UserLeap.visitorId=l)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function _b(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 vi(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const bb=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var m,g,w,y,v;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:u}=r;let{eventName:c}=r;if(window.UserLeap.debugMode&&c!==ba&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const l=(m=Fe.getItem(Ve.Preview))!=null?m:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:ze.NoSurvey}}if(!c||c.trim().length===0){c=c?String(c):"";const b="[Sprig] - Invalid event name "+c;return console.warn(b),{success:!1,message:b,surveyState:ze.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),Me("trackStartUrl",d),(w=(g=window.UserLeap)==null?void 0:g._config)!=null&&w.optimizelyEnabled){const b=Nn(window.UserLeap);vs(b)||oi.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},oi.getAllOptimizelyExperiments())}(v=(y=window.UserLeap)==null?void 0:y._config)!=null&&v.launchDarklyEnabled&&(a.launchDarklyFlags=_a.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),s_({name:c});const p=window.UserLeap.delayingSurvey?await Nt(mt("1",[Wt],"events/batch"),{body:JSON.stringify({events:[{event:c,metadata:a}],previewKey:l}),method:"POST"},0,!0):await Nt(mt("1",[Wt],"events"),{body:JSON.stringify({event:c,metadata:a,previewKey:l}),method:"POST"},0,!0);if(!p.ok){const b="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(b,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:b,error:p.error,surveyState:ze.NoSurvey}}i&&Me("uid",i),o&&Me("aid",o);const f=p.json;return f.invalidPreviewKey&&Fe.removeItem(Ve.Preview),await _b(p,u)?lb(f.eventId,d)?Of(f):{success:!1,message:"Study should not be displayed after page navigation",surveyState:ze.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:ze.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",st.Override),Co({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",st.Override),Co({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",st.Override),Co({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=st.API){K.emit(H.SurveyWillClose,{name:H.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 c="[Sprig] - Disregarding empty payload provided";return console.warn(c),{success:!1,message:c}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const c="[Sprig] - Skipping tracking without userId";return console.warn(c),{success:!1,message:c}}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 u;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,Wn)&&(a[Wn]=a.email,delete a.email),u=await Nt(mt("1",[en,Wt],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!u.ok&&u.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",u.error),u.error&&window.UserLeap.reportError("identifyAndSetAttributes",u.error))):u=await Nt(mt("1",[en,Wt]),{body:JSON.stringify(s),method:"PUT"}),a&&a[Wn]&&(window.UserLeap.email=a[Wn]),u.ok&&(i&&Me("uid",i),o&&Me("aid",o)),{success:!!u.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 Nt(mt("1",[en,Wt],"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){K.on(H.SurveyLifeCycle,r)},async removeSurveyListener(r){K.removeListener(H.SurveyLifeCycle,r)},async addListener(r,i){K.on(r,i)},async removeListener(r,i){K.removeListener(r,i)},async removeAllListeners(){K.removeAllListeners()},setPreviewKey(r){!r||typeof r!="string"||Fe.isStorageAvailable&&r&&Fe.setItem(Ve.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 Nt(mt("1",[en,Wt]),{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&&Cu(),Me("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,Me("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){Lf(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(O.CustomStyle);o?o.textContent=r:fc(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var u,c;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&&((u=window.UserLeap.windowDimensions)!=null&&u.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(c=window.UserLeap.windowDimensions)!=null&&c.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(pc(s.contentDocument))+"px")),K.emit(H.SurveyDimensions,{name:H.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,Fe.removeItem(Ve.Credentials),Fe.removeItem(Ve.PageViews),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Rf(),Cu(),window.UserLeap._queue.unpause()},teardown(){fb(),window.UserLeap("dismissActiveSurvey",st.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;oi.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:u})=>{const c={experiments:[{id:s.id,variation:u.key}]};window.UserLeap("integrateOptimizely",c,!1)};r.notificationCenter.addNotificationListener(Tg.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}_a.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(Wn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return Cb(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await Ic({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:Nn(window.UserLeap)},!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 wb(e){const t=Nn(window.UserLeap);document.addEventListener("securitypolicyviolation",Do);const n=await wt(mt("1",[en],"config"),{headers:t}),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",Do),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Po("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Po(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}const Ib=e=>typeof e=="object"&&e&&"inner"in e&&!!e.inner&&typeof e.inner=="object";async function Sb(e,t,n={}){var d,p;const r=window.__cfg&&window.__cfg.mode,i=gs(),o=window.UserLeap.envId,a=window.document.documentElement,s=Ib(t)?{inner:{message:(d=t.inner)==null?void 0:d.message,stack:(p=t.inner)==null?void 0:p.stack}}:{},u={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,...s},c={action:e,err:{message:t.message,stack:t.stack},meta:u,vid:i,envId:o};(await Nt(mt("1",null,"errors"),{method:"POST",headers:{[at.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function Cb(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 Eb(e={}){var r;const t=(r=new URLSearchParams(window.location.search).get(Af.Preview))!=null?r:"";window.UserLeap.UPDATES=ka,window.UserLeap("setPreviewKey",t);async function n(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Sb,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 i=window.UserLeap.sampleRate;if(i){let u=qt("sampled");if(u===null&&(u=Math.random()<i,Me("sampled",u)),!u)return}else qt("sampled")!==null&&Me("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new ob(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<o.length;u++)window.UserLeap._queue.push(o[u]);const a=qt("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=qt("vid"),window.UserLeap.userId=qt("uid"),window.UserLeap.partnerAnonymousId=qt("aid")):(Fe.removeItem(Ve.Credentials),Rf());const s=await wb(e);qy(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings),bb(s),await yb(s),window.UserLeap._queue.unpause(),K.emit(H.SDKReady,{maxMobileReplayDurationSeconds:s.maxMobileReplayDurationSeconds,mobileReplaySettings:s.mobileReplaySettings}),K.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?n():window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",()=>{n()},!1)}class Oi{constructor(){ge(this,"UPDATES",ka)}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 wa={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(Oi.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Oi.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Eb(e),window.Sprig}};wa.configure;window.UpChunk={createUpload:_p};window.rrwebRecord=wr;exports.DismissReason=st;exports.SprigAPI=Oi;exports.SprigEvent=H;exports.sprig=wa;