@college-africa/chat-ui 0.1.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -21
- package/dist/index.mjs +2440 -2407
- package/dist/utils/db.d.ts +2 -0
- package/dist/utils/groups.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";var ys=Object.defineProperty;var gs=(t,n,i)=>n in t?ys(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i;var
|
|
1
|
+
"use strict";var ys=Object.defineProperty;var gs=(t,n,i)=>n in t?ys(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i;var Pt=(t,n,i)=>gs(t,typeof n!="symbol"?n+"":n,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),ue=require("react"),X=require("@mui/material"),vs=require("sdk"),bs=require("@emotion/styled");require("@emotion/react");function ws(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const jt=ws(ue);let lt=null;async function ta(t,n){if(lt)throw new Error("SDK already initialized. Call disconnectSDK() first to reinitialize.");return lt=new vs.ChatSDK(t),n&&await lt.setAuthToken(n),await lt.connect(),lt}function xt(){if(!lt)throw new Error("SDK not initialized. Call initSDK() first.");return lt}function So(){lt&&(lt.disconnect(),lt=null)}function xs(){return lt!==null}const Ss=()=>B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",children:B.jsx(X.CircularProgress,{})}),_s=({error:t,retry:n})=>B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",p:2,children:B.jsxs(X.Alert,{severity:"error",action:B.jsx("button",{onClick:n,style:{cursor:"pointer"},children:"Retry"}),children:[B.jsx(X.AlertTitle,{children:"Failed to initialize chat"}),t.message]})}),Cs=({config:t,token:n,getToken:i,children:s,LoadingComponent:c=Ss,ErrorComponent:f=_s})=>{const[h,m]=ue.useState(!1),[T,_]=ue.useState(null),R=ue.useCallback(async()=>{m(!1),_(null);try{So();let A=n;i&&!A&&(A=await i()),await ta(t,A),m(!0)}catch(A){_(A instanceof Error?A:new Error("Unknown error initializing SDK"))}},[t,n,i]);return ue.useEffect(()=>(R(),()=>{So()}),[t.baseURL,n,i]),!h&&!T?B.jsx(c,{}):T?B.jsx(f,{error:T,retry:R}):B.jsx(B.Fragment,{children:s})},vi=t=>t,Es=()=>{let t=vi;return{configure(n){t=n},generate(n){return t(n)},reset(){t=vi}}},Ts=Es();function Yt(t,...n){const i=new URL(`https://mui.com/production-error/?code=${t}`);return n.forEach(s=>i.searchParams.append("args[]",s)),`Minified MUI error #${t}; visit ${i} for the full message.`}function Gt(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Yt(7));return t.charAt(0).toUpperCase()+t.slice(1)}var ks=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ra(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var on={exports:{}},an={exports:{}},Oe={};/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/var
|
|
8
|
+
*/var bi;function Os(){if(bi)return Oe;bi=1;var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,c=t?Symbol.for("react.strict_mode"):60108,f=t?Symbol.for("react.profiler"):60114,h=t?Symbol.for("react.provider"):60109,m=t?Symbol.for("react.context"):60110,T=t?Symbol.for("react.async_mode"):60111,_=t?Symbol.for("react.concurrent_mode"):60111,R=t?Symbol.for("react.forward_ref"):60112,A=t?Symbol.for("react.suspense"):60113,I=t?Symbol.for("react.suspense_list"):60120,K=t?Symbol.for("react.memo"):60115,M=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,V=t?Symbol.for("react.fundamental"):60117,J=t?Symbol.for("react.responder"):60118,ae=t?Symbol.for("react.scope"):60119;function ce(F){if(typeof F=="object"&&F!==null){var ee=F.$$typeof;switch(ee){case n:switch(F=F.type,F){case T:case _:case s:case f:case c:case A:return F;default:switch(F=F&&F.$$typeof,F){case m:case R:case M:case K:case h:return F;default:return ee}}case i:return ee}}}function W(F){return ce(F)===_}return Oe.AsyncMode=T,Oe.ConcurrentMode=_,Oe.ContextConsumer=m,Oe.ContextProvider=h,Oe.Element=n,Oe.ForwardRef=R,Oe.Fragment=s,Oe.Lazy=M,Oe.Memo=K,Oe.Portal=i,Oe.Profiler=f,Oe.StrictMode=c,Oe.Suspense=A,Oe.isAsyncMode=function(F){return W(F)||ce(F)===T},Oe.isConcurrentMode=W,Oe.isContextConsumer=function(F){return ce(F)===m},Oe.isContextProvider=function(F){return ce(F)===h},Oe.isElement=function(F){return typeof F=="object"&&F!==null&&F.$$typeof===n},Oe.isForwardRef=function(F){return ce(F)===R},Oe.isFragment=function(F){return ce(F)===s},Oe.isLazy=function(F){return ce(F)===M},Oe.isMemo=function(F){return ce(F)===K},Oe.isPortal=function(F){return ce(F)===i},Oe.isProfiler=function(F){return ce(F)===f},Oe.isStrictMode=function(F){return ce(F)===c},Oe.isSuspense=function(F){return ce(F)===A},Oe.isValidElementType=function(F){return typeof F=="string"||typeof F=="function"||F===s||F===_||F===f||F===c||F===A||F===I||typeof F=="object"&&F!==null&&(F.$$typeof===M||F.$$typeof===K||F.$$typeof===h||F.$$typeof===m||F.$$typeof===R||F.$$typeof===V||F.$$typeof===J||F.$$typeof===ae||F.$$typeof===g)},Oe.typeOf=ce,Oe}var Ae={};/** @license React v16.13.1
|
|
9
9
|
* react-is.development.js
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the MIT license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*/var
|
|
15
|
+
*/var wi;function As(){return wi||(wi=1,process.env.NODE_ENV!=="production"&&(function(){var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,c=t?Symbol.for("react.strict_mode"):60108,f=t?Symbol.for("react.profiler"):60114,h=t?Symbol.for("react.provider"):60109,m=t?Symbol.for("react.context"):60110,T=t?Symbol.for("react.async_mode"):60111,_=t?Symbol.for("react.concurrent_mode"):60111,R=t?Symbol.for("react.forward_ref"):60112,A=t?Symbol.for("react.suspense"):60113,I=t?Symbol.for("react.suspense_list"):60120,K=t?Symbol.for("react.memo"):60115,M=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,V=t?Symbol.for("react.fundamental"):60117,J=t?Symbol.for("react.responder"):60118,ae=t?Symbol.for("react.scope"):60119;function ce(q){return typeof q=="string"||typeof q=="function"||q===s||q===_||q===f||q===c||q===A||q===I||typeof q=="object"&&q!==null&&(q.$$typeof===M||q.$$typeof===K||q.$$typeof===h||q.$$typeof===m||q.$$typeof===R||q.$$typeof===V||q.$$typeof===J||q.$$typeof===ae||q.$$typeof===g)}function W(q){if(typeof q=="object"&&q!==null){var Ze=q.$$typeof;switch(Ze){case n:var Ht=q.type;switch(Ht){case T:case _:case s:case f:case c:case A:return Ht;default:var ft=Ht&&Ht.$$typeof;switch(ft){case m:case R:case M:case K:case h:return ft;default:return Ze}}case i:return Ze}}}var F=T,ee=_,pe=m,Pe=h,Ke=n,tt=R,Re=s,y=M,re=K,G=i,fe=f,ye=c,qe=A,Le=!1;function rt(q){return Le||(Le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),z(q)||W(q)===T}function z(q){return W(q)===_}function oe(q){return W(q)===m}function he(q){return W(q)===h}function be(q){return typeof q=="object"&&q!==null&&q.$$typeof===n}function de(q){return W(q)===R}function xe(q){return W(q)===s}function ge(q){return W(q)===M}function me(q){return W(q)===K}function we(q){return W(q)===i}function ke(q){return W(q)===f}function Y(q){return W(q)===c}function Je(q){return W(q)===A}Ae.AsyncMode=F,Ae.ConcurrentMode=ee,Ae.ContextConsumer=pe,Ae.ContextProvider=Pe,Ae.Element=Ke,Ae.ForwardRef=tt,Ae.Fragment=Re,Ae.Lazy=y,Ae.Memo=re,Ae.Portal=G,Ae.Profiler=fe,Ae.StrictMode=ye,Ae.Suspense=qe,Ae.isAsyncMode=rt,Ae.isConcurrentMode=z,Ae.isContextConsumer=oe,Ae.isContextProvider=he,Ae.isElement=be,Ae.isForwardRef=de,Ae.isFragment=xe,Ae.isLazy=ge,Ae.isMemo=me,Ae.isPortal=we,Ae.isProfiler=ke,Ae.isStrictMode=Y,Ae.isSuspense=Je,Ae.isValidElementType=ce,Ae.typeOf=W})()),Ae}var xi;function na(){return xi||(xi=1,process.env.NODE_ENV==="production"?an.exports=Os():an.exports=As()),an.exports}/*
|
|
16
16
|
object-assign
|
|
17
17
|
(c) Sindre Sorhus
|
|
18
18
|
@license MIT
|
|
19
|
-
*/var
|
|
20
|
-
Valid keys: `+JSON.stringify(Object.keys(z),null," "));var q=
|
|
19
|
+
*/var fo,Si;function Ps(){if(Si)return fo;Si=1;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(f){if(f==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(f)}function c(){try{if(!Object.assign)return!1;var f=new String("abc");if(f[5]="de",Object.getOwnPropertyNames(f)[0]==="5")return!1;for(var h={},m=0;m<10;m++)h["_"+String.fromCharCode(m)]=m;var T=Object.getOwnPropertyNames(h).map(function(R){return h[R]});if(T.join("")!=="0123456789")return!1;var _={};return"abcdefghijklmnopqrst".split("").forEach(function(R){_[R]=R}),Object.keys(Object.assign({},_)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return fo=c()?Object.assign:function(f,h){for(var m,T=s(f),_,R=1;R<arguments.length;R++){m=Object(arguments[R]);for(var A in m)n.call(m,A)&&(T[A]=m[A]);if(t){_=t(m);for(var I=0;I<_.length;I++)i.call(m,_[I])&&(T[_[I]]=m[_[I]])}}return T},fo}var po,_i;function Po(){if(_i)return po;_i=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return po=t,po}var ho,Ci;function oa(){return Ci||(Ci=1,ho=Function.call.bind(Object.prototype.hasOwnProperty)),ho}var mo,Ei;function Rs(){if(Ei)return mo;Ei=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var n=Po(),i={},s=oa();t=function(f){var h="Warning: "+f;typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}}}function c(f,h,m,T,_){if(process.env.NODE_ENV!=="production"){for(var R in f)if(s(f,R)){var A;try{if(typeof f[R]!="function"){var I=Error((T||"React class")+": "+m+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof f[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw I.name="Invariant Violation",I}A=f[R](h,R,T,m,null,n)}catch(M){A=M}if(A&&!(A instanceof Error)&&t((T||"React class")+": type specification of "+m+" `"+R+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof A+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),A instanceof Error&&!(A.message in i)){i[A.message]=!0;var K=_?_():"";t("Failed "+m+" type: "+A.message+(K??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(i={})},mo=c,mo}var yo,Ti;function js(){if(Ti)return yo;Ti=1;var t=na(),n=Ps(),i=Po(),s=oa(),c=Rs(),f=function(){};process.env.NODE_ENV!=="production"&&(f=function(m){var T="Warning: "+m;typeof console<"u"&&console.error(T);try{throw new Error(T)}catch{}});function h(){return null}return yo=function(m,T){var _=typeof Symbol=="function"&&Symbol.iterator,R="@@iterator";function A(z){var oe=z&&(_&&z[_]||z[R]);if(typeof oe=="function")return oe}var I="<<anonymous>>",K={array:J("array"),bigint:J("bigint"),bool:J("boolean"),func:J("function"),number:J("number"),object:J("object"),string:J("string"),symbol:J("symbol"),any:ae(),arrayOf:ce,element:W(),elementType:F(),instanceOf:ee,node:tt(),objectOf:Pe,oneOf:pe,oneOfType:Ke,shape:y,exact:re};function M(z,oe){return z===oe?z!==0||1/z===1/oe:z!==z&&oe!==oe}function g(z,oe){this.message=z,this.data=oe&&typeof oe=="object"?oe:{},this.stack=""}g.prototype=Error.prototype;function V(z){if(process.env.NODE_ENV!=="production")var oe={},he=0;function be(xe,ge,me,we,ke,Y,Je){if(we=we||I,Y=Y||me,Je!==i){if(T){var q=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw q.name="Invariant Violation",q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Ze=we+":"+me;!oe[Ze]&&he<3&&(f("You are manually calling a React.PropTypes validation function for the `"+Y+"` prop on `"+we+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),oe[Ze]=!0,he++)}}return ge[me]==null?xe?ge[me]===null?new g("The "+ke+" `"+Y+"` is marked as required "+("in `"+we+"`, but its value is `null`.")):new g("The "+ke+" `"+Y+"` is marked as required in "+("`"+we+"`, but its value is `undefined`.")):null:z(ge,me,we,ke,Y)}var de=be.bind(null,!1);return de.isRequired=be.bind(null,!0),de}function J(z){function oe(he,be,de,xe,ge,me){var we=he[be],ke=ye(we);if(ke!==z){var Y=qe(we);return new g("Invalid "+xe+" `"+ge+"` of type "+("`"+Y+"` supplied to `"+de+"`, expected ")+("`"+z+"`."),{expectedType:z})}return null}return V(oe)}function ae(){return V(h)}function ce(z){function oe(he,be,de,xe,ge){if(typeof z!="function")return new g("Property `"+ge+"` of component `"+de+"` has invalid PropType notation inside arrayOf.");var me=he[be];if(!Array.isArray(me)){var we=ye(me);return new g("Invalid "+xe+" `"+ge+"` of type "+("`"+we+"` supplied to `"+de+"`, expected an array."))}for(var ke=0;ke<me.length;ke++){var Y=z(me,ke,de,xe,ge+"["+ke+"]",i);if(Y instanceof Error)return Y}return null}return V(oe)}function W(){function z(oe,he,be,de,xe){var ge=oe[he];if(!m(ge)){var me=ye(ge);return new g("Invalid "+de+" `"+xe+"` of type "+("`"+me+"` supplied to `"+be+"`, expected a single ReactElement."))}return null}return V(z)}function F(){function z(oe,he,be,de,xe){var ge=oe[he];if(!t.isValidElementType(ge)){var me=ye(ge);return new g("Invalid "+de+" `"+xe+"` of type "+("`"+me+"` supplied to `"+be+"`, expected a single ReactElement type."))}return null}return V(z)}function ee(z){function oe(he,be,de,xe,ge){if(!(he[be]instanceof z)){var me=z.name||I,we=rt(he[be]);return new g("Invalid "+xe+" `"+ge+"` of type "+("`"+we+"` supplied to `"+de+"`, expected ")+("instance of `"+me+"`."))}return null}return V(oe)}function pe(z){if(!Array.isArray(z))return process.env.NODE_ENV!=="production"&&(arguments.length>1?f("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):f("Invalid argument supplied to oneOf, expected an array.")),h;function oe(he,be,de,xe,ge){for(var me=he[be],we=0;we<z.length;we++)if(M(me,z[we]))return null;var ke=JSON.stringify(z,function(Je,q){var Ze=qe(q);return Ze==="symbol"?String(q):q});return new g("Invalid "+xe+" `"+ge+"` of value `"+String(me)+"` "+("supplied to `"+de+"`, expected one of "+ke+"."))}return V(oe)}function Pe(z){function oe(he,be,de,xe,ge){if(typeof z!="function")return new g("Property `"+ge+"` of component `"+de+"` has invalid PropType notation inside objectOf.");var me=he[be],we=ye(me);if(we!=="object")return new g("Invalid "+xe+" `"+ge+"` of type "+("`"+we+"` supplied to `"+de+"`, expected an object."));for(var ke in me)if(s(me,ke)){var Y=z(me,ke,de,xe,ge+"."+ke,i);if(Y instanceof Error)return Y}return null}return V(oe)}function Ke(z){if(!Array.isArray(z))return process.env.NODE_ENV!=="production"&&f("Invalid argument supplied to oneOfType, expected an instance of array."),h;for(var oe=0;oe<z.length;oe++){var he=z[oe];if(typeof he!="function")return f("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Le(he)+" at index "+oe+"."),h}function be(de,xe,ge,me,we){for(var ke=[],Y=0;Y<z.length;Y++){var Je=z[Y],q=Je(de,xe,ge,me,we,i);if(q==null)return null;q.data&&s(q.data,"expectedType")&&ke.push(q.data.expectedType)}var Ze=ke.length>0?", expected one of type ["+ke.join(", ")+"]":"";return new g("Invalid "+me+" `"+we+"` supplied to "+("`"+ge+"`"+Ze+"."))}return V(be)}function tt(){function z(oe,he,be,de,xe){return G(oe[he])?null:new g("Invalid "+de+" `"+xe+"` supplied to "+("`"+be+"`, expected a ReactNode."))}return V(z)}function Re(z,oe,he,be,de){return new g((z||"React class")+": "+oe+" type `"+he+"."+be+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+de+"`.")}function y(z){function oe(he,be,de,xe,ge){var me=he[be],we=ye(me);if(we!=="object")return new g("Invalid "+xe+" `"+ge+"` of type `"+we+"` "+("supplied to `"+de+"`, expected `object`."));for(var ke in z){var Y=z[ke];if(typeof Y!="function")return Re(de,xe,ge,ke,qe(Y));var Je=Y(me,ke,de,xe,ge+"."+ke,i);if(Je)return Je}return null}return V(oe)}function re(z){function oe(he,be,de,xe,ge){var me=he[be],we=ye(me);if(we!=="object")return new g("Invalid "+xe+" `"+ge+"` of type `"+we+"` "+("supplied to `"+de+"`, expected `object`."));var ke=n({},he[be],z);for(var Y in ke){var Je=z[Y];if(s(z,Y)&&typeof Je!="function")return Re(de,xe,ge,Y,qe(Je));if(!Je)return new g("Invalid "+xe+" `"+ge+"` key `"+Y+"` supplied to `"+de+"`.\nBad object: "+JSON.stringify(he[be],null," ")+`
|
|
20
|
+
Valid keys: `+JSON.stringify(Object.keys(z),null," "));var q=Je(me,Y,de,xe,ge+"."+Y,i);if(q)return q}return null}return V(oe)}function G(z){switch(typeof z){case"number":case"string":case"undefined":return!0;case"boolean":return!z;case"object":if(Array.isArray(z))return z.every(G);if(z===null||m(z))return!0;var oe=A(z);if(oe){var he=oe.call(z),be;if(oe!==z.entries){for(;!(be=he.next()).done;)if(!G(be.value))return!1}else for(;!(be=he.next()).done;){var de=be.value;if(de&&!G(de[1]))return!1}}else return!1;return!0;default:return!1}}function fe(z,oe){return z==="symbol"?!0:oe?oe["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&oe instanceof Symbol:!1}function ye(z){var oe=typeof z;return Array.isArray(z)?"array":z instanceof RegExp?"object":fe(oe,z)?"symbol":oe}function qe(z){if(typeof z>"u"||z===null)return""+z;var oe=ye(z);if(oe==="object"){if(z instanceof Date)return"date";if(z instanceof RegExp)return"regexp"}return oe}function Le(z){var oe=qe(z);switch(oe){case"array":case"object":return"an "+oe;case"boolean":case"date":case"regexp":return"a "+oe;default:return oe}}function rt(z){return!z.constructor||!z.constructor.name?I:z.constructor.name}return K.checkPropTypes=c,K.resetWarningCache=c.resetWarningCache,K.PropTypes=K,K},yo}var go,ki;function Is(){if(ki)return go;ki=1;var t=Po();function n(){}function i(){}return i.resetWarningCache=n,go=function(){function s(h,m,T,_,R,A){if(A!==t){var I=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw I.name="Invariant Violation",I}}s.isRequired=s;function c(){return s}var f={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:c,element:s,elementType:s,instanceOf:c,node:s,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:i,resetWarningCache:n};return f.PropTypes=f,f},go}var Oi;function $s(){if(Oi)return on.exports;if(Oi=1,process.env.NODE_ENV!=="production"){var t=na(),n=!0;on.exports=js()(t.isElement,n)}else on.exports=Is()();return on.exports}var Ds=$s();const Te=ra(Ds);function ia(t){var n,i,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var c=t.length;for(n=0;n<c;n++)t[n]&&(i=ia(t[n]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}function aa(){for(var t,n,i=0,s="",c=arguments.length;i<c;i++)(t=arguments[i])&&(n=ia(t))&&(s&&(s+=" "),s+=n);return s}function Bs(t,n,i=void 0){const s={};for(const c in t){const f=t[c];let h="",m=!0;for(let T=0;T<f.length;T+=1){const _=f[T];_&&(h+=(m===!0?"":" ")+n(_),m=!1,i&&i[_]&&(h+=" "+i[_]))}s[c]=h}return s}var sn={exports:{}},$e={};/**
|
|
21
21
|
* @license React
|
|
22
22
|
* react-is.production.js
|
|
23
23
|
*
|
|
@@ -25,7 +25,7 @@ Valid keys: `+JSON.stringify(Object.keys(z),null," "));var q=Xe(me,Y,pe,xe,ge+"
|
|
|
25
25
|
*
|
|
26
26
|
* This source code is licensed under the MIT license found in the
|
|
27
27
|
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/var
|
|
28
|
+
*/var Ai;function Ms(){if(Ai)return $e;Ai=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.view_transition"),K=Symbol.for("react.client.reference");function M(g){if(typeof g=="object"&&g!==null){var V=g.$$typeof;switch(V){case t:switch(g=g.type,g){case i:case c:case s:case T:case _:case I:return g;default:switch(g=g&&g.$$typeof,g){case h:case m:case A:case R:return g;case f:return g;default:return V}}case n:return V}}}return $e.ContextConsumer=f,$e.ContextProvider=h,$e.Element=t,$e.ForwardRef=m,$e.Fragment=i,$e.Lazy=A,$e.Memo=R,$e.Portal=n,$e.Profiler=c,$e.StrictMode=s,$e.Suspense=T,$e.SuspenseList=_,$e.isContextConsumer=function(g){return M(g)===f},$e.isContextProvider=function(g){return M(g)===h},$e.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===t},$e.isForwardRef=function(g){return M(g)===m},$e.isFragment=function(g){return M(g)===i},$e.isLazy=function(g){return M(g)===A},$e.isMemo=function(g){return M(g)===R},$e.isPortal=function(g){return M(g)===n},$e.isProfiler=function(g){return M(g)===c},$e.isStrictMode=function(g){return M(g)===s},$e.isSuspense=function(g){return M(g)===T},$e.isSuspenseList=function(g){return M(g)===_},$e.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===i||g===c||g===s||g===T||g===_||typeof g=="object"&&g!==null&&(g.$$typeof===A||g.$$typeof===R||g.$$typeof===h||g.$$typeof===f||g.$$typeof===m||g.$$typeof===K||g.getModuleId!==void 0)},$e.typeOf=M,$e}var De={};/**
|
|
29
29
|
* @license React
|
|
30
30
|
* react-is.development.js
|
|
31
31
|
*
|
|
@@ -33,22 +33,22 @@ Valid keys: `+JSON.stringify(Object.keys(z),null," "));var q=Xe(me,Y,pe,xe,ge+"
|
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the MIT license found in the
|
|
35
35
|
* LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/var
|
|
37
|
-
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}const[,s,c]=i,f=Number.isNaN(+s)?s||0:+s;return t.containerQueries(c).up(f)}function Ls(t){const n=(f,h)=>f.replace("@media",h?`@container ${h}`:"@container");function i(f,h){f.up=(...
|
|
36
|
+
*/var Pi;function Ns(){return Pi||(Pi=1,process.env.NODE_ENV!=="production"&&(function(){function t(g){if(typeof g=="object"&&g!==null){var V=g.$$typeof;switch(V){case n:switch(g=g.type,g){case s:case f:case c:case _:case R:case K:return g;default:switch(g=g&&g.$$typeof,g){case m:case T:case I:case A:return g;case h:return g;default:return V}}case i:return V}}}var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),K=Symbol.for("react.view_transition"),M=Symbol.for("react.client.reference");De.ContextConsumer=h,De.ContextProvider=m,De.Element=n,De.ForwardRef=T,De.Fragment=s,De.Lazy=I,De.Memo=A,De.Portal=i,De.Profiler=f,De.StrictMode=c,De.Suspense=_,De.SuspenseList=R,De.isContextConsumer=function(g){return t(g)===h},De.isContextProvider=function(g){return t(g)===m},De.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===n},De.isForwardRef=function(g){return t(g)===T},De.isFragment=function(g){return t(g)===s},De.isLazy=function(g){return t(g)===I},De.isMemo=function(g){return t(g)===A},De.isPortal=function(g){return t(g)===i},De.isProfiler=function(g){return t(g)===f},De.isStrictMode=function(g){return t(g)===c},De.isSuspense=function(g){return t(g)===_},De.isSuspenseList=function(g){return t(g)===R},De.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===s||g===f||g===c||g===_||g===R||typeof g=="object"&&g!==null&&(g.$$typeof===I||g.$$typeof===A||g.$$typeof===m||g.$$typeof===h||g.$$typeof===T||g.$$typeof===M||g.getModuleId!==void 0)},De.typeOf=t})()),De}var Ri;function Ks(){return Ri||(Ri=1,process.env.NODE_ENV==="production"?sn.exports=Ms():sn.exports=Ns()),sn.exports}var fn=Ks();function bt(t){if(typeof t!="object"||t===null)return!1;const n=Object.getPrototypeOf(t);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function sa(t){if(jt.isValidElement(t)||fn.isValidElementType(t)||!bt(t))return t;const n={};return Object.keys(t).forEach(i=>{n[i]=sa(t[i])}),n}function at(t,n,i={clone:!0}){const s=i.clone?{...t}:t;return bt(t)&&bt(n)&&Object.keys(n).forEach(c=>{jt.isValidElement(n[c])||fn.isValidElementType(n[c])?s[c]=n[c]:bt(n[c])&&Object.prototype.hasOwnProperty.call(t,c)&&bt(t[c])?s[c]=at(t[c],n[c],i):i.clone?s[c]=bt(n[c])?sa(n[c]):n[c]:s[c]=n[c]}),s}function Ar(t,n){return n?at(t,n,{clone:!1}):t}const $t=process.env.NODE_ENV!=="production"?Te.oneOfType([Te.number,Te.string,Te.object,Te.array]):{};function ji(t,n){if(!t.containerQueries)return n;const i=Object.keys(n).filter(s=>s.startsWith("@container")).sort((s,c)=>{var h,m;const f=/min-width:\s*([0-9.]+)/;return+(((h=s.match(f))==null?void 0:h[1])||0)-+(((m=c.match(f))==null?void 0:m[1])||0)});return i.length?i.reduce((s,c)=>{const f=n[c];return delete s[c],s[c]=f,s},{...n}):n}function Fs(t,n){return n==="@"||n.startsWith("@")&&(t.some(i=>n.startsWith(`@${i}`))||!!n.match(/^@\d/))}function qs(t,n){const i=n.match(/^@([^/]+)?\/?(.+)?$/);if(!i){if(process.env.NODE_ENV!=="production")throw new Error(`MUI: The provided shorthand ${`(${n})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
37
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}const[,s,c]=i,f=Number.isNaN(+s)?s||0:+s;return t.containerQueries(c).up(f)}function Ls(t){const n=(f,h)=>f.replace("@media",h?`@container ${h}`:"@container");function i(f,h){f.up=(...m)=>n(t.breakpoints.up(...m),h),f.down=(...m)=>n(t.breakpoints.down(...m),h),f.between=(...m)=>n(t.breakpoints.between(...m),h),f.only=(...m)=>n(t.breakpoints.only(...m),h),f.not=(...m)=>{const T=n(t.breakpoints.not(...m),h);return T.includes("not all and")?T.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):T}}const s={},c=f=>(i(s,f),s);return i(c),{...t,containerQueries:c}}const yn={xs:0,sm:600,md:900,lg:1200,xl:1536},Ii={keys:["xs","sm","md","lg","xl"],up:t=>`@media (min-width:${yn[t]}px)`},zs={containerQueries:t=>({up:n=>{let i=typeof n=="number"?n:yn[n]||n;return typeof i=="number"&&(i=`${i}px`),t?`@container ${t} (min-width:${i})`:`@container (min-width:${i})`}})};function wt(t,n,i){const s=t.theme||{};if(Array.isArray(n)){const f=s.breakpoints||Ii;return n.reduce((h,m,T)=>(h[f.up(f.keys[T])]=i(n[T]),h),{})}if(typeof n=="object"){const f=s.breakpoints||Ii;return Object.keys(n).reduce((h,m)=>{if(Fs(f.keys,m)){const T=qs(s.containerQueries?s:zs,m);T&&(h[T]=i(n[m],m))}else if(Object.keys(f.values||yn).includes(m)){const T=f.up(m);h[T]=i(n[m],m)}else{const T=m;h[T]=n[T]}return h},{})}return i(n)}function Vs(t={}){var i;return((i=t.keys)==null?void 0:i.reduce((s,c)=>{const f=t.up(c);return s[f]={},s},{}))||{}}function $i(t,n){return t.reduce((i,s)=>{const c=i[s];return(!c||Object.keys(c).length===0)&&delete i[s],i},n)}function gn(t,n,i=!0){if(!n||typeof n!="string")return null;if(t&&t.vars&&i){const s=`vars.${n}`.split(".").reduce((c,f)=>c&&c[f]?c[f]:null,t);if(s!=null)return s}return n.split(".").reduce((s,c)=>s&&s[c]!=null?s[c]:null,t)}function dn(t,n,i,s=i){let c;return typeof t=="function"?c=t(i):Array.isArray(t)?c=t[i]||s:c=gn(t,i)||s,n&&(c=n(c,s,t)),c}function Ge(t){const{prop:n,cssProperty:i=t.prop,themeKey:s,transform:c}=t,f=h=>{if(h[n]==null)return null;const m=h[n],T=h.theme,_=gn(T,s)||{};return wt(h,m,A=>{let I=dn(_,c,A);return A===I&&typeof A=="string"&&(I=dn(_,c,`${n}${A==="default"?"":Gt(A)}`,A)),i===!1?I:{[i]:I}})};return f.propTypes=process.env.NODE_ENV!=="production"?{[n]:$t}:{},f.filterProps=[n],f}function Ws(t){const n={};return i=>(n[i]===void 0&&(n[i]=t(i)),n[i])}const Us={m:"margin",p:"padding"},Ys={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Di={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Gs=Ws(t=>{if(t.length>2)if(Di[t])t=Di[t];else return[t];const[n,i]=t.split(""),s=Us[n],c=Ys[i]||"";return Array.isArray(c)?c.map(f=>s+f):[s+c]}),vn=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],bn=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],Hs=[...vn,...bn];function Rr(t,n,i,s){const c=gn(t,n,!0)??i;return typeof c=="number"||typeof c=="string"?f=>typeof f=="string"?f:(process.env.NODE_ENV!=="production"&&typeof f!="number"&&console.error(`MUI: Expected ${s} argument to be a number or a string, got ${f}.`),typeof c=="string"?c.startsWith("var(")&&f===0?0:c.startsWith("var(")&&f===1?c:`calc(${f} * ${c})`:c*f):Array.isArray(c)?f=>{if(typeof f=="string")return f;const h=Math.abs(f);process.env.NODE_ENV!=="production"&&(Number.isInteger(h)?h>c.length-1&&console.error([`MUI: The value provided (${h}) overflows.`,`The supported values are: ${JSON.stringify(c)}.`,`${h} > ${c.length-1}, you need to add the missing values.`].join(`
|
|
38
38
|
`)):console.error([`MUI: The \`theme.${n}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${n}\` as a number.`].join(`
|
|
39
|
-
`)));const
|
|
40
|
-
`)),()=>{})}function Po(t){return Rr(t,"spacing",8,"spacing")}function jr(t,n){return typeof n=="string"||n==null?n:t(n)}function Qs(t,n){return i=>t.reduce((s,c)=>(s[c]=jr(n,i),s),{})}function Xs(t,n,i,s){if(!n.includes(i))return null;const c=Gs(i),f=Qs(c,s),h=t[i];return wt(t,h,f)}function ua(t,n){const i=Po(t.theme);return Object.keys(t).map(s=>Xs(t,n,s,i)).reduce(Ar,{})}function Ve(t){return ua(t,gn)}Ve.propTypes=process.env.NODE_ENV!=="production"?gn.reduce((t,n)=>(t[n]=It,t),{}):{};Ve.filterProps=gn;function We(t){return ua(t,vn)}We.propTypes=process.env.NODE_ENV!=="production"?vn.reduce((t,n)=>(t[n]=It,t),{}):{};We.filterProps=vn;process.env.NODE_ENV!=="production"&&Hs.reduce((t,n)=>(t[n]=It,t),{});function bn(...t){const n=t.reduce((s,c)=>(c.filterProps.forEach(f=>{s[f]=c}),s),{}),i=s=>Object.keys(s).reduce((c,f)=>n[f]?Ar(c,n[f](s)):c,{});return i.propTypes=process.env.NODE_ENV!=="production"?t.reduce((s,c)=>Object.assign(s,c.propTypes),{}):{},i.filterProps=t.reduce((s,c)=>s.concat(c.filterProps),[]),i}function ut(t){return typeof t!="number"?t:`${t}px solid`}function ct(t,n){return Ge({prop:t,themeKey:"borders",transform:n})}const Js=ct("border",ut),Zs=ct("borderTop",ut),eu=ct("borderRight",ut),tu=ct("borderBottom",ut),ru=ct("borderLeft",ut),nu=ct("borderColor"),ou=ct("borderTopColor"),iu=ct("borderRightColor"),au=ct("borderBottomColor"),su=ct("borderLeftColor"),uu=ct("outline",ut),cu=ct("outlineColor"),wn=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const n=Rr(t.theme,"shape.borderRadius",4,"borderRadius"),i=s=>({borderRadius:jr(n,s)});return wt(t,t.borderRadius,i)}return null};wn.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:It}:{};wn.filterProps=["borderRadius"];bn(Js,Zs,eu,tu,ru,nu,ou,iu,au,su,wn,uu,cu);const xn=t=>{if(t.gap!==void 0&&t.gap!==null){const n=Rr(t.theme,"spacing",8,"gap"),i=s=>({gap:jr(n,s)});return wt(t,t.gap,i)}return null};xn.propTypes=process.env.NODE_ENV!=="production"?{gap:It}:{};xn.filterProps=["gap"];const Sn=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const n=Rr(t.theme,"spacing",8,"columnGap"),i=s=>({columnGap:jr(n,s)});return wt(t,t.columnGap,i)}return null};Sn.propTypes=process.env.NODE_ENV!=="production"?{columnGap:It}:{};Sn.filterProps=["columnGap"];const _n=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const n=Rr(t.theme,"spacing",8,"rowGap"),i=s=>({rowGap:jr(n,s)});return wt(t,t.rowGap,i)}return null};_n.propTypes=process.env.NODE_ENV!=="production"?{rowGap:It}:{};_n.filterProps=["rowGap"];const lu=Ge({prop:"gridColumn"}),fu=Ge({prop:"gridRow"}),du=Ge({prop:"gridAutoFlow"}),pu=Ge({prop:"gridAutoColumns"}),hu=Ge({prop:"gridAutoRows"}),mu=Ge({prop:"gridTemplateColumns"}),yu=Ge({prop:"gridTemplateRows"}),gu=Ge({prop:"gridTemplateAreas"}),vu=Ge({prop:"gridArea"});bn(xn,Sn,_n,lu,fu,du,pu,hu,mu,yu,gu,vu);function lr(t,n){return n==="grey"?n:t}const bu=Ge({prop:"color",themeKey:"palette",transform:lr}),wu=Ge({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:lr}),xu=Ge({prop:"backgroundColor",themeKey:"palette",transform:lr});bn(bu,wu,xu);function it(t){return t<=1&&t!==0?`${t*100}%`:t}const Su=Ge({prop:"width",transform:it}),Ro=t=>{if(t.maxWidth!==void 0&&t.maxWidth!==null){const n=i=>{var c,f,h,y,T;const s=((h=(f=(c=t.theme)==null?void 0:c.breakpoints)==null?void 0:f.values)==null?void 0:h[i])||mn[i];return s?((T=(y=t.theme)==null?void 0:y.breakpoints)==null?void 0:T.unit)!=="px"?{maxWidth:`${s}${t.theme.breakpoints.unit}`}:{maxWidth:s}:{maxWidth:it(i)}};return wt(t,t.maxWidth,n)}return null};Ro.filterProps=["maxWidth"];const _u=Ge({prop:"minWidth",transform:it}),Cu=Ge({prop:"height",transform:it}),Eu=Ge({prop:"maxHeight",transform:it}),Tu=Ge({prop:"minHeight",transform:it});Ge({prop:"size",cssProperty:"width",transform:it});Ge({prop:"size",cssProperty:"height",transform:it});const ku=Ge({prop:"boxSizing"});bn(Su,Ro,_u,Cu,Eu,Tu,ku);const Cn={border:{themeKey:"borders",transform:ut},borderTop:{themeKey:"borders",transform:ut},borderRight:{themeKey:"borders",transform:ut},borderBottom:{themeKey:"borders",transform:ut},borderLeft:{themeKey:"borders",transform:ut},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:ut},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:wn},color:{themeKey:"palette",transform:lr},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:lr},backgroundColor:{themeKey:"palette",transform:lr},p:{style:We},pt:{style:We},pr:{style:We},pb:{style:We},pl:{style:We},px:{style:We},py:{style:We},padding:{style:We},paddingTop:{style:We},paddingRight:{style:We},paddingBottom:{style:We},paddingLeft:{style:We},paddingX:{style:We},paddingY:{style:We},paddingInline:{style:We},paddingInlineStart:{style:We},paddingInlineEnd:{style:We},paddingBlock:{style:We},paddingBlockStart:{style:We},paddingBlockEnd:{style:We},m:{style:Ve},mt:{style:Ve},mr:{style:Ve},mb:{style:Ve},ml:{style:Ve},mx:{style:Ve},my:{style:Ve},margin:{style:Ve},marginTop:{style:Ve},marginRight:{style:Ve},marginBottom:{style:Ve},marginLeft:{style:Ve},marginX:{style:Ve},marginY:{style:Ve},marginInline:{style:Ve},marginInlineStart:{style:Ve},marginInlineEnd:{style:Ve},marginBlock:{style:Ve},marginBlockStart:{style:Ve},marginBlockEnd:{style:Ve},displayPrint:{cssProperty:!1,transform:t=>({"@media print":{display:t}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:xn},rowGap:{style:_n},columnGap:{style:Sn},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:it},maxWidth:{style:Ro},minWidth:{transform:it},height:{transform:it},maxHeight:{transform:it},minHeight:{transform:it},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Ou(...t){const n=t.reduce((s,c)=>s.concat(Object.keys(c)),[]),i=new Set(n);return t.every(s=>i.size===Object.keys(s).length)}function Au(t,n){return typeof t=="function"?t(n):t}function Pu(){function t(i,s,c,f){const h={[i]:s,theme:c},y=f[i];if(!y)return{[i]:s};const{cssProperty:T=i,themeKey:_,transform:R,style:A}=y;if(s==null)return null;if(_==="typography"&&s==="inherit")return{[i]:s};const I=yn(c,_)||{};return A?A(h):wt(h,s,M=>{let g=dn(I,R,M);return M===g&&typeof M=="string"&&(g=dn(I,R,`${i}${M==="default"?"":Gt(M)}`,M)),T===!1?g:{[T]:g}})}function n(i){const{sx:s,theme:c={},nested:f}=i||{};if(!s)return null;const h=c.unstable_sxConfig??Cn;function y(T){let _=T;if(typeof T=="function")_=T(c);else if(typeof T!="object")return T;if(!_)return null;const R=Vs(c.breakpoints),A=Object.keys(R);let I=R;return Object.keys(_).forEach(F=>{const M=Au(_[F],c);if(M!=null)if(typeof M=="object")if(h[F])I=Ar(I,t(F,M,c,h));else{const g=wt({theme:c},M,V=>({[F]:V}));Ou(g,M)?I[F]=n({sx:M,theme:c,nested:!0}):I=Ar(I,g)}else I=Ar(I,t(F,M,c,h))}),!f&&c.modularCssLayers?{"@layer sx":Ri(c,Ii(A,I))}:Ri(c,Ii(A,I))}return Array.isArray(s)?s.map(y):y(s)}return n}const fr=Pu();fr.filterProps=["sx"];function Ru(t){for(var n=0,i,s=0,c=t.length;c>=4;++s,c-=4)i=t.charCodeAt(s)&255|(t.charCodeAt(++s)&255)<<8|(t.charCodeAt(++s)&255)<<16|(t.charCodeAt(++s)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,n=(i&65535)*1540483477+((i>>>16)*59797<<16)^(n&65535)*1540483477+((n>>>16)*59797<<16);switch(c){case 3:n^=(t.charCodeAt(s+2)&255)<<16;case 2:n^=(t.charCodeAt(s+1)&255)<<8;case 1:n^=t.charCodeAt(s)&255,n=(n&65535)*1540483477+((n>>>16)*59797<<16)}return n^=n>>>13,n=(n&65535)*1540483477+((n>>>16)*59797<<16),((n^n>>>15)>>>0).toString(36)}var ju={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Iu(t){var n=Object.create(null);return function(i){return n[i]===void 0&&(n[i]=t(i)),n[i]}}var $u=/[A-Z]|^ms/g,Du=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ca=function(n){return n.charCodeAt(1)===45},Di=function(n){return n!=null&&typeof n!="boolean"},go=Iu(function(t){return ca(t)?t:t.replace($u,"-$&").toLowerCase()}),Bi=function(n,i){switch(n){case"animation":case"animationName":if(typeof i=="string")return i.replace(Du,function(s,c,f){return At={name:c,styles:f,next:At},c})}return ju[n]!==1&&!ca(n)&&typeof i=="number"&&i!==0?i+"px":i};function pn(t,n,i){if(i==null)return"";var s=i;if(s.__emotion_styles!==void 0)return s;switch(typeof i){case"boolean":return"";case"object":{var c=i;if(c.anim===1)return At={name:c.name,styles:c.styles,next:At},c.name;var f=i;if(f.styles!==void 0){var h=f.next;if(h!==void 0)for(;h!==void 0;)At={name:h.name,styles:h.styles,next:At},h=h.next;var y=f.styles+";";return y}return Bu(t,n,i)}}var T=i;return T}function Bu(t,n,i){var s="";if(Array.isArray(i))for(var c=0;c<i.length;c++)s+=pn(t,n,i[c])+";";else for(var f in i){var h=i[f];if(typeof h!="object"){var y=h;Di(y)&&(s+=go(f)+":"+Bi(f,y)+";")}else if(Array.isArray(h)&&typeof h[0]=="string"&&n==null)for(var T=0;T<h.length;T++)Di(h[T])&&(s+=go(f)+":"+Bi(f,h[T])+";");else{var _=pn(t,n,h);switch(f){case"animation":case"animationName":{s+=go(f)+":"+_+";";break}default:s+=f+"{"+_+"}"}}}return s}var Mi=/label:\s*([^\s;{]+)\s*(;|$)/g,At;function Mu(t,n,i){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var s=!0,c="";At=void 0;var f=t[0];if(f==null||f.raw===void 0)s=!1,c+=pn(i,n,f);else{var h=f;c+=h[0]}for(var y=1;y<t.length;y++)if(c+=pn(i,n,t[y]),s){var T=f;c+=T[y]}Mi.lastIndex=0;for(var _="",R;(R=Mi.exec(c))!==null;)_+="-"+R[1];var A=Ru(c)+_;return{name:A,styles:c,next:At}}/**
|
|
39
|
+
`)));const m=c[h];return f>=0?m:typeof m=="number"?-m:typeof m=="string"&&m.startsWith("var(")?`calc(-1 * ${m})`:`-${m}`}:typeof c=="function"?c:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${n}\` value (${c}) is invalid.`,"It should be a number, an array or a function."].join(`
|
|
40
|
+
`)),()=>{})}function Ro(t){return Rr(t,"spacing",8,"spacing")}function jr(t,n){return typeof n=="string"||n==null?n:t(n)}function Qs(t,n){return i=>t.reduce((s,c)=>(s[c]=jr(n,i),s),{})}function Xs(t,n,i,s){if(!n.includes(i))return null;const c=Gs(i),f=Qs(c,s),h=t[i];return wt(t,h,f)}function ua(t,n){const i=Ro(t.theme);return Object.keys(t).map(s=>Xs(t,n,s,i)).reduce(Ar,{})}function Ve(t){return ua(t,vn)}Ve.propTypes=process.env.NODE_ENV!=="production"?vn.reduce((t,n)=>(t[n]=$t,t),{}):{};Ve.filterProps=vn;function We(t){return ua(t,bn)}We.propTypes=process.env.NODE_ENV!=="production"?bn.reduce((t,n)=>(t[n]=$t,t),{}):{};We.filterProps=bn;process.env.NODE_ENV!=="production"&&Hs.reduce((t,n)=>(t[n]=$t,t),{});function wn(...t){const n=t.reduce((s,c)=>(c.filterProps.forEach(f=>{s[f]=c}),s),{}),i=s=>Object.keys(s).reduce((c,f)=>n[f]?Ar(c,n[f](s)):c,{});return i.propTypes=process.env.NODE_ENV!=="production"?t.reduce((s,c)=>Object.assign(s,c.propTypes),{}):{},i.filterProps=t.reduce((s,c)=>s.concat(c.filterProps),[]),i}function ut(t){return typeof t!="number"?t:`${t}px solid`}function ct(t,n){return Ge({prop:t,themeKey:"borders",transform:n})}const Js=ct("border",ut),Zs=ct("borderTop",ut),eu=ct("borderRight",ut),tu=ct("borderBottom",ut),ru=ct("borderLeft",ut),nu=ct("borderColor"),ou=ct("borderTopColor"),iu=ct("borderRightColor"),au=ct("borderBottomColor"),su=ct("borderLeftColor"),uu=ct("outline",ut),cu=ct("outlineColor"),xn=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const n=Rr(t.theme,"shape.borderRadius",4,"borderRadius"),i=s=>({borderRadius:jr(n,s)});return wt(t,t.borderRadius,i)}return null};xn.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:$t}:{};xn.filterProps=["borderRadius"];wn(Js,Zs,eu,tu,ru,nu,ou,iu,au,su,xn,uu,cu);const Sn=t=>{if(t.gap!==void 0&&t.gap!==null){const n=Rr(t.theme,"spacing",8,"gap"),i=s=>({gap:jr(n,s)});return wt(t,t.gap,i)}return null};Sn.propTypes=process.env.NODE_ENV!=="production"?{gap:$t}:{};Sn.filterProps=["gap"];const _n=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const n=Rr(t.theme,"spacing",8,"columnGap"),i=s=>({columnGap:jr(n,s)});return wt(t,t.columnGap,i)}return null};_n.propTypes=process.env.NODE_ENV!=="production"?{columnGap:$t}:{};_n.filterProps=["columnGap"];const Cn=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const n=Rr(t.theme,"spacing",8,"rowGap"),i=s=>({rowGap:jr(n,s)});return wt(t,t.rowGap,i)}return null};Cn.propTypes=process.env.NODE_ENV!=="production"?{rowGap:$t}:{};Cn.filterProps=["rowGap"];const lu=Ge({prop:"gridColumn"}),fu=Ge({prop:"gridRow"}),du=Ge({prop:"gridAutoFlow"}),pu=Ge({prop:"gridAutoColumns"}),hu=Ge({prop:"gridAutoRows"}),mu=Ge({prop:"gridTemplateColumns"}),yu=Ge({prop:"gridTemplateRows"}),gu=Ge({prop:"gridTemplateAreas"}),vu=Ge({prop:"gridArea"});wn(Sn,_n,Cn,lu,fu,du,pu,hu,mu,yu,gu,vu);function lr(t,n){return n==="grey"?n:t}const bu=Ge({prop:"color",themeKey:"palette",transform:lr}),wu=Ge({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:lr}),xu=Ge({prop:"backgroundColor",themeKey:"palette",transform:lr});wn(bu,wu,xu);function it(t){return t<=1&&t!==0?`${t*100}%`:t}const Su=Ge({prop:"width",transform:it}),jo=t=>{if(t.maxWidth!==void 0&&t.maxWidth!==null){const n=i=>{var c,f,h,m,T;const s=((h=(f=(c=t.theme)==null?void 0:c.breakpoints)==null?void 0:f.values)==null?void 0:h[i])||yn[i];return s?((T=(m=t.theme)==null?void 0:m.breakpoints)==null?void 0:T.unit)!=="px"?{maxWidth:`${s}${t.theme.breakpoints.unit}`}:{maxWidth:s}:{maxWidth:it(i)}};return wt(t,t.maxWidth,n)}return null};jo.filterProps=["maxWidth"];const _u=Ge({prop:"minWidth",transform:it}),Cu=Ge({prop:"height",transform:it}),Eu=Ge({prop:"maxHeight",transform:it}),Tu=Ge({prop:"minHeight",transform:it});Ge({prop:"size",cssProperty:"width",transform:it});Ge({prop:"size",cssProperty:"height",transform:it});const ku=Ge({prop:"boxSizing"});wn(Su,jo,_u,Cu,Eu,Tu,ku);const En={border:{themeKey:"borders",transform:ut},borderTop:{themeKey:"borders",transform:ut},borderRight:{themeKey:"borders",transform:ut},borderBottom:{themeKey:"borders",transform:ut},borderLeft:{themeKey:"borders",transform:ut},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:ut},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:xn},color:{themeKey:"palette",transform:lr},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:lr},backgroundColor:{themeKey:"palette",transform:lr},p:{style:We},pt:{style:We},pr:{style:We},pb:{style:We},pl:{style:We},px:{style:We},py:{style:We},padding:{style:We},paddingTop:{style:We},paddingRight:{style:We},paddingBottom:{style:We},paddingLeft:{style:We},paddingX:{style:We},paddingY:{style:We},paddingInline:{style:We},paddingInlineStart:{style:We},paddingInlineEnd:{style:We},paddingBlock:{style:We},paddingBlockStart:{style:We},paddingBlockEnd:{style:We},m:{style:Ve},mt:{style:Ve},mr:{style:Ve},mb:{style:Ve},ml:{style:Ve},mx:{style:Ve},my:{style:Ve},margin:{style:Ve},marginTop:{style:Ve},marginRight:{style:Ve},marginBottom:{style:Ve},marginLeft:{style:Ve},marginX:{style:Ve},marginY:{style:Ve},marginInline:{style:Ve},marginInlineStart:{style:Ve},marginInlineEnd:{style:Ve},marginBlock:{style:Ve},marginBlockStart:{style:Ve},marginBlockEnd:{style:Ve},displayPrint:{cssProperty:!1,transform:t=>({"@media print":{display:t}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Sn},rowGap:{style:Cn},columnGap:{style:_n},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:it},maxWidth:{style:jo},minWidth:{transform:it},height:{transform:it},maxHeight:{transform:it},minHeight:{transform:it},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Ou(...t){const n=t.reduce((s,c)=>s.concat(Object.keys(c)),[]),i=new Set(n);return t.every(s=>i.size===Object.keys(s).length)}function Au(t,n){return typeof t=="function"?t(n):t}function Pu(){function t(i,s,c,f){const h={[i]:s,theme:c},m=f[i];if(!m)return{[i]:s};const{cssProperty:T=i,themeKey:_,transform:R,style:A}=m;if(s==null)return null;if(_==="typography"&&s==="inherit")return{[i]:s};const I=gn(c,_)||{};return A?A(h):wt(h,s,M=>{let g=dn(I,R,M);return M===g&&typeof M=="string"&&(g=dn(I,R,`${i}${M==="default"?"":Gt(M)}`,M)),T===!1?g:{[T]:g}})}function n(i){const{sx:s,theme:c={},nested:f}=i||{};if(!s)return null;const h=c.unstable_sxConfig??En;function m(T){let _=T;if(typeof T=="function")_=T(c);else if(typeof T!="object")return T;if(!_)return null;const R=Vs(c.breakpoints),A=Object.keys(R);let I=R;return Object.keys(_).forEach(K=>{const M=Au(_[K],c);if(M!=null)if(typeof M=="object")if(h[K])I=Ar(I,t(K,M,c,h));else{const g=wt({theme:c},M,V=>({[K]:V}));Ou(g,M)?I[K]=n({sx:M,theme:c,nested:!0}):I=Ar(I,g)}else I=Ar(I,t(K,M,c,h))}),!f&&c.modularCssLayers?{"@layer sx":ji(c,$i(A,I))}:ji(c,$i(A,I))}return Array.isArray(s)?s.map(m):m(s)}return n}const fr=Pu();fr.filterProps=["sx"];function Ru(t){for(var n=0,i,s=0,c=t.length;c>=4;++s,c-=4)i=t.charCodeAt(s)&255|(t.charCodeAt(++s)&255)<<8|(t.charCodeAt(++s)&255)<<16|(t.charCodeAt(++s)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,n=(i&65535)*1540483477+((i>>>16)*59797<<16)^(n&65535)*1540483477+((n>>>16)*59797<<16);switch(c){case 3:n^=(t.charCodeAt(s+2)&255)<<16;case 2:n^=(t.charCodeAt(s+1)&255)<<8;case 1:n^=t.charCodeAt(s)&255,n=(n&65535)*1540483477+((n>>>16)*59797<<16)}return n^=n>>>13,n=(n&65535)*1540483477+((n>>>16)*59797<<16),((n^n>>>15)>>>0).toString(36)}var ju={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Iu(t){var n=Object.create(null);return function(i){return n[i]===void 0&&(n[i]=t(i)),n[i]}}var $u=/[A-Z]|^ms/g,Du=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ca=function(n){return n.charCodeAt(1)===45},Bi=function(n){return n!=null&&typeof n!="boolean"},vo=Iu(function(t){return ca(t)?t:t.replace($u,"-$&").toLowerCase()}),Mi=function(n,i){switch(n){case"animation":case"animationName":if(typeof i=="string")return i.replace(Du,function(s,c,f){return Rt={name:c,styles:f,next:Rt},c})}return ju[n]!==1&&!ca(n)&&typeof i=="number"&&i!==0?i+"px":i};function pn(t,n,i){if(i==null)return"";var s=i;if(s.__emotion_styles!==void 0)return s;switch(typeof i){case"boolean":return"";case"object":{var c=i;if(c.anim===1)return Rt={name:c.name,styles:c.styles,next:Rt},c.name;var f=i;if(f.styles!==void 0){var h=f.next;if(h!==void 0)for(;h!==void 0;)Rt={name:h.name,styles:h.styles,next:Rt},h=h.next;var m=f.styles+";";return m}return Bu(t,n,i)}}var T=i;return T}function Bu(t,n,i){var s="";if(Array.isArray(i))for(var c=0;c<i.length;c++)s+=pn(t,n,i[c])+";";else for(var f in i){var h=i[f];if(typeof h!="object"){var m=h;Bi(m)&&(s+=vo(f)+":"+Mi(f,m)+";")}else if(Array.isArray(h)&&typeof h[0]=="string"&&n==null)for(var T=0;T<h.length;T++)Bi(h[T])&&(s+=vo(f)+":"+Mi(f,h[T])+";");else{var _=pn(t,n,h);switch(f){case"animation":case"animationName":{s+=vo(f)+":"+_+";";break}default:s+=f+"{"+_+"}"}}}return s}var Ni=/label:\s*([^\s;{]+)\s*(;|$)/g,Rt;function Mu(t,n,i){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var s=!0,c="";Rt=void 0;var f=t[0];if(f==null||f.raw===void 0)s=!1,c+=pn(i,n,f);else{var h=f;c+=h[0]}for(var m=1;m<t.length;m++)if(c+=pn(i,n,t[m]),s){var T=f;c+=T[m]}Ni.lastIndex=0;for(var _="",R;(R=Ni.exec(c))!==null;)_+="-"+R[1];var A=Ru(c)+_;return{name:A,styles:c,next:Rt}}/**
|
|
41
41
|
* @mui/styled-engine v7.3.8
|
|
42
42
|
*
|
|
43
43
|
* @license MIT
|
|
44
44
|
* This source code is licensed under the MIT license found in the
|
|
45
45
|
* LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/function Nu(t,n){const i=bs(t,n);return process.env.NODE_ENV!=="production"?(...s)=>{const c=typeof t=="string"?`"${t}"`:"component";return s.length===0?console.error([`MUI: Seems like you called \`styled(${c})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
47
|
-
`)):s.some(f=>f===void 0)&&console.error(`MUI: the styled(${c})(...args) API requires all its args to be defined.`),i(...s)}:i}function Ku(t,n){Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=n(t.__emotion_styles))}const
|
|
47
|
+
`)):s.some(f=>f===void 0)&&console.error(`MUI: the styled(${c})(...args) API requires all its args to be defined.`),i(...s)}:i}function Ku(t,n){Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=n(t.__emotion_styles))}const Ki=[];function Ut(t){return Ki[0]=t,Mu(Ki)}const Fu=t=>{const n=Object.keys(t).map(i=>({key:i,val:t[i]}))||[];return n.sort((i,s)=>i.val-s.val),n.reduce((i,s)=>({...i,[s.key]:s.val}),{})};function qu(t){const{values:n={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:i="px",step:s=5,...c}=t,f=Fu(n),h=Object.keys(f);function m(I){return`@media (min-width:${typeof n[I]=="number"?n[I]:I}${i})`}function T(I){return`@media (max-width:${(typeof n[I]=="number"?n[I]:I)-s/100}${i})`}function _(I,K){const M=h.indexOf(K);return`@media (min-width:${typeof n[I]=="number"?n[I]:I}${i}) and (max-width:${(M!==-1&&typeof n[h[M]]=="number"?n[h[M]]:K)-s/100}${i})`}function R(I){return h.indexOf(I)+1<h.length?_(I,h[h.indexOf(I)+1]):m(I)}function A(I){const K=h.indexOf(I);return K===0?m(h[1]):K===h.length-1?T(h[K]):_(I,h[h.indexOf(I)+1]).replace("@media","@media not all and")}return{keys:h,values:f,up:m,down:T,between:_,only:R,not:A,unit:i,...c}}const Lu={borderRadius:4};function la(t=8,n=Ro({spacing:t})){if(t.mui)return t;const i=(...s)=>(process.env.NODE_ENV!=="production"&&(s.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${s.length}`)),(s.length===0?[1]:s).map(f=>{const h=n(f);return typeof h=="number"?`${h}px`:h}).join(" "));return i.mui=!0,i}function zu(t,n){var s;const i=this;if(i.vars){if(!((s=i.colorSchemes)!=null&&s[t])||typeof i.getColorSchemeSelector!="function")return{};let c=i.getColorSchemeSelector(t);return c==="&"?n:((c.includes("data-")||c.includes("."))&&(c=`*:where(${c.replace(/\s*&$/,"")}) &`),{[c]:n})}return i.palette.mode===t?n:{}}function fa(t={},...n){const{breakpoints:i={},palette:s={},spacing:c,shape:f={},...h}=t,m=qu(i),T=la(c);let _=at({breakpoints:m,direction:"ltr",components:{},palette:{mode:"light",...s},spacing:T,shape:{...Lu,...f}},h);return _=Ls(_),_.applyStyles=zu,_=n.reduce((R,A)=>at(R,A),_),_.unstable_sxConfig={...En,...h==null?void 0:h.unstable_sxConfig},_.unstable_sx=function(A){return fr({sx:A,theme:this})},_}const Vu={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Io(t,n,i="Mui"){const s=Vu[n];return s?`${i}-${s}`:`${Ts.generate(t)}-${n}`}function Wu(t,n,i="Mui"){const s={};return n.forEach(c=>{s[c]=Io(t,c,i)}),s}function da(t,n=""){return t.displayName||t.name||n}function Fi(t,n,i){const s=da(n);return t.displayName||(s!==""?`${i}(${s})`:i)}function Uu(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="function")return da(t,"Component");if(typeof t=="object")switch(t.$$typeof){case fn.ForwardRef:return Fi(t,t.render,"ForwardRef");case fn.Memo:return Fi(t,t.type,"memo");default:return}}}function pa(t){const{variants:n,...i}=t,s={variants:n,style:Ut(i),isProcessed:!0};return s.style===i||n&&n.forEach(c=>{typeof c.style!="function"&&(c.style=Ut(c.style))}),s}const Yu=fa();function bo(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function Wt(t,n){return n&&t&&typeof t=="object"&&t.styles&&!t.styles.startsWith("@layer")&&(t.styles=`@layer ${n}{${String(t.styles)}}`),t}function Gu(t){return t?(n,i)=>i[t]:null}function Hu(t,n,i){t.theme=Zu(t.theme)?i:t.theme[n]||t.theme}function cn(t,n,i){const s=typeof n=="function"?n(t):n;if(Array.isArray(s))return s.flatMap(c=>cn(t,c,i));if(Array.isArray(s==null?void 0:s.variants)){let c;if(s.isProcessed)c=i?Wt(s.style,i):s.style;else{const{variants:f,...h}=s;c=i?Wt(Ut(h),i):h}return ha(t,s.variants,[c],i)}return s!=null&&s.isProcessed?i?Wt(Ut(s.style),i):s.style:i?Wt(Ut(s),i):s}function ha(t,n,i=[],s=void 0){var f;let c;e:for(let h=0;h<n.length;h+=1){const m=n[h];if(typeof m.props=="function"){if(c??(c={...t,...t.ownerState,ownerState:t.ownerState}),!m.props(c))continue}else for(const T in m.props)if(t[T]!==m.props[T]&&((f=t.ownerState)==null?void 0:f[T])!==m.props[T])continue e;typeof m.style=="function"?(c??(c={...t,...t.ownerState,ownerState:t.ownerState}),i.push(s?Wt(Ut(m.style(c)),s):m.style(c))):i.push(s?Wt(Ut(m.style),s):m.style)}return i}function Qu(t={}){const{themeId:n,defaultTheme:i=Yu,rootShouldForwardProp:s=bo,slotShouldForwardProp:c=bo}=t;function f(m){Hu(m,n,i)}return(m,T={})=>{Ku(m,ee=>ee.filter(pe=>pe!==fr));const{name:_,slot:R,skipVariantsResolver:A,skipSx:I,overridesResolver:K=Gu(ma(R)),...M}=T,g=_&&_.startsWith("Mui")||R?"components":"custom",V=A!==void 0?A:R&&R!=="Root"&&R!=="root"||!1,J=I||!1;let ae=bo;R==="Root"||R==="root"?ae=s:R?ae=c:ec(m)&&(ae=void 0);const ce=Nu(m,{shouldForwardProp:ae,label:Ju(_,R),...M}),W=ee=>{if(ee.__emotion_real===ee)return ee;if(typeof ee=="function")return function(Pe){return cn(Pe,ee,Pe.theme.modularCssLayers?g:void 0)};if(bt(ee)){const pe=pa(ee);return function(Ke){return pe.variants?cn(Ke,pe,Ke.theme.modularCssLayers?g:void 0):Ke.theme.modularCssLayers?Wt(pe.style,g):pe.style}}return ee},F=(...ee)=>{const pe=[],Pe=ee.map(W),Ke=[];if(pe.push(f),_&&K&&Ke.push(function(re){var qe,Le;const fe=(Le=(qe=re.theme.components)==null?void 0:qe[_])==null?void 0:Le.styleOverrides;if(!fe)return null;const ye={};for(const rt in fe)ye[rt]=cn(re,fe[rt],re.theme.modularCssLayers?"theme":void 0);return K(re,ye)}),_&&!V&&Ke.push(function(re){var ye,qe;const G=re.theme,fe=(qe=(ye=G==null?void 0:G.components)==null?void 0:ye[_])==null?void 0:qe.variants;return fe?ha(re,fe,[],re.theme.modularCssLayers?"theme":void 0):null}),J||Ke.push(fr),Array.isArray(Pe[0])){const y=Pe.shift(),re=new Array(pe.length).fill(""),G=new Array(Ke.length).fill("");let fe;fe=[...re,...y,...G],fe.raw=[...re,...y.raw,...G],pe.unshift(fe)}const tt=[...pe,...Pe,...Ke],Re=ce(...tt);return m.muiName&&(Re.muiName=m.muiName),process.env.NODE_ENV!=="production"&&(Re.displayName=Xu(_,R,m)),Re};return ce.withConfig&&(F.withConfig=ce.withConfig),F}}function Xu(t,n,i){return t?`${t}${Gt(n||"")}`:`Styled(${Uu(i)})`}function Ju(t,n){let i;return process.env.NODE_ENV!=="production"&&t&&(i=`${t}-${ma(n||"Root")}`),i}function Zu(t){for(const n in t)return!1;return!0}function ec(t){return typeof t=="string"&&t.charCodeAt(0)>96}function ma(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}function _o(t,n,i=!1){const s={...n};for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const f=c;if(f==="components"||f==="slots")s[f]={...t[f],...s[f]};else if(f==="componentsProps"||f==="slotProps"){const h=t[f],m=n[f];if(!m)s[f]=h||{};else if(!h)s[f]=m;else{s[f]={...m};for(const T in h)if(Object.prototype.hasOwnProperty.call(h,T)){const _=T;s[f][_]=_o(h[_],m[_],i)}}}else f==="className"&&i&&n.className?s.className=aa(t==null?void 0:t.className,n==null?void 0:n.className):f==="style"&&i&&n.style?s.style={...t==null?void 0:t.style,...n==null?void 0:n.style}:s[f]===void 0&&(s[f]=t[f])}return s}function tc(t,n=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(t,i))}function $o(t,n=0,i=1){return process.env.NODE_ENV!=="production"&&(t<n||t>i)&&console.error(`MUI: The value provided ${t} is out of range [${n}, ${i}].`),tc(t,n,i)}function rc(t){t=t.slice(1);const n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let i=t.match(n);return i&&i[0].length===1&&(i=i.map(s=>s+s)),process.env.NODE_ENV!=="production"&&t.length!==t.trim().length&&console.error(`MUI: The color: "${t}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),i?`rgb${i.length===4?"a":""}(${i.map((s,c)=>c<3?parseInt(s,16):Math.round(parseInt(s,16)/255*1e3)/1e3).join(", ")})`:""}function It(t){if(t.type)return t;if(t.charAt(0)==="#")return It(rc(t));const n=t.indexOf("("),i=t.substring(0,n);if(!["rgb","rgba","hsl","hsla","color"].includes(i))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${t}\` color.
|
|
48
48
|
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Yt(9,t));let s=t.substring(n+1,t.length-1),c;if(i==="color"){if(s=s.split(" "),c=s.shift(),s.length===4&&s[3].charAt(0)==="/"&&(s[3]=s[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(c))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${c}\` color space.
|
|
49
|
-
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Yt(10,c))}else s=s.split(",");return s=s.map(f=>parseFloat(f)),{type:i,values:s,colorSpace:c}}const nc=t=>{const n=
|
|
50
|
-
`))}return
|
|
51
|
-
The color object needs to have a \`main\` property or a \`${
|
|
49
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Yt(10,c))}else s=s.split(",");return s=s.map(f=>parseFloat(f)),{type:i,values:s,colorSpace:c}}const nc=t=>{const n=It(t);return n.values.slice(0,3).map((i,s)=>n.type.includes("hsl")&&s!==0?`${i}%`:i).join(" ")},kr=(t,n)=>{try{return nc(t)}catch{return n&&process.env.NODE_ENV!=="production"&&console.warn(n),t}};function Tn(t){const{type:n,colorSpace:i}=t;let{values:s}=t;return n.includes("rgb")?s=s.map((c,f)=>f<3?parseInt(c,10):c):n.includes("hsl")&&(s[1]=`${s[1]}%`,s[2]=`${s[2]}%`),n.includes("color")?s=`${i} ${s.join(" ")}`:s=`${s.join(", ")}`,`${n}(${s})`}function ya(t){t=It(t);const{values:n}=t,i=n[0],s=n[1]/100,c=n[2]/100,f=s*Math.min(c,1-c),h=(_,R=(_+i/30)%12)=>c-f*Math.max(Math.min(R-3,9-R,1),-1);let m="rgb";const T=[Math.round(h(0)*255),Math.round(h(8)*255),Math.round(h(4)*255)];return t.type==="hsla"&&(m+="a",T.push(n[3])),Tn({type:m,values:T})}function Co(t){t=It(t);let n=t.type==="hsl"||t.type==="hsla"?It(ya(t)).values:t.values;return n=n.map(i=>(t.type!=="color"&&(i/=255),i<=.03928?i/12.92:((i+.055)/1.055)**2.4)),Number((.2126*n[0]+.7152*n[1]+.0722*n[2]).toFixed(3))}function qi(t,n){const i=Co(t),s=Co(n);return(Math.max(i,s)+.05)/(Math.min(i,s)+.05)}function ga(t,n){return t=It(t),n=$o(n),(t.type==="rgb"||t.type==="hsl")&&(t.type+="a"),t.type==="color"?t.values[3]=`/${n}`:t.values[3]=n,Tn(t)}function Vt(t,n,i){try{return ga(t,n)}catch{return i&&process.env.NODE_ENV!=="production"&&console.warn(i),t}}function kn(t,n){if(t=It(t),n=$o(n),t.type.includes("hsl"))t.values[2]*=1-n;else if(t.type.includes("rgb")||t.type.includes("color"))for(let i=0;i<3;i+=1)t.values[i]*=1-n;return Tn(t)}function je(t,n,i){try{return kn(t,n)}catch{return i&&process.env.NODE_ENV!=="production"&&console.warn(i),t}}function On(t,n){if(t=It(t),n=$o(n),t.type.includes("hsl"))t.values[2]+=(100-t.values[2])*n;else if(t.type.includes("rgb"))for(let i=0;i<3;i+=1)t.values[i]+=(255-t.values[i])*n;else if(t.type.includes("color"))for(let i=0;i<3;i+=1)t.values[i]+=(1-t.values[i])*n;return Tn(t)}function Ie(t,n,i){try{return On(t,n)}catch{return i&&process.env.NODE_ENV!=="production"&&console.warn(i),t}}function oc(t,n=.15){return Co(t)>.5?kn(t,n):On(t,n)}function un(t,n,i){try{return oc(t,n)}catch{return t}}const ic=jt.createContext(void 0);process.env.NODE_ENV!=="production"&&(Te.node,Te.object);function ac(t){const{theme:n,name:i,props:s}=t;if(!n||!n.components||!n.components[i])return s;const c=n.components[i];return c.defaultProps?_o(c.defaultProps,s,n.components.mergeClassNameAndStyle):!c.styleOverrides&&!c.variants?_o(c,s,n.components.mergeClassNameAndStyle):s}function sc({props:t,name:n}){const i=jt.useContext(ic);return ac({props:t,name:n,theme:{components:i}})}const Li={theme:void 0};function uc(t){let n,i;return function(c){let f=n;return(f===void 0||c.theme!==i)&&(Li.theme=c.theme,f=pa(t(Li)),n=f,i=c.theme),f}}function cc(t=""){function n(...s){if(!s.length)return"";const c=s[0];return typeof c=="string"&&!c.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${t?`${t}-`:""}${c}${n(...s.slice(1))})`:`, ${c}`}return(s,...c)=>`var(--${t?`${t}-`:""}${s}${n(...c)})`}const zi=(t,n,i,s=[])=>{let c=t;n.forEach((f,h)=>{h===n.length-1?Array.isArray(c)?c[Number(f)]=i:c&&typeof c=="object"&&(c[f]=i):c&&typeof c=="object"&&(c[f]||(c[f]=s.includes(f)?[]:{}),c=c[f])})},lc=(t,n,i)=>{function s(c,f=[],h=[]){Object.entries(c).forEach(([m,T])=>{(!i||i&&!i([...f,m]))&&T!=null&&(typeof T=="object"&&Object.keys(T).length>0?s(T,[...f,m],Array.isArray(T)?[...h,m]:h):n([...f,m],T,h))})}s(t)},fc=(t,n)=>typeof n=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(s=>t.includes(s))||t[t.length-1].toLowerCase().includes("opacity")?n:`${n}px`:n;function wo(t,n){const{prefix:i,shouldSkipGeneratingVar:s}=n||{},c={},f={},h={};return lc(t,(m,T,_)=>{if((typeof T=="string"||typeof T=="number")&&(!s||!s(m,T))){const R=`--${i?`${i}-`:""}${m.join("-")}`,A=fc(m,T);Object.assign(c,{[R]:A}),zi(f,m,`var(${R})`,_),zi(h,m,`var(${R}, ${A})`,_)}},m=>m[0]==="vars"),{css:c,vars:f,varsWithDefaults:h}}function dc(t,n={}){const{getSelector:i=J,disableCssColorScheme:s,colorSchemeSelector:c,enableContrastVars:f}=n,{colorSchemes:h={},components:m,defaultColorScheme:T="light",..._}=t,{vars:R,css:A,varsWithDefaults:I}=wo(_,n);let K=I;const M={},{[T]:g,...V}=h;if(Object.entries(V||{}).forEach(([W,F])=>{const{vars:ee,css:pe,varsWithDefaults:Pe}=wo(F,n);K=at(K,Pe),M[W]={css:pe,vars:ee}}),g){const{css:W,vars:F,varsWithDefaults:ee}=wo(g,n);K=at(K,ee),M[T]={css:W,vars:F}}function J(W,F){var pe,Pe;let ee=c;if(c==="class"&&(ee=".%s"),c==="data"&&(ee="[data-%s]"),c!=null&&c.startsWith("data-")&&!c.includes("%s")&&(ee=`[${c}="%s"]`),W){if(ee==="media")return t.defaultColorScheme===W?":root":{[`@media (prefers-color-scheme: ${((Pe=(pe=h[W])==null?void 0:pe.palette)==null?void 0:Pe.mode)||W})`]:{":root":F}};if(ee)return t.defaultColorScheme===W?`:root, ${ee.replace("%s",String(W))}`:ee.replace("%s",String(W))}return":root"}return{vars:K,generateThemeVars:()=>{let W={...R};return Object.entries(M).forEach(([,{vars:F}])=>{W=at(W,F)}),W},generateStyleSheets:()=>{var Ke,tt;const W=[],F=t.defaultColorScheme||"light";function ee(Re,y){Object.keys(y).length&&W.push(typeof Re=="string"?{[Re]:{...y}}:Re)}ee(i(void 0,{...A}),A);const{[F]:pe,...Pe}=M;if(pe){const{css:Re}=pe,y=(tt=(Ke=h[F])==null?void 0:Ke.palette)==null?void 0:tt.mode,re=!s&&y?{colorScheme:y,...Re}:{...Re};ee(i(F,{...re}),re)}return Object.entries(Pe).forEach(([Re,{css:y}])=>{var fe,ye;const re=(ye=(fe=h[Re])==null?void 0:fe.palette)==null?void 0:ye.mode,G=!s&&re?{colorScheme:re,...y}:{...y};ee(i(Re,{...G}),G)}),f&&W.push({":root":{"--__l-threshold":"0.7","--__l":"clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)","--__a":"clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"}}),W}}}function pc(t){return function(i){return t==="media"?(process.env.NODE_ENV!=="production"&&i!=="light"&&i!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${i}'.`),`@media (prefers-color-scheme: ${i})`):t?t.startsWith("data-")&&!t.includes("%s")?`[${t}="${i}"] &`:t==="class"?`.${i} &`:t==="data"?`[data-${i}] &`:`${t.replace("%s",i)} &`:"&"}}const Pr={black:"#000",white:"#fff"},hc={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},ir={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},ar={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Tr={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},sr={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},ur={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},cr={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function va(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Pr.white,default:Pr.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const ba=va();function wa(){return{text:{primary:Pr.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Pr.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const Eo=wa();function Vi(t,n,i,s){const c=s.light||s,f=s.dark||s*1.5;t[n]||(t.hasOwnProperty(i)?t[n]=t[i]:n==="light"?t.light=On(t.main,c):n==="dark"&&(t.dark=kn(t.main,f)))}function Wi(t,n,i,s,c){const f=c.light||c,h=c.dark||c*1.5;n[i]||(n.hasOwnProperty(s)?n[i]=n[s]:i==="light"?n.light=`color-mix(in ${t}, ${n.main}, #fff ${(f*100).toFixed(0)}%)`:i==="dark"&&(n.dark=`color-mix(in ${t}, ${n.main}, #000 ${(h*100).toFixed(0)}%)`))}function mc(t="light"){return t==="dark"?{main:sr[200],light:sr[50],dark:sr[400]}:{main:sr[700],light:sr[400],dark:sr[800]}}function yc(t="light"){return t==="dark"?{main:ir[200],light:ir[50],dark:ir[400]}:{main:ir[500],light:ir[300],dark:ir[700]}}function gc(t="light"){return t==="dark"?{main:ar[500],light:ar[300],dark:ar[700]}:{main:ar[700],light:ar[400],dark:ar[800]}}function vc(t="light"){return t==="dark"?{main:ur[400],light:ur[300],dark:ur[700]}:{main:ur[700],light:ur[500],dark:ur[900]}}function bc(t="light"){return t==="dark"?{main:cr[400],light:cr[300],dark:cr[700]}:{main:cr[800],light:cr[500],dark:cr[900]}}function wc(t="light"){return t==="dark"?{main:Tr[400],light:Tr[300],dark:Tr[700]}:{main:"#ed6c02",light:Tr[500],dark:Tr[900]}}function xc(t){return`oklch(from ${t} var(--__l) 0 h / var(--__a))`}function Do(t){const{mode:n="light",contrastThreshold:i=3,tonalOffset:s=.2,colorSpace:c,...f}=t,h=t.primary||mc(n),m=t.secondary||yc(n),T=t.error||gc(n),_=t.info||vc(n),R=t.success||bc(n),A=t.warning||wc(n);function I(V){if(c)return xc(V);const J=qi(V,Eo.text.primary)>=i?Eo.text.primary:ba.text.primary;if(process.env.NODE_ENV!=="production"){const ae=qi(V,J);ae<3&&console.error([`MUI: The contrast ratio of ${ae}:1 for ${J} on ${V}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
|
|
50
|
+
`))}return J}const K=({color:V,name:J,mainShade:ae=500,lightShade:ce=300,darkShade:W=700})=>{if(V={...V},!V.main&&V[ae]&&(V.main=V[ae]),!V.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${J?` (${J})`:""} provided to augmentColor(color) is invalid.
|
|
51
|
+
The color object needs to have a \`main\` property or a \`${ae}\` property.`:Yt(11,J?` (${J})`:"",ae));if(typeof V.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${J?` (${J})`:""} provided to augmentColor(color) is invalid.
|
|
52
52
|
\`color.main\` should be a string, but \`${JSON.stringify(V.main)}\` was provided instead.
|
|
53
53
|
|
|
54
54
|
Did you intend to use one of the following approaches?
|
|
@@ -61,16 +61,16 @@ const theme1 = createTheme({ palette: {
|
|
|
61
61
|
|
|
62
62
|
const theme2 = createTheme({ palette: {
|
|
63
63
|
primary: { main: green[500] },
|
|
64
|
-
} });`:Yt(12,
|
|
65
|
-
`)),Object.keys(_).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(_).join(",")}].`)}return(Array.isArray(c)?c:[c]).map(R=>`${R} ${typeof h=="string"?h:
|
|
64
|
+
} });`:Yt(12,J?` (${J})`:"",JSON.stringify(V.main)));return c?(Wi(c,V,"light",ce,s),Wi(c,V,"dark",W,s)):(Vi(V,"light",ce,s),Vi(V,"dark",W,s)),V.contrastText||(V.contrastText=I(V.main)),V};let M;return n==="light"?M=va():n==="dark"&&(M=wa()),process.env.NODE_ENV!=="production"&&(M||console.error(`MUI: The palette mode \`${n}\` is not supported.`)),at({common:{...Pr},mode:n,primary:K({color:h,name:"primary"}),secondary:K({color:m,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:K({color:T,name:"error"}),warning:K({color:A,name:"warning"}),info:K({color:_,name:"info"}),success:K({color:R,name:"success"}),grey:hc,contrastThreshold:i,getContrastText:I,augmentColor:K,tonalOffset:s,...M},f)}function Sc(t){const n={};return Object.entries(t).forEach(s=>{const[c,f]=s;typeof f=="object"&&(n[c]=`${f.fontStyle?`${f.fontStyle} `:""}${f.fontVariant?`${f.fontVariant} `:""}${f.fontWeight?`${f.fontWeight} `:""}${f.fontStretch?`${f.fontStretch} `:""}${f.fontSize||""}${f.lineHeight?`/${f.lineHeight} `:""}${f.fontFamily||""}`)}),n}function _c(t,n){return{toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}},...n}}function Cc(t){return Math.round(t*1e5)/1e5}const Ui={textTransform:"uppercase"},Yi='"Roboto", "Helvetica", "Arial", sans-serif';function Ec(t,n){const{fontFamily:i=Yi,fontSize:s=14,fontWeightLight:c=300,fontWeightRegular:f=400,fontWeightMedium:h=500,fontWeightBold:m=700,htmlFontSize:T=16,allVariants:_,pxToRem:R,...A}=typeof n=="function"?n(t):n;process.env.NODE_ENV!=="production"&&(typeof s!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof T!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const I=s/14,K=R||(V=>`${V/T*I}rem`),M=(V,J,ae,ce,W)=>({fontFamily:i,fontWeight:V,fontSize:K(J),lineHeight:ae,...i===Yi?{letterSpacing:`${Cc(ce/J)}em`}:{},...W,..._}),g={h1:M(c,96,1.167,-1.5),h2:M(c,60,1.2,-.5),h3:M(f,48,1.167,0),h4:M(f,34,1.235,.25),h5:M(f,24,1.334,0),h6:M(h,20,1.6,.15),subtitle1:M(f,16,1.75,.15),subtitle2:M(h,14,1.57,.1),body1:M(f,16,1.5,.15),body2:M(f,14,1.43,.15),button:M(h,14,1.75,.4,Ui),caption:M(f,12,1.66,.4),overline:M(f,12,2.66,1,Ui),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return at({htmlFontSize:T,pxToRem:K,fontFamily:i,fontSize:s,fontWeightLight:c,fontWeightRegular:f,fontWeightMedium:h,fontWeightBold:m,...g},A,{clone:!1})}const Tc=.2,kc=.14,Oc=.12;function Ne(...t){return[`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px rgba(0,0,0,${Tc})`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px rgba(0,0,0,${kc})`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px rgba(0,0,0,${Oc})`].join(",")}const Ac=["none",Ne(0,2,1,-1,0,1,1,0,0,1,3,0),Ne(0,3,1,-2,0,2,2,0,0,1,5,0),Ne(0,3,3,-2,0,3,4,0,0,1,8,0),Ne(0,2,4,-1,0,4,5,0,0,1,10,0),Ne(0,3,5,-1,0,5,8,0,0,1,14,0),Ne(0,3,5,-1,0,6,10,0,0,1,18,0),Ne(0,4,5,-2,0,7,10,1,0,2,16,1),Ne(0,5,5,-3,0,8,10,1,0,3,14,2),Ne(0,5,6,-3,0,9,12,1,0,3,16,2),Ne(0,6,6,-3,0,10,14,1,0,4,18,3),Ne(0,6,7,-4,0,11,15,1,0,4,20,3),Ne(0,7,8,-4,0,12,17,2,0,5,22,4),Ne(0,7,8,-4,0,13,19,2,0,5,24,4),Ne(0,7,9,-4,0,14,21,2,0,5,26,4),Ne(0,8,9,-5,0,15,22,2,0,6,28,5),Ne(0,8,10,-5,0,16,24,2,0,6,30,5),Ne(0,8,11,-5,0,17,26,2,0,6,32,5),Ne(0,9,11,-5,0,18,28,2,0,7,34,6),Ne(0,9,12,-6,0,19,29,2,0,7,36,6),Ne(0,10,13,-6,0,20,31,3,0,8,38,7),Ne(0,10,13,-6,0,21,33,3,0,8,40,7),Ne(0,10,14,-6,0,22,35,3,0,8,42,7),Ne(0,11,14,-7,0,23,36,3,0,9,44,8),Ne(0,11,15,-7,0,24,38,3,0,9,46,8)],Pc={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Rc={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Gi(t){return`${Math.round(t)}ms`}function jc(t){if(!t)return 0;const n=t/36;return Math.min(Math.round((4+15*n**.25+n/5)*10),3e3)}function Ic(t){const n={...Pc,...t.easing},i={...Rc,...t.duration};return{getAutoHeightDuration:jc,create:(c=["all"],f={})=>{const{duration:h=i.standard,easing:m=n.easeInOut,delay:T=0,..._}=f;if(process.env.NODE_ENV!=="production"){const R=I=>typeof I=="string",A=I=>!Number.isNaN(parseFloat(I));!R(c)&&!Array.isArray(c)&&console.error('MUI: Argument "props" must be a string or Array.'),!A(h)&&!R(h)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${h}.`),R(m)||console.error('MUI: Argument "easing" must be a string.'),!A(T)&&!R(T)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof f!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
65
|
+
`)),Object.keys(_).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(_).join(",")}].`)}return(Array.isArray(c)?c:[c]).map(R=>`${R} ${typeof h=="string"?h:Gi(h)} ${m} ${typeof T=="string"?T:Gi(T)}`).join(",")},...t,easing:n,duration:i}}const $c={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Dc(t){return bt(t)||typeof t>"u"||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||Array.isArray(t)}function xa(t={}){const n={...t};function i(s){const c=Object.entries(s);for(let f=0;f<c.length;f++){const[h,m]=c[f];!Dc(m)||h.startsWith("unstable_")?delete s[h]:bt(m)&&(s[h]={...m},i(s[h]))}}return i(n),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
66
66
|
|
|
67
67
|
const theme = ${JSON.stringify(n,null,2)};
|
|
68
68
|
|
|
69
69
|
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
70
70
|
theme.transitions = createTransitions(theme.transitions || {});
|
|
71
71
|
|
|
72
|
-
export default theme;`}function
|
|
73
|
-
`))}V[
|
|
74
|
-
To suppress this warning, you need to explicitly provide the \`palette.${n}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Wc(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const mt=t=>{try{return t()}catch{}},Uc=(t="mui")=>cc(t);function wo(t,n,i,s,c){if(!i)return;i=i===!0?{}:i;const f=c==="dark"?"dark":"light";if(!s){n[c]=Fc({...i,palette:{mode:f,...i==null?void 0:i.palette},colorSpace:t});return}const{palette:h,...y}=Co({...s,palette:{mode:f,...i==null?void 0:i.palette},colorSpace:t});return n[c]={...i,palette:h,opacity:{...Sa(f),...i==null?void 0:i.opacity},overlays:(i==null?void 0:i.overlays)||_a(f)},y}function Yc(t={},...n){const{colorSchemes:i={light:!0},defaultColorScheme:s,disableCssColorScheme:c=!1,cssVarPrefix:f="mui",nativeColor:h=!1,shouldSkipGeneratingVar:y=qc,colorSchemeSelector:T=i.light&&i.dark?"media":void 0,rootSelector:_=":root",...R}=t,A=Object.keys(i)[0],I=s||(i.light&&A!=="light"?"light":A),F=Uc(f),{[I]:M,light:g,dark:V,...ne}=i,W={...ne};let ce=M;if((I==="dark"&&!("dark"in i)||I==="light"&&!("light"in i))&&(ce=!0),!ce)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${I}\` option is either missing or invalid.`:Yt(21,I));let J;h&&(J="oklch");const N=wo(J,W,ce,R,I);g&&!W.light&&wo(J,W,g,void 0,"light"),V&&!W.dark&&wo(J,W,V,void 0,"dark");let G={defaultColorScheme:I,...N,cssVarPrefix:f,colorSchemeSelector:T,rootSelector:_,getCssVar:F,colorSchemes:W,font:{...Sc(N.typography),...N.font},spacing:Wc(R.spacing)};Object.keys(G.colorSchemes).forEach(Re=>{const m=G.colorSchemes[Re].palette,re=de=>{const ye=de.split("-"),qe=ye[1],Le=ye[2];return F(de,m[qe][Le])};m.mode==="light"&&($(m.common,"background","#fff"),$(m.common,"onBackground","#000")),m.mode==="dark"&&($(m.common,"background","#000"),$(m.common,"onBackground","#fff"));function H(de,ye,qe){if(J){let Le;return de===Vt&&(Le=`transparent ${((1-qe)*100).toFixed(0)}%`),de===je&&(Le=`#000 ${(qe*100).toFixed(0)}%`),de===Ie&&(Le=`#fff ${(qe*100).toFixed(0)}%`),`color-mix(in ${J}, ${ye}, ${Le})`}return de(ye,qe)}if(Vc(m,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),m.mode==="light"){$(m.Alert,"errorColor",H(je,m.error.light,.6)),$(m.Alert,"infoColor",H(je,m.info.light,.6)),$(m.Alert,"successColor",H(je,m.success.light,.6)),$(m.Alert,"warningColor",H(je,m.warning.light,.6)),$(m.Alert,"errorFilledBg",re("palette-error-main")),$(m.Alert,"infoFilledBg",re("palette-info-main")),$(m.Alert,"successFilledBg",re("palette-success-main")),$(m.Alert,"warningFilledBg",re("palette-warning-main")),$(m.Alert,"errorFilledColor",mt(()=>m.getContrastText(m.error.main))),$(m.Alert,"infoFilledColor",mt(()=>m.getContrastText(m.info.main))),$(m.Alert,"successFilledColor",mt(()=>m.getContrastText(m.success.main))),$(m.Alert,"warningFilledColor",mt(()=>m.getContrastText(m.warning.main))),$(m.Alert,"errorStandardBg",H(Ie,m.error.light,.9)),$(m.Alert,"infoStandardBg",H(Ie,m.info.light,.9)),$(m.Alert,"successStandardBg",H(Ie,m.success.light,.9)),$(m.Alert,"warningStandardBg",H(Ie,m.warning.light,.9)),$(m.Alert,"errorIconColor",re("palette-error-main")),$(m.Alert,"infoIconColor",re("palette-info-main")),$(m.Alert,"successIconColor",re("palette-success-main")),$(m.Alert,"warningIconColor",re("palette-warning-main")),$(m.AppBar,"defaultBg",re("palette-grey-100")),$(m.Avatar,"defaultBg",re("palette-grey-400")),$(m.Button,"inheritContainedBg",re("palette-grey-300")),$(m.Button,"inheritContainedHoverBg",re("palette-grey-A100")),$(m.Chip,"defaultBorder",re("palette-grey-400")),$(m.Chip,"defaultAvatarColor",re("palette-grey-700")),$(m.Chip,"defaultIconColor",re("palette-grey-700")),$(m.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),$(m.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),$(m.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),$(m.LinearProgress,"primaryBg",H(Ie,m.primary.main,.62)),$(m.LinearProgress,"secondaryBg",H(Ie,m.secondary.main,.62)),$(m.LinearProgress,"errorBg",H(Ie,m.error.main,.62)),$(m.LinearProgress,"infoBg",H(Ie,m.info.main,.62)),$(m.LinearProgress,"successBg",H(Ie,m.success.main,.62)),$(m.LinearProgress,"warningBg",H(Ie,m.warning.main,.62)),$(m.Skeleton,"bg",J?H(Vt,m.text.primary,.11):`rgba(${re("palette-text-primaryChannel")} / 0.11)`),$(m.Slider,"primaryTrack",H(Ie,m.primary.main,.62)),$(m.Slider,"secondaryTrack",H(Ie,m.secondary.main,.62)),$(m.Slider,"errorTrack",H(Ie,m.error.main,.62)),$(m.Slider,"infoTrack",H(Ie,m.info.main,.62)),$(m.Slider,"successTrack",H(Ie,m.success.main,.62)),$(m.Slider,"warningTrack",H(Ie,m.warning.main,.62));const de=J?H(je,m.background.default,.6825):un(m.background.default,.8);$(m.SnackbarContent,"bg",de),$(m.SnackbarContent,"color",mt(()=>J?_o.text.primary:m.getContrastText(de))),$(m.SpeedDialAction,"fabHoverBg",un(m.background.paper,.15)),$(m.StepConnector,"border",re("palette-grey-400")),$(m.StepContent,"border",re("palette-grey-400")),$(m.Switch,"defaultColor",re("palette-common-white")),$(m.Switch,"defaultDisabledColor",re("palette-grey-100")),$(m.Switch,"primaryDisabledColor",H(Ie,m.primary.main,.62)),$(m.Switch,"secondaryDisabledColor",H(Ie,m.secondary.main,.62)),$(m.Switch,"errorDisabledColor",H(Ie,m.error.main,.62)),$(m.Switch,"infoDisabledColor",H(Ie,m.info.main,.62)),$(m.Switch,"successDisabledColor",H(Ie,m.success.main,.62)),$(m.Switch,"warningDisabledColor",H(Ie,m.warning.main,.62)),$(m.TableCell,"border",H(Ie,H(Vt,m.divider,1),.88)),$(m.Tooltip,"bg",H(Vt,m.grey[700],.92))}if(m.mode==="dark"){$(m.Alert,"errorColor",H(Ie,m.error.light,.6)),$(m.Alert,"infoColor",H(Ie,m.info.light,.6)),$(m.Alert,"successColor",H(Ie,m.success.light,.6)),$(m.Alert,"warningColor",H(Ie,m.warning.light,.6)),$(m.Alert,"errorFilledBg",re("palette-error-dark")),$(m.Alert,"infoFilledBg",re("palette-info-dark")),$(m.Alert,"successFilledBg",re("palette-success-dark")),$(m.Alert,"warningFilledBg",re("palette-warning-dark")),$(m.Alert,"errorFilledColor",mt(()=>m.getContrastText(m.error.dark))),$(m.Alert,"infoFilledColor",mt(()=>m.getContrastText(m.info.dark))),$(m.Alert,"successFilledColor",mt(()=>m.getContrastText(m.success.dark))),$(m.Alert,"warningFilledColor",mt(()=>m.getContrastText(m.warning.dark))),$(m.Alert,"errorStandardBg",H(je,m.error.light,.9)),$(m.Alert,"infoStandardBg",H(je,m.info.light,.9)),$(m.Alert,"successStandardBg",H(je,m.success.light,.9)),$(m.Alert,"warningStandardBg",H(je,m.warning.light,.9)),$(m.Alert,"errorIconColor",re("palette-error-main")),$(m.Alert,"infoIconColor",re("palette-info-main")),$(m.Alert,"successIconColor",re("palette-success-main")),$(m.Alert,"warningIconColor",re("palette-warning-main")),$(m.AppBar,"defaultBg",re("palette-grey-900")),$(m.AppBar,"darkBg",re("palette-background-paper")),$(m.AppBar,"darkColor",re("palette-text-primary")),$(m.Avatar,"defaultBg",re("palette-grey-600")),$(m.Button,"inheritContainedBg",re("palette-grey-800")),$(m.Button,"inheritContainedHoverBg",re("palette-grey-700")),$(m.Chip,"defaultBorder",re("palette-grey-700")),$(m.Chip,"defaultAvatarColor",re("palette-grey-300")),$(m.Chip,"defaultIconColor",re("palette-grey-300")),$(m.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),$(m.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),$(m.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),$(m.LinearProgress,"primaryBg",H(je,m.primary.main,.5)),$(m.LinearProgress,"secondaryBg",H(je,m.secondary.main,.5)),$(m.LinearProgress,"errorBg",H(je,m.error.main,.5)),$(m.LinearProgress,"infoBg",H(je,m.info.main,.5)),$(m.LinearProgress,"successBg",H(je,m.success.main,.5)),$(m.LinearProgress,"warningBg",H(je,m.warning.main,.5)),$(m.Skeleton,"bg",J?H(Vt,m.text.primary,.13):`rgba(${re("palette-text-primaryChannel")} / 0.13)`),$(m.Slider,"primaryTrack",H(je,m.primary.main,.5)),$(m.Slider,"secondaryTrack",H(je,m.secondary.main,.5)),$(m.Slider,"errorTrack",H(je,m.error.main,.5)),$(m.Slider,"infoTrack",H(je,m.info.main,.5)),$(m.Slider,"successTrack",H(je,m.success.main,.5)),$(m.Slider,"warningTrack",H(je,m.warning.main,.5));const de=J?H(Ie,m.background.default,.985):un(m.background.default,.98);$(m.SnackbarContent,"bg",de),$(m.SnackbarContent,"color",mt(()=>J?ba.text.primary:m.getContrastText(de))),$(m.SpeedDialAction,"fabHoverBg",un(m.background.paper,.15)),$(m.StepConnector,"border",re("palette-grey-600")),$(m.StepContent,"border",re("palette-grey-600")),$(m.Switch,"defaultColor",re("palette-grey-300")),$(m.Switch,"defaultDisabledColor",re("palette-grey-600")),$(m.Switch,"primaryDisabledColor",H(je,m.primary.main,.55)),$(m.Switch,"secondaryDisabledColor",H(je,m.secondary.main,.55)),$(m.Switch,"errorDisabledColor",H(je,m.error.main,.55)),$(m.Switch,"infoDisabledColor",H(je,m.info.main,.55)),$(m.Switch,"successDisabledColor",H(je,m.success.main,.55)),$(m.Switch,"warningDisabledColor",H(je,m.warning.main,.55)),$(m.TableCell,"border",H(je,H(Vt,m.divider,1),.68)),$(m.Tooltip,"bg",H(Vt,m.grey[700],.92))}vt(m.background,"default"),vt(m.background,"paper"),vt(m.common,"background"),vt(m.common,"onBackground"),vt(m,"divider"),Object.keys(m).forEach(de=>{const ye=m[de];de!=="tonalOffset"&&ye&&typeof ye=="object"&&(ye.main&&$(m[de],"mainChannel",kr(Or(ye.main))),ye.light&&$(m[de],"lightChannel",kr(Or(ye.light))),ye.dark&&$(m[de],"darkChannel",kr(Or(ye.dark))),ye.contrastText&&$(m[de],"contrastTextChannel",kr(Or(ye.contrastText))),de==="text"&&(vt(m[de],"primary"),vt(m[de],"secondary")),de==="action"&&(ye.active&&vt(m[de],"active"),ye.selected&&vt(m[de],"selected")))})}),G=n.reduce((Re,m)=>at(Re,m),G);const le={prefix:f,disableCssColorScheme:c,shouldSkipGeneratingVar:y,getSelector:zc(G),enableContrastVars:h},{vars:Pe,generateThemeVars:Ke,generateStyleSheets:tt}=dc(G,le);return G.vars=Pe,Object.entries(G.colorSchemes[G.defaultColorScheme]).forEach(([Re,m])=>{G[Re]=m}),G.generateThemeVars=Ke,G.generateStyleSheets=tt,G.generateSpacing=function(){return la(R.spacing,Po(this))},G.getColorSchemeSelector=pc(T),G.spacing=G.generateSpacing(),G.shouldSkipGeneratingVar=y,G.unstable_sxConfig={...Cn,...R==null?void 0:R.unstable_sxConfig},G.unstable_sx=function(m){return fr({sx:m,theme:this})},G.toRuntimeSource=xa,G}function Hi(t,n,i){t.colorSchemes&&i&&(t.colorSchemes[n]={...i!==!0&&i,palette:$o({...i===!0?{}:i.palette,mode:n})})}function Ca(t={},...n){const{palette:i,cssVariables:s=!1,colorSchemes:c=i?void 0:{light:!0},defaultColorScheme:f=i==null?void 0:i.mode,...h}=t,y=f||"light",T=c==null?void 0:c[y],_={...c,...i?{[y]:{...typeof T!="boolean"&&T,palette:i}}:void 0};if(s===!1){if(!("colorSchemes"in t))return Co(t,...n);let R=i;"palette"in t||_[y]&&(_[y]!==!0?R=_[y].palette:y==="dark"&&(R={mode:"dark"}));const A=Co({...t,palette:R},...n);return A.defaultColorScheme=y,A.colorSchemes=_,A.palette.mode==="light"&&(A.colorSchemes.light={..._.light!==!0&&_.light,palette:A.palette},Hi(A,"dark",_.dark)),A.palette.mode==="dark"&&(A.colorSchemes.dark={..._.dark!==!0&&_.dark,palette:A.palette},Hi(A,"light",_.light)),A}return!i&&!("light"in _)&&y==="light"&&(_.light=!0),Yc({...h,colorSchemes:_,defaultColorScheme:y,...typeof s!="boolean"&&s},...n)}const Gc=Ca(),Hc="$$material";function Qc(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const Xc=t=>Qc(t)&&t!=="classes",Jc=Qu({themeId:Hc,defaultTheme:Gc,rootShouldForwardProp:Xc}),Zc=uc;process.env.NODE_ENV!=="production"&&(Te.node,Te.object.isRequired);function el(t){return sc(t)}function tl(t){return jo("MuiSvgIcon",t)}Wu("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const rl=t=>{const{color:n,fontSize:i,classes:s}=t,c={root:["root",n!=="inherit"&&`color${Gt(n)}`,`fontSize${Gt(i)}`]};return Bs(c,tl,s)},nl=Jc("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:i}=t;return[n.root,i.color!=="inherit"&&n[`color${Gt(i.color)}`],n[`fontSize${Gt(i.fontSize)}`]]}})(Zc(({theme:t})=>{var n,i,s,c,f,h,y,T,_,R,A,I,F,M;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(c=(n=t.transitions)==null?void 0:n.create)==null?void 0:c.call(n,"fill",{duration:(s=(i=(t.vars??t).transitions)==null?void 0:i.duration)==null?void 0:s.shorter}),variants:[{props:g=>!g.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((h=(f=t.typography)==null?void 0:f.pxToRem)==null?void 0:h.call(f,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((T=(y=t.typography)==null?void 0:y.pxToRem)==null?void 0:T.call(y,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((R=(_=t.typography)==null?void 0:_.pxToRem)==null?void 0:R.call(_,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,g])=>g&&g.main).map(([g])=>{var V,ne;return{props:{color:g},style:{color:(ne=(V=(t.vars??t).palette)==null?void 0:V[g])==null?void 0:ne.main}}}),{props:{color:"action"},style:{color:(I=(A=(t.vars??t).palette)==null?void 0:A.action)==null?void 0:I.active}},{props:{color:"disabled"},style:{color:(M=(F=(t.vars??t).palette)==null?void 0:F.action)==null?void 0:M.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),hn=Pt.forwardRef(function(n,i){const s=el({props:n,name:"MuiSvgIcon"}),{children:c,className:f,color:h="inherit",component:y="svg",fontSize:T="medium",htmlColor:_,inheritViewBox:R=!1,titleAccess:A,viewBox:I="0 0 24 24",...F}=s,M=Pt.isValidElement(c)&&c.type==="svg",g={...s,color:h,component:y,fontSize:T,instanceFontSize:n.fontSize,inheritViewBox:R,viewBox:I,hasSvgAsChild:M},V={};R||(V.viewBox=I);const ne=rl(g);return B.jsxs(nl,{as:y,className:aa(ne.root,f),focusable:"false",color:_,"aria-hidden":A?void 0:!0,role:A?"img":void 0,ref:i,...V,...F,...M&&c.props,ownerState:g,children:[M?c.props.children:c,A?B.jsx("title",{children:A}):null]})});process.env.NODE_ENV!=="production"&&(hn.propTypes={children:Te.node,classes:Te.object,className:Te.string,color:Te.oneOfType([Te.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),Te.string]),component:Te.elementType,fontSize:Te.oneOfType([Te.oneOf(["inherit","large","medium","small"]),Te.string]),htmlColor:Te.string,inheritViewBox:Te.bool,shapeRendering:Te.string,sx:Te.oneOfType([Te.arrayOf(Te.oneOfType([Te.func,Te.object,Te.bool])),Te.func,Te.object]),titleAccess:Te.string,viewBox:Te.string});hn.muiName="SvgIcon";function xt(t,n){function i(s,c){return B.jsx(hn,{"data-testid":process.env.NODE_ENV!=="production"?`${n}Icon`:void 0,ref:c,...s,children:t})}return process.env.NODE_ENV!=="production"&&(i.displayName=`${n}Icon`),i.muiName=hn.muiName,Pt.memo(Pt.forwardRef(i))}const ol=xt(B.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),il=xt(B.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),al=xt(B.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Ea=xt(B.jsx("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group"),Ta=xt(B.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),sl=xt(B.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),ul=xt([B.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),B.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule"),cl=xt(B.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send"),ll=xt(B.jsx("path",{d:"M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0"}),"WifiOff");function fl(t){const n=new Date(t),s=new Date().getTime()-n.getTime(),c=Math.floor(s/6e4),f=Math.floor(s/36e5),h=Math.floor(s/864e5);return c<1?"now":c<60?`${c}m`:f<24?`${f}h`:h<7?`${h}d`:n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const ka=ue.memo(({conversation:t,displayName:n,selected:i,onClick:s})=>{const c=!!t.group,f=t.unread_count;return B.jsx(Z.ListItem,{disablePadding:!0,children:B.jsxs(Z.ListItemButton,{selected:i,onClick:s,sx:{"&.Mui-selected":{backgroundColor:"action.selected","&:hover":{backgroundColor:"action.selected"}}},children:[B.jsx(Z.ListItemAvatar,{children:B.jsx(Z.Badge,{badgeContent:f,color:"primary",overlap:"circular",invisible:f===0,children:B.jsx(Z.Avatar,{sx:{bgcolor:c?"primary.main":"secondary.main"},children:c?B.jsx(Ea,{}):B.jsx(Ta,{})})})}),B.jsx(Z.ListItemText,{primary:B.jsxs(Z.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[B.jsx(Z.Typography,{variant:"subtitle2",noWrap:!0,sx:{fontWeight:f>0?600:400,flex:1},children:n}),B.jsx(Z.Typography,{variant:"caption",color:"text.secondary",sx:{ml:1,flexShrink:0},children:fl(t.last_message_at)})]}),secondary:B.jsx(Z.Typography,{variant:"body2",color:"text.secondary",noWrap:!0,sx:{fontWeight:f>0?500:400},children:t.message_count===0?"No messages yet":`${t.message_count} message${t.message_count!==1?"s":""}`})})]})})}),Oa=()=>B.jsxs(Z.ListItem,{children:[B.jsx(Z.ListItemAvatar,{children:B.jsx(Z.Skeleton,{variant:"circular",width:40,height:40})}),B.jsx(Z.ListItemText,{primary:B.jsxs(Z.Box,{display:"flex",justifyContent:"space-between",children:[B.jsx(Z.Skeleton,{variant:"text",width:"60%"}),B.jsx(Z.Skeleton,{variant:"text",width:"15%"})]}),secondary:B.jsx(Z.Skeleton,{variant:"text",width:"80%"})})]});var ln={exports:{}},dl=ln.exports,Qi;function pl(){return Qi||(Qi=1,(function(t,n){((i,s)=>{t.exports=s()})(dl,function(){var i=function(e,r){return(i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(o,a){o.__proto__=a}:function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])}))(e,r)},s=function(){return(s=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++)for(var u in r=arguments[o])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e}).apply(this,arguments)};function c(e,r,o){for(var a,u=0,l=r.length;u<l;u++)!a&&u in r||((a=a||Array.prototype.slice.call(r,0,u))[u]=r[u]);return e.concat(a||Array.prototype.slice.call(r))}var f=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:ks,h=Object.keys,y=Array.isArray;function T(e,r){return typeof r=="object"&&h(r).forEach(function(o){e[o]=r[o]}),e}typeof Promise>"u"||f.Promise||(f.Promise=Promise);var _=Object.getPrototypeOf,R={}.hasOwnProperty;function A(e,r){return R.call(e,r)}function I(e,r){typeof r=="function"&&(r=r(_(e))),(typeof Reflect>"u"?h:Reflect.ownKeys)(r).forEach(function(o){M(e,o,r[o])})}var F=Object.defineProperty;function M(e,r,o,a){F(e,r,T(o&&A(o,"get")&&typeof o.get=="function"?{get:o.get,set:o.set,configurable:!0}:{value:o,configurable:!0,writable:!0},a))}function g(e){return{from:function(r){return e.prototype=Object.create(r.prototype),M(e.prototype,"constructor",e),{extend:I.bind(null,e.prototype)}}}}var V=Object.getOwnPropertyDescriptor,ne=[].slice;function W(e,r,o){return ne.call(e,r,o)}function ce(e,r){return r(e)}function J(e){if(!e)throw new Error("Assertion Failed")}function N(e){f.setImmediate?setImmediate(e):setTimeout(e,0)}function G(e,r){if(typeof r=="string"&&A(e,r))return e[r];if(!r)return e;if(typeof r!="string"){for(var o=[],a=0,u=r.length;a<u;++a){var l=G(e,r[a]);o.push(l)}return o}var d,p=r.indexOf(".");return p===-1||(d=e[r.substr(0,p)])==null?void 0:G(d,r.substr(p+1))}function le(e,r,o){if(e&&r!==void 0&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof r!="string"&&"length"in r){J(typeof o!="string"&&"length"in o);for(var a=0,u=r.length;a<u;++a)le(e,r[a],o[a])}else{var l,d,p=r.indexOf(".");p!==-1?(l=r.substr(0,p),(p=r.substr(p+1))===""?o===void 0?y(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=o:le(d=(d=e[l])&&A(e,l)?d:e[l]={},p,o)):o===void 0?y(e)&&!isNaN(parseInt(r))?e.splice(r,1):delete e[r]:e[r]=o}}function Pe(e){var r,o={};for(r in e)A(e,r)&&(o[r]=e[r]);return o}var Ke=[].concat;function tt(e){return Ke.apply([],e)}var he="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(tt([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(r){return r+e+"Array"})}))).filter(function(e){return f[e]}),Re=new Set(he.map(function(e){return f[e]})),m=null;function re(e){return m=new WeakMap,e=(function r(o){if(!o||typeof o!="object")return o;var a=m.get(o);if(a)return a;if(y(o)){a=[],m.set(o,a);for(var u=0,l=o.length;u<l;++u)a.push(r(o[u]))}else if(Re.has(o.constructor))a=o;else{var d,p=_(o);for(d in a=p===Object.prototype?{}:Object.create(p),m.set(o,a),o)A(o,d)&&(a[d]=r(o[d]))}return a})(e),m=null,e}var H={}.toString;function de(e){return H.call(e).slice(8,-1)}var ye=typeof Symbol<"u"?Symbol.iterator:"@@iterator",qe=typeof ye=="symbol"?function(e){var r;return e!=null&&(r=e[ye])&&r.apply(e)}:function(){return null};function Le(e,r){r=e.indexOf(r),0<=r&&e.splice(r,1)}var rt={};function z(e){var r,o,a,u;if(arguments.length===1){if(y(e))return e.slice();if(this===rt&&typeof e=="string")return[e];if(u=qe(e))for(o=[];!(a=u.next()).done;)o.push(a.value);else{if(e==null)return[e];if(typeof(r=e.length)!="number")return[e];for(o=new Array(r);r--;)o[r]=e[r]}}else for(r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o}var ie=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},he=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],nt=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(he),be={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 pe(e,r){this.name=e,this.message=r}function xe(e,r){return e+". Errors: "+Object.keys(r).map(function(o){return r[o].toString()}).filter(function(o,a,u){return u.indexOf(o)===a}).join(`
|
|
75
|
-
`)}function ge(e,r,o,a){this.failures=r,this.failedKeys=a,this.successCount=o,this.message=xe(e,r)}function me(e,r){this.name="BulkError",this.failures=Object.keys(r).map(function(o){return r[o]}),this.failuresByPos=r,this.message=xe(e,this.failures)}g(
|
|
76
|
-
`+l:""),this.inner=l||null):typeof u=="object"&&(this.message="".concat(u.name," ").concat(u.message),this.inner=u):(this.message=be[r]||o,this.inner=null)}return g(a).from(ke),e[r]=a,e},{}),Xe=(Y.Syntax=SyntaxError,Y.Type=TypeError,Y.Range=RangeError,he.reduce(function(e,r){return e[r+"Error"]=Y[r],e},{}));he=nt.reduce(function(e,r){return["Syntax","Type","Range"].indexOf(r)===-1&&(e[r+"Error"]=Y[r]),e},{});function q(){}function Je(e){return e}function Ht(e,r){return e==null||e===Je?r:function(o){return r(e(o))}}function ft(e,r){return function(){e.apply(this,arguments),r.apply(this,arguments)}}function qa(e,r){return e===q?r:function(){var o=e.apply(this,arguments),a=(o!==void 0&&(arguments[0]=o),this.onsuccess),u=this.onerror,l=(this.onsuccess=null,this.onerror=null,r.apply(this,arguments));return a&&(this.onsuccess=this.onsuccess?ft(a,this.onsuccess):a),u&&(this.onerror=this.onerror?ft(u,this.onerror):u),l!==void 0?l:o}}function La(e,r){return e===q?r:function(){e.apply(this,arguments);var o=this.onsuccess,a=this.onerror;this.onsuccess=this.onerror=null,r.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?ft(o,this.onsuccess):o),a&&(this.onerror=this.onerror?ft(a,this.onerror):a)}}function za(e,r){return e===q?r:function(u){var a=e.apply(this,arguments),u=(T(u,a),this.onsuccess),l=this.onerror,d=(this.onsuccess=null,this.onerror=null,r.apply(this,arguments));return u&&(this.onsuccess=this.onsuccess?ft(u,this.onsuccess):u),l&&(this.onerror=this.onerror?ft(l,this.onerror):l),a===void 0?d===void 0?void 0:d:T(a,d)}}function Va(e,r){return e===q?r:function(){return r.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function An(e,r){return e===q?r:function(){var o=e.apply(this,arguments);if(o&&typeof o.then=="function"){for(var a=this,u=arguments.length,l=new Array(u);u--;)l[u]=arguments[u];return o.then(function(){return r.apply(a,l)})}return r.apply(this,arguments)}}he.ModifyError=ge,he.DexieError=pe,he.BulkError=me;var dt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Bo(e){dt=e}var pr={},Mo=100,hr=typeof Promise>"u"?[]:(nt=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[hr=crypto.subtle.digest("SHA-512",new Uint8Array([0])),_(hr),nt]:[nt,_(nt),nt]),nt=hr[0],nr=hr[1],nr=nr&&nr.then,$t=nt&&nt.constructor,Pn=!!hr[2],mr=function(e,r){yr.push([e,r]),Ir&&(queueMicrotask(Ua),Ir=!1)},Rn=!0,Ir=!0,Dt=[],$r=[],jn=Je,St={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:q,pgp:!1,env:{},finalize:q},se=St,yr=[],Bt=0,Dr=[];function ee(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var r=this._PSD=se;if(typeof e!="function"){if(e!==pr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&$n(this,this._value)}else this._state=null,this._value=null,++r.ref,(function o(a,u){try{u(function(l){if(a._state===null){if(l===a)throw new TypeError("A promise cannot be resolved with itself.");var d=a._lib&&Qt();l&&typeof l.then=="function"?o(a,function(p,w){l instanceof ee?l._then(p,w):l.then(p,w)}):(a._state=!0,a._value=l,Ko(a)),d&&Xt()}},$n.bind(null,a))}catch(l){$n(a,l)}})(this,e)}var In={get:function(){var e=se,r=Kr;function o(a,u){var l=this,d=!e.global&&(e!==se||r!==Kr),p=d&&!Ct(),w=new ee(function(O,x){Dn(l,new No(qo(a,e,d,p),qo(u,e,d,p),O,x,e))});return this._consoleTask&&(w._consoleTask=this._consoleTask),w}return o.prototype=pr,o},set:function(e){M(this,"then",e&&e.prototype===pr?In:{get:function(){return e},set:In.set})}};function No(e,r,o,a,u){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof r=="function"?r:null,this.resolve=o,this.reject=a,this.psd=u}function $n(e,r){var o,a;$r.push(r),e._state===null&&(o=e._lib&&Qt(),r=jn(r),e._state=!1,e._value=r,a=e,Dt.some(function(u){return u._value===a._value})||Dt.push(a),Ko(e),o)&&Xt()}function Ko(e){var r=e._listeners;e._listeners=[];for(var o=0,a=r.length;o<a;++o)Dn(e,r[o]);var u=e._PSD;--u.ref||u.finalize(),Bt===0&&(++Bt,mr(function(){--Bt==0&&Bn()},[]))}function Dn(e,r){if(e._state===null)e._listeners.push(r);else{var o=e._state?r.onFulfilled:r.onRejected;if(o===null)return(e._state?r.resolve:r.reject)(e._value);++r.psd.ref,++Bt,mr(Wa,[o,e,r])}}function Wa(e,r,o){try{var a,u=r._value;!r._state&&$r.length&&($r=[]),a=dt&&r._consoleTask?r._consoleTask.run(function(){return e(u)}):e(u),r._state||$r.indexOf(u)!==-1||(l=>{for(var d=Dt.length;d;)if(Dt[--d]._value===l._value)return Dt.splice(d,1)})(r),o.resolve(a)}catch(l){o.reject(l)}finally{--Bt==0&&Bn(),--o.psd.ref||o.psd.finalize()}}function Ua(){Mt(St,function(){Qt()&&Xt()})}function Qt(){var e=Rn;return Ir=Rn=!1,e}function Xt(){var e,r,o;do for(;0<yr.length;)for(e=yr,yr=[],o=e.length,r=0;r<o;++r){var a=e[r];a[0].apply(null,a[1])}while(0<yr.length);Ir=Rn=!0}function Bn(){for(var e=Dt,r=(Dt=[],e.forEach(function(a){a._PSD.onunhandled.call(null,a._value,a)}),Dr.slice(0)),o=r.length;o;)r[--o]()}function Br(e){return new ee(pr,!1,e)}function Me(e,r){var o=se;return function(){var a=Qt(),u=se;try{return Et(o,!0),e.apply(this,arguments)}catch(l){r&&r(l)}finally{Et(u,!1),a&&Xt()}}}I(ee.prototype,{then:In,_then:function(e,r){Dn(this,new No(null,null,e,r,se))},catch:function(e){var r,o;return arguments.length===1?this.then(null,e):(r=e,o=arguments[1],typeof r=="function"?this.then(null,function(a){return(a instanceof r?o:Br)(a)}):this.then(null,function(a){return(a&&a.name===r?o:Br)(a)}))},finally:function(e){return this.then(function(r){return ee.resolve(e()).then(function(){return r})},function(r){return ee.resolve(e()).then(function(){return Br(r)})})},timeout:function(e,r){var o=this;return e<1/0?new ee(function(a,u){var l=setTimeout(function(){return u(new Y.Timeout(r))},e);o.then(a,u).finally(clearTimeout.bind(null,l))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&M(ee.prototype,Symbol.toStringTag,"Dexie.Promise"),St.env=Fo(),I(ee,{all:function(){var e=z.apply(null,arguments).map(Fr);return new ee(function(r,o){e.length===0&&r([]);var a=e.length;e.forEach(function(u,l){return ee.resolve(u).then(function(d){e[l]=d,--a||r(e)},o)})})},resolve:function(e){return e instanceof ee?e:e&&typeof e.then=="function"?new ee(function(r,o){e.then(r,o)}):new ee(pr,!0,e)},reject:Br,race:function(){var e=z.apply(null,arguments).map(Fr);return new ee(function(r,o){e.map(function(a){return ee.resolve(a).then(r,o)})})},PSD:{get:function(){return se},set:function(e){return se=e}},totalEchoes:{get:function(){return Kr}},newPSD:_t,usePSD:Mt,scheduler:{get:function(){return mr},set:function(e){mr=e}},rejectionMapper:{get:function(){return jn},set:function(e){jn=e}},follow:function(e,r){return new ee(function(o,a){return _t(function(u,l){var d=se;d.unhandleds=[],d.onunhandled=l,d.finalize=ft(function(){var p,w=this;p=function(){w.unhandleds.length===0?u():l(w.unhandleds[0])},Dr.push(function O(){p(),Dr.splice(Dr.indexOf(O),1)}),++Bt,mr(function(){--Bt==0&&Bn()},[])},d.finalize),e()},r,o,a)})}}),$t&&($t.allSettled&&M(ee,"allSettled",function(){var e=z.apply(null,arguments).map(Fr);return new ee(function(r){e.length===0&&r([]);var o=e.length,a=new Array(o);e.forEach(function(u,l){return ee.resolve(u).then(function(d){return a[l]={status:"fulfilled",value:d}},function(d){return a[l]={status:"rejected",reason:d}}).then(function(){return--o||r(a)})})})}),$t.any&&typeof AggregateError<"u"&&M(ee,"any",function(){var e=z.apply(null,arguments).map(Fr);return new ee(function(r,o){e.length===0&&o(new AggregateError([]));var a=e.length,u=new Array(a);e.forEach(function(l,d){return ee.resolve(l).then(function(p){return r(p)},function(p){u[d]=p,--a||o(new AggregateError(u))})})})}),$t.withResolvers)&&(ee.withResolvers=$t.withResolvers);var He={awaits:0,echoes:0,id:0},Ya=0,Mr=[],Nr=0,Kr=0,Ga=0;function _t(e,d,o,a){var u=se,l=Object.create(u),d=(l.parent=u,l.ref=0,l.global=!1,l.id=++Ga,St.env,l.env=Pn?{Promise:ee,PromiseProp:{value:ee,configurable:!0,writable:!0},all:ee.all,race:ee.race,allSettled:ee.allSettled,any:ee.any,resolve:ee.resolve,reject:ee.reject}:{},d&&T(l,d),++u.ref,l.finalize=function(){--this.parent.ref||this.parent.finalize()},Mt(l,e,o,a));return l.ref===0&&l.finalize(),d}function Jt(){return He.id||(He.id=++Ya),++He.awaits,He.echoes+=Mo,He.id}function Ct(){return!!He.awaits&&(--He.awaits==0&&(He.id=0),He.echoes=He.awaits*Mo,!0)}function Fr(e){return He.echoes&&e&&e.constructor===$t?(Jt(),e.then(function(r){return Ct(),r},function(r){return Ct(),Ue(r)})):e}function Ha(){var e=Mr[Mr.length-1];Mr.pop(),Et(e,!1)}function Et(e,r){var o,a,u=se;(r?!He.echoes||Nr++&&e===se:!Nr||--Nr&&e===se)||queueMicrotask(r?(function(l){++Kr,He.echoes&&--He.echoes!=0||(He.echoes=He.awaits=He.id=0),Mr.push(se),Et(l,!0)}).bind(null,e):Ha),e!==se&&(se=e,u===St&&(St.env=Fo()),Pn)&&(o=St.env.Promise,a=e.env,u.global||e.global)&&(Object.defineProperty(f,"Promise",a.PromiseProp),o.all=a.all,o.race=a.race,o.resolve=a.resolve,o.reject=a.reject,a.allSettled&&(o.allSettled=a.allSettled),a.any)&&(o.any=a.any)}function Fo(){var e=f.Promise;return Pn?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(f,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Mt(e,r,o,a,u){var l=se;try{return Et(e,!0),r(o,a,u)}finally{Et(l,!1)}}function qo(e,r,o,a){return typeof e!="function"?e:function(){var u=se;o&&Jt(),Et(r,!0);try{return e.apply(this,arguments)}finally{Et(u,!1),a&&queueMicrotask(Ct)}}}function Mn(e){Promise===$t&&He.echoes===0?Nr===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+nr).indexOf("[native code]")===-1&&(Jt=Ct=q);var Ue=ee.reject,Nt="",yt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Lo="String expected.",Zt=[],qr="__dbnames",Nn="readonly",Kn="readwrite";function Kt(e,r){return e?r?function(){return e.apply(this,arguments)&&r.apply(this,arguments)}:e:r}var zo={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Lr(e){return typeof e!="string"||/\./.test(e)?function(r){return r}:function(r){return r[e]===void 0&&e in r&&delete(r=re(r))[e],r}}function Vo(){throw Y.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function Se(e,r){try{var o=Wo(e),a=Wo(r);if(o!==a)return o==="Array"?1:a==="Array"?-1:o==="binary"?1:a==="binary"?-1:o==="string"?1:a==="string"?-1:o==="Date"?1:a!=="Date"?NaN:-1;switch(o){case"number":case"Date":case"string":return r<e?1:e<r?-1:0;case"binary":for(var u=Uo(e),l=Uo(r),d=u.length,p=l.length,w=d<p?d:p,O=0;O<w;++O)if(u[O]!==l[O])return u[O]<l[O]?-1:1;return d===p?0:d<p?-1:1;case"Array":for(var x=e,v=r,C=x.length,E=v.length,S=C<E?C:E,b=0;b<S;++b){var P=Se(x[b],v[b]);if(P!==0)return P}return C===E?0:C<E?-1:1}}catch{}return NaN}function Wo(e){var r=typeof e;return r=="object"&&(ArrayBuffer.isView(e)||(r=de(e))==="ArrayBuffer")?"binary":r}function Uo(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function zr(e,r,o){var a=e.schema.yProps;return a?(r&&0<o.numFailures&&(r=r.filter(function(u,l){return!o.failures[l]})),Promise.all(a.map(function(u){return u=u.updatesTable,r?e.db.table(u).where("k").anyOf(r).delete():e.db.table(u).clear()})).then(function(){return o})):o}Yo.prototype.execute=function(e){var r=this["@@propmod"];if(r.add!==void 0){var o=r.add;if(y(o))return c(c([],y(e)?e:[],!0),o).sort();if(typeof o=="number")return(Number(e)||0)+o;if(typeof o=="bigint")try{return BigInt(e)+o}catch{return BigInt(0)+o}throw new TypeError("Invalid term ".concat(o))}if(r.remove!==void 0){var a=r.remove;if(y(a))return y(e)?e.filter(function(u){return!a.includes(u)}).sort():[];if(typeof a=="number")return Number(e)-a;if(typeof a=="bigint")try{return BigInt(e)-a}catch{return BigInt(0)-a}throw new TypeError("Invalid subtrahend ".concat(a))}return o=(o=r.replacePrefix)==null?void 0:o[0],o&&typeof e=="string"&&e.startsWith(o)?r.replacePrefix[1]+e.substring(o.length):e};var gr=Yo;function Yo(e){this["@@propmod"]=e}function Go(e,r){for(var o=h(r),a=o.length,u=!1,l=0;l<a;++l){var d=o[l],p=r[d],w=G(e,d);p instanceof gr?(le(e,d,p.execute(w)),u=!0):w!==p&&(le(e,d,p),u=!0)}return u}Be.prototype._trans=function(e,r,o){var a=this._tx||se.trans,u=this.name,l=dt&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function d(O,x,v){if(v.schema[u])return r(v.idbtrans,v);throw new Y.NotFound("Table "+u+" not part of transaction")}var p=Qt();try{var w=a&&a.db._novip===this.db._novip?a===se.trans?a._promise(e,d,o):_t(function(){return a._promise(e,d,o)},{trans:a,transless:se.transless||se}):(function O(x,v,C,E){if(x.idbdb&&(x._state.openComplete||se.letThrough||x._vip)){var S=x._createTransaction(v,C,x._dbSchema);try{S.create(),x._state.PR1398_maxLoop=3}catch(b){return b.name===we.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return O(x,v,C,E)})):Ue(b)}return S._promise(v,function(b,P){return _t(function(){return se.trans=S,E(b,P,S)})}).then(function(b){if(v==="readwrite")try{S.idbtrans.commit()}catch{}return v==="readonly"?b:S._completion.then(function(){return b})})}if(x._state.openComplete)return Ue(new Y.DatabaseClosed(x._state.dbOpenError));if(!x._state.isBeingOpened){if(!x._state.autoOpen)return Ue(new Y.DatabaseClosed);x.open().catch(q)}return x._state.dbReadyPromise.then(function(){return O(x,v,C,E)})})(this.db,e,[this.name],d);return l&&(w._consoleTask=l,w=w.catch(function(O){return console.trace(O),Ue(O)})),w}finally{p&&Xt()}},Be.prototype.get=function(e,r){var o=this;return e&&e.constructor===Object?this.where(e).first(r):e==null?Ue(new Y.Type("Invalid argument to Table.get()")):this._trans("readonly",function(a){return o.core.get({trans:a,key:e}).then(function(u){return o.hook.reading.fire(u)})}).then(r)},Be.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(y(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var r=h(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);var o=this.schema.indexes.concat(this.schema.primKey).filter(function(p){if(p.compound&&r.every(function(O){return 0<=p.keyPath.indexOf(O)})){for(var w=0;w<r.length;++w)if(r.indexOf(p.keyPath[w])===-1)return!1;return!0}return!1}).sort(function(p,w){return p.keyPath.length-w.keyPath.length})[0];if(o&&this.db._maxKey!==Nt)return d=o.keyPath.slice(0,r.length),this.where(d).equals(d.map(function(p){return e[p]}));!o&&dt&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(r.join("+"),"]"));var a=this.schema.idxByName;function u(p,w){return Se(p,w)===0}var d=r.reduce(function(x,w){var O=x[0],x=x[1],v=a[w],C=e[w];return[O||v,O||!v?Kt(x,v&&v.multi?function(E){return E=G(E,w),y(E)&&E.some(function(S){return u(C,S)})}:function(E){return u(C,G(E,w))}):x]},[null,null]),l=d[0],d=d[1];return l?this.where(l.name).equals(e[l.keyPath]).filter(d):o?this.filter(d):this.where(r).equals("")},Be.prototype.filter=function(e){return this.toCollection().and(e)},Be.prototype.count=function(e){return this.toCollection().count(e)},Be.prototype.offset=function(e){return this.toCollection().offset(e)},Be.prototype.limit=function(e){return this.toCollection().limit(e)},Be.prototype.each=function(e){return this.toCollection().each(e)},Be.prototype.toArray=function(e){return this.toCollection().toArray(e)},Be.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Be.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,y(e)?"[".concat(e.join("+"),"]"):e))},Be.prototype.reverse=function(){return this.toCollection().reverse()},Be.prototype.mapToClass=function(e){for(var r=this.db,o=this.name,a=((this.schema.mappedClass=e).prototype instanceof Vo&&(e=(d=>{var p=x,w=d;if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function O(){this.constructor=p}function x(){return d!==null&&d.apply(this,arguments)||this}return i(p,w),p.prototype=w===null?Object.create(w):(O.prototype=w.prototype,new O),Object.defineProperty(x.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),x.prototype.table=function(){return o},x})(e)),new Set),u=e.prototype;u;u=_(u))Object.getOwnPropertyNames(u).forEach(function(d){return a.add(d)});function l(d){if(!d)return d;var p,w=Object.create(e.prototype);for(p in d)if(!a.has(p))try{w[p]=d[p]}catch{}return w}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=l,this.hook("reading",l),e},Be.prototype.defineClass=function(){return this.mapToClass(function(e){T(this,e)})},Be.prototype.add=function(e,r){var o=this,a=this.schema.primKey,u=a.auto,l=a.keyPath,d=e;return l&&u&&(d=Lr(l)(e)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"add",keys:r!=null?[r]:null,values:[d]})}).then(function(p){return p.numFailures?ee.reject(p.failures[0]):p.lastResult}).then(function(p){if(l)try{le(e,l,p)}catch{}return p})},Be.prototype.upsert=function(e,r){var o=this,a=this.schema.primKey.keyPath;return this._trans("readwrite",function(u){return o.core.get({trans:u,key:e}).then(function(l){var d=l??{};return Go(d,r),a&&le(d,a,e),o.core.mutate({trans:u,type:"put",values:[d],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[r]}}).then(function(p){return p.numFailures?ee.reject(p.failures[0]):!!l})})})},Be.prototype.update=function(e,r){return typeof e!="object"||y(e)?this.where(":id").equals(e).modify(r):(e=G(e,this.schema.primKey.keyPath))===void 0?Ue(new Y.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(r)},Be.prototype.put=function(e,r){var o=this,a=this.schema.primKey,u=a.auto,l=a.keyPath,d=e;return l&&u&&(d=Lr(l)(e)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"put",values:[d],keys:r!=null?[r]:null})}).then(function(p){return p.numFailures?ee.reject(p.failures[0]):p.lastResult}).then(function(p){if(l)try{le(e,l,p)}catch{}return p})},Be.prototype.delete=function(e){var r=this;return this._trans("readwrite",function(o){return r.core.mutate({trans:o,type:"delete",keys:[e]}).then(function(a){return zr(r,[e],a)}).then(function(a){return a.numFailures?ee.reject(a.failures[0]):void 0})})},Be.prototype.clear=function(){var e=this;return this._trans("readwrite",function(r){return e.core.mutate({trans:r,type:"deleteRange",range:zo}).then(function(o){return zr(e,null,o)})}).then(function(r){return r.numFailures?ee.reject(r.failures[0]):void 0})},Be.prototype.bulkGet=function(e){var r=this;return this._trans("readonly",function(o){return r.core.getMany({keys:e,trans:o}).then(function(a){return a.map(function(u){return r.hook.reading.fire(u)})})})},Be.prototype.bulkAdd=function(e,r,o){var a=this,u=Array.isArray(r)?r:void 0,l=(o=o||(u?void 0:r))?o.allKeys:void 0;return this._trans("readwrite",function(d){var p=a.schema.primKey,O=p.auto,p=p.keyPath;if(p&&u)throw new Y.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(u&&u.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var w=e.length,O=p&&O?e.map(Lr(p)):e;return a.core.mutate({trans:d,type:"add",keys:u,values:O,wantResults:l}).then(function(x){var v=x.numFailures,C=x.failures;if(v===0)return l?x.results:x.lastResult;throw new me("".concat(a.name,".bulkAdd(): ").concat(v," of ").concat(w," operations failed"),C)})})},Be.prototype.bulkPut=function(e,r,o){var a=this,u=Array.isArray(r)?r:void 0,l=(o=o||(u?void 0:r))?o.allKeys:void 0;return this._trans("readwrite",function(d){var p=a.schema.primKey,O=p.auto,p=p.keyPath;if(p&&u)throw new Y.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(u&&u.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var w=e.length,O=p&&O?e.map(Lr(p)):e;return a.core.mutate({trans:d,type:"put",keys:u,values:O,wantResults:l}).then(function(x){var v=x.numFailures,C=x.failures;if(v===0)return l?x.results:x.lastResult;throw new me("".concat(a.name,".bulkPut(): ").concat(v," of ").concat(w," operations failed"),C)})})},Be.prototype.bulkUpdate=function(e){var r=this,o=this.core,a=e.map(function(d){return d.key}),u=e.map(function(d){return d.changes}),l=[];return this._trans("readwrite",function(d){return o.getMany({trans:d,keys:a,cache:"clone"}).then(function(p){var w=[],O=[],x=(e.forEach(function(v,C){var E=v.key,S=v.changes,b=p[C];if(b){for(var P=0,j=Object.keys(S);P<j.length;P++){var k=j[P],D=S[k];if(k===r.schema.primKey.keyPath){if(Se(D,E)!==0)throw new Y.Constraint("Cannot update primary key in bulkUpdate()")}else le(b,k,D)}l.push(C),w.push(E),O.push(b)}}),w.length);return o.mutate({trans:d,type:"put",keys:w,values:O,updates:{keys:a,changeSpecs:u}}).then(function(v){var C=v.numFailures,E=v.failures;if(C===0)return x;for(var S=0,b=Object.keys(E);S<b.length;S++){var P,j=b[S],k=l[Number(j)];k!=null&&(P=E[j],delete E[j],E[k]=P)}throw new me("".concat(r.name,".bulkUpdate(): ").concat(C," of ").concat(x," operations failed"),E)})})})},Be.prototype.bulkDelete=function(e){var r=this,o=e.length;return this._trans("readwrite",function(a){return r.core.mutate({trans:a,type:"delete",keys:e}).then(function(u){return zr(r,e,u)})}).then(function(a){var u=a.numFailures,l=a.failures;if(u===0)return a.lastResult;throw new me("".concat(r.name,".bulkDelete(): ").concat(u," of ").concat(o," operations failed"),l)})};var Ho=Be;function Be(){}function vr(e){function r(d,p){if(p){for(var w=arguments.length,O=new Array(w-1);--w;)O[w-1]=arguments[w];return o[d].subscribe.apply(null,O),e}if(typeof d=="string")return o[d]}var o={};r.addEventType=l;for(var a=1,u=arguments.length;a<u;++a)l(arguments[a]);return r;function l(d,p,w){var O,x;if(typeof d!="object")return p=p||Va,x={subscribers:[],fire:w=w||q,subscribe:function(v){x.subscribers.indexOf(v)===-1&&(x.subscribers.push(v),x.fire=p(x.fire,v))},unsubscribe:function(v){x.subscribers=x.subscribers.filter(function(C){return C!==v}),x.fire=x.subscribers.reduce(p,w)}},o[d]=r[d]=x;h(O=d).forEach(function(v){var C=O[v];if(y(C))l(v,O[v][0],O[v][1]);else{if(C!=="asap")throw new Y.InvalidArgument("Invalid event config");var E=l(v,Je,function(){for(var S=arguments.length,b=new Array(S);S--;)b[S]=arguments[S];E.subscribers.forEach(function(P){N(function(){P.apply(null,b)})})})}})}}function br(e,r){return g(r).from({prototype:e}),r}function er(e,r){return!(e.filter||e.algorithm||e.or)&&(r?e.justLimit:!e.replayFilter)}function Fn(e,r){e.filter=Kt(e.filter,r)}function qn(e,r,o){var a=e.replayFilter;e.replayFilter=a?function(){return Kt(a(),r())}:r,e.justLimit=o&&!a}function Vr(e,r){if(e.isPrimKey)return r.primaryKey;var o=r.getIndexByKeyPath(e.index);if(o)return o;throw new Y.Schema("KeyPath "+e.index+" on object store "+r.name+" is not indexed")}function Qo(e,r,o){var a=Vr(e,r.schema);return r.openCursor({trans:o,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:a,range:e.range}})}function Wr(e,r,o,a){var u,l,d=e.replayFilter?Kt(e.filter,e.replayFilter()):e.filter;return e.or?(u={},l=function(p,w,O){var x,v;d&&!d(w,O,function(C){return w.stop(C)},function(C){return w.fail(C)})||((v=""+(x=w.primaryKey))=="[object ArrayBuffer]"&&(v=""+new Uint8Array(x)),A(u,v))||(u[v]=!0,r(p,w,O))},Promise.all([e.or._iterate(l,o),Xo(Qo(e,a,o),e.algorithm,l,!e.keysOnly&&e.valueMapper)])):Xo(Qo(e,a,o),Kt(e.algorithm,d),r,!e.keysOnly&&e.valueMapper)}function Xo(e,r,o,a){var u=Me(a?function(l,d,p){return o(a(l),d,p)}:o);return e.then(function(l){if(l)return l.start(function(){var d=function(){return l.continue()};r&&!r(l,function(p){return d=p},function(p){l.stop(p),d=q},function(p){l.fail(p),d=q})||u(l.value,l,function(p){return d=p}),d()})})}Ce.prototype._read=function(e,r){var o=this._ctx;return o.error?o.table._trans(null,Ue.bind(null,o.error)):o.table._trans("readonly",e).then(r)},Ce.prototype._write=function(e){var r=this._ctx;return r.error?r.table._trans(null,Ue.bind(null,r.error)):r.table._trans("readwrite",e,"locked")},Ce.prototype._addAlgorithm=function(e){var r=this._ctx;r.algorithm=Kt(r.algorithm,e)},Ce.prototype._iterate=function(e,r){return Wr(this._ctx,e,r,this._ctx.table.core)},Ce.prototype.clone=function(e){var r=Object.create(this.constructor.prototype),o=Object.create(this._ctx);return e&&T(o,e),r._ctx=o,r},Ce.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ce.prototype.each=function(e){var r=this._ctx;return this._read(function(o){return Wr(r,e,o,r.table.core)})},Ce.prototype.count=function(e){var r=this;return this._read(function(o){var a,u=r._ctx,l=u.table.core;return er(u,!0)?l.count({trans:o,query:{index:Vr(u,l.schema),range:u.range}}).then(function(d){return Math.min(d,u.limit)}):(a=0,Wr(u,function(){return++a,!1},o,l).then(function(){return a}))}).then(e)},Ce.prototype.sortBy=function(e,r){var o=e.split(".").reverse(),a=o[0],u=o.length-1;function l(w,O){return O?l(w[o[O]],O-1):w[a]}var d=this._ctx.dir==="next"?1:-1;function p(w,O){return Se(l(w,u),l(O,u))*d}return this.toArray(function(w){return w.sort(p)}).then(r)},Ce.prototype.toArray=function(e){var r=this;return this._read(function(o){var a,u,l,d=r._ctx;return d.dir==="next"&&er(d,!0)&&0<d.limit?(a=d.valueMapper,u=Vr(d,d.table.core.schema),d.table.core.query({trans:o,limit:d.limit,values:!0,query:{index:u,range:d.range}}).then(function(p){return p=p.result,a?p.map(a):p})):(l=[],Wr(d,function(p){return l.push(p)},o,d.table.core).then(function(){return l}))},e)},Ce.prototype.offset=function(e){var r=this._ctx;return e<=0||(r.offset+=e,er(r)?qn(r,function(){var o=e;return function(a,u){return o===0||(o===1?--o:u(function(){a.advance(o),o=0}),!1)}}):qn(r,function(){var o=e;return function(){return--o<0}})),this},Ce.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),qn(this._ctx,function(){var r=e;return function(o,a,u){return--r<=0&&a(u),0<=r}},!0),this},Ce.prototype.until=function(e,r){return Fn(this._ctx,function(o,a,u){return!e(o.value)||(a(u),r)}),this},Ce.prototype.first=function(e){return this.limit(1).toArray(function(r){return r[0]}).then(e)},Ce.prototype.last=function(e){return this.reverse().first(e)},Ce.prototype.filter=function(e){var r;return Fn(this._ctx,function(o){return e(o.value)}),(r=this._ctx).isMatch=Kt(r.isMatch,e),this},Ce.prototype.and=function(e){return this.filter(e)},Ce.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Ce.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ce.prototype.desc=function(){return this.reverse()},Ce.prototype.eachKey=function(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(o,a){e(a.key,a)})},Ce.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Ce.prototype.eachPrimaryKey=function(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(o,a){e(a.primaryKey,a)})},Ce.prototype.keys=function(e){var r=this._ctx,o=(r.keysOnly=!r.isMatch,[]);return this.each(function(a,u){o.push(u.key)}).then(function(){return o}).then(e)},Ce.prototype.primaryKeys=function(e){var r=this._ctx;if(r.dir==="next"&&er(r,!0)&&0<r.limit)return this._read(function(a){var u=Vr(r,r.table.core.schema);return r.table.core.query({trans:a,values:!1,limit:r.limit,query:{index:u,range:r.range}})}).then(function(a){return a.result}).then(e);r.keysOnly=!r.isMatch;var o=[];return this.each(function(a,u){o.push(u.primaryKey)}).then(function(){return o}).then(e)},Ce.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Ce.prototype.firstKey=function(e){return this.limit(1).keys(function(r){return r[0]}).then(e)},Ce.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Ce.prototype.distinct=function(){var e,r=this._ctx,r=r.index&&r.table.schema.idxByName[r.index];return r&&r.multi&&(e={},Fn(this._ctx,function(a){var a=a.primaryKey.toString(),u=A(e,a);return e[a]=!0,!u})),this},Ce.prototype.modify=function(e){var r=this,o=this._ctx;return this._write(function(a){function u(b,P){var j=P.failures;C+=b-P.numFailures;for(var k=0,D=h(j);k<D.length;k++){var K=D[k];v.push(j[K])}}var l=typeof e=="function"?e:function(b){return Go(b,e)},d=o.table.core,x=d.schema.primaryKey,p=x.outbound,w=x.extractKey,O=200,x=r.db._options.modifyChunkSize,v=(x&&(O=typeof x=="object"?x[d.name]||x["*"]||200:x),[]),C=0,E=[],S=e===Jo;return r.clone().primaryKeys().then(function(b){function P(k){var D=Math.min(O,b.length-k),K=b.slice(k,k+D);return(S?Promise.resolve([]):d.getMany({trans:a,keys:K,cache:"immutable"})).then(function(Q){var X=[],L=[],oe=p?[]:null,te=S?K:[];if(!S)for(var U=0;U<D;++U){var ae=Q[U],_e={value:re(ae),primKey:b[k+U]};l.call(_e,_e.value,_e)!==!1&&(_e.value==null?te.push(b[k+U]):p||Se(w(ae),w(_e.value))===0?(L.push(_e.value),p&&oe.push(b[k+U])):(te.push(b[k+U]),X.push(_e.value)))}return Promise.resolve(0<X.length&&d.mutate({trans:a,type:"add",values:X}).then(function(Ee){for(var fe in Ee.failures)te.splice(parseInt(fe),1);u(X.length,Ee)})).then(function(){return(0<L.length||j&&typeof e=="object")&&d.mutate({trans:a,type:"put",keys:oe,values:L,criteria:j,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<k}).then(function(Ee){return u(L.length,Ee)})}).then(function(){return(0<te.length||j&&S)&&d.mutate({trans:a,type:"delete",keys:te,criteria:j,isAdditionalChunk:0<k}).then(function(Ee){return zr(o.table,te,Ee)}).then(function(Ee){return u(te.length,Ee)})}).then(function(){return b.length>k+D&&P(k+O)})})}var j=er(o)&&o.limit===1/0&&(typeof e!="function"||S)&&{index:o.index,range:o.range};return P(0).then(function(){if(0<v.length)throw new ge("Error modifying one or more objects",v,C,E);return b.length})})})},Ce.prototype.delete=function(){var e=this._ctx,r=e.range;return!er(e)||e.table.schema.yProps||!e.isPrimKey&&r.type!==3?this.modify(Jo):this._write(function(o){var a=e.table.core.schema.primaryKey,u=r;return e.table.core.count({trans:o,query:{index:a,range:u}}).then(function(l){return e.table.core.mutate({trans:o,type:"deleteRange",range:u}).then(function(w){var p=w.failures,w=w.numFailures;if(w)throw new ge("Could not delete some values",Object.keys(p).map(function(O){return p[O]}),l-w);return l-w})})})};var Qa=Ce;function Ce(){}var Jo=function(e,r){return r.value=null};function Xa(e,r){return e<r?-1:e===r?0:1}function Ja(e,r){return r<e?-1:e===r?0:1}function ot(e,r,o){return e=e instanceof ei?new e.Collection(e):e,e._ctx.error=new(o||TypeError)(r),e}function tr(e){return new e.Collection(e,function(){return Zo("")}).limit(0)}function Ur(E,r,o,a){var u,l,d,p,w,O,x,v=o.length;if(!o.every(function(b){return typeof b=="string"}))return ot(E,Lo);function C(b){u=b==="next"?function(j){return j.toUpperCase()}:function(j){return j.toLowerCase()},l=b==="next"?function(j){return j.toLowerCase()}:function(j){return j.toUpperCase()},d=b==="next"?Xa:Ja;var P=o.map(function(j){return{lower:l(j),upper:u(j)}}).sort(function(j,k){return d(j.lower,k.lower)});p=P.map(function(j){return j.upper}),w=P.map(function(j){return j.lower}),x=(O=b)==="next"?"":a}C("next");var E=new E.Collection(E,function(){return Tt(p[0],w[v-1]+a)}),S=(E._ondirectionchange=function(b){C(b)},0);return E._addAlgorithm(function(b,P,j){var k=b.key;if(typeof k=="string"){var D=l(k);if(r(D,w,S))return!0;for(var K=null,Q=S;Q<v;++Q){var X=((L,oe,te,U,ae,_e)=>{for(var Ee=Math.min(L.length,U.length),fe=-1,ve=0;ve<Ee;++ve){var Fe=oe[ve];if(Fe!==U[ve])return ae(L[ve],te[ve])<0?L.substr(0,ve)+te[ve]+te.substr(ve+1):ae(L[ve],U[ve])<0?L.substr(0,ve)+U[ve]+te.substr(ve+1):0<=fe?L.substr(0,fe)+oe[fe]+te.substr(fe+1):null;ae(L[ve],Fe)<0&&(fe=ve)}return Ee<U.length&&_e==="next"?L+te.substr(L.length):Ee<L.length&&_e==="prev"?L.substr(0,te.length):fe<0?null:L.substr(0,fe)+U[fe]+te.substr(fe+1)})(k,D,p[Q],w[Q],d,O);X===null&&K===null?S=Q+1:(K===null||0<d(K,X))&&(K=X)}P(K!==null?function(){b.continue(K+x)}:j)}return!1}),E}function Tt(e,r,o,a){return{type:2,lower:e,upper:r,lowerOpen:o,upperOpen:a}}function Zo(e){return{type:1,lower:e,upper:e}}Object.defineProperty(Qe.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Qe.prototype.between=function(e,r,o,a){o=o!==!1,a=a===!0;try{return 0<this._cmp(e,r)||this._cmp(e,r)===0&&(o||a)&&(!o||!a)?tr(this):new this.Collection(this,function(){return Tt(e,r,!o,!a)})}catch{return ot(this,yt)}},Qe.prototype.equals=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return Zo(e)})},Qe.prototype.above=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return Tt(e,void 0,!0)})},Qe.prototype.aboveOrEqual=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return Tt(e,void 0,!1)})},Qe.prototype.below=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return Tt(void 0,e,!1,!0)})},Qe.prototype.belowOrEqual=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return Tt(void 0,e)})},Qe.prototype.startsWith=function(e){return typeof e!="string"?ot(this,Lo):this.between(e,e+Nt,!0,!0)},Qe.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):Ur(this,function(r,o){return r.indexOf(o[0])===0},[e],Nt)},Qe.prototype.equalsIgnoreCase=function(e){return Ur(this,function(r,o){return r===o[0]},[e],"")},Qe.prototype.anyOfIgnoreCase=function(){var e=z.apply(rt,arguments);return e.length===0?tr(this):Ur(this,function(r,o){return o.indexOf(r)!==-1},e,"")},Qe.prototype.startsWithAnyOfIgnoreCase=function(){var e=z.apply(rt,arguments);return e.length===0?tr(this):Ur(this,function(r,o){return o.some(function(a){return r.indexOf(a)===0})},e,Nt)},Qe.prototype.anyOf=function(){var e,r,o=this,a=z.apply(rt,arguments),u=this._cmp;try{a.sort(u)}catch{return ot(this,yt)}return a.length===0?tr(this):((e=new this.Collection(this,function(){return Tt(a[0],a[a.length-1])}))._ondirectionchange=function(l){u=l==="next"?o._ascending:o._descending,a.sort(u)},r=0,e._addAlgorithm(function(l,d,p){for(var w=l.key;0<u(w,a[r]);)if(++r===a.length)return d(p),!1;return u(w,a[r])===0||(d(function(){l.continue(a[r])}),!1)}),e)},Qe.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Qe.prototype.noneOf=function(){var e=z.apply(rt,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return ot(this,yt)}var r=e.reduce(function(o,a){return o?o.concat([[o[o.length-1][1],a]]):[[-1/0,a]]},null);return r.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})},Qe.prototype.inAnyRange=function(e,j){var o=this,a=this._cmp,u=this._ascending,l=this._descending,d=this._min,p=this._max;if(e.length===0)return tr(this);if(!e.every(function(k){return k[0]!==void 0&&k[1]!==void 0&&u(k[0],k[1])<=0}))return ot(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Y.InvalidArgument);var w=!j||j.includeLowers!==!1,O=j&&j.includeUppers===!0,x,v=u;function C(k,D){return v(k[0],D[0])}try{(x=e.reduce(function(k,D){for(var K=0,Q=k.length;K<Q;++K){var X=k[K];if(a(D[0],X[1])<0&&0<a(D[1],X[0])){X[0]=d(X[0],D[0]),X[1]=p(X[1],D[1]);break}}return K===Q&&k.push(D),k},[])).sort(C)}catch{return ot(this,yt)}var E=0,S=O?function(k){return 0<u(k,x[E][1])}:function(k){return 0<=u(k,x[E][1])},b=w?function(k){return 0<l(k,x[E][0])}:function(k){return 0<=l(k,x[E][0])},P=S,j=new this.Collection(this,function(){return Tt(x[0][0],x[x.length-1][1],!w,!O)});return j._ondirectionchange=function(k){v=k==="next"?(P=S,u):(P=b,l),x.sort(C)},j._addAlgorithm(function(k,D,K){for(var Q,X=k.key;P(X);)if(++E===x.length)return D(K),!1;return!S(Q=X)&&!b(Q)||(o._cmp(X,x[E][1])===0||o._cmp(X,x[E][0])===0||D(function(){v===u?k.continue(x[E][0]):k.continue(x[E][1])}),!1)}),j},Qe.prototype.startsWithAnyOf=function(){var e=z.apply(rt,arguments);return e.every(function(r){return typeof r=="string"})?e.length===0?tr(this):this.inAnyRange(e.map(function(r){return[r,r+Nt]})):ot(this,"startsWithAnyOf() only works with strings")};var ei=Qe;function Qe(){}function pt(e){return Me(function(r){return wr(r),e(r.target.error),!1})}function wr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var xr="storagemutated",Ln="x-storagemutated-1",kt=vr(null,xr),Za=(ht.prototype._lock=function(){return J(!se.global),++this._reculock,this._reculock!==1||se.global||(se.lockOwnerFor=this),this},ht.prototype._unlock=function(){if(J(!se.global),--this._reculock==0)for(se.global||(se.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Mt(e[1],e[0])}catch{}}return this},ht.prototype._locked=function(){return this._reculock&&se.lockOwnerFor!==this},ht.prototype.create=function(e){var r=this;if(this.mode){var o=this.db.idbdb,a=this.db._state.dbOpenError;if(J(!this.idbtrans),!e&&!o)switch(a&&a.name){case"DatabaseClosedError":throw new Y.DatabaseClosed(a);case"MissingAPIError":throw new Y.MissingAPI(a.message,a);default:throw new Y.OpenFailed(a)}if(!this.active)throw new Y.TransactionInactive;J(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||o).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Me(function(u){wr(u),r._reject(e.error)}),e.onabort=Me(function(u){wr(u),r.active&&r._reject(new Y.Abort(e.error)),r.active=!1,r.on("abort").fire(u)}),e.oncomplete=Me(function(){r.active=!1,r._resolve(),"mutatedParts"in e&&kt.storagemutated.fire(e.mutatedParts)})}return this},ht.prototype._promise=function(e,r,o){var a,u=this;return e==="readwrite"&&this.mode!=="readwrite"?Ue(new Y.ReadOnly("Transaction is readonly")):this.active?this._locked()?new ee(function(l,d){u._blockedFuncs.push([function(){u._promise(e,r,o).then(l,d)},se])}):o?_t(function(){var l=new ee(function(d,p){u._lock();var w=r(d,p,u);w&&w.then&&w.then(d,p)});return l.finally(function(){return u._unlock()}),l._lib=!0,l}):((a=new ee(function(l,d){var p=r(l,d,u);p&&p.then&&p.then(l,d)}))._lib=!0,a):Ue(new Y.TransactionInactive)},ht.prototype._root=function(){return this.parent?this.parent._root():this},ht.prototype.waitFor=function(e){var r,o=this._root(),a=ee.resolve(e),u=(o._waitingFor?o._waitingFor=o._waitingFor.then(function(){return a}):(o._waitingFor=a,o._waitingQueue=[],r=o.idbtrans.objectStore(o.storeNames[0]),(function l(){for(++o._spinCount;o._waitingQueue.length;)o._waitingQueue.shift()();o._waitingFor&&(r.get(-1/0).onsuccess=l)})()),o._waitingFor);return new ee(function(l,d){a.then(function(p){return o._waitingQueue.push(Me(l.bind(null,p)))},function(p){return o._waitingQueue.push(Me(d.bind(null,p)))}).finally(function(){o._waitingFor===u&&(o._waitingFor=null)})})},ht.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new Y.Abort))},ht.prototype.table=function(e){var r=this._memoizedTables||(this._memoizedTables={});if(A(r,e))return r[e];var o=this.schema[e];if(o)return(o=new this.db.Table(e,o,this)).core=this.db.core.table(e),r[e]=o;throw new Y.NotFound("Table "+e+" not part of transaction")},ht);function ht(){}function zn(e,r,o,a,u,l,d,p){return{name:e,keyPath:r,unique:o,multi:a,auto:u,compound:l,src:(o&&!d?"&":"")+(a?"*":"")+(u?"++":"")+ti(r),type:p}}function ti(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Vn(e,r,o){return{name:e,primKey:r,indexes:o,mappedClass:null,idxByName:(a=function(u){return[u.name,u]},o.reduce(function(u,l,d){return l=a(l,d),l&&(u[l[0]]=l[1]),u},{}))};var a}var Sr=function(e){try{return e.only([[]]),Sr=function(){return[[]]},[[]]}catch{return Sr=function(){return Nt},Nt}};function Wn(e){return e==null?function(){}:typeof e=="string"?(r=e).split(".").length===1?function(o){return o[r]}:function(o){return G(o,r)}:function(o){return G(o,e)};var r}function ri(e){return[].slice.call(e)}var es=0;function _r(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function ts(e,r,w){function a(S){if(S.type===3)return null;if(S.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var v=S.lower,C=S.upper,E=S.lowerOpen,S=S.upperOpen;return v===void 0?C===void 0?null:r.upperBound(C,!!S):C===void 0?r.lowerBound(v,!!E):r.bound(v,C,!!E,!!S)}function u(x){var v,C=x.name;return{name:C,schema:x,mutate:function(E){var S=E.trans,b=E.type,P=E.keys,j=E.values,k=E.range;return new Promise(function(D,K){D=Me(D);var Q=S.objectStore(C),X=Q.keyPath==null,L=b==="put"||b==="add";if(!L&&b!=="delete"&&b!=="deleteRange")throw new Error("Invalid operation type: "+b);var oe,te=(P||j||{length:1}).length;if(P&&j&&P.length!==j.length)throw new Error("Given keys array must have same length as given values array.");if(te===0)return D({numFailures:0,failures:{},results:[],lastResult:void 0});function U(ze){++Ee,wr(ze)}var ae=[],_e=[],Ee=0;if(b==="deleteRange"){if(k.type===4)return D({numFailures:Ee,failures:_e,results:[],lastResult:void 0});k.type===3?ae.push(oe=Q.clear()):ae.push(oe=Q.delete(a(k)))}else{var X=L?X?[j,P]:[j,null]:[P,null],fe=X[0],ve=X[1];if(L)for(var Fe=0;Fe<te;++Fe)ae.push(oe=ve&&ve[Fe]!==void 0?Q[b](fe[Fe],ve[Fe]):Q[b](fe[Fe])),oe.onerror=U;else for(Fe=0;Fe<te;++Fe)ae.push(oe=Q[b](fe[Fe])),oe.onerror=U}function st(ze){ze=ze.target.result,ae.forEach(function(Lt,co){return Lt.error!=null&&(_e[co]=Lt.error)}),D({numFailures:Ee,failures:_e,results:b==="delete"?P:ae.map(function(Lt){return Lt.result}),lastResult:ze})}oe.onerror=function(ze){U(ze),st(ze)},oe.onsuccess=st})},getMany:function(E){var S=E.trans,b=E.keys;return new Promise(function(P,j){P=Me(P);for(var k,D=S.objectStore(C),K=b.length,Q=new Array(K),X=0,L=0,oe=function(ae){ae=ae.target,Q[ae._pos]=ae.result,++L===X&&P(Q)},te=pt(j),U=0;U<K;++U)b[U]!=null&&((k=D.get(b[U]))._pos=U,k.onsuccess=oe,k.onerror=te,++X);X===0&&P(Q)})},get:function(E){var S=E.trans,b=E.key;return new Promise(function(P,j){P=Me(P);var k=S.objectStore(C).get(b);k.onsuccess=function(D){return P(D.target.result)},k.onerror=pt(j)})},query:(v=p,function(E){return new Promise(function(S,b){S=Me(S);var P,j,k,L=E.trans,D=E.values,K=E.limit,X=E.query,Q=K===1/0?void 0:K,oe=X.index,X=X.range,L=L.objectStore(C),L=oe.isPrimaryKey?L:L.index(oe.name),oe=a(X);if(K===0)return S({result:[]});v?((X=D?L.getAll(oe,Q):L.getAllKeys(oe,Q)).onsuccess=function(te){return S({result:te.target.result})},X.onerror=pt(b)):(P=0,j=!D&&"openKeyCursor"in L?L.openKeyCursor(oe):L.openCursor(oe),k=[],j.onsuccess=function(te){var U=j.result;return!U||(k.push(D?U.value:U.primaryKey),++P===K)?S({result:k}):void U.continue()},j.onerror=pt(b))})}),openCursor:function(E){var S=E.trans,b=E.values,P=E.query,j=E.reverse,k=E.unique;return new Promise(function(D,K){D=Me(D);var L=P.index,Q=P.range,X=S.objectStore(C),X=L.isPrimaryKey?X:X.index(L.name),L=j?k?"prevunique":"prev":k?"nextunique":"next",oe=!b&&"openKeyCursor"in X?X.openKeyCursor(a(Q),L):X.openCursor(a(Q),L);oe.onerror=pt(K),oe.onsuccess=Me(function(te){var U,ae,_e,Ee,fe=oe.result;fe?(fe.___id=++es,fe.done=!1,U=fe.continue.bind(fe),ae=(ae=fe.continuePrimaryKey)&&ae.bind(fe),_e=fe.advance.bind(fe),Ee=function(){throw new Error("Cursor not stopped")},fe.trans=S,fe.stop=fe.continue=fe.continuePrimaryKey=fe.advance=function(){throw new Error("Cursor not started")},fe.fail=Me(K),fe.next=function(){var ve=this,Fe=1;return this.start(function(){return Fe--?ve.continue():ve.stop()}).then(function(){return ve})},fe.start=function(ve){function Fe(){if(oe.result)try{ve()}catch(ze){fe.fail(ze)}else fe.done=!0,fe.start=function(){throw new Error("Cursor behind last entry")},fe.stop()}var st=new Promise(function(ze,Lt){ze=Me(ze),oe.onerror=pt(Lt),fe.fail=Lt,fe.stop=function(co){fe.stop=fe.continue=fe.continuePrimaryKey=fe.advance=Ee,ze(co)}});return oe.onsuccess=Me(function(ze){oe.onsuccess=Fe,Fe()}),fe.continue=U,fe.continuePrimaryKey=ae,fe.advance=_e,Fe(),st},D(fe)):D(null)},K)})},count:function(E){var S=E.query,b=E.trans,P=S.index,j=S.range;return new Promise(function(k,D){var K=b.objectStore(C),K=P.isPrimaryKey?K:K.index(P.name),Q=a(j),Q=Q?K.count(Q):K.count();Q.onsuccess=Me(function(X){return k(X.target.result)}),Q.onerror=pt(D)})}}}l=w,d=ri((w=e).objectStoreNames);var l,w={schema:{name:w.name,tables:d.map(function(x){return l.objectStore(x)}).map(function(x){var v=x.keyPath,C=x.autoIncrement,S=y(v),E={},S={name:x.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:v==null,compound:S,keyPath:v,autoIncrement:C,unique:!0,extractKey:Wn(v)},indexes:ri(x.indexNames).map(function(b){return x.index(b)}).map(function(k){var D=k.name,P=k.unique,j=k.multiEntry,k=k.keyPath,D={name:D,compound:y(k),keyPath:k,unique:P,multiEntry:j,extractKey:Wn(k)};return E[_r(k)]=D}),getIndexByKeyPath:function(b){return E[_r(b)]}};return E[":id"]=S.primaryKey,v!=null&&(E[_r(v)]=S.primaryKey),S})},hasGetAll:0<d.length&&"getAll"in l.objectStore(d[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)},d=w.schema,p=w.hasGetAll,w=d.tables.map(u),O={};return w.forEach(function(x){return O[x.name]=x}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(x){if(O[x])return O[x];throw new Error("Table '".concat(x,"' not found"))},MIN_KEY:-1/0,MAX_KEY:Sr(r),schema:d}}function rs(e,r,o,a){return o=o.IDBKeyRange,r=ts(r,o,a),{dbcore:e.dbcore.reduce(function(u,l){return l=l.create,s(s({},u),l(u))},r)}}function Yr(e,r){var o=r.db,o=rs(e._middlewares,o,e._deps,r);e.core=o.dbcore,e.tables.forEach(function(a){var u=a.name;e.core.schema.tables.some(function(l){return l.name===u})&&(a.core=e.core.table(u),e[u]instanceof e.Table)&&(e[u].core=a.core)})}function Gr(e,r,o,a){o.forEach(function(u){var l=a[u];r.forEach(function(d){var p=(function w(O,x){return V(O,x)||(O=_(O))&&w(O,x)})(d,u);(!p||"value"in p&&p.value===void 0)&&(d===e.Transaction.prototype||d instanceof e.Transaction?M(d,u,{get:function(){return this.table(u)},set:function(w){F(this,u,{value:w,writable:!0,configurable:!0,enumerable:!0})}}):d[u]=new e.Table(u,l))})})}function Un(e,r){r.forEach(function(o){for(var a in o)o[a]instanceof e.Table&&delete o[a]})}function ns(e,r){return e._cfg.version-r._cfg.version}function os(e,r,o,a){var u=e._dbSchema,l=(o.objectStoreNames.contains("$meta")&&!u.$meta&&(u.$meta=Vn("$meta",oi("")[0],[]),e._storeNames.push("$meta")),e._createTransaction("readwrite",e._storeNames,u)),d=(l.create(o),l._completion.catch(a),l._reject.bind(l)),p=se.transless||se;_t(function(){if(se.trans=l,se.transless=p,r!==0)return Yr(e,o),O=r,((w=l).storeNames.includes("$meta")?w.table("$meta").get("version").then(function(x){return x??O}):ee.resolve(O)).then(function(P){var v=e,C=P,E=l,S=o,b=[],P=v._versions,j=v._dbSchema=Qr(0,v.idbdb,S);return(P=P.filter(function(k){return k._cfg.version>=C})).length===0?ee.resolve():(P.forEach(function(k){b.push(function(){var D,K,Q,X=j,L=k._cfg.dbschema,oe=(Xr(v,X,S),Xr(v,L,S),j=v._dbSchema=L,Yn(X,L)),te=(oe.add.forEach(function(U){Gn(S,U[0],U[1].primKey,U[1].indexes)}),oe.change.forEach(function(U){if(U.recreate)throw new Y.Upgrade("Not yet support for changing primary key");var ae=S.objectStore(U.name);U.add.forEach(function(_e){return Hr(ae,_e)}),U.change.forEach(function(_e){ae.deleteIndex(_e.name),Hr(ae,_e)}),U.del.forEach(function(_e){return ae.deleteIndex(_e)})}),k._cfg.contentUpgrade);if(te&&k._cfg.version>C)return Yr(v,S),E._memoizedTables={},D=Pe(L),oe.del.forEach(function(U){D[U]=X[U]}),Un(v,[v.Transaction.prototype]),Gr(v,[v.Transaction.prototype],h(D),D),E.schema=D,(K=ie(te))&&Jt(),L=ee.follow(function(){var U;(Q=te(E))&&K&&(U=Ct.bind(null,null),Q.then(U,U))}),Q&&typeof Q.then=="function"?ee.resolve(Q):L.then(function(){return Q})}),b.push(function(D){var K,Q,X=k._cfg.dbschema;K=X,Q=D,[].slice.call(Q.db.objectStoreNames).forEach(function(L){return K[L]==null&&Q.db.deleteObjectStore(L)}),Un(v,[v.Transaction.prototype]),Gr(v,[v.Transaction.prototype],v._storeNames,v._dbSchema),E.schema=v._dbSchema}),b.push(function(D){v.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(v.idbdb.version/10)===k._cfg.version?(v.idbdb.deleteObjectStore("$meta"),delete v._dbSchema.$meta,v._storeNames=v._storeNames.filter(function(K){return K!=="$meta"})):D.objectStore("$meta").put(k._cfg.version,"version"))})}),(function k(){return b.length?ee.resolve(b.shift()(E.idbtrans)).then(k):ee.resolve()})().then(function(){ni(j,S)}))}).catch(d);var w,O;h(u).forEach(function(x){Gn(o,x,u[x].primKey,u[x].indexes)}),Yr(e,o),ee.follow(function(){return e.on.populate.fire(l)}).catch(d)})}function is(e,r){ni(e._dbSchema,r),r.db.version%10!=0||r.objectStoreNames.contains("$meta")||r.db.createObjectStore("$meta").add(Math.ceil(r.db.version/10-1),"version");var o=Qr(0,e.idbdb,r);Xr(e,e._dbSchema,r);for(var a=0,u=Yn(o,e._dbSchema).change;a<u.length;a++){var l=(d=>{if(d.change.length||d.recreate)return console.warn("Unable to patch indexes of table ".concat(d.name," because it has changes on the type of index or primary key.")),{value:void 0};var p=r.objectStore(d.name);d.add.forEach(function(w){dt&&console.debug("Dexie upgrade patch: Creating missing index ".concat(d.name,".").concat(w.src)),Hr(p,w)})})(u[a]);if(typeof l=="object")return l.value}}function Yn(e,r){var o,a={del:[],add:[],change:[]};for(o in e)r[o]||a.del.push(o);for(o in r){var u=e[o],l=r[o];if(u){var d={name:o,def:l,recreate:!1,del:[],add:[],change:[]};if(""+(u.primKey.keyPath||"")!=""+(l.primKey.keyPath||"")||u.primKey.auto!==l.primKey.auto)d.recreate=!0,a.change.push(d);else{var p=u.idxByName,w=l.idxByName,O=void 0;for(O in p)w[O]||d.del.push(O);for(O in w){var x=p[O],v=w[O];x?x.src!==v.src&&d.change.push(v):d.add.push(v)}(0<d.del.length||0<d.add.length||0<d.change.length)&&a.change.push(d)}}else a.add.push([o,l])}return a}function Gn(e,r,o,a){var u=e.db.createObjectStore(r,o.keyPath?{keyPath:o.keyPath,autoIncrement:o.auto}:{autoIncrement:o.auto});a.forEach(function(l){return Hr(u,l)})}function ni(e,r){h(e).forEach(function(o){r.db.objectStoreNames.contains(o)||(dt&&console.debug("Dexie: Creating missing table",o),Gn(r,o,e[o].primKey,e[o].indexes))})}function Hr(e,r){e.createIndex(r.name,r.keyPath,{unique:r.unique,multiEntry:r.multi})}function Qr(e,r,o){var a={};return W(r.objectStoreNames,0).forEach(function(u){for(var l=o.objectStore(u),d=zn(ti(O=l.keyPath),O||"",!0,!1,!!l.autoIncrement,O&&typeof O!="string",!0),p=[],w=0;w<l.indexNames.length;++w){var x=l.index(l.indexNames[w]),O=x.keyPath,x=zn(x.name,O,!!x.unique,!!x.multiEntry,!1,O&&typeof O!="string",!1);p.push(x)}a[u]=Vn(u,d,p)}),a}function Xr(e,r,o){for(var a=o.db.objectStoreNames,u=0;u<a.length;++u){var l=a[u],d=o.objectStore(l);e._hasGetAll="getAll"in d;for(var p=0;p<d.indexNames.length;++p){var w,O=d.indexNames[p],x=d.index(O).keyPath,x=typeof x=="string"?x:"["+W(x).join("+")+"]";r[l]&&(w=r[l].idxByName[x])&&(w.name=O,delete r[l].idxByName[x],r[l].idxByName[O]=w)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&f.WorkerGlobalScope&&f instanceof f.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function oi(e){return e.split(",").map(function(r,o){var u=r.split(":"),a=(a=u[1])==null?void 0:a.trim(),u=(r=u[0].trim()).replace(/([&*]|\+\+)/g,""),l=/^\[/.test(u)?u.match(/^\[(.*)\]$/)[1].split("+"):u;return zn(u,l||null,/\&/.test(r),/\*/.test(r),/\+\+/.test(r),y(l),o===0,a)})}rr.prototype._createTableSchema=Vn,rr.prototype._parseIndexSyntax=oi,rr.prototype._parseStoresSpec=function(e,r){var o=this;h(e).forEach(function(a){if(e[a]!==null){var u=o._parseIndexSyntax(e[a]),l=u.shift();if(!l)throw new Y.Schema("Invalid schema for table "+a+": "+e[a]);if(l.unique=!0,l.multi)throw new Y.Schema("Primary key cannot be multiEntry*");u.forEach(function(d){if(d.auto)throw new Y.Schema("Only primary key can be marked as autoIncrement (++)");if(!d.keyPath)throw new Y.Schema("Index must have a name and cannot be an empty string")}),l=o._createTableSchema(a,l,u),r[a]=l}})},rr.prototype.stores=function(o){var r=this.db,o=(this._cfg.storesSource=this._cfg.storesSource?T(this._cfg.storesSource,o):o,r._versions),a={},u={};return o.forEach(function(l){T(a,l._cfg.storesSource),u=l._cfg.dbschema={},l._parseStoresSpec(a,u)}),r._dbSchema=u,Un(r,[r._allTables,r,r.Transaction.prototype]),Gr(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],h(u),u),r._storeNames=h(u),this},rr.prototype.upgrade=function(e){return this._cfg.contentUpgrade=An(this._cfg.contentUpgrade||q,e),this};var as=rr;function rr(){}function Hn(e,r){var o=e._dbNamesDB;return o||(o=e._dbNamesDB=new gt(qr,{addons:[],indexedDB:e,IDBKeyRange:r})).version(1).stores({dbnames:"name"}),o.table("dbnames")}function Qn(e){return e&&typeof e.databases=="function"}function Xn(e){return _t(function(){return se.letThrough=!0,e()})}function Jn(e){return!("from"in e)}var Ze=function(e,r){var o;if(!this)return o=new Ze,e&&"d"in e&&T(o,e),o;T(this,arguments.length?{d:1,from:e,to:1<arguments.length?r:e}:{d:0})};function Cr(e,r,o){var a=Se(r,o);if(!isNaN(a)){if(0<a)throw RangeError();if(Jn(e))return T(e,{from:r,to:o,d:1});var a=e.l,u=e.r;if(Se(o,e.from)<0)return a?Cr(a,r,o):e.l={from:r,to:o,d:1,l:null,r:null},ai(e);if(0<Se(r,e.to))return u?Cr(u,r,o):e.r={from:r,to:o,d:1,l:null,r:null},ai(e);Se(r,e.from)<0&&(e.from=r,e.l=null,e.d=u?u.d+1:1),0<Se(o,e.to)&&(e.to=o,e.r=null,e.d=e.l?e.l.d+1:1),r=!e.r,a&&!e.l&&Er(e,a),u&&r&&Er(e,u)}}function Er(e,r){Jn(r)||(function o(a,u){var l=u.from,d=u.l,p=u.r;Cr(a,l,u.to),d&&o(a,d),p&&o(a,p)})(e,r)}function ii(e,r){var o=Jr(r),a=o.next();if(!a.done)for(var u=a.value,l=Jr(e),d=l.next(u.from),p=d.value;!a.done&&!d.done;){if(Se(p.from,u.to)<=0&&0<=Se(p.to,u.from))return!0;Se(u.from,p.from)<0?u=(a=o.next(p.from)).value:p=(d=l.next(u.from)).value}return!1}function Jr(e){var r=Jn(e)?null:{s:0,n:e};return{next:function(o){for(var a=0<arguments.length;r;)switch(r.s){case 0:if(r.s=1,a)for(;r.n.l&&Se(o,r.n.from)<0;)r={up:r,n:r.n.l,s:1};else for(;r.n.l;)r={up:r,n:r.n.l,s:1};case 1:if(r.s=2,!a||Se(o,r.n.to)<=0)return{value:r.n,done:!1};case 2:if(r.n.r){r.s=3,r={up:r,n:r.n.r,s:0};continue}case 3:r=r.up}return{done:!0}}}}function ai(e){var r,o,a,u=(((u=e.r)==null?void 0:u.d)||0)-(((u=e.l)==null?void 0:u.d)||0),u=1<u?"r":u<-1?"l":"";u&&(r=u=="r"?"l":"r",o=s({},e),a=e[u],e.from=a.from,e.to=a.to,e[u]=a[u],o[u]=a[r],(e[r]=o).d=si(o)),e.d=si(e)}function si(o){var r=o.r,o=o.l;return(r?o?Math.max(r.d,o.d):r.d:o?o.d:0)+1}function Zr(e,r){return h(r).forEach(function(o){e[o]?Er(e[o],r[o]):e[o]=(function a(u){var l,d,p={};for(l in u)A(u,l)&&(d=u[l],p[l]=!d||typeof d!="object"||Re.has(d.constructor)?d:a(d));return p})(r[o])}),e}function Zn(e,r){return e.all||r.all||Object.keys(e).some(function(o){return r[o]&&ii(r[o],e[o])})}I(Ze.prototype,((nt={add:function(e){return Er(this,e),this},addKey:function(e){return Cr(this,e,e),this},addKeys:function(e){var r=this;return e.forEach(function(o){return Cr(r,o,o)}),this},hasKey:function(e){var r=Jr(this).next(e).value;return r&&Se(r.from,e)<=0&&0<=Se(r.to,e)}})[ye]=function(){return Jr(this)},nt));var Ft={},eo={},to=!1;function en(e){Zr(eo,e),to||(to=!0,setTimeout(function(){to=!1,ro(eo,!(eo={}))},0))}function ro(e,r){r===void 0&&(r=!1);var o=new Set;if(e.all)for(var a=0,u=Object.values(Ft);a<u.length;a++)ui(p=u[a],e,o,r);else for(var l in e){var d,p,l=/^idb\:\/\/(.*)\/(.*)\//.exec(l);l&&(d=l[1],l=l[2],p=Ft["idb://".concat(d,"/").concat(l)])&&ui(p,e,o,r)}o.forEach(function(w){return w()})}function ui(e,r,o,a){for(var u=[],l=0,d=Object.entries(e.queries.query);l<d.length;l++){for(var p=d[l],w=p[0],O=[],x=0,v=p[1];x<v.length;x++){var C=v[x];Zn(r,C.obsSet)?C.subscribers.forEach(function(P){return o.add(P)}):a&&O.push(C)}a&&u.push([w,O])}if(a)for(var E=0,S=u;E<S.length;E++){var b=S[E],w=b[0],O=b[1];e.queries.query[w]=O}}function ss(e){var r=e._state,o=e._deps.indexedDB;if(r.isBeingOpened||e.idbdb)return r.dbReadyPromise.then(function(){return r.dbOpenError?Ue(r.dbOpenError):e});r.isBeingOpened=!0,r.dbOpenError=null,r.openComplete=!1;var a=r.openCanceller,u=Math.round(10*e.verno),l=!1;function d(){if(r.openCanceller!==a)throw new Y.DatabaseClosed("db.open() was cancelled")}function p(){return new ee(function(C,E){if(d(),!o)throw new Y.MissingAPI;var S=e.name,b=r.autoSchema||!u?o.open(S):o.open(S,u);if(!b)throw new Y.MissingAPI;b.onerror=pt(E),b.onblocked=Me(e._fireOnBlocked),b.onupgradeneeded=Me(function(P){var j;x=b.transaction,r.autoSchema&&!e._options.allowEmptyDB?(b.onerror=wr,x.abort(),b.result.close(),(j=o.deleteDatabase(S)).onsuccess=j.onerror=Me(function(){E(new Y.NoSuchDatabase("Database ".concat(S," doesnt exist")))})):(x.onerror=pt(E),j=P.oldVersion>Math.pow(2,62)?0:P.oldVersion,v=j<1,e.idbdb=b.result,l&&is(e,x),os(e,j/10,x,E))},E),b.onsuccess=Me(function(){x=null;var P,j,k,D,K,Q,X=e.idbdb=b.result,L=W(X.objectStoreNames);if(0<L.length)try{var oe=X.transaction((K=L).length===1?K[0]:K,"readonly");if(r.autoSchema)Q=X,D=oe,(k=e).verno=Q.version/10,D=k._dbSchema=Qr(0,Q,D),k._storeNames=W(Q.objectStoreNames,0),Gr(k,[k._allTables],h(D),D);else if(Xr(e,e._dbSchema,oe),j=oe,((j=Yn(Qr(0,(P=e).idbdb,j),P._dbSchema)).add.length||j.change.some(function(te){return te.add.length||te.change.length}))&&!l)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),X.close(),u=X.version+1,l=!0,C(p());Yr(e,oe)}catch{}Zt.push(e),X.onversionchange=Me(function(te){r.vcFired=!0,e.on("versionchange").fire(te)}),X.onclose=Me(function(){e.close({disableAutoOpen:!1})}),v&&(L=e._deps,K=S,Qn(Q=L.indexedDB)||K===qr||Hn(Q,L.IDBKeyRange).put({name:K}).catch(q)),C()},E)}).catch(function(C){switch(C==null?void 0:C.name){case"UnknownError":if(0<r.PR1398_maxLoop)return r.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),p();break;case"VersionError":if(0<u)return u=0,p()}return ee.reject(C)})}var w,O=r.dbReadyResolve,x=null,v=!1;return ee.race([a,(typeof navigator>"u"?ee.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(C){function E(){return indexedDB.databases().finally(C)}w=setInterval(E,100),E()}).finally(function(){return clearInterval(w)}):Promise.resolve()).then(p)]).then(function(){return d(),r.onReadyBeingFired=[],ee.resolve(Xn(function(){return e.on.ready.fire(e.vip)})).then(function C(){var E;if(0<r.onReadyBeingFired.length)return E=r.onReadyBeingFired.reduce(An,q),r.onReadyBeingFired=[],ee.resolve(Xn(function(){return E(e.vip)})).then(C)})}).finally(function(){r.openCanceller===a&&(r.onReadyBeingFired=null,r.isBeingOpened=!1)}).catch(function(C){r.dbOpenError=C;try{x&&x.abort()}catch{}return a===r.openCanceller&&e._close(),Ue(C)}).finally(function(){r.openComplete=!0,O()}).then(function(){var C;return v&&(C={},e.tables.forEach(function(E){E.schema.indexes.forEach(function(S){S.name&&(C["idb://".concat(e.name,"/").concat(E.name,"/").concat(S.name)]=new Ze(-1/0,[[[]]]))}),C["idb://".concat(e.name,"/").concat(E.name,"/")]=C["idb://".concat(e.name,"/").concat(E.name,"/:dels")]=new Ze(-1/0,[[[]]])}),kt(xr).fire(C),ro(C,!0)),e})}function no(e){function r(l){return e.next(l)}var o=u(r),a=u(function(l){return e.throw(l)});function u(l){return function(p){var p=l(p),w=p.value;return p.done?w:w&&typeof w.then=="function"?w.then(o,a):y(w)?Promise.all(w).then(o,a):o(w)}}return u(r)()}function tn(e,r,o){for(var a=y(e)?e.slice():[e],u=0;u<o;++u)a.push(r);return a}var us={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return s(s({},e),{table:function(a){var o=e.table(a),a=o.schema,u={},l=[];function d(C,E,S){var k=_r(C),b=u[k]=u[k]||[],P=C==null?0:typeof C=="string"?1:C.length,j=0<E,k=s(s({},S),{name:j?"".concat(k,"(virtual-from:").concat(S.name,")"):S.name,lowLevelIndex:S,isVirtual:j,keyTail:E,keyLength:P,extractKey:Wn(C),unique:!j&&S.unique});return b.push(k),k.isPrimaryKey||l.push(k),1<P&&d(P===2?C[0]:C.slice(0,P-1),E+1,S),b.sort(function(D,K){return D.keyTail-K.keyTail}),k}var p=d(a.primaryKey.keyPath,0,a.primaryKey);u[":id"]=[p];for(var w=0,O=a.indexes;w<O.length;w++){var x=O[w];d(x.keyPath,0,x)}function v(C){var E,S=C.query.index;return S.isVirtual?s(s({},C),{query:{index:S.lowLevelIndex,range:(E=C.query.range,S=S.keyTail,{type:E.type===1?2:E.type,lower:tn(E.lower,E.lowerOpen?e.MAX_KEY:e.MIN_KEY,S),lowerOpen:!0,upper:tn(E.upper,E.upperOpen?e.MIN_KEY:e.MAX_KEY,S),upperOpen:!0})}}):C}return s(s({},o),{schema:s(s({},a),{primaryKey:p,indexes:l,getIndexByKeyPath:function(C){return(C=u[_r(C)])&&C[0]}}),count:function(C){return o.count(v(C))},query:function(C){return o.query(v(C))},openCursor:function(C){var E=C.query.index,S=E.keyTail,b=E.keyLength;return E.isVirtual?o.openCursor(v(C)).then(function(j){return j&&P(j)}):o.openCursor(C);function P(j){return Object.create(j,{continue:{value:function(k){k!=null?j.continue(tn(k,C.reverse?e.MAX_KEY:e.MIN_KEY,S)):C.unique?j.continue(j.key.slice(0,b).concat(C.reverse?e.MIN_KEY:e.MAX_KEY,S)):j.continue()}},continuePrimaryKey:{value:function(k,D){j.continuePrimaryKey(tn(k,e.MAX_KEY,S),D)}},primaryKey:{get:function(){return j.primaryKey}},key:{get:function(){var k=j.key;return b===1?k[0]:k.slice(0,b)}},value:{get:function(){return j.value}}})}}})}})}};function oo(e,r,o,a){return o=o||{},a=a||"",h(e).forEach(function(u){var l,d,p;A(r,u)?(l=e[u],d=r[u],typeof l=="object"&&typeof d=="object"&&l&&d?(p=de(l))!==de(d)?o[a+u]=r[u]:p==="Object"?oo(l,d,o,a+u+"."):l!==d&&(o[a+u]=r[u]):l!==d&&(o[a+u]=r[u])):o[a+u]=void 0}),h(r).forEach(function(u){A(e,u)||(o[a+u]=r[u])}),o}function io(e,r){return r.type==="delete"?r.keys:r.keys||r.values.map(e.extractKey)}var cs={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return s(s({},e),{table:function(r){var o=e.table(r),a=o.schema.primaryKey;return s(s({},o),{mutate:function(u){var l=se.trans,d=l.table(r).hook,p=d.deleting,w=d.creating,O=d.updating;switch(u.type){case"add":if(w.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"put":if(w.fire===q&&O.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"delete":if(p.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"deleteRange":if(p.fire===q)break;return l._promise("readwrite",function(){return(function v(C,E,S){return o.query({trans:C,values:!1,query:{index:a,range:E},limit:S}).then(function(b){var P=b.result;return x({type:"delete",keys:P,trans:C}).then(function(j){return 0<j.numFailures?Promise.reject(j.failures[0]):P.length<S?{failures:[],numFailures:0,lastResult:void 0}:v(C,s(s({},E),{lower:P[P.length-1],lowerOpen:!0}),S)})})})(u.trans,u.range,1e4)},!0)}return o.mutate(u);function x(v){var C,E,S,b=se.trans,P=v.keys||io(a,v);if(P)return(v=v.type==="add"||v.type==="put"?s(s({},v),{keys:P}):s({},v)).type!=="delete"&&(v.values=c([],v.values)),v.keys&&(v.keys=c([],v.keys)),C=o,S=P,((E=v).type==="add"?Promise.resolve([]):C.getMany({trans:E.trans,keys:S,cache:"immutable"})).then(function(j){var k=P.map(function(D,K){var Q,X,L,oe=j[K],te={onerror:null,onsuccess:null};return v.type==="delete"?p.fire.call(te,D,oe,b):v.type==="add"||oe===void 0?(Q=w.fire.call(te,D,v.values[K],b),D==null&&Q!=null&&(v.keys[K]=D=Q,a.outbound||le(v.values[K],a.keyPath,D))):(Q=oo(oe,v.values[K]),(X=O.fire.call(te,Q,D,oe,b))&&(L=v.values[K],Object.keys(X).forEach(function(U){A(L,U)?L[U]=X[U]:le(L,U,X[U])}))),te});return o.mutate(v).then(function(D){for(var K=D.failures,Q=D.results,X=D.numFailures,D=D.lastResult,L=0;L<P.length;++L){var oe=(Q||P)[L],te=k[L];oe==null?te.onerror&&te.onerror(K[L]):te.onsuccess&&te.onsuccess(v.type==="put"&&j[L]?v.values[L]:oe)}return{failures:K,results:Q,numFailures:X,lastResult:D}}).catch(function(D){return k.forEach(function(K){return K.onerror&&K.onerror(D)}),Promise.reject(D)})});throw new Error("Keys missing")}}})}})}};function ci(e,r,o){try{if(!r||r.keys.length<e.length)return null;for(var a=[],u=0,l=0;u<r.keys.length&&l<e.length;++u)Se(r.keys[u],e[l])===0&&(a.push(o?re(r.values[u]):r.values[u]),++l);return a.length===e.length?a:null}catch{return null}}var ls={stack:"dbcore",level:-1,create:function(e){return{table:function(r){var o=e.table(r);return s(s({},o),{getMany:function(a){var u;return a.cache?(u=ci(a.keys,a.trans._cache,a.cache==="clone"))?ee.resolve(u):o.getMany(a).then(function(l){return a.trans._cache={keys:a.keys,values:a.cache==="clone"?re(l):l},l}):o.getMany(a)},mutate:function(a){return a.type!=="add"&&(a.trans._cache=null),o.mutate(a)}})}}}};function li(e,r){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!r.schema.primaryKey.outbound}function fi(e,r){switch(e){case"query":return r.values&&!r.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var fs={stack:"dbcore",level:0,name:"Observability",create:function(e){var r=e.schema.name,o=new Ze(e.MIN_KEY,e.MAX_KEY);return s(s({},e),{transaction:function(a,u,l){if(se.subscr&&u!=="readonly")throw new Y.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(se.querier));return e.transaction(a,u,l)},table:function(a){function u(P){var b,P=P.query;return[b=P.index,new Ze((b=(P=P.range).lower)!=null?b:e.MIN_KEY,(b=P.upper)!=null?b:e.MAX_KEY)]}var l=e.table(a),d=l.schema,p=d.primaryKey,w=d.indexes,O=p.extractKey,x=p.outbound,v=p.autoIncrement&&w.filter(function(S){return S.compound&&S.keyPath.includes(p.keyPath)}),C=s(s({},l),{mutate:function(S){function b(ae){return ae="idb://".concat(r,"/").concat(a,"/").concat(ae),K[ae]||(K[ae]=new Ze)}var P,j,k,D=S.trans,K=S.mutatedParts||(S.mutatedParts={}),Q=b(""),X=b(":dels"),L=S.type,te=S.type==="deleteRange"?[S.range]:S.type==="delete"?[S.keys]:S.values.length<50?[io(p,S).filter(function(ae){return ae}),S.values]:[],oe=te[0],te=te[1],U=S.trans._cache;return y(oe)?(Q.addKeys(oe),(L=L==="delete"||oe.length===te.length?ci(oe,U):null)||X.addKeys(oe),(L||te)&&(P=b,j=L,k=te,d.indexes.forEach(function(ae){var _e=P(ae.name||"");function Ee(ve){return ve!=null?ae.extractKey(ve):null}function fe(ve){ae.multiEntry&&y(ve)?ve.forEach(function(Fe){return _e.addKey(Fe)}):_e.addKey(ve)}(j||k).forEach(function(ve,ze){var st=j&&Ee(j[ze]),ze=k&&Ee(k[ze]);Se(st,ze)!==0&&(st!=null&&fe(st),ze!=null)&&fe(ze)})}))):oe?(te={from:(U=oe.lower)!=null?U:e.MIN_KEY,to:(L=oe.upper)!=null?L:e.MAX_KEY},X.add(te),Q.add(te)):(Q.add(o),X.add(o),d.indexes.forEach(function(ae){return b(ae.name).add(o)})),l.mutate(S).then(function(ae){return!oe||S.type!=="add"&&S.type!=="put"||(Q.addKeys(ae.results),v&&v.forEach(function(_e){for(var Ee=S.values.map(function(st){return _e.extractKey(st)}),fe=_e.keyPath.findIndex(function(st){return st===p.keyPath}),ve=0,Fe=ae.results.length;ve<Fe;++ve)Ee[ve][fe]=ae.results[ve];b(_e.name).addKeys(Ee)})),D.mutatedParts=Zr(D.mutatedParts||{},K),ae})}}),E={get:function(S){return[p,new Ze(S.key)]},getMany:function(S){return[p,new Ze().addKeys(S.keys)]},count:u,query:u,openCursor:u};return h(E).forEach(function(S){C[S]=function(b){var P=se.subscr,j=!!P,k=li(se,l)&&fi(S,b)?b.obsSet={}:P;if(j){var D,P=function(te){return te="idb://".concat(r,"/").concat(a,"/").concat(te),k[te]||(k[te]=new Ze)},K=P(""),Q=P(":dels"),j=E[S](b),X=j[0],j=j[1];if((S==="query"&&X.isPrimaryKey&&!b.values?Q:P(X.name||"")).add(j),!X.isPrimaryKey){if(S!=="count")return D=S==="query"&&x&&b.values&&l.query(s(s({},b),{values:!1})),l[S].apply(this,arguments).then(function(te){if(S==="query"){if(x&&b.values)return D.then(function(Ee){return Ee=Ee.result,K.addKeys(Ee),te});var U=b.values?te.result.map(O):te.result;(b.values?K:Q).addKeys(U)}else{var ae,_e;if(S==="openCursor")return _e=b.values,(ae=te)&&Object.create(ae,{key:{get:function(){return Q.addKey(ae.primaryKey),ae.key}},primaryKey:{get:function(){var Ee=ae.primaryKey;return Q.addKey(Ee),Ee}},value:{get:function(){return _e&&K.addKey(ae.primaryKey),ae.value}}})}return te});Q.add(o)}}return l[S].apply(this,arguments)}}),C}})}};function di(e,r,o){var a;return o.numFailures===0?r:r.type==="deleteRange"||(a=r.keys?r.keys.length:"values"in r&&r.values?r.values.length:1,o.numFailures===a)?null:(a=s({},r),y(a.keys)&&(a.keys=a.keys.filter(function(u,l){return!(l in o.failures)})),"values"in a&&y(a.values)&&(a.values=a.values.filter(function(u,l){return!(l in o.failures)})),a)}function ao(e,r){return o=e,((a=r).lower===void 0||(a.lowerOpen?0<Se(o,a.lower):0<=Se(o,a.lower)))&&(o=e,(a=r).upper===void 0||(a.upperOpen?Se(o,a.upper)<0:Se(o,a.upper)<=0));var o,a}function pi(e,r,o,a,u,l){var d,p,w,O,x,v;return!o||o.length===0||(d=r.query.index,p=d.multiEntry,w=r.query.range,O=a.schema.primaryKey.extractKey,x=d.extractKey,v=(d.lowLevelIndex||d).extractKey,(a=o.reduce(function(C,E){var S=C,b=[];if(E.type==="add"||E.type==="put")for(var P=new Ze,j=E.values.length-1;0<=j;--j){var k,D=E.values[j],K=O(D);!P.hasKey(K)&&(k=x(D),p&&y(k)?k.some(function(te){return ao(te,w)}):ao(k,w))&&(P.addKey(K),b.push(D))}switch(E.type){case"add":var Q=new Ze().addKeys(r.values?C.map(function(U){return O(U)}):C),S=C.concat(r.values?b.filter(function(U){return U=O(U),!Q.hasKey(U)&&(Q.addKey(U),!0)}):b.map(function(U){return O(U)}).filter(function(U){return!Q.hasKey(U)&&(Q.addKey(U),!0)}));break;case"put":var X=new Ze().addKeys(E.values.map(function(U){return O(U)}));S=C.filter(function(U){return!X.hasKey(r.values?O(U):U)}).concat(r.values?b:b.map(function(U){return O(U)}));break;case"delete":var L=new Ze().addKeys(E.keys);S=C.filter(function(U){return!L.hasKey(r.values?O(U):U)});break;case"deleteRange":var oe=E.range;S=C.filter(function(U){return!ao(O(U),oe)})}return S},e))===e)?e:(a.sort(function(C,E){return Se(v(C),v(E))||Se(O(C),O(E))}),r.limit&&r.limit<1/0&&(a.length>r.limit?a.length=r.limit:e.length===r.limit&&a.length<r.limit&&(u.dirty=!0)),l?Object.freeze(a):a)}function hi(e,r){return Se(e.lower,r.lower)===0&&Se(e.upper,r.upper)===0&&!!e.lowerOpen==!!r.lowerOpen&&!!e.upperOpen==!!r.upperOpen}function ds(e,r){return((o,a,u,l)=>{if(o===void 0)return a!==void 0?-1:0;if(a===void 0)return 1;if((o=Se(o,a))===0){if(u&&l)return 0;if(u)return 1;if(l)return-1}return o})(e.lower,r.lower,e.lowerOpen,r.lowerOpen)<=0&&0<=((o,a,u,l)=>{if(o===void 0)return a!==void 0?1:0;if(a===void 0)return-1;if((o=Se(o,a))===0){if(u&&l)return 0;if(u)return-1;if(l)return 1}return o})(e.upper,r.upper,e.upperOpen,r.upperOpen)}function ps(e,r,o,a){e.subscribers.add(o),a.addEventListener("abort",function(){var u,l;e.subscribers.delete(o),e.subscribers.size===0&&(u=e,l=r,setTimeout(function(){u.subscribers.size===0&&Le(l,u)},3e3))})}var hs={stack:"dbcore",level:0,name:"Cache",create:function(e){var r=e.schema.name;return s(s({},e),{transaction:function(o,a,u){var l,d,p=e.transaction(o,a,u);return a==="readwrite"&&(u=(l=new AbortController).signal,p.addEventListener("abort",(d=function(w){return function(){if(l.abort(),a==="readwrite"){for(var O=new Set,x=0,v=o;x<v.length;x++){var C=v[x],E=Ft["idb://".concat(r,"/").concat(C)];if(E){var S=e.table(C),b=E.optimisticOps.filter(function(ae){return ae.trans===p});if(p._explicit&&w&&p.mutatedParts)for(var P=0,j=Object.values(E.queries.query);P<j.length;P++)for(var k=0,D=(X=j[P]).slice();k<D.length;k++)Zn((L=D[k]).obsSet,p.mutatedParts)&&(Le(X,L),L.subscribers.forEach(function(ae){return O.add(ae)}));else if(0<b.length){E.optimisticOps=E.optimisticOps.filter(function(ae){return ae.trans!==p});for(var K=0,Q=Object.values(E.queries.query);K<Q.length;K++)for(var X,L,oe,te=0,U=(X=Q[K]).slice();te<U.length;te++)(L=U[te]).res!=null&&p.mutatedParts&&(w&&!L.dirty?(oe=Object.isFrozen(L.res),oe=pi(L.res,L.req,b,S,L,oe),L.dirty?(Le(X,L),L.subscribers.forEach(function(ae){return O.add(ae)})):oe!==L.res&&(L.res=oe,L.promise=ee.resolve({result:oe}))):(L.dirty&&Le(X,L),L.subscribers.forEach(function(ae){return O.add(ae)})))}}}O.forEach(function(ae){return ae()})}}})(!1),{signal:u}),p.addEventListener("error",d(!1),{signal:u}),p.addEventListener("complete",d(!0),{signal:u})),p},table:function(o){var a=e.table(o),u=a.schema.primaryKey;return s(s({},a),{mutate:function(l){var d,p=se.trans;return!u.outbound&&p.db._options.cache!=="disabled"&&!p.explicit&&p.idbtrans.mode==="readwrite"&&(d=Ft["idb://".concat(r,"/").concat(o)])?(p=a.mutate(l),l.type!=="add"&&l.type!=="put"||!(50<=l.values.length||io(u,l).some(function(w){return w==null}))?(d.optimisticOps.push(l),l.mutatedParts&&en(l.mutatedParts),p.then(function(w){0<w.numFailures&&(Le(d.optimisticOps,l),(w=di(0,l,w))&&d.optimisticOps.push(w),l.mutatedParts)&&en(l.mutatedParts)}),p.catch(function(){Le(d.optimisticOps,l),l.mutatedParts&&en(l.mutatedParts)})):p.then(function(w){var O=di(0,s(s({},l),{values:l.values.map(function(x,v){var C;return w.failures[v]?x:(le(C=(C=u.keyPath)!=null&&C.includes(".")?re(x):s({},x),u.keyPath,w.results[v]),C)})}),w);d.optimisticOps.push(O),queueMicrotask(function(){return l.mutatedParts&&en(l.mutatedParts)})}),p):a.mutate(l)},query:function(l){var d,p,w,O,x,v,C;return li(se,a)&&fi("query",l)?(d=((w=se.trans)==null?void 0:w.db._options.cache)==="immutable",p=(w=se).requery,w=w.signal,v=((E,S,b,P)=>{var j=Ft["idb://".concat(E,"/").concat(S)];if(!j)return[];if(!(E=j.queries[b]))return[null,!1,j,null];var k=E[(P.query?P.query.index.name:null)||""];if(!k)return[null,!1,j,null];switch(b){case"query":var D=k.find(function(K){return K.req.limit===P.limit&&K.req.values===P.values&&hi(K.req.query.range,P.query.range)});return D?[D,!0,j,k]:[k.find(function(K){return("limit"in K.req?K.req.limit:1/0)>=P.limit&&(!P.values||K.req.values)&&ds(K.req.query.range,P.query.range)}),!1,j,k];case"count":return D=k.find(function(K){return hi(K.req.query.range,P.query.range)}),[D,!!D,j,k]}})(r,o,"query",l),C=v[0],O=v[2],x=v[3],C&&v[1]?C.obsSet=l.obsSet:(v=a.query(l).then(function(E){var S=E.result;if(C&&(C.res=S),d){for(var b=0,P=S.length;b<P;++b)Object.freeze(S[b]);Object.freeze(S)}else E.result=re(S);return E}).catch(function(E){return x&&C&&Le(x,C),Promise.reject(E)}),C={obsSet:l.obsSet,promise:v,subscribers:new Set,type:"query",req:l,dirty:!1},x?x.push(C):(x=[C],(O=O||(Ft["idb://".concat(r,"/").concat(o)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[l.query.index.name||""]=x)),ps(C,x,p,w),C.promise.then(function(E){return{result:pi(E.result,l,O==null?void 0:O.optimisticOps,a,C,d)}})):a.query(l)}})}})}};function rn(e,r){return new Proxy(e,{get:function(o,a,u){return a==="db"?r:Reflect.get(o,a,u)}})}Ye.prototype.version=function(e){if(isNaN(e)||e<.1)throw new Y.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new Y.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var r=this._versions,o=r.filter(function(a){return a._cfg.version===e})[0];return o||(o=new this.Version(e),r.push(o),r.sort(ns),o.stores({}),this._state.autoSchema=!1),o},Ye.prototype._whenReady=function(e){var r=this;return this.idbdb&&(this._state.openComplete||se.letThrough||this._vip)?e():new ee(function(o,a){if(r._state.openComplete)return a(new Y.DatabaseClosed(r._state.dbOpenError));if(!r._state.isBeingOpened){if(!r._state.autoOpen)return void a(new Y.DatabaseClosed);r.open().catch(q)}r._state.dbReadyPromise.then(o,a)}).then(e)},Ye.prototype.use=function(u){var r=u.stack,o=u.create,a=u.level,u=u.name,l=(u&&this.unuse({stack:r,name:u}),this._middlewares[r]||(this._middlewares[r]=[]));return l.push({stack:r,create:o,level:a??10,name:u}),l.sort(function(d,p){return d.level-p.level}),this},Ye.prototype.unuse=function(e){var r=e.stack,o=e.name,a=e.create;return r&&this._middlewares[r]&&(this._middlewares[r]=this._middlewares[r].filter(function(u){return a?u.create!==a:!!o&&u.name!==o})),this},Ye.prototype.open=function(){var e=this;return Mt(St,function(){return ss(e)})},Ye.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state,r=Zt.indexOf(this);if(0<=r&&Zt.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new ee(function(o){e.dbReadyResolve=o}),e.openCanceller=new ee(function(o,a){e.cancelOpen=a}))},Ye.prototype.close=function(r){var r=(r===void 0?{disableAutoOpen:!0}:r).disableAutoOpen,o=this._state;r?(o.isBeingOpened&&o.cancelOpen(new Y.DatabaseClosed),this._close(),o.autoOpen=!1,o.dbOpenError=new Y.DatabaseClosed):(this._close(),o.autoOpen=this._options.autoOpen||o.isBeingOpened,o.openComplete=!1,o.dbOpenError=null)},Ye.prototype.delete=function(e){var r=this,o=(e===void 0&&(e={disableAutoOpen:!0}),0<arguments.length&&typeof arguments[0]!="object"),a=this._state;return new ee(function(u,l){function d(){r.close(e);var p=r._deps.indexedDB.deleteDatabase(r.name);p.onsuccess=Me(function(){var w,O,x;w=r._deps,O=r.name,Qn(x=w.indexedDB)||O===qr||Hn(x,w.IDBKeyRange).delete(O).catch(q),u()}),p.onerror=pt(l),p.onblocked=r._fireOnBlocked}if(o)throw new Y.InvalidArgument("Invalid closeOptions argument to db.delete()");a.isBeingOpened?a.dbReadyPromise.then(d):d()})},Ye.prototype.backendDB=function(){return this.idbdb},Ye.prototype.isOpen=function(){return this.idbdb!==null},Ye.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},Ye.prototype.hasFailed=function(){return this._state.dbOpenError!==null},Ye.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Ye.prototype,"tables",{get:function(){var e=this;return h(this._allTables).map(function(r){return e._allTables[r]})},enumerable:!1,configurable:!0}),Ye.prototype.transaction=function(){var e=(function(r,o,a){var u=arguments.length;if(u<2)throw new Y.InvalidArgument("Too few arguments");for(var l=new Array(u-1);--u;)l[u-1]=arguments[u];return a=l.pop(),[r,tt(l),a]}).apply(this,arguments);return this._transaction.apply(this,e)},Ye.prototype._transaction=function(e,r,o){var a,u,l=this,d=se.trans,p=(d&&d.db===this&&e.indexOf("!")===-1||(d=null),e.indexOf("?")!==-1);e=e.replace("!","").replace("?","");try{if(u=r.map(function(O){if(O=O instanceof l.Table?O.name:O,typeof O!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return O}),e=="r"||e===Nn)a=Nn;else{if(e!="rw"&&e!=Kn)throw new Y.InvalidArgument("Invalid transaction mode: "+e);a=Kn}if(d){if(d.mode===Nn&&a===Kn){if(!p)throw new Y.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");d=null}d&&u.forEach(function(O){if(d&&d.storeNames.indexOf(O)===-1){if(!p)throw new Y.SubTransaction("Table "+O+" not included in parent transaction.");d=null}}),p&&d&&!d.active&&(d=null)}}catch(O){return d?d._promise(null,function(x,v){v(O)}):Ue(O)}var w=(function O(x,v,C,E,S){return ee.resolve().then(function(){var k=se.transless||se,b=x._createTransaction(v,C,x._dbSchema,E),k=(b.explicit=!0,{trans:b,transless:k});if(E)b.idbtrans=E.idbtrans;else try{b.create(),b.idbtrans._explicit=!0,x._state.PR1398_maxLoop=3}catch(D){return D.name===we.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return O(x,v,C,null,S)})):Ue(D)}var P,j=ie(S),k=(j&&Jt(),ee.follow(function(){var D;(P=S.call(b,b))&&(j?(D=Ct.bind(null,null),P.then(D,D)):typeof P.next=="function"&&typeof P.throw=="function"&&(P=no(P)))},k));return(P&&typeof P.then=="function"?ee.resolve(P).then(function(D){return b.active?D:Ue(new Y.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):k.then(function(){return P})).then(function(D){return E&&b._resolve(),b._completion.then(function(){return D})}).catch(function(D){return b._reject(D),Ue(D)})})}).bind(null,this,a,u,d,o);return d?d._promise(a,w,"lock"):se.trans?Mt(se.transless,function(){return l._whenReady(w)}):this._whenReady(w)},Ye.prototype.table=function(e){if(A(this._allTables,e))return this._allTables[e];throw new Y.InvalidTable("Table ".concat(e," does not exist"))};var gt=Ye;function Ye(e,r){var o,a,u,l,d,p=this,w=(this._middlewares={},this.verno=0,Ye.dependencies),w=(this._options=r=s({addons:Ye.addons,autoOpen:!0,indexedDB:w.indexedDB,IDBKeyRange:w.IDBKeyRange,cache:"cloned"},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange},r.addons),O=(this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this,{dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:q,dbReadyPromise:null,cancelOpen:q,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:r.autoOpen}),x=(O.dbReadyPromise=new ee(function(v){O.dbReadyResolve=v}),O.openCanceller=new ee(function(v,C){O.cancelOpen=C}),this._state=O,this.name=e,this.on=vr(this,"populate","blocked","versionchange","close",{ready:[An,q]}),this.once=function(v,C){var E=function(){for(var S=[],b=0;b<arguments.length;b++)S[b]=arguments[b];p.on(v).unsubscribe(E),C.apply(p,S)};return p.on(v,E)},this.on.ready.subscribe=ce(this.on.ready.subscribe,function(v){return function(C,E){Ye.vip(function(){var S,b=p._state;b.openComplete?(b.dbOpenError||ee.resolve().then(C),E&&v(C)):b.onReadyBeingFired?(b.onReadyBeingFired.push(C),E&&v(C)):(v(C),S=p,E||v(function P(){S.on.ready.unsubscribe(C),S.on.ready.unsubscribe(P)}))})}}),this.Collection=(o=this,br(Qa.prototype,function(P,b){this.db=o;var E=zo,S=null;if(b)try{E=b()}catch(k){S=k}var b=P._ctx,P=b.table,j=P.hook.reading.fire;this._ctx={table:P,index:b.index,isPrimKey:!b.index||P.schema.primKey.keyPath&&b.index===P.schema.primKey.name,range:E,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:S,or:b.or,valueMapper:j!==Je?j:null}})),this.Table=(a=this,br(Ho.prototype,function(v,C,E){this.db=a,this._tx=E,this.name=v,this.schema=C,this.hook=a._allTables[v]?a._allTables[v].hook:vr(null,{creating:[qa,q],reading:[Ht,Je],updating:[za,q],deleting:[La,q]})})),this.Transaction=(u=this,br(Za.prototype,function(v,C,E,S,b){var P=this;v!=="readonly"&&C.forEach(function(j){j=(j=E[j])==null?void 0:j.yProps,j&&(C=C.concat(j.map(function(k){return k.updatesTable})))}),this.db=u,this.mode=v,this.storeNames=C,this.schema=E,this.chromeTransactionDurability=S,this.idbtrans=null,this.on=vr(this,"complete","error","abort"),this.parent=b||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 ee(function(j,k){P._resolve=j,P._reject=k}),this._completion.then(function(){P.active=!1,P.on.complete.fire()},function(j){var k=P.active;return P.active=!1,P.on.error.fire(j),P.parent?P.parent._reject(j):k&&P.idbtrans&&P.idbtrans.abort(),Ue(j)})})),this.Version=(l=this,br(as.prototype,function(v){this.db=l,this._cfg={version:v,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(d=this,br(ei.prototype,function(v,C,E){if(this.db=d,this._ctx={table:v,index:C===":id"?null:C,or:E},this._cmp=this._ascending=Se,this._descending=function(S,b){return Se(b,S)},this._max=function(S,b){return 0<Se(S,b)?S:b},this._min=function(S,b){return Se(S,b)<0?S:b},this._IDBKeyRange=d._deps.IDBKeyRange,!this._IDBKeyRange)throw new Y.MissingAPI})),this.on("versionchange",function(v){0<v.newVersion?console.warn("Another connection wants to upgrade database '".concat(p.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(p.name,"'. Closing db now to resume the delete request.")),p.close({disableAutoOpen:!1})}),this.on("blocked",function(v){!v.newVersion||v.newVersion<v.oldVersion?console.warn("Dexie.delete('".concat(p.name,"') was blocked")):console.warn("Upgrade '".concat(p.name,"' blocked by other connection holding version ").concat(v.oldVersion/10))}),this._maxKey=Sr(r.IDBKeyRange),this._createTransaction=function(v,C,E,S){return new p.Transaction(v,C,E,p._options.chromeTransactionDurability,S)},this._fireOnBlocked=function(v){p.on("blocked").fire(v),Zt.filter(function(C){return C.name===p.name&&C!==p&&!C._state.vcFired}).map(function(C){return C.on("versionchange").fire(v)})},this.use(ls),this.use(hs),this.use(fs),this.use(us),this.use(cs),new Proxy(this,{get:function(v,C,E){var S;return C==="_vip"||(C==="table"?function(b){return rn(p.table(b),x)}:(S=Reflect.get(v,C,E))instanceof Ho?rn(S,x):C==="tables"?S.map(function(b){return rn(b,x)}):C==="_createTransaction"?function(){return rn(S.apply(this,arguments),x)}:S)}}));this.vip=x,w.forEach(function(v){return v(p)})}var nn,nr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",ms=(so.prototype.subscribe=function(e,r,o){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:r,complete:o})},so.prototype[nr]=function(){return this},so);function so(e){this._subscribe=e}try{nn={indexedDB:f.indexedDB||f.mozIndexedDB||f.webkitIndexedDB||f.msIndexedDB,IDBKeyRange:f.IDBKeyRange||f.webkitIDBKeyRange}}catch{nn={indexedDB:null,IDBKeyRange:null}}function mi(e){var r,o=!1,a=new ms(function(u){var l=ie(e),d,p=!1,w={},O={},x={get closed(){return p},unsubscribe:function(){p||(p=!0,d&&d.abort(),v&&kt.storagemutated.unsubscribe(E))}},v=(u.start&&u.start(x),!1),C=function(){return Mn(S)},E=function(b){Zr(w,b),Zn(O,w)&&C()},S=function(){var b,P,j;!p&&nn.indexedDB&&(w={},b={},d&&d.abort(),d=new AbortController,j=(k=>{var D=Qt();try{l&&Jt();var K=_t(e,k);return K=l?K.finally(Ct):K}finally{D&&Xt()}})(P={subscr:b,signal:d.signal,requery:C,querier:e,trans:null}),Promise.resolve(j).then(function(k){o=!0,r=k,p||P.signal.aborted||(w={},(D=>{for(var K in D)if(A(D,K))return;return 1})(O=b)||v||(kt(xr,E),v=!0),Mn(function(){return!p&&u.next&&u.next(k)}))},function(k){o=!1,["DatabaseClosedError","AbortError"].includes(k==null?void 0:k.name)||p||Mn(function(){p||u.error&&u.error(k)})}))};return setTimeout(C,0),x});return a.hasValue=function(){return o},a.getValue=function(){return r},a}var qt=gt;function uo(e){var r=Ot;try{Ot=!0,kt.storagemutated.fire(e),ro(e,!0)}finally{Ot=r}}I(qt,s(s({},he),{delete:function(e){return new qt(e,{addons:[]}).delete()},exists:function(e){return new qt(e,{addons:[]}).open().then(function(r){return r.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return r=qt.dependencies,o=r.indexedDB,r=r.IDBKeyRange,(Qn(o)?Promise.resolve(o.databases()).then(function(a){return a.map(function(u){return u.name}).filter(function(u){return u!==qr})}):Hn(o,r).toCollection().primaryKeys()).then(e)}catch{return Ue(new Y.MissingAPI)}var r,o},defineClass:function(){return function(e){T(this,e)}},ignoreTransaction:function(e){return se.trans?Mt(se.transless,e):e()},vip:Xn,async:function(e){return function(){try{var r=no(e.apply(this,arguments));return r&&typeof r.then=="function"?r:ee.resolve(r)}catch(o){return Ue(o)}}},spawn:function(e,r,o){try{var a=no(e.apply(o,r||[]));return a&&typeof a.then=="function"?a:ee.resolve(a)}catch(u){return Ue(u)}},currentTransaction:{get:function(){return se.trans||null}},waitFor:function(e,r){return e=ee.resolve(typeof e=="function"?qt.ignoreTransaction(e):e).timeout(r||6e4),se.trans?se.trans.waitFor(e):e},Promise:ee,debug:{get:function(){return dt},set:function(e){Bo(e)}},derive:g,extend:T,props:I,override:ce,Events:vr,on:kt,liveQuery:mi,extendObservabilitySet:Zr,getByKeyPath:G,setByKeyPath:le,delByKeyPath:function(e,r){typeof r=="string"?le(e,r,void 0):"length"in r&&[].map.call(r,function(o){le(e,o,void 0)})},shallowClone:Pe,deepClone:re,getObjectDiff:oo,cmp:Se,asap:N,minKey:-1/0,addons:[],connections:Zt,errnames:we,dependencies:nn,cache:Ft,semVer:"4.3.0",version:"4.3.0".split(".").map(function(e){return parseInt(e)}).reduce(function(e,r,o){return e+r/Math.pow(10,2*o)})})),qt.maxKey=Sr(qt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(kt(xr,function(e){Ot||(e=new CustomEvent(Ln,{detail:e}),Ot=!0,dispatchEvent(e),Ot=!1)}),addEventListener(Ln,function(e){e=e.detail,Ot||uo(e)}));var or,Ot=!1,yi=function(){};return typeof BroadcastChannel<"u"&&((yi=function(){(or=new BroadcastChannel(Ln)).onmessage=function(e){return e.data&&uo(e.data)}})(),typeof or.unref=="function"&&or.unref(),kt(xr,function(e){Ot||or.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!gt.disableBfCache&&e.persisted){dt&&console.debug("Dexie: handling persisted pagehide"),or!=null&&or.close();for(var r=0,o=Zt;r<o.length;r++)o[r].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!gt.disableBfCache&&e.persisted&&(dt&&console.debug("Dexie: handling persisted pageshow"),yi(),uo({all:new Ze(-1/0,[[]])}))})),ee.rejectionMapper=function(e,r){return!e||e instanceof pe||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Xe[e.name]?e:(r=new Xe[e.name](r||e.message,e),"stack"in e&&M(r,"stack",{get:function(){return this.inner.stack}}),r)},Bo(dt),s(gt,Object.freeze({__proto__:null,Dexie:gt,Entity:Vo,PropModification:gr,RangeSet:Ze,add:function(e){return new gr({add:e})},cmp:Se,default:gt,liveQuery:mi,mergeRanges:Er,rangesOverlap:ii,remove:function(e){return new gr({remove:e})},replacePrefix:function(e,r){return new gr({replacePrefix:[e,r]})}}),{default:gt}),gt})})(ln)),ln.exports}var hl=pl();const Eo=ra(hl),Xi=Symbol.for("Dexie"),dr=globalThis[Xi]||(globalThis[Xi]=Eo);if(Eo.semVer!==dr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Eo.semVer} and ${dr.semVer}`);const{liveQuery:Pl,mergeRanges:Rl,rangesOverlap:jl,RangeSet:Il,cmp:$l,Entity:Dl,PropModification:Bl,replacePrefix:Ml,add:Nl,remove:Kl,DexieYProvider:Fl}=dr;class ml extends dr{constructor(){super("chat_cache");zt(this,"conversations");zt(this,"summaries");zt(this,"users");zt(this,"messages");zt(this,"msgCursor");this.version(1).stores({summaries:"id",users:"id",messages:"id, conversationId",msgCursor:"id"})}async clearData(){await Promise.all([this.summaries.clear(),this.users.clear(),this.messages.clear(),this.msgCursor.clear()])}}const et=new ml,On=({type:t,id:n})=>`${t}:${n}`,yl=({group:t,user:n})=>`${t?"group":"user"}:${t||n}`,gl=(t,n)=>t.group?`group:${t.group}`:`dm:${t.sender===n?t.receiver:t.sender}`,vl=async t=>{const s=(await jt().getMessagesSummary(t)).map(c=>({...c,id:yl(c)}));return et.summaries.bulkPut(s),s};function bl(t,n,i){var s,c;typeof t=="function"?(s=n||[],c=i):(s=[],c=n);var f=ue.useRef({hasResult:!1,result:c,error:null}),h=ue.useReducer(function(_){return _+1},0);h[0];var y=h[1],T=ue.useMemo(function(){var _=typeof t=="function"?t():t;if(!_||typeof _.subscribe!="function")throw t===_?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!f.current.hasResult&&typeof window<"u"&&(typeof _.hasValue!="function"||_.hasValue()))if(typeof _.getValue=="function")f.current.result=_.getValue(),f.current.hasResult=!0;else{var R=_.subscribe(function(A){f.current.result=A,f.current.hasResult=!0});typeof R=="function"?R():R.unsubscribe()}return _},s);if(ue.useDebugValue(f.current.result),ue.useEffect(function(){var _=T.subscribe(function(R){var A=f.current;(A.error!==null||A.result!==R)&&(A.error=null,A.result=R,A.hasResult=!0,y())},function(R){var A=f.current;A.error!==R&&(A.error=R,y())});return typeof _=="function"?_:_.unsubscribe.bind(_)},s),f.current.error)throw f.current.error;return f.current.result}function To(t,n,i){return bl(function(){return dr.liveQuery(t)},n||[],i)}typeof FinalizationRegistry<"u"&&new FinalizationRegistry(function(t){var n=dr.DexieYProvider;n&&n.release(t)});const Aa=({selectedConversation:t,currentUser:n,onConversationSelect:i})=>{const[s,c]=ue.useState(!0),[f,h]=ue.useState(),[y,T]=ue.useState(),_=To(()=>et.summaries.toArray(),[t])||[],R=ue.useCallback(async()=>{c(!0),vl({}).catch(h),c(!1)},[]);ue.useEffect(()=>(R(),T(setInterval(R,3*6e4)),y),[]);const[A,I]=ue.useState({}),[F,M]=ue.useState({});ue.useEffect(()=>{const W=async()=>{if(!(n!=null&&n.org))return;const ce=jt(),J={},N={};for(const G of _)try{if(G.user!==void 0){if(!A[G.user]){const le=await ce.getUser(G.user);J[G.user]=le.name}}else if(G.group!==void 0&&!F[G.group]){const le=await ce.getGroup(n.org,G.group);N[G.group]=le.name}}catch(le){console.error("Failed to load conversation name:",le)}Object.keys(J).length>0&&I(G=>({...G,...J})),Object.keys(N).length>0&&M(G=>({...G,...N}))};_.length>0&&(n!=null&&n.org)&&W()},[_,n==null?void 0:n.org]);const g=W=>W.user!==void 0?A[W.user]||`User ${W.user}`:W.group!==void 0?F[W.group]||`Group ${W.group}`:"Unknown",V=W=>t?W.group!==void 0?t.type==="group"&&t.id===W.group:W.user!==void 0?t.type==="dm"&&t.id===W.user:!1:!1,ne=W=>{W.group!==void 0?i({type:"group",id:W.group,name:g(W)}):W.user!==void 0&&i({type:"dm",id:W.user,name:g(W)})};return B.jsxs(Z.Box,{display:"flex",flexDirection:"column",height:"100%",children:[B.jsx(Z.AppBar,{position:"static",elevation:0,sx:{backgroundColor:"background.default",color:"text.primary"},children:B.jsx(Z.Toolbar,{children:B.jsx(Z.Typography,{variant:"h6",component:"div",children:"Messages"})})}),B.jsx(Z.Box,{flex:1,overflow:"auto",children:s&&!_.length?B.jsx(Z.List,{disablePadding:!0,children:[1,2,3,4,5].map(W=>B.jsx(Oa,{},W))}):f?B.jsx(Z.Box,{p:2,children:B.jsxs(Z.Alert,{severity:"error",children:["Failed to load conversations: ",f.message]})}):_.length===0?B.jsx(Z.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",p:2,children:B.jsx(Z.Typography,{color:"text.secondary",align:"center",children:"No conversations yet"})}):B.jsx(Z.List,{disablePadding:!0,children:[..._].sort((W,ce)=>new Date(ce.last_message_at).getTime()-new Date(W.last_message_at).getTime()).map(W=>B.jsx(ka,{conversation:W,displayName:g(W),selected:V(W),onClick:()=>ne(W)},W.group!==void 0?`group-${W.group}`:`user-${W.user}`))})})]})},Pa=({displayName:t,type:n,subtitle:i,isConnected:s=!0,onBack:c})=>{const f=n==="group";return B.jsx(Z.AppBar,{position:"static",elevation:0,sx:{backgroundColor:"background.default",color:"text.primary"},children:B.jsxs(Z.Toolbar,{children:[c&&B.jsx(Z.IconButton,{edge:"start",color:"inherit",onClick:c,sx:{mr:2,display:{xs:"flex",sm:"flex",md:"none"}},children:B.jsx(ol,{})}),B.jsx(Z.Avatar,{sx:{bgcolor:f?"primary.main":"secondary.main",mr:2},children:f?B.jsx(Ea,{}):B.jsx(Ta,{})}),B.jsxs(Z.Box,{flex:1,children:[B.jsx(Z.Typography,{variant:"h6",component:"div",noWrap:!0,children:t}),i&&B.jsx(Z.Typography,{variant:"caption",color:"inherit",sx:{opacity:.7},children:i})]}),!s&&B.jsx(Z.Chip,{icon:B.jsx(ll,{}),label:"Disconnected",size:"small",color:"warning",sx:{ml:1}})]})})};function wl(t){return(typeof t=="string"?new Date(t):t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}const Ra=300*1e3;function xl(t,n=Ra){if(t.length===0)return[];const i=[];let s=null;for(const c of t){const f=new Date(c.created_at).getTime();if(!s)s={senderId:c.sender,messages:[c],timestamp:new Date(c.created_at)};else{const h=new Date(s.messages[s.messages.length-1].created_at).getTime(),y=f-h;s.senderId===c.sender&&y<=n?s.messages.push(c):(i.push(s),s={senderId:c.sender,messages:[c],timestamp:new Date(c.created_at)})}}return s&&i.push(s),i}function ko(t,n,i=Ra){if(t.sender!==n.sender)return!1;const s=new Date(t.created_at).getTime(),c=new Date(n.created_at).getTime();return Math.abs(c-s)<=i}function Sl(t=""){const n=t.trim().split(" ").filter(i=>i.length>0);if(n.length>=2){const i=n[0],s=n[n.length-1];if(i&&s&&i[0]&&s[0])return(i[0]+s[0]).toUpperCase()}return t.slice(0,2).toUpperCase()}const Ji=async(t,n={})=>{const i=jt(),s=On(t);t.type==="group"?n.group=t.id:n.user=t.id;const c=await i.getMessages(n);return c.messages.map(h=>({...h,conversationId:s})).forEach(h=>et.messages.put(h)),et.msgCursor.put({...c.cursor,id:s}),c},ja=ue.memo(({message:t,isOwnMessage:n,senderName:i,showSenderName:s=!0,isFirstInGroup:c=!0,isLastInGroup:f=!0,status:h="sent"})=>{const y=t.id.startsWith("temp-"),T=()=>{if(!n||!f)return null;const R={fontSize:14,ml:.5,opacity:.7,verticalAlign:"middle"};return h==="failed"?B.jsx(al,{sx:{...R,color:"error.main"}}):h==="sending"||y?B.jsx(ul,{sx:R}):B.jsx(il,{sx:R})},_=B.jsx(Z.Avatar,{sx:{width:32,height:32,fontSize:"0.875rem",color:n?"primary.contrastText":"secondary.contrastText",bgcolor:n?"primary.main":"secondary.main",visibility:f?"visible":"hidden"},children:Sl(i)});return B.jsxs(Z.Box,{display:"flex",justifyContent:n?"flex-end":"flex-start",alignItems:"flex-end",mb:f?1:.25,gap:1,children:[!n&&_,B.jsxs(Z.Paper,{elevation:1,sx:{maxWidth:"80%",p:1.5,backgroundColor:n?"primary.main":"background.paper",color:n?"primary.contrastText":"text.primary",borderTopLeftRadius:n||!c?void 0:4,borderTopRightRadius:!n||!c?void 0:4,borderBottomLeftRadius:n||!f?void 0:4,borderBottomRightRadius:!n||!f?void 0:4},children:[!n&&s&&c&&B.jsx(Z.Typography,{variant:"caption",fontWeight:"bold",display:"block",mb:.5,children:i||`User ${t.sender}`}),B.jsx(Z.Typography,{variant:"body1",sx:{whiteSpace:"pre-wrap"},children:t.content}),f&&B.jsxs(Z.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center",mt:.5,children:[B.jsx(Z.Typography,{variant:"caption",color:n?"inherit":"text.secondary",sx:{opacity:.7},children:wl(new Date(t.created_at))}),B.jsx(T,{})]})]}),n&&_]})}),Ia=({isOwnMessage:t=!1})=>B.jsx(Z.Box,{display:"flex",justifyContent:t?"flex-end":"flex-start",mb:1,children:B.jsxs(Z.Box,{maxWidth:"70%",children:[!t&&B.jsx(Z.Skeleton,{variant:"text",width:80,sx:{mb:.5}}),B.jsx(Z.Skeleton,{variant:"rounded",width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:t?"primary.light":"background.main"}})]})}),$a=({hasMore:t,loading:n,onLoadMore:i,threshold:s=1,rootMargin:c="100px"})=>{const f=ue.useRef(null),h=ue.useRef(null);return ue.useEffect(()=>{if(!t||n)return;const y=f.current;if(y)return h.current=new IntersectionObserver(T=>{const[_]=T;_&&_.isIntersecting&&t&&!n&&i()},{threshold:s,rootMargin:c}),h.current.observe(y),()=>{h.current&&y&&(h.current.unobserve(y),h.current.disconnect())}},[t,n,i,s,c]),t?B.jsx(Z.Box,{ref:f,display:"flex",justifyContent:"center",alignItems:"center",py:2,children:n?B.jsx(Z.CircularProgress,{size:24}):B.jsx(Z.Typography,{variant:"caption",color:"text.secondary",children:"Scroll to load more"})}):null},Do=(t,n,i)=>{ue.useEffect(()=>((async()=>{await t()})(),i),n)};function _l(t){const n=t.map(s=>Number(s.sender));return new Set(n)}function Da(t){const n=jt(),[i,s]=ue.useState(()=>new Map),c=ue.useCallback(async()=>{if(!t.length)return i;try{const f=_l(t),h=Array.from(f);if(console.log("[names] size:",f.size),!f.size)return i;const y=(await et.users.bulkGet(h)).filter(I=>!!I),T=new Map;if(y.forEach(I=>{T.set(I.id,I.name)}),f.size===y.length)return T;const _=h.filter(I=>!T.has(I)),R=await n.getUsers(_,{fields:["id","name"]});await et.users.bulkPut(R);const A=T;return R.forEach(I=>A.set(I.id,I.name)),A}catch(f){console.error("[useSenderNames] Failed to fetch users:",f)}return i},[t,i]);return Do(async()=>{const f=await c();s(f)},[t]),i}const Ba=({messages:t,currentUserId:n,loading:i=!1,error:s=null,autoScroll:c=!0,hasMore:f=!1,loadingMore:h=!1,onLoadMore:y})=>{const T=ue.useRef(null),_=ue.useRef(null),R=ue.useRef(0),A=ue.useRef(!0),[I,F]=ue.useState(c),M=Da(t),g=()=>{if(!_.current)return!1;const{scrollTop:ne,scrollHeight:W,clientHeight:ce}=_.current;return W-ne-ce<100},V=()=>{A.current=g()};return ue.useEffect(()=>{t.length>0&&T.current&&(T.current.scrollIntoView({behavior:"auto"}),A.current=!0)},[]),ue.useEffect(()=>{!h||!t.length||(_.current&&(R.current=_.current.scrollHeight),F(!1))},[h]),ue.useLayoutEffect(()=>{if(t.length){if(I&&T.current&&A.current)T.current.scrollIntoView({behavior:"smooth"});else if(!I&&_.current&&R.current>0){const W=_.current.scrollHeight-R.current;_.current.scrollTop=_.current.scrollTop+W,R.current=0,F(!0)}}},[t.length,c]),i&&!t.length?B.jsx(Z.Box,{flex:1,overflow:"auto",p:2,children:[1,2,3,4,5].map(ne=>B.jsx(Ia,{isOwnMessage:ne%3===0},ne))}):s&&!t.length?B.jsx(Z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flex:1,p:2,children:B.jsxs(Z.Alert,{severity:"error",children:[B.jsx("strong",{children:"Failed to load messages"}),B.jsx("br",{}),s.message]})}):t.length===0?B.jsx(Z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flex:1,children:B.jsx(Z.Typography,{variant:"body2",color:"text.secondary",children:"No messages yet. Start the conversation!"})}):B.jsxs(Z.Box,{ref:_,flex:1,overflow:"auto",p:2,display:"flex",flexDirection:"column",onScroll:V,children:[f&&y&&B.jsx($a,{hasMore:f,loading:h,onLoadMore:y}),t.map((ne,W)=>{const ce=ne.sender,J=ne.sender===n,N=M.get(ce),G=W>0?t[W-1]:null,le=W<t.length-1?t[W+1]:null,Pe=!G||!ko(G,ne),Ke=!le||!ko(ne,le);return B.jsx(ja,{message:ne,isOwnMessage:J,senderName:N,showSenderName:Pe,isFirstInGroup:Pe,isLastInGroup:Ke},ne.id)}),B.jsx("div",{ref:T})]})},Ma=({onSend:t,sending:n=!1,placeholder:i="Type a message...",disabled:s=!1})=>{const[c,f]=ue.useState(""),h=ue.useRef(null),y=()=>{const _=c.trim();_&&!n&&!s&&(t(_),f(""),setTimeout(()=>{var R,A;(A=(R=h.current)==null?void 0:R.querySelector("textarea"))==null||A.focus()},300))},T=_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),y())};return B.jsxs(Z.Box,{display:"flex",gap:1,p:2,borderTop:1,borderColor:"divider",children:[B.jsx(Z.TextField,{ref:h,fullWidth:!0,multiline:!0,maxRows:4,value:c,onChange:_=>f(_.target.value),onKeyDown:T,placeholder:i,disabled:s||n,variant:"outlined",size:"small"}),B.jsx(Z.IconButton,{color:"primary",onClick:y,disabled:!c.trim()||n||s,size:"large",children:n?B.jsx(Z.CircularProgress,{size:24}):B.jsx(cl,{})})]})};function Na({conversation:t,limit:n=50}){const i=On(t),[s,c]=ue.useState(!1),[f,h]=ue.useState(!1),[y,T]=ue.useState(),_=To(()=>et.messages.where("conversationId").equals(i).sortBy("created_at"),[i])||[],R=To(()=>et.msgCursor.where("id").equals(i).first(),[i]);Do(async()=>{var F;const I={limit:n};_.length&&(I.cursorType="after",I.cursorDatetime=(F=_[_.length-1])==null?void 0:F.created_at),c(!0),await Ji(t,I).catch(T),c(!1),await et.summaries.update(i,{unread_count:0})},[t,n]),console.log("mw",_.length);const A=ue.useCallback(async()=>{if(!(!R||f||s)){h(!0);try{const I={limit:n};if(!(R!=null&&R.datetime))return;I.cursorType="before",I.cursorDatetime=R.datetime,await Ji(t,I)}catch(I){console.error("[useMessages] Failed to load more:",I)}finally{h(!1)}}},[R,n,t,f,s]);return{messages:_,cursor:R,loading:s,error:y,loadMore:A,loadingMore:f}}const Ka=({conversation:t,user:n,isConnected:i,onBack:s})=>{const c=jt(),{messages:f,cursor:h,loading:y,error:T,loadMore:_,loadingMore:R}=Na({conversation:t}),[A,I]=ue.useState(!1),[F,M]=ue.useState(null),[g,V]=ue.useState(!1),ne=async W=>{if(!W.trim())return;I(!0),M(null),V(!0);const ce=`temp-${Date.now()}-${Math.random()}`,J={id:ce,sender:n==null?void 0:n.id,receiver:t.type==="dm"?t.id:null,group:t.type==="group"?t.id:null,content:W,created_at:new Date().toISOString(),conversationId:On(t)};try{await et.messages.put(J),await(t.type==="group"?c.sendGroupMessage:c.sendDM).bind(c)(t.id,W),await et.messages.delete(ce)}catch(N){M(N instanceof Error?N:new Error("Failed to send message"))}finally{I(!1),setTimeout(()=>V(!1),100)}};return B.jsxs(Z.Box,{display:"flex",flexDirection:"column",height:"100%",children:[B.jsx(Pa,{displayName:t.name||"Chat",type:t.type,isConnected:i,onBack:s}),F&&B.jsxs(Z.Alert,{severity:"error",onClose:()=>M(null),children:["Failed to send message: ",F.message]}),B.jsx(Ba,{messages:f,currentUserId:(n==null?void 0:n.id)||0,loading:y,error:T,autoScroll:!0,hasMore:!!(h!=null&&h.datetime),loadingMore:R,onLoadMore:_,forceScrollToBottom:g}),B.jsx(Ma,{onSend:ne,sending:A,disabled:(n==null?void 0:n.id)===null})]})};class Oo extends ue.Component{constructor(i){super(i);zt(this,"handleReset",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,s){var c,f;console.error("ErrorBoundary caught an error:",i,s),(f=(c=this.props).onError)==null||f.call(c,i,s)}render(){var i;return this.state.hasError?this.props.fallback?this.props.fallback:B.jsxs(Z.Box,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",p:3,children:[B.jsxs(Z.Alert,{severity:"error",sx:{mb:2,maxWidth:500},children:[B.jsx(Z.Typography,{variant:"h6",gutterBottom:!0,children:"Something went wrong"}),B.jsx(Z.Typography,{variant:"body2",color:"text.secondary",children:((i=this.state.error)==null?void 0:i.message)||"An unexpected error occurred"})]}),B.jsx(Z.Button,{variant:"contained",startIcon:B.jsx(sl,{}),onClick:this.handleReset,children:"Try Again"})]}):this.props.children}}function Fa({onMessage:t,onConnect:n,onDisconnect:i,onError:s,currentUserId:c,conversation:f,updateCache:h=!0}={}){const y=ue.useRef(c),T=ue.useRef(f),_=ue.useRef(h),R=ue.useRef(t);ue.useEffect(()=>{y.current=c,T.current=f,_.current=h,R.current=t},[c,f,h,t]);const A=ue.useCallback(async g=>{var V;if(g.type==="message"){const ne=g.data;if((V=R.current)==null||V.call(R,ne),console.log("sss",{updateCache:_.current,currentUserId:y.current}),!_.current||!y.current)return;const W=T.current&&On(T.current),ce=gl(ne,y.current),J={...ne,conversationId:ce};et.messages.put(J);const N=await et.summaries.get(ce),{unread_count:G,message_count:le}=N,Pe={message_count:le+1,last_message_at:ne.created_at};ce!==W&&(Pe.unread_count=G+1),await et.summaries.update(ce,Pe)}},[]),I=ue.useCallback(()=>{n==null||n()},[n]),F=ue.useCallback((g,V)=>{i==null||i(g,V)},[i]),M=ue.useCallback(g=>{console.error("[WS] WebSocket error:",g),s==null||s(g)},[s]);ue.useEffect(()=>{try{const g=jt();return console.log("www adding listeners"),g.on("message",A),g.on("open",I),g.on("close",F),g.on("error",M),()=>{console.log("www removing listeners"),g.off("message",A),g.off("open",I),g.off("close",F),g.off("error",M)}}catch(g){console.error("Failed to setup WebSocket listeners:",g)}},[A,I,F,M])}const Cl=({initialConversation:t})=>{const[n,i]=ue.useState(t??null),[s,c]=ue.useState(),[f,h]=ue.useState(!0),y=A=>()=>h(A),T=jt();Do(async()=>{const A=await T.getMe();c(A),et.users.put(A),console.log("sdf user set",A)},[]),Fa({onError:y(!1),onConnect:y(!0),onDisconnect:y(!1),currentUserId:s==null?void 0:s.id,conversation:n,updateCache:!0});const _=A=>{i(A)},R=()=>{i(null)};return B.jsxs(Z.Box,{display:"flex",height:"100%",overflow:"hidden",children:[B.jsx(Z.Box,{sx:{width:{xs:"100%",sm:"100%",md:"320px"},flexShrink:0,border:"0px solid",borderRightWidth:{xs:0,md:1},borderColor:"divider",overflow:"hidden",display:{xs:n?"none":"flex",sm:n?"none":"flex",md:"flex"},flexDirection:"column"},children:B.jsx(Oo,{children:B.jsx(Aa,{currentUser:s,selectedConversation:n,onConversationSelect:_})})}),B.jsx(Z.Box,{sx:{flex:1,overflow:"hidden",display:{xs:n?"flex":"none",sm:n?"flex":"none",md:"flex"},flexDirection:"column"},children:n?B.jsx(Oo,{children:B.jsx(Ka,{conversation:n,user:s,isConnected:f,onBack:R})}):B.jsx(Z.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"text.secondary",children:"Select a conversation to start chatting"})})]})},El=({count:t,children:n,max:i=99})=>B.jsx(Z.Badge,{badgeContent:t,color:"error",max:i,overlap:"rectangular",sx:{"& .MuiBadge-badge":{right:8,top:"50%",transform:"translateY(-50%)"}},children:n}),Tl={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},Zi=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches,kl={mode:"dark",background:{paper:"#3d3d43",default:"#333338"},text:{primary:"#eee",secondary:"#aaa"}},Ol=Ca({palette:{mode:"light",primary:{main:"#E91E63",light:"#F48FB1",dark:"#AD1457",contrastText:"#fff"},secondary:{main:"#e4e6eb",light:"#f0f2f5",dark:"#b0b3b8",contrastText:"rgba(0, 0, 0, 0.87)"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},background:{default:"#f5f5f5",paper:"#ffff"},...Zi?kl:{}},typography:{fontFamily:["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'].join(","),fontSize:14,h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500},body1:{fontSize:"0.9375rem",lineHeight:1.4},body2:{fontSize:"0.8125rem",lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:"50%"}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:"0.6875rem",height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:"8px",height:"8px"},"*::-webkit-scrollbar-track":{background:"undo",borderRadius:"4px"},"*::-webkit-scrollbar-thumb":{background:"undo",borderRadius:"4px","&:hover":{background:"undo"}},scrollbarWidth:"thin",scrollbarColor:Zi?"#6a6a6e #333338":"#c1c1c1 #f5f5f5"}}}}});exports.CACHE_TTL=Tl;exports.ChatApp=Cs;exports.ChatContainer=Cl;exports.ChatHeader=Pa;exports.ChatWindow=Ka;exports.ConversationItem=ka;exports.ConversationItemSkeleton=Oa;exports.ConversationList=Aa;exports.ErrorBoundary=Oo;exports.LoadMoreTrigger=$a;exports.MessageBubble=ja;exports.MessageInput=Ma;exports.MessageList=Ba;exports.MessageSkeleton=Ia;exports.UnreadBadge=El;exports.disconnectSDK=ta;exports.getSDK=jt;exports.groupMessages=xl;exports.initSDK=ea;exports.isSDKInitialized=xs;exports.shouldGroupMessages=ko;exports.theme=Ol;exports.useMessages=Na;exports.useSenderNames=Da;exports.useWebSocketMessages=Fa;
|
|
72
|
+
export default theme;`}function Hi(t){return typeof t=="number"?`${(t*100).toFixed(0)}%`:`calc((${t}) * 100%)`}const Bc=t=>{if(!Number.isNaN(+t))return+t;const n=t.match(/\d*\.?\d+/g);if(!n)return 0;let i=0;for(let s=0;s<n.length;s+=1)i+=+n[s];return i};function Mc(t){Object.assign(t,{alpha(n,i){const s=this||t;return s.colorSpace?`oklch(from ${n} l c h / ${typeof i=="string"?`calc(${i})`:i})`:s.vars?`rgba(${n.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof i=="string"?`calc(${i})`:i})`:ga(n,Bc(i))},lighten(n,i){const s=this||t;return s.colorSpace?`color-mix(in ${s.colorSpace}, ${n}, #fff ${Hi(i)})`:On(n,i)},darken(n,i){const s=this||t;return s.colorSpace?`color-mix(in ${s.colorSpace}, ${n}, #000 ${Hi(i)})`:kn(n,i)}})}function To(t={},...n){const{breakpoints:i,mixins:s={},spacing:c,palette:f={},transitions:h={},typography:m={},shape:T,colorSpace:_,...R}=t;if(t.vars&&t.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":Yt(20));const A=Do({...f,colorSpace:_}),I=fa(t);let K=at(I,{mixins:_c(I.breakpoints,s),palette:A,shadows:Ac.slice(),typography:Ec(A,m),transitions:Ic(h),zIndex:{...$c}});if(K=at(K,R),K=n.reduce((M,g)=>at(M,g),K),process.env.NODE_ENV!=="production"){const M=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],g=(V,J)=>{let ae;for(ae in V){const ce=V[ae];if(M.includes(ae)&&Object.keys(ce).length>0){if(process.env.NODE_ENV!=="production"){const W=Io("",ae);console.error([`MUI: The \`${J}\` component increases the CSS specificity of the \`${ae}\` internal state.`,"You can not override it like this: ",JSON.stringify(V,null,2),"",`Instead, you need to use the '&.${W}' syntax:`,JSON.stringify({root:{[`&.${W}`]:ce}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
73
|
+
`))}V[ae]={}}}};Object.keys(K.components).forEach(V=>{const J=K.components[V].styleOverrides;J&&V.startsWith("Mui")&&g(J,V)})}return K.unstable_sxConfig={...En,...R==null?void 0:R.unstable_sxConfig},K.unstable_sx=function(g){return fr({sx:g,theme:this})},K.toRuntimeSource=xa,Mc(K),K}function Nc(t){let n;return t<1?n=5.11916*t**2:n=4.5*Math.log(t+1)+2,Math.round(n*10)/1e3}const Kc=[...Array(25)].map((t,n)=>{if(n===0)return"none";const i=Nc(n);return`linear-gradient(rgba(255 255 255 / ${i}), rgba(255 255 255 / ${i}))`});function Sa(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function _a(t){return t==="dark"?Kc:[]}function Fc(t){const{palette:n={mode:"light"},opacity:i,overlays:s,colorSpace:c,...f}=t,h=Do({...n,colorSpace:c});return{palette:h,opacity:{...Sa(h.mode),...i},overlays:s||_a(h.mode),...f}}function qc(t){var n;return!!t[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!t[0].match(/sxConfig$/)||t[0]==="palette"&&!!((n=t[1])!=null&&n.match(/(mode|contrastThreshold|tonalOffset)/))}const Lc=t=>[...[...Array(25)].map((n,i)=>`--${t?`${t}-`:""}overlays-${i}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],zc=t=>(n,i)=>{const s=t.rootSelector||":root",c=t.colorSchemeSelector;let f=c;if(c==="class"&&(f=".%s"),c==="data"&&(f="[data-%s]"),c!=null&&c.startsWith("data-")&&!c.includes("%s")&&(f=`[${c}="%s"]`),t.defaultColorScheme===n){if(n==="dark"){const h={};return Lc(t.cssVarPrefix).forEach(m=>{h[m]=i[m],delete i[m]}),f==="media"?{[s]:i,"@media (prefers-color-scheme: dark)":{[s]:h}}:f?{[f.replace("%s",n)]:h,[`${s}, ${f.replace("%s",n)}`]:i}:{[s]:{...i,...h}}}if(f&&f!=="media")return`${s}, ${f.replace("%s",String(n))}`}else if(n){if(f==="media")return{[`@media (prefers-color-scheme: ${String(n)})`]:{[s]:i}};if(f)return f.replace("%s",String(n))}return s};function Vc(t,n){n.forEach(i=>{t[i]||(t[i]={})})}function $(t,n,i){!t[n]&&i&&(t[n]=i)}function Or(t){return typeof t!="string"||!t.startsWith("hsl")?t:ya(t)}function vt(t,n){`${n}Channel`in t||(t[`${n}Channel`]=kr(Or(t[n]),`MUI: Can't create \`palette.${n}Channel\` because \`palette.${n}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
74
|
+
To suppress this warning, you need to explicitly provide the \`palette.${n}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Wc(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const mt=t=>{try{return t()}catch{}},Uc=(t="mui")=>cc(t);function xo(t,n,i,s,c){if(!i)return;i=i===!0?{}:i;const f=c==="dark"?"dark":"light";if(!s){n[c]=Fc({...i,palette:{mode:f,...i==null?void 0:i.palette},colorSpace:t});return}const{palette:h,...m}=To({...s,palette:{mode:f,...i==null?void 0:i.palette},colorSpace:t});return n[c]={...i,palette:h,opacity:{...Sa(f),...i==null?void 0:i.opacity},overlays:(i==null?void 0:i.overlays)||_a(f)},m}function Yc(t={},...n){const{colorSchemes:i={light:!0},defaultColorScheme:s,disableCssColorScheme:c=!1,cssVarPrefix:f="mui",nativeColor:h=!1,shouldSkipGeneratingVar:m=qc,colorSchemeSelector:T=i.light&&i.dark?"media":void 0,rootSelector:_=":root",...R}=t,A=Object.keys(i)[0],I=s||(i.light&&A!=="light"?"light":A),K=Uc(f),{[I]:M,light:g,dark:V,...J}=i,ae={...J};let ce=M;if((I==="dark"&&!("dark"in i)||I==="light"&&!("light"in i))&&(ce=!0),!ce)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${I}\` option is either missing or invalid.`:Yt(21,I));let W;h&&(W="oklch");const F=xo(W,ae,ce,R,I);g&&!ae.light&&xo(W,ae,g,void 0,"light"),V&&!ae.dark&&xo(W,ae,V,void 0,"dark");let ee={defaultColorScheme:I,...F,cssVarPrefix:f,colorSchemeSelector:T,rootSelector:_,getCssVar:K,colorSchemes:ae,font:{...Sc(F.typography),...F.font},spacing:Wc(R.spacing)};Object.keys(ee.colorSchemes).forEach(Re=>{const y=ee.colorSchemes[Re].palette,re=fe=>{const ye=fe.split("-"),qe=ye[1],Le=ye[2];return K(fe,y[qe][Le])};y.mode==="light"&&($(y.common,"background","#fff"),$(y.common,"onBackground","#000")),y.mode==="dark"&&($(y.common,"background","#000"),$(y.common,"onBackground","#fff"));function G(fe,ye,qe){if(W){let Le;return fe===Vt&&(Le=`transparent ${((1-qe)*100).toFixed(0)}%`),fe===je&&(Le=`#000 ${(qe*100).toFixed(0)}%`),fe===Ie&&(Le=`#fff ${(qe*100).toFixed(0)}%`),`color-mix(in ${W}, ${ye}, ${Le})`}return fe(ye,qe)}if(Vc(y,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),y.mode==="light"){$(y.Alert,"errorColor",G(je,y.error.light,.6)),$(y.Alert,"infoColor",G(je,y.info.light,.6)),$(y.Alert,"successColor",G(je,y.success.light,.6)),$(y.Alert,"warningColor",G(je,y.warning.light,.6)),$(y.Alert,"errorFilledBg",re("palette-error-main")),$(y.Alert,"infoFilledBg",re("palette-info-main")),$(y.Alert,"successFilledBg",re("palette-success-main")),$(y.Alert,"warningFilledBg",re("palette-warning-main")),$(y.Alert,"errorFilledColor",mt(()=>y.getContrastText(y.error.main))),$(y.Alert,"infoFilledColor",mt(()=>y.getContrastText(y.info.main))),$(y.Alert,"successFilledColor",mt(()=>y.getContrastText(y.success.main))),$(y.Alert,"warningFilledColor",mt(()=>y.getContrastText(y.warning.main))),$(y.Alert,"errorStandardBg",G(Ie,y.error.light,.9)),$(y.Alert,"infoStandardBg",G(Ie,y.info.light,.9)),$(y.Alert,"successStandardBg",G(Ie,y.success.light,.9)),$(y.Alert,"warningStandardBg",G(Ie,y.warning.light,.9)),$(y.Alert,"errorIconColor",re("palette-error-main")),$(y.Alert,"infoIconColor",re("palette-info-main")),$(y.Alert,"successIconColor",re("palette-success-main")),$(y.Alert,"warningIconColor",re("palette-warning-main")),$(y.AppBar,"defaultBg",re("palette-grey-100")),$(y.Avatar,"defaultBg",re("palette-grey-400")),$(y.Button,"inheritContainedBg",re("palette-grey-300")),$(y.Button,"inheritContainedHoverBg",re("palette-grey-A100")),$(y.Chip,"defaultBorder",re("palette-grey-400")),$(y.Chip,"defaultAvatarColor",re("palette-grey-700")),$(y.Chip,"defaultIconColor",re("palette-grey-700")),$(y.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),$(y.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),$(y.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),$(y.LinearProgress,"primaryBg",G(Ie,y.primary.main,.62)),$(y.LinearProgress,"secondaryBg",G(Ie,y.secondary.main,.62)),$(y.LinearProgress,"errorBg",G(Ie,y.error.main,.62)),$(y.LinearProgress,"infoBg",G(Ie,y.info.main,.62)),$(y.LinearProgress,"successBg",G(Ie,y.success.main,.62)),$(y.LinearProgress,"warningBg",G(Ie,y.warning.main,.62)),$(y.Skeleton,"bg",W?G(Vt,y.text.primary,.11):`rgba(${re("palette-text-primaryChannel")} / 0.11)`),$(y.Slider,"primaryTrack",G(Ie,y.primary.main,.62)),$(y.Slider,"secondaryTrack",G(Ie,y.secondary.main,.62)),$(y.Slider,"errorTrack",G(Ie,y.error.main,.62)),$(y.Slider,"infoTrack",G(Ie,y.info.main,.62)),$(y.Slider,"successTrack",G(Ie,y.success.main,.62)),$(y.Slider,"warningTrack",G(Ie,y.warning.main,.62));const fe=W?G(je,y.background.default,.6825):un(y.background.default,.8);$(y.SnackbarContent,"bg",fe),$(y.SnackbarContent,"color",mt(()=>W?Eo.text.primary:y.getContrastText(fe))),$(y.SpeedDialAction,"fabHoverBg",un(y.background.paper,.15)),$(y.StepConnector,"border",re("palette-grey-400")),$(y.StepContent,"border",re("palette-grey-400")),$(y.Switch,"defaultColor",re("palette-common-white")),$(y.Switch,"defaultDisabledColor",re("palette-grey-100")),$(y.Switch,"primaryDisabledColor",G(Ie,y.primary.main,.62)),$(y.Switch,"secondaryDisabledColor",G(Ie,y.secondary.main,.62)),$(y.Switch,"errorDisabledColor",G(Ie,y.error.main,.62)),$(y.Switch,"infoDisabledColor",G(Ie,y.info.main,.62)),$(y.Switch,"successDisabledColor",G(Ie,y.success.main,.62)),$(y.Switch,"warningDisabledColor",G(Ie,y.warning.main,.62)),$(y.TableCell,"border",G(Ie,G(Vt,y.divider,1),.88)),$(y.Tooltip,"bg",G(Vt,y.grey[700],.92))}if(y.mode==="dark"){$(y.Alert,"errorColor",G(Ie,y.error.light,.6)),$(y.Alert,"infoColor",G(Ie,y.info.light,.6)),$(y.Alert,"successColor",G(Ie,y.success.light,.6)),$(y.Alert,"warningColor",G(Ie,y.warning.light,.6)),$(y.Alert,"errorFilledBg",re("palette-error-dark")),$(y.Alert,"infoFilledBg",re("palette-info-dark")),$(y.Alert,"successFilledBg",re("palette-success-dark")),$(y.Alert,"warningFilledBg",re("palette-warning-dark")),$(y.Alert,"errorFilledColor",mt(()=>y.getContrastText(y.error.dark))),$(y.Alert,"infoFilledColor",mt(()=>y.getContrastText(y.info.dark))),$(y.Alert,"successFilledColor",mt(()=>y.getContrastText(y.success.dark))),$(y.Alert,"warningFilledColor",mt(()=>y.getContrastText(y.warning.dark))),$(y.Alert,"errorStandardBg",G(je,y.error.light,.9)),$(y.Alert,"infoStandardBg",G(je,y.info.light,.9)),$(y.Alert,"successStandardBg",G(je,y.success.light,.9)),$(y.Alert,"warningStandardBg",G(je,y.warning.light,.9)),$(y.Alert,"errorIconColor",re("palette-error-main")),$(y.Alert,"infoIconColor",re("palette-info-main")),$(y.Alert,"successIconColor",re("palette-success-main")),$(y.Alert,"warningIconColor",re("palette-warning-main")),$(y.AppBar,"defaultBg",re("palette-grey-900")),$(y.AppBar,"darkBg",re("palette-background-paper")),$(y.AppBar,"darkColor",re("palette-text-primary")),$(y.Avatar,"defaultBg",re("palette-grey-600")),$(y.Button,"inheritContainedBg",re("palette-grey-800")),$(y.Button,"inheritContainedHoverBg",re("palette-grey-700")),$(y.Chip,"defaultBorder",re("palette-grey-700")),$(y.Chip,"defaultAvatarColor",re("palette-grey-300")),$(y.Chip,"defaultIconColor",re("palette-grey-300")),$(y.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),$(y.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),$(y.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),$(y.LinearProgress,"primaryBg",G(je,y.primary.main,.5)),$(y.LinearProgress,"secondaryBg",G(je,y.secondary.main,.5)),$(y.LinearProgress,"errorBg",G(je,y.error.main,.5)),$(y.LinearProgress,"infoBg",G(je,y.info.main,.5)),$(y.LinearProgress,"successBg",G(je,y.success.main,.5)),$(y.LinearProgress,"warningBg",G(je,y.warning.main,.5)),$(y.Skeleton,"bg",W?G(Vt,y.text.primary,.13):`rgba(${re("palette-text-primaryChannel")} / 0.13)`),$(y.Slider,"primaryTrack",G(je,y.primary.main,.5)),$(y.Slider,"secondaryTrack",G(je,y.secondary.main,.5)),$(y.Slider,"errorTrack",G(je,y.error.main,.5)),$(y.Slider,"infoTrack",G(je,y.info.main,.5)),$(y.Slider,"successTrack",G(je,y.success.main,.5)),$(y.Slider,"warningTrack",G(je,y.warning.main,.5));const fe=W?G(Ie,y.background.default,.985):un(y.background.default,.98);$(y.SnackbarContent,"bg",fe),$(y.SnackbarContent,"color",mt(()=>W?ba.text.primary:y.getContrastText(fe))),$(y.SpeedDialAction,"fabHoverBg",un(y.background.paper,.15)),$(y.StepConnector,"border",re("palette-grey-600")),$(y.StepContent,"border",re("palette-grey-600")),$(y.Switch,"defaultColor",re("palette-grey-300")),$(y.Switch,"defaultDisabledColor",re("palette-grey-600")),$(y.Switch,"primaryDisabledColor",G(je,y.primary.main,.55)),$(y.Switch,"secondaryDisabledColor",G(je,y.secondary.main,.55)),$(y.Switch,"errorDisabledColor",G(je,y.error.main,.55)),$(y.Switch,"infoDisabledColor",G(je,y.info.main,.55)),$(y.Switch,"successDisabledColor",G(je,y.success.main,.55)),$(y.Switch,"warningDisabledColor",G(je,y.warning.main,.55)),$(y.TableCell,"border",G(je,G(Vt,y.divider,1),.68)),$(y.Tooltip,"bg",G(Vt,y.grey[700],.92))}vt(y.background,"default"),vt(y.background,"paper"),vt(y.common,"background"),vt(y.common,"onBackground"),vt(y,"divider"),Object.keys(y).forEach(fe=>{const ye=y[fe];fe!=="tonalOffset"&&ye&&typeof ye=="object"&&(ye.main&&$(y[fe],"mainChannel",kr(Or(ye.main))),ye.light&&$(y[fe],"lightChannel",kr(Or(ye.light))),ye.dark&&$(y[fe],"darkChannel",kr(Or(ye.dark))),ye.contrastText&&$(y[fe],"contrastTextChannel",kr(Or(ye.contrastText))),fe==="text"&&(vt(y[fe],"primary"),vt(y[fe],"secondary")),fe==="action"&&(ye.active&&vt(y[fe],"active"),ye.selected&&vt(y[fe],"selected")))})}),ee=n.reduce((Re,y)=>at(Re,y),ee);const pe={prefix:f,disableCssColorScheme:c,shouldSkipGeneratingVar:m,getSelector:zc(ee),enableContrastVars:h},{vars:Pe,generateThemeVars:Ke,generateStyleSheets:tt}=dc(ee,pe);return ee.vars=Pe,Object.entries(ee.colorSchemes[ee.defaultColorScheme]).forEach(([Re,y])=>{ee[Re]=y}),ee.generateThemeVars=Ke,ee.generateStyleSheets=tt,ee.generateSpacing=function(){return la(R.spacing,Ro(this))},ee.getColorSchemeSelector=pc(T),ee.spacing=ee.generateSpacing(),ee.shouldSkipGeneratingVar=m,ee.unstable_sxConfig={...En,...R==null?void 0:R.unstable_sxConfig},ee.unstable_sx=function(y){return fr({sx:y,theme:this})},ee.toRuntimeSource=xa,ee}function Qi(t,n,i){t.colorSchemes&&i&&(t.colorSchemes[n]={...i!==!0&&i,palette:Do({...i===!0?{}:i.palette,mode:n})})}function Ca(t={},...n){const{palette:i,cssVariables:s=!1,colorSchemes:c=i?void 0:{light:!0},defaultColorScheme:f=i==null?void 0:i.mode,...h}=t,m=f||"light",T=c==null?void 0:c[m],_={...c,...i?{[m]:{...typeof T!="boolean"&&T,palette:i}}:void 0};if(s===!1){if(!("colorSchemes"in t))return To(t,...n);let R=i;"palette"in t||_[m]&&(_[m]!==!0?R=_[m].palette:m==="dark"&&(R={mode:"dark"}));const A=To({...t,palette:R},...n);return A.defaultColorScheme=m,A.colorSchemes=_,A.palette.mode==="light"&&(A.colorSchemes.light={..._.light!==!0&&_.light,palette:A.palette},Qi(A,"dark",_.dark)),A.palette.mode==="dark"&&(A.colorSchemes.dark={..._.dark!==!0&&_.dark,palette:A.palette},Qi(A,"light",_.light)),A}return!i&&!("light"in _)&&m==="light"&&(_.light=!0),Yc({...h,colorSchemes:_,defaultColorScheme:m,...typeof s!="boolean"&&s},...n)}const Gc=Ca(),Hc="$$material";function Qc(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const Xc=t=>Qc(t)&&t!=="classes",Jc=Qu({themeId:Hc,defaultTheme:Gc,rootShouldForwardProp:Xc}),Zc=uc;process.env.NODE_ENV!=="production"&&(Te.node,Te.object.isRequired);function el(t){return sc(t)}function tl(t){return Io("MuiSvgIcon",t)}Wu("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const rl=t=>{const{color:n,fontSize:i,classes:s}=t,c={root:["root",n!=="inherit"&&`color${Gt(n)}`,`fontSize${Gt(i)}`]};return Bs(c,tl,s)},nl=Jc("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:i}=t;return[n.root,i.color!=="inherit"&&n[`color${Gt(i.color)}`],n[`fontSize${Gt(i.fontSize)}`]]}})(Zc(({theme:t})=>{var n,i,s,c,f,h,m,T,_,R,A,I,K,M;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(c=(n=t.transitions)==null?void 0:n.create)==null?void 0:c.call(n,"fill",{duration:(s=(i=(t.vars??t).transitions)==null?void 0:i.duration)==null?void 0:s.shorter}),variants:[{props:g=>!g.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((h=(f=t.typography)==null?void 0:f.pxToRem)==null?void 0:h.call(f,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((T=(m=t.typography)==null?void 0:m.pxToRem)==null?void 0:T.call(m,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((R=(_=t.typography)==null?void 0:_.pxToRem)==null?void 0:R.call(_,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,g])=>g&&g.main).map(([g])=>{var V,J;return{props:{color:g},style:{color:(J=(V=(t.vars??t).palette)==null?void 0:V[g])==null?void 0:J.main}}}),{props:{color:"action"},style:{color:(I=(A=(t.vars??t).palette)==null?void 0:A.action)==null?void 0:I.active}},{props:{color:"disabled"},style:{color:(M=(K=(t.vars??t).palette)==null?void 0:K.action)==null?void 0:M.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),hn=jt.forwardRef(function(n,i){const s=el({props:n,name:"MuiSvgIcon"}),{children:c,className:f,color:h="inherit",component:m="svg",fontSize:T="medium",htmlColor:_,inheritViewBox:R=!1,titleAccess:A,viewBox:I="0 0 24 24",...K}=s,M=jt.isValidElement(c)&&c.type==="svg",g={...s,color:h,component:m,fontSize:T,instanceFontSize:n.fontSize,inheritViewBox:R,viewBox:I,hasSvgAsChild:M},V={};R||(V.viewBox=I);const J=rl(g);return B.jsxs(nl,{as:m,className:aa(J.root,f),focusable:"false",color:_,"aria-hidden":A?void 0:!0,role:A?"img":void 0,ref:i,...V,...K,...M&&c.props,ownerState:g,children:[M?c.props.children:c,A?B.jsx("title",{children:A}):null]})});process.env.NODE_ENV!=="production"&&(hn.propTypes={children:Te.node,classes:Te.object,className:Te.string,color:Te.oneOfType([Te.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),Te.string]),component:Te.elementType,fontSize:Te.oneOfType([Te.oneOf(["inherit","large","medium","small"]),Te.string]),htmlColor:Te.string,inheritViewBox:Te.bool,shapeRendering:Te.string,sx:Te.oneOfType([Te.arrayOf(Te.oneOfType([Te.func,Te.object,Te.bool])),Te.func,Te.object]),titleAccess:Te.string,viewBox:Te.string});hn.muiName="SvgIcon";function St(t,n){function i(s,c){return B.jsx(hn,{"data-testid":process.env.NODE_ENV!=="production"?`${n}Icon`:void 0,ref:c,...s,children:t})}return process.env.NODE_ENV!=="production"&&(i.displayName=`${n}Icon`),i.muiName=hn.muiName,jt.memo(jt.forwardRef(i))}const ol=St(B.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),il=St(B.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),al=St(B.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Ea=St(B.jsx("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group"),Ta=St(B.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),sl=St(B.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),ul=St([B.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),B.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule"),cl=St(B.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send"),ll=St(B.jsx("path",{d:"M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0"}),"WifiOff");function fl(t){const n=new Date(t),s=new Date().getTime()-n.getTime(),c=Math.floor(s/6e4),f=Math.floor(s/36e5),h=Math.floor(s/864e5);return c<1?"now":c<60?`${c}m`:f<24?`${f}h`:h<7?`${h}d`:n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const ka=ue.memo(({conversation:t,displayName:n,selected:i,onClick:s})=>{const c=!!t.group,f=t.unread_count;return B.jsx(X.ListItem,{disablePadding:!0,children:B.jsxs(X.ListItemButton,{selected:i,onClick:s,sx:{"&.Mui-selected":{backgroundColor:"action.selected","&:hover":{backgroundColor:"action.selected"}}},children:[B.jsx(X.ListItemAvatar,{children:B.jsx(X.Badge,{badgeContent:f,color:"primary",overlap:"circular",invisible:f===0,children:B.jsx(X.Avatar,{sx:{bgcolor:c?"primary.main":"secondary.main"},children:c?B.jsx(Ea,{}):B.jsx(Ta,{})})})}),B.jsx(X.ListItemText,{primary:B.jsxs(X.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[B.jsx(X.Typography,{variant:"subtitle2",noWrap:!0,sx:{fontWeight:f>0?600:400,flex:1},children:n}),B.jsx(X.Typography,{variant:"caption",color:"text.secondary",sx:{ml:1,flexShrink:0},children:fl(t.last_message_at)})]}),secondary:B.jsx(X.Typography,{variant:"body2",color:"text.secondary",noWrap:!0,sx:{fontWeight:f>0?500:400},children:t.message_count===0?"No messages yet":`${t.message_count} message${t.message_count!==1?"s":""}`})})]})})}),Oa=()=>B.jsxs(X.ListItem,{children:[B.jsx(X.ListItemAvatar,{children:B.jsx(X.Skeleton,{variant:"circular",width:40,height:40})}),B.jsx(X.ListItemText,{primary:B.jsxs(X.Box,{display:"flex",justifyContent:"space-between",children:[B.jsx(X.Skeleton,{variant:"text",width:"60%"}),B.jsx(X.Skeleton,{variant:"text",width:"15%"})]}),secondary:B.jsx(X.Skeleton,{variant:"text",width:"80%"})})]});var ln={exports:{}},dl=ln.exports,Xi;function pl(){return Xi||(Xi=1,(function(t,n){((i,s)=>{t.exports=s()})(dl,function(){var i=function(e,r){return(i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(o,a){o.__proto__=a}:function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])}))(e,r)},s=function(){return(s=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++)for(var u in r=arguments[o])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e}).apply(this,arguments)};function c(e,r,o){for(var a,u=0,l=r.length;u<l;u++)!a&&u in r||((a=a||Array.prototype.slice.call(r,0,u))[u]=r[u]);return e.concat(a||Array.prototype.slice.call(r))}var f=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:ks,h=Object.keys,m=Array.isArray;function T(e,r){return typeof r=="object"&&h(r).forEach(function(o){e[o]=r[o]}),e}typeof Promise>"u"||f.Promise||(f.Promise=Promise);var _=Object.getPrototypeOf,R={}.hasOwnProperty;function A(e,r){return R.call(e,r)}function I(e,r){typeof r=="function"&&(r=r(_(e))),(typeof Reflect>"u"?h:Reflect.ownKeys)(r).forEach(function(o){M(e,o,r[o])})}var K=Object.defineProperty;function M(e,r,o,a){K(e,r,T(o&&A(o,"get")&&typeof o.get=="function"?{get:o.get,set:o.set,configurable:!0}:{value:o,configurable:!0,writable:!0},a))}function g(e){return{from:function(r){return e.prototype=Object.create(r.prototype),M(e.prototype,"constructor",e),{extend:I.bind(null,e.prototype)}}}}var V=Object.getOwnPropertyDescriptor,J=[].slice;function ae(e,r,o){return J.call(e,r,o)}function ce(e,r){return r(e)}function W(e){if(!e)throw new Error("Assertion Failed")}function F(e){f.setImmediate?setImmediate(e):setTimeout(e,0)}function ee(e,r){if(typeof r=="string"&&A(e,r))return e[r];if(!r)return e;if(typeof r!="string"){for(var o=[],a=0,u=r.length;a<u;++a){var l=ee(e,r[a]);o.push(l)}return o}var d,p=r.indexOf(".");return p===-1||(d=e[r.substr(0,p)])==null?void 0:ee(d,r.substr(p+1))}function pe(e,r,o){if(e&&r!==void 0&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof r!="string"&&"length"in r){W(typeof o!="string"&&"length"in o);for(var a=0,u=r.length;a<u;++a)pe(e,r[a],o[a])}else{var l,d,p=r.indexOf(".");p!==-1?(l=r.substr(0,p),(p=r.substr(p+1))===""?o===void 0?m(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=o:pe(d=(d=e[l])&&A(e,l)?d:e[l]={},p,o)):o===void 0?m(e)&&!isNaN(parseInt(r))?e.splice(r,1):delete e[r]:e[r]=o}}function Pe(e){var r,o={};for(r in e)A(e,r)&&(o[r]=e[r]);return o}var Ke=[].concat;function tt(e){return Ke.apply([],e)}var he="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(tt([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(r){return r+e+"Array"})}))).filter(function(e){return f[e]}),Re=new Set(he.map(function(e){return f[e]})),y=null;function re(e){return y=new WeakMap,e=(function r(o){if(!o||typeof o!="object")return o;var a=y.get(o);if(a)return a;if(m(o)){a=[],y.set(o,a);for(var u=0,l=o.length;u<l;++u)a.push(r(o[u]))}else if(Re.has(o.constructor))a=o;else{var d,p=_(o);for(d in a=p===Object.prototype?{}:Object.create(p),y.set(o,a),o)A(o,d)&&(a[d]=r(o[d]))}return a})(e),y=null,e}var G={}.toString;function fe(e){return G.call(e).slice(8,-1)}var ye=typeof Symbol<"u"?Symbol.iterator:"@@iterator",qe=typeof ye=="symbol"?function(e){var r;return e!=null&&(r=e[ye])&&r.apply(e)}:function(){return null};function Le(e,r){r=e.indexOf(r),0<=r&&e.splice(r,1)}var rt={};function z(e){var r,o,a,u;if(arguments.length===1){if(m(e))return e.slice();if(this===rt&&typeof e=="string")return[e];if(u=qe(e))for(o=[];!(a=u.next()).done;)o.push(a.value);else{if(e==null)return[e];if(typeof(r=e.length)!="number")return[e];for(o=new Array(r);r--;)o[r]=e[r]}}else for(r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o}var oe=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},he=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],nt=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(he),be={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 de(e,r){this.name=e,this.message=r}function xe(e,r){return e+". Errors: "+Object.keys(r).map(function(o){return r[o].toString()}).filter(function(o,a,u){return u.indexOf(o)===a}).join(`
|
|
75
|
+
`)}function ge(e,r,o,a){this.failures=r,this.failedKeys=a,this.successCount=o,this.message=xe(e,r)}function me(e,r){this.name="BulkError",this.failures=Object.keys(r).map(function(o){return r[o]}),this.failuresByPos=r,this.message=xe(e,this.failures)}g(de).from(Error).extend({toString:function(){return this.name+": "+this.message}}),g(ge).from(de),g(me).from(de);var we=nt.reduce(function(e,r){return e[r]=r+"Error",e},{}),ke=de,Y=nt.reduce(function(e,r){var o=r+"Error";function a(u,l){this.name=o,u?typeof u=="string"?(this.message="".concat(u).concat(l?`
|
|
76
|
+
`+l:""),this.inner=l||null):typeof u=="object"&&(this.message="".concat(u.name," ").concat(u.message),this.inner=u):(this.message=be[r]||o,this.inner=null)}return g(a).from(ke),e[r]=a,e},{}),Je=(Y.Syntax=SyntaxError,Y.Type=TypeError,Y.Range=RangeError,he.reduce(function(e,r){return e[r+"Error"]=Y[r],e},{}));he=nt.reduce(function(e,r){return["Syntax","Type","Range"].indexOf(r)===-1&&(e[r+"Error"]=Y[r]),e},{});function q(){}function Ze(e){return e}function Ht(e,r){return e==null||e===Ze?r:function(o){return r(e(o))}}function ft(e,r){return function(){e.apply(this,arguments),r.apply(this,arguments)}}function qa(e,r){return e===q?r:function(){var o=e.apply(this,arguments),a=(o!==void 0&&(arguments[0]=o),this.onsuccess),u=this.onerror,l=(this.onsuccess=null,this.onerror=null,r.apply(this,arguments));return a&&(this.onsuccess=this.onsuccess?ft(a,this.onsuccess):a),u&&(this.onerror=this.onerror?ft(u,this.onerror):u),l!==void 0?l:o}}function La(e,r){return e===q?r:function(){e.apply(this,arguments);var o=this.onsuccess,a=this.onerror;this.onsuccess=this.onerror=null,r.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?ft(o,this.onsuccess):o),a&&(this.onerror=this.onerror?ft(a,this.onerror):a)}}function za(e,r){return e===q?r:function(u){var a=e.apply(this,arguments),u=(T(u,a),this.onsuccess),l=this.onerror,d=(this.onsuccess=null,this.onerror=null,r.apply(this,arguments));return u&&(this.onsuccess=this.onsuccess?ft(u,this.onsuccess):u),l&&(this.onerror=this.onerror?ft(l,this.onerror):l),a===void 0?d===void 0?void 0:d:T(a,d)}}function Va(e,r){return e===q?r:function(){return r.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function Pn(e,r){return e===q?r:function(){var o=e.apply(this,arguments);if(o&&typeof o.then=="function"){for(var a=this,u=arguments.length,l=new Array(u);u--;)l[u]=arguments[u];return o.then(function(){return r.apply(a,l)})}return r.apply(this,arguments)}}he.ModifyError=ge,he.DexieError=de,he.BulkError=me;var dt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Mo(e){dt=e}var pr={},No=100,hr=typeof Promise>"u"?[]:(nt=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[hr=crypto.subtle.digest("SHA-512",new Uint8Array([0])),_(hr),nt]:[nt,_(nt),nt]),nt=hr[0],nr=hr[1],nr=nr&&nr.then,Dt=nt&&nt.constructor,Rn=!!hr[2],mr=function(e,r){yr.push([e,r]),Ir&&(queueMicrotask(Ua),Ir=!1)},jn=!0,Ir=!0,Bt=[],$r=[],In=Ze,_t={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:q,pgp:!1,env:{},finalize:q},se=_t,yr=[],Mt=0,Dr=[];function Z(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var r=this._PSD=se;if(typeof e!="function"){if(e!==pr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Dn(this,this._value)}else this._state=null,this._value=null,++r.ref,(function o(a,u){try{u(function(l){if(a._state===null){if(l===a)throw new TypeError("A promise cannot be resolved with itself.");var d=a._lib&&Qt();l&&typeof l.then=="function"?o(a,function(p,w){l instanceof Z?l._then(p,w):l.then(p,w)}):(a._state=!0,a._value=l,Fo(a)),d&&Xt()}},Dn.bind(null,a))}catch(l){Dn(a,l)}})(this,e)}var $n={get:function(){var e=se,r=Kr;function o(a,u){var l=this,d=!e.global&&(e!==se||r!==Kr),p=d&&!Et(),w=new Z(function(O,x){Bn(l,new Ko(Lo(a,e,d,p),Lo(u,e,d,p),O,x,e))});return this._consoleTask&&(w._consoleTask=this._consoleTask),w}return o.prototype=pr,o},set:function(e){M(this,"then",e&&e.prototype===pr?$n:{get:function(){return e},set:$n.set})}};function Ko(e,r,o,a,u){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof r=="function"?r:null,this.resolve=o,this.reject=a,this.psd=u}function Dn(e,r){var o,a;$r.push(r),e._state===null&&(o=e._lib&&Qt(),r=In(r),e._state=!1,e._value=r,a=e,Bt.some(function(u){return u._value===a._value})||Bt.push(a),Fo(e),o)&&Xt()}function Fo(e){var r=e._listeners;e._listeners=[];for(var o=0,a=r.length;o<a;++o)Bn(e,r[o]);var u=e._PSD;--u.ref||u.finalize(),Mt===0&&(++Mt,mr(function(){--Mt==0&&Mn()},[]))}function Bn(e,r){if(e._state===null)e._listeners.push(r);else{var o=e._state?r.onFulfilled:r.onRejected;if(o===null)return(e._state?r.resolve:r.reject)(e._value);++r.psd.ref,++Mt,mr(Wa,[o,e,r])}}function Wa(e,r,o){try{var a,u=r._value;!r._state&&$r.length&&($r=[]),a=dt&&r._consoleTask?r._consoleTask.run(function(){return e(u)}):e(u),r._state||$r.indexOf(u)!==-1||(l=>{for(var d=Bt.length;d;)if(Bt[--d]._value===l._value)return Bt.splice(d,1)})(r),o.resolve(a)}catch(l){o.reject(l)}finally{--Mt==0&&Mn(),--o.psd.ref||o.psd.finalize()}}function Ua(){Nt(_t,function(){Qt()&&Xt()})}function Qt(){var e=jn;return Ir=jn=!1,e}function Xt(){var e,r,o;do for(;0<yr.length;)for(e=yr,yr=[],o=e.length,r=0;r<o;++r){var a=e[r];a[0].apply(null,a[1])}while(0<yr.length);Ir=jn=!0}function Mn(){for(var e=Bt,r=(Bt=[],e.forEach(function(a){a._PSD.onunhandled.call(null,a._value,a)}),Dr.slice(0)),o=r.length;o;)r[--o]()}function Br(e){return new Z(pr,!1,e)}function Me(e,r){var o=se;return function(){var a=Qt(),u=se;try{return Tt(o,!0),e.apply(this,arguments)}catch(l){r&&r(l)}finally{Tt(u,!1),a&&Xt()}}}I(Z.prototype,{then:$n,_then:function(e,r){Bn(this,new Ko(null,null,e,r,se))},catch:function(e){var r,o;return arguments.length===1?this.then(null,e):(r=e,o=arguments[1],typeof r=="function"?this.then(null,function(a){return(a instanceof r?o:Br)(a)}):this.then(null,function(a){return(a&&a.name===r?o:Br)(a)}))},finally:function(e){return this.then(function(r){return Z.resolve(e()).then(function(){return r})},function(r){return Z.resolve(e()).then(function(){return Br(r)})})},timeout:function(e,r){var o=this;return e<1/0?new Z(function(a,u){var l=setTimeout(function(){return u(new Y.Timeout(r))},e);o.then(a,u).finally(clearTimeout.bind(null,l))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&M(Z.prototype,Symbol.toStringTag,"Dexie.Promise"),_t.env=qo(),I(Z,{all:function(){var e=z.apply(null,arguments).map(Fr);return new Z(function(r,o){e.length===0&&r([]);var a=e.length;e.forEach(function(u,l){return Z.resolve(u).then(function(d){e[l]=d,--a||r(e)},o)})})},resolve:function(e){return e instanceof Z?e:e&&typeof e.then=="function"?new Z(function(r,o){e.then(r,o)}):new Z(pr,!0,e)},reject:Br,race:function(){var e=z.apply(null,arguments).map(Fr);return new Z(function(r,o){e.map(function(a){return Z.resolve(a).then(r,o)})})},PSD:{get:function(){return se},set:function(e){return se=e}},totalEchoes:{get:function(){return Kr}},newPSD:Ct,usePSD:Nt,scheduler:{get:function(){return mr},set:function(e){mr=e}},rejectionMapper:{get:function(){return In},set:function(e){In=e}},follow:function(e,r){return new Z(function(o,a){return Ct(function(u,l){var d=se;d.unhandleds=[],d.onunhandled=l,d.finalize=ft(function(){var p,w=this;p=function(){w.unhandleds.length===0?u():l(w.unhandleds[0])},Dr.push(function O(){p(),Dr.splice(Dr.indexOf(O),1)}),++Mt,mr(function(){--Mt==0&&Mn()},[])},d.finalize),e()},r,o,a)})}}),Dt&&(Dt.allSettled&&M(Z,"allSettled",function(){var e=z.apply(null,arguments).map(Fr);return new Z(function(r){e.length===0&&r([]);var o=e.length,a=new Array(o);e.forEach(function(u,l){return Z.resolve(u).then(function(d){return a[l]={status:"fulfilled",value:d}},function(d){return a[l]={status:"rejected",reason:d}}).then(function(){return--o||r(a)})})})}),Dt.any&&typeof AggregateError<"u"&&M(Z,"any",function(){var e=z.apply(null,arguments).map(Fr);return new Z(function(r,o){e.length===0&&o(new AggregateError([]));var a=e.length,u=new Array(a);e.forEach(function(l,d){return Z.resolve(l).then(function(p){return r(p)},function(p){u[d]=p,--a||o(new AggregateError(u))})})})}),Dt.withResolvers)&&(Z.withResolvers=Dt.withResolvers);var He={awaits:0,echoes:0,id:0},Ya=0,Mr=[],Nr=0,Kr=0,Ga=0;function Ct(e,d,o,a){var u=se,l=Object.create(u),d=(l.parent=u,l.ref=0,l.global=!1,l.id=++Ga,_t.env,l.env=Rn?{Promise:Z,PromiseProp:{value:Z,configurable:!0,writable:!0},all:Z.all,race:Z.race,allSettled:Z.allSettled,any:Z.any,resolve:Z.resolve,reject:Z.reject}:{},d&&T(l,d),++u.ref,l.finalize=function(){--this.parent.ref||this.parent.finalize()},Nt(l,e,o,a));return l.ref===0&&l.finalize(),d}function Jt(){return He.id||(He.id=++Ya),++He.awaits,He.echoes+=No,He.id}function Et(){return!!He.awaits&&(--He.awaits==0&&(He.id=0),He.echoes=He.awaits*No,!0)}function Fr(e){return He.echoes&&e&&e.constructor===Dt?(Jt(),e.then(function(r){return Et(),r},function(r){return Et(),Ue(r)})):e}function Ha(){var e=Mr[Mr.length-1];Mr.pop(),Tt(e,!1)}function Tt(e,r){var o,a,u=se;(r?!He.echoes||Nr++&&e===se:!Nr||--Nr&&e===se)||queueMicrotask(r?(function(l){++Kr,He.echoes&&--He.echoes!=0||(He.echoes=He.awaits=He.id=0),Mr.push(se),Tt(l,!0)}).bind(null,e):Ha),e!==se&&(se=e,u===_t&&(_t.env=qo()),Rn)&&(o=_t.env.Promise,a=e.env,u.global||e.global)&&(Object.defineProperty(f,"Promise",a.PromiseProp),o.all=a.all,o.race=a.race,o.resolve=a.resolve,o.reject=a.reject,a.allSettled&&(o.allSettled=a.allSettled),a.any)&&(o.any=a.any)}function qo(){var e=f.Promise;return Rn?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(f,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Nt(e,r,o,a,u){var l=se;try{return Tt(e,!0),r(o,a,u)}finally{Tt(l,!1)}}function Lo(e,r,o,a){return typeof e!="function"?e:function(){var u=se;o&&Jt(),Tt(r,!0);try{return e.apply(this,arguments)}finally{Tt(u,!1),a&&queueMicrotask(Et)}}}function Nn(e){Promise===Dt&&He.echoes===0?Nr===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+nr).indexOf("[native code]")===-1&&(Jt=Et=q);var Ue=Z.reject,Kt="",yt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",zo="String expected.",Zt=[],qr="__dbnames",Kn="readonly",Fn="readwrite";function Ft(e,r){return e?r?function(){return e.apply(this,arguments)&&r.apply(this,arguments)}:e:r}var Vo={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Lr(e){return typeof e!="string"||/\./.test(e)?function(r){return r}:function(r){return r[e]===void 0&&e in r&&delete(r=re(r))[e],r}}function Wo(){throw Y.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function Se(e,r){try{var o=Uo(e),a=Uo(r);if(o!==a)return o==="Array"?1:a==="Array"?-1:o==="binary"?1:a==="binary"?-1:o==="string"?1:a==="string"?-1:o==="Date"?1:a!=="Date"?NaN:-1;switch(o){case"number":case"Date":case"string":return r<e?1:e<r?-1:0;case"binary":for(var u=Yo(e),l=Yo(r),d=u.length,p=l.length,w=d<p?d:p,O=0;O<w;++O)if(u[O]!==l[O])return u[O]<l[O]?-1:1;return d===p?0:d<p?-1:1;case"Array":for(var x=e,v=r,C=x.length,E=v.length,S=C<E?C:E,b=0;b<S;++b){var P=Se(x[b],v[b]);if(P!==0)return P}return C===E?0:C<E?-1:1}}catch{}return NaN}function Uo(e){var r=typeof e;return r=="object"&&(ArrayBuffer.isView(e)||(r=fe(e))==="ArrayBuffer")?"binary":r}function Yo(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function zr(e,r,o){var a=e.schema.yProps;return a?(r&&0<o.numFailures&&(r=r.filter(function(u,l){return!o.failures[l]})),Promise.all(a.map(function(u){return u=u.updatesTable,r?e.db.table(u).where("k").anyOf(r).delete():e.db.table(u).clear()})).then(function(){return o})):o}Go.prototype.execute=function(e){var r=this["@@propmod"];if(r.add!==void 0){var o=r.add;if(m(o))return c(c([],m(e)?e:[],!0),o).sort();if(typeof o=="number")return(Number(e)||0)+o;if(typeof o=="bigint")try{return BigInt(e)+o}catch{return BigInt(0)+o}throw new TypeError("Invalid term ".concat(o))}if(r.remove!==void 0){var a=r.remove;if(m(a))return m(e)?e.filter(function(u){return!a.includes(u)}).sort():[];if(typeof a=="number")return Number(e)-a;if(typeof a=="bigint")try{return BigInt(e)-a}catch{return BigInt(0)-a}throw new TypeError("Invalid subtrahend ".concat(a))}return o=(o=r.replacePrefix)==null?void 0:o[0],o&&typeof e=="string"&&e.startsWith(o)?r.replacePrefix[1]+e.substring(o.length):e};var gr=Go;function Go(e){this["@@propmod"]=e}function Ho(e,r){for(var o=h(r),a=o.length,u=!1,l=0;l<a;++l){var d=o[l],p=r[d],w=ee(e,d);p instanceof gr?(pe(e,d,p.execute(w)),u=!0):w!==p&&(pe(e,d,p),u=!0)}return u}Be.prototype._trans=function(e,r,o){var a=this._tx||se.trans,u=this.name,l=dt&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function d(O,x,v){if(v.schema[u])return r(v.idbtrans,v);throw new Y.NotFound("Table "+u+" not part of transaction")}var p=Qt();try{var w=a&&a.db._novip===this.db._novip?a===se.trans?a._promise(e,d,o):Ct(function(){return a._promise(e,d,o)},{trans:a,transless:se.transless||se}):(function O(x,v,C,E){if(x.idbdb&&(x._state.openComplete||se.letThrough||x._vip)){var S=x._createTransaction(v,C,x._dbSchema);try{S.create(),x._state.PR1398_maxLoop=3}catch(b){return b.name===we.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return O(x,v,C,E)})):Ue(b)}return S._promise(v,function(b,P){return Ct(function(){return se.trans=S,E(b,P,S)})}).then(function(b){if(v==="readwrite")try{S.idbtrans.commit()}catch{}return v==="readonly"?b:S._completion.then(function(){return b})})}if(x._state.openComplete)return Ue(new Y.DatabaseClosed(x._state.dbOpenError));if(!x._state.isBeingOpened){if(!x._state.autoOpen)return Ue(new Y.DatabaseClosed);x.open().catch(q)}return x._state.dbReadyPromise.then(function(){return O(x,v,C,E)})})(this.db,e,[this.name],d);return l&&(w._consoleTask=l,w=w.catch(function(O){return console.trace(O),Ue(O)})),w}finally{p&&Xt()}},Be.prototype.get=function(e,r){var o=this;return e&&e.constructor===Object?this.where(e).first(r):e==null?Ue(new Y.Type("Invalid argument to Table.get()")):this._trans("readonly",function(a){return o.core.get({trans:a,key:e}).then(function(u){return o.hook.reading.fire(u)})}).then(r)},Be.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(m(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var r=h(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);var o=this.schema.indexes.concat(this.schema.primKey).filter(function(p){if(p.compound&&r.every(function(O){return 0<=p.keyPath.indexOf(O)})){for(var w=0;w<r.length;++w)if(r.indexOf(p.keyPath[w])===-1)return!1;return!0}return!1}).sort(function(p,w){return p.keyPath.length-w.keyPath.length})[0];if(o&&this.db._maxKey!==Kt)return d=o.keyPath.slice(0,r.length),this.where(d).equals(d.map(function(p){return e[p]}));!o&&dt&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(r.join("+"),"]"));var a=this.schema.idxByName;function u(p,w){return Se(p,w)===0}var d=r.reduce(function(x,w){var O=x[0],x=x[1],v=a[w],C=e[w];return[O||v,O||!v?Ft(x,v&&v.multi?function(E){return E=ee(E,w),m(E)&&E.some(function(S){return u(C,S)})}:function(E){return u(C,ee(E,w))}):x]},[null,null]),l=d[0],d=d[1];return l?this.where(l.name).equals(e[l.keyPath]).filter(d):o?this.filter(d):this.where(r).equals("")},Be.prototype.filter=function(e){return this.toCollection().and(e)},Be.prototype.count=function(e){return this.toCollection().count(e)},Be.prototype.offset=function(e){return this.toCollection().offset(e)},Be.prototype.limit=function(e){return this.toCollection().limit(e)},Be.prototype.each=function(e){return this.toCollection().each(e)},Be.prototype.toArray=function(e){return this.toCollection().toArray(e)},Be.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Be.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,m(e)?"[".concat(e.join("+"),"]"):e))},Be.prototype.reverse=function(){return this.toCollection().reverse()},Be.prototype.mapToClass=function(e){for(var r=this.db,o=this.name,a=((this.schema.mappedClass=e).prototype instanceof Wo&&(e=(d=>{var p=x,w=d;if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function O(){this.constructor=p}function x(){return d!==null&&d.apply(this,arguments)||this}return i(p,w),p.prototype=w===null?Object.create(w):(O.prototype=w.prototype,new O),Object.defineProperty(x.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),x.prototype.table=function(){return o},x})(e)),new Set),u=e.prototype;u;u=_(u))Object.getOwnPropertyNames(u).forEach(function(d){return a.add(d)});function l(d){if(!d)return d;var p,w=Object.create(e.prototype);for(p in d)if(!a.has(p))try{w[p]=d[p]}catch{}return w}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=l,this.hook("reading",l),e},Be.prototype.defineClass=function(){return this.mapToClass(function(e){T(this,e)})},Be.prototype.add=function(e,r){var o=this,a=this.schema.primKey,u=a.auto,l=a.keyPath,d=e;return l&&u&&(d=Lr(l)(e)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"add",keys:r!=null?[r]:null,values:[d]})}).then(function(p){return p.numFailures?Z.reject(p.failures[0]):p.lastResult}).then(function(p){if(l)try{pe(e,l,p)}catch{}return p})},Be.prototype.upsert=function(e,r){var o=this,a=this.schema.primKey.keyPath;return this._trans("readwrite",function(u){return o.core.get({trans:u,key:e}).then(function(l){var d=l??{};return Ho(d,r),a&&pe(d,a,e),o.core.mutate({trans:u,type:"put",values:[d],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[r]}}).then(function(p){return p.numFailures?Z.reject(p.failures[0]):!!l})})})},Be.prototype.update=function(e,r){return typeof e!="object"||m(e)?this.where(":id").equals(e).modify(r):(e=ee(e,this.schema.primKey.keyPath))===void 0?Ue(new Y.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(r)},Be.prototype.put=function(e,r){var o=this,a=this.schema.primKey,u=a.auto,l=a.keyPath,d=e;return l&&u&&(d=Lr(l)(e)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"put",values:[d],keys:r!=null?[r]:null})}).then(function(p){return p.numFailures?Z.reject(p.failures[0]):p.lastResult}).then(function(p){if(l)try{pe(e,l,p)}catch{}return p})},Be.prototype.delete=function(e){var r=this;return this._trans("readwrite",function(o){return r.core.mutate({trans:o,type:"delete",keys:[e]}).then(function(a){return zr(r,[e],a)}).then(function(a){return a.numFailures?Z.reject(a.failures[0]):void 0})})},Be.prototype.clear=function(){var e=this;return this._trans("readwrite",function(r){return e.core.mutate({trans:r,type:"deleteRange",range:Vo}).then(function(o){return zr(e,null,o)})}).then(function(r){return r.numFailures?Z.reject(r.failures[0]):void 0})},Be.prototype.bulkGet=function(e){var r=this;return this._trans("readonly",function(o){return r.core.getMany({keys:e,trans:o}).then(function(a){return a.map(function(u){return r.hook.reading.fire(u)})})})},Be.prototype.bulkAdd=function(e,r,o){var a=this,u=Array.isArray(r)?r:void 0,l=(o=o||(u?void 0:r))?o.allKeys:void 0;return this._trans("readwrite",function(d){var p=a.schema.primKey,O=p.auto,p=p.keyPath;if(p&&u)throw new Y.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(u&&u.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var w=e.length,O=p&&O?e.map(Lr(p)):e;return a.core.mutate({trans:d,type:"add",keys:u,values:O,wantResults:l}).then(function(x){var v=x.numFailures,C=x.failures;if(v===0)return l?x.results:x.lastResult;throw new me("".concat(a.name,".bulkAdd(): ").concat(v," of ").concat(w," operations failed"),C)})})},Be.prototype.bulkPut=function(e,r,o){var a=this,u=Array.isArray(r)?r:void 0,l=(o=o||(u?void 0:r))?o.allKeys:void 0;return this._trans("readwrite",function(d){var p=a.schema.primKey,O=p.auto,p=p.keyPath;if(p&&u)throw new Y.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(u&&u.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var w=e.length,O=p&&O?e.map(Lr(p)):e;return a.core.mutate({trans:d,type:"put",keys:u,values:O,wantResults:l}).then(function(x){var v=x.numFailures,C=x.failures;if(v===0)return l?x.results:x.lastResult;throw new me("".concat(a.name,".bulkPut(): ").concat(v," of ").concat(w," operations failed"),C)})})},Be.prototype.bulkUpdate=function(e){var r=this,o=this.core,a=e.map(function(d){return d.key}),u=e.map(function(d){return d.changes}),l=[];return this._trans("readwrite",function(d){return o.getMany({trans:d,keys:a,cache:"clone"}).then(function(p){var w=[],O=[],x=(e.forEach(function(v,C){var E=v.key,S=v.changes,b=p[C];if(b){for(var P=0,j=Object.keys(S);P<j.length;P++){var k=j[P],D=S[k];if(k===r.schema.primKey.keyPath){if(Se(D,E)!==0)throw new Y.Constraint("Cannot update primary key in bulkUpdate()")}else pe(b,k,D)}l.push(C),w.push(E),O.push(b)}}),w.length);return o.mutate({trans:d,type:"put",keys:w,values:O,updates:{keys:a,changeSpecs:u}}).then(function(v){var C=v.numFailures,E=v.failures;if(C===0)return x;for(var S=0,b=Object.keys(E);S<b.length;S++){var P,j=b[S],k=l[Number(j)];k!=null&&(P=E[j],delete E[j],E[k]=P)}throw new me("".concat(r.name,".bulkUpdate(): ").concat(C," of ").concat(x," operations failed"),E)})})})},Be.prototype.bulkDelete=function(e){var r=this,o=e.length;return this._trans("readwrite",function(a){return r.core.mutate({trans:a,type:"delete",keys:e}).then(function(u){return zr(r,e,u)})}).then(function(a){var u=a.numFailures,l=a.failures;if(u===0)return a.lastResult;throw new me("".concat(r.name,".bulkDelete(): ").concat(u," of ").concat(o," operations failed"),l)})};var Qo=Be;function Be(){}function vr(e){function r(d,p){if(p){for(var w=arguments.length,O=new Array(w-1);--w;)O[w-1]=arguments[w];return o[d].subscribe.apply(null,O),e}if(typeof d=="string")return o[d]}var o={};r.addEventType=l;for(var a=1,u=arguments.length;a<u;++a)l(arguments[a]);return r;function l(d,p,w){var O,x;if(typeof d!="object")return p=p||Va,x={subscribers:[],fire:w=w||q,subscribe:function(v){x.subscribers.indexOf(v)===-1&&(x.subscribers.push(v),x.fire=p(x.fire,v))},unsubscribe:function(v){x.subscribers=x.subscribers.filter(function(C){return C!==v}),x.fire=x.subscribers.reduce(p,w)}},o[d]=r[d]=x;h(O=d).forEach(function(v){var C=O[v];if(m(C))l(v,O[v][0],O[v][1]);else{if(C!=="asap")throw new Y.InvalidArgument("Invalid event config");var E=l(v,Ze,function(){for(var S=arguments.length,b=new Array(S);S--;)b[S]=arguments[S];E.subscribers.forEach(function(P){F(function(){P.apply(null,b)})})})}})}}function br(e,r){return g(r).from({prototype:e}),r}function er(e,r){return!(e.filter||e.algorithm||e.or)&&(r?e.justLimit:!e.replayFilter)}function qn(e,r){e.filter=Ft(e.filter,r)}function Ln(e,r,o){var a=e.replayFilter;e.replayFilter=a?function(){return Ft(a(),r())}:r,e.justLimit=o&&!a}function Vr(e,r){if(e.isPrimKey)return r.primaryKey;var o=r.getIndexByKeyPath(e.index);if(o)return o;throw new Y.Schema("KeyPath "+e.index+" on object store "+r.name+" is not indexed")}function Xo(e,r,o){var a=Vr(e,r.schema);return r.openCursor({trans:o,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:a,range:e.range}})}function Wr(e,r,o,a){var u,l,d=e.replayFilter?Ft(e.filter,e.replayFilter()):e.filter;return e.or?(u={},l=function(p,w,O){var x,v;d&&!d(w,O,function(C){return w.stop(C)},function(C){return w.fail(C)})||((v=""+(x=w.primaryKey))=="[object ArrayBuffer]"&&(v=""+new Uint8Array(x)),A(u,v))||(u[v]=!0,r(p,w,O))},Promise.all([e.or._iterate(l,o),Jo(Xo(e,a,o),e.algorithm,l,!e.keysOnly&&e.valueMapper)])):Jo(Xo(e,a,o),Ft(e.algorithm,d),r,!e.keysOnly&&e.valueMapper)}function Jo(e,r,o,a){var u=Me(a?function(l,d,p){return o(a(l),d,p)}:o);return e.then(function(l){if(l)return l.start(function(){var d=function(){return l.continue()};r&&!r(l,function(p){return d=p},function(p){l.stop(p),d=q},function(p){l.fail(p),d=q})||u(l.value,l,function(p){return d=p}),d()})})}Ce.prototype._read=function(e,r){var o=this._ctx;return o.error?o.table._trans(null,Ue.bind(null,o.error)):o.table._trans("readonly",e).then(r)},Ce.prototype._write=function(e){var r=this._ctx;return r.error?r.table._trans(null,Ue.bind(null,r.error)):r.table._trans("readwrite",e,"locked")},Ce.prototype._addAlgorithm=function(e){var r=this._ctx;r.algorithm=Ft(r.algorithm,e)},Ce.prototype._iterate=function(e,r){return Wr(this._ctx,e,r,this._ctx.table.core)},Ce.prototype.clone=function(e){var r=Object.create(this.constructor.prototype),o=Object.create(this._ctx);return e&&T(o,e),r._ctx=o,r},Ce.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ce.prototype.each=function(e){var r=this._ctx;return this._read(function(o){return Wr(r,e,o,r.table.core)})},Ce.prototype.count=function(e){var r=this;return this._read(function(o){var a,u=r._ctx,l=u.table.core;return er(u,!0)?l.count({trans:o,query:{index:Vr(u,l.schema),range:u.range}}).then(function(d){return Math.min(d,u.limit)}):(a=0,Wr(u,function(){return++a,!1},o,l).then(function(){return a}))}).then(e)},Ce.prototype.sortBy=function(e,r){var o=e.split(".").reverse(),a=o[0],u=o.length-1;function l(w,O){return O?l(w[o[O]],O-1):w[a]}var d=this._ctx.dir==="next"?1:-1;function p(w,O){return Se(l(w,u),l(O,u))*d}return this.toArray(function(w){return w.sort(p)}).then(r)},Ce.prototype.toArray=function(e){var r=this;return this._read(function(o){var a,u,l,d=r._ctx;return d.dir==="next"&&er(d,!0)&&0<d.limit?(a=d.valueMapper,u=Vr(d,d.table.core.schema),d.table.core.query({trans:o,limit:d.limit,values:!0,query:{index:u,range:d.range}}).then(function(p){return p=p.result,a?p.map(a):p})):(l=[],Wr(d,function(p){return l.push(p)},o,d.table.core).then(function(){return l}))},e)},Ce.prototype.offset=function(e){var r=this._ctx;return e<=0||(r.offset+=e,er(r)?Ln(r,function(){var o=e;return function(a,u){return o===0||(o===1?--o:u(function(){a.advance(o),o=0}),!1)}}):Ln(r,function(){var o=e;return function(){return--o<0}})),this},Ce.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Ln(this._ctx,function(){var r=e;return function(o,a,u){return--r<=0&&a(u),0<=r}},!0),this},Ce.prototype.until=function(e,r){return qn(this._ctx,function(o,a,u){return!e(o.value)||(a(u),r)}),this},Ce.prototype.first=function(e){return this.limit(1).toArray(function(r){return r[0]}).then(e)},Ce.prototype.last=function(e){return this.reverse().first(e)},Ce.prototype.filter=function(e){var r;return qn(this._ctx,function(o){return e(o.value)}),(r=this._ctx).isMatch=Ft(r.isMatch,e),this},Ce.prototype.and=function(e){return this.filter(e)},Ce.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Ce.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ce.prototype.desc=function(){return this.reverse()},Ce.prototype.eachKey=function(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(o,a){e(a.key,a)})},Ce.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Ce.prototype.eachPrimaryKey=function(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(o,a){e(a.primaryKey,a)})},Ce.prototype.keys=function(e){var r=this._ctx,o=(r.keysOnly=!r.isMatch,[]);return this.each(function(a,u){o.push(u.key)}).then(function(){return o}).then(e)},Ce.prototype.primaryKeys=function(e){var r=this._ctx;if(r.dir==="next"&&er(r,!0)&&0<r.limit)return this._read(function(a){var u=Vr(r,r.table.core.schema);return r.table.core.query({trans:a,values:!1,limit:r.limit,query:{index:u,range:r.range}})}).then(function(a){return a.result}).then(e);r.keysOnly=!r.isMatch;var o=[];return this.each(function(a,u){o.push(u.primaryKey)}).then(function(){return o}).then(e)},Ce.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Ce.prototype.firstKey=function(e){return this.limit(1).keys(function(r){return r[0]}).then(e)},Ce.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Ce.prototype.distinct=function(){var e,r=this._ctx,r=r.index&&r.table.schema.idxByName[r.index];return r&&r.multi&&(e={},qn(this._ctx,function(a){var a=a.primaryKey.toString(),u=A(e,a);return e[a]=!0,!u})),this},Ce.prototype.modify=function(e){var r=this,o=this._ctx;return this._write(function(a){function u(b,P){var j=P.failures;C+=b-P.numFailures;for(var k=0,D=h(j);k<D.length;k++){var N=D[k];v.push(j[N])}}var l=typeof e=="function"?e:function(b){return Ho(b,e)},d=o.table.core,x=d.schema.primaryKey,p=x.outbound,w=x.extractKey,O=200,x=r.db._options.modifyChunkSize,v=(x&&(O=typeof x=="object"?x[d.name]||x["*"]||200:x),[]),C=0,E=[],S=e===Zo;return r.clone().primaryKeys().then(function(b){function P(k){var D=Math.min(O,b.length-k),N=b.slice(k,k+D);return(S?Promise.resolve([]):d.getMany({trans:a,keys:N,cache:"immutable"})).then(function(H){var Q=[],L=[],ne=p?[]:null,te=S?N:[];if(!S)for(var U=0;U<D;++U){var ie=H[U],_e={value:re(ie),primKey:b[k+U]};l.call(_e,_e.value,_e)!==!1&&(_e.value==null?te.push(b[k+U]):p||Se(w(ie),w(_e.value))===0?(L.push(_e.value),p&&ne.push(b[k+U])):(te.push(b[k+U]),Q.push(_e.value)))}return Promise.resolve(0<Q.length&&d.mutate({trans:a,type:"add",values:Q}).then(function(Ee){for(var le in Ee.failures)te.splice(parseInt(le),1);u(Q.length,Ee)})).then(function(){return(0<L.length||j&&typeof e=="object")&&d.mutate({trans:a,type:"put",keys:ne,values:L,criteria:j,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<k}).then(function(Ee){return u(L.length,Ee)})}).then(function(){return(0<te.length||j&&S)&&d.mutate({trans:a,type:"delete",keys:te,criteria:j,isAdditionalChunk:0<k}).then(function(Ee){return zr(o.table,te,Ee)}).then(function(Ee){return u(te.length,Ee)})}).then(function(){return b.length>k+D&&P(k+O)})})}var j=er(o)&&o.limit===1/0&&(typeof e!="function"||S)&&{index:o.index,range:o.range};return P(0).then(function(){if(0<v.length)throw new ge("Error modifying one or more objects",v,C,E);return b.length})})})},Ce.prototype.delete=function(){var e=this._ctx,r=e.range;return!er(e)||e.table.schema.yProps||!e.isPrimKey&&r.type!==3?this.modify(Zo):this._write(function(o){var a=e.table.core.schema.primaryKey,u=r;return e.table.core.count({trans:o,query:{index:a,range:u}}).then(function(l){return e.table.core.mutate({trans:o,type:"deleteRange",range:u}).then(function(w){var p=w.failures,w=w.numFailures;if(w)throw new ge("Could not delete some values",Object.keys(p).map(function(O){return p[O]}),l-w);return l-w})})})};var Qa=Ce;function Ce(){}var Zo=function(e,r){return r.value=null};function Xa(e,r){return e<r?-1:e===r?0:1}function Ja(e,r){return r<e?-1:e===r?0:1}function ot(e,r,o){return e=e instanceof ti?new e.Collection(e):e,e._ctx.error=new(o||TypeError)(r),e}function tr(e){return new e.Collection(e,function(){return ei("")}).limit(0)}function Ur(E,r,o,a){var u,l,d,p,w,O,x,v=o.length;if(!o.every(function(b){return typeof b=="string"}))return ot(E,zo);function C(b){u=b==="next"?function(j){return j.toUpperCase()}:function(j){return j.toLowerCase()},l=b==="next"?function(j){return j.toLowerCase()}:function(j){return j.toUpperCase()},d=b==="next"?Xa:Ja;var P=o.map(function(j){return{lower:l(j),upper:u(j)}}).sort(function(j,k){return d(j.lower,k.lower)});p=P.map(function(j){return j.upper}),w=P.map(function(j){return j.lower}),x=(O=b)==="next"?"":a}C("next");var E=new E.Collection(E,function(){return kt(p[0],w[v-1]+a)}),S=(E._ondirectionchange=function(b){C(b)},0);return E._addAlgorithm(function(b,P,j){var k=b.key;if(typeof k=="string"){var D=l(k);if(r(D,w,S))return!0;for(var N=null,H=S;H<v;++H){var Q=((L,ne,te,U,ie,_e)=>{for(var Ee=Math.min(L.length,U.length),le=-1,ve=0;ve<Ee;++ve){var Fe=ne[ve];if(Fe!==U[ve])return ie(L[ve],te[ve])<0?L.substr(0,ve)+te[ve]+te.substr(ve+1):ie(L[ve],U[ve])<0?L.substr(0,ve)+U[ve]+te.substr(ve+1):0<=le?L.substr(0,le)+ne[le]+te.substr(le+1):null;ie(L[ve],Fe)<0&&(le=ve)}return Ee<U.length&&_e==="next"?L+te.substr(L.length):Ee<L.length&&_e==="prev"?L.substr(0,te.length):le<0?null:L.substr(0,le)+U[le]+te.substr(le+1)})(k,D,p[H],w[H],d,O);Q===null&&N===null?S=H+1:(N===null||0<d(N,Q))&&(N=Q)}P(N!==null?function(){b.continue(N+x)}:j)}return!1}),E}function kt(e,r,o,a){return{type:2,lower:e,upper:r,lowerOpen:o,upperOpen:a}}function ei(e){return{type:1,lower:e,upper:e}}Object.defineProperty(Qe.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Qe.prototype.between=function(e,r,o,a){o=o!==!1,a=a===!0;try{return 0<this._cmp(e,r)||this._cmp(e,r)===0&&(o||a)&&(!o||!a)?tr(this):new this.Collection(this,function(){return kt(e,r,!o,!a)})}catch{return ot(this,yt)}},Qe.prototype.equals=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return ei(e)})},Qe.prototype.above=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return kt(e,void 0,!0)})},Qe.prototype.aboveOrEqual=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return kt(e,void 0,!1)})},Qe.prototype.below=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return kt(void 0,e,!1,!0)})},Qe.prototype.belowOrEqual=function(e){return e==null?ot(this,yt):new this.Collection(this,function(){return kt(void 0,e)})},Qe.prototype.startsWith=function(e){return typeof e!="string"?ot(this,zo):this.between(e,e+Kt,!0,!0)},Qe.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):Ur(this,function(r,o){return r.indexOf(o[0])===0},[e],Kt)},Qe.prototype.equalsIgnoreCase=function(e){return Ur(this,function(r,o){return r===o[0]},[e],"")},Qe.prototype.anyOfIgnoreCase=function(){var e=z.apply(rt,arguments);return e.length===0?tr(this):Ur(this,function(r,o){return o.indexOf(r)!==-1},e,"")},Qe.prototype.startsWithAnyOfIgnoreCase=function(){var e=z.apply(rt,arguments);return e.length===0?tr(this):Ur(this,function(r,o){return o.some(function(a){return r.indexOf(a)===0})},e,Kt)},Qe.prototype.anyOf=function(){var e,r,o=this,a=z.apply(rt,arguments),u=this._cmp;try{a.sort(u)}catch{return ot(this,yt)}return a.length===0?tr(this):((e=new this.Collection(this,function(){return kt(a[0],a[a.length-1])}))._ondirectionchange=function(l){u=l==="next"?o._ascending:o._descending,a.sort(u)},r=0,e._addAlgorithm(function(l,d,p){for(var w=l.key;0<u(w,a[r]);)if(++r===a.length)return d(p),!1;return u(w,a[r])===0||(d(function(){l.continue(a[r])}),!1)}),e)},Qe.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Qe.prototype.noneOf=function(){var e=z.apply(rt,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return ot(this,yt)}var r=e.reduce(function(o,a){return o?o.concat([[o[o.length-1][1],a]]):[[-1/0,a]]},null);return r.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})},Qe.prototype.inAnyRange=function(e,j){var o=this,a=this._cmp,u=this._ascending,l=this._descending,d=this._min,p=this._max;if(e.length===0)return tr(this);if(!e.every(function(k){return k[0]!==void 0&&k[1]!==void 0&&u(k[0],k[1])<=0}))return ot(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Y.InvalidArgument);var w=!j||j.includeLowers!==!1,O=j&&j.includeUppers===!0,x,v=u;function C(k,D){return v(k[0],D[0])}try{(x=e.reduce(function(k,D){for(var N=0,H=k.length;N<H;++N){var Q=k[N];if(a(D[0],Q[1])<0&&0<a(D[1],Q[0])){Q[0]=d(Q[0],D[0]),Q[1]=p(Q[1],D[1]);break}}return N===H&&k.push(D),k},[])).sort(C)}catch{return ot(this,yt)}var E=0,S=O?function(k){return 0<u(k,x[E][1])}:function(k){return 0<=u(k,x[E][1])},b=w?function(k){return 0<l(k,x[E][0])}:function(k){return 0<=l(k,x[E][0])},P=S,j=new this.Collection(this,function(){return kt(x[0][0],x[x.length-1][1],!w,!O)});return j._ondirectionchange=function(k){v=k==="next"?(P=S,u):(P=b,l),x.sort(C)},j._addAlgorithm(function(k,D,N){for(var H,Q=k.key;P(Q);)if(++E===x.length)return D(N),!1;return!S(H=Q)&&!b(H)||(o._cmp(Q,x[E][1])===0||o._cmp(Q,x[E][0])===0||D(function(){v===u?k.continue(x[E][0]):k.continue(x[E][1])}),!1)}),j},Qe.prototype.startsWithAnyOf=function(){var e=z.apply(rt,arguments);return e.every(function(r){return typeof r=="string"})?e.length===0?tr(this):this.inAnyRange(e.map(function(r){return[r,r+Kt]})):ot(this,"startsWithAnyOf() only works with strings")};var ti=Qe;function Qe(){}function pt(e){return Me(function(r){return wr(r),e(r.target.error),!1})}function wr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var xr="storagemutated",zn="x-storagemutated-1",Ot=vr(null,xr),Za=(ht.prototype._lock=function(){return W(!se.global),++this._reculock,this._reculock!==1||se.global||(se.lockOwnerFor=this),this},ht.prototype._unlock=function(){if(W(!se.global),--this._reculock==0)for(se.global||(se.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Nt(e[1],e[0])}catch{}}return this},ht.prototype._locked=function(){return this._reculock&&se.lockOwnerFor!==this},ht.prototype.create=function(e){var r=this;if(this.mode){var o=this.db.idbdb,a=this.db._state.dbOpenError;if(W(!this.idbtrans),!e&&!o)switch(a&&a.name){case"DatabaseClosedError":throw new Y.DatabaseClosed(a);case"MissingAPIError":throw new Y.MissingAPI(a.message,a);default:throw new Y.OpenFailed(a)}if(!this.active)throw new Y.TransactionInactive;W(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||o).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Me(function(u){wr(u),r._reject(e.error)}),e.onabort=Me(function(u){wr(u),r.active&&r._reject(new Y.Abort(e.error)),r.active=!1,r.on("abort").fire(u)}),e.oncomplete=Me(function(){r.active=!1,r._resolve(),"mutatedParts"in e&&Ot.storagemutated.fire(e.mutatedParts)})}return this},ht.prototype._promise=function(e,r,o){var a,u=this;return e==="readwrite"&&this.mode!=="readwrite"?Ue(new Y.ReadOnly("Transaction is readonly")):this.active?this._locked()?new Z(function(l,d){u._blockedFuncs.push([function(){u._promise(e,r,o).then(l,d)},se])}):o?Ct(function(){var l=new Z(function(d,p){u._lock();var w=r(d,p,u);w&&w.then&&w.then(d,p)});return l.finally(function(){return u._unlock()}),l._lib=!0,l}):((a=new Z(function(l,d){var p=r(l,d,u);p&&p.then&&p.then(l,d)}))._lib=!0,a):Ue(new Y.TransactionInactive)},ht.prototype._root=function(){return this.parent?this.parent._root():this},ht.prototype.waitFor=function(e){var r,o=this._root(),a=Z.resolve(e),u=(o._waitingFor?o._waitingFor=o._waitingFor.then(function(){return a}):(o._waitingFor=a,o._waitingQueue=[],r=o.idbtrans.objectStore(o.storeNames[0]),(function l(){for(++o._spinCount;o._waitingQueue.length;)o._waitingQueue.shift()();o._waitingFor&&(r.get(-1/0).onsuccess=l)})()),o._waitingFor);return new Z(function(l,d){a.then(function(p){return o._waitingQueue.push(Me(l.bind(null,p)))},function(p){return o._waitingQueue.push(Me(d.bind(null,p)))}).finally(function(){o._waitingFor===u&&(o._waitingFor=null)})})},ht.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new Y.Abort))},ht.prototype.table=function(e){var r=this._memoizedTables||(this._memoizedTables={});if(A(r,e))return r[e];var o=this.schema[e];if(o)return(o=new this.db.Table(e,o,this)).core=this.db.core.table(e),r[e]=o;throw new Y.NotFound("Table "+e+" not part of transaction")},ht);function ht(){}function Vn(e,r,o,a,u,l,d,p){return{name:e,keyPath:r,unique:o,multi:a,auto:u,compound:l,src:(o&&!d?"&":"")+(a?"*":"")+(u?"++":"")+ri(r),type:p}}function ri(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Wn(e,r,o){return{name:e,primKey:r,indexes:o,mappedClass:null,idxByName:(a=function(u){return[u.name,u]},o.reduce(function(u,l,d){return l=a(l,d),l&&(u[l[0]]=l[1]),u},{}))};var a}var Sr=function(e){try{return e.only([[]]),Sr=function(){return[[]]},[[]]}catch{return Sr=function(){return Kt},Kt}};function Un(e){return e==null?function(){}:typeof e=="string"?(r=e).split(".").length===1?function(o){return o[r]}:function(o){return ee(o,r)}:function(o){return ee(o,e)};var r}function ni(e){return[].slice.call(e)}var es=0;function _r(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function ts(e,r,w){function a(S){if(S.type===3)return null;if(S.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var v=S.lower,C=S.upper,E=S.lowerOpen,S=S.upperOpen;return v===void 0?C===void 0?null:r.upperBound(C,!!S):C===void 0?r.lowerBound(v,!!E):r.bound(v,C,!!E,!!S)}function u(x){var v,C=x.name;return{name:C,schema:x,mutate:function(E){var S=E.trans,b=E.type,P=E.keys,j=E.values,k=E.range;return new Promise(function(D,N){D=Me(D);var H=S.objectStore(C),Q=H.keyPath==null,L=b==="put"||b==="add";if(!L&&b!=="delete"&&b!=="deleteRange")throw new Error("Invalid operation type: "+b);var ne,te=(P||j||{length:1}).length;if(P&&j&&P.length!==j.length)throw new Error("Given keys array must have same length as given values array.");if(te===0)return D({numFailures:0,failures:{},results:[],lastResult:void 0});function U(ze){++Ee,wr(ze)}var ie=[],_e=[],Ee=0;if(b==="deleteRange"){if(k.type===4)return D({numFailures:Ee,failures:_e,results:[],lastResult:void 0});k.type===3?ie.push(ne=H.clear()):ie.push(ne=H.delete(a(k)))}else{var Q=L?Q?[j,P]:[j,null]:[P,null],le=Q[0],ve=Q[1];if(L)for(var Fe=0;Fe<te;++Fe)ie.push(ne=ve&&ve[Fe]!==void 0?H[b](le[Fe],ve[Fe]):H[b](le[Fe])),ne.onerror=U;else for(Fe=0;Fe<te;++Fe)ie.push(ne=H[b](le[Fe])),ne.onerror=U}function st(ze){ze=ze.target.result,ie.forEach(function(zt,lo){return zt.error!=null&&(_e[lo]=zt.error)}),D({numFailures:Ee,failures:_e,results:b==="delete"?P:ie.map(function(zt){return zt.result}),lastResult:ze})}ne.onerror=function(ze){U(ze),st(ze)},ne.onsuccess=st})},getMany:function(E){var S=E.trans,b=E.keys;return new Promise(function(P,j){P=Me(P);for(var k,D=S.objectStore(C),N=b.length,H=new Array(N),Q=0,L=0,ne=function(ie){ie=ie.target,H[ie._pos]=ie.result,++L===Q&&P(H)},te=pt(j),U=0;U<N;++U)b[U]!=null&&((k=D.get(b[U]))._pos=U,k.onsuccess=ne,k.onerror=te,++Q);Q===0&&P(H)})},get:function(E){var S=E.trans,b=E.key;return new Promise(function(P,j){P=Me(P);var k=S.objectStore(C).get(b);k.onsuccess=function(D){return P(D.target.result)},k.onerror=pt(j)})},query:(v=p,function(E){return new Promise(function(S,b){S=Me(S);var P,j,k,L=E.trans,D=E.values,N=E.limit,Q=E.query,H=N===1/0?void 0:N,ne=Q.index,Q=Q.range,L=L.objectStore(C),L=ne.isPrimaryKey?L:L.index(ne.name),ne=a(Q);if(N===0)return S({result:[]});v?((Q=D?L.getAll(ne,H):L.getAllKeys(ne,H)).onsuccess=function(te){return S({result:te.target.result})},Q.onerror=pt(b)):(P=0,j=!D&&"openKeyCursor"in L?L.openKeyCursor(ne):L.openCursor(ne),k=[],j.onsuccess=function(te){var U=j.result;return!U||(k.push(D?U.value:U.primaryKey),++P===N)?S({result:k}):void U.continue()},j.onerror=pt(b))})}),openCursor:function(E){var S=E.trans,b=E.values,P=E.query,j=E.reverse,k=E.unique;return new Promise(function(D,N){D=Me(D);var L=P.index,H=P.range,Q=S.objectStore(C),Q=L.isPrimaryKey?Q:Q.index(L.name),L=j?k?"prevunique":"prev":k?"nextunique":"next",ne=!b&&"openKeyCursor"in Q?Q.openKeyCursor(a(H),L):Q.openCursor(a(H),L);ne.onerror=pt(N),ne.onsuccess=Me(function(te){var U,ie,_e,Ee,le=ne.result;le?(le.___id=++es,le.done=!1,U=le.continue.bind(le),ie=(ie=le.continuePrimaryKey)&&ie.bind(le),_e=le.advance.bind(le),Ee=function(){throw new Error("Cursor not stopped")},le.trans=S,le.stop=le.continue=le.continuePrimaryKey=le.advance=function(){throw new Error("Cursor not started")},le.fail=Me(N),le.next=function(){var ve=this,Fe=1;return this.start(function(){return Fe--?ve.continue():ve.stop()}).then(function(){return ve})},le.start=function(ve){function Fe(){if(ne.result)try{ve()}catch(ze){le.fail(ze)}else le.done=!0,le.start=function(){throw new Error("Cursor behind last entry")},le.stop()}var st=new Promise(function(ze,zt){ze=Me(ze),ne.onerror=pt(zt),le.fail=zt,le.stop=function(lo){le.stop=le.continue=le.continuePrimaryKey=le.advance=Ee,ze(lo)}});return ne.onsuccess=Me(function(ze){ne.onsuccess=Fe,Fe()}),le.continue=U,le.continuePrimaryKey=ie,le.advance=_e,Fe(),st},D(le)):D(null)},N)})},count:function(E){var S=E.query,b=E.trans,P=S.index,j=S.range;return new Promise(function(k,D){var N=b.objectStore(C),N=P.isPrimaryKey?N:N.index(P.name),H=a(j),H=H?N.count(H):N.count();H.onsuccess=Me(function(Q){return k(Q.target.result)}),H.onerror=pt(D)})}}}l=w,d=ni((w=e).objectStoreNames);var l,w={schema:{name:w.name,tables:d.map(function(x){return l.objectStore(x)}).map(function(x){var v=x.keyPath,C=x.autoIncrement,S=m(v),E={},S={name:x.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:v==null,compound:S,keyPath:v,autoIncrement:C,unique:!0,extractKey:Un(v)},indexes:ni(x.indexNames).map(function(b){return x.index(b)}).map(function(k){var D=k.name,P=k.unique,j=k.multiEntry,k=k.keyPath,D={name:D,compound:m(k),keyPath:k,unique:P,multiEntry:j,extractKey:Un(k)};return E[_r(k)]=D}),getIndexByKeyPath:function(b){return E[_r(b)]}};return E[":id"]=S.primaryKey,v!=null&&(E[_r(v)]=S.primaryKey),S})},hasGetAll:0<d.length&&"getAll"in l.objectStore(d[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)},d=w.schema,p=w.hasGetAll,w=d.tables.map(u),O={};return w.forEach(function(x){return O[x.name]=x}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(x){if(O[x])return O[x];throw new Error("Table '".concat(x,"' not found"))},MIN_KEY:-1/0,MAX_KEY:Sr(r),schema:d}}function rs(e,r,o,a){return o=o.IDBKeyRange,r=ts(r,o,a),{dbcore:e.dbcore.reduce(function(u,l){return l=l.create,s(s({},u),l(u))},r)}}function Yr(e,r){var o=r.db,o=rs(e._middlewares,o,e._deps,r);e.core=o.dbcore,e.tables.forEach(function(a){var u=a.name;e.core.schema.tables.some(function(l){return l.name===u})&&(a.core=e.core.table(u),e[u]instanceof e.Table)&&(e[u].core=a.core)})}function Gr(e,r,o,a){o.forEach(function(u){var l=a[u];r.forEach(function(d){var p=(function w(O,x){return V(O,x)||(O=_(O))&&w(O,x)})(d,u);(!p||"value"in p&&p.value===void 0)&&(d===e.Transaction.prototype||d instanceof e.Transaction?M(d,u,{get:function(){return this.table(u)},set:function(w){K(this,u,{value:w,writable:!0,configurable:!0,enumerable:!0})}}):d[u]=new e.Table(u,l))})})}function Yn(e,r){r.forEach(function(o){for(var a in o)o[a]instanceof e.Table&&delete o[a]})}function ns(e,r){return e._cfg.version-r._cfg.version}function os(e,r,o,a){var u=e._dbSchema,l=(o.objectStoreNames.contains("$meta")&&!u.$meta&&(u.$meta=Wn("$meta",ii("")[0],[]),e._storeNames.push("$meta")),e._createTransaction("readwrite",e._storeNames,u)),d=(l.create(o),l._completion.catch(a),l._reject.bind(l)),p=se.transless||se;Ct(function(){if(se.trans=l,se.transless=p,r!==0)return Yr(e,o),O=r,((w=l).storeNames.includes("$meta")?w.table("$meta").get("version").then(function(x){return x??O}):Z.resolve(O)).then(function(P){var v=e,C=P,E=l,S=o,b=[],P=v._versions,j=v._dbSchema=Qr(0,v.idbdb,S);return(P=P.filter(function(k){return k._cfg.version>=C})).length===0?Z.resolve():(P.forEach(function(k){b.push(function(){var D,N,H,Q=j,L=k._cfg.dbschema,ne=(Xr(v,Q,S),Xr(v,L,S),j=v._dbSchema=L,Gn(Q,L)),te=(ne.add.forEach(function(U){Hn(S,U[0],U[1].primKey,U[1].indexes)}),ne.change.forEach(function(U){if(U.recreate)throw new Y.Upgrade("Not yet support for changing primary key");var ie=S.objectStore(U.name);U.add.forEach(function(_e){return Hr(ie,_e)}),U.change.forEach(function(_e){ie.deleteIndex(_e.name),Hr(ie,_e)}),U.del.forEach(function(_e){return ie.deleteIndex(_e)})}),k._cfg.contentUpgrade);if(te&&k._cfg.version>C)return Yr(v,S),E._memoizedTables={},D=Pe(L),ne.del.forEach(function(U){D[U]=Q[U]}),Yn(v,[v.Transaction.prototype]),Gr(v,[v.Transaction.prototype],h(D),D),E.schema=D,(N=oe(te))&&Jt(),L=Z.follow(function(){var U;(H=te(E))&&N&&(U=Et.bind(null,null),H.then(U,U))}),H&&typeof H.then=="function"?Z.resolve(H):L.then(function(){return H})}),b.push(function(D){var N,H,Q=k._cfg.dbschema;N=Q,H=D,[].slice.call(H.db.objectStoreNames).forEach(function(L){return N[L]==null&&H.db.deleteObjectStore(L)}),Yn(v,[v.Transaction.prototype]),Gr(v,[v.Transaction.prototype],v._storeNames,v._dbSchema),E.schema=v._dbSchema}),b.push(function(D){v.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(v.idbdb.version/10)===k._cfg.version?(v.idbdb.deleteObjectStore("$meta"),delete v._dbSchema.$meta,v._storeNames=v._storeNames.filter(function(N){return N!=="$meta"})):D.objectStore("$meta").put(k._cfg.version,"version"))})}),(function k(){return b.length?Z.resolve(b.shift()(E.idbtrans)).then(k):Z.resolve()})().then(function(){oi(j,S)}))}).catch(d);var w,O;h(u).forEach(function(x){Hn(o,x,u[x].primKey,u[x].indexes)}),Yr(e,o),Z.follow(function(){return e.on.populate.fire(l)}).catch(d)})}function is(e,r){oi(e._dbSchema,r),r.db.version%10!=0||r.objectStoreNames.contains("$meta")||r.db.createObjectStore("$meta").add(Math.ceil(r.db.version/10-1),"version");var o=Qr(0,e.idbdb,r);Xr(e,e._dbSchema,r);for(var a=0,u=Gn(o,e._dbSchema).change;a<u.length;a++){var l=(d=>{if(d.change.length||d.recreate)return console.warn("Unable to patch indexes of table ".concat(d.name," because it has changes on the type of index or primary key.")),{value:void 0};var p=r.objectStore(d.name);d.add.forEach(function(w){dt&&console.debug("Dexie upgrade patch: Creating missing index ".concat(d.name,".").concat(w.src)),Hr(p,w)})})(u[a]);if(typeof l=="object")return l.value}}function Gn(e,r){var o,a={del:[],add:[],change:[]};for(o in e)r[o]||a.del.push(o);for(o in r){var u=e[o],l=r[o];if(u){var d={name:o,def:l,recreate:!1,del:[],add:[],change:[]};if(""+(u.primKey.keyPath||"")!=""+(l.primKey.keyPath||"")||u.primKey.auto!==l.primKey.auto)d.recreate=!0,a.change.push(d);else{var p=u.idxByName,w=l.idxByName,O=void 0;for(O in p)w[O]||d.del.push(O);for(O in w){var x=p[O],v=w[O];x?x.src!==v.src&&d.change.push(v):d.add.push(v)}(0<d.del.length||0<d.add.length||0<d.change.length)&&a.change.push(d)}}else a.add.push([o,l])}return a}function Hn(e,r,o,a){var u=e.db.createObjectStore(r,o.keyPath?{keyPath:o.keyPath,autoIncrement:o.auto}:{autoIncrement:o.auto});a.forEach(function(l){return Hr(u,l)})}function oi(e,r){h(e).forEach(function(o){r.db.objectStoreNames.contains(o)||(dt&&console.debug("Dexie: Creating missing table",o),Hn(r,o,e[o].primKey,e[o].indexes))})}function Hr(e,r){e.createIndex(r.name,r.keyPath,{unique:r.unique,multiEntry:r.multi})}function Qr(e,r,o){var a={};return ae(r.objectStoreNames,0).forEach(function(u){for(var l=o.objectStore(u),d=Vn(ri(O=l.keyPath),O||"",!0,!1,!!l.autoIncrement,O&&typeof O!="string",!0),p=[],w=0;w<l.indexNames.length;++w){var x=l.index(l.indexNames[w]),O=x.keyPath,x=Vn(x.name,O,!!x.unique,!!x.multiEntry,!1,O&&typeof O!="string",!1);p.push(x)}a[u]=Wn(u,d,p)}),a}function Xr(e,r,o){for(var a=o.db.objectStoreNames,u=0;u<a.length;++u){var l=a[u],d=o.objectStore(l);e._hasGetAll="getAll"in d;for(var p=0;p<d.indexNames.length;++p){var w,O=d.indexNames[p],x=d.index(O).keyPath,x=typeof x=="string"?x:"["+ae(x).join("+")+"]";r[l]&&(w=r[l].idxByName[x])&&(w.name=O,delete r[l].idxByName[x],r[l].idxByName[O]=w)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&f.WorkerGlobalScope&&f instanceof f.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function ii(e){return e.split(",").map(function(r,o){var u=r.split(":"),a=(a=u[1])==null?void 0:a.trim(),u=(r=u[0].trim()).replace(/([&*]|\+\+)/g,""),l=/^\[/.test(u)?u.match(/^\[(.*)\]$/)[1].split("+"):u;return Vn(u,l||null,/\&/.test(r),/\*/.test(r),/\+\+/.test(r),m(l),o===0,a)})}rr.prototype._createTableSchema=Wn,rr.prototype._parseIndexSyntax=ii,rr.prototype._parseStoresSpec=function(e,r){var o=this;h(e).forEach(function(a){if(e[a]!==null){var u=o._parseIndexSyntax(e[a]),l=u.shift();if(!l)throw new Y.Schema("Invalid schema for table "+a+": "+e[a]);if(l.unique=!0,l.multi)throw new Y.Schema("Primary key cannot be multiEntry*");u.forEach(function(d){if(d.auto)throw new Y.Schema("Only primary key can be marked as autoIncrement (++)");if(!d.keyPath)throw new Y.Schema("Index must have a name and cannot be an empty string")}),l=o._createTableSchema(a,l,u),r[a]=l}})},rr.prototype.stores=function(o){var r=this.db,o=(this._cfg.storesSource=this._cfg.storesSource?T(this._cfg.storesSource,o):o,r._versions),a={},u={};return o.forEach(function(l){T(a,l._cfg.storesSource),u=l._cfg.dbschema={},l._parseStoresSpec(a,u)}),r._dbSchema=u,Yn(r,[r._allTables,r,r.Transaction.prototype]),Gr(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],h(u),u),r._storeNames=h(u),this},rr.prototype.upgrade=function(e){return this._cfg.contentUpgrade=Pn(this._cfg.contentUpgrade||q,e),this};var as=rr;function rr(){}function Qn(e,r){var o=e._dbNamesDB;return o||(o=e._dbNamesDB=new gt(qr,{addons:[],indexedDB:e,IDBKeyRange:r})).version(1).stores({dbnames:"name"}),o.table("dbnames")}function Xn(e){return e&&typeof e.databases=="function"}function Jn(e){return Ct(function(){return se.letThrough=!0,e()})}function Zn(e){return!("from"in e)}var et=function(e,r){var o;if(!this)return o=new et,e&&"d"in e&&T(o,e),o;T(this,arguments.length?{d:1,from:e,to:1<arguments.length?r:e}:{d:0})};function Cr(e,r,o){var a=Se(r,o);if(!isNaN(a)){if(0<a)throw RangeError();if(Zn(e))return T(e,{from:r,to:o,d:1});var a=e.l,u=e.r;if(Se(o,e.from)<0)return a?Cr(a,r,o):e.l={from:r,to:o,d:1,l:null,r:null},si(e);if(0<Se(r,e.to))return u?Cr(u,r,o):e.r={from:r,to:o,d:1,l:null,r:null},si(e);Se(r,e.from)<0&&(e.from=r,e.l=null,e.d=u?u.d+1:1),0<Se(o,e.to)&&(e.to=o,e.r=null,e.d=e.l?e.l.d+1:1),r=!e.r,a&&!e.l&&Er(e,a),u&&r&&Er(e,u)}}function Er(e,r){Zn(r)||(function o(a,u){var l=u.from,d=u.l,p=u.r;Cr(a,l,u.to),d&&o(a,d),p&&o(a,p)})(e,r)}function ai(e,r){var o=Jr(r),a=o.next();if(!a.done)for(var u=a.value,l=Jr(e),d=l.next(u.from),p=d.value;!a.done&&!d.done;){if(Se(p.from,u.to)<=0&&0<=Se(p.to,u.from))return!0;Se(u.from,p.from)<0?u=(a=o.next(p.from)).value:p=(d=l.next(u.from)).value}return!1}function Jr(e){var r=Zn(e)?null:{s:0,n:e};return{next:function(o){for(var a=0<arguments.length;r;)switch(r.s){case 0:if(r.s=1,a)for(;r.n.l&&Se(o,r.n.from)<0;)r={up:r,n:r.n.l,s:1};else for(;r.n.l;)r={up:r,n:r.n.l,s:1};case 1:if(r.s=2,!a||Se(o,r.n.to)<=0)return{value:r.n,done:!1};case 2:if(r.n.r){r.s=3,r={up:r,n:r.n.r,s:0};continue}case 3:r=r.up}return{done:!0}}}}function si(e){var r,o,a,u=(((u=e.r)==null?void 0:u.d)||0)-(((u=e.l)==null?void 0:u.d)||0),u=1<u?"r":u<-1?"l":"";u&&(r=u=="r"?"l":"r",o=s({},e),a=e[u],e.from=a.from,e.to=a.to,e[u]=a[u],o[u]=a[r],(e[r]=o).d=ui(o)),e.d=ui(e)}function ui(o){var r=o.r,o=o.l;return(r?o?Math.max(r.d,o.d):r.d:o?o.d:0)+1}function Zr(e,r){return h(r).forEach(function(o){e[o]?Er(e[o],r[o]):e[o]=(function a(u){var l,d,p={};for(l in u)A(u,l)&&(d=u[l],p[l]=!d||typeof d!="object"||Re.has(d.constructor)?d:a(d));return p})(r[o])}),e}function eo(e,r){return e.all||r.all||Object.keys(e).some(function(o){return r[o]&&ai(r[o],e[o])})}I(et.prototype,((nt={add:function(e){return Er(this,e),this},addKey:function(e){return Cr(this,e,e),this},addKeys:function(e){var r=this;return e.forEach(function(o){return Cr(r,o,o)}),this},hasKey:function(e){var r=Jr(this).next(e).value;return r&&Se(r.from,e)<=0&&0<=Se(r.to,e)}})[ye]=function(){return Jr(this)},nt));var qt={},to={},ro=!1;function en(e){Zr(to,e),ro||(ro=!0,setTimeout(function(){ro=!1,no(to,!(to={}))},0))}function no(e,r){r===void 0&&(r=!1);var o=new Set;if(e.all)for(var a=0,u=Object.values(qt);a<u.length;a++)ci(p=u[a],e,o,r);else for(var l in e){var d,p,l=/^idb\:\/\/(.*)\/(.*)\//.exec(l);l&&(d=l[1],l=l[2],p=qt["idb://".concat(d,"/").concat(l)])&&ci(p,e,o,r)}o.forEach(function(w){return w()})}function ci(e,r,o,a){for(var u=[],l=0,d=Object.entries(e.queries.query);l<d.length;l++){for(var p=d[l],w=p[0],O=[],x=0,v=p[1];x<v.length;x++){var C=v[x];eo(r,C.obsSet)?C.subscribers.forEach(function(P){return o.add(P)}):a&&O.push(C)}a&&u.push([w,O])}if(a)for(var E=0,S=u;E<S.length;E++){var b=S[E],w=b[0],O=b[1];e.queries.query[w]=O}}function ss(e){var r=e._state,o=e._deps.indexedDB;if(r.isBeingOpened||e.idbdb)return r.dbReadyPromise.then(function(){return r.dbOpenError?Ue(r.dbOpenError):e});r.isBeingOpened=!0,r.dbOpenError=null,r.openComplete=!1;var a=r.openCanceller,u=Math.round(10*e.verno),l=!1;function d(){if(r.openCanceller!==a)throw new Y.DatabaseClosed("db.open() was cancelled")}function p(){return new Z(function(C,E){if(d(),!o)throw new Y.MissingAPI;var S=e.name,b=r.autoSchema||!u?o.open(S):o.open(S,u);if(!b)throw new Y.MissingAPI;b.onerror=pt(E),b.onblocked=Me(e._fireOnBlocked),b.onupgradeneeded=Me(function(P){var j;x=b.transaction,r.autoSchema&&!e._options.allowEmptyDB?(b.onerror=wr,x.abort(),b.result.close(),(j=o.deleteDatabase(S)).onsuccess=j.onerror=Me(function(){E(new Y.NoSuchDatabase("Database ".concat(S," doesnt exist")))})):(x.onerror=pt(E),j=P.oldVersion>Math.pow(2,62)?0:P.oldVersion,v=j<1,e.idbdb=b.result,l&&is(e,x),os(e,j/10,x,E))},E),b.onsuccess=Me(function(){x=null;var P,j,k,D,N,H,Q=e.idbdb=b.result,L=ae(Q.objectStoreNames);if(0<L.length)try{var ne=Q.transaction((N=L).length===1?N[0]:N,"readonly");if(r.autoSchema)H=Q,D=ne,(k=e).verno=H.version/10,D=k._dbSchema=Qr(0,H,D),k._storeNames=ae(H.objectStoreNames,0),Gr(k,[k._allTables],h(D),D);else if(Xr(e,e._dbSchema,ne),j=ne,((j=Gn(Qr(0,(P=e).idbdb,j),P._dbSchema)).add.length||j.change.some(function(te){return te.add.length||te.change.length}))&&!l)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),Q.close(),u=Q.version+1,l=!0,C(p());Yr(e,ne)}catch{}Zt.push(e),Q.onversionchange=Me(function(te){r.vcFired=!0,e.on("versionchange").fire(te)}),Q.onclose=Me(function(){e.close({disableAutoOpen:!1})}),v&&(L=e._deps,N=S,Xn(H=L.indexedDB)||N===qr||Qn(H,L.IDBKeyRange).put({name:N}).catch(q)),C()},E)}).catch(function(C){switch(C==null?void 0:C.name){case"UnknownError":if(0<r.PR1398_maxLoop)return r.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),p();break;case"VersionError":if(0<u)return u=0,p()}return Z.reject(C)})}var w,O=r.dbReadyResolve,x=null,v=!1;return Z.race([a,(typeof navigator>"u"?Z.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(C){function E(){return indexedDB.databases().finally(C)}w=setInterval(E,100),E()}).finally(function(){return clearInterval(w)}):Promise.resolve()).then(p)]).then(function(){return d(),r.onReadyBeingFired=[],Z.resolve(Jn(function(){return e.on.ready.fire(e.vip)})).then(function C(){var E;if(0<r.onReadyBeingFired.length)return E=r.onReadyBeingFired.reduce(Pn,q),r.onReadyBeingFired=[],Z.resolve(Jn(function(){return E(e.vip)})).then(C)})}).finally(function(){r.openCanceller===a&&(r.onReadyBeingFired=null,r.isBeingOpened=!1)}).catch(function(C){r.dbOpenError=C;try{x&&x.abort()}catch{}return a===r.openCanceller&&e._close(),Ue(C)}).finally(function(){r.openComplete=!0,O()}).then(function(){var C;return v&&(C={},e.tables.forEach(function(E){E.schema.indexes.forEach(function(S){S.name&&(C["idb://".concat(e.name,"/").concat(E.name,"/").concat(S.name)]=new et(-1/0,[[[]]]))}),C["idb://".concat(e.name,"/").concat(E.name,"/")]=C["idb://".concat(e.name,"/").concat(E.name,"/:dels")]=new et(-1/0,[[[]]])}),Ot(xr).fire(C),no(C,!0)),e})}function oo(e){function r(l){return e.next(l)}var o=u(r),a=u(function(l){return e.throw(l)});function u(l){return function(p){var p=l(p),w=p.value;return p.done?w:w&&typeof w.then=="function"?w.then(o,a):m(w)?Promise.all(w).then(o,a):o(w)}}return u(r)()}function tn(e,r,o){for(var a=m(e)?e.slice():[e],u=0;u<o;++u)a.push(r);return a}var us={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return s(s({},e),{table:function(a){var o=e.table(a),a=o.schema,u={},l=[];function d(C,E,S){var k=_r(C),b=u[k]=u[k]||[],P=C==null?0:typeof C=="string"?1:C.length,j=0<E,k=s(s({},S),{name:j?"".concat(k,"(virtual-from:").concat(S.name,")"):S.name,lowLevelIndex:S,isVirtual:j,keyTail:E,keyLength:P,extractKey:Un(C),unique:!j&&S.unique});return b.push(k),k.isPrimaryKey||l.push(k),1<P&&d(P===2?C[0]:C.slice(0,P-1),E+1,S),b.sort(function(D,N){return D.keyTail-N.keyTail}),k}var p=d(a.primaryKey.keyPath,0,a.primaryKey);u[":id"]=[p];for(var w=0,O=a.indexes;w<O.length;w++){var x=O[w];d(x.keyPath,0,x)}function v(C){var E,S=C.query.index;return S.isVirtual?s(s({},C),{query:{index:S.lowLevelIndex,range:(E=C.query.range,S=S.keyTail,{type:E.type===1?2:E.type,lower:tn(E.lower,E.lowerOpen?e.MAX_KEY:e.MIN_KEY,S),lowerOpen:!0,upper:tn(E.upper,E.upperOpen?e.MIN_KEY:e.MAX_KEY,S),upperOpen:!0})}}):C}return s(s({},o),{schema:s(s({},a),{primaryKey:p,indexes:l,getIndexByKeyPath:function(C){return(C=u[_r(C)])&&C[0]}}),count:function(C){return o.count(v(C))},query:function(C){return o.query(v(C))},openCursor:function(C){var E=C.query.index,S=E.keyTail,b=E.keyLength;return E.isVirtual?o.openCursor(v(C)).then(function(j){return j&&P(j)}):o.openCursor(C);function P(j){return Object.create(j,{continue:{value:function(k){k!=null?j.continue(tn(k,C.reverse?e.MAX_KEY:e.MIN_KEY,S)):C.unique?j.continue(j.key.slice(0,b).concat(C.reverse?e.MIN_KEY:e.MAX_KEY,S)):j.continue()}},continuePrimaryKey:{value:function(k,D){j.continuePrimaryKey(tn(k,e.MAX_KEY,S),D)}},primaryKey:{get:function(){return j.primaryKey}},key:{get:function(){var k=j.key;return b===1?k[0]:k.slice(0,b)}},value:{get:function(){return j.value}}})}}})}})}};function io(e,r,o,a){return o=o||{},a=a||"",h(e).forEach(function(u){var l,d,p;A(r,u)?(l=e[u],d=r[u],typeof l=="object"&&typeof d=="object"&&l&&d?(p=fe(l))!==fe(d)?o[a+u]=r[u]:p==="Object"?io(l,d,o,a+u+"."):l!==d&&(o[a+u]=r[u]):l!==d&&(o[a+u]=r[u])):o[a+u]=void 0}),h(r).forEach(function(u){A(e,u)||(o[a+u]=r[u])}),o}function ao(e,r){return r.type==="delete"?r.keys:r.keys||r.values.map(e.extractKey)}var cs={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return s(s({},e),{table:function(r){var o=e.table(r),a=o.schema.primaryKey;return s(s({},o),{mutate:function(u){var l=se.trans,d=l.table(r).hook,p=d.deleting,w=d.creating,O=d.updating;switch(u.type){case"add":if(w.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"put":if(w.fire===q&&O.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"delete":if(p.fire===q)break;return l._promise("readwrite",function(){return x(u)},!0);case"deleteRange":if(p.fire===q)break;return l._promise("readwrite",function(){return(function v(C,E,S){return o.query({trans:C,values:!1,query:{index:a,range:E},limit:S}).then(function(b){var P=b.result;return x({type:"delete",keys:P,trans:C}).then(function(j){return 0<j.numFailures?Promise.reject(j.failures[0]):P.length<S?{failures:[],numFailures:0,lastResult:void 0}:v(C,s(s({},E),{lower:P[P.length-1],lowerOpen:!0}),S)})})})(u.trans,u.range,1e4)},!0)}return o.mutate(u);function x(v){var C,E,S,b=se.trans,P=v.keys||ao(a,v);if(P)return(v=v.type==="add"||v.type==="put"?s(s({},v),{keys:P}):s({},v)).type!=="delete"&&(v.values=c([],v.values)),v.keys&&(v.keys=c([],v.keys)),C=o,S=P,((E=v).type==="add"?Promise.resolve([]):C.getMany({trans:E.trans,keys:S,cache:"immutable"})).then(function(j){var k=P.map(function(D,N){var H,Q,L,ne=j[N],te={onerror:null,onsuccess:null};return v.type==="delete"?p.fire.call(te,D,ne,b):v.type==="add"||ne===void 0?(H=w.fire.call(te,D,v.values[N],b),D==null&&H!=null&&(v.keys[N]=D=H,a.outbound||pe(v.values[N],a.keyPath,D))):(H=io(ne,v.values[N]),(Q=O.fire.call(te,H,D,ne,b))&&(L=v.values[N],Object.keys(Q).forEach(function(U){A(L,U)?L[U]=Q[U]:pe(L,U,Q[U])}))),te});return o.mutate(v).then(function(D){for(var N=D.failures,H=D.results,Q=D.numFailures,D=D.lastResult,L=0;L<P.length;++L){var ne=(H||P)[L],te=k[L];ne==null?te.onerror&&te.onerror(N[L]):te.onsuccess&&te.onsuccess(v.type==="put"&&j[L]?v.values[L]:ne)}return{failures:N,results:H,numFailures:Q,lastResult:D}}).catch(function(D){return k.forEach(function(N){return N.onerror&&N.onerror(D)}),Promise.reject(D)})});throw new Error("Keys missing")}}})}})}};function li(e,r,o){try{if(!r||r.keys.length<e.length)return null;for(var a=[],u=0,l=0;u<r.keys.length&&l<e.length;++u)Se(r.keys[u],e[l])===0&&(a.push(o?re(r.values[u]):r.values[u]),++l);return a.length===e.length?a:null}catch{return null}}var ls={stack:"dbcore",level:-1,create:function(e){return{table:function(r){var o=e.table(r);return s(s({},o),{getMany:function(a){var u;return a.cache?(u=li(a.keys,a.trans._cache,a.cache==="clone"))?Z.resolve(u):o.getMany(a).then(function(l){return a.trans._cache={keys:a.keys,values:a.cache==="clone"?re(l):l},l}):o.getMany(a)},mutate:function(a){return a.type!=="add"&&(a.trans._cache=null),o.mutate(a)}})}}}};function fi(e,r){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!r.schema.primaryKey.outbound}function di(e,r){switch(e){case"query":return r.values&&!r.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var fs={stack:"dbcore",level:0,name:"Observability",create:function(e){var r=e.schema.name,o=new et(e.MIN_KEY,e.MAX_KEY);return s(s({},e),{transaction:function(a,u,l){if(se.subscr&&u!=="readonly")throw new Y.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(se.querier));return e.transaction(a,u,l)},table:function(a){function u(P){var b,P=P.query;return[b=P.index,new et((b=(P=P.range).lower)!=null?b:e.MIN_KEY,(b=P.upper)!=null?b:e.MAX_KEY)]}var l=e.table(a),d=l.schema,p=d.primaryKey,w=d.indexes,O=p.extractKey,x=p.outbound,v=p.autoIncrement&&w.filter(function(S){return S.compound&&S.keyPath.includes(p.keyPath)}),C=s(s({},l),{mutate:function(S){function b(ie){return ie="idb://".concat(r,"/").concat(a,"/").concat(ie),N[ie]||(N[ie]=new et)}var P,j,k,D=S.trans,N=S.mutatedParts||(S.mutatedParts={}),H=b(""),Q=b(":dels"),L=S.type,te=S.type==="deleteRange"?[S.range]:S.type==="delete"?[S.keys]:S.values.length<50?[ao(p,S).filter(function(ie){return ie}),S.values]:[],ne=te[0],te=te[1],U=S.trans._cache;return m(ne)?(H.addKeys(ne),(L=L==="delete"||ne.length===te.length?li(ne,U):null)||Q.addKeys(ne),(L||te)&&(P=b,j=L,k=te,d.indexes.forEach(function(ie){var _e=P(ie.name||"");function Ee(ve){return ve!=null?ie.extractKey(ve):null}function le(ve){ie.multiEntry&&m(ve)?ve.forEach(function(Fe){return _e.addKey(Fe)}):_e.addKey(ve)}(j||k).forEach(function(ve,ze){var st=j&&Ee(j[ze]),ze=k&&Ee(k[ze]);Se(st,ze)!==0&&(st!=null&&le(st),ze!=null)&&le(ze)})}))):ne?(te={from:(U=ne.lower)!=null?U:e.MIN_KEY,to:(L=ne.upper)!=null?L:e.MAX_KEY},Q.add(te),H.add(te)):(H.add(o),Q.add(o),d.indexes.forEach(function(ie){return b(ie.name).add(o)})),l.mutate(S).then(function(ie){return!ne||S.type!=="add"&&S.type!=="put"||(H.addKeys(ie.results),v&&v.forEach(function(_e){for(var Ee=S.values.map(function(st){return _e.extractKey(st)}),le=_e.keyPath.findIndex(function(st){return st===p.keyPath}),ve=0,Fe=ie.results.length;ve<Fe;++ve)Ee[ve][le]=ie.results[ve];b(_e.name).addKeys(Ee)})),D.mutatedParts=Zr(D.mutatedParts||{},N),ie})}}),E={get:function(S){return[p,new et(S.key)]},getMany:function(S){return[p,new et().addKeys(S.keys)]},count:u,query:u,openCursor:u};return h(E).forEach(function(S){C[S]=function(b){var P=se.subscr,j=!!P,k=fi(se,l)&&di(S,b)?b.obsSet={}:P;if(j){var D,P=function(te){return te="idb://".concat(r,"/").concat(a,"/").concat(te),k[te]||(k[te]=new et)},N=P(""),H=P(":dels"),j=E[S](b),Q=j[0],j=j[1];if((S==="query"&&Q.isPrimaryKey&&!b.values?H:P(Q.name||"")).add(j),!Q.isPrimaryKey){if(S!=="count")return D=S==="query"&&x&&b.values&&l.query(s(s({},b),{values:!1})),l[S].apply(this,arguments).then(function(te){if(S==="query"){if(x&&b.values)return D.then(function(Ee){return Ee=Ee.result,N.addKeys(Ee),te});var U=b.values?te.result.map(O):te.result;(b.values?N:H).addKeys(U)}else{var ie,_e;if(S==="openCursor")return _e=b.values,(ie=te)&&Object.create(ie,{key:{get:function(){return H.addKey(ie.primaryKey),ie.key}},primaryKey:{get:function(){var Ee=ie.primaryKey;return H.addKey(Ee),Ee}},value:{get:function(){return _e&&N.addKey(ie.primaryKey),ie.value}}})}return te});H.add(o)}}return l[S].apply(this,arguments)}}),C}})}};function pi(e,r,o){var a;return o.numFailures===0?r:r.type==="deleteRange"||(a=r.keys?r.keys.length:"values"in r&&r.values?r.values.length:1,o.numFailures===a)?null:(a=s({},r),m(a.keys)&&(a.keys=a.keys.filter(function(u,l){return!(l in o.failures)})),"values"in a&&m(a.values)&&(a.values=a.values.filter(function(u,l){return!(l in o.failures)})),a)}function so(e,r){return o=e,((a=r).lower===void 0||(a.lowerOpen?0<Se(o,a.lower):0<=Se(o,a.lower)))&&(o=e,(a=r).upper===void 0||(a.upperOpen?Se(o,a.upper)<0:Se(o,a.upper)<=0));var o,a}function hi(e,r,o,a,u,l){var d,p,w,O,x,v;return!o||o.length===0||(d=r.query.index,p=d.multiEntry,w=r.query.range,O=a.schema.primaryKey.extractKey,x=d.extractKey,v=(d.lowLevelIndex||d).extractKey,(a=o.reduce(function(C,E){var S=C,b=[];if(E.type==="add"||E.type==="put")for(var P=new et,j=E.values.length-1;0<=j;--j){var k,D=E.values[j],N=O(D);!P.hasKey(N)&&(k=x(D),p&&m(k)?k.some(function(te){return so(te,w)}):so(k,w))&&(P.addKey(N),b.push(D))}switch(E.type){case"add":var H=new et().addKeys(r.values?C.map(function(U){return O(U)}):C),S=C.concat(r.values?b.filter(function(U){return U=O(U),!H.hasKey(U)&&(H.addKey(U),!0)}):b.map(function(U){return O(U)}).filter(function(U){return!H.hasKey(U)&&(H.addKey(U),!0)}));break;case"put":var Q=new et().addKeys(E.values.map(function(U){return O(U)}));S=C.filter(function(U){return!Q.hasKey(r.values?O(U):U)}).concat(r.values?b:b.map(function(U){return O(U)}));break;case"delete":var L=new et().addKeys(E.keys);S=C.filter(function(U){return!L.hasKey(r.values?O(U):U)});break;case"deleteRange":var ne=E.range;S=C.filter(function(U){return!so(O(U),ne)})}return S},e))===e)?e:(a.sort(function(C,E){return Se(v(C),v(E))||Se(O(C),O(E))}),r.limit&&r.limit<1/0&&(a.length>r.limit?a.length=r.limit:e.length===r.limit&&a.length<r.limit&&(u.dirty=!0)),l?Object.freeze(a):a)}function mi(e,r){return Se(e.lower,r.lower)===0&&Se(e.upper,r.upper)===0&&!!e.lowerOpen==!!r.lowerOpen&&!!e.upperOpen==!!r.upperOpen}function ds(e,r){return((o,a,u,l)=>{if(o===void 0)return a!==void 0?-1:0;if(a===void 0)return 1;if((o=Se(o,a))===0){if(u&&l)return 0;if(u)return 1;if(l)return-1}return o})(e.lower,r.lower,e.lowerOpen,r.lowerOpen)<=0&&0<=((o,a,u,l)=>{if(o===void 0)return a!==void 0?1:0;if(a===void 0)return-1;if((o=Se(o,a))===0){if(u&&l)return 0;if(u)return-1;if(l)return 1}return o})(e.upper,r.upper,e.upperOpen,r.upperOpen)}function ps(e,r,o,a){e.subscribers.add(o),a.addEventListener("abort",function(){var u,l;e.subscribers.delete(o),e.subscribers.size===0&&(u=e,l=r,setTimeout(function(){u.subscribers.size===0&&Le(l,u)},3e3))})}var hs={stack:"dbcore",level:0,name:"Cache",create:function(e){var r=e.schema.name;return s(s({},e),{transaction:function(o,a,u){var l,d,p=e.transaction(o,a,u);return a==="readwrite"&&(u=(l=new AbortController).signal,p.addEventListener("abort",(d=function(w){return function(){if(l.abort(),a==="readwrite"){for(var O=new Set,x=0,v=o;x<v.length;x++){var C=v[x],E=qt["idb://".concat(r,"/").concat(C)];if(E){var S=e.table(C),b=E.optimisticOps.filter(function(ie){return ie.trans===p});if(p._explicit&&w&&p.mutatedParts)for(var P=0,j=Object.values(E.queries.query);P<j.length;P++)for(var k=0,D=(Q=j[P]).slice();k<D.length;k++)eo((L=D[k]).obsSet,p.mutatedParts)&&(Le(Q,L),L.subscribers.forEach(function(ie){return O.add(ie)}));else if(0<b.length){E.optimisticOps=E.optimisticOps.filter(function(ie){return ie.trans!==p});for(var N=0,H=Object.values(E.queries.query);N<H.length;N++)for(var Q,L,ne,te=0,U=(Q=H[N]).slice();te<U.length;te++)(L=U[te]).res!=null&&p.mutatedParts&&(w&&!L.dirty?(ne=Object.isFrozen(L.res),ne=hi(L.res,L.req,b,S,L,ne),L.dirty?(Le(Q,L),L.subscribers.forEach(function(ie){return O.add(ie)})):ne!==L.res&&(L.res=ne,L.promise=Z.resolve({result:ne}))):(L.dirty&&Le(Q,L),L.subscribers.forEach(function(ie){return O.add(ie)})))}}}O.forEach(function(ie){return ie()})}}})(!1),{signal:u}),p.addEventListener("error",d(!1),{signal:u}),p.addEventListener("complete",d(!0),{signal:u})),p},table:function(o){var a=e.table(o),u=a.schema.primaryKey;return s(s({},a),{mutate:function(l){var d,p=se.trans;return!u.outbound&&p.db._options.cache!=="disabled"&&!p.explicit&&p.idbtrans.mode==="readwrite"&&(d=qt["idb://".concat(r,"/").concat(o)])?(p=a.mutate(l),l.type!=="add"&&l.type!=="put"||!(50<=l.values.length||ao(u,l).some(function(w){return w==null}))?(d.optimisticOps.push(l),l.mutatedParts&&en(l.mutatedParts),p.then(function(w){0<w.numFailures&&(Le(d.optimisticOps,l),(w=pi(0,l,w))&&d.optimisticOps.push(w),l.mutatedParts)&&en(l.mutatedParts)}),p.catch(function(){Le(d.optimisticOps,l),l.mutatedParts&&en(l.mutatedParts)})):p.then(function(w){var O=pi(0,s(s({},l),{values:l.values.map(function(x,v){var C;return w.failures[v]?x:(pe(C=(C=u.keyPath)!=null&&C.includes(".")?re(x):s({},x),u.keyPath,w.results[v]),C)})}),w);d.optimisticOps.push(O),queueMicrotask(function(){return l.mutatedParts&&en(l.mutatedParts)})}),p):a.mutate(l)},query:function(l){var d,p,w,O,x,v,C;return fi(se,a)&&di("query",l)?(d=((w=se.trans)==null?void 0:w.db._options.cache)==="immutable",p=(w=se).requery,w=w.signal,v=((E,S,b,P)=>{var j=qt["idb://".concat(E,"/").concat(S)];if(!j)return[];if(!(E=j.queries[b]))return[null,!1,j,null];var k=E[(P.query?P.query.index.name:null)||""];if(!k)return[null,!1,j,null];switch(b){case"query":var D=k.find(function(N){return N.req.limit===P.limit&&N.req.values===P.values&&mi(N.req.query.range,P.query.range)});return D?[D,!0,j,k]:[k.find(function(N){return("limit"in N.req?N.req.limit:1/0)>=P.limit&&(!P.values||N.req.values)&&ds(N.req.query.range,P.query.range)}),!1,j,k];case"count":return D=k.find(function(N){return mi(N.req.query.range,P.query.range)}),[D,!!D,j,k]}})(r,o,"query",l),C=v[0],O=v[2],x=v[3],C&&v[1]?C.obsSet=l.obsSet:(v=a.query(l).then(function(E){var S=E.result;if(C&&(C.res=S),d){for(var b=0,P=S.length;b<P;++b)Object.freeze(S[b]);Object.freeze(S)}else E.result=re(S);return E}).catch(function(E){return x&&C&&Le(x,C),Promise.reject(E)}),C={obsSet:l.obsSet,promise:v,subscribers:new Set,type:"query",req:l,dirty:!1},x?x.push(C):(x=[C],(O=O||(qt["idb://".concat(r,"/").concat(o)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[l.query.index.name||""]=x)),ps(C,x,p,w),C.promise.then(function(E){return{result:hi(E.result,l,O==null?void 0:O.optimisticOps,a,C,d)}})):a.query(l)}})}})}};function rn(e,r){return new Proxy(e,{get:function(o,a,u){return a==="db"?r:Reflect.get(o,a,u)}})}Ye.prototype.version=function(e){if(isNaN(e)||e<.1)throw new Y.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new Y.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var r=this._versions,o=r.filter(function(a){return a._cfg.version===e})[0];return o||(o=new this.Version(e),r.push(o),r.sort(ns),o.stores({}),this._state.autoSchema=!1),o},Ye.prototype._whenReady=function(e){var r=this;return this.idbdb&&(this._state.openComplete||se.letThrough||this._vip)?e():new Z(function(o,a){if(r._state.openComplete)return a(new Y.DatabaseClosed(r._state.dbOpenError));if(!r._state.isBeingOpened){if(!r._state.autoOpen)return void a(new Y.DatabaseClosed);r.open().catch(q)}r._state.dbReadyPromise.then(o,a)}).then(e)},Ye.prototype.use=function(u){var r=u.stack,o=u.create,a=u.level,u=u.name,l=(u&&this.unuse({stack:r,name:u}),this._middlewares[r]||(this._middlewares[r]=[]));return l.push({stack:r,create:o,level:a??10,name:u}),l.sort(function(d,p){return d.level-p.level}),this},Ye.prototype.unuse=function(e){var r=e.stack,o=e.name,a=e.create;return r&&this._middlewares[r]&&(this._middlewares[r]=this._middlewares[r].filter(function(u){return a?u.create!==a:!!o&&u.name!==o})),this},Ye.prototype.open=function(){var e=this;return Nt(_t,function(){return ss(e)})},Ye.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state,r=Zt.indexOf(this);if(0<=r&&Zt.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new Z(function(o){e.dbReadyResolve=o}),e.openCanceller=new Z(function(o,a){e.cancelOpen=a}))},Ye.prototype.close=function(r){var r=(r===void 0?{disableAutoOpen:!0}:r).disableAutoOpen,o=this._state;r?(o.isBeingOpened&&o.cancelOpen(new Y.DatabaseClosed),this._close(),o.autoOpen=!1,o.dbOpenError=new Y.DatabaseClosed):(this._close(),o.autoOpen=this._options.autoOpen||o.isBeingOpened,o.openComplete=!1,o.dbOpenError=null)},Ye.prototype.delete=function(e){var r=this,o=(e===void 0&&(e={disableAutoOpen:!0}),0<arguments.length&&typeof arguments[0]!="object"),a=this._state;return new Z(function(u,l){function d(){r.close(e);var p=r._deps.indexedDB.deleteDatabase(r.name);p.onsuccess=Me(function(){var w,O,x;w=r._deps,O=r.name,Xn(x=w.indexedDB)||O===qr||Qn(x,w.IDBKeyRange).delete(O).catch(q),u()}),p.onerror=pt(l),p.onblocked=r._fireOnBlocked}if(o)throw new Y.InvalidArgument("Invalid closeOptions argument to db.delete()");a.isBeingOpened?a.dbReadyPromise.then(d):d()})},Ye.prototype.backendDB=function(){return this.idbdb},Ye.prototype.isOpen=function(){return this.idbdb!==null},Ye.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},Ye.prototype.hasFailed=function(){return this._state.dbOpenError!==null},Ye.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Ye.prototype,"tables",{get:function(){var e=this;return h(this._allTables).map(function(r){return e._allTables[r]})},enumerable:!1,configurable:!0}),Ye.prototype.transaction=function(){var e=(function(r,o,a){var u=arguments.length;if(u<2)throw new Y.InvalidArgument("Too few arguments");for(var l=new Array(u-1);--u;)l[u-1]=arguments[u];return a=l.pop(),[r,tt(l),a]}).apply(this,arguments);return this._transaction.apply(this,e)},Ye.prototype._transaction=function(e,r,o){var a,u,l=this,d=se.trans,p=(d&&d.db===this&&e.indexOf("!")===-1||(d=null),e.indexOf("?")!==-1);e=e.replace("!","").replace("?","");try{if(u=r.map(function(O){if(O=O instanceof l.Table?O.name:O,typeof O!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return O}),e=="r"||e===Kn)a=Kn;else{if(e!="rw"&&e!=Fn)throw new Y.InvalidArgument("Invalid transaction mode: "+e);a=Fn}if(d){if(d.mode===Kn&&a===Fn){if(!p)throw new Y.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");d=null}d&&u.forEach(function(O){if(d&&d.storeNames.indexOf(O)===-1){if(!p)throw new Y.SubTransaction("Table "+O+" not included in parent transaction.");d=null}}),p&&d&&!d.active&&(d=null)}}catch(O){return d?d._promise(null,function(x,v){v(O)}):Ue(O)}var w=(function O(x,v,C,E,S){return Z.resolve().then(function(){var k=se.transless||se,b=x._createTransaction(v,C,x._dbSchema,E),k=(b.explicit=!0,{trans:b,transless:k});if(E)b.idbtrans=E.idbtrans;else try{b.create(),b.idbtrans._explicit=!0,x._state.PR1398_maxLoop=3}catch(D){return D.name===we.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return O(x,v,C,null,S)})):Ue(D)}var P,j=oe(S),k=(j&&Jt(),Z.follow(function(){var D;(P=S.call(b,b))&&(j?(D=Et.bind(null,null),P.then(D,D)):typeof P.next=="function"&&typeof P.throw=="function"&&(P=oo(P)))},k));return(P&&typeof P.then=="function"?Z.resolve(P).then(function(D){return b.active?D:Ue(new Y.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):k.then(function(){return P})).then(function(D){return E&&b._resolve(),b._completion.then(function(){return D})}).catch(function(D){return b._reject(D),Ue(D)})})}).bind(null,this,a,u,d,o);return d?d._promise(a,w,"lock"):se.trans?Nt(se.transless,function(){return l._whenReady(w)}):this._whenReady(w)},Ye.prototype.table=function(e){if(A(this._allTables,e))return this._allTables[e];throw new Y.InvalidTable("Table ".concat(e," does not exist"))};var gt=Ye;function Ye(e,r){var o,a,u,l,d,p=this,w=(this._middlewares={},this.verno=0,Ye.dependencies),w=(this._options=r=s({addons:Ye.addons,autoOpen:!0,indexedDB:w.indexedDB,IDBKeyRange:w.IDBKeyRange,cache:"cloned"},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange},r.addons),O=(this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this,{dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:q,dbReadyPromise:null,cancelOpen:q,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:r.autoOpen}),x=(O.dbReadyPromise=new Z(function(v){O.dbReadyResolve=v}),O.openCanceller=new Z(function(v,C){O.cancelOpen=C}),this._state=O,this.name=e,this.on=vr(this,"populate","blocked","versionchange","close",{ready:[Pn,q]}),this.once=function(v,C){var E=function(){for(var S=[],b=0;b<arguments.length;b++)S[b]=arguments[b];p.on(v).unsubscribe(E),C.apply(p,S)};return p.on(v,E)},this.on.ready.subscribe=ce(this.on.ready.subscribe,function(v){return function(C,E){Ye.vip(function(){var S,b=p._state;b.openComplete?(b.dbOpenError||Z.resolve().then(C),E&&v(C)):b.onReadyBeingFired?(b.onReadyBeingFired.push(C),E&&v(C)):(v(C),S=p,E||v(function P(){S.on.ready.unsubscribe(C),S.on.ready.unsubscribe(P)}))})}}),this.Collection=(o=this,br(Qa.prototype,function(P,b){this.db=o;var E=Vo,S=null;if(b)try{E=b()}catch(k){S=k}var b=P._ctx,P=b.table,j=P.hook.reading.fire;this._ctx={table:P,index:b.index,isPrimKey:!b.index||P.schema.primKey.keyPath&&b.index===P.schema.primKey.name,range:E,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:S,or:b.or,valueMapper:j!==Ze?j:null}})),this.Table=(a=this,br(Qo.prototype,function(v,C,E){this.db=a,this._tx=E,this.name=v,this.schema=C,this.hook=a._allTables[v]?a._allTables[v].hook:vr(null,{creating:[qa,q],reading:[Ht,Ze],updating:[za,q],deleting:[La,q]})})),this.Transaction=(u=this,br(Za.prototype,function(v,C,E,S,b){var P=this;v!=="readonly"&&C.forEach(function(j){j=(j=E[j])==null?void 0:j.yProps,j&&(C=C.concat(j.map(function(k){return k.updatesTable})))}),this.db=u,this.mode=v,this.storeNames=C,this.schema=E,this.chromeTransactionDurability=S,this.idbtrans=null,this.on=vr(this,"complete","error","abort"),this.parent=b||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 Z(function(j,k){P._resolve=j,P._reject=k}),this._completion.then(function(){P.active=!1,P.on.complete.fire()},function(j){var k=P.active;return P.active=!1,P.on.error.fire(j),P.parent?P.parent._reject(j):k&&P.idbtrans&&P.idbtrans.abort(),Ue(j)})})),this.Version=(l=this,br(as.prototype,function(v){this.db=l,this._cfg={version:v,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(d=this,br(ti.prototype,function(v,C,E){if(this.db=d,this._ctx={table:v,index:C===":id"?null:C,or:E},this._cmp=this._ascending=Se,this._descending=function(S,b){return Se(b,S)},this._max=function(S,b){return 0<Se(S,b)?S:b},this._min=function(S,b){return Se(S,b)<0?S:b},this._IDBKeyRange=d._deps.IDBKeyRange,!this._IDBKeyRange)throw new Y.MissingAPI})),this.on("versionchange",function(v){0<v.newVersion?console.warn("Another connection wants to upgrade database '".concat(p.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(p.name,"'. Closing db now to resume the delete request.")),p.close({disableAutoOpen:!1})}),this.on("blocked",function(v){!v.newVersion||v.newVersion<v.oldVersion?console.warn("Dexie.delete('".concat(p.name,"') was blocked")):console.warn("Upgrade '".concat(p.name,"' blocked by other connection holding version ").concat(v.oldVersion/10))}),this._maxKey=Sr(r.IDBKeyRange),this._createTransaction=function(v,C,E,S){return new p.Transaction(v,C,E,p._options.chromeTransactionDurability,S)},this._fireOnBlocked=function(v){p.on("blocked").fire(v),Zt.filter(function(C){return C.name===p.name&&C!==p&&!C._state.vcFired}).map(function(C){return C.on("versionchange").fire(v)})},this.use(ls),this.use(hs),this.use(fs),this.use(us),this.use(cs),new Proxy(this,{get:function(v,C,E){var S;return C==="_vip"||(C==="table"?function(b){return rn(p.table(b),x)}:(S=Reflect.get(v,C,E))instanceof Qo?rn(S,x):C==="tables"?S.map(function(b){return rn(b,x)}):C==="_createTransaction"?function(){return rn(S.apply(this,arguments),x)}:S)}}));this.vip=x,w.forEach(function(v){return v(p)})}var nn,nr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",ms=(uo.prototype.subscribe=function(e,r,o){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:r,complete:o})},uo.prototype[nr]=function(){return this},uo);function uo(e){this._subscribe=e}try{nn={indexedDB:f.indexedDB||f.mozIndexedDB||f.webkitIndexedDB||f.msIndexedDB,IDBKeyRange:f.IDBKeyRange||f.webkitIDBKeyRange}}catch{nn={indexedDB:null,IDBKeyRange:null}}function yi(e){var r,o=!1,a=new ms(function(u){var l=oe(e),d,p=!1,w={},O={},x={get closed(){return p},unsubscribe:function(){p||(p=!0,d&&d.abort(),v&&Ot.storagemutated.unsubscribe(E))}},v=(u.start&&u.start(x),!1),C=function(){return Nn(S)},E=function(b){Zr(w,b),eo(O,w)&&C()},S=function(){var b,P,j;!p&&nn.indexedDB&&(w={},b={},d&&d.abort(),d=new AbortController,j=(k=>{var D=Qt();try{l&&Jt();var N=Ct(e,k);return N=l?N.finally(Et):N}finally{D&&Xt()}})(P={subscr:b,signal:d.signal,requery:C,querier:e,trans:null}),Promise.resolve(j).then(function(k){o=!0,r=k,p||P.signal.aborted||(w={},(D=>{for(var N in D)if(A(D,N))return;return 1})(O=b)||v||(Ot(xr,E),v=!0),Nn(function(){return!p&&u.next&&u.next(k)}))},function(k){o=!1,["DatabaseClosedError","AbortError"].includes(k==null?void 0:k.name)||p||Nn(function(){p||u.error&&u.error(k)})}))};return setTimeout(C,0),x});return a.hasValue=function(){return o},a.getValue=function(){return r},a}var Lt=gt;function co(e){var r=At;try{At=!0,Ot.storagemutated.fire(e),no(e,!0)}finally{At=r}}I(Lt,s(s({},he),{delete:function(e){return new Lt(e,{addons:[]}).delete()},exists:function(e){return new Lt(e,{addons:[]}).open().then(function(r){return r.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return r=Lt.dependencies,o=r.indexedDB,r=r.IDBKeyRange,(Xn(o)?Promise.resolve(o.databases()).then(function(a){return a.map(function(u){return u.name}).filter(function(u){return u!==qr})}):Qn(o,r).toCollection().primaryKeys()).then(e)}catch{return Ue(new Y.MissingAPI)}var r,o},defineClass:function(){return function(e){T(this,e)}},ignoreTransaction:function(e){return se.trans?Nt(se.transless,e):e()},vip:Jn,async:function(e){return function(){try{var r=oo(e.apply(this,arguments));return r&&typeof r.then=="function"?r:Z.resolve(r)}catch(o){return Ue(o)}}},spawn:function(e,r,o){try{var a=oo(e.apply(o,r||[]));return a&&typeof a.then=="function"?a:Z.resolve(a)}catch(u){return Ue(u)}},currentTransaction:{get:function(){return se.trans||null}},waitFor:function(e,r){return e=Z.resolve(typeof e=="function"?Lt.ignoreTransaction(e):e).timeout(r||6e4),se.trans?se.trans.waitFor(e):e},Promise:Z,debug:{get:function(){return dt},set:function(e){Mo(e)}},derive:g,extend:T,props:I,override:ce,Events:vr,on:Ot,liveQuery:yi,extendObservabilitySet:Zr,getByKeyPath:ee,setByKeyPath:pe,delByKeyPath:function(e,r){typeof r=="string"?pe(e,r,void 0):"length"in r&&[].map.call(r,function(o){pe(e,o,void 0)})},shallowClone:Pe,deepClone:re,getObjectDiff:io,cmp:Se,asap:F,minKey:-1/0,addons:[],connections:Zt,errnames:we,dependencies:nn,cache:qt,semVer:"4.3.0",version:"4.3.0".split(".").map(function(e){return parseInt(e)}).reduce(function(e,r,o){return e+r/Math.pow(10,2*o)})})),Lt.maxKey=Sr(Lt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Ot(xr,function(e){At||(e=new CustomEvent(zn,{detail:e}),At=!0,dispatchEvent(e),At=!1)}),addEventListener(zn,function(e){e=e.detail,At||co(e)}));var or,At=!1,gi=function(){};return typeof BroadcastChannel<"u"&&((gi=function(){(or=new BroadcastChannel(zn)).onmessage=function(e){return e.data&&co(e.data)}})(),typeof or.unref=="function"&&or.unref(),Ot(xr,function(e){At||or.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!gt.disableBfCache&&e.persisted){dt&&console.debug("Dexie: handling persisted pagehide"),or!=null&&or.close();for(var r=0,o=Zt;r<o.length;r++)o[r].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!gt.disableBfCache&&e.persisted&&(dt&&console.debug("Dexie: handling persisted pageshow"),gi(),co({all:new et(-1/0,[[]])}))})),Z.rejectionMapper=function(e,r){return!e||e instanceof de||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Je[e.name]?e:(r=new Je[e.name](r||e.message,e),"stack"in e&&M(r,"stack",{get:function(){return this.inner.stack}}),r)},Mo(dt),s(gt,Object.freeze({__proto__:null,Dexie:gt,Entity:Wo,PropModification:gr,RangeSet:et,add:function(e){return new gr({add:e})},cmp:Se,default:gt,liveQuery:yi,mergeRanges:Er,rangesOverlap:ai,remove:function(e){return new gr({remove:e})},replacePrefix:function(e,r){return new gr({replacePrefix:[e,r]})}}),{default:gt}),gt})})(ln)),ln.exports}var hl=pl();const ko=ra(hl),Ji=Symbol.for("Dexie"),dr=globalThis[Ji]||(globalThis[Ji]=ko);if(ko.semVer!==dr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${ko.semVer} and ${dr.semVer}`);const{liveQuery:Rl,mergeRanges:jl,rangesOverlap:Il,RangeSet:$l,cmp:Dl,Entity:Bl,PropModification:Ml,replacePrefix:Nl,add:Kl,remove:Fl,DexieYProvider:ql}=dr;class ml extends dr{constructor(){super("chat_cache");Pt(this,"conversations");Pt(this,"summaries");Pt(this,"users");Pt(this,"messages");Pt(this,"msgCursor");Pt(this,"groups");this.version(1).stores({summaries:"id",users:"id",messages:"id, conversationId",msgCursor:"id",groups:"id"})}async clearData(){await Promise.all([this.summaries.clear(),this.users.clear(),this.messages.clear(),this.msgCursor.clear(),this.groups.clear()])}}const Xe=new ml,An=({type:t,id:n})=>`${t}:${n}`,yl=({group:t,user:n})=>`${t?"group":"user"}:${t||n}`,gl=(t,n)=>t.group?`group:${t.group}`:`dm:${t.sender===n?t.receiver:t.sender}`,vl=async t=>{const s=(await xt().getMessagesSummary(t)).map(c=>({...c,id:yl(c)}));return await Xe.summaries.bulkPut(s),s},bl=async t=>{const i=await xt().getGroups(t);return await Xe.groups.clear(),await Xe.groups.bulkPut(i),i};function wl(t,n,i){var s,c;typeof t=="function"?(s=n||[],c=i):(s=[],c=n);var f=ue.useRef({hasResult:!1,result:c,error:null}),h=ue.useReducer(function(_){return _+1},0);h[0];var m=h[1],T=ue.useMemo(function(){var _=typeof t=="function"?t():t;if(!_||typeof _.subscribe!="function")throw t===_?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!f.current.hasResult&&typeof window<"u"&&(typeof _.hasValue!="function"||_.hasValue()))if(typeof _.getValue=="function")f.current.result=_.getValue(),f.current.hasResult=!0;else{var R=_.subscribe(function(A){f.current.result=A,f.current.hasResult=!0});typeof R=="function"?R():R.unsubscribe()}return _},s);if(ue.useDebugValue(f.current.result),ue.useEffect(function(){var _=T.subscribe(function(R){var A=f.current;(A.error!==null||A.result!==R)&&(A.error=null,A.result=R,A.hasResult=!0,m())},function(R){var A=f.current;A.error!==R&&(A.error=R,m())});return typeof _=="function"?_:_.unsubscribe.bind(_)},s),f.current.error)throw f.current.error;return f.current.result}function mn(t,n,i){return wl(function(){return dr.liveQuery(t)},n||[],i)}typeof FinalizationRegistry<"u"&&new FinalizationRegistry(function(t){var n=dr.DexieYProvider;n&&n.release(t)});const Aa=({selectedConversation:t,currentUser:n,onConversationSelect:i})=>{const[s,c]=ue.useState(!0),[f,h]=ue.useState(),m=mn(()=>Xe.summaries.toArray(),[t])||[],T=mn(()=>Xe.groups.toArray(),[])||[],_=ue.useCallback(async()=>{c(!0),await Promise.all([vl({}),bl(n==null?void 0:n.org)]).catch(g=>{h(g instanceof Error?g:new Error(String(g)))}),c(!1)},[n==null?void 0:n.org]);ue.useEffect(()=>{_();const g=setInterval(_,3*6e4);return()=>clearInterval(g)},[_]);const[R,A]=ue.useState({});ue.useEffect(()=>{const g=async()=>{if(!(n!=null&&n.org))return;const V=xt(),J={};for(const ae of m)try{if(ae.user!==void 0&&!R[ae.user]){const ce=await V.getUser(ae.user);J[ae.user]=ce.name}}catch(ce){console.error("Failed to load conversation name:",ce)}Object.keys(J).length>0&&A(ae=>({...ae,...J}))};m.length>0&&(n!=null&&n.org)&&g()},[m,n==null?void 0:n.org]);const I=g=>{if(g.user!==void 0)return R[g.user]||`User ${g.user}`;if(g.group!==void 0){const V=T.find(J=>J.id===g.group);return(V==null?void 0:V.name)||`Group ${g.group}`}return"Unknown"},K=g=>t?g.group!==void 0?t.type==="group"&&t.id===g.group:g.user!==void 0?t.type==="dm"&&t.id===g.user:!1:!1,M=g=>{g.group!==void 0?i({type:"group",id:g.group,name:I(g)}):g.user!==void 0&&i({type:"dm",id:g.user,name:I(g)})};return B.jsxs(X.Box,{display:"flex",flexDirection:"column",height:"100%",children:[B.jsx(X.AppBar,{position:"static",elevation:0,sx:{backgroundColor:"background.default",color:"text.primary"},children:B.jsx(X.Toolbar,{children:B.jsx(X.Typography,{variant:"h6",component:"div",children:"Messages"})})}),B.jsx(X.Box,{flex:1,overflow:"auto",children:s&&!m.length?B.jsx(X.List,{disablePadding:!0,children:[1,2,3,4,5].map(g=>B.jsx(Oa,{},g))}):f?B.jsx(X.Box,{p:2,children:B.jsxs(X.Alert,{severity:"error",children:["Failed to load conversations: ",f.message]})}):m.length===0&&T.length===0?B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",p:2,children:B.jsx(X.Typography,{color:"text.secondary",align:"center",children:"No conversations yet"})}):B.jsx(X.List,{disablePadding:!0,children:(()=>{const g=new Set(m.filter(W=>W.group!==void 0).map(W=>W.group)),J=T.filter(W=>!g.has(W.id)).map(W=>({group:W.id,last_message_at:W.created_at,message_count:0,unread_count:0}));return[...[...m].sort((W,F)=>new Date(F.last_message_at).getTime()-new Date(W.last_message_at).getTime()),...J].map(W=>B.jsx(ka,{conversation:W,displayName:I(W),selected:K(W),onClick:()=>M(W)},W.group!==void 0?`group-${W.group}`:`user-${W.user}`))})()})})]})},Pa=({displayName:t,type:n,subtitle:i,isConnected:s=!0,onBack:c})=>{const f=n==="group";return B.jsx(X.AppBar,{position:"static",elevation:0,sx:{backgroundColor:"background.default",color:"text.primary"},children:B.jsxs(X.Toolbar,{children:[c&&B.jsx(X.IconButton,{edge:"start",color:"inherit",onClick:c,sx:{mr:2,display:{xs:"flex",sm:"flex",md:"none"}},children:B.jsx(ol,{})}),B.jsx(X.Avatar,{sx:{bgcolor:f?"primary.main":"secondary.main",mr:2},children:f?B.jsx(Ea,{}):B.jsx(Ta,{})}),B.jsxs(X.Box,{flex:1,children:[B.jsx(X.Typography,{variant:"h6",component:"div",noWrap:!0,children:t}),i&&B.jsx(X.Typography,{variant:"caption",color:"inherit",sx:{opacity:.7},children:i})]}),!s&&B.jsx(X.Chip,{icon:B.jsx(ll,{}),label:"Disconnected",size:"small",color:"warning",sx:{ml:1}})]})})};function xl(t){return(typeof t=="string"?new Date(t):t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}const Ra=300*1e3;function Sl(t,n=Ra){if(t.length===0)return[];const i=[];let s=null;for(const c of t){const f=new Date(c.created_at).getTime();if(!s)s={senderId:c.sender,messages:[c],timestamp:new Date(c.created_at)};else{const h=new Date(s.messages[s.messages.length-1].created_at).getTime(),m=f-h;s.senderId===c.sender&&m<=n?s.messages.push(c):(i.push(s),s={senderId:c.sender,messages:[c],timestamp:new Date(c.created_at)})}}return s&&i.push(s),i}function Oo(t,n,i=Ra){if(t.sender!==n.sender)return!1;const s=new Date(t.created_at).getTime(),c=new Date(n.created_at).getTime();return Math.abs(c-s)<=i}function _l(t=""){const n=t.trim().split(" ").filter(i=>i.length>0);if(n.length>=2){const i=n[0],s=n[n.length-1];if(i&&s&&i[0]&&s[0])return(i[0]+s[0]).toUpperCase()}return t.slice(0,2).toUpperCase()}const Zi=async(t,n={})=>{const i=xt(),s=An(t);t.type==="group"?n.group=t.id:n.user=t.id;const c=await i.getMessages(n);return c.messages.map(h=>({...h,conversationId:s})).forEach(h=>Xe.messages.put(h)),Xe.msgCursor.put({...c.cursor,id:s}),c},ja=ue.memo(({message:t,isOwnMessage:n,senderName:i,showSenderName:s=!0,isFirstInGroup:c=!0,isLastInGroup:f=!0,status:h="sent"})=>{const m=t.id.startsWith("temp-"),T=()=>{if(!n||!f)return null;const R={fontSize:14,ml:.5,opacity:.7,verticalAlign:"middle"};return h==="failed"?B.jsx(al,{sx:{...R,color:"error.main"}}):h==="sending"||m?B.jsx(ul,{sx:R}):B.jsx(il,{sx:R})},_=B.jsx(X.Avatar,{sx:{width:32,height:32,fontSize:"0.875rem",color:n?"primary.contrastText":"secondary.contrastText",bgcolor:n?"primary.main":"secondary.main",visibility:f?"visible":"hidden"},children:_l(i)});return B.jsxs(X.Box,{display:"flex",justifyContent:n?"flex-end":"flex-start",alignItems:"flex-end",mb:f?1:.25,gap:1,children:[!n&&_,B.jsxs(X.Paper,{elevation:1,sx:{maxWidth:"80%",p:1.5,backgroundColor:n?"primary.main":"background.paper",color:n?"primary.contrastText":"text.primary",borderTopLeftRadius:n||!c?void 0:4,borderTopRightRadius:!n||!c?void 0:4,borderBottomLeftRadius:n||!f?void 0:4,borderBottomRightRadius:!n||!f?void 0:4},children:[!n&&s&&c&&B.jsx(X.Typography,{variant:"caption",fontWeight:"bold",display:"block",mb:.5,children:i||`User ${t.sender}`}),B.jsx(X.Typography,{variant:"body1",sx:{whiteSpace:"pre-wrap"},children:t.content}),f&&B.jsxs(X.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center",mt:.5,children:[B.jsx(X.Typography,{variant:"caption",color:n?"inherit":"text.secondary",sx:{opacity:.7},children:xl(new Date(t.created_at))}),B.jsx(T,{})]})]}),n&&_]})}),Ia=({isOwnMessage:t=!1})=>B.jsx(X.Box,{display:"flex",justifyContent:t?"flex-end":"flex-start",mb:1,children:B.jsxs(X.Box,{maxWidth:"70%",children:[!t&&B.jsx(X.Skeleton,{variant:"text",width:80,sx:{mb:.5}}),B.jsx(X.Skeleton,{variant:"rounded",width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:t?"primary.light":"background.main"}})]})}),$a=({hasMore:t,loading:n,onLoadMore:i,threshold:s=1,rootMargin:c="100px"})=>{const f=ue.useRef(null),h=ue.useRef(null);return ue.useEffect(()=>{if(!t||n)return;const m=f.current;if(m)return h.current=new IntersectionObserver(T=>{const[_]=T;_&&_.isIntersecting&&t&&!n&&i()},{threshold:s,rootMargin:c}),h.current.observe(m),()=>{h.current&&m&&(h.current.unobserve(m),h.current.disconnect())}},[t,n,i,s,c]),t?B.jsx(X.Box,{ref:f,display:"flex",justifyContent:"center",alignItems:"center",py:2,children:n?B.jsx(X.CircularProgress,{size:24}):B.jsx(X.Typography,{variant:"caption",color:"text.secondary",children:"Scroll to load more"})}):null},Bo=(t,n,i)=>{ue.useEffect(()=>((async()=>{await t()})(),i),n)};function Cl(t){const n=t.map(s=>Number(s.sender));return new Set(n)}function Da(t){const n=xt(),[i,s]=ue.useState(()=>new Map),c=ue.useCallback(async()=>{if(!t.length)return i;try{const f=Cl(t),h=Array.from(f);if(console.log("[names] size:",f.size),!f.size)return i;const m=(await Xe.users.bulkGet(h)).filter(I=>!!I),T=new Map;if(m.forEach(I=>{T.set(I.id,I.name)}),f.size===m.length)return T;const _=h.filter(I=>!T.has(I)),R=await n.getUsers(_,{fields:["id","name"]});await Xe.users.bulkPut(R);const A=T;return R.forEach(I=>A.set(I.id,I.name)),A}catch(f){console.error("[useSenderNames] Failed to fetch users:",f)}return i},[t,i]);return Bo(async()=>{const f=await c();s(f)},[t]),i}const Ba=({messages:t,currentUserId:n,loading:i=!1,error:s=null,autoScroll:c=!0,hasMore:f=!1,loadingMore:h=!1,onLoadMore:m})=>{const T=ue.useRef(null),_=ue.useRef(null),R=ue.useRef(0),A=ue.useRef(!0),[I,K]=ue.useState(c),M=Da(t),g=()=>{if(!_.current)return!1;const{scrollTop:J,scrollHeight:ae,clientHeight:ce}=_.current;return ae-J-ce<100},V=()=>{A.current=g()};return ue.useEffect(()=>{t.length>0&&T.current&&(T.current.scrollIntoView({behavior:"auto"}),A.current=!0)},[]),ue.useEffect(()=>{!h||!t.length||(_.current&&(R.current=_.current.scrollHeight),K(!1))},[h]),ue.useLayoutEffect(()=>{if(t.length){if(I&&T.current&&A.current)T.current.scrollIntoView({behavior:"smooth"});else if(!I&&_.current&&R.current>0){const ae=_.current.scrollHeight-R.current;_.current.scrollTop=_.current.scrollTop+ae,R.current=0,K(!0)}}},[t.length,c]),i&&!t.length?B.jsx(X.Box,{flex:1,overflow:"auto",p:2,children:[1,2,3,4,5].map(J=>B.jsx(Ia,{isOwnMessage:J%3===0},J))}):s&&!t.length?B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",flex:1,p:2,children:B.jsxs(X.Alert,{severity:"error",children:[B.jsx("strong",{children:"Failed to load messages"}),B.jsx("br",{}),s.message]})}):t.length===0?B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",flex:1,children:B.jsx(X.Typography,{variant:"body2",color:"text.secondary",children:"No messages yet. Start the conversation!"})}):B.jsxs(X.Box,{ref:_,flex:1,overflow:"auto",p:2,display:"flex",flexDirection:"column",onScroll:V,children:[f&&m&&B.jsx($a,{hasMore:f,loading:h,onLoadMore:m}),t.map((J,ae)=>{const ce=J.sender,W=J.sender===n,F=M.get(ce),ee=ae>0?t[ae-1]:null,pe=ae<t.length-1?t[ae+1]:null,Pe=!ee||!Oo(ee,J),Ke=!pe||!Oo(J,pe);return B.jsx(ja,{message:J,isOwnMessage:W,senderName:F,showSenderName:Pe,isFirstInGroup:Pe,isLastInGroup:Ke},J.id)}),B.jsx("div",{ref:T})]})},Ma=({onSend:t,sending:n=!1,placeholder:i="Type a message...",disabled:s=!1})=>{const[c,f]=ue.useState(""),h=ue.useRef(null),m=()=>{const _=c.trim();_&&!n&&!s&&(t(_),f(""),setTimeout(()=>{var R,A;(A=(R=h.current)==null?void 0:R.querySelector("textarea"))==null||A.focus()},300))},T=_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),m())};return B.jsxs(X.Box,{display:"flex",gap:1,p:2,borderTop:1,borderColor:"divider",children:[B.jsx(X.TextField,{ref:h,fullWidth:!0,multiline:!0,maxRows:4,value:c,onChange:_=>f(_.target.value),onKeyDown:T,placeholder:i,disabled:s||n,variant:"outlined",size:"small"}),B.jsx(X.IconButton,{color:"primary",onClick:m,disabled:!c.trim()||n||s,size:"large",children:n?B.jsx(X.CircularProgress,{size:24}):B.jsx(cl,{})})]})};function Na({conversation:t,limit:n=50}){const i=An(t),[s,c]=ue.useState(!1),[f,h]=ue.useState(!1),[m,T]=ue.useState(),_=mn(()=>Xe.messages.where("conversationId").equals(i).sortBy("created_at"),[i])||[],R=mn(()=>Xe.msgCursor.where("id").equals(i).first(),[i]);Bo(async()=>{var K;const I={limit:n};_.length&&(I.cursorType="after",I.cursorDatetime=(K=_[_.length-1])==null?void 0:K.created_at),c(!0),await Zi(t,I).catch(T),c(!1),await Xe.summaries.update(i,{unread_count:0})},[t,n]),console.log("mw",_.length);const A=ue.useCallback(async()=>{if(!(!R||f||s)){h(!0);try{const I={limit:n};if(!(R!=null&&R.datetime))return;I.cursorType="before",I.cursorDatetime=R.datetime,await Zi(t,I)}catch(I){console.error("[useMessages] Failed to load more:",I)}finally{h(!1)}}},[R,n,t,f,s]);return{messages:_,cursor:R,loading:s,error:m,loadMore:A,loadingMore:f}}const Ka=({conversation:t,user:n,isConnected:i,onBack:s})=>{const c=xt(),{messages:f,cursor:h,loading:m,error:T,loadMore:_,loadingMore:R}=Na({conversation:t}),[A,I]=ue.useState(!1),[K,M]=ue.useState(null),[g,V]=ue.useState(!1),J=async ae=>{if(!ae.trim())return;I(!0),M(null),V(!0);const ce=`temp-${Date.now()}-${Math.random()}`,W={id:ce,sender:n==null?void 0:n.id,receiver:t.type==="dm"?t.id:null,group:t.type==="group"?t.id:null,content:ae,created_at:new Date().toISOString(),conversationId:An(t)};try{await Xe.messages.put(W),await(t.type==="group"?c.sendGroupMessage:c.sendDM).bind(c)(t.id,ae),await Xe.messages.delete(ce)}catch(F){M(F instanceof Error?F:new Error("Failed to send message"))}finally{I(!1),setTimeout(()=>V(!1),100)}};return B.jsxs(X.Box,{display:"flex",flexDirection:"column",height:"100%",children:[B.jsx(Pa,{displayName:t.name||"Chat",type:t.type,isConnected:i,onBack:s}),K&&B.jsxs(X.Alert,{severity:"error",onClose:()=>M(null),children:["Failed to send message: ",K.message]}),B.jsx(Ba,{messages:f,currentUserId:(n==null?void 0:n.id)||0,loading:m,error:T,autoScroll:!0,hasMore:!!(h!=null&&h.datetime),loadingMore:R,onLoadMore:_,forceScrollToBottom:g}),B.jsx(Ma,{onSend:J,sending:A,disabled:(n==null?void 0:n.id)===null})]})};class Ao extends ue.Component{constructor(i){super(i);Pt(this,"handleReset",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,s){var c,f;console.error("ErrorBoundary caught an error:",i,s),(f=(c=this.props).onError)==null||f.call(c,i,s)}render(){var i;return this.state.hasError?this.props.fallback?this.props.fallback:B.jsxs(X.Box,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",p:3,children:[B.jsxs(X.Alert,{severity:"error",sx:{mb:2,maxWidth:500},children:[B.jsx(X.Typography,{variant:"h6",gutterBottom:!0,children:"Something went wrong"}),B.jsx(X.Typography,{variant:"body2",color:"text.secondary",children:((i=this.state.error)==null?void 0:i.message)||"An unexpected error occurred"})]}),B.jsx(X.Button,{variant:"contained",startIcon:B.jsx(sl,{}),onClick:this.handleReset,children:"Try Again"})]}):this.props.children}}function Fa({onMessage:t,onConnect:n,onDisconnect:i,onError:s,currentUserId:c,conversation:f,updateCache:h=!0}={}){const m=ue.useRef(c),T=ue.useRef(f),_=ue.useRef(h),R=ue.useRef(t);ue.useEffect(()=>{m.current=c,T.current=f,_.current=h,R.current=t},[c,f,h,t]);const A=ue.useCallback(async g=>{var V;if(g.type==="message"){const J=g.data;if((V=R.current)==null||V.call(R,J),console.log("sss",{updateCache:_.current,currentUserId:m.current}),!_.current||!m.current)return;const ae=T.current&&An(T.current),ce=gl(J,m.current),W={...J,conversationId:ce};Xe.messages.put(W);const F=await Xe.summaries.get(ce),{unread_count:ee,message_count:pe}=F,Pe={message_count:pe+1,last_message_at:J.created_at};ce!==ae&&(Pe.unread_count=ee+1),await Xe.summaries.update(ce,Pe)}},[]),I=ue.useCallback(()=>{n==null||n()},[n]),K=ue.useCallback((g,V)=>{i==null||i(g,V)},[i]),M=ue.useCallback(g=>{console.error("[WS] WebSocket error:",g),s==null||s(g)},[s]);ue.useEffect(()=>{try{const g=xt();return console.log("www adding listeners"),g.on("message",A),g.on("open",I),g.on("close",K),g.on("error",M),()=>{console.log("www removing listeners"),g.off("message",A),g.off("open",I),g.off("close",K),g.off("error",M)}}catch(g){console.error("Failed to setup WebSocket listeners:",g)}},[A,I,K,M])}const El=({initialConversation:t})=>{const[n,i]=ue.useState(t??null),[s,c]=ue.useState(),[f,h]=ue.useState(!0),m=A=>()=>h(A),T=xt();Bo(async()=>{const A=await T.getMe();c(A),Xe.users.put(A),console.log("sdf user set",A)},[]),Fa({onError:m(!1),onConnect:m(!0),onDisconnect:m(!1),currentUserId:s==null?void 0:s.id,conversation:n,updateCache:!0});const _=A=>{i(A)},R=()=>{i(null)};return B.jsxs(X.Box,{display:"flex",height:"100%",overflow:"hidden",children:[B.jsx(X.Box,{sx:{width:{xs:"100%",sm:"100%",md:"320px"},flexShrink:0,border:"0px solid",borderRightWidth:{xs:0,md:1},borderColor:"divider",overflow:"hidden",display:{xs:n?"none":"flex",sm:n?"none":"flex",md:"flex"},flexDirection:"column"},children:B.jsx(Ao,{children:B.jsx(Aa,{currentUser:s,selectedConversation:n,onConversationSelect:_})})}),B.jsx(X.Box,{sx:{flex:1,overflow:"hidden",display:{xs:n?"flex":"none",sm:n?"flex":"none",md:"flex"},flexDirection:"column"},children:n?B.jsx(Ao,{children:B.jsx(Ka,{conversation:n,user:s,isConnected:f,onBack:R})}):B.jsx(X.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"text.secondary",children:"Select a conversation to start chatting"})})]})},Tl=({count:t,children:n,max:i=99})=>B.jsx(X.Badge,{badgeContent:t,color:"error",max:i,overlap:"rectangular",sx:{"& .MuiBadge-badge":{right:8,top:"50%",transform:"translateY(-50%)"}},children:n}),kl={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},ea=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches,Ol={mode:"dark",background:{paper:"#3d3d43",default:"#333338"},text:{primary:"#eee",secondary:"#aaa"}},Al=Ca({palette:{mode:"light",primary:{main:"#E91E63",light:"#F48FB1",dark:"#AD1457",contrastText:"#fff"},secondary:{main:"#e4e6eb",light:"#f0f2f5",dark:"#b0b3b8",contrastText:"rgba(0, 0, 0, 0.87)"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},background:{default:"#f5f5f5",paper:"#ffff"},...ea?Ol:{}},typography:{fontFamily:["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'].join(","),fontSize:14,h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500},body1:{fontSize:"0.9375rem",lineHeight:1.4},body2:{fontSize:"0.8125rem",lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:"50%"}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:"0.6875rem",height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:"8px",height:"8px"},"*::-webkit-scrollbar-track":{background:"undo",borderRadius:"4px"},"*::-webkit-scrollbar-thumb":{background:"undo",borderRadius:"4px","&:hover":{background:"undo"}},scrollbarWidth:"thin",scrollbarColor:ea?"#6a6a6e #333338":"#c1c1c1 #f5f5f5"}}}}});exports.CACHE_TTL=kl;exports.ChatApp=Cs;exports.ChatContainer=El;exports.ChatHeader=Pa;exports.ChatWindow=Ka;exports.ConversationItem=ka;exports.ConversationItemSkeleton=Oa;exports.ConversationList=Aa;exports.ErrorBoundary=Ao;exports.LoadMoreTrigger=$a;exports.MessageBubble=ja;exports.MessageInput=Ma;exports.MessageList=Ba;exports.MessageSkeleton=Ia;exports.UnreadBadge=Tl;exports.disconnectSDK=So;exports.getSDK=xt;exports.groupMessages=Sl;exports.initSDK=ta;exports.isSDKInitialized=xs;exports.shouldGroupMessages=Oo;exports.theme=Al;exports.useMessages=Na;exports.useSenderNames=Da;exports.useWebSocketMessages=Fa;
|