From d4d19d1854ea54424a0a95ce355fcee40c511d6b Mon Sep 17 00:00:00 2001 From: rakshitranga <61892635+rakshitranga@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:53:50 -0400 Subject: [PATCH] Changed name to docs --- dist/assets/index-30b0bbee.css | 1 - dist/assets/index-a37fde6a.js | 28 ------------------- dist/dreamer.svg | 1 - dist/index.html | 17 ------------ dist/logo.png | Bin 31274 -> 0 bytes dist/manifest.webmanifest | 48 --------------------------------- dist/nature.svg | 1 - dist/treesvg.svg | 1 - dist/vite.svg | 1 - 9 files changed, 98 deletions(-) delete mode 100644 dist/assets/index-30b0bbee.css delete mode 100644 dist/assets/index-a37fde6a.js delete mode 100644 dist/dreamer.svg delete mode 100644 dist/index.html delete mode 100644 dist/logo.png delete mode 100644 dist/manifest.webmanifest delete mode 100644 dist/nature.svg delete mode 100644 dist/treesvg.svg delete mode 100644 dist/vite.svg diff --git a/dist/assets/index-30b0bbee.css b/dist/assets/index-30b0bbee.css deleted file mode 100644 index a8f22a2..0000000 --- a/dist/assets/index-30b0bbee.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Lexend+Deca&display=swap";*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.bottom-0{bottom:0}.m-4{margin:1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mr-2{margin-right:.5rem}.mt-12{margin-top:3rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-8{margin-top:2rem}.block{display:block}.inline{display:inline}.flex{display:flex}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.max-h-64{max-height:16rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-full{width:100%}.max-w-lg{max-width:32rem}.grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.justify-around{justify-content:space-around}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.bg-green{--tw-bg-opacity: 1;background-color:rgb(40 61 52 / var(--tw-bg-opacity))}.bg-neutral-200{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.bg-neutral-300{--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.fill-green{fill:#283d34}.stroke-green{stroke:#283d34}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-20{padding-bottom:5rem}.pb-8{padding-bottom:2rem}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.text-green{--tw-text-opacity: 1;color:rgb(40 61 52 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}:root{font-family:Lexend Deca,sans-serif;color-scheme:light;color:#ffffffde}h1{font-size:1.875rem;line-height:2.25rem;--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}h2{font-size:1.5rem;line-height:2rem;font-weight:800;--tw-text-opacity: 1;color:rgb(40 61 52 / var(--tw-text-opacity))}p{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}section{margin:1rem;border-radius:.75rem;--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity));padding:1rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.button{padding:.75rem 1.25rem;outline:2px solid transparent;outline-offset:2px;--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.input{margin-bottom:.75rem;padding:.75rem;--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px;--tw-ring-opacity: 1;--tw-ring-color: rgb(40 61 52 / var(--tw-ring-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.input:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.modal-overlay{position:fixed;top:0;left:0;display:none;height:100%;width:100%;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-bg-opacity: .7}.modal-overlay .modal{position:relative;top:20%;margin:.75rem}#addGoal:target{display:block}.main{margin-left:auto;margin-right:auto;max-width:32rem;touch-action:manipulation} diff --git a/dist/assets/index-a37fde6a.js b/dist/assets/index-a37fde6a.js deleted file mode 100644 index 9a2ec96..0000000 --- a/dist/assets/index-a37fde6a.js +++ /dev/null @@ -1,28 +0,0 @@ -var Gu=Object.defineProperty;var Qu=(n,t,e)=>t in n?Gu(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var A=(n,t,e)=>(Qu(n,typeof t!="symbol"?t+"":t,e),e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function e(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=e(s);fetch(s.href,o)}})();function E(){}const ic=n=>n;function Qe(n,t){for(const e in t)n[e]=t[e];return n}function Zu(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function sc(n){return n()}function Kr(){return Object.create(null)}function Bt(n){n.forEach(sc)}function ki(n){return typeof n=="function"}function Pt(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}let Oi;function vo(n,t){return n===t?!0:(Oi||(Oi=document.createElement("a")),Oi.href=t,n===Oi.href)}function qr(n){return n.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function Ju(n,t){const e=qr(n.srcset),i=qr(t||"");return i.length===e.length&&i.every(([s,o],r)=>o===e[r][1]&&(vo(e[r][0],s)||vo(s,e[r][0])))}function th(n){return Object.keys(n).length===0}function oc(n,...t){if(n==null){for(const i of t)i(void 0);return E}const e=n.subscribe(...t);return e.unsubscribe?()=>e.unsubscribe():e}function Gt(n,t,e){n.$$.on_destroy.push(oc(t,e))}function Bs(n,t,e,i){if(n){const s=rc(n,t,e,i);return n[0](s)}}function rc(n,t,e,i){return n[1]&&i?Qe(e.ctx.slice(),n[1](i(t))):e.ctx}function zs(n,t,e,i){if(n[2]&&i){const s=n[2](i(e));if(t.dirty===void 0)return s;if(typeof s=="object"){const o=[],r=Math.max(t.dirty.length,s.length);for(let a=0;a32){const t=[],e=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),fr=ac?n=>requestAnimationFrame(n):E;const _n=new Set;function cc(n){_n.forEach(t=>{t.c(n)||(_n.delete(t),t.f())}),_n.size!==0&&fr(cc)}function uc(n){let t;return _n.size===0&&fr(cc),{promise:new Promise(e=>{_n.add(t={c:n,f:e})}),abort(){_n.delete(t)}}}function P(n,t){n.appendChild(t)}function hc(n){if(!n)return document;const t=n.getRootNode?n.getRootNode():n.ownerDocument;return t&&t.host?t:n.ownerDocument}function eh(n){const t=T("style");return t.textContent="/* empty */",nh(hc(n),t),t.sheet}function nh(n,t){return P(n.head||n,t),t.sheet}function I(n,t,e){n.insertBefore(t,e||null)}function L(n){n.parentNode&&n.parentNode.removeChild(n)}function dr(n,t){for(let e=0;en.removeEventListener(t,e,i)}function C(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}const ih=["width","height"];function Yr(n,t){const e=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in t)t[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=t[i]:i==="__value"?n.value=n[i]=t[i]:e[i]&&e[i].set&&ih.indexOf(i)===-1?n[i]=t[i]:C(n,i,t[i])}function fc(n){return n===""?null:+n}function sh(n){return Array.from(n.childNodes)}function dn(n,t){t=""+t,n.data!==t&&(n.data=t)}function Kt(n,t){n.value=t??""}function oh(n,t,e,i){e==null?n.style.removeProperty(t):n.style.setProperty(t,e,i?"important":"")}function Xr(n,t,e){for(let i=0;i>>0}function lh(n,t){const e={stylesheet:eh(t),rules:{}};return ms.set(n,e),e}function pc(n,t,e,i,s,o,r,a=0){const l=16.666/i;let c=`{ -`;for(let b=0;b<=1;b+=l){const m=t+(e-t)*o(b);c+=b*100+`%{${r(m,1-m)}} -`}const u=c+`100% {${r(e,1-e)}} -}`,h=`__svelte_${ah(u)}_${a}`,f=hc(n),{stylesheet:d,rules:p}=ms.get(f)||lh(f,n);p[h]||(p[h]=!0,d.insertRule(`@keyframes ${h} ${u}`,d.cssRules.length));const g=n.style.animation||"";return n.style.animation=`${g?`${g}, `:""}${h} ${i}ms linear ${s}ms 1 both`,bs+=1,h}function ko(n,t){const e=(n.style.animation||"").split(", "),i=e.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),s=e.length-i.length;s&&(n.style.animation=i.join(", "),bs-=s,bs||ch())}function ch(){fr(()=>{bs||(ms.forEach(n=>{const{ownerNode:t}=n.stylesheet;t&&L(t)}),ms.clear())})}let ai;function ce(n){ai=n}function Dn(){if(!ai)throw new Error("Function called outside component initialization");return ai}function gc(n){Dn().$$.on_mount.push(n)}function uh(n){Dn().$$.on_destroy.push(n)}function hh(){const n=Dn();return(t,e,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[t];if(s){const o=dc(t,e,{cancelable:i});return s.slice().forEach(r=>{r.call(n,o)}),!o.defaultPrevented}return!0}}function Xs(n,t){return Dn().$$.context.set(n,t),t}function yn(n){return Dn().$$.context.get(n)}const pn=[],So=[];let xn=[];const Qr=[],fh=Promise.resolve();let Mo=!1;function dh(){Mo||(Mo=!0,fh.then(pr))}function Ze(n){xn.push(n)}const Gs=new Set;let an=0;function pr(){if(an!==0)return;const n=ai;do{try{for(;ann.indexOf(i)===-1?t.push(i):e.push(i)),e.forEach(i=>i()),xn=t}let Ln;function mc(){return Ln||(Ln=Promise.resolve(),Ln.then(()=>{Ln=null})),Ln}function _s(n,t,e){n.dispatchEvent(dc(`${t?"intro":"outro"}${e}`))}const Ji=new Set;let ke;function Zt(){ke={r:0,c:[],p:ke}}function Jt(){ke.r||Bt(ke.c),ke=ke.p}function $(n,t){n&&n.i&&(Ji.delete(n),n.i(t))}function j(n,t,e,i){if(n&&n.o){if(Ji.has(n))return;Ji.add(n),ke.c.push(()=>{Ji.delete(n),i&&(e&&n.d(1),i())}),n.o(t)}else i&&i()}const bc={duration:0};function mh(n,t,e){const i={direction:"in"};let s=t(n,e,i),o=!1,r,a,l=0;function c(){r&&ko(n,r)}function u(){const{delay:f=0,duration:d=300,easing:p=ic,tick:g=E,css:b}=s||bc;b&&(r=pc(n,0,1,d,f,p,b,l++)),g(0,1);const m=lc()+f,_=m+d;a&&a.abort(),o=!0,Ze(()=>_s(n,!0,"start")),a=uc(y=>{if(o){if(y>=_)return g(1,0),_s(n,!0,"end"),c(),o=!1;if(y>=m){const v=p((y-m)/d);g(v,1-v)}}return o})}let h=!1;return{start(){h||(h=!0,ko(n),ki(s)?(s=s(i),mc().then(u)):u())},invalidate(){h=!1},end(){o&&(c(),o=!1)}}}function bh(n,t,e){const i={direction:"out"};let s=t(n,e,i),o=!0,r;const a=ke;a.r+=1;let l;function c(){const{delay:u=0,duration:h=300,easing:f=ic,tick:d=E,css:p}=s||bc;p&&(r=pc(n,1,0,h,u,f,p));const g=lc()+u,b=g+h;Ze(()=>_s(n,!1,"start")),"inert"in n&&(l=n.inert,n.inert=!0),uc(m=>{if(o){if(m>=b)return d(0,1),_s(n,!1,"end"),--a.r||Bt(a.c),!1;if(m>=g){const _=f((m-g)/h);d(1-_,_)}}return o})}return ki(s)?mc().then(()=>{s=s(i),c()}):c(),{end(u){u&&"inert"in n&&(n.inert=l),u&&s.tick&&s.tick(1,0),o&&(r&&ko(n,r),o=!1)}}}function Sn(n,t){const e=t.token={};function i(s,o,r,a){if(t.token!==e)return;t.resolved=a;let l=t.ctx;r!==void 0&&(l=l.slice(),l[r]=a);const c=s&&(t.current=s)(l);let u=!1;t.block&&(t.blocks?t.blocks.forEach((h,f)=>{f!==o&&h&&(Zt(),j(h,1,1,()=>{t.blocks[f]===h&&(t.blocks[f]=null)}),Jt())}):t.block.d(1),c.c(),$(c,1),c.m(t.mount(),t.anchor),u=!0),t.block=c,t.blocks&&(t.blocks[o]=c),u&&pr()}if(Zu(n)){const s=Dn();if(n.then(o=>{ce(s),i(t.then,1,t.value,o),ce(null)},o=>{if(ce(s),i(t.catch,2,t.error,o),ce(null),!t.hasCatch)throw o}),t.current!==t.pending)return i(t.pending,0),!0}else{if(t.current!==t.then)return i(t.then,1,t.value,n),!0;t.resolved=n}}function Si(n,t,e){const i=t.slice(),{resolved:s}=n;n.current===n.then&&(i[n.value]=s),n.current===n.catch&&(i[n.error]=s),n.block.p(i,e)}function be(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function _h(n,t){n.d(1),t.delete(n.key)}function yh(n,t){j(n,1,1,()=>{t.delete(n.key)})}function _c(n,t,e,i,s,o,r,a,l,c,u,h){let f=n.length,d=o.length,p=f;const g={};for(;p--;)g[n[p].key]=p;const b=[],m=new Map,_=new Map,y=[];for(p=d;p--;){const M=h(s,o,p),k=e(M);let w=r.get(k);w?i&&y.push(()=>w.p(M,t)):(w=c(k,M),w.c()),m.set(k,b[p]=w),k in g&&_.set(k,Math.abs(p-g[k]))}const v=new Set,x=new Set;function S(M){$(M,1),M.m(a,u),r.set(M.key,M),u=M.first,d--}for(;f&&d;){const M=b[d-1],k=n[f-1],w=M.key,O=k.key;M===k?(u=M.first,f--,d--):m.has(O)?!r.has(w)||v.has(w)?S(M):x.has(O)?f--:_.get(w)>_.get(O)?(x.add(w),S(M)):(v.add(O),f--):(l(k,r),f--)}for(;f--;){const M=n[f];m.has(M.key)||l(M,r)}for(;d;)S(b[d-1]);return Bt(y),b}function Co(n,t){const e={},i={},s={$$scope:1};let o=n.length;for(;o--;){const r=n[o],a=t[o];if(a){for(const l in r)l in a||(i[l]=1);for(const l in a)s[l]||(e[l]=a[l],s[l]=1);n[o]=a}else for(const l in r)s[l]=1}for(const r in i)r in e||(e[r]=void 0);return e}function Ai(n){return typeof n=="object"&&n!==null?n:{}}function lt(n){n&&n.c()}function it(n,t,e){const{fragment:i,after_update:s}=n.$$;i&&i.m(t,e),Ze(()=>{const o=n.$$.on_mount.map(sc).filter(ki);n.$$.on_destroy?n.$$.on_destroy.push(...o):Bt(o),n.$$.on_mount=[]}),s.forEach(Ze)}function st(n,t){const e=n.$$;e.fragment!==null&&(gh(e.after_update),Bt(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function xh(n,t){n.$$.dirty[0]===-1&&(pn.push(n),dh(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<{const p=d.length?d[0]:f;return c.ctx&&s(c.ctx[h],c.ctx[h]=p)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](p),u&&xh(n,h)),f}):[],c.update(),u=!0,Bt(c.before_update),c.fragment=i?i(c.ctx):!1,t.target){if(t.hydrate){const h=sh(t.target);c.fragment&&c.fragment.l(h),h.forEach(L)}else c.fragment&&c.fragment.c();t.intro&&$(n.$$.fragment),it(n,t.target,t.anchor),pr()}ce(l)}class $t{constructor(){A(this,"$$");A(this,"$$set")}$destroy(){st(this,1),this.$destroy=E}$on(t,e){if(!ki(e))return E;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}$set(t){this.$$set&&!th(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const vh="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(vh);const Po={},ys={},yc={},xc=/^:(.+)/,Zr=4,wh=3,kh=2,Sh=1,Mh=1,li=n=>n.replace(/(^\/+|\/+$)/g,"").split("/"),Qs=n=>n.replace(/(^\/+|\/+$)/g,""),Ch=(n,t)=>{const e=n.default?0:li(n.path).reduce((i,s)=>(i+=Zr,s===""?i+=Mh:xc.test(s)?i+=kh:s[0]==="*"?i-=Zr+Sh:i+=wh,i),0);return{route:n,score:e,index:t}},Ph=n=>n.map(Ch).sort((t,e)=>t.scoree.score?-1:t.index-e.index),Jr=(n,t)=>{let e,i;const[s]=t.split("?"),o=li(s),r=o[0]==="",a=Ph(n);for(let l=0,c=a.length;l"u"){h=!0;break}const _=xc.exec(b);if(_&&!r){const y=decodeURIComponent(m);d[_[1]]=y}else if(b!==m){h=!0;break}}if(!h){e={route:u,params:d,uri:"/"+o.slice(0,g).join("/")};break}}return e||i||null},Zs=(n,t)=>n+(t?`?${t}`:""),Oh=(n,t)=>{if(n.startsWith("/"))return n;const[e,i]=n.split("?"),[s]=t.split("?"),o=li(e),r=li(s);if(o[0]==="")return Zs(s,i);if(!o[0].startsWith(".")){const c=r.concat(o).join("/");return Zs((s==="/"?"":"/")+c,i)}const a=r.concat(o),l=[];return a.forEach(c=>{c===".."?l.pop():c!=="."&&l.push(c)}),Zs("/"+l.join("/"),i)},ta=(n,t)=>`${Qs(t==="/"?n:`${Qs(n)}/${Qs(t)}`)}/`,Ah=n=>!n.defaultPrevented&&n.button===0&&!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey),vc=()=>typeof window<"u"&&"document"in window&&"location"in window,Dh=n=>({active:n&4}),ea=n=>({active:!!n[2]});function Th(n){let t,e,i,s;const o=n[17].default,r=Bs(o,n,n[16],ea);let a=[{href:n[0]},{"aria-current":n[2]},n[1],n[6]],l={};for(let c=0;c({})}=t,{preserveScroll:p=!1}=t;const g=yn(Po);Gt(n,g,k=>e(14,r=k));const{base:b}=yn(ys);Gt(n,b,k=>e(15,a=k));const{navigate:m}=yn(yc),_=hh();let y,v,x,S;const M=k=>{if(_("click",k),Ah(k)){k.preventDefault();const w=r.pathname===y||h;m(y,{state:f,replace:w,preserveScroll:p})}};return n.$$set=k=>{t=Qe(Qe({},t),wo(k)),e(6,o=Ur(t,s)),"to"in k&&e(7,u=k.to),"replace"in k&&e(8,h=k.replace),"state"in k&&e(9,f=k.state),"getProps"in k&&e(10,d=k.getProps),"preserveScroll"in k&&e(11,p=k.preserveScroll),"$$scope"in k&&e(16,c=k.$$scope)},n.$$.update=()=>{n.$$.dirty&32896&&e(0,y=u==="/"?a.uri:Oh(u,a.uri)),n.$$.dirty&16385&&e(12,v=r.pathname.startsWith(y)),n.$$.dirty&16385&&e(13,x=y===r.pathname),n.$$.dirty&8192&&e(2,i=x?"page":void 0),e(1,S=d({location:r,href:y,isPartiallyCurrent:v,isCurrent:x,existingProps:o}))},[y,S,i,g,b,M,o,u,h,f,d,p,v,x,r,a,c,l]}class Di extends $t{constructor(t){super(),zt(this,t,Eh,Th,Pt,{to:7,replace:8,state:9,getProps:10,preserveScroll:11})}}const Rh=n=>({params:n&4}),na=n=>({params:n[2]});function ia(n){let t,e,i,s;const o=[Ih,Lh],r=[];function a(l,c){return l[0]?0:1}return t=a(n),e=r[t]=o[t](n),{c(){e.c(),i=bt()},m(l,c){r[t].m(l,c),I(l,i,c),s=!0},p(l,c){let u=t;t=a(l),t===u?r[t].p(l,c):(Zt(),j(r[u],1,1,()=>{r[u]=null}),Jt(),e=r[t],e?e.p(l,c):(e=r[t]=o[t](l),e.c()),$(e,1),e.m(i.parentNode,i))},i(l){s||($(e),s=!0)},o(l){j(e),s=!1},d(l){l&&L(i),r[t].d(l)}}}function Lh(n){let t;const e=n[8].default,i=Bs(e,n,n[7],na);return{c(){i&&i.c()},m(s,o){i&&i.m(s,o),t=!0},p(s,o){i&&i.p&&(!t||o&132)&&$s(i,e,s,s[7],t?zs(e,s[7],o,Rh):js(s[7]),na)},i(s){t||($(i,s),t=!0)},o(s){j(i,s),t=!1},d(s){i&&i.d(s)}}}function Ih(n){let t,e,i,s={ctx:n,current:null,token:null,hasCatch:!1,pending:zh,then:Bh,catch:Fh,value:12,blocks:[,,,]};return Sn(e=n[0],s),{c(){t=bt(),s.block.c()},m(o,r){I(o,t,r),s.block.m(o,s.anchor=r),s.mount=()=>t.parentNode,s.anchor=t,i=!0},p(o,r){n=o,s.ctx=n,r&1&&e!==(e=n[0])&&Sn(e,s)||Si(s,n,r)},i(o){i||($(s.block),i=!0)},o(o){for(let r=0;r<3;r+=1){const a=s.blocks[r];j(a)}i=!1},d(o){o&&L(t),s.block.d(o),s.token=null,s=null}}}function Fh(n){return{c:E,m:E,p:E,i:E,o:E,d:E}}function Bh(n){var a;let t,e,i;const s=[n[2],n[3]];var o=((a=n[12])==null?void 0:a.default)||n[12];function r(l,c){let u={};if(c!==void 0&&c&12)u=Co(s,[c&4&&Ai(l[2]),c&8&&Ai(l[3])]);else for(let h=0;h{st(h,1)}),Jt()}o?(t=Gr(o,r(l,c)),lt(t.$$.fragment),$(t.$$.fragment,1),it(t,e.parentNode,e)):t=null}else if(o){const h=c&12?Co(s,[c&4&&Ai(l[2]),c&8&&Ai(l[3])]):{};t.$set(h)}},i(l){i||(t&&$(t.$$.fragment,l),i=!0)},o(l){t&&j(t.$$.fragment,l),i=!1},d(l){l&&L(e),t&&st(t,l)}}}function zh(n){return{c:E,m:E,p:E,i:E,o:E,d:E}}function $h(n){let t,e,i=n[1]&&n[1].route===n[5]&&ia(n);return{c(){i&&i.c(),t=bt()},m(s,o){i&&i.m(s,o),I(s,t,o),e=!0},p(s,[o]){s[1]&&s[1].route===s[5]?i?(i.p(s,o),o&2&&$(i,1)):(i=ia(s),i.c(),$(i,1),i.m(t.parentNode,t)):i&&(Zt(),j(i,1,1,()=>{i=null}),Jt())},i(s){e||($(i),e=!0)},o(s){j(i),e=!1},d(s){s&&L(t),i&&i.d(s)}}}function jh(n,t,e){let i,{$$slots:s={},$$scope:o}=t,{path:r=""}=t,{component:a=null}=t,l={},c={};const{registerRoute:u,unregisterRoute:h,activeRoute:f}=yn(ys);Gt(n,f,p=>e(1,i=p));const d={path:r,default:r===""};return u(d),uh(()=>{h(d)}),n.$$set=p=>{e(11,t=Qe(Qe({},t),wo(p))),"path"in p&&e(6,r=p.path),"component"in p&&e(0,a=p.component),"$$scope"in p&&e(7,o=p.$$scope)},n.$$.update=()=>{if(i&&i.route===d){e(2,l=i.params);const{component:p,path:g,...b}=t;e(3,c=b),p&&(p.toString().startsWith("class ")?e(0,a=p):e(0,a=p())),vc()&&!i.preserveScroll&&(window==null||window.scrollTo(0,0))}},t=wo(t),[a,i,l,c,f,d,r,o,s]}class Ti extends $t{constructor(t){super(),zt(this,t,jh,$h,Pt,{path:6,component:0})}}const ln=[];function Nh(n,t){return{subscribe:Nn(n,t).subscribe}}function Nn(n,t=E){let e;const i=new Set;function s(a){if(Pt(n,a)&&(n=a,e)){const l=!ln.length;for(const c of i)c[1](),ln.push(c,n);if(l){for(let c=0;c{i.delete(c),i.size===0&&e&&(e(),e=null)}}return{set:s,update:o,subscribe:r}}function Vh(n,t,e){const i=!Array.isArray(n),s=i?[n]:n;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=t.length<2;return Nh(e,(r,a)=>{let l=!1;const c=[];let u=0,h=E;const f=()=>{if(u)return;h();const p=t(i?c[0]:c,r,a);o?r(p):h=ki(p)?p:E},d=s.map((p,g)=>oc(p,b=>{c[g]=b,u&=~(1<{u|=1<({...n.location,state:n.history.state,key:n.history.state&&n.history.state.key||"initial"}),Hh=n=>{const t=[];let e=Js(n);return{get location(){return e},listen(i){t.push(i);const s=()=>{e=Js(n),i({location:e,action:"POP"})};return n.addEventListener("popstate",s),()=>{n.removeEventListener("popstate",s);const o=t.indexOf(i);t.splice(o,1)}},navigate(i,{state:s,replace:o=!1,preserveScroll:r=!1}={}){s={...s,key:Date.now()+""};try{o?n.history.replaceState(s,"",i):n.history.pushState(s,"",i)}catch{n.location[o?"replace":"assign"](i)}e=Js(n),t.forEach(a=>a({location:e,action:"PUSH",preserveScroll:r})),document.activeElement.blur()}}},Wh=(n="/")=>{let t=0;const e=[{pathname:n,search:""}],i=[];return{get location(){return e[t]},addEventListener(s,o){},removeEventListener(s,o){},history:{get entries(){return e},get index(){return t},get state(){return i[t]},pushState(s,o,r){const[a,l=""]=r.split("?");t++,e.push({pathname:a,search:l}),i.push(s)},replaceState(s,o,r){const[a,l=""]=r.split("?");e[t]={pathname:a,search:l},i[t]=s}}}},wc=Hh(vc()?window:Wh()),{navigate:Kh}=wc,qh=n=>({route:n&4,location:n&2}),sa=n=>({route:n[2]&&n[2].uri,location:n[1]}),Uh=n=>({route:n&4,location:n&2}),oa=n=>({route:n[2]&&n[2].uri,location:n[1]});function Yh(n){let t;const e=n[15].default,i=Bs(e,n,n[14],sa);return{c(){i&&i.c()},m(s,o){i&&i.m(s,o),t=!0},p(s,o){i&&i.p&&(!t||o&16390)&&$s(i,e,s,s[14],t?zs(e,s[14],o,qh):js(s[14]),sa)},i(s){t||($(i,s),t=!0)},o(s){j(i,s),t=!1},d(s){i&&i.d(s)}}}function Xh(n){let t=n[1].pathname,e,i,s=ra(n);return{c(){s.c(),e=bt()},m(o,r){s.m(o,r),I(o,e,r),i=!0},p(o,r){r&2&&Pt(t,t=o[1].pathname)?(Zt(),j(s,1,1,E),Jt(),s=ra(o),s.c(),$(s,1),s.m(e.parentNode,e)):s.p(o,r)},i(o){i||($(s),i=!0)},o(o){j(s),i=!1},d(o){o&&L(e),s.d(o)}}}function ra(n){let t,e,i,s;const o=n[15].default,r=Bs(o,n,n[14],oa);return{c(){t=T("div"),r&&r.c()},m(a,l){I(a,t,l),r&&r.m(t,null),s=!0},p(a,l){r&&r.p&&(!s||l&16390)&&$s(r,o,a,a[14],s?zs(o,a[14],l,Uh):js(a[14]),oa)},i(a){s||($(r,a),a&&Ze(()=>{s&&(i&&i.end(1),e=mh(t,n[3],{}),e.start())}),s=!0)},o(a){j(r,a),e&&e.invalidate(),a&&(i=bh(t,n[3],{})),s=!1},d(a){a&&L(t),r&&r.d(a),a&&i&&i.end()}}}function Gh(n){let t,e,i,s;const o=[Xh,Yh],r=[];function a(l,c){return l[0]?0:1}return t=a(n),e=r[t]=o[t](n),{c(){e.c(),i=bt()},m(l,c){r[t].m(l,c),I(l,i,c),s=!0},p(l,[c]){let u=t;t=a(l),t===u?r[t].p(l,c):(Zt(),j(r[u],1,1,()=>{r[u]=null}),Jt(),e=r[t],e?e.p(l,c):(e=r[t]=o[t](l),e.c()),$(e,1),e.m(i.parentNode,i))},i(l){s||($(e),s=!0)},o(l){j(e),s=!1},d(l){l&&L(i),r[t].d(l)}}}function Qh(n,t,e){let i,s,o,r,{$$slots:a={},$$scope:l}=t,{basepath:c="/"}=t,{url:u=null}=t,{viewtransition:h=null}=t,{history:f=wc}=t;const d=(w,O,D)=>{const R=h(D);return typeof(R==null?void 0:R.fn)=="function"?R.fn(w,R):R};Xs(yc,f);const p=yn(Po),g=yn(ys),b=Nn([]);Gt(n,b,w=>e(12,s=w));const m=Nn(null);Gt(n,m,w=>e(2,r=w));let _=!1;const y=p||Nn(u?{pathname:u}:f.location);Gt(n,y,w=>e(1,i=w));const v=g?g.routerBase:Nn({path:c,uri:c});Gt(n,v,w=>e(13,o=w));const x=Vh([v,m],([w,O])=>{if(!O)return w;const{path:D}=w,{route:R,uri:N}=O;return{path:R.default?D:R.path.replace(/\*.*$/,""),uri:N}}),S=w=>{const{path:O}=o;let{path:D}=w;if(w._path=D,w.path=ta(O,D),typeof window>"u"){if(_)return;const R=Jr([w],i.pathname);R&&(m.set(R),_=!0)}else b.update(R=>[...R,w])},M=w=>{b.update(O=>O.filter(D=>D!==w))};let k=!1;return p||(gc(()=>f.listen(O=>{e(11,k=O.preserveScroll||!1),y.set(O.location)})),Xs(Po,y)),Xs(ys,{activeRoute:m,base:v,routerBase:x,registerRoute:S,unregisterRoute:M}),n.$$set=w=>{"basepath"in w&&e(8,c=w.basepath),"url"in w&&e(9,u=w.url),"viewtransition"in w&&e(0,h=w.viewtransition),"history"in w&&e(10,f=w.history),"$$scope"in w&&e(14,l=w.$$scope)},n.$$.update=()=>{if(n.$$.dirty&8192){const{path:w}=o;b.update(O=>O.map(D=>Object.assign(D,{path:ta(w,D._path)})))}if(n.$$.dirty&6146){const w=Jr(s,i.pathname);m.set({...w,preserveScroll:k})}},[h,i,r,d,b,m,y,v,c,u,f,k,s,o,l,a]}class Zh extends $t{constructor(t){super(),zt(this,t,Qh,Gh,Pt,{basepath:8,url:9,viewtransition:0,history:10})}}function Jh(n){let t,e;return{c(){t=pe("svg"),e=pe("path"),C(e,"stroke-linecap","round"),C(e,"stroke-linejoin","round"),C(e,"d","M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"),C(t,"xmlns","http://www.w3.org/2000/svg"),C(t,"fill","none"),C(t,"viewBox","0 0 24 24"),C(t,"stroke-width","1.5"),C(t,"class","w-8 h-8 stroke-green")},m(i,s){I(i,t,s),P(t,e)},p:E,d(i){i&&L(t)}}}function tf(n){let t,e;return{c(){t=pe("svg"),e=pe("path"),C(e,"stroke-linecap","round"),C(e,"stroke-linejoin","round"),C(e,"d","M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-3.375c0-.621-.503-1.125-1.125-1.125h-.871M7.5 18.75v-3.375c0-.621.504-1.125 1.125-1.125h.872m5.007 0H9.497m5.007 0a7.454 7.454 0 01-.982-3.172M9.497 14.25a7.454 7.454 0 00.981-3.172M5.25 4.236c-.982.143-1.954.317-2.916.52A6.003 6.003 0 007.73 9.728M5.25 4.236V4.5c0 2.108.966 3.99 2.48 5.228M5.25 4.236V2.721C7.456 2.41 9.71 2.25 12 2.25c2.291 0 4.545.16 6.75.47v1.516M7.73 9.728a6.726 6.726 0 002.748 1.35m8.272-6.842V4.5c0 2.108-.966 3.99-2.48 5.228m2.48-5.492a46.32 46.32 0 012.916.52 6.003 6.003 0 01-5.395 4.972m0 0a6.726 6.726 0 01-2.749 1.35m0 0a6.772 6.772 0 01-3.044 0"),C(t,"xmlns","http://www.w3.org/2000/svg"),C(t,"fill","none"),C(t,"viewBox","0 0 24 24"),C(t,"stroke-width","1.5"),C(t,"class","w-8 h-8 stroke-green")},m(i,s){I(i,t,s),P(t,e)},p:E,d(i){i&&L(t)}}}function ef(n){let t,e,i;return{c(){t=pe("svg"),e=pe("path"),i=pe("path"),C(e,"stroke-linecap","round"),C(e,"stroke-linejoin","round"),C(e,"d","M10.5 6a7.5 7.5 0 107.5 7.5h-7.5V6z"),C(i,"stroke-linecap","round"),C(i,"stroke-linejoin","round"),C(i,"d","M13.5 10.5H21A7.5 7.5 0 0013.5 3v7.5z"),C(t,"xmlns","http://www.w3.org/2000/svg"),C(t,"fill","none"),C(t,"viewBox","0 0 24 24"),C(t,"stroke-width","1.5"),C(t,"class","w-8 h-8 stroke-green")},m(s,o){I(s,t,o),P(t,e),P(t,i)},p:E,d(s){s&&L(t)}}}function nf(n){let t,e;return{c(){t=pe("svg"),e=pe("path"),C(e,"stroke-linecap","round"),C(e,"stroke-linejoin","round"),C(e,"d","M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"),C(t,"xmlns","http://www.w3.org/2000/svg"),C(t,"fill","none"),C(t,"viewBox","0 0 24 24"),C(t,"stroke-width","1.5"),C(t,"class","w-8 h-8 stroke-green")},m(i,s){I(i,t,s),P(t,e)},p:E,d(i){i&&L(t)}}}function sf(n){let t,e,i,s,o,r,a,l,c,u,h;return e=new Di({props:{class:"",to:"/",$$slots:{default:[Jh]},$$scope:{ctx:n}}}),s=new Di({props:{class:"",to:"/achievements",$$slots:{default:[tf]},$$scope:{ctx:n}}}),l=new Di({props:{class:"",to:"/stats",$$slots:{default:[ef]},$$scope:{ctx:n}}}),u=new Di({props:{class:"",to:"/profile",$$slots:{default:[nf]},$$scope:{ctx:n}}}),{c(){t=T("div"),lt(e.$$.fragment),i=V(),lt(s.$$.fragment),o=V(),r=T("a"),r.innerHTML='',a=V(),lt(l.$$.fragment),c=V(),lt(u.$$.fragment),C(r,"class","rounded-full bg-green"),C(r,"href","/#addGoal"),C(t,"class","bg-neutral-200 shadow-xl py-5 pb-8 bottom-0 fixed w-full max-w-lg mx-auto flex justify-around")},m(f,d){I(f,t,d),it(e,t,null),P(t,i),it(s,t,null),P(t,o),P(t,r),P(t,a),it(l,t,null),P(t,c),it(u,t,null),h=!0},p(f,[d]){const p={};d&1&&(p.$$scope={dirty:d,ctx:f}),e.$set(p);const g={};d&1&&(g.$$scope={dirty:d,ctx:f}),s.$set(g);const b={};d&1&&(b.$$scope={dirty:d,ctx:f}),l.$set(b);const m={};d&1&&(m.$$scope={dirty:d,ctx:f}),u.$set(m)},i(f){h||($(e.$$.fragment,f),$(s.$$.fragment,f),$(l.$$.fragment,f),$(u.$$.fragment,f),h=!0)},o(f){j(e.$$.fragment,f),j(s.$$.fragment,f),j(l.$$.fragment,f),j(u.$$.fragment,f),h=!1},d(f){f&&L(t),st(e),st(s),st(l),st(u)}}}class Ns extends $t{constructor(t){super(),zt(this,t,null,sf,Pt,{})}}const _t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,mt=Object.keys,vt=Array.isArray;function Ft(n,t){return typeof t!="object"||mt(t).forEach(function(e){n[e]=t[e]}),n}typeof Promise>"u"||_t.Promise||(_t.Promise=Promise);const Mn=Object.getPrototypeOf,of={}.hasOwnProperty;function Et(n,t){return of.call(n,t)}function Cn(n,t){typeof t=="function"&&(t=t(Mn(n))),(typeof Reflect>"u"?mt:Reflect.ownKeys)(t).forEach(e=>{ge(n,e,t[e])})}const kc=Object.defineProperty;function ge(n,t,e,i){kc(n,t,Ft(e&&Et(e,"get")&&typeof e.get=="function"?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},i))}function vn(n){return{from:function(t){return n.prototype=Object.create(t.prototype),ge(n.prototype,"constructor",n),{extend:Cn.bind(null,n.prototype)}}}}const rf=Object.getOwnPropertyDescriptor;function gr(n,t){let e;return rf(n,t)||(e=Mn(n))&&gr(e,t)}const af=[].slice;function xs(n,t,e){return af.call(n,t,e)}function Sc(n,t){return t(n)}function Vn(n){if(!n)throw new Error("Assertion Failed")}function Mc(n){_t.setImmediate?setImmediate(n):setTimeout(n,0)}function me(n,t){if(Et(n,t))return n[t];if(!t)return n;if(typeof t!="string"){for(var e=[],i=0,s=t.length;i["Int","Uint","Float"].map(t=>t+n+"Array")))).filter(n=>_t[n]),Oc=new Set(cf.map(n=>_t[n]));function Ac(n){const t={};for(const e in n)if(Et(n,e)){const i=n[e];t[e]=!i||typeof i!="object"||Oc.has(i.constructor)?i:Ac(i)}return t}let Qn=null;function De(n){Qn=new WeakMap;const t=Oo(n);return Qn=null,t}function Oo(n){if(!n||typeof n!="object")return n;let t=Qn.get(n);if(t)return t;if(vt(n)){t=[],Qn.set(n,t);for(var e=0,i=n.length;e=0&&n.splice(e,1),e>=0}const gn={};function le(n){var t,e,i,s;if(arguments.length===1){if(vt(n))return n.slice();if(this===gn&&typeof n=="string")return[n];if(s=hf(n)){for(e=[];!(i=s.next()).done;)e.push(i.value);return e}if(n==null)return[n];if(typeof(t=n.length)=="number"){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}const mr=typeof Symbol<"u"?n=>n[Symbol.toStringTag]==="AsyncFunction":()=>!1;var ye=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Dc(n,t){ye=n,Tc=t}var Tc=()=>!0;const ff=!new Error("").stack;function on(){if(ff)try{throw on.arguments,new Error}catch(n){return n}return new Error}function To(n,t){var e=n.stack;return e?(t=t||0,e.indexOf(n.name)===0&&(t+=(n.name+n.message).split(` -`).length),e.split(` -`).slice(t).filter(Tc).map(i=>` -`+i).join("")):""}var Ec=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],br=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Ec),df={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 wn(n,t){this._e=on(),this.name=n,this.message=t}function Rc(n,t){return n+". Errors: "+Object.keys(t).map(e=>t[e].toString()).filter((e,i,s)=>s.indexOf(e)===i).join(` -`)}function vs(n,t,e,i){this._e=on(),this.failures=t,this.failedKeys=i,this.successCount=e,this.message=Rc(n,t)}function mn(n,t){this._e=on(),this.name="BulkError",this.failures=Object.keys(t).map(e=>t[e]),this.failuresByPos=t,this.message=Rc(n,this.failures)}vn(wn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+To(this._e,2))}},toString:function(){return this.name+": "+this.message}}),vn(vs).from(wn),vn(mn).from(wn);var _r=br.reduce((n,t)=>(n[t]=t+"Error",n),{});const pf=wn;var z=br.reduce((n,t)=>{var e=t+"Error";function i(s,o){this._e=on(),this.name=e,s?typeof s=="string"?(this.message=`${s}${o?` - `+o:""}`,this.inner=o||null):typeof s=="object"&&(this.message=`${s.name} ${s.message}`,this.inner=s):(this.message=df[t]||e,this.inner=null)}return vn(i).from(pf),n[t]=i,n},{});z.Syntax=SyntaxError,z.Type=TypeError,z.Range=RangeError;var aa=Ec.reduce((n,t)=>(n[t+"Error"]=z[t],n),{}),ts=br.reduce((n,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=z[t]),n),{});function J(){}function ci(n){return n}function gf(n,t){return n==null||n===ci?t:function(e){return t(n(e))}}function Je(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function mf(n,t){return n===J?t:function(){var e=n.apply(this,arguments);e!==void 0&&(arguments[0]=e);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?Je(i,this.onsuccess):i),s&&(this.onerror=this.onerror?Je(s,this.onerror):s),o!==void 0?o:e}}function bf(n,t){return n===J?t:function(){n.apply(this,arguments);var e=this.onsuccess,i=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?Je(e,this.onsuccess):e),i&&(this.onerror=this.onerror?Je(i,this.onerror):i)}}function _f(n,t){return n===J?t:function(e){var i=n.apply(this,arguments);Ft(e,i);var s=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var r=t.apply(this,arguments);return s&&(this.onsuccess=this.onsuccess?Je(s,this.onsuccess):s),o&&(this.onerror=this.onerror?Je(o,this.onerror):o),i===void 0?r===void 0?void 0:r:Ft(i,r)}}function yf(n,t){return n===J?t:function(){return t.apply(this,arguments)!==!1&&n.apply(this,arguments)}}function yr(n,t){return n===J?t:function(){var e=n.apply(this,arguments);if(e&&typeof e.then=="function"){for(var i=this,s=arguments.length,o=new Array(s);s--;)o[s]=arguments[s];return e.then(function(){return t.apply(i,o)})}return t.apply(this,arguments)}}ts.ModifyError=vs,ts.DexieError=wn,ts.BulkError=mn;var ui={};const[la,ws,xf]=typeof Promise>"u"?[]:(()=>{let n=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[n,Mn(n),n];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Mn(t),n]})(),vf=ws&&ws.then,es=la&&la.constructor,xr=!!xf;var Eo=!1,Zn=function(n,t){Wn.push([n,t]),ks&&(queueMicrotask(kf),ks=!1)},Ro=!0,ks=!0,qe=[],ns=[],Lo=null,Io=ci,Oe={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:J,pgp:!1,env:{},finalize:J},B=Oe,Wn=[],Ue=0,is=[];function F(n){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=B;if(ye&&(this._stackHolder=on(),this._prev=null,this._numPrev=0),typeof n!="function"){if(n!==ui)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Bo(this,this._value))}this._state=null,this._value=null,++t.ref,Ic(this,n)}const Fo={get:function(){var n=B,t=Ss;function e(i,s){var o=!n.global&&(n!==B||t!==Ss);const r=o&&!Ee();var a=new F((l,c)=>{vr(this,new Lc(Ms(i,n,o,r),Ms(s,n,o,r),l,c,n))});return ye&&zc(a,this),a}return e.prototype=ui,e},set:function(n){ge(this,"then",n&&n.prototype===ui?Fo:{get:function(){return n},set:Fo.set})}};function Lc(n,t,e,i,s){this.onFulfilled=typeof n=="function"?n:null,this.onRejected=typeof t=="function"?t:null,this.resolve=e,this.reject=i,this.psd=s}function Ic(n,t){try{t(e=>{if(n._state===null){if(e===n)throw new TypeError("A promise cannot be resolved with itself.");var i=n._lib&&Tn();e&&typeof e.then=="function"?Ic(n,(s,o)=>{e instanceof F?e._then(s,o):e.then(s,o)}):(n._state=!0,n._value=e,Fc(n)),i&&En()}},Bo.bind(null,n))}catch(e){Bo(n,e)}}function Bo(n,t){if(ns.push(t),n._state===null){var e=n._lib&&Tn();t=Io(t),n._state=!1,n._value=t,ye&&t!==null&&typeof t=="object"&&!t._promise&&function(i,s,o){try{i.apply(null,o)}catch(r){s&&s(r)}}(()=>{var i=gr(t,"stack");t._promise=n,ge(t,"stack",{get:()=>Eo?i&&(i.get?i.get.apply(t):i.value):n.stack})}),function(i){qe.some(s=>s._value===i._value)||qe.push(i)}(n),Fc(n),e&&En()}}function Fc(n){var t=n._listeners;n._listeners=[];for(var e=0,i=t.length;e{--Ue==0&&wr()},[]))}function vr(n,t){if(n._state!==null){var e=n._state?t.onFulfilled:t.onRejected;if(e===null)return(n._state?t.resolve:t.reject)(n._value);++t.psd.ref,++Ue,Zn(wf,[e,n,t])}else n._listeners.push(t)}function wf(n,t,e){try{Lo=t;var i,s=t._value;t._state?i=n(s):(ns.length&&(ns=[]),i=n(s),ns.indexOf(s)===-1&&function(o){for(var r=qe.length;r;)if(qe[--r]._value===o._value)return void qe.splice(r,1)}(t)),e.resolve(i)}catch(o){e.reject(o)}finally{Lo=null,--Ue==0&&wr(),--e.psd.ref||e.psd.finalize()}}function Bc(n,t,e){if(t.length===e)return t;var i="";if(n._state===!1){var s,o,r=n._value;r!=null?(s=r.name||"Error",o=r.message||r,i=To(r,0)):(s=r,o=""),t.push(s+(o?": "+o:"")+i)}return ye&&((i=To(n._stackHolder,2))&&t.indexOf(i)===-1&&t.push(i),n._prev&&Bc(n._prev,t,e)),t}function zc(n,t){var e=t?t._numPrev+1:0;e<100&&(n._prev=t,n._numPrev=e)}function kf(){tn(Oe,()=>{Tn()&&En()})}function Tn(){var n=Ro;return Ro=!1,ks=!1,n}function En(){var n,t,e;do for(;Wn.length>0;)for(n=Wn,Wn=[],e=n.length,t=0;t0);Ro=!0,ks=!0}function wr(){var n=qe;qe=[],n.forEach(i=>{i._PSD.onunhandled.call(null,i._value,i)});for(var t=is.slice(0),e=t.length;e;)t[--e]()}function Ei(n){return new F(ui,!1,n)}function at(n,t){var e=B;return function(){var i=Tn(),s=B;try{return Re(e,!0),n.apply(this,arguments)}catch(o){t&&t(o)}finally{Re(s,!1),i&&En()}}}Cn(F.prototype,{then:Fo,_then:function(n,t){vr(this,new Lc(null,null,n,t,B))},catch:function(n){if(arguments.length===1)return this.then(null,n);var t=arguments[0],e=arguments[1];return typeof t=="function"?this.then(null,i=>i instanceof t?e(i):Ei(i)):this.then(null,i=>i&&i.name===t?e(i):Ei(i))},finally:function(n){return this.then(t=>(n(),t),t=>(n(),Ei(t)))},stack:{get:function(){if(this._stack)return this._stack;try{Eo=!0;var n=Bc(this,[],20).join(` -From previous: `);return this._state!==null&&(this._stack=n),n}finally{Eo=!1}}},timeout:function(n,t){return n<1/0?new F((e,i)=>{var s=setTimeout(()=>i(new z.Timeout(t)),n);this.then(e,i).finally(clearTimeout.bind(null,s))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&ge(F.prototype,Symbol.toStringTag,"Dexie.Promise"),Oe.env=$c(),Cn(F,{all:function(){var n=le.apply(null,arguments).map(Ri);return new F(function(t,e){n.length===0&&t([]);var i=n.length;n.forEach((s,o)=>F.resolve(s).then(r=>{n[o]=r,--i||t(n)},e))})},resolve:n=>{if(n instanceof F)return n;if(n&&typeof n.then=="function")return new F((e,i)=>{n.then(e,i)});var t=new F(ui,!0,n);return zc(t,Lo),t},reject:Ei,race:function(){var n=le.apply(null,arguments).map(Ri);return new F((t,e)=>{n.map(i=>F.resolve(i).then(t,e))})},PSD:{get:()=>B,set:n=>B=n},totalEchoes:{get:()=>Ss},newPSD:Te,usePSD:tn,scheduler:{get:()=>Zn,set:n=>{Zn=n}},rejectionMapper:{get:()=>Io,set:n=>{Io=n}},follow:(n,t)=>new F((e,i)=>Te((s,o)=>{var r=B;r.unhandleds=[],r.onunhandled=o,r.finalize=Je(function(){(function(a){function l(){a(),is.splice(is.indexOf(l),1)}is.push(l),++Ue,Zn(()=>{--Ue==0&&wr()},[])})(()=>{this.unhandleds.length===0?s():o(this.unhandleds[0])})},r.finalize),n()},t,e,i))}),es&&(es.allSettled&&ge(F,"allSettled",function(){const n=le.apply(null,arguments).map(Ri);return new F(t=>{n.length===0&&t([]);let e=n.length;const i=new Array(e);n.forEach((s,o)=>F.resolve(s).then(r=>i[o]={status:"fulfilled",value:r},r=>i[o]={status:"rejected",reason:r}).then(()=>--e||t(i)))})}),es.any&&typeof AggregateError<"u"&&ge(F,"any",function(){const n=le.apply(null,arguments).map(Ri);return new F((t,e)=>{n.length===0&&e(new AggregateError([]));let i=n.length;const s=new Array(i);n.forEach((o,r)=>F.resolve(o).then(a=>t(a),a=>{s[r]=a,--i||e(new AggregateError(s))}))})}));const xt={awaits:0,echoes:0,id:0};var Sf=0,ss=[],to=0,Ss=0,Mf=0;function Te(n,t,e,i){var s=B,o=Object.create(s);o.parent=s,o.ref=0,o.global=!1,o.id=++Mf;var r=Oe.env;o.env=xr?{Promise:F,PromiseProp:{value:F,configurable:!0,writable:!0},all:F.all,race:F.race,allSettled:F.allSettled,any:F.any,resolve:F.resolve,reject:F.reject,nthen:ca(r.nthen,o),gthen:ca(r.gthen,o)}:{},t&&Ft(o,t),++s.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=tn(o,n,e,i);return o.ref===0&&o.finalize(),a}function Rn(){return xt.id||(xt.id=++Sf),++xt.awaits,xt.echoes+=100,xt.id}function Ee(){return!!xt.awaits&&(--xt.awaits==0&&(xt.id=0),xt.echoes=100*xt.awaits,!0)}function Ri(n){return xt.echoes&&n&&n.constructor===es?(Rn(),n.then(t=>(Ee(),t),t=>(Ee(),dt(t)))):n}function Cf(n){++Ss,xt.echoes&&--xt.echoes!=0||(xt.echoes=xt.id=0),ss.push(B),Re(n,!0)}function Pf(){var n=ss[ss.length-1];ss.pop(),Re(n,!1)}function Re(n,t){var e=B;if((t?!xt.echoes||to++&&n===B:!to||--to&&n===B)||queueMicrotask(t?Cf.bind(null,n):Pf),n!==B&&(B=n,e===Oe&&(Oe.env=$c()),xr)){var i=Oe.env.Promise,s=n.env;ws.then=s.nthen,i.prototype.then=s.gthen,(e.global||n.global)&&(Object.defineProperty(_t,"Promise",s.PromiseProp),i.all=s.all,i.race=s.race,i.resolve=s.resolve,i.reject=s.reject,s.allSettled&&(i.allSettled=s.allSettled),s.any&&(i.any=s.any))}}function $c(){var n=_t.Promise;return xr?{Promise:n,PromiseProp:Object.getOwnPropertyDescriptor(_t,"Promise"),all:n.all,race:n.race,allSettled:n.allSettled,any:n.any,resolve:n.resolve,reject:n.reject,nthen:ws.then,gthen:n.prototype.then}:{}}function tn(n,t,e,i,s){var o=B;try{return Re(n,!0),t(e,i,s)}finally{Re(o,!1)}}function Ms(n,t,e,i){return typeof n!="function"?n:function(){var s=B;e&&Rn(),Re(t,!0);try{return n.apply(this,arguments)}finally{Re(s,!1),i&&queueMicrotask(Ee)}}}function ca(n,t){return function(e,i){return n.call(this,Ms(e,t),Ms(i,t))}}(""+vf).indexOf("[native code]")===-1&&(Rn=Ee=J);var dt=F.reject;function zo(n,t,e,i){if(n.idbdb&&(n._state.openComplete||B.letThrough||n._vip)){var s=n._createTransaction(t,e,n._dbSchema);try{s.create(),n._state.PR1398_maxLoop=3}catch(o){return o.name===_r.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>zo(n,t,e,i))):dt(o)}return s._promise(t,(o,r)=>Te(()=>(B.trans=s,i(o,r,s)))).then(o=>{if(t==="readwrite")try{s.idbtrans.commit()}catch{}return t==="readonly"?o:s._completion.then(()=>o)})}if(n._state.openComplete)return dt(new z.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return dt(new z.DatabaseClosed);n.open().catch(J)}return n._state.dbReadyPromise.then(()=>zo(n,t,e,i))}const We=String.fromCharCode(65535),ne="Invalid key provided. Keys must be of type string, number, Date or Array.",Jn=[],Vs=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Of=Vs,Af=Vs,jc=n=>!/(dexie\.js|dexie\.min\.js)/.test(n);function en(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}const Nc={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Li(n){return typeof n!="string"||/\./.test(n)?t=>t:t=>(t[n]===void 0&&n in t&&delete(t=De(t))[n],t)}function Df(){throw z.Type()}function Q(n,t){try{const e=ua(n),i=ua(t);if(e!==i)return e==="Array"?1:i==="Array"?-1:e==="binary"?1:i==="binary"?-1:e==="string"?1:i==="string"?-1:e==="Date"?1:i!=="Date"?NaN:-1;switch(e){case"number":case"Date":case"string":return n>t?1:ns._promise(t,r,i),{trans:s,transless:B.transless||B}):zo(this.db,t,[this.name],r)}finally{a&&En()}}get(t,e){return t&&t.constructor===Object?this.where(t).first(e):this._trans("readonly",i=>this.core.get({trans:i,key:t}).then(s=>this.hook.reading.fire(s))).then(e)}where(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(vt(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const e=mt(t);if(e.length===1)return this.where(e[0]).equals(t[e[0]]);const i=this.schema.indexes.concat(this.schema.primKey).filter(c=>{if(c.compound&&e.every(u=>c.keyPath.indexOf(u)>=0)){for(let u=0;uc.keyPath.length-u.keyPath.length)[0];if(i&&this.db._maxKey!==We){const c=i.keyPath.slice(0,e.length);return this.where(c).equals(c.map(u=>t[u]))}!i&&ye&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${e.join("+")}]`);const{idxByName:s}=this.schema,o=this.db._deps.indexedDB;function r(c,u){return o.cmp(c,u)===0}const[a,l]=e.reduce(([c,u],h)=>{const f=s[h],d=t[h];return[c||f,c||!f?en(u,f&&f.multi?p=>{const g=me(p,h);return vt(g)&&g.some(b=>r(d,b))}:p=>r(d,me(p,h))):u]},[null,null]);return a?this.where(a.name).equals(t[a.keyPath]).filter(l):i?this.filter(l):this.where(e).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,vt(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){const{db:e,name:i}=this;this.schema.mappedClass=t,t.prototype instanceof Df&&(t=class extends t{get db(){return e}table(){return i}});const s=new Set;for(let r=t.prototype;r;r=Mn(r))Object.getOwnPropertyNames(r).forEach(a=>s.add(a));const o=r=>{if(!r)return r;const a=Object.create(t.prototype);for(let l in r)if(!s.has(l))try{a[l]=r[l]}catch{}return a};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=o,this.hook("reading",o),t}defineClass(){return this.mapToClass(function(t){Ft(this,t)})}add(t,e){const{auto:i,keyPath:s}=this.schema.primKey;let o=t;return s&&i&&(o=Li(s)(t)),this._trans("readwrite",r=>this.core.mutate({trans:r,type:"add",keys:e!=null?[e]:null,values:[o]})).then(r=>r.numFailures?F.reject(r.failures[0]):r.lastResult).then(r=>{if(s)try{Vt(t,s,r)}catch{}return r})}update(t,e){if(typeof t!="object"||vt(t))return this.where(":id").equals(t).modify(e);{const i=me(t,this.schema.primKey.keyPath);return i===void 0?dt(new z.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(i).modify(e)}}put(t,e){const{auto:i,keyPath:s}=this.schema.primKey;let o=t;return s&&i&&(o=Li(s)(t)),this._trans("readwrite",r=>this.core.mutate({trans:r,type:"put",values:[o],keys:e!=null?[e]:null})).then(r=>r.numFailures?F.reject(r.failures[0]):r.lastResult).then(r=>{if(s)try{Vt(t,s,r)}catch{}return r})}delete(t){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"delete",keys:[t]})).then(e=>e.numFailures?F.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"deleteRange",range:Nc})).then(t=>t.numFailures?F.reject(t.failures[0]):void 0)}bulkGet(t){return this._trans("readonly",e=>this.core.getMany({keys:t,trans:e}).then(i=>i.map(s=>this.hook.reading.fire(s))))}bulkAdd(t,e,i){const s=Array.isArray(e)?e:void 0,o=(i=i||(s?void 0:e))?i.allKeys:void 0;return this._trans("readwrite",r=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&s)throw new z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(s&&s.length!==t.length)throw new z.InvalidArgument("Arguments objects and keys must have the same length");const c=t.length;let u=l&&a?t.map(Li(l)):t;return this.core.mutate({trans:r,type:"add",keys:s,values:u,wantResults:o}).then(({numFailures:h,results:f,lastResult:d,failures:p})=>{if(h===0)return o?f:d;throw new mn(`${this.name}.bulkAdd(): ${h} of ${c} operations failed`,p)})})}bulkPut(t,e,i){const s=Array.isArray(e)?e:void 0,o=(i=i||(s?void 0:e))?i.allKeys:void 0;return this._trans("readwrite",r=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&s)throw new z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(s&&s.length!==t.length)throw new z.InvalidArgument("Arguments objects and keys must have the same length");const c=t.length;let u=l&&a?t.map(Li(l)):t;return this.core.mutate({trans:r,type:"put",keys:s,values:u,wantResults:o}).then(({numFailures:h,results:f,lastResult:d,failures:p})=>{if(h===0)return o?f:d;throw new mn(`${this.name}.bulkPut(): ${h} of ${c} operations failed`,p)})})}bulkUpdate(t){const e=this.core,i=t.map(r=>r.key),s=t.map(r=>r.changes),o=[];return this._trans("readwrite",r=>e.getMany({trans:r,keys:i,cache:"clone"}).then(a=>{const l=[],c=[];t.forEach(({key:h,changes:f},d)=>{const p=a[d];if(p){for(const g of Object.keys(f)){const b=f[g];if(g===this.schema.primKey.keyPath){if(Q(b,h)!==0)throw new z.Constraint("Cannot update primary key in bulkUpdate()")}else Vt(p,g,b)}o.push(d),l.push(h),c.push(p)}});const u=l.length;return e.mutate({trans:r,type:"put",keys:l,values:c,updates:{keys:i,changeSpecs:s}}).then(({numFailures:h,failures:f})=>{if(h===0)return u;for(const d of Object.keys(f)){const p=o[Number(d)];if(p!=null){const g=f[d];delete f[d],f[p]=g}}throw new mn(`${this.name}.bulkUpdate(): ${h} of ${u} operations failed`,f)})}))}bulkDelete(t){const e=t.length;return this._trans("readwrite",i=>this.core.mutate({trans:i,type:"delete",keys:t})).then(({numFailures:i,lastResult:s,failures:o})=>{if(i===0)return s;throw new mn(`${this.name}.bulkDelete(): ${i} of ${e} operations failed`,o)})}}function ti(n){var t={},e=function(a,l){if(l){for(var c=arguments.length,u=new Array(c-1);--c;)u[c-1]=arguments[c];return t[a].subscribe.apply(null,u),n}if(typeof a=="string")return t[a]};e.addEventType=o;for(var i=1,s=arguments.length;ien(i(),t()):t,n.justLimit=e&&!i}function os(n,t){if(n.isPrimKey)return t.primaryKey;const e=t.getIndexByKeyPath(n.index);if(!e)throw new z.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return e}function da(n,t,e){const i=os(n,t.schema);return t.openCursor({trans:e,values:!n.keysOnly,reverse:n.dir==="prev",unique:!!n.unique,query:{index:i,range:n.range}})}function Ii(n,t,e,i){const s=n.replayFilter?en(n.filter,n.replayFilter()):n.filter;if(n.or){const o={},r=(a,l,c)=>{if(!s||s(l,c,f=>l.stop(f),f=>l.fail(f))){var u=l.primaryKey,h=""+u;h==="[object ArrayBuffer]"&&(h=""+new Uint8Array(u)),Et(o,h)||(o[h]=!0,t(a,l,c))}};return Promise.all([n.or._iterate(r,e),pa(da(n,i,e),n.algorithm,r,!n.keysOnly&&n.valueMapper)])}return pa(da(n,i,e),en(n.algorithm,s),t,!n.keysOnly&&n.valueMapper)}function pa(n,t,e,i){var s=at(i?(o,r,a)=>e(i(o),r,a):e);return n.then(o=>{if(o)return o.start(()=>{var r=()=>o.continue();t&&!t(o,a=>r=a,a=>{o.stop(a),r=J},a=>{o.fail(a),r=J})||s(o.value,o,a=>r=a),r()})})}class Tf{_read(t,e){var i=this._ctx;return i.error?i.table._trans(null,dt.bind(null,i.error)):i.table._trans("readonly",t).then(e)}_write(t){var e=this._ctx;return e.error?e.table._trans(null,dt.bind(null,e.error)):e.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var e=this._ctx;e.algorithm=en(e.algorithm,t)}_iterate(t,e){return Ii(this._ctx,t,e,this._ctx.table.core)}clone(t){var e=Object.create(this.constructor.prototype),i=Object.create(this._ctx);return t&&Ft(i,t),e._ctx=i,e}raw(){return this._ctx.valueMapper=null,this}each(t){var e=this._ctx;return this._read(i=>Ii(e,t,i,e.table.core))}count(t){return this._read(e=>{const i=this._ctx,s=i.table.core;if(cn(i,!0))return s.count({trans:e,query:{index:os(i,s.schema),range:i.range}}).then(r=>Math.min(r,i.limit));var o=0;return Ii(i,()=>(++o,!1),e,s).then(()=>o)}).then(t)}sortBy(t,e){const i=t.split(".").reverse(),s=i[0],o=i.length-1;function r(c,u){return u?r(c[i[u]],u-1):c[s]}var a=this._ctx.dir==="next"?1:-1;function l(c,u){var h=r(c,o),f=r(u,o);return hf?a:0}return this.toArray(function(c){return c.sort(l)}).then(e)}toArray(t){return this._read(e=>{var i=this._ctx;if(i.dir==="next"&&cn(i,!0)&&i.limit>0){const{valueMapper:s}=i,o=os(i,i.table.core.schema);return i.table.core.query({trans:e,limit:i.limit,values:!0,query:{index:o,range:i.range}}).then(({result:r})=>s?r.map(s):r)}{const s=[];return Ii(i,o=>s.push(o),e,i.table.core).then(()=>s)}},t)}offset(t){var e=this._ctx;return t<=0||(e.offset+=t,cn(e)?no(e,()=>{var i=t;return(s,o)=>i===0||(i===1?(--i,!1):(o(()=>{s.advance(i),i=0}),!1))}):no(e,()=>{var i=t;return()=>--i<0})),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),no(this._ctx,()=>{var e=t;return function(i,s,o){return--e<=0&&s(o),e>=0}},!0),this}until(t,e){return eo(this._ctx,function(i,s,o){return!t(i.value)||(s(o),e)}),this}first(t){return this.limit(1).toArray(function(e){return e[0]}).then(t)}last(t){return this.reverse().first(t)}filter(t){var e,i;return eo(this._ctx,function(s){return t(s.value)}),e=this._ctx,i=t,e.isMatch=en(e.isMatch,i),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 e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(i,s){t(s.key,s)})}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(i,s){t(s.primaryKey,s)})}keys(t){var e=this._ctx;e.keysOnly=!e.isMatch;var i=[];return this.each(function(s,o){i.push(o.key)}).then(function(){return i}).then(t)}primaryKeys(t){var e=this._ctx;if(e.dir==="next"&&cn(e,!0)&&e.limit>0)return this._read(s=>{var o=os(e,e.table.core.schema);return e.table.core.query({trans:s,values:!1,limit:e.limit,query:{index:o,range:e.range}})}).then(({result:s})=>s).then(t);e.keysOnly=!e.isMatch;var i=[];return this.each(function(s,o){i.push(o.primaryKey)}).then(function(){return i}).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys(function(e){return e[0]}).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,e=t.index&&t.table.schema.idxByName[t.index];if(!e||!e.multi)return this;var i={};return eo(this._ctx,function(s){var o=s.primaryKey.toString(),r=Et(i,o);return i[o]=!0,!r}),this}modify(t){var e=this._ctx;return this._write(i=>{var s;if(typeof t=="function")s=t;else{var o=mt(t),r=o.length;s=function(g){for(var b=!1,m=0;m{const{failures:m,numFailures:_}=b;f+=g-_;for(let y of mt(m))h.push(m[y])};return this.clone().primaryKeys().then(g=>{const b=m=>{const _=Math.min(u,g.length-m);return a.getMany({trans:i,keys:g.slice(m,m+_),cache:"immutable"}).then(y=>{const v=[],x=[],S=l?[]:null,M=[];for(let w=0;w<_;++w){const O=y[w],D={value:De(O),primKey:g[m+w]};s.call(D,D.value,D)!==!1&&(D.value==null?M.push(g[m+w]):l||Q(c(O),c(D.value))===0?(x.push(D.value),l&&S.push(g[m+w])):(M.push(g[m+w]),v.push(D.value)))}const k=cn(e)&&e.limit===1/0&&(typeof t!="function"||t===io)&&{index:e.index,range:e.range};return Promise.resolve(v.length>0&&a.mutate({trans:i,type:"add",values:v}).then(w=>{for(let O in w.failures)M.splice(parseInt(O),1);p(v.length,w)})).then(()=>(x.length>0||k&&typeof t=="object")&&a.mutate({trans:i,type:"put",keys:S,values:x,criteria:k,changeSpec:typeof t!="function"&&t}).then(w=>p(x.length,w))).then(()=>(M.length>0||k&&t===io)&&a.mutate({trans:i,type:"delete",keys:M,criteria:k}).then(w=>p(M.length,w))).then(()=>g.length>m+_&&b(m+u))})};return b(0).then(()=>{if(h.length>0)throw new vs("Error modifying one or more objects",h,f,d);return g.length})})})}delete(){var t=this._ctx,e=t.range;return cn(t)&&(t.isPrimKey&&!Af||e.type===3)?this._write(i=>{const{primaryKey:s}=t.table.core.schema,o=e;return t.table.core.count({trans:i,query:{index:s,range:o}}).then(r=>t.table.core.mutate({trans:i,type:"deleteRange",range:o}).then(({failures:a,lastResult:l,results:c,numFailures:u})=>{if(u)throw new vs("Could not delete some values",Object.keys(a).map(h=>a[h]),r-u);return r-u}))}):this.modify(io)}}const io=(n,t)=>t.value=null;function Ef(n,t){return nt?-1:n===t?0:1}function Rt(n,t,e){var i=n instanceof Hc?new n.Collection(n):n;return i._ctx.error=e?new e(t):new TypeError(t),i}function un(n){return new n.Collection(n,()=>Vc("")).limit(0)}function Lf(n,t,e,i,s,o){for(var r=Math.min(n.length,i.length),a=-1,l=0;l=0?n.substr(0,a)+t[a]+e.substr(a+1):null;s(n[l],c)<0&&(a=l)}return rtypeof g=="string"))return Rt(n,"String expected.");function f(g){s=function(m){return m==="next"?_=>_.toUpperCase():_=>_.toLowerCase()}(g),o=function(m){return m==="next"?_=>_.toLowerCase():_=>_.toUpperCase()}(g),r=g==="next"?Ef:Rf;var b=e.map(function(m){return{lower:o(m),upper:s(m)}}).sort(function(m,_){return r(m.lower,_.lower)});a=b.map(function(m){return m.upper}),l=b.map(function(m){return m.lower}),c=g,u=g==="next"?"":i}f("next");var d=new n.Collection(n,()=>we(a[0],l[h-1]+i));d._ondirectionchange=function(g){f(g)};var p=0;return d._addAlgorithm(function(g,b,m){var _=g.key;if(typeof _!="string")return!1;var y=o(_);if(t(y,l,p))return!0;for(var v=null,x=p;x0)&&(v=S)}return b(v!==null?function(){g.continue(v+u)}:m),!1}),d}function we(n,t,e,i){return{type:2,lower:n,upper:t,lowerOpen:e,upperOpen:i}}function Vc(n){return{type:1,lower:n,upper:n}}class Hc{get Collection(){return this._ctx.table.db.Collection}between(t,e,i,s){i=i!==!1,s=s===!0;try{return this._cmp(t,e)>0||this._cmp(t,e)===0&&(i||s)&&(!i||!s)?un(this):new this.Collection(this,()=>we(t,e,!i,!s))}catch{return Rt(this,ne)}}equals(t){return t==null?Rt(this,ne):new this.Collection(this,()=>Vc(t))}above(t){return t==null?Rt(this,ne):new this.Collection(this,()=>we(t,void 0,!0))}aboveOrEqual(t){return t==null?Rt(this,ne):new this.Collection(this,()=>we(t,void 0,!1))}below(t){return t==null?Rt(this,ne):new this.Collection(this,()=>we(void 0,t,!1,!0))}belowOrEqual(t){return t==null?Rt(this,ne):new this.Collection(this,()=>we(void 0,t))}startsWith(t){return typeof t!="string"?Rt(this,"String expected."):this.between(t,t+We,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):Fi(this,(e,i)=>e.indexOf(i[0])===0,[t],We)}equalsIgnoreCase(t){return Fi(this,(e,i)=>e===i[0],[t],"")}anyOfIgnoreCase(){var t=le.apply(gn,arguments);return t.length===0?un(this):Fi(this,(e,i)=>i.indexOf(e)!==-1,t,"")}startsWithAnyOfIgnoreCase(){var t=le.apply(gn,arguments);return t.length===0?un(this):Fi(this,(e,i)=>i.some(s=>e.indexOf(s)===0),t,We)}anyOf(){const t=le.apply(gn,arguments);let e=this._cmp;try{t.sort(e)}catch{return Rt(this,ne)}if(t.length===0)return un(this);const i=new this.Collection(this,()=>we(t[0],t[t.length-1]));i._ondirectionchange=o=>{e=o==="next"?this._ascending:this._descending,t.sort(e)};let s=0;return i._addAlgorithm((o,r,a)=>{const l=o.key;for(;e(l,t[s])>0;)if(++s,s===t.length)return r(a),!1;return e(l,t[s])===0||(r(()=>{o.continue(t[s])}),!1)}),i}notEqual(t){return this.inAnyRange([[-(1/0),t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=le.apply(gn,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Rt(this,ne)}const e=t.reduce((i,s)=>i?i.concat([[i[i.length-1][1],s]]):[[-(1/0),s]],null);return e.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,e){const i=this._cmp,s=this._ascending,o=this._descending,r=this._min,a=this._max;if(t.length===0)return un(this);if(!t.every(_=>_[0]!==void 0&&_[1]!==void 0&&s(_[0],_[1])<=0))return Rt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",z.InvalidArgument);const l=!e||e.includeLowers!==!1,c=e&&e.includeUppers===!0;let u,h=s;function f(_,y){return h(_[0],y[0])}try{u=t.reduce(function(_,y){let v=0,x=_.length;for(;v0){S[0]=r(S[0],y[0]),S[1]=a(S[1],y[1]);break}}return v===x&&_.push(y),_},[]),u.sort(f)}catch{return Rt(this,ne)}let d=0;const p=c?_=>s(_,u[d][1])>0:_=>s(_,u[d][1])>=0,g=l?_=>o(_,u[d][0])>0:_=>o(_,u[d][0])>=0;let b=p;const m=new this.Collection(this,()=>we(u[0][0],u[u.length-1][1],!l,!c));return m._ondirectionchange=_=>{_==="next"?(b=p,h=s):(b=g,h=o),u.sort(f)},m._addAlgorithm((_,y,v)=>{for(var x=_.key;b(x);)if(++d,d===u.length)return y(v),!1;return!!function(S){return!p(S)&&!g(S)}(x)||(this._cmp(x,u[d][1])===0||this._cmp(x,u[d][0])===0||y(()=>{h===s?_.continue(u[d][0]):_.continue(u[d][1])}),!1)}),m}startsWithAnyOf(){const t=le.apply(gn,arguments);return t.every(e=>typeof e=="string")?t.length===0?un(this):this.inAnyRange(t.map(e=>[e,e+We])):Rt(this,"startsWithAnyOf() only works with strings")}}function Xt(n){return at(function(t){return hi(t),n(t.target.error),!1})}function hi(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}const _e=ti(null,"storagemutated");class If{_lock(){return Vn(!B.global),++this._reculock,this._reculock!==1||B.global||(B.lockOwnerFor=this),this}_unlock(){if(Vn(!B.global),--this._reculock==0)for(B.global||(B.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{tn(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&B.lockOwnerFor!==this}create(t){if(!this.mode)return this;const e=this.db.idbdb,i=this.db._state.dbOpenError;if(Vn(!this.idbtrans),!t&&!e)switch(i&&i.name){case"DatabaseClosedError":throw new z.DatabaseClosed(i);case"MissingAPIError":throw new z.MissingAPI(i.message,i);default:throw new z.OpenFailed(i)}if(!this.active)throw new z.TransactionInactive;return Vn(this._completion._state===null),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):e.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=at(s=>{hi(s),this._reject(t.error)}),t.onabort=at(s=>{hi(s),this.active&&this._reject(new z.Abort(t.error)),this.active=!1,this.on("abort").fire(s)}),t.oncomplete=at(()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&_e.storagemutated.fire(t.mutatedParts)}),this}_promise(t,e,i){if(t==="readwrite"&&this.mode!=="readwrite")return dt(new z.ReadOnly("Transaction is readonly"));if(!this.active)return dt(new z.TransactionInactive);if(this._locked())return new F((o,r)=>{this._blockedFuncs.push([()=>{this._promise(t,e,i).then(o,r)},B])});if(i)return Te(()=>{var o=new F((r,a)=>{this._lock();const l=e(r,a,this);l&&l.then&&l.then(r,a)});return o.finally(()=>this._unlock()),o._lib=!0,o});var s=new F((o,r)=>{var a=e(o,r,this);a&&a.then&&a.then(o,r)});return s._lib=!0,s}_root(){return this.parent?this.parent._root():this}waitFor(t){var e=this._root();const i=F.resolve(t);if(e._waitingFor)e._waitingFor=e._waitingFor.then(()=>i);else{e._waitingFor=i,e._waitingQueue=[];var s=e.idbtrans.objectStore(e.storeNames[0]);(function r(){for(++e._spinCount;e._waitingQueue.length;)e._waitingQueue.shift()();e._waitingFor&&(s.get(-1/0).onsuccess=r)})()}var o=e._waitingFor;return new F((r,a)=>{i.then(l=>e._waitingQueue.push(at(r.bind(null,l))),l=>e._waitingQueue.push(at(a.bind(null,l)))).finally(()=>{e._waitingFor===o&&(e._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new z.Abort))}table(t){const e=this._memoizedTables||(this._memoizedTables={});if(Et(e,t))return e[t];const i=this.schema[t];if(!i)throw new z.NotFound("Table "+t+" not part of transaction");const s=new this.db.Table(t,i,this);return s.core=this.db.core.table(t),e[t]=s,s}}function $o(n,t,e,i,s,o,r){return{name:n,keyPath:t,unique:e,multi:i,auto:s,compound:o,src:(e&&!r?"&":"")+(i?"*":"")+(s?"++":"")+Wc(t)}}function Wc(n){return typeof n=="string"?n:n?"["+[].join.call(n,"+")+"]":""}function Kc(n,t,e){return{name:n,primKey:t,indexes:e,mappedClass:null,idxByName:(i=e,s=o=>[o.name,o],i.reduce((o,r,a)=>{var l=s(r,a);return l&&(o[l[0]]=l[1]),o},{}))};var i,s}let fi=n=>{try{return n.only([[]]),fi=()=>[[]],[[]]}catch{return fi=()=>We,We}};function jo(n){return n==null?()=>{}:typeof n=="string"?function(t){return t.split(".").length===1?e=>e[t]:e=>me(e,t)}(n):t=>me(t,n)}function ga(n){return[].slice.call(n)}let Ff=0;function ei(n){return n==null?":id":typeof n=="string"?n:`[${n.join("+")}]`}function Bf(n,t,e){function i(l){if(l.type===3)return null;if(l.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:c,upper:u,lowerOpen:h,upperOpen:f}=l;return c===void 0?u===void 0?null:t.upperBound(u,!!f):u===void 0?t.lowerBound(c,!!h):t.bound(c,u,!!h,!!f)}const{schema:s,hasGetAll:o}=function(l,c){const u=ga(l.objectStoreNames);return{schema:{name:l.name,tables:u.map(h=>c.objectStore(h)).map(h=>{const{keyPath:f,autoIncrement:d}=h,p=vt(f),g=f==null,b={},m={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:g,compound:p,keyPath:f,autoIncrement:d,unique:!0,extractKey:jo(f)},indexes:ga(h.indexNames).map(_=>h.index(_)).map(_=>{const{name:y,unique:v,multiEntry:x,keyPath:S}=_,M={name:y,compound:vt(S),keyPath:S,unique:v,multiEntry:x,extractKey:jo(S)};return b[ei(S)]=M,M}),getIndexByKeyPath:_=>b[ei(_)]};return b[":id"]=m.primaryKey,f!=null&&(b[ei(f)]=m.primaryKey),m})},hasGetAll:u.length>0&&"getAll"in c.objectStore(u[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(n,e),r=s.tables.map(l=>function(c){const u=c.name;return{name:u,schema:c,mutate:function({trans:h,type:f,keys:d,values:p,range:g}){return new Promise((b,m)=>{b=at(b);const _=h.objectStore(u),y=_.keyPath==null,v=f==="put"||f==="add";if(!v&&f!=="delete"&&f!=="deleteRange")throw new Error("Invalid operation type: "+f);const{length:x}=d||p||{length:1};if(d&&p&&d.length!==p.length)throw new Error("Given keys array must have same length as given values array.");if(x===0)return b({numFailures:0,failures:{},results:[],lastResult:void 0});let S;const M=[],k=[];let w=0;const O=R=>{++w,hi(R)};if(f==="deleteRange"){if(g.type===4)return b({numFailures:w,failures:k,results:[],lastResult:void 0});g.type===3?M.push(S=_.clear()):M.push(S=_.delete(i(g)))}else{const[R,N]=v?y?[p,d]:[p,null]:[d,null];if(v)for(let W=0;W{const N=R.target.result;M.forEach((W,K)=>W.error!=null&&(k[K]=W.error)),b({numFailures:w,failures:k,results:f==="delete"?d:M.map(W=>W.result),lastResult:N})};S.onerror=R=>{O(R),D(R)},S.onsuccess=D})},getMany:({trans:h,keys:f})=>new Promise((d,p)=>{d=at(d);const g=h.objectStore(u),b=f.length,m=new Array(b);let _,y=0,v=0;const x=M=>{const k=M.target;m[k._pos]=k.result,++v===y&&d(m)},S=Xt(p);for(let M=0;Mnew Promise((d,p)=>{d=at(d);const g=h.objectStore(u).get(f);g.onsuccess=b=>d(b.target.result),g.onerror=Xt(p)}),query:function(h){return f=>new Promise((d,p)=>{d=at(d);const{trans:g,values:b,limit:m,query:_}=f,y=m===1/0?void 0:m,{index:v,range:x}=_,S=g.objectStore(u),M=v.isPrimaryKey?S:S.index(v.name),k=i(x);if(m===0)return d({result:[]});if(h){const w=b?M.getAll(k,y):M.getAllKeys(k,y);w.onsuccess=O=>d({result:O.target.result}),w.onerror=Xt(p)}else{let w=0;const O=b||!("openKeyCursor"in M)?M.openCursor(k):M.openKeyCursor(k),D=[];O.onsuccess=R=>{const N=O.result;return N?(D.push(b?N.value:N.primaryKey),++w===m?d({result:D}):void N.continue()):d({result:D})},O.onerror=Xt(p)}})}(o),openCursor:function({trans:h,values:f,query:d,reverse:p,unique:g}){return new Promise((b,m)=>{b=at(b);const{index:_,range:y}=d,v=h.objectStore(u),x=_.isPrimaryKey?v:v.index(_.name),S=p?g?"prevunique":"prev":g?"nextunique":"next",M=f||!("openKeyCursor"in x)?x.openCursor(i(y),S):x.openKeyCursor(i(y),S);M.onerror=Xt(m),M.onsuccess=at(k=>{const w=M.result;if(!w)return void b(null);w.___id=++Ff,w.done=!1;const O=w.continue.bind(w);let D=w.continuePrimaryKey;D&&(D=D.bind(w));const R=w.advance.bind(w),N=()=>{throw new Error("Cursor not stopped")};w.trans=h,w.stop=w.continue=w.continuePrimaryKey=w.advance=()=>{throw new Error("Cursor not started")},w.fail=at(m),w.next=function(){let W=1;return this.start(()=>W--?this.continue():this.stop()).then(()=>this)},w.start=W=>{const K=new Promise((U,G)=>{U=at(U),M.onerror=Xt(G),w.fail=G,w.stop=tt=>{w.stop=w.continue=w.continuePrimaryKey=w.advance=N,U(tt)}}),q=()=>{if(M.result)try{W()}catch(U){w.fail(U)}else w.done=!0,w.start=()=>{throw new Error("Cursor behind last entry")},w.stop()};return M.onsuccess=at(U=>{M.onsuccess=q,q()}),w.continue=O,w.continuePrimaryKey=D,w.advance=R,q(),K},b(w)},m)})},count({query:h,trans:f}){const{index:d,range:p}=h;return new Promise((g,b)=>{const m=f.objectStore(u),_=d.isPrimaryKey?m:m.index(d.name),y=i(p),v=y?_.count(y):_.count();v.onsuccess=at(x=>g(x.target.result)),v.onerror=Xt(b)})}}}(l)),a={};return r.forEach(l=>a[l.name]=l),{stack:"dbcore",transaction:n.transaction.bind(n),table(l){if(!a[l])throw new Error(`Table '${l}' not found`);return a[l]},MIN_KEY:-1/0,MAX_KEY:fi(t),schema:s}}function No(n,t){const e=t.db,i=function(s,o,{IDBKeyRange:r,indexedDB:a},l){return{dbcore:function(u,h){return h.reduce((f,{create:d})=>({...f,...d(f)}),u)}(Bf(o,r,l),s.dbcore)}}(n._middlewares,e,n._deps,t);n.core=i.dbcore,n.tables.forEach(s=>{const o=s.name;n.core.schema.tables.some(r=>r.name===o)&&(s.core=n.core.table(o),n[o]instanceof n.Table&&(n[o].core=s.core))})}function Cs(n,t,e,i){e.forEach(s=>{const o=i[s];t.forEach(r=>{const a=gr(r,s);(!a||"value"in a&&a.value===void 0)&&(r===n.Transaction.prototype||r instanceof n.Transaction?ge(r,s,{get(){return this.table(s)},set(l){kc(this,s,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):r[s]=new n.Table(s,o))})})}function Vo(n,t){t.forEach(e=>{for(let i in e)e[i]instanceof n.Table&&delete e[i]})}function zf(n,t){return n._cfg.version-t._cfg.version}function $f(n,t,e,i){const s=n._dbSchema,o=n._createTransaction("readwrite",n._storeNames,s);o.create(e),o._completion.catch(i);const r=o._reject.bind(o),a=B.transless||B;Te(()=>{B.trans=o,B.transless=a,t===0?(mt(s).forEach(l=>{so(e,l,s[l].primKey,s[l].indexes)}),No(n,e),F.follow(()=>n.on.populate.fire(o)).catch(r)):function(l,c,u,h){const f=[],d=l._versions;let p=l._dbSchema=Wo(l,l.idbdb,h),g=!1;function b(){return f.length?F.resolve(f.shift()(u.idbtrans)).then(b):F.resolve()}return d.filter(m=>m._cfg.version>=c).forEach(m=>{f.push(()=>{const _=p,y=m._cfg.dbschema;Ko(l,_,h),Ko(l,y,h),p=l._dbSchema=y;const v=qc(_,y);v.add.forEach(S=>{so(h,S[0],S[1].primKey,S[1].indexes)}),v.change.forEach(S=>{if(S.recreate)throw new z.Upgrade("Not yet support for changing primary key");{const M=h.objectStore(S.name);S.add.forEach(k=>Ho(M,k)),S.change.forEach(k=>{M.deleteIndex(k.name),Ho(M,k)}),S.del.forEach(k=>M.deleteIndex(k))}});const x=m._cfg.contentUpgrade;if(x&&m._cfg.version>c){No(l,h),u._memoizedTables={},g=!0;let S=Cc(y);v.del.forEach(O=>{S[O]=_[O]}),Vo(l,[l.Transaction.prototype]),Cs(l,[l.Transaction.prototype],mt(S),S),u.schema=S;const M=mr(x);let k;M&&Rn();const w=F.follow(()=>{if(k=x(u),k&&M){var O=Ee.bind(null,null);k.then(O,O)}});return k&&typeof k.then=="function"?F.resolve(k):w.then(()=>k)}}),f.push(_=>{(!g||!Of)&&function(y,v){[].slice.call(v.db.objectStoreNames).forEach(x=>y[x]==null&&v.db.deleteObjectStore(x))}(m._cfg.dbschema,_),Vo(l,[l.Transaction.prototype]),Cs(l,[l.Transaction.prototype],l._storeNames,l._dbSchema),u.schema=l._dbSchema})}),b().then(()=>{var m,_;_=h,mt(m=p).forEach(y=>{_.db.objectStoreNames.contains(y)||so(_,y,m[y].primKey,m[y].indexes)})})}(n,t,o,e).catch(r)})}function qc(n,t){const e={del:[],add:[],change:[]};let i;for(i in n)t[i]||e.del.push(i);for(i in t){const s=n[i],o=t[i];if(s){const r={name:i,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||s.primKey.auto!==o.primKey.auto&&!Vs)r.recreate=!0,e.change.push(r);else{const a=s.idxByName,l=o.idxByName;let c;for(c in a)l[c]||r.del.push(c);for(c in l){const u=a[c],h=l[c];u?u.src!==h.src&&r.change.push(h):r.add.push(h)}(r.del.length>0||r.add.length>0||r.change.length>0)&&e.change.push(r)}}else e.add.push([i,o])}return e}function so(n,t,e,i){const s=n.db.createObjectStore(t,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return i.forEach(o=>Ho(s,o)),s}function Ho(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Wo(n,t,e){const i={};return xs(t.objectStoreNames,0).forEach(s=>{const o=e.objectStore(s);let r=o.keyPath;const a=$o(Wc(r),r||"",!1,!1,!!o.autoIncrement,r&&typeof r!="string",!0),l=[];for(let u=0;u{if(t[i]!==null){var s=t[i].split(",").map((r,a)=>{const l=(r=r.trim()).replace(/([&*]|\+\+)/g,""),c=/^\[/.test(l)?l.match(/^\[(.*)\]$/)[1].split("+"):l;return $o(l,c||null,/\&/.test(r),/\*/.test(r),/\+\+/.test(r),vt(c),a===0)}),o=s.shift();if(o.multi)throw new z.Schema("Primary key cannot be multi-valued");s.forEach(r=>{if(r.auto)throw new z.Schema("Only primary key can be marked as autoIncrement (++)");if(!r.keyPath)throw new z.Schema("Index must have a name and cannot be an empty string")}),e[i]=Kc(i,o,s)}})}stores(t){const e=this.db;this._cfg.storesSource=this._cfg.storesSource?Ft(this._cfg.storesSource,t):t;const i=e._versions,s={};let o={};return i.forEach(r=>{Ft(s,r._cfg.storesSource),o=r._cfg.dbschema={},r._parseStoresSpec(s,o)}),e._dbSchema=o,Vo(e,[e._allTables,e,e.Transaction.prototype]),Cs(e,[e._allTables,e,e.Transaction.prototype,this._cfg.tables],mt(o),o),e._storeNames=mt(o),this}upgrade(t){return this._cfg.contentUpgrade=yr(this._cfg.contentUpgrade||J,t),this}}function kr(n,t){let e=n._dbNamesDB;return e||(e=n._dbNamesDB=new Ye("__dbnames",{addons:[],indexedDB:n,IDBKeyRange:t}),e.version(1).stores({dbnames:"name"})),e.table("dbnames")}function Sr(n){return n&&typeof n.databases=="function"}function qo(n){return Te(function(){return B.letThrough=!0,n()})}function Nf(){var n;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(t){var e=function(){return indexedDB.databases().finally(t)};n=setInterval(e,100),e()}).finally(function(){return clearInterval(n)}):Promise.resolve()}function Mr(n){return!("from"in n)}const Dt=function(n,t){if(!this){const e=new Dt;return n&&"d"in n&&Ft(e,n),e}Ft(this,arguments.length?{d:1,from:n,to:arguments.length>1?t:n}:{d:0})};function di(n,t,e){const i=Q(t,e);if(isNaN(i))return;if(i>0)throw RangeError();if(Mr(n))return Ft(n,{from:t,to:e,d:1});const s=n.l,o=n.r;if(Q(e,n.from)<0)return s?di(s,t,e):n.l={from:t,to:e,d:1,l:null,r:null},ma(n);if(Q(t,n.to)>0)return o?di(o,t,e):n.r={from:t,to:e,d:1,l:null,r:null},ma(n);Q(t,n.from)<0&&(n.from=t,n.l=null,n.d=o?o.d+1:1),Q(e,n.to)>0&&(n.to=e,n.r=null,n.d=n.l?n.l.d+1:1);const r=!n.r;s&&!n.l&&Ps(n,s),o&&r&&Ps(n,o)}function Ps(n,t){Mr(t)||function e(i,{from:s,to:o,l:r,r:a}){di(i,s,o),r&&e(i,r),a&&e(i,a)}(n,t)}function Uo(n,t){const e=Yo(t);let i=e.next();if(i.done)return!1;let s=i.value;const o=Yo(n);let r=o.next(s.from),a=r.value;for(;!i.done&&!r.done;){if(Q(a.from,s.to)<=0&&Q(a.to,s.from)>=0)return!0;Q(s.from,a.from)<0?s=(i=e.next(a.from)).value:a=(r=o.next(s.from)).value}return!1}function Yo(n){let t=Mr(n)?null:{s:0,n};return{next(e){const i=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,i)for(;t.n.l&&Q(e,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,!i||Q(e,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 ma(n){var t,e;const i=(((t=n.r)===null||t===void 0?void 0:t.d)||0)-(((e=n.l)===null||e===void 0?void 0:e.d)||0),s=i>1?"r":i<-1?"l":"";if(s){const o=s==="r"?"l":"r",r={...n},a=n[s];n.from=a.from,n.to=a.to,n[s]=a[s],r[s]=a[o],n[o]=r,r.d=ba(r)}n.d=ba(n)}function ba({r:n,l:t}){return(n?t?Math.max(n.d,t.d):n.d:t?t.d:0)+1}function Hs(n,t){return mt(t).forEach(e=>{n[e]?Ps(n[e],t[e]):n[e]=Ac(t[e])}),n}function Uc(n,t){return Object.keys(n).some(e=>t[e]&&Uo(t[e],n[e]))}Cn(Dt.prototype,{add(n){return Ps(this,n),this},addKey(n){return di(this,n,n),this},addKeys(n){return n.forEach(t=>di(this,t,t)),this},[Do](){return Yo(this)}});const bn={};let oo={},ro=!1;function ao(n){Hs(oo,n),ro||(ro=!0,queueMicrotask(()=>{ro=!1;const t=oo;oo={},Cr(t)}))}function Cr(n,t=!1){const e=new Set;for(const i in n){const s=/^idb\:\/\/(.*)\/(.*)\//.exec(i);if(s){const[,o,r]=s,a=bn[`idb://${o}/${r}`];a&&Vf(a,n,e,t)}}e.forEach(i=>i())}function Vf(n,t,e,i){const s=i&&[];for(const[o,r]of Object.entries(n.queries.query)){const a=i&&[];for(const l of r)l.obsSet&&Uc(t,l.obsSet)?l.subscribers.forEach(c=>e.add(c)):i&&a.push(l);i&&s.push([o,a])}if(i)for(const[o,r]of s)n.queries.query[o]=r}function Hf(n){const t=n._state,{indexedDB:e}=n._deps;if(t.isBeingOpened||n.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?dt(t.dbOpenError):n);ye&&(t.openCanceller._stackHolder=on()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const i=t.openCanceller;function s(){if(t.openCanceller!==i)throw new z.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,r=null,a=!1;return F.race([i,(typeof navigator>"u"?F.resolve():Nf()).then(()=>new F((l,c)=>{if(s(),!e)throw new z.MissingAPI;const u=n.name,h=t.autoSchema?e.open(u):e.open(u,Math.round(10*n.verno));if(!h)throw new z.MissingAPI;h.onerror=Xt(c),h.onblocked=at(n._fireOnBlocked),h.onupgradeneeded=at(f=>{if(r=h.transaction,t.autoSchema&&!n._options.allowEmptyDB){h.onerror=hi,r.abort(),h.result.close();const p=e.deleteDatabase(u);p.onsuccess=p.onerror=at(()=>{c(new z.NoSuchDatabase(`Database ${u} doesnt exist`))})}else{r.onerror=Xt(c);var d=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;a=d<1,n.idbdb=h.result,$f(n,d/10,r,c)}},c),h.onsuccess=at(()=>{r=null;const f=n.idbdb=h.result,d=xs(f.objectStoreNames);if(d.length>0)try{const g=f.transaction((p=d).length===1?p[0]:p,"readonly");t.autoSchema?function(b,m,_){b.verno=m.version/10;const y=b._dbSchema=Wo(0,m,_);b._storeNames=xs(m.objectStoreNames,0),Cs(b,[b._allTables],mt(y),y)}(n,f,g):(Ko(n,n._dbSchema,g),function(b,m){const _=qc(Wo(0,b.idbdb,m),b._dbSchema);return!(_.add.length||_.change.some(y=>y.add.length||y.change.length))}(n,g)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),No(n,g)}catch{}var p;Jn.push(n),f.onversionchange=at(g=>{t.vcFired=!0,n.on("versionchange").fire(g)}),f.onclose=at(g=>{n.on("close").fire(g)}),a&&function({indexedDB:g,IDBKeyRange:b},m){!Sr(g)&&m!=="__dbnames"&&kr(g,b).put({name:m}).catch(J)}(n._deps,u),l()},c)}))]).then(()=>(s(),t.onReadyBeingFired=[],F.resolve(qo(()=>n.on.ready.fire(n.vip))).then(function l(){if(t.onReadyBeingFired.length>0){let c=t.onReadyBeingFired.reduce(yr,J);return t.onReadyBeingFired=[],F.resolve(qo(()=>c(n.vip))).then(l)}}))).finally(()=>{t.openCanceller===i&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(l=>{t.dbOpenError=l;try{r&&r.abort()}catch{}return i===t.openCanceller&&n._close(),dt(l)}).finally(()=>{t.openComplete=!0,o()}).then(()=>{if(a){const l={};n.tables.forEach(c=>{c.schema.indexes.forEach(u=>{u.name&&(l[`idb://${n.name}/${c.name}/${u.name}`]=new Dt(-1/0,[[[]]]))}),l[`idb://${n.name}/${c.name}/`]=l[`idb://${n.name}/${c.name}/:dels`]=new Dt(-1/0,[[[]]])}),_e("storagemutated").fire(l),Cr(l,!0)}return n})}function Xo(n){var t=o=>n.next(o),e=s(t),i=s(o=>n.throw(o));function s(o){return r=>{var a=o(r),l=a.value;return a.done?l:l&&typeof l.then=="function"?l.then(e,i):vt(l)?Promise.all(l).then(e,i):e(l)}}return s(t)()}function Wf(n,t,e){var i=arguments.length;if(i<2)throw new z.InvalidArgument("Too few arguments");for(var s=new Array(i-1);--i;)s[i-1]=arguments[i];e=s.pop();var o=Pc(s);return[n,o,e]}function Yc(n,t,e,i,s){return F.resolve().then(()=>{const o=B.transless||B,r=n._createTransaction(t,e,n._dbSchema,i);r.explicit=!0;const a={trans:r,transless:o};if(i)r.idbtrans=i.idbtrans;else try{r.create(),n._state.PR1398_maxLoop=3}catch(h){return h.name===_r.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>Yc(n,t,e,null,s))):dt(h)}const l=mr(s);let c;l&&Rn();const u=F.follow(()=>{if(c=s.call(r,r),c)if(l){var h=Ee.bind(null,null);c.then(h,h)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=Xo(c))},a);return(c&&typeof c.then=="function"?F.resolve(c).then(h=>r.active?h:dt(new z.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>c)).then(h=>(i&&r._resolve(),r._completion.then(()=>h))).catch(h=>(r._reject(h),dt(h)))})}function Bi(n,t,e){const i=vt(n)?n.slice():[n];for(let s=0;s0,m={...f,name:b?`${d}(virtual-from:${f.name})`:f.name,lowLevelIndex:f,isVirtual:b,keyTail:h,keyLength:g,extractKey:jo(u),unique:!b&&f.unique};return p.push(m),m.isPrimaryKey||o.push(m),g>1&&r(g===2?u[0]:u.slice(0,g-1),h+1,f),p.sort((_,y)=>_.keyTail-y.keyTail),m}const a=r(i.primaryKey.keyPath,0,i.primaryKey);s[":id"]=[a];for(const u of i.indexes)r(u.keyPath,0,u);function l(u){const h=u.query.index;return h.isVirtual?{...u,query:{index:h.lowLevelIndex,range:(f=u.query.range,d=h.keyTail,{type:f.type===1?2:f.type,lower:Bi(f.lower,f.lowerOpen?n.MAX_KEY:n.MIN_KEY,d),lowerOpen:!0,upper:Bi(f.upper,f.upperOpen?n.MIN_KEY:n.MAX_KEY,d),upperOpen:!0})}}:u;var f,d}return{...e,schema:{...i,primaryKey:a,indexes:o,getIndexByKeyPath:function(u){const h=s[ei(u)];return h&&h[0]}},count:u=>e.count(l(u)),query:u=>e.query(l(u)),openCursor(u){const{keyTail:h,isVirtual:f,keyLength:d}=u.query.index;return f?e.openCursor(l(u)).then(p=>p&&function(g){return Object.create(g,{continue:{value:function(m){m!=null?g.continue(Bi(m,u.reverse?n.MAX_KEY:n.MIN_KEY,h)):u.unique?g.continue(g.key.slice(0,d).concat(u.reverse?n.MIN_KEY:n.MAX_KEY,h)):g.continue()}},continuePrimaryKey:{value(m,_){g.continuePrimaryKey(Bi(m,n.MAX_KEY,h),_)}},primaryKey:{get:()=>g.primaryKey},key:{get(){const m=g.key;return d===1?m[0]:m.slice(0,d)}},value:{get:()=>g.value}})}(p)):e.openCursor(u)}}}}}};function Pr(n,t,e,i){return e=e||{},i=i||"",mt(n).forEach(s=>{if(Et(t,s)){var o=n[s],r=t[s];if(typeof o=="object"&&typeof r=="object"&&o&&r){const a=Ao(o);a!==Ao(r)?e[i+s]=t[s]:a==="Object"?Pr(o,r,e,i+s+"."):o!==r&&(e[i+s]=t[s])}else o!==r&&(e[i+s]=t[s])}else e[i+s]=void 0}),mt(t).forEach(s=>{Et(n,s)||(e[i+s]=t[s])}),e}function Or(n,t){return t.type==="delete"?t.keys:t.keys||t.values.map(n.extractKey)}const qf={stack:"dbcore",name:"HooksMiddleware",level:2,create:n=>({...n,table(t){const e=n.table(t),{primaryKey:i}=e.schema;return{...e,mutate(o){const r=B.trans,{deleting:a,creating:l,updating:c}=r.table(t).hook;switch(o.type){case"add":if(l.fire===J)break;return r._promise("readwrite",()=>u(o),!0);case"put":if(l.fire===J&&c.fire===J)break;return r._promise("readwrite",()=>u(o),!0);case"delete":if(a.fire===J)break;return r._promise("readwrite",()=>u(o),!0);case"deleteRange":if(a.fire===J)break;return r._promise("readwrite",()=>function(f){return h(f.trans,f.range,1e4)}(o),!0)}return e.mutate(o);function u(f){const d=B.trans,p=f.keys||Or(i,f);if(!p)throw new Error("Keys missing");return(f=f.type==="add"||f.type==="put"?{...f,keys:p}:{...f}).type!=="delete"&&(f.values=[...f.values]),f.keys&&(f.keys=[...f.keys]),function(g,b,m){return b.type==="add"?Promise.resolve([]):g.getMany({trans:b.trans,keys:m,cache:"immutable"})}(e,f,p).then(g=>{const b=p.map((m,_)=>{const y=g[_],v={onerror:null,onsuccess:null};if(f.type==="delete")a.fire.call(v,m,y,d);else if(f.type==="add"||y===void 0){const x=l.fire.call(v,m,f.values[_],d);m==null&&x!=null&&(m=x,f.keys[_]=m,i.outbound||Vt(f.values[_],i.keyPath,m))}else{const x=Pr(y,f.values[_]),S=c.fire.call(v,x,m,y,d);if(S){const M=f.values[_];Object.keys(S).forEach(k=>{Et(M,k)?M[k]=S[k]:Vt(M,k,S[k])})}}return v});return e.mutate(f).then(({failures:m,results:_,numFailures:y,lastResult:v})=>{for(let x=0;x(b.forEach(_=>_.onerror&&_.onerror(m)),Promise.reject(m)))})}function h(f,d,p){return e.query({trans:f,values:!1,query:{index:i,range:d},limit:p}).then(({result:g})=>u({type:"delete",keys:g,trans:f}).then(b=>b.numFailures>0?Promise.reject(b.failures[0]):g.length({table:t=>{const e=n.table(t);return{...e,getMany:i=>{if(!i.cache)return e.getMany(i);const s=Xc(i.keys,i.trans._cache,i.cache==="clone");return s?F.resolve(s):e.getMany(i).then(o=>(i.trans._cache={keys:i.keys,values:i.cache==="clone"?De(o):o},o))},mutate:i=>(i.type!=="add"&&(i.trans._cache=null),e.mutate(i))}}})};function Gc(n,t){return n.trans.mode==="readonly"&&!!n.subscr&&!n.trans.explicit&&n.trans.db._options.cache!=="disabled"&&!t.schema.primaryKey.outbound}function Qc(n,t){switch(n){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}const Yf={stack:"dbcore",level:0,name:"Observability",create:n=>{const t=n.schema.name,e=new Dt(n.MIN_KEY,n.MAX_KEY);return{...n,transaction:(i,s,o)=>{if(B.subscr&&s!=="readonly")throw new z.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${B.querier}`);return n.transaction(i,s,o)},table:i=>{const s=n.table(i),{schema:o}=s,{primaryKey:r}=o,{extractKey:a,outbound:l}=r,c={...s,mutate:f=>{const d=f.trans,p=f.mutatedParts||(f.mutatedParts={}),g=S=>{const M=`idb://${t}/${i}/${S}`;return p[M]||(p[M]=new Dt)},b=g(""),m=g(":dels"),{type:_}=f;let[y,v]=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[Or(r,f).filter(S=>S),f.values]:[];const x=f.trans._cache;if(vt(y)){b.addKeys(y);const S=_==="delete"||y.length===v.length?Xc(y,x):null;S||_==="add"||m.addKeys(y),(S||v)&&function(M,k,w,O){function D(R){const N=M(R.name||"");function W(q){return q!=null?R.extractKey(q):null}const K=q=>R.multiEntry&&vt(q)?q.forEach(U=>N.addKey(U)):N.addKey(q);(w||O).forEach((q,U)=>{const G=w&&W(w[U]),tt=O&&W(O[U]);Q(G,tt)!==0&&(G!=null&&K(G),tt!=null&&K(tt))})}k.indexes.forEach(D)}(g,o,S,v)}else if(y){const S={from:y.lower,to:y.upper};m.add(S),b.add(S)}else b.add(e),m.add(e),o.indexes.forEach(S=>g(S.name).add(e));return s.mutate(f).then(S=>(!y||f.type!=="add"&&f.type!=="put"||b.addKeys(S.results),d.mutatedParts=Hs(d.mutatedParts||{},p),S))}},u=({query:{index:f,range:d}})=>{var p,g;return[f,new Dt((p=d.lower)!==null&&p!==void 0?p:n.MIN_KEY,(g=d.upper)!==null&&g!==void 0?g:n.MAX_KEY)]},h={get:f=>[r,new Dt(f.key)],getMany:f=>[r,new Dt().addKeys(f.keys)],count:u,query:u,openCursor:u};return mt(h).forEach(f=>{c[f]=function(d){const{subscr:p}=B,g=!!p,m=Gc(B,s)&&Qc(f,d)?d.obsSet={}:p;if(g){const _=M=>{const k=`idb://${t}/${i}/${M}`;return m[k]||(m[k]=new Dt)},y=_(""),v=_(":dels"),[x,S]=h[f](d);if(_(x.name||"").add(S),!x.isPrimaryKey){if(f!=="count"){const M=f==="query"&&l&&d.values&&s.query({...d,values:!1});return s[f].apply(this,arguments).then(k=>{if(f==="query"){if(l&&d.values)return M.then(({result:O})=>(y.addKeys(O),k));const w=d.values?k.result.map(a):k.result;d.values?y.addKeys(w):v.addKeys(w)}else if(f==="openCursor"){const w=k,O=d.values;return w&&Object.create(w,{key:{get:()=>(v.addKey(w.primaryKey),w.key)},primaryKey:{get(){const D=w.primaryKey;return v.addKey(D),D}},value:{get:()=>(O&&y.addKey(w.primaryKey),w.value)}})}return k})}v.add(e)}}return s[f].apply(this,arguments)}}),c}}}};function _a(n,t){return function(e,i){return i.lower===void 0||(i.lowerOpen?Q(e,i.lower)>0:Q(e,i.lower)>=0)}(n,t)&&function(e,i){return i.upper===void 0||(i.upperOpen?Q(e,i.upper)<0:Q(e,i.upper)<=0)}(n,t)}function ya(n,t,e,i,s,o){if(!e||e.length===0)return n;const r=t.query.index,a=i.schema.primaryKey.extractKey,l=r.extractKey,c=(r.lowLevelIndex||r).extractKey;let u=e.reduce((h,f)=>{let d=h;const p=f.type==="add"||f.type==="put"?f.values.filter(g=>_a(l(g),t.query.range)).map(g=>(g=De(g),o&&Object.freeze(g),g)):[];switch(f.type){case"add":d=h.concat(t.values?p:p.map(_=>a(_)));break;case"put":const g=new Dt().addKeys(f.values.map(_=>a(_)));d=h.filter(_=>{const y=t.values?a(_):_;return!Uo(new Dt(y),g)}).concat(t.values?p:p.map(_=>a(_)));break;case"delete":const b=new Dt().addKeys(f.keys);d=h.filter(_=>{const y=t.values?a(_):_;return!Uo(new Dt(y),b)});break;case"deleteRange":const m=f.range;d=h.filter(_=>!_a(a(_),m))}return d},n);return u===n?n:(u.sort((h,f)=>Q(c(h),c(f))||Q(a(h),a(f))),t.limit&&t.limit<1/0&&(u.length>t.limit?u.length=t.limit:n.length===t.limit&&u.length=0}function Gf(n,t,e,i){n.subscribers.add(e),i.addEventListener("abort",()=>{n.subscribers.delete(e),n.subscribers.size===0&&function(s,o){setTimeout(()=>{s.subscribers.size===0&&Hn(o,s)},3e3)}(n,t)})}const Qf={stack:"dbcore",level:0,name:"Cache",create:n=>{const t=n.schema.name;return{...n,transaction:(i,s,o)=>{const r=n.transaction(i,s,o);if(s==="readwrite"){const a=new AbortController,{signal:l}=a,c=u=>()=>{if(a.abort(),s==="readwrite"){const h=new Set;for(const f of i){const d=bn[`idb://${t}/${f}`],p=n.table(f);if(d){const g=d.optimisticOps.filter(b=>b.trans===r);if(g.length>0){d.optimisticOps=d.optimisticOps.filter(b=>b.trans!==r);for(const b of Object.values(d.queries.query))for(const m of b.slice())if(m.res!=null&&r.mutatedParts)if(u&&!m.dirty){const _=Object.isFrozen(m.res),y=ya(m.res,m.req,g,p,m,_);m.dirty?(Hn(b,m),m.subscribers.forEach(v=>h.add(v))):y!==m.res&&(m.res=y,m.promise=F.resolve({result:y}))}else m.dirty&&Hn(b,m),m.subscribers.forEach(_=>h.add(_))}}}h.forEach(f=>f())}};r.addEventListener("abort",c(!1),{signal:l}),r.addEventListener("error",c(!1),{signal:l}),r.addEventListener("complete",c(!0),{signal:l})}return r},table(i){const s=n.table(i),o=s.schema.primaryKey;return{...s,mutate(a){if(o.outbound||B.trans.db._options.cache==="disabled")return s.mutate(a);const l=bn[`idb://${t}/${i}`];if(!l)return s.mutate(a);const c=s.mutate(a);return a.type!=="add"&&a.type!=="put"||!(a.values.length>=50||Or(o,a).some(u=>u==null))?(l.optimisticOps.push(a),ao(a.mutatedParts),c.catch(()=>{Hn(l.optimisticOps,a),ao(a.mutatedParts)})):c.then(u=>{const h={...a,values:a.values.map((f,d)=>{const p=o.keyPath.includes(".")?De(f):{...f};return Vt(p,o.keyPath,u.results[d]),p})};l.optimisticOps.push(h),queueMicrotask(()=>ao(a.mutatedParts))}),c},query(a){if(!Gc(B,s)||!Qc("query",a))return s.query(a);const l=B.trans.db._options.cache==="immutable",{requery:c,signal:u}=B;let[h,f,d,p]=function(g,b,m,_){const y=bn[`idb://${g}/${b}`];if(!y)return[];const v=y.queries[m];if(!v)return[null,!1,y,null];const x=v[(_.query?_.query.index.name:null)||""];if(!x)return[null,!1,y,null];switch(m){case"query":const S=x.find(k=>k.req.limit===_.limit&&k.req.values===_.values&&xa(k.req.query.range,_.query.range));return S?[S,!0,y,x]:[x.find(k=>("limit"in k.req?k.req.limit:1/0)>=_.limit&&(!_.values||k.req.values)&&Xf(k.req.query.range,_.query.range)),!1,y,x];case"count":const M=x.find(k=>xa(k.req.query.range,_.query.range));return[M,!!M,y,x]}}(t,i,"query",a);if(h&&f)h.obsSet=a.obsSet;else{const g=s.query(a).then(b=>{const m=b.result;if(h.res=m,l){for(let _=0,y=m.length;_(p&&h&&Hn(p,h),Promise.reject(b)));h={obsSet:a.obsSet,promise:g,subscribers:new Set,type:"query",req:a,dirty:!1},p?p.push(h):(p=[h],d||(d=bn[`idb://${t}/${i}`]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}}),d.queries.query[a.query.index.name||""]=p)}return Gf(h,p,c,u),h.promise.then(g=>({result:ya(g.result,a,d==null?void 0:d.optimisticOps,s,h,l)}))}}}}}};function zi(n,t){return new Proxy(n,{get:(e,i,s)=>i==="db"?t:Reflect.get(e,i,s)})}class Ye{constructor(t,e){this._middlewares={},this.verno=0;const i=Ye.dependencies;this._options=e={addons:Ye.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned",...e},this._deps={indexedDB:e.indexedDB,IDBKeyRange:e.IDBKeyRange};const{addons:s}=e;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:J,dbReadyPromise:null,cancelOpen:J,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var r;o.dbReadyPromise=new F(l=>{o.dbReadyResolve=l}),o.openCanceller=new F((l,c)=>{o.cancelOpen=c}),this._state=o,this.name=t,this.on=ti(this,"populate","blocked","versionchange","close",{ready:[yr,J]}),this.on.ready.subscribe=Sc(this.on.ready.subscribe,l=>(c,u)=>{Ye.vip(()=>{const h=this._state;if(h.openComplete)h.dbOpenError||F.resolve().then(c),u&&l(c);else if(h.onReadyBeingFired)h.onReadyBeingFired.push(c),u&&l(c);else{l(c);const f=this;u||l(function d(){f.on.ready.unsubscribe(c),f.on.ready.unsubscribe(d)})}})}),this.Collection=(r=this,In(Tf.prototype,function(l,c){this.db=r;let u=Nc,h=null;if(c)try{u=c()}catch(g){h=g}const f=l._ctx,d=f.table,p=d.hook.reading.fire;this._ctx={table:d,index:f.index,isPrimKey:!f.index||d.schema.primKey.keyPath&&f.index===d.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:h,or:f.or,valueMapper:p!==ci?p:null}})),this.Table=function(l){return In(fa.prototype,function(c,u,h){this.db=l,this._tx=h,this.name=c,this.schema=u,this.hook=l._allTables[c]?l._allTables[c].hook:ti(null,{creating:[mf,J],reading:[gf,ci],updating:[_f,J],deleting:[bf,J]})})}(this),this.Transaction=function(l){return In(If.prototype,function(c,u,h,f,d){this.db=l,this.mode=c,this.storeNames=u,this.schema=h,this.chromeTransactionDurability=f,this.idbtrans=null,this.on=ti(this,"complete","error","abort"),this.parent=d||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 F((p,g)=>{this._resolve=p,this._reject=g}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},p=>{var g=this.active;return this.active=!1,this.on.error.fire(p),this.parent?this.parent._reject(p):g&&this.idbtrans&&this.idbtrans.abort(),dt(p)})})}(this),this.Version=function(l){return In(jf.prototype,function(c){this.db=l,this._cfg={version:c,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(l){return In(Hc.prototype,function(c,u,h){if(this.db=l,this._ctx={table:c,index:u===":id"?null:u,or:h},this._cmp=this._ascending=Q,this._descending=(f,d)=>Q(d,f),this._max=(f,d)=>Q(f,d)>0?f:d,this._min=(f,d)=>Q(f,d)<0?f:d,this._IDBKeyRange=l._deps.IDBKeyRange,!this._IDBKeyRange)throw new z.MissingAPI})}(this),this.on("versionchange",l=>{l.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({disableAutoOpen:!1}),this._state.openComplete=!1}),this.on("blocked",l=>{!l.newVersion||l.newVersionnew this.Transaction(l,c,u,this._options.chromeTransactionDurability,h),this._fireOnBlocked=l=>{this.on("blocked").fire(l),Jn.filter(c=>c.name===this.name&&c!==this&&!c._state.vcFired).map(c=>c.on("versionchange").fire(l))},this.use(Uf),this.use(Qf),this.use(Yf),this.use(Kf),this.use(qf);const a=new Proxy(this,{get:(l,c,u)=>{if(c==="_vip")return!0;if(c==="table")return f=>zi(this.table(f),a);const h=Reflect.get(l,c,u);return h instanceof fa?zi(h,a):c==="tables"?h.map(f=>zi(f,a)):c==="_createTransaction"?function(){const f=h.apply(this,arguments);return zi(f,a)}:h}});this.vip=a,s.forEach(l=>l(this))}version(t){if(isNaN(t)||t<.1)throw new z.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new z.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const e=this._versions;var i=e.filter(s=>s._cfg.version===t)[0];return i||(i=new this.Version(t),e.push(i),e.sort(zf),i.stores({}),this._state.autoSchema=!1,i)}_whenReady(t){return this.idbdb&&(this._state.openComplete||B.letThrough||this._vip)?t():new F((e,i)=>{if(this._state.openComplete)return i(new z.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void i(new z.DatabaseClosed);this.open().catch(J)}this._state.dbReadyPromise.then(e,i)}).then(t)}use({stack:t,create:e,level:i,name:s}){s&&this.unuse({stack:t,name:s});const o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:e,level:i??10,name:s}),o.sort((r,a)=>r.level-a.level),this}unuse({stack:t,name:e,create:i}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(s=>i?s.create!==i:!!e&&s.name!==e)),this}open(){return tn(Oe,()=>Hf(this))}_close(){const t=this._state,e=Jn.indexOf(this);if(e>=0&&Jn.splice(e,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}t.dbReadyPromise=new F(i=>{t.dbReadyResolve=i}),t.openCanceller=new F((i,s)=>{t.cancelOpen=s})}close({disableAutoOpen:t}={disableAutoOpen:!0}){this._close();const e=this._state;t&&(this._options.autoOpen=!1),e.dbOpenError=new z.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const t=arguments.length>0,e=this._state;return new F((i,s)=>{const o=()=>{this.close({disableAutoOpen:!1});var r=this._deps.indexedDB.deleteDatabase(this.name);r.onsuccess=at(()=>{(function({indexedDB:a,IDBKeyRange:l},c){!Sr(a)&&c!=="__dbnames"&&kr(a,l).delete(c).catch(J)})(this._deps,this.name),i()}),r.onerror=Xt(s),r.onblocked=this._fireOnBlocked};if(t)throw new z.InvalidArgument("Arguments not allowed in db.delete()");e.isBeingOpened?e.dbReadyPromise.then(o):o()})}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 mt(this._allTables).map(t=>this._allTables[t])}transaction(){const t=Wf.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,e,i){let s=B.trans;s&&s.db===this&&t.indexOf("!")===-1||(s=null);const o=t.indexOf("?")!==-1;let r,a;t=t.replace("!","").replace("?","");try{if(a=e.map(c=>{var u=c instanceof this.Table?c.name:c;if(typeof u!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return u}),t=="r"||t==="readonly")r="readonly";else{if(t!="rw"&&t!="readwrite")throw new z.InvalidArgument("Invalid transaction mode: "+t);r="readwrite"}if(s){if(s.mode==="readonly"&&r==="readwrite"){if(!o)throw new z.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");s=null}s&&a.forEach(c=>{if(s&&s.storeNames.indexOf(c)===-1){if(!o)throw new z.SubTransaction("Table "+c+" not included in parent transaction.");s=null}}),o&&s&&!s.active&&(s=null)}}catch(c){return s?s._promise(null,(u,h)=>{h(c)}):dt(c)}const l=Yc.bind(null,this,r,a,s,i);return s?s._promise(r,l,"lock"):B.trans?tn(B.transless,()=>this._whenReady(l)):this._whenReady(l)}table(t){if(!Et(this._allTables,t))throw new z.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const Zf=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class Jf{constructor(t){this._subscribe=t}subscribe(t,e,i){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:e,complete:i})}[Zf](){return this}}let Os;try{Os={indexedDB:_t.indexedDB||_t.mozIndexedDB||_t.webkitIndexedDB||_t.msIndexedDB,IDBKeyRange:_t.IDBKeyRange||_t.webkitIDBKeyRange}}catch{Os={indexedDB:null,IDBKeyRange:null}}function pi(n){let t,e=!1;const i=new Jf(s=>{const o=mr(n);let r,a=!1,l={},c={};const u={get closed(){return a},unsubscribe:()=>{a||(a=!0,r&&r.abort(),h&&_e.storagemutated.unsubscribe(f))}};s.start&&s.start(u);let h=!1;const f=p=>{Hs(l,p),Uc(c,l)&&d()},d=()=>{if(a||!Os.indexedDB)return;l={};const p={};r&&r.abort(),r=new AbortController;const g={subscr:p,signal:r.signal,requery:d,querier:n,trans:null},b=function(m){const _=Tn();try{o&&Rn();const y=Te(n,m);return o&&y.finally(Ee),y}finally{_&&En()}}(g);Promise.resolve(b).then(m=>{e=!0,t=m,a||g.signal.aborted||(l={},c=p,function(_){for(const y in _)if(Et(_,y))return!1;return!0}(c)||h||(_e("storagemutated",f),h=!0),s.next&&s.next(m))},m=>{if(e=!1,!["DatabaseClosedError","AbortError"].includes(m==null?void 0:m.name)){if(a)return;s.error&&s.error(m)}})};return d(),u});return i.hasValue=()=>e,i.getValue=()=>t,i}const Be=Ye;function rs(n){let t=ue;try{ue=!0,_e.storagemutated.fire(n),Cr(n,!0)}finally{ue=t}}Cn(Be,{...ts,delete:n=>new Be(n,{addons:[]}).delete(),exists:n=>new Be(n,{addons:[]}).open().then(t=>(t.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(n){try{return function({indexedDB:t,IDBKeyRange:e}){return Sr(t)?Promise.resolve(t.databases()).then(i=>i.map(s=>s.name).filter(s=>s!=="__dbnames")):kr(t,e).toCollection().primaryKeys()}(Be.dependencies).then(n)}catch{return dt(new z.MissingAPI)}},defineClass:()=>function(n){Ft(this,n)},ignoreTransaction:n=>B.trans?tn(B.transless,n):n(),vip:qo,async:function(n){return function(){try{var t=Xo(n.apply(this,arguments));return t&&typeof t.then=="function"?t:F.resolve(t)}catch(e){return dt(e)}}},spawn:function(n,t,e){try{var i=Xo(n.apply(e,t||[]));return i&&typeof i.then=="function"?i:F.resolve(i)}catch(s){return dt(s)}},currentTransaction:{get:()=>B.trans||null},waitFor:function(n,t){const e=F.resolve(typeof n=="function"?Be.ignoreTransaction(n):n).timeout(t||6e4);return B.trans?B.trans.waitFor(e):e},Promise:F,debug:{get:()=>ye,set:n=>{Dc(n,n==="dexie"?()=>!0:jc)}},derive:vn,extend:Ft,props:Cn,override:Sc,Events:ti,on:_e,liveQuery:pi,extendObservabilitySet:Hs,getByKeyPath:me,setByKeyPath:Vt,delByKeyPath:function(n,t){typeof t=="string"?Vt(n,t,void 0):"length"in t&&[].map.call(t,function(e){Vt(n,e,void 0)})},shallowClone:Cc,deepClone:De,getObjectDiff:Pr,cmp:Q,asap:Mc,minKey:-(1/0),addons:[],connections:Jn,errnames:_r,dependencies:Os,cache:bn,semVer:"4.0.1-alpha.25",version:"4.0.1-alpha.25".split(".").map(n=>parseInt(n)).reduce((n,t,e)=>n+t/Math.pow(10,2*e))}),Be.maxKey=fi(Be.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(_e("storagemutated",n=>{if(!ue){let t;Vs?(t=document.createEvent("CustomEvent"),t.initCustomEvent("x-storagemutated-1",!0,!0,n)):t=new CustomEvent("x-storagemutated-1",{detail:n}),ue=!0,dispatchEvent(t),ue=!1}}),addEventListener("x-storagemutated-1",({detail:n})=>{ue||rs(n)}));let ue=!1;if(typeof BroadcastChannel<"u"){const n=new BroadcastChannel("x-storagemutated-1");typeof n.unref=="function"&&n.unref(),_e("storagemutated",t=>{ue||n.postMessage(t)}),n.onmessage=t=>{t.data&&rs(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){_e("storagemutated",t=>{try{ue||(typeof localStorage<"u"&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(e=>e.postMessage({type:"x-storagemutated-1",changedParts:t})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",t=>{if(t.key==="x-storagemutated-1"){const e=JSON.parse(t.newValue);e&&rs(e.changedParts)}});const n=self.document&&navigator.serviceWorker;n&&n.addEventListener("message",function({data:t}){t&&t.type==="x-storagemutated-1"&&rs(t.changedParts)})}F.rejectionMapper=function(n,t){if(!n||n instanceof wn||n instanceof TypeError||n instanceof SyntaxError||!n.name||!aa[n.name])return n;var e=new aa[n.name](t||n.message,n);return"stack"in n&&ge(e,"stack",{get:function(){return this.inner.stack}}),e},Dc(ye,jc);const St=new Ye("carbonquestDB");St.version(1).stores({goals:"++id, goalTitle, totalEmissions, emissionGoal, hourOrUsageGoal"});St.version(1).stores({profile:"++id, name"});St.version(1).stores({stats:"++id, day, emissionsTotal, streak"});function td(n){let t,e,i=n[1].goalTitle+"",s,o,r,a,l=n[1].totalEmissions+"",c,u,h,f,d,p,g=n[1].emissionGoal+"",b,m,_,y,v,x,S=n[1].hourOrUsageGoal+"",M,k,w=n[1].step==.5?"hrs":"times",O,D,R,N,W,K,q,U,G,tt,te,xe,jt,ee,ve;return{c(){t=T("section"),e=T("h2"),s=At(i),o=V(),r=T("p"),a=T("span"),c=At(l),u=At("g CO₂"),h=T("span"),h.textContent="Average Emissions",f=V(),d=T("p"),p=T("span"),b=At(g),m=At("g CO₂"),_=T("span"),_.textContent="Goal Emissions",y=V(),v=T("p"),x=T("span"),M=At(S),k=V(),O=At(w),D=T("span"),D.textContent="Hour/Usage Goal",R=V(),N=T("div"),W=T("div"),K=T("button"),K.textContent="-",q=V(),U=T("div"),G=T("input"),te=V(),xe=T("div"),jt=T("button"),jt.textContent="+",C(e,"class","font-bold mb-2"),C(a,"class","p-1 rounded bg-neutral-200 mr-2 font-mono"),C(h,"class","text-red-500"),C(r,"class","my-2"),C(p,"class","p-1 rounded bg-neutral-200 mr-2 font-mono"),C(_,"class","text-green-600"),C(d,"class","my-2"),C(x,"class","p-1 rounded bg-neutral-200 mr-2 font-mono"),C(D,"class","text-green-500"),C(v,"class","my-2 mb-4"),C(K,"class","button rounded-l-xl px-3 bg-green text-white"),C(G,"class","input shadow-md"),C(G,"type","number"),C(G,"step",tt=n[1].step),G.readOnly=!0,C(G,"aria-readonly","true"),C(jt,"class","button rounded-r-xl px-3 bg-green text-white"),C(N,"class","flex"),C(t,"class","bg-green-300")},m(pt,Ct){I(pt,t,Ct),P(t,e),P(e,s),P(t,o),P(t,r),P(r,a),P(a,c),P(a,u),P(r,h),P(t,f),P(t,d),P(d,p),P(p,b),P(p,m),P(d,_),P(t,y),P(t,v),P(v,x),P(x,M),P(x,k),P(x,O),P(v,D),P(t,R),P(t,N),P(N,W),P(W,K),P(N,q),P(N,U),P(U,G),Kt(G,n[0]),P(N,te),P(N,xe),P(xe,jt),ee||(ve=[kt(K,"click",n[3]),kt(G,"input",n[4]),kt(jt,"click",n[5])],ee=!0)},p(pt,[Ct]){Ct&2&&i!==(i=pt[1].goalTitle+"")&&dn(s,i),Ct&2&&l!==(l=pt[1].totalEmissions+"")&&dn(c,l),Ct&2&&g!==(g=pt[1].emissionGoal+"")&&dn(b,g),Ct&2&&S!==(S=pt[1].hourOrUsageGoal+"")&&dn(M,S),Ct&2&&w!==(w=pt[1].step==.5?"hrs":"times")&&dn(O,w),Ct&2&&tt!==(tt=pt[1].step)&&C(G,"step",tt),Ct&1&&fc(G.value)!==pt[0]&&Kt(G,pt[0])},i:E,o:E,d(pt){pt&&L(t),ee=!1,Bt(ve)}}}function ed(n,t,e){let{goal:i}=t,{usageLog:s=0}=t;pi(()=>St.goals.toArray());function o(c){let u=Math.round((c.totalEmissions+s*c.emissionPerUnit)/2);St.goals.update(c.id,{totalEmissions:u,hoursToday:s})}i.hoursToday>0&&(s=i.hoursToday);const r=()=>{s>0&&(e(0,s-=i.step),o(i))};function a(){s=fc(this.value),e(0,s)}const l=()=>{s<24&&(e(0,s+=i.step),o(i))};return n.$$set=c=>{"goal"in c&&e(1,i=c.goal),"usageLog"in c&&e(0,s=c.usageLog)},[s,i,o,r,a,l]}class nd extends $t{constructor(t){super(),zt(this,t,ed,td,Pt,{goal:1,usageLog:0})}}const id=[{name:"Car Use 🚗🏎️",emission:"3360",time:"1"},{name:"Plastic Bag 🛍️",emission:"33",time:"none"},{name:"Plastic Water Bottle 🥤",emission:"83",time:"none"},{name:"Disposable Drink/Coffee Cup 🧋",emission:"16",time:"none"},{name:"Phone/Device Usage 📱🖥️",emission:"172",time:"1"},{name:"Clothes Shopping 👕",emission:"187",time:"none"},{name:"Toilet Paper Rolls 🧻",emission:"1300",time:"none"},{name:"Flight Use ✈️☁️",emission:"40000",time:"1"},{name:"Microwave Use ♨️",emission:"400",time:"none"},{name:"Washing Machine 🩳🫧",emission:"275",time:"none"},{name:"Dryer ☀️👖",emission:"1000",time:"none"},{name:"Kettle 🫖",emission:"50",time:"none"},{name:"Lights 💡",emission:"43",time:"1"},{name:"Hot Shower 🚿",emission:"12000",time:"1"},{name:"Electric Stove/Hob Use ⚡",emission:"675",time:"none"},{name:"Gas Stove/Hob Use 🫕",emission:"167",time:"none"},{name:"Cooling/Air Conditioning ❄️",emission:"83",time:"1"},{name:"Heating 🔥",emission:"292",time:"1"}];function sd(n,t,e){const i=n.slice();return i[8]=t[e],i}function od(n){let t;return{c(){t=T("option"),t.textContent=`${n[8].name}`,t.__value=n[8],Kt(t,t.__value)},m(e,i){I(e,t,i)},p:E,d(e){e&&L(t)}}}function va(n){let t;function e(o,r){return o[0].time==1?ad:rd}let i=e(n),s=i(n);return{c(){s.c(),t=bt()},m(o,r){s.m(o,r),I(o,t,r)},p(o,r){i===(i=e(o))&&s?s.p(o,r):(s.d(1),s=i(o),s&&(s.c(),s.m(t.parentNode,t)))},d(o){o&&L(t),s.d(o)}}}function rd(n){let t,e,i;return{c(){t=T("input"),C(t,"type","text"),C(t,"placeholder","Times used/done per day"),C(t,"class","input block rounded-xl")},m(s,o){I(s,t,o),Kt(t,n[1]),e||(i=kt(t,"input",n[6]),e=!0)},p(s,o){o&2&&t.value!==s[1]&&Kt(t,s[1])},d(s){s&&L(t),e=!1,i()}}}function ad(n){let t,e,i;return{c(){t=T("input"),C(t,"type","text"),C(t,"placeholder","Hours used per day"),C(t,"class","input block rounded-xl")},m(s,o){I(s,t,o),Kt(t,n[1]),e||(i=kt(t,"input",n[5]),e=!0)},p(s,o){o&2&&t.value!==s[1]&&Kt(t,s[1])},d(s){s&&L(t),e=!1,i()}}}function ld(n){let t,e,i,s,o,r,a,l,c,u,h,f,d,p,g=be(id),b=[];for(let _=0;_n[4].call(o)),C(l,"type","text"),C(l,"placeholder","Goal times/hours"),C(l,"class","input block rounded-xl"),C(u,"class","button bg-green rounded-xl"),C(f,"class","button rounded-xl bg-red-600"),C(f,"href","#"),C(e,"class","modal"),C(t,"class","modal-overlay"),C(t,"id","addGoal")},m(_,y){I(_,t,y),P(t,e),P(e,i),P(e,s),P(e,o);for(let v=0;v{"goalTitle"in h&&e(0,i=h.goalTitle),"multiplier"in h&&e(1,s=h.multiplier),"emissionGoal"in h&&e(2,o=h.emissionGoal)},[i,s,o,r,a,l,c,u]}class ud extends $t{constructor(t){super(),zt(this,t,cd,ld,Pt,{goalTitle:0,multiplier:1,emissionGoal:2})}}function wa(n,t,e){const i=n.slice();return i[6]=t[e],i}function ka(n){let t,e,i=[],s=new Map,o,r,a,l=be(n[0]);const c=d=>d[6].id;for(let d=0;d',e=V(),i=T("p"),i.innerHTML='Add a CarbonQuest to get started!
Click the + icon below.',C(t,"class","text-center mt-12 max-h-64"),C(i,"class","mx-4 text-center")},m(s,o){I(s,t,o),I(s,e,o),I(s,i,o)},p:E,d(s){s&&(L(t),L(e),L(i))}}}function Ma(n){let t;function e(o,r){return o[1].length==0?pd:dd}let i=e(n),s=i(n);return{c(){s.c(),t=bt()},m(o,r){s.m(o,r),I(o,t,r)},p(o,r){i===(i=e(o))&&s?s.p(o,r):(s.d(1),s=i(o),s&&(s.c(),s.m(t.parentNode,t)))},d(o){o&&L(t),s.d(o)}}}function dd(n){let t=console.log("PROFILE EXISTS")+"",e;return{c(){e=At(t)},m(i,s){I(i,e,s)},p:E,d(i){i&&L(e)}}}function pd(n){let t=location.href="/profile",e;return{c(){e=At(t)},m(i,s){I(i,e,s)},p:E,d(i){i&&L(e)}}}function gd(n){let t,e,i,s,o,r,a,l=n[0]&&ka(n),c=n[1]&&Ma(n);return s=new ud({}),r=new Ns({}),{c(){t=T("main"),l&&l.c(),e=V(),c&&c.c(),i=V(),lt(s.$$.fragment),o=V(),lt(r.$$.fragment),C(t,"class","main pb-20")},m(u,h){I(u,t,h),l&&l.m(t,null),P(t,e),c&&c.m(t,null),P(t,i),it(s,t,null),P(t,o),it(r,t,null),a=!0},p(u,[h]){u[0]?l?(l.p(u,h),h&1&&$(l,1)):(l=ka(u),l.c(),$(l,1),l.m(t,e)):l&&(Zt(),j(l,1,1,()=>{l=null}),Jt()),u[1]?c?c.p(u,h):(c=Ma(u),c.c(),c.m(t,i)):c&&(c.d(1),c=null)},i(u){a||($(l),$(s.$$.fragment,u),$(r.$$.fragment,u),a=!0)},o(u){j(l),j(s.$$.fragment,u),j(r.$$.fragment,u),a=!1},d(u){u&&L(t),l&&l.d(),c&&c.d(),st(s),st(r)}}}function md(n,t,e){let i,s,o=pi(()=>St.profile.toArray());Gt(n,o,c=>e(1,s=c));let r=pi(()=>St.goals.toArray());Gt(n,r,c=>e(0,i=c)),console.log(r);function a(){let c=i.length,u=0;for(let h in i)i[h].totalEmissions',h=V(),f=T("div"),d=T("button"),d.innerHTML='',C(s,"class",""),C(e,"class","grow p-2"),C(u,"class","text-green p-2"),C(c,"class","mx-1"),C(d,"class","text-green p-2"),C(f,"class","font-bold mx-1"),C(t,"class","flex")},m(_,y){I(_,t,y),P(t,e),P(e,i),P(i,s),P(i,r),P(i,a),P(t,l),P(t,c),P(c,u),P(t,h),P(t,f),P(f,d),p||(g=[kt(u,"click",b),kt(d,"click",m)],p=!0)},p(_,y){n=_},d(_){_&&L(t),p=!1,Bt(g)}}}function xd(n){let t;return{c(){t=T("div"),t.innerHTML=' Loading...',C(t,"role","status")},m(e,i){I(e,t,i)},p:E,d(e){e&&L(t)}}}function vd(n){let t,e={ctx:n,current:null,token:null,hasCatch:!1,pending:xd,then:yd,catch:_d,value:5};return Sn(n[1],e),{c(){t=T("div"),e.block.c()},m(i,s){I(i,t,s),e.block.m(t,e.anchor=null),e.mount=()=>t,e.anchor=null},p(i,[s]){n=i,Si(e,n,s)},i:E,o:E,d(i){i&&L(t),e.block.d(),e.token=null,e=null}}}function wd(n){alert(`You've met your emission goals for all your CarbonQuests for ${n} ${n==1?"day":"days"}!`)}function kd(n){let t=async()=>await St.stats.toArray().then(r=>{let a=0;for(let l in r)r[l].streak==!1?a=0:r[l].streak==!0&&a++;return a}),e=r=>{navigator.share&&navigator.share({title:"CarbonQuest",text:`I have a ${r} day streak on CarbonQuest!`,url:"https://flowshade.github.io/CarbonQuest"}).then(()=>console.log("Successful share")).catch(a=>console.log("Error sharing",a))},i=t().then(r=>r);return[e,i,r=>{wd(r)},r=>{e(r)}]}class Zc extends $t{constructor(t){super(),zt(this,t,kd,vd,Pt,{})}}function Ca(n,t,e){const i=n.slice();return i[8]=t[e],i}function Pa(n){let t,e,i,s;const o=[Md,Sd],r=[];function a(l,c){return l[1].length==0?0:1}return t=a(n),e=r[t]=o[t](n),{c(){e.c(),i=bt()},m(l,c){r[t].m(l,c),I(l,i,c),s=!0},p(l,c){let u=t;t=a(l),t===u?r[t].p(l,c):(Zt(),j(r[u],1,1,()=>{r[u]=null}),Jt(),e=r[t],e?e.p(l,c):(e=r[t]=o[t](l),e.c()),$(e,1),e.m(i.parentNode,i))},i(l){s||($(e),s=!0)},o(l){j(e),s=!1},d(l){l&&L(i),r[t].d(l)}}}function Sd(n){let t,e,i,s=[],o=new Map,r,a,l,c,u,h=be(n[1]);const f=d=>d[8].id;for(let d=0;dCarbonQuest!",i=V(),s=T("input"),o=V(),r=T("button"),r.textContent="Save",a=V(),l=T("img"),C(e,"class","text-2xl my-8"),C(s,"type","text"),C(s,"name",""),C(s,"class","inline input rounded-xl shadow-xl"),C(s,"placeholder","What's your name?"),C(r,"class","inline button bg-green rounded-xl"),vo(l.src,c="/")||C(l,"src",c),C(l,"alt","nature"),Ju(l,u="nature.svg")||C(l,"srcset",u),C(l,"class","mt-8"),C(t,"class","p-3 text-center"),C(t,"id","editName")},m(d,p){I(d,t,p),P(t,e),P(t,i),P(t,s),Kt(s,n[0]),P(t,o),P(t,r),P(t,a),P(t,l),h||(f=[kt(s,"input",n[6]),kt(r,"click",n[3])],h=!0)},p(d,p){p&1&&s.value!==d[0]&&Kt(s,d[0])},i:E,o:E,d(d){d&&L(t),h=!1,Bt(f)}}}function Oa(n,t){let e,i=t[8].name+"",s,o,r,a,l,c,u;function h(){return t[7](t[8])}return{key:n,first:null,c(){e=T("h2"),s=At(i),o=V(),r=T("button"),r.innerHTML='',a=V(),l=T("button"),l.innerHTML=`Share Profile - `,C(e,"class","text-center my-5"),C(l,"class","inline button rounded-xl bg-green"),this.first=e},m(f,d){I(f,e,d),P(e,s),P(e,o),P(e,r),I(f,a,d),I(f,l,d),c||(u=[kt(r,"click",t[4]),kt(l,"click",h)],c=!0)},p(f,d){t=f,d&2&&i!==(i=t[8].name+"")&&dn(s,i)},d(f){f&&(L(e),L(a),L(l)),c=!1,Bt(u)}}}function Cd(n){let t,e,i=n[1]&&Pa(n);return{c(){t=T("main"),i&&i.c(),C(t,"class","main")},m(s,o){I(s,t,o),i&&i.m(t,null),e=!0},p(s,[o]){s[1]?i?(i.p(s,o),o&2&&$(i,1)):(i=Pa(s),i.c(),$(i,1),i.m(t,null)):i&&(Zt(),j(i,1,1,()=>{i=null}),Jt())},i(s){e||($(i),e=!0)},o(s){j(i),e=!1},d(s){s&&L(t),i&&i.d()}}}function Pd(n,t,e){let i,s=pi(()=>St.profile.toArray());Gt(n,s,h=>e(1,i=h));let{name:o=s.name?s.name:""}=t,r=async()=>{try{let h={name:o};const f=St.profile.add(h);Kh("/",{replace:!1})}catch(h){console.log(`Failed to add ${o}: ${h}`)}},a=async()=>{try{let h=await St.profile.clear();console.log("DELETED PROFILE")}catch(h){console.log(`Failed to delete!!!: ${h}`)}},l=h=>{navigator.share&&navigator.share({title:"CarbonQuest",text:`Join ${h} in reducing your carbon footprint!`,url:"https://flowshade.github.io/CarbonQuest"}).then(()=>console.log("Successful share")).catch(f=>console.log("Error sharing",f))};function c(){o=this.value,e(0,o)}const u=h=>{l(h.name)};return n.$$set=h=>{"name"in h&&e(0,o=h.name)},[o,i,s,r,a,l,c,u]}class Od extends $t{constructor(t){super(),zt(this,t,Pd,Cd,Pt,{name:0})}}const Aa=[{title:"Climate Conscious 🍃",description:"Create your first carbon emission reduction goal.",type:"goalCount"},{title:"Screen Time 🤖",description:"Reduce your screen time by 50%",type:"screenTimeGoal"},{title:"7 Day Streak 🔥",description:"Your total average emissions have been under your set emission goals for 7 days straight!",type:"streak",streakGoal:7},{title:"25 Day Streak 🔥",description:"Your total average emissions have been under your set emission goals for 25 days straight!",type:"streak",streakGoal:25},{title:"50 Day Streak 🔥",description:"Your total average emissions have been under your set emission goals for 50 days straight!",type:"streak",streakGoal:50},{title:"100 Day Streak ❤️‍🔥",description:"Your total average emissions have been under your set emission goals for 100 days straight!",type:"streak",streakGoal:100}];function Da(n,t,e){const i=n.slice();return i[4]=t[e],i}function Ta(n,t,e){const i=n.slice();return i[9]=t[e],i}function Ad(n){let t,e={ctx:n,current:null,token:null,hasCatch:!1,pending:Bd,then:Ed,catch:Td,value:8};return Sn(n[1],e),{c(){t=bt(),e.block.c()},m(i,s){I(i,t,s),e.block.m(i,e.anchor=s),e.mount=()=>t.parentNode,e.anchor=t},p(i,s){n=i,Si(e,n,s)},d(i){i&&L(t),e.block.d(i),e.token=null,e=null}}}function Dd(n){let t,e={ctx:n,current:null,token:null,hasCatch:!1,pending:Vd,then:$d,catch:zd,value:7};return Sn(n[0],e),{c(){t=bt(),e.block.c()},m(i,s){I(i,t,s),e.block.m(i,e.anchor=s),e.mount=()=>t.parentNode,e.anchor=t},p(i,s){n=i,Si(e,n,s)},d(i){i&&L(t),e.block.d(i),e.token=null,e=null}}}function Td(n){return{c:E,m:E,p:E,d:E}}function Ed(n){let t;function e(o,r){if(o[4].type=="goalCount"&&o[8].length>0)return Ld;if(o[4].type=="screenTimeGoal")return Rd}let i=e(n),s=i&&i(n);return{c(){s&&s.c(),t=bt()},m(o,r){s&&s.m(o,r),I(o,t,r)},p(o,r){s&&s.p(o,r)},d(o){o&&L(t),s&&s.d(o)}}}function Rd(n){let t,e=be(n[8]),i=[];for(let s=0;s