@sprig-technologies/sprig-browser 2.29.0 → 2.30.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-DCzsCvvC.cjs +19 -0
- package/dist/index-Del4rEas.js +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +64 -12
- package/dist/index.js +1 -1
- package/dist/{view-DsGYmN51.js → view-BeigWq26.js} +5 -5
- package/dist/view-XkUymOdH.cjs +685 -0
- package/package.json +1 -1
- package/dist/index-Dl-jpk4y.cjs +0 -19
- package/dist/index-HZs0t66-.js +0 -19
- package/dist/view-oWj5EBWB.cjs +0 -685
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var Ys=Object.defineProperty,Qs=(e,t,n)=>t in e?Ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t,n)=>(Qs(e,typeof t!="symbol"?t+"":t,n),n),me=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.FeedbackClosed="feedback.closed",e.PageChange="page.change",e.API="api",e.Override="override",e))(me||{}),A=(e=>(e.ReplayCapture="replay.capture",e.FeedbackButtonLoaded="feedback.button.loaded",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.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(A||{});const ot={FEEDBACK_BUTTON_LOADED:"feedback.button.loaded",SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_WIDTH:"survey.width",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};let jt;const Xs=new Uint8Array(16);function Zs(){if(!jt&&(jt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jt(Xs)}const z=[];for(let e=0;e<256;++e)z.push((e+256).toString(16).slice(1));function eo(e,t=0){return z[e[t+0]]+z[e[t+1]]+z[e[t+2]]+z[e[t+3]]+"-"+z[e[t+4]]+z[e[t+5]]+"-"+z[e[t+6]]+z[e[t+7]]+"-"+z[e[t+8]]+z[e[t+9]]+"-"+z[e[t+10]]+z[e[t+11]]+z[e[t+12]]+z[e[t+13]]+z[e[t+14]]+z[e[t+15]]}const to=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vr={randomUUID:to};function ke(e,t,n){if(Vr.randomUUID&&!t&&!e)return Vr.randomUUID();e=e||{};const r=e.random||(e.rng||Zs)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,eo(r)}const no='.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}',Hr="360px",ro="ul-app",io="#e6e6e6",so="#bd282a",oo=500,ao=1030,zr=()=>{try{return window.parent.Intercom}catch{return null}},lo=()=>{const e=zr();e&&(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},uo=()=>{const e=zr();e&&(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},co=Object.freeze(Object.defineProperty({__proto__:null,disable:uo,enable:lo},Symbol.toStringTag,{value:"Module"})),Gr=[co];class Jr{static disable(){Gr.forEach(t=>t.disable())}static enable(){Gr.forEach(t=>t.enable())}}var po=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"}},Yr=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=Yr.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 po(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)}},Qr=Yr;Qr.defaultMaxListeners=10;const D=new Qr,Nt=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Xr=({"userleap-platform":e})=>e!=="web";class Zr{constructor(t){F(this,"storage"),F(this,"tempStorage",{}),F(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 G=new Zr("sessionStorage"),ee=new Zr("localStorage");class ho{constructor(t){F(this,"payload"),F(this,"promise"),F(this,"reject",()=>{}),F(this,"resolve",()=>{}),this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const mo={RATELIMIT_RESET_DEFAULT:10};let ei=!1,ti="",Mt=!1,ni=!1,Kt=[];const fo=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?"web-gtm":e._segment?"web-segment":"web-snippet",En=e=>{var t;(t=e?.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(ni=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",En))},In=(e="")=>{ei=!0,ti=e};function je(e={}){const t={"Content-Type":"application/json","userleap-platform":"web","x-ul-sdk-version":"2.30.0","x-ul-installation-method":fo(e)};if(e.envId&&(t["x-ul-environment-id"]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t["x-ul-user-id"]=e.userId),e.visitorId&&(t["x-ul-visitor-id"]=e.visitorId),e.partnerAnonymousId&&(t["x-ul-anonymous-id"]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t["x-ul-preview-mode"]="1"),t}const ri=async({shouldDropOnRateLimit:e,...t})=>{if(e)return{status:429};{const n=new ho(t);return Kt.push(n),n.promise}},fe=async(e,t)=>{const{retries:n=0,shouldDropOnRateLimit:r=!1,shouldRetryRequest:i=!1,...s}=t,o={url:e,options:s,retries:n,shouldDropOnRateLimit:r};if(Mt&&!i)return ri(o);const a={ok:!1,reportError:!1};if(ei)return console.info(`UserLeap - ${ti}`),a;try{const l=await fetch(e,s);if(l.status===429)if(!Mt&&!r||i){Mt=!0;const u=l.headers.has("ratelimit-reset")?Number(l.headers.get("ratelimit-reset")):mo.RATELIMIT_RESET_DEFAULT;return await Nt(u*1e3),fe(e,{...s,shouldDropOnRateLimit:r,shouldRetryRequest:!0})}else return ri(o);if(Mt=!1,Kt.length&&(Kt.map(u=>{const c=u.payload;fe(c.url,{...c.options,retries:c.retries,shouldDropOnRateLimit:c.shouldDropOnRateLimit}).then(d=>{u.resolveRequest(d)})}),Kt=[]),l.ok){if(l.status===249)return In(),a;const u=await l.text();try{return u&&u!=="OK"&&(l.json=JSON.parse(u)),l}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${u}`)}}}return l}catch(l){const u=n+1;return u>5||ni?{ok:!1,reportError:!1,error:l}:(await Nt(Math.pow(2,n)*1e3),fe(e,{...s,retries:u}))}},ze={Error:1,Warn:2,Info:3,Debug:4};let Ln=1e3,$t=ze.Debug,Ge=[];const yo=e=>{const t=Object.entries(ze).find(n=>n[1]===e);return t?.[0]??""},go=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),wo=(e,t)=>`${go(t)}:${e}`,vo=()=>{Ge=Ge.filter(e=>e.level<=$t)},bo=()=>{Ge.length>Ln&&Ge.shift()},Bt=(e,t)=>{e>$t||(Ge.push({level:e,line:wo(t,new Date)}),bo())},at=e=>{Bt(ze.Debug,e)},L=e=>{Bt(ze.Info,e)},Un=e=>{Bt(ze.Warn,e)},ii=e=>{Bt(ze.Error,e)},_o=()=>Ge.map(e=>e.line),So=()=>new TextEncoder().encode(_o().join(`
|
|
2
|
+
`)),si=async e=>{if(!e)return;const t=So();return fe(e,{body:t,method:"PUT"})},ko=(e,t)=>{e!==void 0&&(Ln=e),t!==void 0&&($t=t),at(`Initializing logger with limit of ${Ln} lines and ${yo($t)} level`),vo()};var xn=(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))(xn||{});class Eo{constructor(t){F(this,"awaitingResolvers",[]),F(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 oi=new Eo(2),Io=e=>oi.setLimit(e),Lo=async e=>oi.execute(async()=>{var t;L(`Beginning upload of chunk ${e.chunkIndex} for survey: ${e.surveyId}`);const n=await fe(e.uploadUrl,{body:e.data,method:"PUT"});L(`Completed upload of chunk ${e.chunkIndex} for survey: ${e.surveyId}`);const r=(t=n.headers)==null?void 0:t.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),ai=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:s,replayDuration:o,eventDigest:a},l=!1)=>{var u;if(!l&&!n&&!r){L(`Cannot mark upload complete: isMobile: ${l} / uploadId: ${n} / etags: ${r}`);return}L(`Marking upload complete for survey: ${t}`);const c=await fe(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:s,surveyId:t,replayDuration:o,eventDigest:a,userAgent:(u=window?.navigator)==null?void 0:u.userAgent}),headers:i,shouldRetryRequest:!0});return L(`Done marking upload complete for survey: ${t}`),c},M=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,q=Object.keys,J=Array.isArray;function X(e,t){return typeof t!="object"||q(t).forEach(function(n){e[n]=t[n]}),e}typeof Promise>"u"||M.Promise||(M.Promise=Promise);const lt=Object.getPrototypeOf,Uo={}.hasOwnProperty;function te(e,t){return Uo.call(e,t)}function Je(e,t){typeof t=="function"&&(t=t(lt(e))),(typeof Reflect>"u"?q:Reflect.ownKeys)(t).forEach(n=>{ye(e,n,t[n])})}const li=Object.defineProperty;function ye(e,t,n,r){li(e,t,X(n&&te(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function Ye(e){return{from:function(t){return e.prototype=Object.create(t.prototype),ye(e.prototype,"constructor",e),{extend:Je.bind(null,e.prototype)}}}}const xo=Object.getOwnPropertyDescriptor;function An(e,t){let n;return xo(e,t)||(n=lt(e))&&An(n,t)}const Ao=[].slice;function Ft(e,t,n){return Ao.call(e,t,n)}function ui(e,t){return t(e)}function ut(e){if(!e)throw new Error("Assertion Failed")}function ci(e){M.setImmediate?setImmediate(e):setTimeout(e,0)}function di(e,t){return e.reduce((n,r,i)=>{var s=t(r,i);return s&&(n[s[0]]=s[1]),n},{})}function ge(e,t){if(typeof t=="string"&&te(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 s=ge(e,t[r]);n.push(s)}return n}var o=t.indexOf(".");if(o!==-1){var a=e[t.substr(0,o)];return a==null?void 0:ge(a,t.substr(o+1))}}function ie(e,t,n){if(e&&t!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){ut(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)ie(e,t[r],n[r])}else{var s=t.indexOf(".");if(s!==-1){var o=t.substr(0,s),a=t.substr(s+1);if(a==="")n===void 0?J(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n;else{var l=e[o];l&&te(e,o)||(l=e[o]={}),ie(l,a,n)}}else n===void 0?J(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function pi(e){var t={};for(var n in e)te(e,n)&&(t[n]=e[n]);return t}const Do=[].concat;function hi(e){return Do.apply([],e)}const mi="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(hi([8,16,32,64].map(e=>["Int","Uint","Float"].map(t=>t+e+"Array")))).filter(e=>M[e]),Oo=mi.map(e=>M[e]);di(mi,e=>[e,!0]);let Ee=null;function ct(e){Ee=typeof WeakMap<"u"&&new WeakMap;const t=Dn(e);return Ee=null,t}function Dn(e){if(!e||typeof e!="object")return e;let t=Ee&&Ee.get(e);if(t)return t;if(J(e)){t=[],Ee&&Ee.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Dn(e[n]))}else if(Oo.indexOf(e.constructor)>=0)t=e;else{const s=lt(e);for(var i in t=s===Object.prototype?{}:Object.create(s),Ee&&Ee.set(e,t),e)te(e,i)&&(t[i]=Dn(e[i]))}return t}const{toString:Po}={};function On(e){return Po.call(e).slice(8,-1)}const Pn=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Co=typeof Pn=="symbol"?function(e){var t;return e!=null&&(t=e[Pn])&&t.apply(e)}:function(){return null},Qe={};function we(e){var t,n,r,i;if(arguments.length===1){if(J(e))return e.slice();if(this===Qe&&typeof e=="string")return[e];if(i=Co(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(e==null)return[e];if(typeof(t=e.length)=="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}const Cn=typeof Symbol<"u"?e=>e[Symbol.toStringTag]==="AsyncFunction":()=>!1;var ue=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function fi(e,t){ue=e,yi=t}var yi=()=>!0;const Ro=!new Error("").stack;function Ne(){if(Ro)try{throw Ne.arguments,new Error}catch(e){return e}return new Error}function Rn(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
|
|
3
|
+
`).length),n.split(`
|
|
4
|
+
`).slice(t).filter(yi).map(r=>`
|
|
5
|
+
`+r).join("")):""}var gi=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Tn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(gi),To={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 Xe(e,t){this._e=Ne(),this.name=e,this.message=t}function wi(e,t){return e+". Errors: "+Object.keys(t).map(n=>t[n].toString()).filter((n,r,i)=>i.indexOf(n)===r).join(`
|
|
6
|
+
`)}function qt(e,t,n,r){this._e=Ne(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=wi(e,t)}function dt(e,t){this._e=Ne(),this.name="BulkError",this.failures=Object.keys(t).map(n=>t[n]),this.failuresByPos=t,this.message=wi(e,t)}Ye(Xe).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Rn(this._e,2))}},toString:function(){return this.name+": "+this.message}}),Ye(qt).from(Xe),Ye(dt).from(Xe);var jn=Tn.reduce((e,t)=>(e[t]=t+"Error",e),{});const jo=Xe;var x=Tn.reduce((e,t)=>{var n=t+"Error";function r(i,s){this._e=Ne(),this.name=n,i?typeof i=="string"?(this.message=`${i}${s?`
|
|
7
|
+
`+s:""}`,this.inner=s||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=To[t]||n,this.inner=null)}return Ye(r).from(jo),e[t]=r,e},{});x.Syntax=SyntaxError,x.Type=TypeError,x.Range=RangeError;var vi=gi.reduce((e,t)=>(e[t+"Error"]=x[t],e),{}),Wt=Tn.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=x[t]),e),{});function T(){}function pt(e){return e}function No(e,t){return e==null||e===pt?t:function(n){return t(e(n))}}function Me(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Mo(e,t){return e===T?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 s=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Me(r,this.onsuccess):r),i&&(this.onerror=this.onerror?Me(i,this.onerror):i),s!==void 0?s:n}}function Ko(e,t){return e===T?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?Me(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Me(r,this.onerror):r)}}function $o(e,t){return e===T?t:function(n){var r=e.apply(this,arguments);X(n,r);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?Me(i,this.onsuccess):i),s&&(this.onerror=this.onerror?Me(s,this.onerror):s),r===void 0?o===void 0?void 0:o:X(r,o)}}function Bo(e,t){return e===T?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function Nn(e,t){return e===T?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return n.then(function(){return t.apply(r,s)})}return t.apply(this,arguments)}}Wt.ModifyError=qt,Wt.DexieError=Xe,Wt.BulkError=dt;var ht={};const bi=100,[Mn,Vt,Kn]=typeof Promise>"u"?[]:(()=>{let e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,lt(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,lt(t),e]})(),_i=Vt&&Vt.then,Ht=Mn&&Mn.constructor,$n=!!Kn;var Bn=!1,Fo=Kn?()=>{Kn.then(Yt)}:M.setImmediate?setImmediate.bind(null,Yt):M.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{Yt(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Yt,0)},mt=function(e,t){ft.push([e,t]),zt&&(Fo(),zt=!1)},Fn=!0,zt=!0,Ke=[],Gt=[],qn=null,Wn=pt,Ze={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Oi,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{Oi(e[0],e[1])}catch{}})}},U=Ze,ft=[],$e=0,Jt=[];function E(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=T,this._lib=!1;var t=this._PSD=U;if(ue&&(this._stackHolder=Ne(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==ht)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Hn(this,this._value))}this._state=null,this._value=null,++t.ref,ki(this,e)}const Vn={get:function(){var e=U,t=Zt;function n(r,i){var s=!e.global&&(e!==U||t!==Zt);const o=s&&!ve();var a=new E((l,u)=>{zn(this,new Si(tn(r,e,s,o),tn(i,e,s,o),l,u,e))});return ue&&Li(a,this),a}return n.prototype=ht,n},set:function(e){ye(this,"then",e&&e.prototype===ht?Vn:{get:function(){return e},set:Vn.set})}};function Si(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}function ki(e,t){try{t(n=>{if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&yt();n&&typeof n.then=="function"?ki(e,(i,s)=>{n instanceof E?n._then(i,s):n.then(i,s)}):(e._state=!0,e._value=n,Ei(e)),r&>()}},Hn.bind(null,e))}catch(n){Hn(e,n)}}function Hn(e,t){if(Gt.push(t),e._state===null){var n=e._lib&&yt();t=Wn(t),e._state=!1,e._value=t,ue&&t!==null&&typeof t=="object"&&!t._promise&&function(r,i,s){try{r.apply(null,s)}catch{}}(()=>{var r=An(t,"stack");t._promise=e,ye(t,"stack",{get:()=>Bn?r&&(r.get?r.get.apply(t):r.value):e.stack})}),function(r){Ke.some(i=>i._value===r._value)||Ke.push(r)}(e),Ei(e),n&>()}}function Ei(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)zn(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),$e===0&&(++$e,mt(()=>{--$e==0&&Gn()},[]))}function zn(e,t){if(e._state!==null){var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++$e,mt(qo,[n,e,t])}else e._listeners.push(t)}function qo(e,t,n){try{qn=t;var r,i=t._value;t._state?r=e(i):(Gt.length&&(Gt=[]),r=e(i),Gt.indexOf(i)===-1&&function(s){for(var o=Ke.length;o;)if(Ke[--o]._value===s._value)return void Ke.splice(o,1)}(t)),n.resolve(r)}catch(s){n.reject(s)}finally{qn=null,--$e==0&&Gn(),--n.psd.ref||n.psd.finalize()}}function Ii(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i,s,o=e._value;o!=null?(i=o.name||"Error",s=o.message||o,r=Rn(o,0)):(i=o,s=""),t.push(i+(s?": "+s:"")+r)}return ue&&((r=Rn(e._stackHolder,2))&&t.indexOf(r)===-1&&t.push(r),e._prev&&Ii(e._prev,t,n)),t}function Li(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Yt(){yt()&>()}function yt(){var e=Fn;return Fn=!1,zt=!1,e}function gt(){var e,t,n;do for(;ft.length>0;)for(e=ft,ft=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(ft.length>0);Fn=!0,zt=!0}function Gn(){var e=Ke;Ke=[],e.forEach(r=>{r._PSD.onunhandled.call(null,r._value,r)});for(var t=Jt.slice(0),n=t.length;n;)t[--n]()}function Qt(e){return new E(ht,!1,e)}function $(e,t){var n=U;return function(){var r=yt(),i=U;try{return Le(n,!0),e.apply(this,arguments)}catch(s){t&&t(s)}finally{Le(i,!1),r&>()}}}Je(E.prototype,{then:Vn,_then:function(e,t){zn(this,new Si(null,null,e,t,U))},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,r=>r instanceof t?n(r):Qt(r)):this.then(null,r=>r&&r.name===t?n(r):Qt(r))},finally:function(e){return this.then(t=>(e(),t),t=>(e(),Qt(t)))},stack:{get:function(){if(this._stack)return this._stack;try{Bn=!0;var e=Ii(this,[],20).join(`
|
|
8
|
+
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Bn=!1}}},timeout:function(e,t){return e<1/0?new E((n,r)=>{var i=setTimeout(()=>r(new x.Timeout(t)),e);this.then(n,r).finally(clearTimeout.bind(null,i))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&ye(E.prototype,Symbol.toStringTag,"Dexie.Promise"),Ze.env=Ui(),Je(E,{all:function(){var e=we.apply(null,arguments).map(en);return new E(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach((i,s)=>E.resolve(i).then(o=>{e[s]=o,--r||t(e)},n))})},resolve:e=>{if(e instanceof E)return e;if(e&&typeof e.then=="function")return new E((n,r)=>{e.then(n,r)});var t=new E(ht,!0,e);return Li(t,qn),t},reject:Qt,race:function(){var e=we.apply(null,arguments).map(en);return new E((t,n)=>{e.map(r=>E.resolve(r).then(t,n))})},PSD:{get:()=>U,set:e=>U=e},totalEchoes:{get:()=>Zt},newPSD:Ie,usePSD:tt,scheduler:{get:()=>mt,set:e=>{mt=e}},rejectionMapper:{get:()=>Wn,set:e=>{Wn=e}},follow:(e,t)=>new E((n,r)=>Ie((i,s)=>{var o=U;o.unhandleds=[],o.onunhandled=s,o.finalize=Me(function(){(function(a){function l(){a(),Jt.splice(Jt.indexOf(l),1)}Jt.push(l),++$e,mt(()=>{--$e==0&&Gn()},[])})(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},o.finalize),e()},t,n,r))}),Ht&&(Ht.allSettled&&ye(E,"allSettled",function(){const e=we.apply(null,arguments).map(en);return new E(t=>{e.length===0&&t([]);let n=e.length;const r=new Array(n);e.forEach((i,s)=>E.resolve(i).then(o=>r[s]={status:"fulfilled",value:o},o=>r[s]={status:"rejected",reason:o}).then(()=>--n||t(r)))})}),Ht.any&&typeof AggregateError<"u"&&ye(E,"any",function(){const e=we.apply(null,arguments).map(en);return new E((t,n)=>{e.length===0&&n(new AggregateError([]));let r=e.length;const i=new Array(r);e.forEach((s,o)=>E.resolve(s).then(a=>t(a),a=>{i[o]=a,--r||n(new AggregateError(i))}))})}));const Y={awaits:0,echoes:0,id:0};var Wo=0,Xt=[],Jn=0,Zt=0,Vo=0;function Ie(e,t,n,r){var i=U,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++Vo;var o=Ze.env;s.env=$n?{Promise:E,PromiseProp:{value:E,configurable:!0,writable:!0},all:E.all,race:E.race,allSettled:E.allSettled,any:E.any,resolve:E.resolve,reject:E.reject,nthen:Ai(o.nthen,s),gthen:Ai(o.gthen,s)}:{},t&&X(s,t),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=tt(s,e,n,r);return s.ref===0&&s.finalize(),a}function et(){return Y.id||(Y.id=++Wo),++Y.awaits,Y.echoes+=bi,Y.id}function ve(){return!!Y.awaits&&(--Y.awaits==0&&(Y.id=0),Y.echoes=Y.awaits*bi,!0)}function en(e){return Y.echoes&&e&&e.constructor===Ht?(et(),e.then(t=>(ve(),t),t=>(ve(),W(t)))):e}function Ho(e){++Zt,Y.echoes&&--Y.echoes!=0||(Y.echoes=Y.id=0),Xt.push(U),Le(e,!0)}function zo(){var e=Xt[Xt.length-1];Xt.pop(),Le(e,!1)}function Le(e,t){var n=U;if((t?!Y.echoes||Jn++&&e===U:!Jn||--Jn&&e===U)||xi(t?Ho.bind(null,e):zo),e!==U&&(U=e,n===Ze&&(Ze.env=Ui()),$n)){var r=Ze.env.Promise,i=e.env;Vt.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(M,"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 Ui(){var e=M.Promise;return $n?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(M,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Vt.then,gthen:e.prototype.then}:{}}function tt(e,t,n,r,i){var s=U;try{return Le(e,!0),t(n,r,i)}finally{Le(s,!1)}}function xi(e){_i.call(Mn,e)}function tn(e,t,n,r){return typeof e!="function"?e:function(){var i=U;n&&et(),Le(t,!0);try{return e.apply(this,arguments)}finally{Le(i,!1),r&&xi(ve)}}}function Ai(e,t){return function(n,r){return e.call(this,tn(n,t),tn(r,t))}}(""+_i).indexOf("[native code]")===-1&&(et=ve=T);const Di="unhandledrejection";function Oi(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(M.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(Di,!0,!0),X(r,i)):M.CustomEvent&&X(r=new CustomEvent(Di,{detail:i}),i),r&&M.dispatchEvent&&(dispatchEvent(r),!M.PromiseRejectionEvent&&M.onunhandledrejection))try{M.onunhandledrejection(r)}catch{}ue&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch{}}var W=E.reject;function Yn(e,t,n,r){if(e.idbdb&&(e._state.openComplete||U.letThrough||e._vip)){var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===jn.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(()=>Yn(e,t,n,r))):W(s)}return i._promise(t,(s,o)=>Ie(()=>(U.trans=i,r(s,o,i)))).then(s=>i._completion.then(()=>s))}if(e._state.openComplete)return W(new x.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return W(new x.DatabaseClosed);e.open().catch(T)}return e._state.dbReadyPromise.then(()=>Yn(e,t,n,r))}const Pi="3.2.7",Be="\uFFFF",Qn=-1/0,be="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ci="String expected.",wt=[],nn=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Go=nn,Jo=nn,Ri=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),rn="__dbnames",Xn="readonly",Zn="readwrite";function Fe(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Ti={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sn(e){return typeof e!="string"||/\./.test(e)?t=>t:t=>(t[e]===void 0&&e in t&&delete(t=ct(t))[e],t)}class Yo{_trans(t,n,r){const i=this._tx||U.trans,s=this.name;function o(l,u,c){if(!c.schema[s])throw new x.NotFound("Table "+s+" not part of transaction");return n(c.idbtrans,c)}const a=yt();try{return i&&i.db===this.db?i===U.trans?i._promise(t,o,r):Ie(()=>i._promise(t,o,r),{trans:i,transless:U.transless||U}):Yn(this.db,t,[this.name],o)}finally{a&>()}}get(t,n){return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:t}).then(i=>this.hook.reading.fire(i))).then(n)}where(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(J(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const n=q(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter(u=>{if(u.compound&&n.every(c=>u.keyPath.indexOf(c)>=0)){for(let c=0;c<n.length;++c)if(n.indexOf(u.keyPath[c])===-1)return!1;return!0}return!1}).sort((u,c)=>u.keyPath.length-c.keyPath.length)[0];if(r&&this.db._maxKey!==Be){const u=r.keyPath.slice(0,n.length);return this.where(u).equals(u.map(c=>t[c]))}!r&&ue&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:i}=this.schema,s=this.db._deps.indexedDB;function o(u,c){try{return s.cmp(u,c)===0}catch{return!1}}const[a,l]=n.reduce(([u,c],d)=>{const p=i[d],h=t[d];return[u||p,u||!p?Fe(c,p&&p.multi?m=>{const y=ge(m,d);return J(y)&&y.some(w=>o(h,w))}:m=>o(h,ge(m,d))):c]},[null,null]);return a?this.where(a.name).equals(t[a.keyPath]).filter(l):r?this.filter(l):this.where(n).equals("")}filter(t){return this.toCollection().and(t)}count(t){return this.toCollection().count(t)}offset(t){return this.toCollection().offset(t)}limit(t){return this.toCollection().limit(t)}each(t){return this.toCollection().each(t)}toArray(t){return this.toCollection().toArray(t)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(t){return new this.db.Collection(new this.db.WhereClause(this,J(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){this.schema.mappedClass=t;const n=r=>{if(!r)return r;const i=Object.create(t.prototype);for(var s in r)if(te(r,s))try{i[s]=r[s]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t}defineClass(){return this.mapToClass(function(t){X(this,t)})}add(t,n){const{auto:r,keyPath:i}=this.schema.primKey;let s=t;return i&&r&&(s=sn(i)(t)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"add",keys:n!=null?[n]:null,values:[s]})).then(o=>o.numFailures?E.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{ie(t,i,o)}catch{}return o})}update(t,n){if(typeof t!="object"||J(t))return this.where(":id").equals(t).modify(n);{const r=ge(t,this.schema.primKey.keyPath);if(r===void 0)return W(new x.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?q(n).forEach(i=>{ie(t,i,n[i])}):n(t,{value:t,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}}put(t,n){const{auto:r,keyPath:i}=this.schema.primKey;let s=t;return i&&r&&(s=sn(i)(t)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"put",values:[s],keys:n!=null?[n]:null})).then(o=>o.numFailures?E.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{ie(t,i,o)}catch{}return o})}delete(t){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[t]})).then(n=>n.numFailures?E.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"deleteRange",range:Ti})).then(t=>t.numFailures?E.reject(t.failures[0]):void 0)}bulkGet(t){return this._trans("readonly",n=>this.core.getMany({keys:t,trans:n}).then(r=>r.map(i=>this.hook.reading.fire(i))))}bulkAdd(t,n,r){const i=Array.isArray(n)?n:void 0,s=(r=r||(i?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new x.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new x.InvalidArgument("Arguments objects and keys must have the same length");const u=t.length;let c=l&&a?t.map(sn(l)):t;return this.core.mutate({trans:o,type:"add",keys:i,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:m})=>{if(d===0)return s?p:h;throw new dt(`${this.name}.bulkAdd(): ${d} of ${u} operations failed`,m)})})}bulkPut(t,n,r){const i=Array.isArray(n)?n:void 0,s=(r=r||(i?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new x.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new x.InvalidArgument("Arguments objects and keys must have the same length");const u=t.length;let c=l&&a?t.map(sn(l)):t;return this.core.mutate({trans:o,type:"put",keys:i,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:m})=>{if(d===0)return s?p:h;throw new dt(`${this.name}.bulkPut(): ${d} of ${u} operations failed`,m)})})}bulkDelete(t){const n=t.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:t})).then(({numFailures:r,lastResult:i,failures:s})=>{if(r===0)return i;throw new dt(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,s)})}}function vt(e){var t={},n=function(o,a){if(a){for(var l=arguments.length,u=new Array(l-1);--l;)u[l-1]=arguments[l];return t[o].subscribe.apply(null,u),e}if(typeof o=="string")return t[o]};n.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return n;function s(o,a,l){if(typeof o!="object"){var u;a||(a=Bo),l||(l=T);var c={subscribers:[],fire:l,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=a(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(p){return p!==d}),c.fire=c.subscribers.reduce(a,l)}};return t[o]=n[o]=c,c}q(u=o).forEach(function(d){var p=u[d];if(J(p))s(d,u[d][0],u[d][1]);else{if(p!=="asap")throw new x.InvalidArgument("Invalid event config");var h=s(d,pt,function(){for(var m=arguments.length,y=new Array(m);m--;)y[m]=arguments[m];h.subscribers.forEach(function(w){ci(function(){w.apply(null,y)})})})}})}}function bt(e,t){return Ye(t).from({prototype:e}),t}function nt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function er(e,t){e.filter=Fe(e.filter,t)}function tr(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>Fe(r(),t()):t,e.justLimit=n&&!r}function on(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new x.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function ji(e,t,n){const r=on(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 an(e,t,n,r){const i=e.replayFilter?Fe(e.filter,e.replayFilter()):e.filter;if(e.or){const s={},o=(a,l,u)=>{if(!i||i(l,u,p=>l.stop(p),p=>l.fail(p))){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),te(s,d)||(s[d]=!0,t(a,l,u))}};return Promise.all([e.or._iterate(o,n),Ni(ji(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return Ni(ji(e,r,n),Fe(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Ni(e,t,n,r){var i=$(r?(s,o,a)=>n(r(s),o,a):n);return e.then(s=>{if(s)return s.start(()=>{var o=()=>s.continue();t&&!t(s,a=>o=a,a=>{s.stop(a),o=T},a=>{s.fail(a),o=T})||i(s.value,s,a=>o=a),o()})})}function Z(e,t){try{const n=Mi(e),r=Mi(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 function(i,s){const o=i.length,a=s.length,l=o<a?o:a;for(let u=0;u<l;++u)if(i[u]!==s[u])return i[u]<s[u]?-1:1;return o===a?0:o<a?-1:1}(Ki(e),Ki(t));case"Array":return function(i,s){const o=i.length,a=s.length,l=o<a?o:a;for(let u=0;u<l;++u){const c=Z(i[u],s[u]);if(c!==0)return c}return o===a?0:o<a?-1:1}(e,t)}}catch{}return NaN}function Mi(e){const t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";const n=On(e);return n==="ArrayBuffer"?"binary":n}function Ki(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Qo{_read(t,n){var r=this._ctx;return r.error?r.table._trans(null,W.bind(null,r.error)):r.table._trans("readonly",t).then(n)}_write(t){var n=this._ctx;return n.error?n.table._trans(null,W.bind(null,n.error)):n.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var n=this._ctx;n.algorithm=Fe(n.algorithm,t)}_iterate(t,n){return an(this._ctx,t,n,this._ctx.table.core)}clone(t){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&X(r,t),n._ctx=r,n}raw(){return this._ctx.valueMapper=null,this}each(t){var n=this._ctx;return this._read(r=>an(n,t,r,n.table.core))}count(t){return this._read(n=>{const r=this._ctx,i=r.table.core;if(nt(r,!0))return i.count({trans:n,query:{index:on(r,i.schema),range:r.range}}).then(o=>Math.min(o,r.limit));var s=0;return an(r,()=>(++s,!1),n,i).then(()=>s)}).then(t)}sortBy(t,n){const r=t.split(".").reverse(),i=r[0],s=r.length-1;function o(u,c){return c?o(u[r[c]],c-1):u[i]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var d=o(u,s),p=o(c,s);return d<p?-a:d>p?a:0}return this.toArray(function(u){return u.sort(l)}).then(n)}toArray(t){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&nt(r,!0)&&r.limit>0){const{valueMapper:i}=r,s=on(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:s,range:r.range}}).then(({result:o})=>i?o.map(i):o)}{const i=[];return an(r,s=>i.push(s),n,r.table.core).then(()=>i)}},t)}offset(t){var n=this._ctx;return t<=0||(n.offset+=t,nt(n)?tr(n,()=>{var r=t;return(i,s)=>r===0||(r===1?(--r,!1):(s(()=>{i.advance(r),r=0}),!1))}):tr(n,()=>{var r=t;return()=>--r<0})),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),tr(this._ctx,()=>{var n=t;return function(r,i,s){return--n<=0&&i(s),n>=0}},!0),this}until(t,n){return er(this._ctx,function(r,i,s){return!t(r.value)||(i(s),n)}),this}first(t){return this.limit(1).toArray(function(n){return n[0]}).then(t)}last(t){return this.reverse().first(t)}filter(t){var n,r;return er(this._ctx,function(i){return t(i.value)}),n=this._ctx,r=t,n.isMatch=Fe(n.isMatch,r),this}and(t){return this.filter(t)}or(t){return new this.db.WhereClause(this._ctx.table,t,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.key,i)})}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.primaryKey,i)})}keys(t){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,s){r.push(s.key)}).then(function(){return r}).then(t)}primaryKeys(t){var n=this._ctx;if(n.dir==="next"&&nt(n,!0)&&n.limit>0)return this._read(i=>{var s=on(n,n.table.core.schema);return n.table.core.query({trans:i,values:!1,limit:n.limit,query:{index:s,range:n.range}})}).then(({result:i})=>i).then(t);n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,s){r.push(s.primaryKey)}).then(function(){return r}).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys(function(n){return n[0]}).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return er(this._ctx,function(i){var s=i.primaryKey.toString(),o=te(r,s);return r[s]=!0,!o}),this}modify(t){var n=this._ctx;return this._write(r=>{var i;if(typeof t=="function")i=t;else{var s=q(t),o=s.length;i=function(y){for(var w=!1,g=0;g<o;++g){var f=s[g],b=t[f];ge(y,f)!==b&&(ie(y,f,b),w=!0)}return w}}const a=n.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,d=[];let p=0;const h=[],m=(y,w)=>{const{failures:g,numFailures:f}=w;p+=y-f;for(let b of q(g))d.push(g[b])};return this.clone().primaryKeys().then(y=>{const w=g=>{const f=Math.min(c,y.length-g);return a.getMany({trans:r,keys:y.slice(g,g+f),cache:"immutable"}).then(b=>{const v=[],I=[],k=l?[]:null,_=[];for(let S=0;S<f;++S){const N=b[S],C={value:ct(N),primKey:y[g+S]};i.call(C,C.value,C)!==!1&&(C.value==null?_.push(y[g+S]):l||Z(u(N),u(C.value))===0?(I.push(C.value),l&&k.push(y[g+S])):(_.push(y[g+S]),v.push(C.value)))}const O=nt(n)&&n.limit===1/0&&(typeof t!="function"||t===nr)&&{index:n.index,range:n.range};return Promise.resolve(v.length>0&&a.mutate({trans:r,type:"add",values:v}).then(S=>{for(let N in S.failures)_.splice(parseInt(N),1);m(v.length,S)})).then(()=>(I.length>0||O&&typeof t=="object")&&a.mutate({trans:r,type:"put",keys:k,values:I,criteria:O,changeSpec:typeof t!="function"&&t}).then(S=>m(I.length,S))).then(()=>(_.length>0||O&&t===nr)&&a.mutate({trans:r,type:"delete",keys:_,criteria:O}).then(S=>m(_.length,S))).then(()=>y.length>g+f&&w(g+c))})};return w(0).then(()=>{if(d.length>0)throw new qt("Error modifying one or more objects",d,p,h);return y.length})})})}delete(){var t=this._ctx,n=t.range;return nt(t)&&(t.isPrimKey&&!Jo||n.type===3)?this._write(r=>{const{primaryKey:i}=t.table.core.schema,s=n;return t.table.core.count({trans:r,query:{index:i,range:s}}).then(o=>t.table.core.mutate({trans:r,type:"deleteRange",range:s}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new qt("Could not delete some values",Object.keys(a).map(d=>a[d]),o-c);return o-c}))}):this.modify(nr)}}const nr=(e,t)=>t.value=null;function Xo(e,t){return e<t?-1:e===t?0:1}function Zo(e,t){return e>t?-1:e===t?0:1}function ne(e,t,n){var r=e instanceof Bi?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function rt(e){return new e.Collection(e,()=>$i("")).limit(0)}function ea(e,t,n,r,i,s){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return i(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):i(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;i(e[l],u)<0&&(a=l)}return o<r.length&&s==="next"?e+n.substr(e.length):o<e.length&&s==="prev"?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function ln(e,t,n,r){var i,s,o,a,l,u,c,d=n.length;if(!n.every(y=>typeof y=="string"))return ne(e,Ci);function p(y){i=function(g){return g==="next"?f=>f.toUpperCase():f=>f.toLowerCase()}(y),s=function(g){return g==="next"?f=>f.toLowerCase():f=>f.toUpperCase()}(y),o=y==="next"?Xo:Zo;var w=n.map(function(g){return{lower:s(g),upper:i(g)}}).sort(function(g,f){return o(g.lower,f.lower)});a=w.map(function(g){return g.upper}),l=w.map(function(g){return g.lower}),u=y,c=y==="next"?"":r}p("next");var h=new e.Collection(e,()=>Ue(a[0],l[d-1]+r));h._ondirectionchange=function(y){p(y)};var m=0;return h._addAlgorithm(function(y,w,g){var f=y.key;if(typeof f!="string")return!1;var b=s(f);if(t(b,l,m))return!0;for(var v=null,I=m;I<d;++I){var k=ea(f,b,a[I],l[I],o,u);k===null&&v===null?m=I+1:(v===null||o(v,k)>0)&&(v=k)}return w(v!==null?function(){y.continue(v+c)}:g),!1}),h}function Ue(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function $i(e){return{type:1,lower:e,upper:e}}class Bi{get Collection(){return this._ctx.table.db.Collection}between(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)?rt(this):new this.Collection(this,()=>Ue(t,n,!r,!i))}catch{return ne(this,be)}}equals(t){return t==null?ne(this,be):new this.Collection(this,()=>$i(t))}above(t){return t==null?ne(this,be):new this.Collection(this,()=>Ue(t,void 0,!0))}aboveOrEqual(t){return t==null?ne(this,be):new this.Collection(this,()=>Ue(t,void 0,!1))}below(t){return t==null?ne(this,be):new this.Collection(this,()=>Ue(void 0,t,!1,!0))}belowOrEqual(t){return t==null?ne(this,be):new this.Collection(this,()=>Ue(void 0,t))}startsWith(t){return typeof t!="string"?ne(this,Ci):this.between(t,t+Be,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):ln(this,(n,r)=>n.indexOf(r[0])===0,[t],Be)}equalsIgnoreCase(t){return ln(this,(n,r)=>n===r[0],[t],"")}anyOfIgnoreCase(){var t=we.apply(Qe,arguments);return t.length===0?rt(this):ln(this,(n,r)=>r.indexOf(n)!==-1,t,"")}startsWithAnyOfIgnoreCase(){var t=we.apply(Qe,arguments);return t.length===0?rt(this):ln(this,(n,r)=>r.some(i=>n.indexOf(i)===0),t,Be)}anyOf(){const t=we.apply(Qe,arguments);let n=this._cmp;try{t.sort(n)}catch{return ne(this,be)}if(t.length===0)return rt(this);const r=new this.Collection(this,()=>Ue(t[0],t[t.length-1]));r._ondirectionchange=s=>{n=s==="next"?this._ascending:this._descending,t.sort(n)};let i=0;return r._addAlgorithm((s,o,a)=>{const l=s.key;for(;n(l,t[i])>0;)if(++i,i===t.length)return o(a),!1;return n(l,t[i])===0||(o(()=>{s.continue(t[i])}),!1)}),r}notEqual(t){return this.inAnyRange([[Qn,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=we.apply(Qe,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ne(this,be)}const n=t.reduce((r,i)=>r?r.concat([[r[r.length-1][1],i]]):[[Qn,i]],null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,n){const r=this._cmp,i=this._ascending,s=this._descending,o=this._min,a=this._max;if(t.length===0)return rt(this);if(!t.every(f=>f[0]!==void 0&&f[1]!==void 0&&i(f[0],f[1])<=0))return ne(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",x.InvalidArgument);const l=!n||n.includeLowers!==!1,u=n&&n.includeUppers===!0;let c,d=i;function p(f,b){return d(f[0],b[0])}try{c=t.reduce(function(f,b){let v=0,I=f.length;for(;v<I;++v){const k=f[v];if(r(b[0],k[1])<0&&r(b[1],k[0])>0){k[0]=o(k[0],b[0]),k[1]=a(k[1],b[1]);break}}return v===I&&f.push(b),f},[]),c.sort(p)}catch{return ne(this,be)}let h=0;const m=u?f=>i(f,c[h][1])>0:f=>i(f,c[h][1])>=0,y=l?f=>s(f,c[h][0])>0:f=>s(f,c[h][0])>=0;let w=m;const g=new this.Collection(this,()=>Ue(c[0][0],c[c.length-1][1],!l,!u));return g._ondirectionchange=f=>{f==="next"?(w=m,d=i):(w=y,d=s),c.sort(p)},g._addAlgorithm((f,b,v)=>{for(var I=f.key;w(I);)if(++h,h===c.length)return b(v),!1;return!!function(k){return!m(k)&&!y(k)}(I)||(this._cmp(I,c[h][1])===0||this._cmp(I,c[h][0])===0||b(()=>{d===i?f.continue(c[h][0]):f.continue(c[h][1])}),!1)}),g}startsWithAnyOf(){const t=we.apply(Qe,arguments);return t.every(n=>typeof n=="string")?t.length===0?rt(this):this.inAnyRange(t.map(n=>[n,n+Be])):ne(this,"startsWithAnyOf() only works with strings")}}function ce(e){return $(function(t){return _t(t),e(t.target.error),!1})}function _t(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const St="storagemutated",xe="x-storagemutated-1",Ae=vt(null,St);class ta{_lock(){return ut(!U.global),++this._reculock,this._reculock!==1||U.global||(U.lockOwnerFor=this),this}_unlock(){if(ut(!U.global),--this._reculock==0)for(U.global||(U.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{tt(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&U.lockOwnerFor!==this}create(t){if(!this.mode)return this;const n=this.db.idbdb,r=this.db._state.dbOpenError;if(ut(!this.idbtrans),!t&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new x.DatabaseClosed(r);case"MissingAPIError":throw new x.MissingAPI(r.message,r);default:throw new x.OpenFailed(r)}if(!this.active)throw new x.TransactionInactive;return ut(this._completion._state===null),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=$(i=>{_t(i),this._reject(t.error)}),t.onabort=$(i=>{_t(i),this.active&&this._reject(new x.Abort(t.error)),this.active=!1,this.on("abort").fire(i)}),t.oncomplete=$(()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&Ae.storagemutated.fire(t.mutatedParts)}),this}_promise(t,n,r){if(t==="readwrite"&&this.mode!=="readwrite")return W(new x.ReadOnly("Transaction is readonly"));if(!this.active)return W(new x.TransactionInactive);if(this._locked())return new E((s,o)=>{this._blockedFuncs.push([()=>{this._promise(t,n,r).then(s,o)},U])});if(r)return Ie(()=>{var s=new E((o,a)=>{this._lock();const l=n(o,a,this);l&&l.then&&l.then(o,a)});return s.finally(()=>this._unlock()),s._lib=!0,s});var i=new E((s,o)=>{var a=n(s,o,this);a&&a.then&&a.then(s,o)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(t){var n=this._root();const r=E.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);(function o(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=o)})()}var s=n._waitingFor;return new E((o,a)=>{r.then(l=>n._waitingQueue.push($(o.bind(null,l))),l=>n._waitingQueue.push($(a.bind(null,l)))).finally(()=>{n._waitingFor===s&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new x.Abort))}table(t){const n=this._memoizedTables||(this._memoizedTables={});if(te(n,t))return n[t];const r=this.schema[t];if(!r)throw new x.NotFound("Table "+t+" not part of transaction");const i=new this.db.Table(t,r,this);return i.core=this.db.core.table(t),n[t]=i,i}}function rr(e,t,n,r,i,s,o){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:s,src:(n&&!o?"&":"")+(r?"*":"")+(i?"++":"")+Fi(t)}}function Fi(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function qi(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:di(n,r=>[r.name,r])}}let kt=e=>{try{return e.only([[]]),kt=()=>[[]],[[]]}catch{return kt=()=>Be,Be}};function ir(e){return e==null?()=>{}:typeof e=="string"?function(t){return t.split(".").length===1?n=>n[t]:n=>ge(n,t)}(e):t=>ge(t,e)}function Wi(e){return[].slice.call(e)}let na=0;function Et(e){return e==null?":id":typeof e=="string"?e:`[${e.join("+")}]`}function ra(e,t,n){function r(l){if(l.type===3)return null;if(l.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:u,upper:c,lowerOpen:d,upperOpen:p}=l;return u===void 0?c===void 0?null:t.upperBound(c,!!p):c===void 0?t.lowerBound(u,!!d):t.bound(u,c,!!d,!!p)}const{schema:i,hasGetAll:s}=function(l,u){const c=Wi(l.objectStoreNames);return{schema:{name:l.name,tables:c.map(d=>u.objectStore(d)).map(d=>{const{keyPath:p,autoIncrement:h}=d,m=J(p),y=p==null,w={},g={name:d.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:m,keyPath:p,autoIncrement:h,unique:!0,extractKey:ir(p)},indexes:Wi(d.indexNames).map(f=>d.index(f)).map(f=>{const{name:b,unique:v,multiEntry:I,keyPath:k}=f,_={name:b,compound:J(k),keyPath:k,unique:v,multiEntry:I,extractKey:ir(k)};return w[Et(k)]=_,_}),getIndexByKeyPath:f=>w[Et(f)]};return w[":id"]=g.primaryKey,p!=null&&(w[Et(p)]=g.primaryKey),g})},hasGetAll:c.length>0&&"getAll"in u.objectStore(c[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),o=i.tables.map(l=>function(u){const c=u.name;return{name:c,schema:u,mutate:function({trans:d,type:p,keys:h,values:m,range:y}){return new Promise((w,g)=>{w=$(w);const f=d.objectStore(c),b=f.keyPath==null,v=p==="put"||p==="add";if(!v&&p!=="delete"&&p!=="deleteRange")throw new Error("Invalid operation type: "+p);const{length:I}=h||m||{length:1};if(h&&m&&h.length!==m.length)throw new Error("Given keys array must have same length as given values array.");if(I===0)return w({numFailures:0,failures:{},results:[],lastResult:void 0});let k;const _=[],O=[];let S=0;const N=B=>{++S,_t(B)};if(p==="deleteRange"){if(y.type===4)return w({numFailures:S,failures:O,results:[],lastResult:void 0});y.type===3?_.push(k=f.clear()):_.push(k=f.delete(r(y)))}else{const[B,V]=v?b?[m,h]:[m,null]:[h,null];if(v)for(let K=0;K<I;++K)_.push(k=V&&V[K]!==void 0?f[p](B[K],V[K]):f[p](B[K])),k.onerror=N;else for(let K=0;K<I;++K)_.push(k=f[p](B[K])),k.onerror=N}const C=B=>{const V=B.target.result;_.forEach((K,ae)=>K.error!=null&&(O[ae]=K.error)),w({numFailures:S,failures:O,results:p==="delete"?h:_.map(K=>K.result),lastResult:V})};k.onerror=B=>{N(B),C(B)},k.onsuccess=C})},getMany:({trans:d,keys:p})=>new Promise((h,m)=>{h=$(h);const y=d.objectStore(c),w=p.length,g=new Array(w);let f,b=0,v=0;const I=_=>{const O=_.target;g[O._pos]=O.result,++v===b&&h(g)},k=ce(m);for(let _=0;_<w;++_)p[_]!=null&&(f=y.get(p[_]),f._pos=_,f.onsuccess=I,f.onerror=k,++b);b===0&&h(g)}),get:({trans:d,key:p})=>new Promise((h,m)=>{h=$(h);const y=d.objectStore(c).get(p);y.onsuccess=w=>h(w.target.result),y.onerror=ce(m)}),query:function(d){return p=>new Promise((h,m)=>{h=$(h);const{trans:y,values:w,limit:g,query:f}=p,b=g===1/0?void 0:g,{index:v,range:I}=f,k=y.objectStore(c),_=v.isPrimaryKey?k:k.index(v.name),O=r(I);if(g===0)return h({result:[]});if(d){const S=w?_.getAll(O,b):_.getAllKeys(O,b);S.onsuccess=N=>h({result:N.target.result}),S.onerror=ce(m)}else{let S=0;const N=w||!("openKeyCursor"in _)?_.openCursor(O):_.openKeyCursor(O),C=[];N.onsuccess=B=>{const V=N.result;return V?(C.push(w?V.value:V.primaryKey),++S===g?h({result:C}):void V.continue()):h({result:C})},N.onerror=ce(m)}})}(s),openCursor:function({trans:d,values:p,query:h,reverse:m,unique:y}){return new Promise((w,g)=>{w=$(w);const{index:f,range:b}=h,v=d.objectStore(c),I=f.isPrimaryKey?v:v.index(f.name),k=m?y?"prevunique":"prev":y?"nextunique":"next",_=p||!("openKeyCursor"in I)?I.openCursor(r(b),k):I.openKeyCursor(r(b),k);_.onerror=ce(g),_.onsuccess=$(O=>{const S=_.result;if(!S)return void w(null);S.___id=++na,S.done=!1;const N=S.continue.bind(S);let C=S.continuePrimaryKey;C&&(C=C.bind(S));const B=S.advance.bind(S),V=()=>{throw new Error("Cursor not stopped")};S.trans=d,S.stop=S.continue=S.continuePrimaryKey=S.advance=()=>{throw new Error("Cursor not started")},S.fail=$(g),S.next=function(){let K=1;return this.start(()=>K--?this.continue():this.stop()).then(()=>this)},S.start=K=>{const ae=new Promise((H,le)=>{H=$(H),_.onerror=ce(le),S.fail=le,S.stop=R=>{S.stop=S.continue=S.continuePrimaryKey=S.advance=V,H(R)}}),he=()=>{if(_.result)try{K()}catch(H){S.fail(H)}else S.done=!0,S.start=()=>{throw new Error("Cursor behind last entry")},S.stop()};return _.onsuccess=$(H=>{_.onsuccess=he,he()}),S.continue=N,S.continuePrimaryKey=C,S.advance=B,he(),ae},w(S)},g)})},count({query:d,trans:p}){const{index:h,range:m}=d;return new Promise((y,w)=>{const g=p.objectStore(c),f=h.isPrimaryKey?g:g.index(h.name),b=r(m),v=b?f.count(b):f.count();v.onsuccess=$(I=>y(I.target.result)),v.onerror=ce(w)})}}}(l)),a={};return o.forEach(l=>a[l.name]=l),{stack:"dbcore",transaction:e.transaction.bind(e),table(l){if(!a[l])throw new Error(`Table '${l}' not found`);return a[l]},MIN_KEY:-1/0,MAX_KEY:kt(t),schema:i}}function sr({_novip:e},t){const n=t.db,r=function(i,s,{IDBKeyRange:o,indexedDB:a},l){return{dbcore:function(u,c){return c.reduce((d,{create:p})=>({...d,...p(d)}),u)}(ra(s,o,l),i.dbcore)}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach(i=>{const s=i.name;e.core.schema.tables.some(o=>o.name===s)&&(i.core=e.core.table(s),e[s]instanceof e.Table&&(e[s].core=i.core))})}function un({_novip:e},t,n,r){n.forEach(i=>{const s=r[i];t.forEach(o=>{const a=An(o,i);(!a||"value"in a&&a.value===void 0)&&(o===e.Transaction.prototype||o instanceof e.Transaction?ye(o,i,{get(){return this.table(i)},set(l){li(this,i,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):o[i]=new e.Table(i,s))})})}function or({_novip:e},t){t.forEach(n=>{for(let r in n)n[r]instanceof e.Table&&delete n[r]})}function ia(e,t){return e._cfg.version-t._cfg.version}function sa(e,t,n,r){const i=e._dbSchema,s=e._createTransaction("readwrite",e._storeNames,i);s.create(n),s._completion.catch(r);const o=s._reject.bind(s),a=U.transless||U;Ie(()=>{U.trans=s,U.transless=a,t===0?(q(i).forEach(l=>{ar(n,l,i[l].primKey,i[l].indexes)}),sr(e,n),E.follow(()=>e.on.populate.fire(s)).catch(o)):function({_novip:l},u,c,d){const p=[],h=l._versions;let m=l._dbSchema=ur(l,l.idbdb,d),y=!1;const w=h.filter(f=>f._cfg.version>=u);function g(){return p.length?E.resolve(p.shift()(c.idbtrans)).then(g):E.resolve()}return w.forEach(f=>{p.push(()=>{const b=m,v=f._cfg.dbschema;cr(l,b,d),cr(l,v,d),m=l._dbSchema=v;const I=Vi(b,v);I.add.forEach(_=>{ar(d,_[0],_[1].primKey,_[1].indexes)}),I.change.forEach(_=>{if(_.recreate)throw new x.Upgrade("Not yet support for changing primary key");{const O=d.objectStore(_.name);_.add.forEach(S=>lr(O,S)),_.change.forEach(S=>{O.deleteIndex(S.name),lr(O,S)}),_.del.forEach(S=>O.deleteIndex(S))}});const k=f._cfg.contentUpgrade;if(k&&f._cfg.version>u){sr(l,d),c._memoizedTables={},y=!0;let _=pi(v);I.del.forEach(C=>{_[C]=b[C]}),or(l,[l.Transaction.prototype]),un(l,[l.Transaction.prototype],q(_),_),c.schema=_;const O=Cn(k);let S;O&&et();const N=E.follow(()=>{if(S=k(c),S&&O){var C=ve.bind(null,null);S.then(C,C)}});return S&&typeof S.then=="function"?E.resolve(S):N.then(()=>S)}}),p.push(b=>{(!y||!Go)&&function(v,I){[].slice.call(I.db.objectStoreNames).forEach(k=>v[k]==null&&I.db.deleteObjectStore(k))}(f._cfg.dbschema,b),or(l,[l.Transaction.prototype]),un(l,[l.Transaction.prototype],l._storeNames,l._dbSchema),c.schema=l._dbSchema})}),g().then(()=>{var f,b;b=d,q(f=m).forEach(v=>{b.db.objectStoreNames.contains(v)||ar(b,v,f[v].primKey,f[v].indexes)})})}(e,t,s,n).catch(o)})}function Vi(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const i=e[r],s=t[r];if(i){const o={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||i.primKey.auto!==s.primKey.auto&&!nn)o.recreate=!0,n.change.push(o);else{const a=i.idxByName,l=s.idxByName;let u;for(u in a)l[u]||o.del.push(u);for(u in l){const c=a[u],d=l[u];c?c.src!==d.src&&o.change.push(d):o.add.push(d)}(o.del.length>0||o.add.length>0||o.change.length>0)&&n.change.push(o)}}else n.add.push([r,s])}return n}function ar(e,t,n,r){const i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(s=>lr(i,s)),i}function lr(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function ur(e,t,n){const r={};return Ft(t.objectStoreNames,0).forEach(i=>{const s=n.objectStore(i);let o=s.keyPath;const a=rr(Fi(o),o||"",!1,!1,!!s.autoIncrement,o&&typeof o!="string",!0),l=[];for(let c=0;c<s.indexNames.length;++c){const d=s.index(s.indexNames[c]);o=d.keyPath;var u=rr(d.name,o,!!d.unique,!!d.multiEntry,!1,o&&typeof o!="string",!1);l.push(u)}r[i]=qi(i,a,l)}),r}function cr({_novip:e},t,n){const r=n.db.objectStoreNames;for(let i=0;i<r.length;++i){const s=r[i],o=n.objectStore(s);e._hasGetAll="getAll"in o;for(let a=0;a<o.indexNames.length;++a){const l=o.indexNames[a],u=o.index(l).keyPath,c=typeof u=="string"?u:"["+Ft(u).join("+")+"]";if(t[s]){const d=t[s].idxByName[c];d&&(d.name=l,delete t[s].idxByName[c],t[s].idxByName[l]=d)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&M.WorkerGlobalScope&&M instanceof M.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class oa{_parseStoresSpec(t,n){q(t).forEach(r=>{if(t[r]!==null){var i=t[r].split(",").map((o,a)=>{const l=(o=o.trim()).replace(/([&*]|\+\+)/g,""),u=/^\[/.test(l)?l.match(/^\[(.*)\]$/)[1].split("+"):l;return rr(l,u||null,/\&/.test(o),/\*/.test(o),/\+\+/.test(o),J(u),a===0)}),s=i.shift();if(s.multi)throw new x.Schema("Primary key cannot be multi-valued");i.forEach(o=>{if(o.auto)throw new x.Schema("Only primary key can be marked as autoIncrement (++)");if(!o.keyPath)throw new x.Schema("Index must have a name and cannot be an empty string")}),n[r]=qi(r,s,i)}})}stores(t){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?X(this._cfg.storesSource,t):t;const r=n._versions,i={};let s={};return r.forEach(o=>{X(i,o._cfg.storesSource),s=o._cfg.dbschema={},o._parseStoresSpec(i,s)}),n._dbSchema=s,or(n,[n._allTables,n,n.Transaction.prototype]),un(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],q(s),s),n._storeNames=q(s),this}upgrade(t){return this._cfg.contentUpgrade=Nn(this._cfg.contentUpgrade||T,t),this}}function dr(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new He(rn,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function pr(e){return e&&typeof e.databases=="function"}function hr(e){return Ie(function(){return U.letThrough=!0,e()})}function aa(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()}).finally(function(){return clearInterval(e)}):Promise.resolve()}function la(e){const t=e._state,{indexedDB:n}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?W(t.dbOpenError):e);ue&&(t.openCanceller._stackHolder=Ne()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new x.DatabaseClosed("db.open() was cancelled")}let s=t.dbReadyResolve,o=null,a=!1;const l=()=>new E((u,c)=>{if(i(),!n)throw new x.MissingAPI;const d=e.name,p=t.autoSchema?n.open(d):n.open(d,Math.round(10*e.verno));if(!p)throw new x.MissingAPI;p.onerror=ce(c),p.onblocked=$(e._fireOnBlocked),p.onupgradeneeded=$(h=>{if(o=p.transaction,t.autoSchema&&!e._options.allowEmptyDB){p.onerror=_t,o.abort(),p.result.close();const y=n.deleteDatabase(d);y.onsuccess=y.onerror=$(()=>{c(new x.NoSuchDatabase(`Database ${d} doesnt exist`))})}else{o.onerror=ce(c);var m=h.oldVersion>Math.pow(2,62)?0:h.oldVersion;a=m<1,e._novip.idbdb=p.result,sa(e,m/10,o,c)}},c),p.onsuccess=$(()=>{o=null;const h=e._novip.idbdb=p.result,m=Ft(h.objectStoreNames);if(m.length>0)try{const w=h.transaction((y=m).length===1?y[0]:y,"readonly");t.autoSchema?function({_novip:g},f,b){g.verno=f.version/10;const v=g._dbSchema=ur(0,f,b);g._storeNames=Ft(f.objectStoreNames,0),un(g,[g._allTables],q(v),v)}(e,h,w):(cr(e,e._dbSchema,w),function(g,f){const b=Vi(ur(0,g.idbdb,f),g._dbSchema);return!(b.add.length||b.change.some(v=>v.add.length||v.change.length))}(e,w)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),sr(e,w)}catch{}var y;wt.push(e),h.onversionchange=$(w=>{t.vcFired=!0,e.on("versionchange").fire(w)}),h.onclose=$(w=>{e.on("close").fire(w)}),a&&function({indexedDB:w,IDBKeyRange:g},f){!pr(w)&&f!==rn&&dr(w,g).put({name:f}).catch(T)}(e._deps,d),u()},c)}).catch(u=>u&&u.name==="UnknownError"&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),l()):E.reject(u));return E.race([r,(typeof navigator>"u"?E.resolve():aa()).then(l)]).then(()=>(i(),t.onReadyBeingFired=[],E.resolve(hr(()=>e.on.ready.fire(e.vip))).then(function u(){if(t.onReadyBeingFired.length>0){let c=t.onReadyBeingFired.reduce(Nn,T);return t.onReadyBeingFired=[],E.resolve(hr(()=>c(e.vip))).then(u)}}))).finally(()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(()=>e).catch(u=>{t.dbOpenError=u;try{o&&o.abort()}catch{}return r===t.openCanceller&&e._close(),W(u)}).finally(()=>{t.openComplete=!0,s()})}function mr(e){var t=s=>e.next(s),n=i(t),r=i(s=>e.throw(s));function i(s){return o=>{var a=s(o),l=a.value;return a.done?l:l&&typeof l.then=="function"?l.then(n,r):J(l)?Promise.all(l).then(n,r):n(l)}}return i(t)()}function ua(e,t,n){var r=arguments.length;if(r<2)throw new x.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,hi(i),n]}function Hi(e,t,n,r,i){return E.resolve().then(()=>{const s=U.transless||U,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:s};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(d){return d.name===jn.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(()=>Hi(e,t,n,null,i))):W(d)}const l=Cn(i);let u;l&&et();const c=E.follow(()=>{if(u=i.call(o,o),u)if(l){var d=ve.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=mr(u))},a);return(u&&typeof u.then=="function"?E.resolve(u).then(d=>o.active?d:W(new x.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(d=>(r&&o._resolve(),o._completion.then(()=>d))).catch(d=>(o._reject(d),W(d)))})}function cn(e,t,n){const r=J(e)?e.slice():[e];for(let i=0;i<n;++i)r.push(t);return r}const ca={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,i={},s=[];function o(u,c,d){const p=Et(u),h=i[p]=i[p]||[],m=u==null?0:typeof u=="string"?1:u.length,y=c>0,w={...d,isVirtual:y,keyTail:c,keyLength:m,extractKey:ir(u),unique:!y&&d.unique};return h.push(w),w.isPrimaryKey||s.push(w),m>1&&o(m===2?u[0]:u.slice(0,m-1),c+1,d),h.sort((g,f)=>g.keyTail-f.keyTail),w}const a=o(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[a];for(const u of r.indexes)o(u.keyPath,0,u);function l(u){const c=u.query.index;return c.isVirtual?{...u,query:{index:c,range:(d=u.query.range,p=c.keyTail,{type:d.type===1?2:d.type,lower:cn(d.lower,d.lowerOpen?e.MAX_KEY:e.MIN_KEY,p),lowerOpen:!0,upper:cn(d.upper,d.upperOpen?e.MIN_KEY:e.MAX_KEY,p),upperOpen:!0})}}:u;var d,p}return{...n,schema:{...r,primaryKey:a,indexes:s,getIndexByKeyPath:function(u){const c=i[Et(u)];return c&&c[0]}},count:u=>n.count(l(u)),query:u=>n.query(l(u)),openCursor(u){const{keyTail:c,isVirtual:d,keyLength:p}=u.query.index;return d?n.openCursor(l(u)).then(h=>h&&function(m){return Object.create(m,{continue:{value:function(y){y!=null?m.continue(cn(y,u.reverse?e.MAX_KEY:e.MIN_KEY,c)):u.unique?m.continue(m.key.slice(0,p).concat(u.reverse?e.MIN_KEY:e.MAX_KEY,c)):m.continue()}},continuePrimaryKey:{value(y,w){m.continuePrimaryKey(cn(y,e.MAX_KEY,c),w)}},primaryKey:{get:()=>m.primaryKey},key:{get(){const y=m.key;return p===1?y[0]:y.slice(0,p)}},value:{get:()=>m.value}})}(h)):n.openCursor(u)}}}}}};function fr(e,t,n,r){return n=n||{},r=r||"",q(e).forEach(i=>{if(te(t,i)){var s=e[i],o=t[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){const a=On(s);a!==On(o)?n[r+i]=t[i]:a==="Object"?fr(s,o,n,r+i+"."):s!==o&&(n[r+i]=t[i])}else s!==o&&(n[r+i]=t[i])}else n[r+i]=void 0}),q(t).forEach(i=>{te(e,i)||(n[r+i]=t[i])}),n}const da={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema;return{...n,mutate(i){const s=U.trans,{deleting:o,creating:a,updating:l}=s.table(t).hook;switch(i.type){case"add":if(a.fire===T)break;return s._promise("readwrite",()=>u(i),!0);case"put":if(a.fire===T&&l.fire===T)break;return s._promise("readwrite",()=>u(i),!0);case"delete":if(o.fire===T)break;return s._promise("readwrite",()=>u(i),!0);case"deleteRange":if(o.fire===T)break;return s._promise("readwrite",()=>function(d){return c(d.trans,d.range,1e4)}(i),!0)}return n.mutate(i);function u(d){const p=U.trans,h=d.keys||function(m,y){return y.type==="delete"?y.keys:y.keys||y.values.map(m.extractKey)}(r,d);if(!h)throw new Error("Keys missing");return(d=d.type==="add"||d.type==="put"?{...d,keys:h}:{...d}).type!=="delete"&&(d.values=[...d.values]),d.keys&&(d.keys=[...d.keys]),function(m,y,w){return y.type==="add"?Promise.resolve([]):m.getMany({trans:y.trans,keys:w,cache:"immutable"})}(n,d,h).then(m=>{const y=h.map((w,g)=>{const f=m[g],b={onerror:null,onsuccess:null};if(d.type==="delete")o.fire.call(b,w,f,p);else if(d.type==="add"||f===void 0){const v=a.fire.call(b,w,d.values[g],p);w==null&&v!=null&&(w=v,d.keys[g]=w,r.outbound||ie(d.values[g],r.keyPath,w))}else{const v=fr(f,d.values[g]),I=l.fire.call(b,v,w,f,p);if(I){const k=d.values[g];Object.keys(I).forEach(_=>{te(k,_)?k[_]=I[_]:ie(k,_,I[_])})}}return b});return n.mutate(d).then(({failures:w,results:g,numFailures:f,lastResult:b})=>{for(let v=0;v<h.length;++v){const I=g?g[v]:h[v],k=y[v];I==null?k.onerror&&k.onerror(w[v]):k.onsuccess&&k.onsuccess(d.type==="put"&&m[v]?d.values[v]:I)}return{failures:w,results:g,numFailures:f,lastResult:b}}).catch(w=>(y.forEach(g=>g.onerror&&g.onerror(w)),Promise.reject(w)))})}function c(d,p,h){return n.query({trans:d,values:!1,query:{index:r,range:p},limit:h}).then(({result:m})=>u({type:"delete",keys:m,trans:d}).then(y=>y.numFailures>0?Promise.reject(y.failures[0]):m.length<h?{failures:[],numFailures:0,lastResult:void 0}:c(d,{...p,lower:m[m.length-1],lowerOpen:!0},h)))}}}}})};function zi(e,t,n){try{if(!t||t.keys.length<e.length)return null;const r=[];for(let i=0,s=0;i<t.keys.length&&s<e.length;++i)Z(t.keys[i],e[s])===0&&(r.push(n?ct(t.values[i]):t.values[i]),++s);return r.length===e.length?r:null}catch{return null}}const pa={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:r=>{if(!r.cache)return n.getMany(r);const i=zi(r.keys,r.trans._cache,r.cache==="clone");return i?E.resolve(i):n.getMany(r).then(s=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?ct(s):s},s))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))}}})};function yr(e){return!("from"in e)}const _e=function(e,t){if(!this){const n=new _e;return e&&"d"in e&&X(n,e),n}X(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function It(e,t,n){const r=Z(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(yr(e))return X(e,{from:t,to:n,d:1});const i=e.l,s=e.r;if(Z(n,e.from)<0)return i?It(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Gi(e);if(Z(t,e.to)>0)return s?It(s,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Gi(e);Z(t,e.from)<0&&(e.from=t,e.l=null,e.d=s?s.d+1:1),Z(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const o=!e.r;i&&!e.l&&dn(e,i),s&&o&&dn(e,s)}function dn(e,t){yr(t)||function n(r,{from:i,to:s,l:o,r:a}){It(r,i,s),o&&n(r,o),a&&n(r,a)}(e,t)}function ha(e,t){const n=gr(t);let r=n.next();if(r.done)return!1;let i=r.value;const s=gr(e);let o=s.next(i.from),a=o.value;for(;!r.done&&!o.done;){if(Z(a.from,i.to)<=0&&Z(a.to,i.from)>=0)return!0;Z(i.from,a.from)<0?i=(r=n.next(a.from)).value:a=(o=s.next(i.from)).value}return!1}function gr(e){let t=yr(e)?null:{s:0,n:e};return{next(n){const r=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&Z(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||Z(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 Gi(e){var t,n;const 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){const s=i==="r"?"l":"r",o={...e},a=e[i];e.from=a.from,e.to=a.to,e[i]=a[i],o[i]=a[s],e[s]=o,o.d=Ji(o)}e.d=Ji(e)}function Ji({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}Je(_e.prototype,{add(e){return dn(this,e),this},addKey(e){return It(this,e,e),this},addKeys(e){return e.forEach(t=>It(this,t,t)),this},[Pn](){return gr(this)}});const ma={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,n=new _e(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{const i=e.table(r),{schema:s}=i,{primaryKey:o}=s,{extractKey:a,outbound:l}=o,u={...i,mutate:p=>{const h=p.trans,m=h.mutatedParts||(h.mutatedParts={}),y=k=>{const _=`idb://${t}/${r}/${k}`;return m[_]||(m[_]=new _e)},w=y(""),g=y(":dels"),{type:f}=p;let[b,v]=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[];const I=p.trans._cache;return i.mutate(p).then(k=>{if(J(b)){f!=="delete"&&(b=k.results),w.addKeys(b);const _=zi(b,I);_||f==="add"||g.addKeys(b),(_||v)&&function(O,S,N,C){function B(V){const K=O(V.name||"");function ae(H){return H!=null?V.extractKey(H):null}const he=H=>V.multiEntry&&J(H)?H.forEach(le=>K.addKey(le)):K.addKey(H);(N||C).forEach((H,le)=>{const R=N&&ae(N[le]),Te=C&&ae(C[le]);Z(R,Te)!==0&&(R!=null&&he(R),Te!=null&&he(Te))})}S.indexes.forEach(B)}(y,s,_,v)}else if(b){const _={from:b.lower,to:b.upper};g.add(_),w.add(_)}else w.add(n),g.add(n),s.indexes.forEach(_=>y(_.name).add(n));return k})}},c=({query:{index:p,range:h}})=>{var m,y;return[p,new _e((m=h.lower)!==null&&m!==void 0?m:e.MIN_KEY,(y=h.upper)!==null&&y!==void 0?y:e.MAX_KEY)]},d={get:p=>[o,new _e(p.key)],getMany:p=>[o,new _e().addKeys(p.keys)],count:c,query:c,openCursor:c};return q(d).forEach(p=>{u[p]=function(h){const{subscr:m}=U;if(m){const y=v=>{const I=`idb://${t}/${r}/${v}`;return m[I]||(m[I]=new _e)},w=y(""),g=y(":dels"),[f,b]=d[p](h);if(y(f.name||"").add(b),!f.isPrimaryKey){if(p!=="count"){const v=p==="query"&&l&&h.values&&i.query({...h,values:!1});return i[p].apply(this,arguments).then(I=>{if(p==="query"){if(l&&h.values)return v.then(({result:_})=>(w.addKeys(_),I));const k=h.values?I.result.map(a):I.result;h.values?w.addKeys(k):g.addKeys(k)}else if(p==="openCursor"){const k=I,_=h.values;return k&&Object.create(k,{key:{get:()=>(g.addKey(k.primaryKey),k.key)},primaryKey:{get(){const O=k.primaryKey;return g.addKey(O),O}},value:{get:()=>(_&&w.addKey(k.primaryKey),k.value)}})}return I})}g.add(n)}}return i[p].apply(this,arguments)}}),u}}}};class He{constructor(t,n){this._middlewares={},this.verno=0;const r=He.dependencies;this._options=n={addons:He.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:i}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:T,dbReadyPromise:null,cancelOpen:T,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var o;s.dbReadyPromise=new E(a=>{s.dbReadyResolve=a}),s.openCanceller=new E((a,l)=>{s.cancelOpen=l}),this._state=s,this.name=t,this.on=vt(this,"populate","blocked","versionchange","close",{ready:[Nn,T]}),this.on.ready.subscribe=ui(this.on.ready.subscribe,a=>(l,u)=>{He.vip(()=>{const c=this._state;if(c.openComplete)c.dbOpenError||E.resolve().then(l),u&&a(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&a(l);else{a(l);const d=this;u||a(function p(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(p)})}})}),this.Collection=(o=this,bt(Qo.prototype,function(a,l){this.db=o;let u=Ti,c=null;if(l)try{u=l()}catch(m){c=m}const d=a._ctx,p=d.table,h=p.hook.reading.fire;this._ctx={table:p,index:d.index,isPrimKey:!d.index||p.schema.primKey.keyPath&&d.index===p.schema.primKey.name,range:u,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:c,or:d.or,valueMapper:h!==pt?h:null}})),this.Table=function(a){return bt(Yo.prototype,function(l,u,c){this.db=a,this._tx=c,this.name=l,this.schema=u,this.hook=a._allTables[l]?a._allTables[l].hook:vt(null,{creating:[Mo,T],reading:[No,pt],updating:[$o,T],deleting:[Ko,T]})})}(this),this.Transaction=function(a){return bt(ta.prototype,function(l,u,c,d,p){this.db=a,this.mode=l,this.storeNames=u,this.schema=c,this.chromeTransactionDurability=d,this.idbtrans=null,this.on=vt(this,"complete","error","abort"),this.parent=p||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 E((h,m)=>{this._resolve=h,this._reject=m}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},h=>{var m=this.active;return this.active=!1,this.on.error.fire(h),this.parent?this.parent._reject(h):m&&this.idbtrans&&this.idbtrans.abort(),W(h)})})}(this),this.Version=function(a){return bt(oa.prototype,function(l){this.db=a,this._cfg={version:l,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(a){return bt(Bi.prototype,function(l,u,c){this.db=a,this._ctx={table:l,index:u===":id"?null:u,or:c};const d=a._deps.indexedDB;if(!d)throw new x.MissingAPI;this._cmp=this._ascending=d.cmp.bind(d),this._descending=(p,h)=>d.cmp(h,p),this._max=(p,h)=>d.cmp(p,h)>0?p:h,this._min=(p,h)=>d.cmp(p,h)<0?p:h,this._IDBKeyRange=a._deps.IDBKeyRange})}(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",a=>{!a.newVersion||a.newVersion<a.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${a.oldVersion/10}`)}),this._maxKey=kt(n.IDBKeyRange),this._createTransaction=(a,l,u,c)=>new this.Transaction(a,l,u,this._options.chromeTransactionDurability,c),this._fireOnBlocked=a=>{this.on("blocked").fire(a),wt.filter(l=>l.name===this.name&&l!==this&&!l._state.vcFired).map(l=>l.on("versionchange").fire(a))},this.use(ca),this.use(da),this.use(ma),this.use(pa),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(a=>a(this))}version(t){if(isNaN(t)||t<.1)throw new x.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new x.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const n=this._versions;var r=n.filter(i=>i._cfg.version===t)[0];return r||(r=new this.Version(t),n.push(r),n.sort(ia),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(t){return this.idbdb&&(this._state.openComplete||U.letThrough||this._vip)?t():new E((n,r)=>{if(this._state.openComplete)return r(new x.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void r(new x.DatabaseClosed);this.open().catch(T)}this._state.dbReadyPromise.then(n,r)}).then(t)}use({stack:t,create:n,level:r,name:i}){i&&this.unuse({stack:t,name:i});const s=this._middlewares[t]||(this._middlewares[t]=[]);return s.push({stack:t,create:n,level:r??10,name:i}),s.sort((o,a)=>o.level-a.level),this}unuse({stack:t,name:n,create:r}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(i=>r?i.create!==r:!!n&&i.name!==n)),this}open(){return la(this)}_close(){const t=this._state,n=wt.indexOf(this);if(n>=0&&wt.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new E(r=>{t.dbReadyResolve=r}),t.openCanceller=new E((r,i)=>{t.cancelOpen=i})}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new x.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,n=this._state;return new E((r,i)=>{const s=()=>{this.close();var o=this._deps.indexedDB.deleteDatabase(this.name);o.onsuccess=$(()=>{(function({indexedDB:a,IDBKeyRange:l},u){!pr(a)&&u!==rn&&dr(a,l).delete(u).catch(T)})(this._deps,this.name),r()}),o.onerror=ce(i),o.onblocked=this._fireOnBlocked};if(t)throw new x.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(s):s()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return q(this._allTables).map(t=>this._allTables[t])}transaction(){const t=ua.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,n,r){let i=U.trans;i&&i.db===this&&t.indexOf("!")===-1||(i=null);const s=t.indexOf("?")!==-1;let o,a;t=t.replace("!","").replace("?","");try{if(a=n.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),t=="r"||t===Xn)o=Xn;else{if(t!="rw"&&t!=Zn)throw new x.InvalidArgument("Invalid transaction mode: "+t);o=Zn}if(i){if(i.mode===Xn&&o===Zn){if(!s)throw new x.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach(u=>{if(i&&i.storeNames.indexOf(u)===-1){if(!s)throw new x.SubTransaction("Table "+u+" not included in parent transaction.");i=null}}),s&&i&&!i.active&&(i=null)}}catch(u){return i?i._promise(null,(c,d)=>{d(u)}):W(u)}const l=Hi.bind(null,this,o,a,i,r);return i?i._promise(o,l,"lock"):U.trans?tt(U.transless,()=>this._whenReady(l)):this._whenReady(l)}table(t){if(!te(this._allTables,t))throw new x.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const fa=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class ya{constructor(t){this._subscribe=t}subscribe(t,n,r){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:n,complete:r})}[fa](){return this}}function Yi(e,t){return q(t).forEach(n=>{dn(e[n]||(e[n]=new _e),t[n])}),e}function ga(e){let t,n=!1;const r=new ya(i=>{const s=Cn(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,Ae.storagemutated.unsubscribe(h)}};i.start&&i.start(u);let c=!1,d=!1;function p(){return q(l).some(y=>a[y]&&ha(a[y],l[y]))}const h=y=>{Yi(a,y),p()&&m()},m=()=>{if(c||o)return;a={};const y={},w=function(g){s&&et();const f=()=>Ie(e,{subscr:g,trans:null}),b=U.trans?tt(U.transless,f):f();return s&&b.then(ve,ve),b}(y);d||(Ae(St,h),d=!0),c=!0,Promise.resolve(w).then(g=>{n=!0,t=g,c=!1,o||(p()?m():(a={},l=y,i.next&&i.next(g)))},g=>{c=!1,n=!1,i.error&&i.error(g),u.unsubscribe()})};return m(),u});return r.hasValue=()=>n,r.getValue=()=>t,r}let wr;try{wr={indexedDB:M.indexedDB||M.mozIndexedDB||M.webkitIndexedDB||M.msIndexedDB,IDBKeyRange:M.IDBKeyRange||M.webkitIDBKeyRange}}catch{wr={indexedDB:null,IDBKeyRange:null}}const qe=He;function pn(e){let t=Se;try{Se=!0,Ae.storagemutated.fire(e)}finally{Se=t}}Je(qe,{...Wt,delete:e=>new qe(e,{addons:[]}).delete(),exists:e=>new qe(e,{addons:[]}).open().then(t=>(t.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return function({indexedDB:t,IDBKeyRange:n}){return pr(t)?Promise.resolve(t.databases()).then(r=>r.map(i=>i.name).filter(i=>i!==rn)):dr(t,n).toCollection().primaryKeys()}(qe.dependencies).then(e)}catch{return W(new x.MissingAPI)}},defineClass:()=>function(e){X(this,e)},ignoreTransaction:e=>U.trans?tt(U.transless,e):e(),vip:hr,async:function(e){return function(){try{var t=mr(e.apply(this,arguments));return t&&typeof t.then=="function"?t:E.resolve(t)}catch(n){return W(n)}}},spawn:function(e,t,n){try{var r=mr(e.apply(n,t||[]));return r&&typeof r.then=="function"?r:E.resolve(r)}catch(i){return W(i)}},currentTransaction:{get:()=>U.trans||null},waitFor:function(e,t){const n=E.resolve(typeof e=="function"?qe.ignoreTransaction(e):e).timeout(t||6e4);return U.trans?U.trans.waitFor(n):n},Promise:E,debug:{get:()=>ue,set:e=>{fi(e,e==="dexie"?()=>!0:Ri)}},derive:Ye,extend:X,props:Je,override:ui,Events:vt,on:Ae,liveQuery:ga,extendObservabilitySet:Yi,getByKeyPath:ge,setByKeyPath:ie,delByKeyPath:function(e,t){typeof t=="string"?ie(e,t,void 0):"length"in t&&[].map.call(t,function(n){ie(e,n,void 0)})},shallowClone:pi,deepClone:ct,getObjectDiff:fr,cmp:Z,asap:ci,minKey:Qn,addons:[],connections:wt,errnames:jn,dependencies:wr,semVer:Pi,version:Pi.split(".").map(e=>parseInt(e)).reduce((e,t,n)=>e+t/Math.pow(10,2*n))}),qe.maxKey=kt(qe.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Ae(St,e=>{if(!Se){let t;nn?(t=document.createEvent("CustomEvent"),t.initCustomEvent(xe,!0,!0,e)):t=new CustomEvent(xe,{detail:e}),Se=!0,dispatchEvent(t),Se=!1}}),addEventListener(xe,({detail:e})=>{Se||pn(e)}));let Se=!1;if(typeof BroadcastChannel<"u"){const e=new BroadcastChannel(xe);typeof e.unref=="function"&&e.unref(),Ae(St,t=>{Se||e.postMessage(t)}),e.onmessage=t=>{t.data&&pn(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Ae(St,t=>{try{Se||(typeof localStorage<"u"&&localStorage.setItem(xe,JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:xe,changedParts:t})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",t=>{if(t.key===xe){const n=JSON.parse(t.newValue);n&&pn(n.changedParts)}});const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:t}){t&&t.type===xe&&pn(t.changedParts)})}E.rejectionMapper=function(e,t){if(!e||e instanceof Xe||e instanceof TypeError||e instanceof SyntaxError||!e.name||!vi[e.name])return e;var n=new vi[e.name](t||e.message,e);return"stack"in e&&ye(n,"stack",{get:function(){return this.inner.stack}}),n},fi(ue,Ri);let Qi=!0,vr=!1;const wa=()=>Qi=!1,va=()=>vr=!0,ba=["sdk_event_queue_latency_seconds","sdk_replay_add_event_batch_seconds","sdk_replay_cleanup_seconds","sdk_replay_compression_seconds","sdk_replay_get_events_between_seconds","sdk_replay_snapshot_seconds"];let Lt={},br;class _a{constructor(t){F(this,"_values",[]),F(this,"_isWebMetric"),this.name=t,this._isWebMetric=ba.includes(this.name)}report(t){if(Qi&&this._values.push({time:Date.now(),value:t}),vr||!this._isWebMetric)return;const n=this.findExceededThreshold(t);n&&br&&br(t,n)}collect(){const t=this._values;return this._values=[],t}findExceededThreshold(t){const n=Lt[this.name];if(n)return n.find(r=>this.valueExceedsThreshold(t,r))}valueExceedsThreshold(t,n){return n.type==="max"?t>n.value:n.type==="min"?t<n.value:!1}}const Sa=(e,t)=>{Lt={},vr=!1,e?.forEach(n=>{var r;n.metric in Lt||(Lt[n.metric]=[]),(r=Lt[n.metric])==null||r.push(n)}),br=t},Ut={},hn=e=>{const t=new _a(e);return Ut[e]=t,t},Xi=(e,t)=>{let n=Ut[e];return n||(n=hn(e)),n.report(t)},ka=async e=>{const t=Object.values(Ut).map(n=>({name:n.name,values:n.collect()}));if(t.some(n=>n.values.length))try{await e(JSON.stringify(t))}catch(n){Un(`Error posting metrics: ${n}`)}},Ea=({reportingIntervalSeconds:e,postMetrics:t})=>{e?setInterval(()=>{ka(t)},e*1e3):wa()},Zi=async(e,t)=>{const n=performance.now();try{await e()}finally{const r=performance.now()-n;let i=Ut[t];i||(i=hn(t)),i.report(r/1e3)}},es=(e,t)=>{const n=performance.now();try{e()}finally{const r=performance.now()-n;let i=Ut[t];i||(i=hn(t)),i.report(r/1e3)}},Ia=30,La=3e4;let xt=0;const ts=()=>{G.setItem("sprig.disableReplayRecording","disabled")},We=()=>!!G.getItem("sprig.disableReplayRecording"),Ua=["did not allow mutations","called in an invalid security context"],xa=e=>{if(!e)return!0;for(const t of Ua)if(e.toLowerCase().includes(t))return!1;return!0},Aa=(e,t,{reportError:n=!0,extraInfo:r})=>{We()||t instanceof Error&&(ts(),xa(t?.message)&&(n&&window.UserLeap.reportError(e,t,r),Pa()))},Da=async(e,t,{reportError:n}={reportError:!0})=>{var r;let i;try{if(n&&(r=window.navigator.storage)!=null&&r.estimate){const{quota:s,usage:o}=await window.navigator.storage.estimate();i={availableSpaceInMB:s&&o?(s-o)/(1024*1024):void 0,quota:s,usage:o}}}catch(s){window.UserLeap.reportError("Error getting storage estimate",s,{originalMessage:e,originalError:t})}Aa(e,t,{reportError:n,extraInfo:i})},Oa=()=>{const e=G.getItem("sprig.sessionId");if(e)return L(`Found saved session id: ${e}`),G.removeItem("sprig.sessionId"),e;const t=ke();return L(`Generating new uuid: ${t}`),t},Q=Oa();window.addEventListener("beforeunload",()=>{L(`Before page unload saving session id: ${Q}`),G.setItem("sprig.sessionId",Q)});const Pa=async()=>{P.transaction("rw",P.events,P.chunkUploads,P.pendingCaptures,()=>{P.events.clear(),P.chunkUploads.clear(),P.pendingCaptures.clear()}).catch(()=>{})},_r=(e,t,n=()=>!0)=>P.table(t).where("timestamp").below(e).and(n).delete(),Ca=async(e,t)=>{let n=[];return await Zi(async()=>{n=await P.events.where("[sessionId+timestamp]").between([Q,e],[Q,t??Date.now()]).toArray()},"sdk_replay_get_events_between_seconds"),n},Ra=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n??Ia));return P.events.where("[sessionId+timestamp]").between([Q,e],[Q,t]).modify({expiredAt:i})},Ta=e=>P.chunkUploads.add({...e,sessionId:e.sessionId??Q}),ja=(e,t)=>P.chunkUploads.update(e,{data:null,etag:t,status:"UploadComplete"}),Na=({status:e,uploadId:t})=>t?P.chunkUploads.where({uploadId:t,status:e}).toArray():P.chunkUploads.where({sessionId:Q,status:e}).toArray(),Ma=e=>P.chunkUploads.where({uploadId:e,status:"UploadComplete"}).toArray(),Ka=e=>P.chunkUploads.where({uploadId:e,status:"UploadComplete"}).delete(),$a=e=>P.pendingCaptures.add({...e,sessionId:e.sessionId??Q,canUpload:!1}),ns=async e=>{let t=await P.pendingCaptures.where("sessionId").equals(Q).toArray();return e.beforePresent&&(t=t.filter(n=>n.targetTimestamp<Date.now())),e.isHeatmap&&(t=t.filter(n=>n.captureParams.isHeatmap??!1)),t},Ba=()=>P.pendingCaptures.where("sessionId").equals(Q).toArray(),Fa=e=>P.pendingCaptures.where("sessionId").equals(Q).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0}),qa=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},rs=async e=>{if(parseInt(G.getItem("sprig.pendingCount")??"0")===0)return;const t=Date.now();return Pe(async()=>{await P.pendingCaptures.where("sessionId").equals(Q).and(n=>n.captureParams.isHeatmap??!1).and(n=>e?e.includes(n.uuid):!0).modify(n=>{n.targetTimestamp=t,n.captureParams.triggerTimestamp=t,n.captureParams.replayParams.replayDurationSeconds=Math.floor((t-n.timestamp)/1e3)})},"Error marking pending heatmaps ready")},Wa=async()=>{const e=(await ns({isHeatmap:!0})).map(n=>({eventId:n.captureParams.eventId,uuid:n.uuid})),t=[];e.forEach(({eventId:n,uuid:r})=>{Os(n)||t.push(r)}),t.length&&rs(t)},Va=e=>{if(e>1){xt=0;return}const t=Date.now();if(!xt){xt=t;return}t-xt>=La&&(rs(),xt=0)};class Ha extends He{constructor(){super("replayStorage",{autoOpen:!1}),F(this,"events"),F(this,"chunkUploads"),F(this,"pendingCaptures")}}const P=new Ha;P.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"}),P.open().catch(e=>{ii(`Error opening replay storage: ${JSON.stringify(e)}`),ts()});const za=e=>{if(e instanceof Attr)return null;let t=1;for(let n=e.previousSibling;n;n=n.previousSibling)n.nodeName===e.nodeName&&++t;return t},is=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let n=e;n&&!(n instanceof Document)&&n!==null;n=n instanceof Attr?n.ownerElement:n.parentElement){const r=t[t.length]={name:void 0,position:null};switch(n.nodeType){case Node.TEXT_NODE:r.name="text()";break;case Node.ATTRIBUTE_NODE:r.name="@"+n.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:r.name="processing-instruction()";break;case Node.COMMENT_NODE:r.name="comment()";break;case Node.ELEMENT_NODE:r.name=n.nodeName;break}r.position=za(n)}return"/"+t.reverse().map(n=>n.position!==null?`/${n.name}[${n.position}]`:`/${n.name}`).join("")},De={capture:!0,passive:!0},Ga=["a","button","input","option","li","link"],Ja=["Escape","Enter","Backspace","F5","Tab"];let mn=!1;const Ya=["label","type","role","title","placeholder","errormessage","valuetext","href"],ss="aria-",Qa=e=>{if(!e.tagName)return"No tagName";const t=e.getAttribute("type");return t?`${t} ${e.tagName.toLowerCase()}`:e.tagName.toLowerCase()},os=e=>{var t;if(((t=e.tagName)==null?void 0:t.toLowerCase())==="html")return{element:"html"};const n=e.textContent,r=n?{text:n}:{};r.element=Qa(e);for(const i of e.attributes){let s=i.name;const o=i.value;s.startsWith(ss)&&(s=s.substring(ss.length)),Ya.includes(s)&&(r[s]=o)}return r},Xa=e=>{var t;if(!e)return{};const n={...os(e)},r=e.parentElement;if(r&&Ga.includes((t=r.tagName)==null?void 0:t.toLowerCase())){const i=os(r);Object.assign(n,i)}return n},as=(e,t)=>{var n;Sl({x:t.x,y:t.y,type:e,elementAttributes:Xa(t.target),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...t.target instanceof HTMLElement?{rect:(n=t.target)==null?void 0:n.getBoundingClientRect(),xPath:is(t.target)}:{}})},Za=e=>t=>as(e,t),ls=e=>{Ja.includes(e.key)&&Il({key:e.key})},el=()=>{window.performance.getEntriesByType("navigation").map(e=>e.type).includes("reload")&&kl({url:window.location.href,currentPageTitle:document.title})},tl=()=>{window.performance.getEntriesByType("navigation").map(e=>e.type).includes("back_forward")&&El({curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title})},nl=(e,t)=>{let n;return r=>{clearTimeout(n),n=window.setTimeout(()=>e(r),t)}},rl=e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),Ll({xPath:is(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},us=nl(rl,750),cs=Za("left_click"),ds=e=>{e.button===2&&as("right_click",e)},ps=()=>{mn||(window.addEventListener("click",cs,De),window.addEventListener("mousedown",ds,De),window.addEventListener("keydown",ls,De),window.addEventListener("scroll",us,De),mn=!0,el(),tl())},il=()=>{mn&&(window.removeEventListener("click",cs,De),window.removeEventListener("mousedown",ds,De),window.removeEventListener("keydown",ls,De),window.removeEventListener("scroll",us,De),mn=!1)},sl=async(e,t,n)=>new Promise((r,i)=>{const s=e.createElement("script");s.src=t,s.onload=r,s.onerror=i,n&&(s.nonce=n),e.head.appendChild(s)});let hs=1,Sr=5e3,fn=6e4;const ol=5,ms=1e3,fs=30,yn=fs+ol;let kr,Er,ys,gs=Date.now(),At=!1,gn;const ws={},vs=async({viewDocument:e,maxReplayDurationSeconds:t,replayNonce:n,maxInflightRequests:r=2,replaySettings:i,teardownAfter:s=!1})=>{At||(s&&G.setItem("sprig.teardownAfterCapture","true"),await Pe(async()=>{if(We()){L("Not initializing replay because recording is disabled");return}if(!t){L("Not initializing replay because config didn't specify maxReplayDurationSeconds");return}if(i!=null&&i.minAvailableGb&&(hs=i.minAvailableGb),!await qa(hs)){Un("Minimum storage not available");return}L("Initializing replay"),i!=null&&i.minDuration&&(Sr=i.minDuration),i!=null&&i.batchDuration&&(fn=i.batchDuration),Io(r),ml(),cl(t+yn,30*60,t+yn),dl(),window.rrwebRecord||(L("Loading recording script"),await sl(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n),L("Recording script finished loading"));const o=window.rrwebRecord;if(!o){Un("Record script failed to set global function");return}let a=!0,l=0;gn=o({checkoutEveryNms:fs*1e3,sampling:{input:"last",scroll:250,media:800},emit:(u,c)=>{if(We())return;if(gs=Date.now(),c&&u.type===xn.Meta)l=performance.now();else if(c&&l&&u.type===xn.FullSnapshot){const p=performance.now()-l;Xi("sdk_replay_snapshot_seconds",p/1e3)}const d=a||!!c;a=!1,al({uuid:ke(),event:JSON.stringify(u),isValidStart:d,timestamp:Date.now()})},...i}),At=!0,Er||(Er=window.setInterval(()=>{Date.now()-gs>ms&&se("Sprig_Noop",{})},ms)),D.on("survey.complete",u=>{_l({id:u,userAgent:window.navigator.userAgent})})},"Error initializing replay"))};let Oe=G.getItem("sprig.pendingCount"),Ir=!!G.getItem("sprig.isCapturingHeatmap"),Lr=!1,Ur=[];const al=e=>{var t,n,r,i;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const s=(i=(r=(n=JSON.parse(e.event))==null?void 0:n.data)==null?void 0:r.payload)==null?void 0:i.xPath;if(!s)return;const o=ke();ws[s]=o,e.uuid=o}Ur.push(e),Lr||ul()},ll=e=>{const t=e.map(n=>({...n,sessionId:n.sessionId??Q}));if(Ir&&Va(t.length),t.length!==0)return P.transaction("rw",P.events,()=>{P.events.bulkAdd(t)}).catch(n=>{it("Error storing replay events",n)})},ul=()=>{Lr=!0,setTimeout(async()=>{if(We())return;const e=Ur;Ur=[],Lr=!1,es(async()=>{await ll(e)},"sdk_replay_add_event_batch_seconds")},500)},cl=(e=6*60,t=30*60,n=4*60)=>{kr=window.setInterval(()=>{const r=Date.now();We()||(at(`Performing periodic replay data cleanup / Event Seconds ${e} / Chunk Seconds ${t} / Pending Capture Seconds ${n}`),Zi(()=>P.transaction("rw!",P.events,P.chunkUploads,P.pendingCaptures,()=>{_r(r-e*1e3,"events",i=>i.expiredAt===void 0||i.expiredAt<r-e*1e3),_r(r-t*1e3,"chunkUploads"),_r(r-n*1e3,"pendingCaptures",i=>i.canUpload===void 0||i.canUpload===!1)}).catch(i=>{clearInterval(kr),it("Error deleting table rows",i)}),"sdk_replay_cleanup_seconds"),L("Cleanup complete"))},30*1e3)},dl=(e=5)=>{ys=window.setInterval(async()=>{Pe(async()=>{const t=parseInt(Oe??"0");if(t===0)return;const n=await ns({beforePresent:!0});n!=null&&n.length&&(await Promise.all(n.map(async r=>(await P.pendingCaptures.delete(r.uuid),Es(r.captureParams,r.canUpload)))),Oe=(t-n.length).toString(),G.setItem("sprig.pendingCount",Oe))},"Error initiating pending captures")},e*1e3)},pl=async(e,t,n,r,i)=>{const s=Math.min(e+i,n),o=`from: ${new Date(e).toLocaleTimeString()} to ${new Date(s).toLocaleTimeString()}`;L(`Getting event batch ${o}`);const a=await Ca(e,s);if(!(a!=null&&a.length))return L(`No events found ${o}`),{validStartFound:r,events:[]};if(!r){L(`Searching for valid start in ${a.length} events ${o}`);let l=-1;if(a?.forEach((c,d)=>{if(!c.isValidStart)return;const p=c.timestamp<=t;(l<0||p)&&(l=d)}),l<0)return L(`No valid start found in ${a.length} events ${o}`),{validStartFound:r,events:[]};const u=a[l].timestamp;return L(`Found valid start at: ${new Date(u).toLocaleTimeString()} in events ${o}`),{validStartFound:!0,events:a?.slice(l)}}return{validStartFound:r,events:a}},hl=(e,t,n)=>{const r=e.length,i=t*1024*1024,s=Math.ceil(r/n),o=Math.max(i,s);L(`Total file bytes: ${r} / target chunk size: ${o}`);const a=[];let l=0;for(;l<r;)a.push(e.slice(l,l+o)),l+=o;return a},bs=e=>Promise.all(e.map(async t=>{const n=await Lo(t);return await ja(t.uuid,n),t.uploadId})),_s=async e=>{L(`Marking upload complete if finished: ${e}`);const t=await Ma(e);if(!(t!=null&&t.length)){L(`No finished chunks found for upload: ${e}`);return}const n=t.reduce((s,o)=>(s.find(a=>a.chunkIndex===o.chunkIndex)||s.push(o),s),[]);n.sort((s,o)=>s.chunkIndex-o.chunkIndex);const r=n.map(s=>({ETag:s.etag,PartNumber:s.chunkIndex})).filter(s=>s.ETag!==null),i=n[0];await ai({apiUrl:i.apiUrl,surveyId:i.surveyId,uploadId:e,responseGroupUuid:i.responseGroupId,etags:r,headers:i.completeUploadHeaders,replayDuration:i.replayDuration}),L(`Cleaning up chunks for ${e}`),await Ka(e),L(`Done cleaning up chunks for ${e}`)},ml=async()=>{Pe(async()=>{const e=await Na({status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await bs(e);L(`Finished uploading unfinished chunks for ${t}`),t!=null&&t.length&&await Promise.all(t.map(n=>{if(n)return _s(n)}))},"Error uploading unfinished chunks")},fl=async(e,t)=>{await bs(t),L(`Done uploading chunks for uploads: ${e.join(",")}`),await Promise.all(e.map(n=>_s(n)))},yl=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},Ss=async(e,t,n)=>{const r=new TextEncoder;let i=null,s=null,o=null,a=!1,l=!1,[u,c]=[0,0];const d=e-yn*1e3,p=[];let h=[];L(`Getting events between ${new Date(e).toLocaleTimeString()} and ${new Date(t).toLocaleTimeString()}`),L(`Using batch duration: ${fn}ms`);for(let y=d;y<t;y+=fn){if({validStartFound:l,events:h}=await pl(y,e,t,l,fn),!(h!=null&&h.length)){L("No events found");continue}u===0&&(u=h[0].timestamp),c=h[h.length-1].timestamp,L(`Last event time in batch: ${new Date(c).toLocaleTimeString()}`);const w=`${a?",":"["}${h.map(f=>f.event).join(",")}`,g=r.encode(w);n&&s===null&&(at("Attempting compression"),o=new window.CompressionStream("gzip"),s=o.writable.getWriter()),es(()=>{n&&s?s.write(g):p.push(g)},"sdk_replay_compression_seconds"),a=!0}if(c-u<Sr)return L(`Replay duration is shorter than minimum of ${Sr}ms / Start:${u} / End:${c}`),null;const m=r.encode("]");return at("Writing final close brace"),s&&o?(s.write(m),s.close(),i=new Uint8Array(await new Response(o.readable).arrayBuffer())):(p.push(m),i=yl(p)),L("Finished generating file data"),i},gl=async(e,t)=>{const n=window.CompressionStream!==void 0;let r=null;const i=t??Date.now(),s=i-e;try{r=await Ss(s,i,n)}catch(o){o instanceof Error&&window.UserLeap.reportError("Error compressing replay",o),n&&Pe(async()=>{await Ss(s,i,!1)},"fileData fallback failed")}return r},ks=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:s,replayParams:o,triggerTimestamp:a}=e,l=await gl(o.replayDurationSeconds*1e3,a);if(l!=null&&l.length)L(`Found file data for survey: ${t}`);else{L(`File data is empty for survey: ${t}`);return}const u=hl(l,o.minimumChunkSizeMb,o.signedUrls.length);L(`Got ${u.length} chunks for survey: ${t}`);const c=await Promise.all(u.map(async(d,p)=>{const h=ke(),m={apiUrl:i,chunkIndex:p+1,completeUploadHeaders:s,etag:null,responseGroupId:n,status:"ReadyForUpload",surveyId:t,timestamp:a,totalChunks:u.length,data:d,uploadId:o.uploadId,uploadUrl:o.signedUrls[p].url,uuid:h,visitorId:r};return L(`Recording chunk upload: ${JSON.stringify({index:m.chunkIndex,surveyId:m.surveyId,uploadId:m.uploadId,size:d.length,id:h},null,2)}`),await Ta(m),L(`Done creating chunk upload: ${h}`),m}));L(`All chunk records created. Beginning upload for survey: ${t}`),await fl([o.uploadId],c)},Es=async(e,t)=>{if(L(`Attempting replay capture: ${JSON.stringify({isStandalone:e.isStandalone,duration:e.replayParams.replayDurationSeconds,type:e.replayParams.replayDurationType,responseGroupId:e.responseGroupId,surveyId:e.surveyId,triggerTimestamp:e.triggerTimestamp,visitorId:e.visitorId},null,2)}`),We()){L(`Replay recording is disabled: ${e.surveyId}`);return}L(`Replay recording enabled: ${e.surveyId}`);const{isHeatmap:n,isStandalone:r,replayParams:i,triggerTimestamp:s,responseGroupId:o}=e,a=async()=>{setTimeout(()=>D.removeListener(A.QuestionAnswered,a),0),Pe(async()=>{i.replayDurationType==="before"?await ks(e):await Fa(o)},"Error in schedule/capture callback")};Pe(async()=>{if(i.replayDurationType==="after"||i.replayDurationType==="beforeAndAfter"){!r&&!n&&(L("Attaching QuestionAnswered listener for non-standalone replay"),D.on(A.QuestionAnswered,a)),L(`Scheduling capture for replay of type: ${i.replayDurationType}`),await Is(e);return}if(r||n||t)L(`Proceeding to capture replay for survey: ${e.surveyId} / standalone? ${r} / canUpload? ${t}`),await ks(e),n&&wl();else{const l=yn+i.replayDurationSeconds,u=s-l*1e3,c=s;L(`Setting expiry minutes to ${i.expirationTimeLimitMinutes} for events from ${new Date(u).toLocaleTimeString()} to ${new Date(c).toLocaleTimeString()}`),await Ra(u,c,i.expirationTimeLimitMinutes),L("Attaching QuestionAnswered listener"),D.on(A.QuestionAnswered,a)}},"Error in scheduling/capturing replay")},wl=async()=>{parseInt(Oe??"0")||(G.removeItem("sprig.isCapturingHeatmap"),Ir=!1),G.getItem("sprig.teardownAfterCapture")&&(Us(),xr(),G.removeItem("sprig.teardownAfterCapture"))},xr=()=>{if(We()){at("Not clearing user data, replay is disabled");return}return P.transaction("rw",P.events,P.pendingCaptures,()=>{P.events.where("sessionId").equals(Q).delete(),P.pendingCaptures.where("sessionId").equals(Q).delete()}).catch(e=>{it("Error clearing session event data",e)})},Is=async e=>{L(`Scheduling replay capture: ${JSON.stringify(e)}`);const{isHeatmap:t,surveyId:n}=e,r=await Ba(),i=r?.filter(a=>a.captureParams.surveyId===n);if(i!=null&&i.length){L(`Pending capture exists for survey: ${n}`);return}t&&(Ir=!0,G.setItem("sprig.isCapturingHeatmap","true"));const s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return s.triggerTimestamp=o,Oe=Oe?(parseInt(Oe)+1).toString():"1",G.setItem("sprig.pendingCount",Oe),$a({uuid:ke(),targetTimestamp:o,timestamp:Date.now(),captureParams:s})},se=(e,t)=>{var n,r;if(At)try{(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)}catch(i){it("Error recording custom event",i)}},Pe=async(e,t)=>{try{await e()}catch(n){it(t,n)}},Ls=e=>{e.description&&(e.description=Ar(e.description)),se("Sprig_PageView",e)},vl=e=>{se("Sprig_TrackEvent",e)},bl=e=>{se("Sprig_ShowSurvey",e)},_l=e=>{se("Sprig_SubmitSurvey",e)},Sl=e=>{var t;(t=e?.elementAttributes)!=null&&t.text&&(e.elementAttributes.text=Ar(e.elementAttributes.text)),se("Sprig_Click",e)},kl=e=>{se("Sprig_Refresh",e)},El=e=>{e.currentPageTitle&&(e.currentPageTitle=Ar(e.currentPageTitle)),se("Sprig_BackForward",e)},Il=e=>{se("Sprig_Keystroke",e)},Ll=async e=>{const{x:t,xPath:n,y:r}=e,i=ws[n];i?Pe(async()=>{var s,o,a,l;const u=await P.events.get(i);if(u!=null&&u.event){const c=JSON.parse(u.event),d=t>((o=(s=c.data)==null?void 0:s.payload)==null?void 0:o.x)||0,p=r>((l=(a=c.data)==null?void 0:a.payload)==null?void 0:l.y)||0;if(!(d||p))return;d&&(c.data.payload.x=t),p&&(c.data.payload.y=r),c.data.payload.elementAttributes=e.elementAttributes,u.event=JSON.stringify(c),P.events.put(u)}else se("Sprig_Scroll",e)},"Error updating scroll event"):se("Sprig_Scroll",e)},Us=()=>{gn&&(gn(),gn=void 0),At=!1,[kr,Er,ys].forEach(e=>{e&&clearInterval(e)}),il()},it=(e,t,{reportError:n}={reportError:!0})=>(Us(),ii(`${e} - ${JSON.stringify(t)}`),Da(e,t,{reportError:n})),xs=()=>At,Ar=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),As="ul-view-sdk-script",Ul=["ios","android"],Ce="visitors",Re="environments",Ds=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 wn(e,t){const{matchType:n,pattern:r}=e,i=n?Ds[n]:Ds.legacy;let s=!1;try{s=i(r,t)}catch(o){const a=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;o instanceof Error&&(console.warn(a,o),o.stack=JSON.stringify(e),window.UserLeap.reportError(a,o))}return s}async function de(e,t){var n,r,i;const{shouldDropOnRateLimit:s,...o}=t;o.headers=Object.assign(je(window.UserLeap),o.headers);const a=await fe(e,{...o,shouldDropOnRateLimit:s});if(a.ok){const l=(n=a.headers)==null?void 0:n.get("Authorization"),u=l?l.split(" "):void 0,c=u&&u.length===2?u[1]:void 0,d=(r=a.headers)==null?void 0:r.get("x-ul-visitor-id");c&&d&&(d!==window.UserLeap.visitorId||window.UserLeap.token!==c)&&(re("token",c),re("vid",d),D.emit(A.VisitorIDUpdated,{visitorId:d}),window.UserLeap.token=c,window.UserLeap.visitorId=d)}return(i=a.json)!=null&&i.logMessage&&console.warn(`[Sprig] ${a.json.logMessage}`),a}function re(e,t){const n=ee.getItem("userleap.ids");let r={};if(n)try{r=JSON.parse(n)}catch(s){s instanceof Error&&(s.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",s)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",s)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{ee.setItem("userleap.ids",JSON.stringify(r))}catch(s){s instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${s.message}`)}}function Dr(){return window.previewMode?"0":window.UserLeap.visitorId??""}function oe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Re?r.push(window.UserLeap.envId):i===Ce&&r.push(Dr())}),n&&r.push(n),r.join("/")}const Dt=async(e,t)=>{var n,r;const{context:i,forceBrandedLogo:s,endCard:o,isFeedback:a=!1,heatmap:l,locale:u,productConfig:c,questions:d,responseGroupUid:p,surveyId:h,uuid:m,vid:y,sessionReplay:w,studyType:g}=e,f=je(window.UserLeap),b=Pr(f),v=Or(f);if(L(`Attempting to display survey: ${h}`),w&&(L("Survey has replay attached"),b?D.emit(A.ReplayCapture,{responseGroupUid:p,hasQuestions:!!(d!=null&&d.length),surveyId:h,uploadId:w.uploadId,replayType:w.replayDurationType??"before",seconds:w.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:ke(),mediaType:"screen",questionId:1,responseGroupUid:p,surveyId:h,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}}):Es({responseGroupId:p,surveyId:h,visitorId:y,replayParams:w,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:d.length===0})),l){const{eventId:R,replayParams:Te,responseGroupUid:Gs,surveyId:Js}=l;await vs({viewDocument:window.document,maxReplayDurationSeconds:300,replayNonce:window.UserLeap.replayNonce,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0}),ps(),Is({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:f,eventId:R,isHeatmap:!0,replayParams:Te,responseGroupId:Gs,surveyId:Js,triggerTimestamp:Date.now(),visitorId:y})}if(y==null||!(d!=null&&d.length))return L(`Not displaying survey: vid: ${y} / questions: ${d}`),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){L("Already displaying a survey");const R="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(R),{success:!1,message:R,surveyState:"no survey"}}if(y!==window.UserLeap.visitorId&&m!==window.UserLeap.visitorId&&!window.previewMode){const R="Attempted to display survey to a different visitor";return L(R),window.UserLeap.reportError("DisplaySurvey",new Error(R)),{success:!1,message:R,surveyState:"no survey"}}L(`Showing survey: ${h}`),bl({id:h,userAgent:window.navigator.userAgent}),Jr.disable(),D.emit(A.SurveyWillPresent,{name:A.SurveyWillPresent,"survey.id":h});let I,k=document.createElement("div"),_,O,S;const N=R=>{const{"view.version":Te}=R;Te!==f["x-ul-sdk-version"]&&Cs(),D.removeListener("verify.view.version",N)};D.on("verify.view.version",N),window.UserLeap.useMobileStyling=v,Xr(f)?(I="ul-direct-embeded-frame",_=document.head,O=window,S=!1,b&&(Ps(a),k.id=I,window.UserLeap.container.appendChild(k),Rs(),D.emit(A.SurveyLifeCycle,{state:"presented"}),D.emit(A.SurveyPresented,{name:A.SurveyPresented,"survey.id":h}))):{frameId:I,contentWinDocHead:_,contentWindow:O,hasOverlay:S,iframe:k}=Pl({productConfig:c,useMobileStyling:v,surveyId:h,isFeedback:a}),window.UserLeap.frameId=I;const C=R=>{D.once(A.CloseSurveyOnOverlayClick,R)},B={apiURL:window.UserLeap._API_URL,cards:d,configureExitOnOverlayClick:C,context:i,endCard:o,envId:window.UserLeap.envId,eventEmitFn:D.emit.bind(D),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:s,frame:k,headers:f,locale:u,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:ee.getItem("sprig.previewKey"),productConfig:{framePosition:c?.framePosition,desktopDisplay:c?.desktopDisplay,placement:c?.placement},responseGroupUid:p,startingQuestionIdx:(n=window.UserLeap.config)==null?void 0:n.startingQuestionIdx,studyType:g,styleNonce:window.UserLeap.styleNonce,surveyId:h,tabTitle:document.title,trackPageViewUrl:t,ulEvents:ot,useMobileStyling:v,userId:m,viewDocument:O?.document,viewWindow:O,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},...window.UserLeap._config};(r=window.UserLeap._config)!=null&&r.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const V=(a?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??c.customStyles;B.customStyles=V,O&&(O.__cfg=B);function K(){const R=document.createElement("script");return window.UserLeap.nonce&&R.setAttribute("nonce",window.UserLeap.nonce),R.id=As,R}const ae=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:B.path,he=document.getElementById(As);he&&he.remove();const H=K(),le=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(B.installationMethod==="web-npm"||B.installationMethod==="web-npm-bundled"){const{default:R}=await import("./view-BeigWq26.js");R.configure(B),S&&window.UserLeap.container&&le()}else ae&&(H.src=ae,S&&H.addEventListener("load",()=>{window.UserLeap.container&&le()}),O?.addEventListener("error",R=>{R.target instanceof HTMLScriptElement&&R.target.src===ae&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));return _?.appendChild(H),{success:!0,surveyState:"ready",surveyId:h,responseGroupUid:p}};function Or(e){var t;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const n=((t=window.UserLeap.windowDimensions)==null?void 0:t.width)??document.body.clientWidth;return Pr(e)||n>10&&n<oo}function Pr(e){return Ul.includes(e["userleap-platform"])}const Os=e=>{const{pageUrlEvents:t}=window.UserLeap._config,n=t?.find(r=>r.id===e);return n?wn(n,window.location.href):!1},Cr="ul-frame";window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig),window.UserLeap||(window.UserLeap=window.Sprig),window.Sprig||(window.Sprig=window.UserLeap);const xl="rgba(255,255,255, 0.95)",Al="rgba(0,0,0,0.9)",Rr="0px",Ps=(e,t)=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className=`ul-container ${e&&"ul-container-feedback"}`;const n=Ms();t&&n&&!window.UserLeap.useMobileStyling?n.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},Cs=(e,t)=>{var n;Rl();const r=window.UserLeap.container;if(r)try{(n=r.parentNode)==null||n.removeChild(r),window.UserLeap.container=null,re("trackStartUrl",null),D.emit(A.SurveyLifeCycle,{state:"dismissed"}),D.emit(A.SurveyClosed,{name:A.SurveyClosed,initiator:e,studyType:t})}catch(i){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+r),i instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",i)}},Rs=()=>{D.once(A.SurveyWillClose,({initiator:e,studyType:t})=>{D.removeAllListeners(A.CloseSurveyOnOverlayClick),Cs(e,t)})},Dl=(e,t)=>{const n={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},r=t?e.overlayStyleMobile:e.overlayStyle;n["background-color"]=r==="light"?xl:Al,t||(n.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,n)},Ol=(e,t,n,r)=>{var i,s;const o={position:"fixed",bottom:"0px",right:Rr,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},a=Object.assign({},t,window.UserLeap),{desktopDisplay:l}=t||{},u=l==="center-modal";u&&(a.framePosition="center");let c,d=!1;if(n)(i=window.UserLeap.windowDimensions)!=null&&i.width?o.width=`${window.UserLeap.windowDimensions.width}px`:o.width="100%",(s=window.UserLeap.windowDimensions)!=null&&s.height?o.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?o.maxHeight=window.UserLeap.maxHeight:o.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(a.overlayStyleMobile)&&(d=!0);else{o.width=Hr,o.maxHeight=window.UserLeap.maxHeight||"66vh";const p=()=>{d=!0,c={margin:"auto",position:"static"}};if(r)u?p():c={position:"relative",height:"300px"};else switch(a.framePosition){case"bottomLeft":c={left:Rr};break;case"topLeft":c={left:Rr,top:0};break;case"topRight":c={top:0};break;case"center":p();break}}return d&&Dl(a,n),Object.assign(e.style,o,c),d},Pl=({productConfig:e,useMobileStyling:t,surveyId:n,isFeedback:r})=>{var i,s;const o=Cr,a=r&&e.desktopDisplay==="slider";Ps(r,a),Cl();const l=document.createElement("iframe");l.id=o,l.setAttribute("title","Sprig User Feedback Dialog");const u=Ol(l,e,t,r);Rs();let c=!1;l.setHeight=m=>{(parseInt(l.style.height)!=m||!c)&&(c=!0,l.style.height=`${m}px`,D.emit(A.SurveyHeight,{name:A.SurveyHeight,contentFrameHeight:m}))};let d=!1;l.setWidth=m=>{(parseInt(l.style.width)!=m||!d)&&(d=!0,l.style.width=`${m}px`,D.emit(A.SurveyWidth,{name:A.SurveyWidth,contentFrameWidth:m}))},(i=window.UserLeap.container)==null||i.appendChild(l),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{D.emit(A.CloseSurveyOnOverlayClick)}),D.emit(A.SurveyLifeCycle,{state:"presented"}),D.emit(A.SurveyPresented,{name:A.SurveyPresented,"survey.id":n});const p=(s=l.contentWindow)==null?void 0:s.document;if(p&&(p.open("text/html","replace"),p.write("<!doctype html><head></head><body></body></html>"),p.close(),!t)){const m=p.body;m.style.display="flex",m.style.alignItems="center"}const h=p?.head;return{frameId:o,contentWinDocHead:h,contentWindow:l.contentWindow,hasOverlay:u,iframe:l}},Ts={[A.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},Cl=()=>{Object.entries(Ts).forEach(([e,t])=>{D.on(e,t)})},Rl=()=>{Object.entries(Ts).forEach(([e,t])=>{D.off(e,t)})},Tl=1,js=e=>e instanceof HTMLElement||e instanceof SVGElement,vn=(e,t,n)=>{const r="ul-custom-style",i=e.getElementById(r);if(i){i.textContent=t;return}const s=e.createElement("style");n&&(s.nonce=n),s.textContent=t,s.id=r,e.head.appendChild(s)},Ns=e=>{const t=e.querySelector(".ul-card__container");let n=600,r=360;if(t){n=t.scrollHeight;const i=getComputedStyle(t),s=parseFloat(i.marginTop)+parseFloat(i.marginBottom),o=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),a=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom);n+=s+o+a;const l=t.querySelector(".ul-card--matrix_grid");r=l?l.scrollWidth:t.scrollWidth;const u=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),c=parseFloat(i.marginLeft)+parseFloat(i.marginRight),d=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth);r+=c+d+u}return[n+Tl,r]},jl=e=>{const t=e.querySelector(".ul-card__container");t&&(t.scrollTop=0)},Ms=()=>j,st=()=>document.getElementById("sprig-feedback-container"),Tr=()=>document.getElementById("sprig-feedback-loading-animation"),Nl=()=>{if(Tr())return;const e=document.createElement("div");return e.className="ul-loading-spinner-container",e.id="sprig-feedback-loading-animation",e.role="progressbar",e.setAttribute("aria-live","polite"),e.setAttribute("aria-busy","true"),e.setAttribute("aria-label","Processing..."),e.innerHTML=`
|
|
9
|
+
<div class="ul-loading-spinner">
|
|
10
|
+
<div class="first"></div>
|
|
11
|
+
<div class="second"></div>
|
|
12
|
+
<div class="third"></div>
|
|
13
|
+
<div class="fourth"></div>
|
|
14
|
+
</div>
|
|
15
|
+
`,e},Ks=()=>!!document.getElementById(Cr);let jr=!1,j=null,pe=null,Nr=!1,Ot=null,Pt=null;const Ml=["bottom-left","bottom-right","center-left","center-right"],Kl=e=>{if(st()||!Ml.includes(e))return;const[t,n]=e.split("-"),r=document.createElement("div");r.id="sprig-feedback-container",r.classList.add(`sprig-feedback-container-${n}`,`sprig-feedback-container-${t}`),document.body.appendChild(r)},bn=()=>{var e;const t=window.UserLeap.container;return((e=t?.parentElement)==null?void 0:e.id)==="sprig-feedback-loading-container"},$s=()=>document.getElementById("sprig-feedback-error-container"),Bs=()=>{if(!j)return 0;const e=j?.clientWidth,t=window.getComputedStyle(j),n=parseInt(t.borderRightWidth||"0"),r=parseInt(t.borderLeftWidth||"0");return e+n+r},_n=e=>{const t=st();t&&(Pt!=null&&Pt.endsWith("right")?t.style.right=`${e}px`:Pt!=null&&Pt.endsWith("left")&&(t.style.left=`${e}px`))},Mr=()=>{if(j&&(bn()||$s())){D.off(A.SurveyAppeared,Ct),Kr();const e=Bs();return _n(-e),!0}return!1},Ct=()=>{if(!j||!pe)return;const e=Tr();e&&e.remove(),j.style.height="auto",j.style.width="auto",pe.disabled=!1,Nr=!1},Kr=()=>{if(j&&!Tr()){const e=Nl();e&&(j.style.height="300px",j.style.width="360px",j.appendChild(e))}},Fs=()=>{!j||!pe||(_n(0),pe.disabled=!0,Nr=!0)},$l=async e=>{const t=await de(oe("1",[Ce],"startFeedbackStudy"),{body:JSON.stringify({surveyUuid:e}),method:"POST"});return t.ok?t.json:null},qs=async(e,t,n)=>{const{buttonTheme:r,customStyles:i,eventId:s,placement:o,desktopDisplay:a,feedbackLabel:l,surveyUuid:u,surveyId:c}=e;window.UserLeap.feedbackCustomStyles=void 0;let d=st();if(d){if(!t&&s===Ot)return;d.remove(),D.off(ot.SURVEY_FADING_OUT,Mr)}if(Ot=s,!document.getElementById("sprig-feedback-style")){const{head:g}=document,f=document.createElement("style");f.id="sprig-feedback-style",f.textContent=no,f.nonce=window.UserLeap.styleNonce,g.appendChild(f)}vn(document,i??"",window.UserLeap.styleNonce),jr=a==="center-modal",Pt=o;const[p,h]=o.split("-");Kl(o),d=st(),pe=document.createElement("button");const m=document.createElement("div");m.className="sprig-feedback-button-label",m.innerText=l,pe.appendChild(m),pe.id="sprig-feedback-button",pe.classList.add(`sprig-feedback-button-${h}`,`sprig-feedback-button-${p}`,`sprig-feedback-button-${r}`,"fade-in-transition"),D.on(ot.SURVEY_FADING_OUT,Mr),pe.addEventListener("click",async()=>{const g=document.getElementById("sprig-feedback-error-container");if(Ks()||$s()){if(Mr()){D.emit(A.SurveyWillClose,{name:A.SurveyWillClose,initiator:me.FeedbackClosed,studyType:"feedbackButton"});const v=st();g&&v&&(v.remove(),Ot=null,j=null)}return}const f=je(window.UserLeap);if(!Or(f)&&!Nr&&Fs(),t){j&&j.classList.add("sprig-feedback-loading-container-previews"),await Dt(t),Ct();return}const b=await $l(u);if(b)D.once(A.SurveyAppeared,Ct),Dt({...b,studyType:"feedbackButton"},n);else if(j){const v=Fl();j.appendChild(v),Ct(),j.style.height="300px",j.style.width="360px"}}),d?.appendChild(pe),D.emit(A.FeedbackButtonLoaded,{name:A.FeedbackButtonLoaded,"survey.id":c});const{useMobileStyling:y,_config:{border:w}}=window.UserLeap;if(!jr&&!y){const g=document.createElement("div");g.id="sprig-feedback-loading-container",g.className=`sprig-feedback-loading-container sprig-feedback-loading-container-${h}`,g.style.setProperty("--feedback-border",w),j=g,Kr(),d?.appendChild(g);const f=Bs();_n(-f)}else jr&&_n(0);window.UserLeap._config.isOnQuestionsTab&&t&&!bn()&&j&&(Fs(),Kr(),j&&j.classList.add("sprig-feedback-loading-container-previews"),Dt(t),Ct())},Bl=()=>{if(bn())return;const e=st();e&&(Os(Ot)||(e.remove(),Ot=null,j=null))},Fl=()=>{const e=document.createElement("div");e.id="sprig-feedback-error-container",e.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
16
|
+
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
17
|
+
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
18
|
+
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
19
|
+
</svg>`;const t=document.createElement("h3");return t.className="sprig-feedback-error-text",t.innerText="There was an error while loading the survey",e.appendChild(t),e},ql="!launch_darkly_";class Wl{constructor(){F(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>this._ldData[`${ql}${n}`]=(t[n]??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 $r=new Wl;Object.freeze($r);const Vl="!optimizely_experiments_";class Hl{constructor(){F(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:s,variation:o}=i,a=this.transformExperimentId(s);o&&typeof o=="string"&&(this._optimizelyData[a]=o)}),!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 Vl+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 s,o;return(s=n[i].variation)!=null&&s.name?{id:i,variation:(o=n[i].variation)==null?void 0:o.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 Sn=new Hl;Object.freeze(Sn);class zl{constructor(t,n){F(this,"paused"),F(this,"queue"),F(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}}const Br=(e,t)=>{const n=performance.now();document.hidden?setTimeout(()=>Br(e,t),e):setTimeout(()=>{const r=performance.now()-n;t.report(r/1e3),setTimeout(()=>Br(e,t),e)},0)},Gl=(e=1e3)=>{const t=hn("sdk_event_queue_latency_seconds");Br(e,t)},Jl=({webMetricsEnabled:e,reportingIntervalSeconds:t,thresholds:n,postMetrics:r})=>{Sa(n,(i,s)=>{if(xs()){const o=`Value: ${i} on ${s.metric} violated threshold of ${s.type} ${s.value}`;it("Threshold violated",new Error(o),{reportError:!1}),va()}}),Ea({reportingIntervalSeconds:t,postMetrics:r}),e&&Gl()},Yl={test:"test"},Ql=["popState","pushState","replaceState"],Rt="!email",Fr="pageUrl";function Xl(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const s=[];n&&n.length&&s.push(...n),r&&r.length&&s.push(...r);const o=e&&s.find(a=>a.id===e);return o?wn(o,window.location.href):t===window.location.href}function Tt(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!=="web")return;const s=Ve("trackStartUrl"),o=s?String(s):null;t&&zs(window.location.href),n&&(Vs(),Zl()),Ms()&&Bl(),G.getItem("sprig.isCapturingHeatmap")&&Wa(),!bn()&&r&&o&&o!==window.location.href&&e&&Ql.includes(e.type)&&window.UserLeap("dismissActiveSurvey",me.PageChange)}const Ws={capture:!0},Zl=()=>{const e=window.UserLeap._config.interactiveEvents.filter(n=>wn(n,window.location.href)).map(n=>{const{name:r,properties:i}=n,{selector:s,innerText:o}=i;return s?a=>{if(js(a.target))try{a.target.closest(s)&&window.UserLeap("track",r)}catch{}return!1}:a=>(js(a.target)&&a.target.innerText===o&&window.UserLeap("track",r),!1)}),t=n=>e.forEach(r=>r(n));window.UserLeap._config.interactiveEventsHandler=t,window.addEventListener("click",t,Ws)},Vs=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,Ws),delete window.UserLeap._config.interactiveEventsHandler};function eu(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Tt,!0))}function tu(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Tt,!0)),window.UserLeap._config.interactiveEvents&&Vs()}function nu(e){const t=new URL(oe("1",[Re],"questions"));return Object.entries(e||{}).forEach(([n,r])=>{r&&t.searchParams.append(n,String(r))}),t.toString()}function Ve(e){const t=ee.getItem("userleap.ids");if(t)try{const n=JSON.parse(t)[window.UserLeap.envId];return n&&n[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 Hs(){window.previewMode||(window.UserLeap.visitorId=ke(),L(`Generating new vid: ${window.UserLeap.visitorId}`),re("vid",window.UserLeap.visitorId),D.emit(A.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function zs(e,t,n,r){var i;if(e.endsWith("mock_snippet.html"))return;L(`Tracking page view: ${e}`);const s=window.UserLeap._config.pageUrlEvents;let o=!1;if(s&&s.length)for(let h=0;h<s.length&&(o=wn(s[h],e),!o);h++);if(!o)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const a=10,l=1;let u=[];const c={viewedAt:Date.now(),location:e},d={url:e};r&&(d.trackPageView=!0);const p=ee.getItem("userleap.pageviews");try{if(u=p?JSON.parse(p):[],Array.isArray(u)||(u=[]),u.length>0){const h=u[u.length-1],m=(Date.now()-h.viewedAt)/1e3;if(h.location!=e&&m>l){const y=(i=document?.querySelector('meta[name="description"]'))==null?void 0:i.getAttribute("content");Ls({...y&&{description:y},url:e,referrer:document.referrer,pageTitle:document.title})}(h.location!=e&&m>l||m>a)&&(window.UserLeap._queue.push(["track",Fr,t,d,n]),u.push(c))}else window.UserLeap._queue.push(["track",Fr,t,d,n]),u.push(c),Ls({url:e});u.length>5&&u.splice(0,u.length-5),ee.setItem("userleap.pageviews",JSON.stringify(u))}catch(h){h instanceof Error&&window.UserLeap.reportError("trackPageView",h,{pageViewsStorage:p}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ru(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...n){const r=t.apply(this,n),i=new Event("pushState");return window.dispatchEvent(i),Tt(i),r})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...n){const r=t.apply(this,n),i=new Event("replaceState");return window.dispatchEvent(i),Tt(i),r})(e.replaceState)),eu()}async function qr(e,t){const n=Dr();e&&!t&&(window.UserLeap._config.mode=Yl.test);const r=je(window.UserLeap),i=Or(r),s=await de(nu({desktopDisplay:window.UserLeap._config.desktopDisplay,isMobile:i,previewLanguage:window.UserLeap._config.previewLanguage,surveyid:e?.surveyId,surveytemplateid:e?.surveyTemplateId,vid:n}),{shouldDropOnRateLimit:!0});if(!s.ok)return s.reportError&&s.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",s.error),window.UserLeap.reportError("getQuestions",s.error)),{success:!1,surveyState:"no survey"};if(s.json.delay&&await Nt(s.json.delay),s.json.isFeedback){const{feedbackLabel:o,productConfig:a,surveyUuid:l,feedbackCustomStyles:u}=s.json,{buttonTheme:c,placement:d,desktopDisplay:p}=a,h={customStyles:u,buttonTheme:c,desktopDisplay:p,eventId:0,feedbackLabel:o,placement:d,surveyUuid:l,surveyId:e?.surveyId};qs(h,s.json)}else return Dt(s.json)}function iu(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 su(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&iu(t),(t||n||r)&&(ru(),Tt())}async function ou(e,t){var n,r;let i=!0;return t&&(n=e?.json)!=null&&n.surveyId&&(window.UserLeap.delayingSurvey=!0,i=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!i)?!1:((r=e?.json)!=null&&r.delay&&(window.UserLeap.delayingSurvey=!0,await Nt(e.json.delay),window.UserLeap.delayingSurvey=!1),i)}const au=function(e){if(!window.UserLeap)return;const t=async(i={})=>{var s,o,a,l;const{userId:u,anonymousId:c,metadata:d={},properties:p,showSurveyCallback:h}=i;let{eventName:m}=i;if(window.UserLeap.debugMode&&m!==Fr&&console.info("[DEBUG] Sprig track",i),e.mode==="test")return;const y=ee.getItem("sprig.previewKey")??void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!u){const v="[Sprig] - Skipping tracking without userId";return console.warn(v),{success:!1,message:v,surveyState:"no survey"}}if(!m||m.trim().length===0){m=m?String(m):"";const v="[Sprig] - Invalid event name "+m;return console.warn(v),{success:!1,message:v,surveyState:"no survey"}}const w=window.location.href;if(d.url||(d.url=w),re("trackStartUrl",w),(o=(s=window.UserLeap)==null?void 0:s._config)!=null&&o.optimizelyEnabled){const v=je(window.UserLeap);Pr(v)||Sn.getAndSetWebOptimizelyExperiments(),d.optimizelyExperiments=Object.assign({},Sn.getAllOptimizelyExperiments())}(l=(a=window.UserLeap)==null?void 0:a._config)!=null&&l.launchDarklyEnabled&&(d.launchDarklyFlags=$r.getAllLaunchDarklyVariations()),u&&(window.UserLeap.userId=u),c&&(window.UserLeap.partnerAnonymousId=c),p&&(d.eventProperties=p),vl({name:m,url:d.url}),L(`Tracking event: ${m}`);const g=window.UserLeap.delayingSurvey||Ks()?await de(oe("1",[Ce],"events/batch"),{body:JSON.stringify({events:[{event:m,metadata:d}],previewKey:y}),method:"POST",shouldDropOnRateLimit:!0}):await de(oe("1",[Ce],"events"),{body:JSON.stringify({event:m,metadata:d,previewKey:y}),method:"POST",shouldDropOnRateLimit:!0});if(!g.ok){const v="[Sprig] (ERR-421) Failed to track event";return g.reportError&&(console.warn(v,g.error),g.error&&window.UserLeap.reportError("track",g.error)),{success:!1,message:v,error:g.error,surveyState:"no survey"}}u&&re("uid",u),c&&re("aid",c);const f=g.json;f.invalidPreviewKey&&ee.removeItem("sprig.previewKey");const b=d.trackPageView?d.url:"";return f!=null&&f.feedbackButton&&qs(f.feedbackButton,void 0,b),await ou(g,h)?Xl(f.eventId,w)?Dt(f,b):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},n=(i,s)=>{var o;const a=(o=i?.querySelector(`[id="${Cr}"]`))==null?void 0:o.contentDocument;a&&vn(a,s)},r={async displaySurvey(i){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",me.Override),qr({surveyId:i},!0)},_previewSurvey(i){window.UserLeap("dismissActiveSurvey",me.Override),qr({surveyTemplateId:i},!1)},_reviewSurvey(i){window.UserLeap("dismissActiveSurvey",me.Override),qr({surveyId:i},!1)},previewSurvey(i){r._previewSurvey(i)},reviewSurvey(i){r._reviewSurvey(i)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(i=me.API){D.emit(A.SurveyWillClose,{name:A.SurveyWillClose,initiator:i})},async setAttribute(i,s){if(!i||!s&&s!==0&&s!==!1){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[i]:s})},async setAttributes(i){if(i==null||Object.keys(i).length===0){const s="[Sprig] - Disregarding empty attributes provided";return console.warn(s),{success:!1,message:s}}return this.identifyAndSetAttributes({attributes:i})},async identifyAndSetAttributes(i){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",i),e.mode==="test")return;if(i===null||typeof i!="object"||!(i.userId||i.anonymousId||i.attributes)){const c="[Sprig] - Disregarding empty payload provided";return console.warn(c),{success:!1,message:c}}const{userId:s,anonymousId:o,attributes:a}=i;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!s){const c="[Sprig] - Skipping tracking without userId";return console.warn(c),{success:!1,message:c}}if(!a&&(!s||window.UserLeap.userId===s)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const l={};s&&(l.userId=window.UserLeap.userId=s),o&&(l.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let u;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,Rt)&&(a[Rt]=a.email,delete a.email),L(`Setting attributes: ${JSON.stringify(a)}`),u=await de(oe("1",[Re,Ce],"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 de(oe("1",[Re,Ce]),{body:JSON.stringify(l),method:"PUT"}),a&&a[Rt]&&(window.UserLeap.email=a[Rt]),u.ok&&(s&&re("uid",s),o&&re("aid",o)),{success:!!u.ok}},async removeAttributes(i){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",i),e.mode==="test")return;if(i==null||i.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 s=await de(oe("1",[Re,Ce],"attributes"),{body:JSON.stringify({delete:i}),method:"DELETE"});return!s.ok&&s.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",s.error),s.error&&window.UserLeap.reportError("removeAttributes",s.error)),{success:!!s.ok}},async addSurveyListener(i){D.on(A.SurveyLifeCycle,i)},async removeSurveyListener(i){D.removeListener(A.SurveyLifeCycle,i)},async addListener(i,s){D.on(i,s)},async removeListener(i,s){D.removeListener(i,s)},async removeAllListeners(){D.removeAllListeners()},setPreviewKey(i){!i||typeof i!="string"||ee.isStorageAvailable&&i&&ee.setItem("sprig.previewKey",i)},async setUserId(i){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",i),i==null){const a=`[Sprig] - Invalid userId ${i}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||i===window.UserLeap.userId)return;window.UserLeap.userId=i;const s=window.UserLeap.visitorId,o=await de(oe("1",[Re,Ce]),{body:JSON.stringify({userId:i}),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}s!==window.UserLeap.visitorId&&xr(),re("uid",i)},async setPartnerAnonymousId(i){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",i),i==null){const s=`[Sprig] - Invalid partnerAnonymousId ${i}`;return console.warn(s),{success:!1,message:s}}return window.UserLeap.partnerAnonymousId=i,re("aid",i),{success:!0}},async track(i,s,o={},a=void 0){return t({eventName:i,properties:s,metadata:o,showSurveyCallback:a})},async identifyAndTrack(i){return await t(i)},trackPageView(i,s=void 0,o=void 0,a=!0){zs(i,s,o,a)},applyFeedbackStyles({button:i="",view:s=""}){window.UserLeap.feedbackCustomStyles=s,document.getElementById("sprig-feedback-style")&&vn(document,i,window.UserLeap.styleNonce),n(document.querySelector(".ul-container-feedback"),s)},applyStyles(i){window.UserLeap.customStyles=i,n(window.UserLeap.container,i)},setWindowDimensions(i,s){var o,a;const l=typeof i=="string"?parseInt(i,10):i,u=typeof s=="string"?parseInt(s,10):s;if(!isNaN(l)&&!isNaN(u)&&(window.UserLeap.windowDimensions={width:l,height:u}),!window.UserLeap.frameId)return;const c=document.getElementById(window.UserLeap.frameId);c&&(window.UserLeap.useMobileStyling&&((o=window.UserLeap.windowDimensions)!=null&&o.width&&(c.style.width=`${window.UserLeap.windowDimensions.width}px`),(a=window.UserLeap.windowDimensions)!=null&&a.height&&(c.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),c.contentDocument&&(c.style.height=String(Ns(c.contentDocument)[0])+"px")),D.emit(A.SurveyDimensions,{name:A.SurveyDimensions,contentFrameWidth:c.clientWidth,contentFrameHeight:c.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),L(`Logging out user: ${window.UserLeap.userId} / vid: ${window.UserLeap.visitorId}`),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,ee.removeItem("userleap.ids"),ee.removeItem("userleap.pageviews"),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Hs(),xr(),window.UserLeap._queue.unpause()},teardown(){tu(),window.UserLeap("dismissActiveSurvey",me.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(i,s=!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 l=typeof i=="string"?JSON.parse(i):i;Sn.setOptimizelyExperiment(l,s)}catch(l){console.warn("[Sprig] Error with integrating Optimizely data"),l instanceof Error&&window.UserLeap.reportError("integrateOptimizely",l)}},integrateOptimizelyClient(i){var s,o;if(!((o=(s=window.UserLeap)==null?void 0:s._config)!=null&&o.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const a=({experiment:l,variation:u})=>{const c={experiments:[{id:l.id,variation:u.key}]};window.UserLeap("integrateOptimizely",c,!1)};i.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",a)},importLaunchDarklyData(i){var s,o;if(!((o=(s=window.UserLeap)==null?void 0:s._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}$r.setLDFlagsVariations(i)},setVisitorAttribute(i,s){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),r.setAttribute(i,s)},async setEmail(i){return r.setAttribute(Rt,i)},async setVisitorEmail(i){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),r.setEmail(i)},async _generateVideoUploadUrl(i){return du(i)},_reportMetric(i,s){Xi(i,s)},async _completeSessionReplay({surveyId:i,responseGroupUuid:s,eventDigest:o}){if(!i||!s)return!1;const a=window.UserLeap._API_URL;try{const l=await ai({surveyId:i,responseGroupUuid:s,eventDigest:o,apiUrl:a,headers:je(window.UserLeap)},!0);return!(l!=null&&l.error)}catch(l){return console.warn("[Sprig] Error with completing session replay"),l instanceof Error&&window.UserLeap.reportError("completeSessionReplay",l),!1}}};Object.assign(window.UserLeap,r)};async function lu(e){const t=je(window.UserLeap);document.addEventListener("securitypolicyviolation",En);const n=await fe(oe("1",[Re],"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",En),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),In("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(In(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}const uu=e=>typeof e=="object"&&e&&"inner"in e&&!!e.inner&&typeof e.inner=="object";async function cu(e,t,n={}){var r,i;const s=window.__cfg&&window.__cfg.mode,o=Dr(),a=window.UserLeap.envId,l=window.document.documentElement,u=uu(t)?{inner:{message:(r=t.inner)==null?void 0:r.message,stack:(i=t.inner)==null?void 0:i.stack}}:{},c={mode:s,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:l.clientWidth,clientHeight:l.clientHeight,location:window.location.href,language:window.navigator.language,...n,...u},d={action:e,err:{message:t.message,stack:t.stack},meta:c,vid:o,envId:a},p=await de(oe("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(d),shouldDropOnRateLimit:!0});if(!p.ok)console.warn("[Sprig] (ERR-444) Failed to report error to API",t);else{const{presignedUrl:h}=p.json;si(h)}}async function du(e){var t;if(!e)return;const n=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(n,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(t=i?.upload)==null?void 0:t.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function pu(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey")??"";window.UserLeap.UPDATES=ot,window.UserLeap("setPreviewKey",t);async function n(){if(window.UserLeap.loaded)return;if(L("Loading sprig on page load"),window.UserLeap.reportError=cu,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 a in window.UserLeap._config)window.UserLeap[a]=window.UserLeap._config[a];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 r=window.UserLeap.sampleRate;if(r){let a=Ve("sampled");if(a===null&&(a=Math.random()<r,re("sampled",a)),!a)return}else Ve("sampled")!==null&&re("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const i=[...window.UserLeap._queue];window.UserLeap._queue=new zl(window.UserLeap,[]),window.UserLeap._queue.pause();for(let a=0;a<i.length;a++)window.UserLeap._queue.push(i[a]);const s=Ve("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ve("vid"),window.UserLeap.userId=Ve("uid"),window.UserLeap.partnerAnonymousId=Ve("aid")):(ee.removeItem("userleap.ids"),Hs());const o=await lu(e);Jl({webMetricsEnabled:o.metricsReportingEnabled,reportingIntervalSeconds:o.metricsReportingEnabled||o.mobileMetricsReportingEnabled?o.metricsReportingIntervalSeconds:0,thresholds:o.metricThresholds,postMetrics:async a=>{await de(oe("1",[Re],"metrics"),{body:a,method:"POST",headers:{"x-ul-replay-enabled":`${xs()}`},shouldDropOnRateLimit:!0})}}),vs({viewDocument:window.document,maxReplayDurationSeconds:o.maxReplayDurationSeconds,replayNonce:window.UserLeap.replayNonce,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,replaySettings:o.replaySettings}).then(()=>{ps()}),ko(o.logBufferLimit,o.logLevel),au(o),await su(o),window.UserLeap._queue.unpause(),D.emit(A.SDKReady,{mobileMetricsReportingEnabled:!!o.mobileMetricsReportingEnabled,metricsReportingInterval:o.metricsReportingIntervalSeconds||0,metricsThresholds:o.metricThresholds||[],maxMobileReplayDurationSeconds:o.maxMobileReplayDurationSeconds,mobileReplaySettings:o.mobileReplaySettings}),D.emit(A.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?n():window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",()=>{n()},!1)}class kn{constructor(){F(this,"UPDATES",ot)}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 Wr={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",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(kn.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=kn.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,pu(e),window.Sprig}},hu={sprig:Wr,SprigAPI:kn,configure:Wr.configure};export{ro as A,Jr as C,me as D,ao as E,A as S,fe as a,Hr as b,Ns as c,so as d,D as e,io as f,kn as g,Wr as h,L as i,hu as j,vn as o,jl as r,Xr as s,si as u,ke as v};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-DCzsCvvC.cjs");exports.DismissReason=e.DismissReason;exports.SprigAPI=e.SprigAPI;exports.SprigEvent=e.SprigEvent;exports.default=e.index;exports.sprig=e.sprig;
|