@inspectr/ui 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inspectr-ui.es.js +2629 -2558
- package/dist/inspectr-ui.umd.js +18 -18
- package/dist/ui.css +1 -1
- package/package.json +2 -2
package/dist/inspectr-ui.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Ne,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],T):(Ne=typeof globalThis<"u"?globalThis:Ne||self,T(Ne.InspectrUI={},Ne.React))})(this,function(Ne,T){"use strict";var Ko=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lo(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ir={exports:{}},Vt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var En;function Fo(){if(En)return Vt;En=1;var a=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function d(m,_,E){var N=null;if(E!==void 0&&(N=""+E),_.key!==void 0&&(N=""+_.key),"key"in _){E={};for(var P in _)P!=="key"&&(E[P]=_[P])}else E=_;return _=E.ref,{$$typeof:a,type:m,key:N,ref:_!==void 0?_:null,props:E}}return Vt.Fragment=c,Vt.jsx=d,Vt.jsxs=d,Vt}var Ut={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,28 +14,28 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var An;function Ho(){return An||(An=1,process.env.NODE_ENV!=="production"&&function(){function a(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===Ie?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case ie:return"Fragment";case we:return"Portal";case Ke:return"Profiler";case se:return"StrictMode";case ye:return"Suspense";case Ee:return"SuspenseList"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case ee:return(f.displayName||"Context")+".Provider";case de:return(f._context.displayName||"Context")+".Consumer";case le:var $=f.render;return f=f.displayName,f||(f=$.displayName||$.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case Oe:return $=f.displayName||null,$!==null?$:a(f.type)||"Memo";case J:$=f._payload,f=f._init;try{return a(f($))}catch{}}return null}function c(f){return""+f}function d(f){try{c(f);var $=!1}catch{$=!0}if($){$=console;var U=$.error,be=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return U.call($,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",be),c(f)}}function m(){}function _(){if(We===0){Qe=console.log,lt=console.info,ft=console.warn,Et=console.error,Y=console.group,At=console.groupCollapsed,pt=console.groupEnd;var f={configurable:!0,enumerable:!0,value:m,writable:!0};Object.defineProperties(console,{info:f,log:f,warn:f,error:f,group:f,groupCollapsed:f,groupEnd:f})}We++}function E(){if(We--,We===0){var f={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:re({},f,{value:Qe}),info:re({},f,{value:lt}),warn:re({},f,{value:ft}),error:re({},f,{value:Et}),group:re({},f,{value:Y}),groupCollapsed:re({},f,{value:At}),groupEnd:re({},f,{value:pt})})}0>We&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function N(f){if(ve===void 0)try{throw Error()}catch(U){var $=U.stack.trim().match(/\n( *(at )?)/);ve=$&&$[1]||"",ct=-1<U.stack.indexOf(`
|
|
18
18
|
at`)?" (<anonymous>)":-1<U.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
-
`+
|
|
20
|
-
`),at
|
|
21
|
-
`);for(ne=
|
|
22
|
-
`+
|
|
19
|
+
`+ve+f+ct}function P(f,$){if(!f||Nt)return"";var U=et.get(f);if(U!==void 0)return U;Nt=!0,U=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var be=null;be=Pe.H,Pe.H=null,_();try{var Re={DetermineComponentFrameRoot:function(){try{if($){var nt=function(){throw Error()};if(Object.defineProperty(nt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(nt,[])}catch(He){var bt=He}Reflect.construct(f,[],nt)}else{try{nt.call()}catch(He){bt=He}f.call(nt.prototype)}}else{try{throw Error()}catch(He){bt=He}(nt=f())&&typeof nt.catch=="function"&&nt.catch(function(){})}}catch(He){if(He&&bt&&typeof He.stack=="string")return[He.stack,bt.stack]}return[null,null]}};Re.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _e=Object.getOwnPropertyDescriptor(Re.DetermineComponentFrameRoot,"name");_e&&_e.configurable&&Object.defineProperty(Re.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ne=Re.DetermineComponentFrameRoot(),tt=ne[0],at=ne[1];if(tt&&at){var Le=tt.split(`
|
|
20
|
+
`),it=at.split(`
|
|
21
|
+
`);for(ne=_e=0;_e<Le.length&&!Le[_e].includes("DetermineComponentFrameRoot");)_e++;for(;ne<it.length&&!it[ne].includes("DetermineComponentFrameRoot");)ne++;if(_e===Le.length||ne===it.length)for(_e=Le.length-1,ne=it.length-1;1<=_e&&0<=ne&&Le[_e]!==it[ne];)ne--;for(;1<=_e&&0<=ne;_e--,ne--)if(Le[_e]!==it[ne]){if(_e!==1||ne!==1)do if(_e--,ne--,0>ne||Le[_e]!==it[ne]){var rt=`
|
|
22
|
+
`+Le[_e].replace(" at new "," at ");return f.displayName&&rt.includes("<anonymous>")&&(rt=rt.replace("<anonymous>",f.displayName)),typeof f=="function"&&et.set(f,rt),rt}while(1<=_e&&0<=ne);break}}}finally{Nt=!1,Pe.H=be,E(),Error.prepareStackTrace=U}return Le=(Le=f?f.displayName||f.name:"")?N(Le):"",typeof f=="function"&&et.set(f,Le),Le}function I(f){if(f==null)return"";if(typeof f=="function"){var $=f.prototype;return P(f,!(!$||!$.isReactComponent))}if(typeof f=="string")return N(f);switch(f){case ye:return N("Suspense");case Ee:return N("SuspenseList")}if(typeof f=="object")switch(f.$$typeof){case le:return f=P(f.render,!1),f;case Oe:return I(f.type);case J:$=f._payload,f=f._init;try{return I(f($))}catch{}}return""}function L(){var f=Pe.A;return f===null?null:f.getOwner()}function Z(f){if(Ue.call(f,"key")){var $=Object.getOwnPropertyDescriptor(f,"key").get;if($&&$.isReactWarning)return!1}return f.key!==void 0}function S(f,$){function U(){me||(me=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$))}U.isReactWarning=!0,Object.defineProperty(f,"key",{get:U,configurable:!0})}function Q(){var f=a(this.type);return De[f]||(De[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function oe(f,$,U,be,Re,_e){return U=_e.ref,f={$$typeof:Ce,type:f,key:$,props:_e,_owner:Re},(U!==void 0?U:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:Q}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function q(f,$,U,be,Re,_e){if(typeof f=="string"||typeof f=="function"||f===ie||f===Ke||f===se||f===ye||f===Ee||f===he||typeof f=="object"&&f!==null&&(f.$$typeof===J||f.$$typeof===Oe||f.$$typeof===ee||f.$$typeof===de||f.$$typeof===le||f.$$typeof===ke||f.getModuleId!==void 0)){var ne=$.children;if(ne!==void 0)if(be)if(Ae(ne)){for(be=0;be<ne.length;be++)X(ne[be],f);Object.freeze&&Object.freeze(ne)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else X(ne,f)}else ne="",(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(ne+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),f===null?be="null":Ae(f)?be="array":f!==void 0&&f.$$typeof===Ce?(be="<"+(a(f.type)||"Unknown")+" />",ne=" Did you accidentally export a JSX literal instead of a component?"):be=typeof f,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",be,ne);if(Ue.call($,"key")){ne=a(f);var tt=Object.keys($).filter(function(Le){return Le!=="key"});be=0<tt.length?"{key: someKey, "+tt.join(": ..., ")+": ...}":"{key: someKey}",$e[ne+be]||(tt=0<tt.length?"{"+tt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,
|
|
27
|
+
<%s key={someKey} {...props} />`,be,ne,tt,ne),$e[ne+be]=!0)}if(ne=null,U!==void 0&&(d(U),ne=""+U),Z($)&&(d($.key),ne=""+$.key),"key"in $){U={};for(var at in $)at!=="key"&&(U[at]=$[at])}else U=$;return ne&&S(U,typeof f=="function"?f.displayName||f.name||"Unknown":f),oe(f,ne,_e,Re,L(),U)}function X(f,$){if(typeof f=="object"&&f&&f.$$typeof!==z){if(Ae(f))for(var U=0;U<f.length;U++){var be=f[U];W(be)&&pe(be,$)}else if(W(f))f._store&&(f._store.validated=1);else if(f===null||typeof f!="object"?U=null:(U=Me&&f[Me]||f["@@iterator"],U=typeof U=="function"?U:null),typeof U=="function"&&U!==f.entries&&(U=U.call(f),U!==f))for(;!(f=U.next()).done;)W(f.value)&&pe(f.value,$)}}function W(f){return typeof f=="object"&&f!==null&&f.$$typeof===Ce}function pe(f,$){if(f._store&&!f._store.validated&&f.key==null&&(f._store.validated=1,$=te($),!Fe[$])){Fe[$]=!0;var U="";f&&f._owner!=null&&f._owner!==L()&&(U=null,typeof f._owner.tag=="number"?U=a(f._owner.type):typeof f._owner.name=="string"&&(U=f._owner.name),U=" It was passed a child from "+U+".");var be=Pe.getCurrentStack;Pe.getCurrentStack=function(){var Re=I(f.type);return be&&(Re+=be()||""),Re},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',$,U),Pe.getCurrentStack=be}}function te(f){var $="",U=L();return U&&(U=a(U.type))&&($=`
|
|
28
28
|
|
|
29
|
-
Check the render method of \``+U+"`."),$||(
|
|
29
|
+
Check the render method of \``+U+"`."),$||(f=a(f))&&($=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+
|
|
32
|
-
`)}function
|
|
33
|
-
`+s:""),this.inner=s||null):typeof o=="object"&&(this.message="".concat(o.name," ").concat(o.message),this.inner=o):(this.message=we[t]||n,this.inner=null)}return G(r).from(Tt),e[t]=r,e},{});F.Syntax=SyntaxError,F.Type=TypeError,F.Range=RangeError;var Ne=Me.reduce(function(e,t){return e[t+"Error"]=F[t],e},{}),Le=it.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=F[t]),e},{});function oe(){}function De(e){return e}function ft(e,t){return e==null||e===De?t:function(n){return t(e(n))}}function pe(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Ae(e,t){return e===oe?t:function(){var n=e.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?pe(r,this.onsuccess):r),o&&(this.onerror=this.onerror?pe(o,this.onerror):o),s!==void 0?s:n}}function hn(e,t){return e===oe?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?pe(n,this.onsuccess):n),r&&(this.onerror=this.onerror?pe(r,this.onerror):r)}}function pn(e,t){return e===oe?t:function(n){var r=e.apply(this,arguments);I(n,r);var o=this.onsuccess,s=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?pe(o,this.onsuccess):o),s&&(this.onerror=this.onerror?pe(s,this.onerror):s),r===void 0?n===void 0?void 0:n:I(r,n)}}function mn(e,t){return e===oe?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function Rt(e,t){return e===oe?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,o=arguments.length,s=new Array(o);o--;)s[o]=arguments[o];return n.then(function(){return t.apply(r,s)})}return t.apply(this,arguments)}}Le.ModifyError=$e,Le.DexieError=Ce,Le.BulkError=ut;var h=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function $(e){h=e}var U={},ge=100,je=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,L(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,L(t),e]}(),Me=je[0],it=je[1],je=je[2],it=it&&it.then,ne=Me&&Me.constructor,et=!!je,st=function(e,t){Qt.push([e,t]),at&&(queueMicrotask(la),at=!1)},Fe=!0,at=!0,tt=[],nt=[],gt=De,ze={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:oe,pgp:!1,env:{},finalize:oe},J=ze,Qt=[],kt=0,gn=[];function z(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=J;if(typeof e!="function"){if(e!==U)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Qn(this,this._value))}this._state=null,this._value=null,++t.ref,function n(r,o){try{o(function(s){if(r._state===null){if(s===r)throw new TypeError("A promise cannot be resolved with itself.");var u=r._lib&&Mt();s&&typeof s.then=="function"?n(r,function(l,p){s instanceof z?s._then(l,p):s.then(l,p)}):(r._state=!0,r._value=s,uo(r)),u&&It()}},Qn.bind(null,r))}catch(s){Qn(r,s)}}(this,e)}var $n={get:function(){var e=J,t=xn;function n(r,o){var s=this,u=!e.global&&(e!==J||t!==xn),l=u&&!vt(),p=new z(function(y,x){Jn(s,new io(co(r,e,u,l),co(o,e,u,l),y,x,e))});return this._consoleTask&&(p._consoleTask=this._consoleTask),p}return n.prototype=U,n},set:function(e){q(this,"then",e&&e.prototype===U?$n:{get:function(){return e},set:$n.set})}};function io(e,t,n,r,o){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=o}function Qn(e,t){var n,r;nt.push(t),e._state===null&&(n=e._lib&&Mt(),t=gt(t),e._state=!1,e._value=t,r=e,tt.some(function(o){return o._value===r._value})||tt.push(r),uo(e),n&&It())}function uo(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Jn(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),kt===0&&(++kt,st(function(){--kt==0&&Yn()},[]))}function Jn(e,t){if(e._state!==null){var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++kt,st(ua,[n,e,t])}else e._listeners.push(t)}function ua(e,t,n){try{var r,o=t._value;!t._state&&nt.length&&(nt=[]),r=h&&t._consoleTask?t._consoleTask.run(function(){return e(o)}):e(o),t._state||nt.indexOf(o)!==-1||function(s){for(var u=tt.length;u;)if(tt[--u]._value===s._value)return tt.splice(u,1)}(t),n.resolve(r)}catch(s){n.reject(s)}finally{--kt==0&&Yn(),--n.psd.ref||n.psd.finalize()}}function la(){Ct(ze,function(){Mt()&&It()})}function Mt(){var e=Fe;return at=Fe=!1,e}function It(){var e,t,n;do for(;0<Qt.length;)for(e=Qt,Qt=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(0<Qt.length);at=Fe=!0}function Yn(){var e=tt;tt=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=gn.slice(0),n=t.length;n;)t[--n]()}function yn(e){return new z(U,!1,e)}function Te(e,t){var n=J;return function(){var r=Mt(),o=J;try{return bt(n,!0),e.apply(this,arguments)}catch(s){t&&t(s)}finally{bt(o,!1),r&&It()}}}Q(z.prototype,{then:$n,_then:function(e,t){Jn(this,new io(null,null,e,t,J))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=e,n=arguments[1];return typeof t=="function"?this.then(null,function(r){return(r instanceof t?n:yn)(r)}):this.then(null,function(r){return(r&&r.name===t?n:yn)(r)})},finally:function(e){return this.then(function(t){return z.resolve(e()).then(function(){return t})},function(t){return z.resolve(e()).then(function(){return yn(t)})})},timeout:function(e,t){var n=this;return e<1/0?new z(function(r,o){var s=setTimeout(function(){return o(new F.Timeout(t))},e);n.then(r,o).finally(clearTimeout.bind(null,s))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&q(z.prototype,Symbol.toStringTag,"Dexie.Promise"),ze.env=lo(),Q(z,{all:function(){var e=We.apply(null,arguments).map(wn);return new z(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(o,s){return z.resolve(o).then(function(u){e[s]=u,--r||t(e)},n)})})},resolve:function(e){return e instanceof z?e:e&&typeof e.then=="function"?new z(function(t,n){e.then(t,n)}):new z(U,!0,e)},reject:yn,race:function(){var e=We.apply(null,arguments).map(wn);return new z(function(t,n){e.map(function(r){return z.resolve(r).then(t,n)})})},PSD:{get:function(){return J},set:function(e){return J=e}},totalEchoes:{get:function(){return xn}},newPSD:yt,usePSD:Ct,scheduler:{get:function(){return st},set:function(e){st=e}},rejectionMapper:{get:function(){return gt},set:function(e){gt=e}},follow:function(e,t){return new z(function(n,r){return yt(function(o,s){var u=J;u.unhandleds=[],u.onunhandled=s,u.finalize=pe(function(){var l,p=this;l=function(){p.unhandleds.length===0?o():s(p.unhandleds[0])},gn.push(function y(){l(),gn.splice(gn.indexOf(y),1)}),++kt,st(function(){--kt==0&&Yn()},[])},u.finalize),e()},t,n,r)})}}),ne&&(ne.allSettled&&q(z,"allSettled",function(){var e=We.apply(null,arguments).map(wn);return new z(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(o,s){return z.resolve(o).then(function(u){return r[s]={status:"fulfilled",value:u}},function(u){return r[s]={status:"rejected",reason:u}}).then(function(){return--n||t(r)})})})}),ne.any&&typeof AggregateError<"u"&&q(z,"any",function(){var e=We.apply(null,arguments).map(wn);return new z(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,o=new Array(r);e.forEach(function(s,u){return z.resolve(s).then(function(l){return t(l)},function(l){o[u]=l,--r||n(new AggregateError(o))})})})}),ne.withResolvers&&(z.withResolvers=ne.withResolvers));var Ve={awaits:0,echoes:0,id:0},ca=0,vn=[],bn=0,xn=0,fa=0;function yt(e,t,n,r){var o=J,s=Object.create(o);return s.parent=o,s.ref=0,s.global=!1,s.id=++fa,ze.env,s.env=et?{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}:{},t&&I(s,t),++o.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()},r=Ct(s,e,n,r),s.ref===0&&s.finalize(),r}function Dt(){return Ve.id||(Ve.id=++ca),++Ve.awaits,Ve.echoes+=ge,Ve.id}function vt(){return!!Ve.awaits&&(--Ve.awaits==0&&(Ve.id=0),Ve.echoes=Ve.awaits*ge,!0)}function wn(e){return Ve.echoes&&e&&e.constructor===ne?(Dt(),e.then(function(t){return vt(),t},function(t){return vt(),qe(t)})):e}function da(){var e=vn[vn.length-1];vn.pop(),bt(e,!1)}function bt(e,t){var n,r=J;(t?!Ve.echoes||bn++&&e===J:!bn||--bn&&e===J)||queueMicrotask(t?(function(o){++xn,Ve.echoes&&--Ve.echoes!=0||(Ve.echoes=Ve.awaits=Ve.id=0),vn.push(J),bt(o,!0)}).bind(null,e):da),e!==J&&(J=e,r===ze&&(ze.env=lo()),et&&(n=ze.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(E,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function lo(){var e=E.Promise;return et?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(E,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Ct(e,t,n,r,o){var s=J;try{return bt(e,!0),t(n,r,o)}finally{bt(s,!1)}}function co(e,t,n,r){return typeof e!="function"?e:function(){var o=J;n&&Dt(),bt(t,!0);try{return e.apply(this,arguments)}finally{bt(o,!1),r&&queueMicrotask(vt)}}}function Gn(e){Promise===ne&&Ve.echoes===0?bn===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+it).indexOf("[native code]")===-1&&(Dt=vt=oe);var qe=z.reject,At="",dt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",fo="String expected.",qt=[],jn="__dbnames",Zn="readonly",Xn="readwrite";function Et(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ho={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function _n(e){return typeof e!="string"||/\./.test(e)?function(t){return t}:function(t){return t[e]===void 0&&e in t&&delete(t=Re(t))[e],t}}function po(){throw F.Type()}function me(e,t){try{var n=mo(e),r=mo(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(o,s){for(var u=o.length,l=s.length,p=u<l?u:l,y=0;y<p;++y)if(o[y]!==s[y])return o[y]<s[y]?-1:1;return u===l?0:u<l?-1:1}(go(e),go(t));case"Array":return function(o,s){for(var u=o.length,l=s.length,p=u<l?u:l,y=0;y<p;++y){var x=me(o[y],s[y]);if(x!==0)return x}return u===l?0:u<l?-1:1}(e,t)}}catch{}return NaN}function mo(e){var t=typeof e;return t!="object"?t:ArrayBuffer.isView(e)?"binary":(e=X(e),e==="ArrayBuffer"?"binary":e)}function go(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var yo=(Se.prototype._trans=function(e,t,n){var r=this._tx||J.trans,o=this.name,s=h&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function u(y,x,d){if(!d.schema[o])throw new F.NotFound("Table "+o+" not part of transaction");return t(d.idbtrans,d)}var l=Mt();try{var p=r&&r.db._novip===this.db._novip?r===J.trans?r._promise(e,u,n):yt(function(){return r._promise(e,u,n)},{trans:r,transless:J.transless||J}):function y(x,d,j,g){if(x.idbdb&&(x._state.openComplete||J.letThrough||x._vip)){var b=x._createTransaction(d,j,x._dbSchema);try{b.create(),x._state.PR1398_maxLoop=3}catch(w){return w.name===mt.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return y(x,d,j,g)})):qe(w)}return b._promise(d,function(w,v){return yt(function(){return J.trans=b,g(w,v,b)})}).then(function(w){if(d==="readwrite")try{b.idbtrans.commit()}catch{}return d==="readonly"?w:b._completion.then(function(){return w})})}if(x._state.openComplete)return qe(new F.DatabaseClosed(x._state.dbOpenError));if(!x._state.isBeingOpened){if(!x._state.autoOpen)return qe(new F.DatabaseClosed);x.open().catch(oe)}return x._state.dbReadyPromise.then(function(){return y(x,d,j,g)})}(this.db,e,[this.name],u);return s&&(p._consoleTask=s,p=p.catch(function(y){return console.trace(y),qe(y)})),p}finally{l&&It()}},Se.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):e==null?qe(new F.Type("Invalid argument to Table.get()")):this._trans("readonly",function(r){return n.core.get({trans:r,key:e}).then(function(o){return n.hook.reading.fire(o)})}).then(t)},Se.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(P(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=N(e);if(t.length===1)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(l){if(l.compound&&t.every(function(y){return 0<=l.keyPath.indexOf(y)})){for(var p=0;p<t.length;++p)if(t.indexOf(l.keyPath[p])===-1)return!1;return!0}return!1}).sort(function(l,p){return l.keyPath.length-p.keyPath.length})[0];if(n&&this.db._maxKey!==At){var s=n.keyPath.slice(0,t.length);return this.where(s).equals(s.map(function(p){return e[p]}))}!n&&h&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var r=this.schema.idxByName;function o(l,p){return me(l,p)===0}var u=t.reduce(function(d,p){var y=d[0],x=d[1],d=r[p],j=e[p];return[y||d,y||!d?Et(x,d&&d.multi?function(g){return g=se(g,p),P(g)&&g.some(function(b){return o(j,b)})}:function(g){return o(j,se(g,p))}):x]},[null,null]),s=u[0],u=u[1];return s?this.where(s.name).equals(e[s.keyPath]).filter(u):n?this.filter(u):this.where(t).equals("")},Se.prototype.filter=function(e){return this.toCollection().and(e)},Se.prototype.count=function(e){return this.toCollection().count(e)},Se.prototype.offset=function(e){return this.toCollection().offset(e)},Se.prototype.limit=function(e){return this.toCollection().limit(e)},Se.prototype.each=function(e){return this.toCollection().each(e)},Se.prototype.toArray=function(e){return this.toCollection().toArray(e)},Se.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Se.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,P(e)?"[".concat(e.join("+"),"]"):e))},Se.prototype.reverse=function(){return this.toCollection().reverse()},Se.prototype.mapToClass=function(e){var t,n=this.db,r=this.name;function o(){return t!==null&&t.apply(this,arguments)||this}(this.schema.mappedClass=e).prototype instanceof po&&(function(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function x(){this.constructor=p}f(p,y),p.prototype=y===null?Object.create(y):(x.prototype=y.prototype,new x)}(o,t=e),Object.defineProperty(o.prototype,"db",{get:function(){return n},enumerable:!1,configurable:!0}),o.prototype.table=function(){return r},e=o);for(var s=new Set,u=e.prototype;u;u=L(u))Object.getOwnPropertyNames(u).forEach(function(p){return s.add(p)});function l(p){if(!p)return p;var y,x=Object.create(e.prototype);for(y in p)if(!s.has(y))try{x[y]=p[y]}catch{}return x}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=l,this.hook("reading",l),e},Se.prototype.defineClass=function(){return this.mapToClass(function(e){I(this,e)})},Se.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,s=r.keyPath,u=e;return s&&o&&(u=_n(s)(e)),this._trans("readwrite",function(l){return n.core.mutate({trans:l,type:"add",keys:t!=null?[t]:null,values:[u]})}).then(function(l){return l.numFailures?z.reject(l.failures[0]):l.lastResult}).then(function(l){if(s)try{ae(e,s,l)}catch{}return l})},Se.prototype.update=function(e,t){return typeof e!="object"||P(e)?this.where(":id").equals(e).modify(t):(e=se(e,this.schema.primKey.keyPath),e===void 0?qe(new F.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t))},Se.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,s=r.keyPath,u=e;return s&&o&&(u=_n(s)(e)),this._trans("readwrite",function(l){return n.core.mutate({trans:l,type:"put",values:[u],keys:t!=null?[t]:null})}).then(function(l){return l.numFailures?z.reject(l.failures[0]):l.lastResult}).then(function(l){if(s)try{ae(e,s,l)}catch{}return l})},Se.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})}).then(function(n){return n.numFailures?z.reject(n.failures[0]):void 0})},Se.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:ho})}).then(function(t){return t.numFailures?z.reject(t.failures[0]):void 0})},Se.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(r){return r.map(function(o){return t.hook.reading.fire(o)})})})},Se.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,s=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(u){var y=r.schema.primKey,l=y.auto,y=y.keyPath;if(y&&o)throw new F.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new F.InvalidArgument("Arguments objects and keys must have the same length");var p=e.length,y=y&&l?e.map(_n(y)):e;return r.core.mutate({trans:u,type:"add",keys:o,values:y,wantResults:s}).then(function(b){var d=b.numFailures,j=b.results,g=b.lastResult,b=b.failures;if(d===0)return s?j:g;throw new ut("".concat(r.name,".bulkAdd(): ").concat(d," of ").concat(p," operations failed"),b)})})},Se.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,s=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(u){var y=r.schema.primKey,l=y.auto,y=y.keyPath;if(y&&o)throw new F.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new F.InvalidArgument("Arguments objects and keys must have the same length");var p=e.length,y=y&&l?e.map(_n(y)):e;return r.core.mutate({trans:u,type:"put",keys:o,values:y,wantResults:s}).then(function(b){var d=b.numFailures,j=b.results,g=b.lastResult,b=b.failures;if(d===0)return s?j:g;throw new ut("".concat(r.name,".bulkPut(): ").concat(d," of ").concat(p," operations failed"),b)})})},Se.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(u){return u.key}),o=e.map(function(u){return u.changes}),s=[];return this._trans("readwrite",function(u){return n.getMany({trans:u,keys:r,cache:"clone"}).then(function(l){var p=[],y=[];e.forEach(function(d,j){var g=d.key,b=d.changes,w=l[j];if(w){for(var v=0,_=Object.keys(b);v<_.length;v++){var C=_[v],A=b[C];if(C===t.schema.primKey.keyPath){if(me(A,g)!==0)throw new F.Constraint("Cannot update primary key in bulkUpdate()")}else ae(w,C,A)}s.push(j),p.push(g),y.push(w)}});var x=p.length;return n.mutate({trans:u,type:"put",keys:p,values:y,updates:{keys:r,changeSpecs:o}}).then(function(d){var j=d.numFailures,g=d.failures;if(j===0)return x;for(var b=0,w=Object.keys(g);b<w.length;b++){var v,_=w[b],C=s[Number(_)];C!=null&&(v=g[_],delete g[_],g[C]=v)}throw new ut("".concat(t.name,".bulkUpdate(): ").concat(j," of ").concat(x," operations failed"),g)})})})},Se.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",function(r){return t.core.mutate({trans:r,type:"delete",keys:e})}).then(function(u){var o=u.numFailures,s=u.lastResult,u=u.failures;if(o===0)return s;throw new ut("".concat(t.name,".bulkDelete(): ").concat(o," of ").concat(n," operations failed"),u)})},Se);function Se(){}function Jt(e){function t(u,l){if(l){for(var p=arguments.length,y=new Array(p-1);--p;)y[p-1]=arguments[p];return n[u].subscribe.apply(null,y),e}if(typeof u=="string")return n[u]}var n={};t.addEventType=s;for(var r=1,o=arguments.length;r<o;++r)s(arguments[r]);return t;function s(u,l,p){if(typeof u!="object"){var y;l=l||mn;var x={subscribers:[],fire:p=p||oe,subscribe:function(d){x.subscribers.indexOf(d)===-1&&(x.subscribers.push(d),x.fire=l(x.fire,d))},unsubscribe:function(d){x.subscribers=x.subscribers.filter(function(j){return j!==d}),x.fire=x.subscribers.reduce(l,p)}};return n[u]=t[u]=x}N(y=u).forEach(function(d){var j=y[d];if(P(j))s(d,y[d][0],y[d][1]);else{if(j!=="asap")throw new F.InvalidArgument("Invalid event config");var g=s(d,De,function(){for(var b=arguments.length,w=new Array(b);b--;)w[b]=arguments[b];g.subscribers.forEach(function(v){ce(function(){v.apply(null,w)})})})}})}}function Yt(e,t){return G(t).from({prototype:e}),t}function Bt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function er(e,t){e.filter=Et(e.filter,t)}function tr(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Et(r(),t())}:t,e.justLimit=n&&!r}function kn(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new F.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function vo(e,t,n){var r=kn(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function Cn(e,t,n,r){var o=e.replayFilter?Et(e.filter,e.replayFilter()):e.filter;if(e.or){var s={},u=function(l,p,y){var x,d;o&&!o(p,y,function(j){return p.stop(j)},function(j){return p.fail(j)})||((d=""+(x=p.primaryKey))=="[object ArrayBuffer]"&&(d=""+new Uint8Array(x)),O(s,d)||(s[d]=!0,t(l,p,y)))};return Promise.all([e.or._iterate(u,n),bo(vo(e,r,n),e.algorithm,u,!e.keysOnly&&e.valueMapper)])}return bo(vo(e,r,n),Et(e.algorithm,o),t,!e.keysOnly&&e.valueMapper)}function bo(e,t,n,r){var o=Te(r?function(s,u,l){return n(r(s),u,l)}:n);return e.then(function(s){if(s)return s.start(function(){var u=function(){return s.continue()};t&&!t(s,function(l){return u=l},function(l){s.stop(l),u=oe},function(l){s.fail(l),u=oe})||o(s.value,s,function(l){return u=l}),u()})})}var Gt=(xo.prototype.execute=function(e){var t=this["@@propmod"];if(t.add!==void 0){var n=t.add;if(P(n))return k(k([],P(e)?e:[],!0),n).sort();if(typeof n=="number")return(Number(e)||0)+n;if(typeof n=="bigint")try{return BigInt(e)+n}catch{return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(t.remove!==void 0){var r=t.remove;if(P(r))return P(e)?e.filter(function(o){return!r.includes(o)}).sort():[];if(typeof r=="number")return Number(e)-r;if(typeof r=="bigint")try{return BigInt(e)-r}catch{return BigInt(0)-r}throw new TypeError("Invalid subtrahend ".concat(r))}return n=(n=t.replacePrefix)===null||n===void 0?void 0:n[0],n&&typeof e=="string"&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e},xo);function xo(e){this["@@propmod"]=e}var ha=(xe.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,qe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},xe.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,qe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},xe.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Et(t.algorithm,e)},xe.prototype._iterate=function(e,t){return Cn(this._ctx,e,t,this._ctx.table.core)},xe.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&I(n,e),t._ctx=n,t},xe.prototype.raw=function(){return this._ctx.valueMapper=null,this},xe.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return Cn(t,e,n,t.table.core)})},xe.prototype.count=function(e){var t=this;return this._read(function(n){var r=t._ctx,o=r.table.core;if(Bt(r,!0))return o.count({trans:n,query:{index:kn(r,o.schema),range:r.range}}).then(function(u){return Math.min(u,r.limit)});var s=0;return Cn(r,function(){return++s,!1},n,o).then(function(){return s})}).then(e)},xe.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],o=n.length-1;function s(p,y){return y?s(p[n[y]],y-1):p[r]}var u=this._ctx.dir==="next"?1:-1;function l(p,y){return me(s(p,o),s(y,o))*u}return this.toArray(function(p){return p.sort(l)}).then(t)},xe.prototype.toArray=function(e){var t=this;return this._read(function(n){var r=t._ctx;if(r.dir==="next"&&Bt(r,!0)&&0<r.limit){var o=r.valueMapper,s=kn(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:s,range:r.range}}).then(function(l){return l=l.result,o?l.map(o):l})}var u=[];return Cn(r,function(l){return u.push(l)},n,r.table.core).then(function(){return u})},e)},xe.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,Bt(t)?tr(t,function(){var n=e;return function(r,o){return n===0||(n===1?--n:o(function(){r.advance(n),n=0}),!1)}}):tr(t,function(){var n=e;return function(){return--n<0}})),this},xe.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),tr(this._ctx,function(){var t=e;return function(n,r,o){return--t<=0&&r(o),0<=t}},!0),this},xe.prototype.until=function(e,t){return er(this._ctx,function(n,r,o){return!e(n.value)||(r(o),t)}),this},xe.prototype.first=function(e){return this.limit(1).toArray(function(t){return t[0]}).then(e)},xe.prototype.last=function(e){return this.reverse().first(e)},xe.prototype.filter=function(e){var t;return er(this._ctx,function(n){return e(n.value)}),(t=this._ctx).isMatch=Et(t.isMatch,e),this},xe.prototype.and=function(e){return this.filter(e)},xe.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},xe.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},xe.prototype.desc=function(){return this.reverse()},xe.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.key,r)})},xe.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},xe.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.primaryKey,r)})},xe.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(r,o){n.push(o.key)}).then(function(){return n}).then(e)},xe.prototype.primaryKeys=function(e){var t=this._ctx;if(t.dir==="next"&&Bt(t,!0)&&0<t.limit)return this._read(function(r){var o=kn(t,t.table.core.schema);return t.table.core.query({trans:r,values:!1,limit:t.limit,query:{index:o,range:t.range}})}).then(function(r){return r.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(r,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)},xe.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},xe.prototype.firstKey=function(e){return this.limit(1).keys(function(t){return t[0]}).then(e)},xe.prototype.lastKey=function(e){return this.reverse().firstKey(e)},xe.prototype.distinct=function(){var e=this._ctx,e=e.index&&e.table.schema.idxByName[e.index];if(!e||!e.multi)return this;var t={};return er(this._ctx,function(o){var r=o.primaryKey.toString(),o=O(t,r);return t[r]=!0,!o}),this},xe.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){var o,s,u;u=typeof e=="function"?e:(o=N(e),s=o.length,function(v){for(var _=!1,C=0;C<s;++C){var A=o[C],S=e[A],R=se(v,A);S instanceof Gt?(ae(v,A,S.execute(R)),_=!0):R!==S&&(ae(v,A,S),_=!0)}return _});var l=n.table.core,d=l.schema.primaryKey,p=d.outbound,y=d.extractKey,x=200,d=t.db._options.modifyChunkSize;d&&(x=typeof d=="object"?d[l.name]||d["*"]||200:d);function j(v,A){var C=A.failures,A=A.numFailures;b+=v-A;for(var S=0,R=N(C);S<R.length;S++){var K=R[S];g.push(C[K])}}var g=[],b=0,w=[];return t.clone().primaryKeys().then(function(v){function _(A){var S=Math.min(x,v.length-A);return l.getMany({trans:r,keys:v.slice(A,A+S),cache:"immutable"}).then(function(R){for(var K=[],M=[],D=p?[]:null,H=[],B=0;B<S;++B){var V=R[B],le={value:Re(V),primKey:v[A+B]};u.call(le,le.value,le)!==!1&&(le.value==null?H.push(v[A+B]):p||me(y(V),y(le.value))===0?(M.push(le.value),p&&D.push(v[A+B])):(H.push(v[A+B]),K.push(le.value)))}return Promise.resolve(0<K.length&&l.mutate({trans:r,type:"add",values:K}).then(function(fe){for(var de in fe.failures)H.splice(parseInt(de),1);j(K.length,fe)})).then(function(){return(0<M.length||C&&typeof e=="object")&&l.mutate({trans:r,type:"put",keys:D,values:M,criteria:C,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<A}).then(function(fe){return j(M.length,fe)})}).then(function(){return(0<H.length||C&&e===nr)&&l.mutate({trans:r,type:"delete",keys:H,criteria:C,isAdditionalChunk:0<A}).then(function(fe){return j(H.length,fe)})}).then(function(){return v.length>A+S&&_(A+x)})})}var C=Bt(n)&&n.limit===1/0&&(typeof e!="function"||e===nr)&&{index:n.index,range:n.range};return _(0).then(function(){if(0<g.length)throw new $e("Error modifying one or more objects",g,b,w);return v.length})})})},xe.prototype.delete=function(){var e=this._ctx,t=e.range;return Bt(e)&&(e.isPrimKey||t.type===3)?this._write(function(n){var r=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then(function(s){return e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(function(u){var l=u.failures;if(u.lastResult,u.results,u=u.numFailures,u)throw new $e("Could not delete some values",Object.keys(l).map(function(p){return l[p]}),s-u);return s-u})})}):this.modify(nr)},xe);function xe(){}var nr=function(e,t){return t.value=null};function pa(e,t){return e<t?-1:e===t?0:1}function ma(e,t){return t<e?-1:e===t?0:1}function rt(e,t,n){return e=e instanceof jo?new e.Collection(e):e,e._ctx.error=new(n||TypeError)(t),e}function Kt(e){return new e.Collection(e,function(){return wo("")}).limit(0)}function An(e,t,n,r){var o,s,u,l,p,y,x,d=n.length;if(!n.every(function(b){return typeof b=="string"}))return rt(e,fo);function j(b){o=b==="next"?function(v){return v.toUpperCase()}:function(v){return v.toLowerCase()},s=b==="next"?function(v){return v.toLowerCase()}:function(v){return v.toUpperCase()},u=b==="next"?pa:ma;var w=n.map(function(v){return{lower:s(v),upper:o(v)}}).sort(function(v,_){return u(v.lower,_.lower)});l=w.map(function(v){return v.upper}),p=w.map(function(v){return v.lower}),x=(y=b)==="next"?"":r}j("next"),e=new e.Collection(e,function(){return xt(l[0],p[d-1]+r)}),e._ondirectionchange=function(b){j(b)};var g=0;return e._addAlgorithm(function(b,w,v){var _=b.key;if(typeof _!="string")return!1;var C=s(_);if(t(C,p,g))return!0;for(var A=null,S=g;S<d;++S){var R=function(K,M,D,H,B,V){for(var le=Math.min(K.length,H.length),fe=-1,de=0;de<le;++de){var ot=M[de];if(ot!==H[de])return B(K[de],D[de])<0?K.substr(0,de)+D[de]+D.substr(de+1):B(K[de],H[de])<0?K.substr(0,de)+H[de]+D.substr(de+1):0<=fe?K.substr(0,fe)+M[fe]+D.substr(fe+1):null;B(K[de],ot)<0&&(fe=de)}return le<H.length&&V==="next"?K+D.substr(K.length):le<K.length&&V==="prev"?K.substr(0,D.length):fe<0?null:K.substr(0,fe)+H[fe]+D.substr(fe+1)}(_,C,l[S],p[S],u,y);R===null&&A===null?g=S+1:(A===null||0<u(A,R))&&(A=R)}return w(A!==null?function(){b.continue(A+x)}:v),!1}),e}function xt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function wo(e){return{type:1,lower:e,upper:e}}var jo=(Object.defineProperty(Ue.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Ue.prototype.between=function(e,t,n,r){n=n!==!1,r=r===!0;try{return 0<this._cmp(e,t)||this._cmp(e,t)===0&&(n||r)&&(!n||!r)?Kt(this):new this.Collection(this,function(){return xt(e,t,!n,!r)})}catch{return rt(this,dt)}},Ue.prototype.equals=function(e){return e==null?rt(this,dt):new this.Collection(this,function(){return wo(e)})},Ue.prototype.above=function(e){return e==null?rt(this,dt):new this.Collection(this,function(){return xt(e,void 0,!0)})},Ue.prototype.aboveOrEqual=function(e){return e==null?rt(this,dt):new this.Collection(this,function(){return xt(e,void 0,!1)})},Ue.prototype.below=function(e){return e==null?rt(this,dt):new this.Collection(this,function(){return xt(void 0,e,!1,!0)})},Ue.prototype.belowOrEqual=function(e){return e==null?rt(this,dt):new this.Collection(this,function(){return xt(void 0,e)})},Ue.prototype.startsWith=function(e){return typeof e!="string"?rt(this,fo):this.between(e,e+At,!0,!0)},Ue.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):An(this,function(t,n){return t.indexOf(n[0])===0},[e],At)},Ue.prototype.equalsIgnoreCase=function(e){return An(this,function(t,n){return t===n[0]},[e],"")},Ue.prototype.anyOfIgnoreCase=function(){var e=We.apply(Pe,arguments);return e.length===0?Kt(this):An(this,function(t,n){return n.indexOf(t)!==-1},e,"")},Ue.prototype.startsWithAnyOfIgnoreCase=function(){var e=We.apply(Pe,arguments);return e.length===0?Kt(this):An(this,function(t,n){return n.some(function(r){return t.indexOf(r)===0})},e,At)},Ue.prototype.anyOf=function(){var e=this,t=We.apply(Pe,arguments),n=this._cmp;try{t.sort(n)}catch{return rt(this,dt)}if(t.length===0)return Kt(this);var r=new this.Collection(this,function(){return xt(t[0],t[t.length-1])});r._ondirectionchange=function(s){n=s==="next"?e._ascending:e._descending,t.sort(n)};var o=0;return r._addAlgorithm(function(s,u,l){for(var p=s.key;0<n(p,t[o]);)if(++o===t.length)return u(l),!1;return n(p,t[o])===0||(u(function(){s.continue(t[o])}),!1)}),r},Ue.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Ue.prototype.noneOf=function(){var e=We.apply(Pe,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return rt(this,dt)}var t=e.reduce(function(n,r){return n?n.concat([[n[n.length-1][1],r]]):[[-1/0,r]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Ue.prototype.inAnyRange=function(_,t){var n=this,r=this._cmp,o=this._ascending,s=this._descending,u=this._min,l=this._max;if(_.length===0)return Kt(this);if(!_.every(function(C){return C[0]!==void 0&&C[1]!==void 0&&o(C[0],C[1])<=0}))return rt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",F.InvalidArgument);var p=!t||t.includeLowers!==!1,y=t&&t.includeUppers===!0,x,d=o;function j(C,A){return d(C[0],A[0])}try{(x=_.reduce(function(C,A){for(var S=0,R=C.length;S<R;++S){var K=C[S];if(r(A[0],K[1])<0&&0<r(A[1],K[0])){K[0]=u(K[0],A[0]),K[1]=l(K[1],A[1]);break}}return S===R&&C.push(A),C},[])).sort(j)}catch{return rt(this,dt)}var g=0,b=y?function(C){return 0<o(C,x[g][1])}:function(C){return 0<=o(C,x[g][1])},w=p?function(C){return 0<s(C,x[g][0])}:function(C){return 0<=s(C,x[g][0])},v=b,_=new this.Collection(this,function(){return xt(x[0][0],x[x.length-1][1],!p,!y)});return _._ondirectionchange=function(C){d=C==="next"?(v=b,o):(v=w,s),x.sort(j)},_._addAlgorithm(function(C,A,S){for(var R,K=C.key;v(K);)if(++g===x.length)return A(S),!1;return!b(R=K)&&!w(R)||(n._cmp(K,x[g][1])===0||n._cmp(K,x[g][0])===0||A(function(){d===o?C.continue(x[g][0]):C.continue(x[g][1])}),!1)}),_},Ue.prototype.startsWithAnyOf=function(){var e=We.apply(Pe,arguments);return e.every(function(t){return typeof t=="string"})?e.length===0?Kt(this):this.inAnyRange(e.map(function(t){return[t,t+At]})):rt(this,"startsWithAnyOf() only works with strings")},Ue);function Ue(){}function lt(e){return Te(function(t){return Zt(t),e(t.target.error),!1})}function Zt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Xt="storagemutated",rr="x-storagemutated-1",wt=Jt(null,Xt),ga=(ct.prototype._lock=function(){return _e(!J.global),++this._reculock,this._reculock!==1||J.global||(J.lockOwnerFor=this),this},ct.prototype._unlock=function(){if(_e(!J.global),--this._reculock==0)for(J.global||(J.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Ct(e[1],e[0])}catch{}}return this},ct.prototype._locked=function(){return this._reculock&&J.lockOwnerFor!==this},ct.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(_e(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new F.DatabaseClosed(r);case"MissingAPIError":throw new F.MissingAPI(r.message,r);default:throw new F.OpenFailed(r)}if(!this.active)throw new F.TransactionInactive;return _e(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Te(function(o){Zt(o),t._reject(e.error)}),e.onabort=Te(function(o){Zt(o),t.active&&t._reject(new F.Abort(e.error)),t.active=!1,t.on("abort").fire(o)}),e.oncomplete=Te(function(){t.active=!1,t._resolve(),"mutatedParts"in e&&wt.storagemutated.fire(e.mutatedParts)}),this},ct.prototype._promise=function(e,t,n){var r=this;if(e==="readwrite"&&this.mode!=="readwrite")return qe(new F.ReadOnly("Transaction is readonly"));if(!this.active)return qe(new F.TransactionInactive);if(this._locked())return new z(function(s,u){r._blockedFuncs.push([function(){r._promise(e,t,n).then(s,u)},J])});if(n)return yt(function(){var s=new z(function(u,l){r._lock();var p=t(u,l,r);p&&p.then&&p.then(u,l)});return s.finally(function(){return r._unlock()}),s._lib=!0,s});var o=new z(function(s,u){var l=t(s,u,r);l&&l.then&&l.then(s,u)});return o._lib=!0,o},ct.prototype._root=function(){return this.parent?this.parent._root():this},ct.prototype.waitFor=function(e){var t,n=this._root(),r=z.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then(function(){return r}):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function s(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=s)}());var o=n._waitingFor;return new z(function(s,u){r.then(function(l){return n._waitingQueue.push(Te(s.bind(null,l)))},function(l){return n._waitingQueue.push(Te(u.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},ct.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new F.Abort))},ct.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(O(t,e))return t[e];var n=this.schema[e];if(!n)throw new F.NotFound("Table "+e+" not part of transaction");return n=new this.db.Table(e,n,this),n.core=this.db.core.table(e),t[e]=n},ct);function ct(){}function or(e,t,n,r,o,s,u){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:s,src:(n&&!u?"&":"")+(r?"*":"")+(o?"++":"")+_o(t)}}function _o(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function sr(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(o){return[o.name,o]},n.reduce(function(o,s,u){return u=r(s,u),u&&(o[u[0]]=u[1]),o},{}))};var r}var en=function(e){try{return e.only([[]]),en=function(){return[[]]},[[]]}catch{return en=function(){return At},At}};function ar(e){return e==null?function(){}:typeof e=="string"?(t=e).split(".").length===1?function(n){return n[t]}:function(n){return se(n,t)}:function(n){return se(n,e)};var t}function ko(e){return[].slice.call(e)}var ya=0;function tn(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function va(e,t,p){function r(v){if(v.type===3)return null;if(v.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var g=v.lower,b=v.upper,w=v.lowerOpen,v=v.upperOpen;return g===void 0?b===void 0?null:t.upperBound(b,!!v):b===void 0?t.lowerBound(g,!!w):t.bound(g,b,!!w,!!v)}function o(j){var g,b=j.name;return{name:b,schema:j,mutate:function(w){var v=w.trans,_=w.type,C=w.keys,A=w.values,S=w.range;return new Promise(function(R,K){R=Te(R);var M=v.objectStore(b),D=M.keyPath==null,H=_==="put"||_==="add";if(!H&&_!=="delete"&&_!=="deleteRange")throw new Error("Invalid operation type: "+_);var B,V=(C||A||{length:1}).length;if(C&&A&&C.length!==A.length)throw new Error("Given keys array must have same length as given values array.");if(V===0)return R({numFailures:0,failures:{},results:[],lastResult:void 0});function le(Ze){++ot,Zt(Ze)}var fe=[],de=[],ot=0;if(_==="deleteRange"){if(S.type===4)return R({numFailures:ot,failures:de,results:[],lastResult:void 0});S.type===3?fe.push(B=M.clear()):fe.push(B=M.delete(r(S)))}else{var D=H?D?[A,C]:[A,null]:[C,null],ie=D[0],Ye=D[1];if(H)for(var Ge=0;Ge<V;++Ge)fe.push(B=Ye&&Ye[Ge]!==void 0?M[_](ie[Ge],Ye[Ge]):M[_](ie[Ge])),B.onerror=le;else for(Ge=0;Ge<V;++Ge)fe.push(B=M[_](ie[Ge])),B.onerror=le}function Kn(Ze){Ze=Ze.target.result,fe.forEach(function(Ot,kr){return Ot.error!=null&&(de[kr]=Ot.error)}),R({numFailures:ot,failures:de,results:_==="delete"?C:fe.map(function(Ot){return Ot.result}),lastResult:Ze})}B.onerror=function(Ze){le(Ze),Kn(Ze)},B.onsuccess=Kn})},getMany:function(w){var v=w.trans,_=w.keys;return new Promise(function(C,A){C=Te(C);for(var S,R=v.objectStore(b),K=_.length,M=new Array(K),D=0,H=0,B=function(fe){fe=fe.target,M[fe._pos]=fe.result,++H===D&&C(M)},V=lt(A),le=0;le<K;++le)_[le]!=null&&((S=R.get(_[le]))._pos=le,S.onsuccess=B,S.onerror=V,++D);D===0&&C(M)})},get:function(w){var v=w.trans,_=w.key;return new Promise(function(C,A){C=Te(C);var S=v.objectStore(b).get(_);S.onsuccess=function(R){return C(R.target.result)},S.onerror=lt(A)})},query:(g=y,function(w){return new Promise(function(v,_){v=Te(v);var C,A,S,D=w.trans,R=w.values,K=w.limit,B=w.query,M=K===1/0?void 0:K,H=B.index,B=B.range,D=D.objectStore(b),H=H.isPrimaryKey?D:D.index(H.name),B=r(B);if(K===0)return v({result:[]});g?((M=R?H.getAll(B,M):H.getAllKeys(B,M)).onsuccess=function(V){return v({result:V.target.result})},M.onerror=lt(_)):(C=0,A=!R&&"openKeyCursor"in H?H.openKeyCursor(B):H.openCursor(B),S=[],A.onsuccess=function(V){var le=A.result;return le?(S.push(R?le.value:le.primaryKey),++C===K?v({result:S}):void le.continue()):v({result:S})},A.onerror=lt(_))})}),openCursor:function(w){var v=w.trans,_=w.values,C=w.query,A=w.reverse,S=w.unique;return new Promise(function(R,K){R=Te(R);var H=C.index,M=C.range,D=v.objectStore(b),D=H.isPrimaryKey?D:D.index(H.name),H=A?S?"prevunique":"prev":S?"nextunique":"next",B=!_&&"openKeyCursor"in D?D.openKeyCursor(r(M),H):D.openCursor(r(M),H);B.onerror=lt(K),B.onsuccess=Te(function(V){var le,fe,de,ot,ie=B.result;ie?(ie.___id=++ya,ie.done=!1,le=ie.continue.bind(ie),fe=(fe=ie.continuePrimaryKey)&&fe.bind(ie),de=ie.advance.bind(ie),ot=function(){throw new Error("Cursor not stopped")},ie.trans=v,ie.stop=ie.continue=ie.continuePrimaryKey=ie.advance=function(){throw new Error("Cursor not started")},ie.fail=Te(K),ie.next=function(){var Ye=this,Ge=1;return this.start(function(){return Ge--?Ye.continue():Ye.stop()}).then(function(){return Ye})},ie.start=function(Ye){function Ge(){if(B.result)try{Ye()}catch(Ze){ie.fail(Ze)}else ie.done=!0,ie.start=function(){throw new Error("Cursor behind last entry")},ie.stop()}var Kn=new Promise(function(Ze,Ot){Ze=Te(Ze),B.onerror=lt(Ot),ie.fail=Ot,ie.stop=function(kr){ie.stop=ie.continue=ie.continuePrimaryKey=ie.advance=ot,Ze(kr)}});return B.onsuccess=Te(function(Ze){B.onsuccess=Ge,Ge()}),ie.continue=le,ie.continuePrimaryKey=fe,ie.advance=de,Ge(),Kn},R(ie)):R(null)},K)})},count:function(w){var v=w.query,_=w.trans,C=v.index,A=v.range;return new Promise(function(S,R){var K=_.objectStore(b),M=C.isPrimaryKey?K:K.index(C.name),K=r(A),M=K?M.count(K):M.count();M.onsuccess=Te(function(D){return S(D.target.result)}),M.onerror=lt(R)})}}}var s,u,l,x=(u=p,l=ko((s=e).objectStoreNames),{schema:{name:s.name,tables:l.map(function(j){return u.objectStore(j)}).map(function(j){var g=j.keyPath,v=j.autoIncrement,b=P(g),w={},v={name:j.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:g==null,compound:b,keyPath:g,autoIncrement:v,unique:!0,extractKey:ar(g)},indexes:ko(j.indexNames).map(function(_){return j.index(_)}).map(function(S){var C=S.name,A=S.unique,R=S.multiEntry,S=S.keyPath,R={name:C,compound:P(S),keyPath:S,unique:A,multiEntry:R,extractKey:ar(S)};return w[tn(S)]=R}),getIndexByKeyPath:function(_){return w[tn(_)]}};return w[":id"]=v.primaryKey,g!=null&&(w[tn(g)]=v.primaryKey),v})},hasGetAll:0<l.length&&"getAll"in u.objectStore(l[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),p=x.schema,y=x.hasGetAll,x=p.tables.map(o),d={};return x.forEach(function(j){return d[j.name]=j}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(j){if(!d[j])throw new Error("Table '".concat(j,"' not found"));return d[j]},MIN_KEY:-1/0,MAX_KEY:en(t),schema:p}}function ba(e,t,n,r){var o=n.IDBKeyRange;return n.indexedDB,{dbcore:(r=va(t,o,r),e.dbcore.reduce(function(s,u){return u=u.create,m(m({},s),u(s))},r))}}function En(e,r){var n=r.db,r=ba(e._middlewares,n,e._deps,r);e.core=r.dbcore,e.tables.forEach(function(o){var s=o.name;e.core.schema.tables.some(function(u){return u.name===s})&&(o.core=e.core.table(s),e[s]instanceof e.Table&&(e[s].core=o.core))})}function Nn(e,t,n,r){n.forEach(function(o){var s=r[o];t.forEach(function(u){var l=function p(y,x){return W(y,x)||(y=L(y))&&p(y,x)}(u,o);(!l||"value"in l&&l.value===void 0)&&(u===e.Transaction.prototype||u instanceof e.Transaction?q(u,o,{get:function(){return this.table(o)},set:function(p){re(this,o,{value:p,writable:!0,configurable:!0,enumerable:!0})}}):u[o]=new e.Table(o,s))})})}function ir(e,t){t.forEach(function(n){for(var r in n)n[r]instanceof e.Table&&delete n[r]})}function xa(e,t){return e._cfg.version-t._cfg.version}function wa(e,t,n,r){var o=e._dbSchema;n.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=sr("$meta",Ao("")[0],[]),e._storeNames.push("$meta"));var s=e._createTransaction("readwrite",e._storeNames,o);s.create(n),s._completion.catch(r);var u=s._reject.bind(s),l=J.transless||J;yt(function(){return J.trans=s,J.transless=l,t!==0?(En(e,n),y=t,((p=s).storeNames.includes("$meta")?p.table("$meta").get("version").then(function(x){return x??y}):z.resolve(y)).then(function(x){return j=x,g=s,b=n,w=[],x=(d=e)._versions,v=d._dbSchema=On(0,d.idbdb,b),(x=x.filter(function(_){return _._cfg.version>=j})).length!==0?(x.forEach(function(_){w.push(function(){var C=v,A=_._cfg.dbschema;Pn(d,C,b),Pn(d,A,b),v=d._dbSchema=A;var S=ur(C,A);S.add.forEach(function(H){lr(b,H[0],H[1].primKey,H[1].indexes)}),S.change.forEach(function(H){if(H.recreate)throw new F.Upgrade("Not yet support for changing primary key");var B=b.objectStore(H.name);H.add.forEach(function(V){return Sn(B,V)}),H.change.forEach(function(V){B.deleteIndex(V.name),Sn(B,V)}),H.del.forEach(function(V){return B.deleteIndex(V)})});var R=_._cfg.contentUpgrade;if(R&&_._cfg.version>j){En(d,b),g._memoizedTables={};var K=Oe(A);S.del.forEach(function(H){K[H]=C[H]}),ir(d,[d.Transaction.prototype]),Nn(d,[d.Transaction.prototype],N(K),K),g.schema=K;var M,D=te(R);return D&&Dt(),S=z.follow(function(){var H;(M=R(g))&&D&&(H=vt.bind(null,null),M.then(H,H))}),M&&typeof M.then=="function"?z.resolve(M):S.then(function(){return M})}}),w.push(function(C){var A,S,R=_._cfg.dbschema;A=R,S=C,[].slice.call(S.db.objectStoreNames).forEach(function(K){return A[K]==null&&S.db.deleteObjectStore(K)}),ir(d,[d.Transaction.prototype]),Nn(d,[d.Transaction.prototype],d._storeNames,d._dbSchema),g.schema=d._dbSchema}),w.push(function(C){d.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(d.idbdb.version/10)===_._cfg.version?(d.idbdb.deleteObjectStore("$meta"),delete d._dbSchema.$meta,d._storeNames=d._storeNames.filter(function(A){return A!=="$meta"})):C.objectStore("$meta").put(_._cfg.version,"version"))})}),function _(){return w.length?z.resolve(w.shift()(g.idbtrans)).then(_):z.resolve()}().then(function(){Co(v,b)})):z.resolve();var d,j,g,b,w,v}).catch(u)):(N(o).forEach(function(x){lr(n,x,o[x].primKey,o[x].indexes)}),En(e,n),void z.follow(function(){return e.on.populate.fire(s)}).catch(u));var p,y})}function ja(e,t){Co(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=On(0,e.idbdb,t);Pn(e,e._dbSchema,t);for(var r=0,o=ur(n,e._dbSchema).change;r<o.length;r++){var s=function(u){if(u.change.length||u.recreate)return console.warn("Unable to patch indexes of table ".concat(u.name," because it has changes on the type of index or primary key.")),{value:void 0};var l=t.objectStore(u.name);u.add.forEach(function(p){h&&console.debug("Dexie upgrade patch: Creating missing index ".concat(u.name,".").concat(p.src)),Sn(l,p)})}(o[r]);if(typeof s=="object")return s.value}}function ur(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],s=t[n];if(o){var u={name:n,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||o.primKey.auto!==s.primKey.auto)u.recreate=!0,r.change.push(u);else{var l=o.idxByName,p=s.idxByName,y=void 0;for(y in l)p[y]||u.del.push(y);for(y in p){var x=l[y],d=p[y];x?x.src!==d.src&&u.change.push(d):u.add.push(d)}(0<u.del.length||0<u.add.length||0<u.change.length)&&r.change.push(u)}}else r.add.push([n,s])}return r}function lr(e,t,n,r){var o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(s){return Sn(o,s)}),o}function Co(e,t){N(e).forEach(function(n){t.db.objectStoreNames.contains(n)||(h&&console.debug("Dexie: Creating missing table",n),lr(t,n,e[n].primKey,e[n].indexes))})}function Sn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function On(e,t,n){var r={};return ee(t.objectStoreNames,0).forEach(function(o){for(var s=n.objectStore(o),u=or(_o(y=s.keyPath),y||"",!0,!1,!!s.autoIncrement,y&&typeof y!="string",!0),l=[],p=0;p<s.indexNames.length;++p){var x=s.index(s.indexNames[p]),y=x.keyPath,x=or(x.name,y,!!x.unique,!!x.multiEntry,!1,y&&typeof y!="string",!1);l.push(x)}r[o]=sr(o,u,l)}),r}function Pn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var s=r[o],u=n.objectStore(s);e._hasGetAll="getAll"in u;for(var l=0;l<u.indexNames.length;++l){var p=u.indexNames[l],y=u.index(p).keyPath,x=typeof y=="string"?y:"["+ee(y).join("+")+"]";!t[s]||(y=t[s].idxByName[x])&&(y.name=p,delete t[s].idxByName[x],t[s].idxByName[p]=y)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&E.WorkerGlobalScope&&E instanceof E.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function Ao(e){return e.split(",").map(function(t,n){var r=(t=t.trim()).replace(/([&*]|\+\+)/g,""),o=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return or(r,o||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),P(o),n===0)})}var _a=(Tn.prototype._parseStoresSpec=function(e,t){N(e).forEach(function(n){if(e[n]!==null){var r=Ao(e[n]),o=r.shift();if(o.unique=!0,o.multi)throw new F.Schema("Primary key cannot be multi-valued");r.forEach(function(s){if(s.auto)throw new F.Schema("Only primary key can be marked as autoIncrement (++)");if(!s.keyPath)throw new F.Schema("Index must have a name and cannot be an empty string")}),t[n]=sr(n,o,r)}})},Tn.prototype.stores=function(n){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?I(this._cfg.storesSource,n):n;var n=t._versions,r={},o={};return n.forEach(function(s){I(r,s._cfg.storesSource),o=s._cfg.dbschema={},s._parseStoresSpec(r,o)}),t._dbSchema=o,ir(t,[t._allTables,t,t.Transaction.prototype]),Nn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],N(o),o),t._storeNames=N(o),this},Tn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=Rt(this._cfg.contentUpgrade||oe,e),this},Tn);function Tn(){}function cr(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ht(jn,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function fr(e){return e&&typeof e.databases=="function"}function dr(e){return yt(function(){return J.letThrough=!0,e()})}function hr(e){return!("from"in e)}var Je=function(e,t){if(!this){var n=new Je;return e&&"d"in e&&I(n,e),n}I(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function nn(e,t,n){var r=me(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(hr(e))return I(e,{from:t,to:n,d:1});var o=e.l,r=e.r;if(me(n,e.from)<0)return o?nn(o,t,n):e.l={from:t,to:n,d:1,l:null,r:null},No(e);if(0<me(t,e.to))return r?nn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},No(e);me(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<me(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,o&&!e.l&&rn(e,o),r&&n&&rn(e,r)}}function rn(e,t){hr(t)||function n(r,p){var s=p.from,u=p.to,l=p.l,p=p.r;nn(r,s,u),l&&n(r,l),p&&n(r,p)}(e,t)}function Eo(e,t){var n=Rn(t),r=n.next();if(r.done)return!1;for(var o=r.value,s=Rn(e),u=s.next(o.from),l=u.value;!r.done&&!u.done;){if(me(l.from,o.to)<=0&&0<=me(l.to,o.from))return!0;me(o.from,l.from)<0?o=(r=n.next(l.from)).value:l=(u=s.next(o.from)).value}return!1}function Rn(e){var t=hr(e)?null:{s:0,n:e};return{next:function(n){for(var r=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&me(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||me(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function No(e){var t,n,r=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((n=e.l)===null||n===void 0?void 0:n.d)||0),o=1<r?"r":r<-1?"l":"";o&&(t=o=="r"?"l":"r",n=m({},e),r=e[o],e.from=r.from,e.to=r.to,e[o]=r[o],n[o]=r[t],(e[t]=n).d=So(n)),e.d=So(e)}function So(n){var t=n.r,n=n.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function Mn(e,t){return N(t).forEach(function(n){e[n]?rn(e[n],t[n]):e[n]=function r(o){var s,u,l={};for(s in o)O(o,s)&&(u=o[s],l[s]=!u||typeof u!="object"||be.has(u.constructor)?u:r(u));return l}(t[n])}),e}function pr(e,t){return e.all||t.all||Object.keys(e).some(function(n){return t[n]&&Eo(t[n],e[n])})}Q(Je.prototype,((it={add:function(e){return rn(this,e),this},addKey:function(e){return nn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return nn(t,n,n)}),this},hasKey:function(e){var t=Rn(this).next(e).value;return t&&me(t.from,e)<=0&&0<=me(t.to,e)}})[ve]=function(){return Rn(this)},it));var Nt={},mr={},gr=!1;function In(e){Mn(mr,e),gr||(gr=!0,setTimeout(function(){gr=!1,yr(mr,!(mr={}))},0))}function yr(e,t){t===void 0&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(Nt);r<o.length;r++)Oo(u=o[r],e,n,t);else for(var s in e){var u,l=/^idb\:\/\/(.*)\/(.*)\//.exec(s);l&&(s=l[1],l=l[2],(u=Nt["idb://".concat(s,"/").concat(l)])&&Oo(u,e,n,t))}n.forEach(function(p){return p()})}function Oo(e,t,n,r){for(var o=[],s=0,u=Object.entries(e.queries.query);s<u.length;s++){for(var l=u[s],p=l[0],y=[],x=0,d=l[1];x<d.length;x++){var j=d[x];pr(t,j.obsSet)?j.subscribers.forEach(function(v){return n.add(v)}):r&&y.push(j)}r&&o.push([p,y])}if(r)for(var g=0,b=o;g<b.length;g++){var w=b[g],p=w[0],y=w[1];e.queries.query[p]=y}}function ka(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?qe(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,o=Math.round(10*e.verno),s=!1;function u(){if(t.openCanceller!==r)throw new F.DatabaseClosed("db.open() was cancelled")}function l(){return new z(function(j,g){if(u(),!n)throw new F.MissingAPI;var b=e.name,w=t.autoSchema||!o?n.open(b):n.open(b,o);if(!w)throw new F.MissingAPI;w.onerror=lt(g),w.onblocked=Te(e._fireOnBlocked),w.onupgradeneeded=Te(function(v){var _;x=w.transaction,t.autoSchema&&!e._options.allowEmptyDB?(w.onerror=Zt,x.abort(),w.result.close(),(_=n.deleteDatabase(b)).onsuccess=_.onerror=Te(function(){g(new F.NoSuchDatabase("Database ".concat(b," doesnt exist")))})):(x.onerror=lt(g),v=v.oldVersion>Math.pow(2,62)?0:v.oldVersion,d=v<1,e.idbdb=w.result,s&&ja(e,x),wa(e,v/10,x,g))},g),w.onsuccess=Te(function(){x=null;var v,_,C,A,S,R=e.idbdb=w.result,K=ee(R.objectStoreNames);if(0<K.length)try{var M=R.transaction((A=K).length===1?A[0]:A,"readonly");if(t.autoSchema)_=R,C=M,(v=e).verno=_.version/10,C=v._dbSchema=On(0,_,C),v._storeNames=ee(_.objectStoreNames,0),Nn(v,[v._allTables],N(C),C);else if(Pn(e,e._dbSchema,M),((S=ur(On(0,(S=e).idbdb,M),S._dbSchema)).add.length||S.change.some(function(D){return D.add.length||D.change.length}))&&!s)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."),R.close(),o=R.version+1,s=!0,j(l());En(e,M)}catch{}qt.push(e),R.onversionchange=Te(function(D){t.vcFired=!0,e.on("versionchange").fire(D)}),R.onclose=Te(function(D){e.on("close").fire(D)}),d&&(S=e._deps,M=b,R=S.indexedDB,S=S.IDBKeyRange,fr(R)||M===jn||cr(R,S).put({name:M}).catch(oe)),j()},g)}).catch(function(j){switch(j==null?void 0:j.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),l();break;case"VersionError":if(0<o)return o=0,l()}return z.reject(j)})}var p,y=t.dbReadyResolve,x=null,d=!1;return z.race([r,(typeof navigator>"u"?z.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(j){function g(){return indexedDB.databases().finally(j)}p=setInterval(g,100),g()}).finally(function(){return clearInterval(p)}):Promise.resolve()).then(l)]).then(function(){return u(),t.onReadyBeingFired=[],z.resolve(dr(function(){return e.on.ready.fire(e.vip)})).then(function j(){if(0<t.onReadyBeingFired.length){var g=t.onReadyBeingFired.reduce(Rt,oe);return t.onReadyBeingFired=[],z.resolve(dr(function(){return g(e.vip)})).then(j)}})}).finally(function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(j){t.dbOpenError=j;try{x&&x.abort()}catch{}return r===t.openCanceller&&e._close(),qe(j)}).finally(function(){t.openComplete=!0,y()}).then(function(){var j;return d&&(j={},e.tables.forEach(function(g){g.schema.indexes.forEach(function(b){b.name&&(j["idb://".concat(e.name,"/").concat(g.name,"/").concat(b.name)]=new Je(-1/0,[[[]]]))}),j["idb://".concat(e.name,"/").concat(g.name,"/")]=j["idb://".concat(e.name,"/").concat(g.name,"/:dels")]=new Je(-1/0,[[[]]])}),wt(Xt).fire(j),yr(j,!0)),e})}function vr(e){function t(s){return e.next(s)}var n=o(t),r=o(function(s){return e.throw(s)});function o(s){return function(p){var l=s(p),p=l.value;return l.done?p:p&&typeof p.then=="function"?p.then(n,r):P(p)?Promise.all(p).then(n,r):n(p)}}return o(t)()}function Dn(e,t,n){for(var r=P(e)?e.slice():[e],o=0;o<n;++o)r.push(t);return r}var Ca={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return m(m({},e),{table:function(t){var n=e.table(t),r=n.schema,o={},s=[];function u(d,j,g){var b=tn(d),w=o[b]=o[b]||[],v=d==null?0:typeof d=="string"?1:d.length,_=0<j,_=m(m({},g),{name:_?"".concat(b,"(virtual-from:").concat(g.name,")"):g.name,lowLevelIndex:g,isVirtual:_,keyTail:j,keyLength:v,extractKey:ar(d),unique:!_&&g.unique});return w.push(_),_.isPrimaryKey||s.push(_),1<v&&u(v===2?d[0]:d.slice(0,v-1),j+1,g),w.sort(function(C,A){return C.keyTail-A.keyTail}),_}t=u(r.primaryKey.keyPath,0,r.primaryKey),o[":id"]=[t];for(var l=0,p=r.indexes;l<p.length;l++){var y=p[l];u(y.keyPath,0,y)}function x(d){var j,g=d.query.index;return g.isVirtual?m(m({},d),{query:{index:g.lowLevelIndex,range:(j=d.query.range,g=g.keyTail,{type:j.type===1?2:j.type,lower:Dn(j.lower,j.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:Dn(j.upper,j.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0})}}):d}return m(m({},n),{schema:m(m({},r),{primaryKey:t,indexes:s,getIndexByKeyPath:function(d){return(d=o[tn(d)])&&d[0]}}),count:function(d){return n.count(x(d))},query:function(d){return n.query(x(d))},openCursor:function(d){var j=d.query.index,g=j.keyTail,b=j.isVirtual,w=j.keyLength;return b?n.openCursor(x(d)).then(function(_){return _&&v(_)}):n.openCursor(d);function v(_){return Object.create(_,{continue:{value:function(C){C!=null?_.continue(Dn(C,d.reverse?e.MAX_KEY:e.MIN_KEY,g)):d.unique?_.continue(_.key.slice(0,w).concat(d.reverse?e.MIN_KEY:e.MAX_KEY,g)):_.continue()}},continuePrimaryKey:{value:function(C,A){_.continuePrimaryKey(Dn(C,e.MAX_KEY,g),A)}},primaryKey:{get:function(){return _.primaryKey}},key:{get:function(){var C=_.key;return w===1?C[0]:C.slice(0,w)}},value:{get:function(){return _.value}}})}}})}})}};function br(e,t,n,r){return n=n||{},r=r||"",N(e).forEach(function(o){var s,u,l;O(t,o)?(s=e[o],u=t[o],typeof s=="object"&&typeof u=="object"&&s&&u?(l=X(s))!==X(u)?n[r+o]=t[o]:l==="Object"?br(s,u,n,r+o+"."):s!==u&&(n[r+o]=t[o]):s!==u&&(n[r+o]=t[o])):n[r+o]=void 0}),N(t).forEach(function(o){O(e,o)||(n[r+o]=t[o])}),n}function xr(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Aa={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return m(m({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey;return m(m({},n),{mutate:function(o){var s=J.trans,u=s.table(t).hook,l=u.deleting,p=u.creating,y=u.updating;switch(o.type){case"add":if(p.fire===oe)break;return s._promise("readwrite",function(){return x(o)},!0);case"put":if(p.fire===oe&&y.fire===oe)break;return s._promise("readwrite",function(){return x(o)},!0);case"delete":if(l.fire===oe)break;return s._promise("readwrite",function(){return x(o)},!0);case"deleteRange":if(l.fire===oe)break;return s._promise("readwrite",function(){return function d(j,g,b){return n.query({trans:j,values:!1,query:{index:r,range:g},limit:b}).then(function(w){var v=w.result;return x({type:"delete",keys:v,trans:j}).then(function(_){return 0<_.numFailures?Promise.reject(_.failures[0]):v.length<b?{failures:[],numFailures:0,lastResult:void 0}:d(j,m(m({},g),{lower:v[v.length-1],lowerOpen:!0}),b)})})}(o.trans,o.range,1e4)},!0)}return n.mutate(o);function x(d){var j,g,b,w=J.trans,v=d.keys||xr(r,d);if(!v)throw new Error("Keys missing");return(d=d.type==="add"||d.type==="put"?m(m({},d),{keys:v}):m({},d)).type!=="delete"&&(d.values=k([],d.values)),d.keys&&(d.keys=k([],d.keys)),j=n,b=v,((g=d).type==="add"?Promise.resolve([]):j.getMany({trans:g.trans,keys:b,cache:"immutable"})).then(function(_){var C=v.map(function(A,S){var R,K,M,D=_[S],H={onerror:null,onsuccess:null};return d.type==="delete"?l.fire.call(H,A,D,w):d.type==="add"||D===void 0?(R=p.fire.call(H,A,d.values[S],w),A==null&&R!=null&&(d.keys[S]=A=R,r.outbound||ae(d.values[S],r.keyPath,A))):(R=br(D,d.values[S]),(K=y.fire.call(H,R,A,D,w))&&(M=d.values[S],Object.keys(K).forEach(function(B){O(M,B)?M[B]=K[B]:ae(M,B,K[B])}))),H});return n.mutate(d).then(function(A){for(var S=A.failures,R=A.results,K=A.numFailures,A=A.lastResult,M=0;M<v.length;++M){var D=(R||v)[M],H=C[M];D==null?H.onerror&&H.onerror(S[M]):H.onsuccess&&H.onsuccess(d.type==="put"&&_[M]?d.values[M]:D)}return{failures:S,results:R,numFailures:K,lastResult:A}}).catch(function(A){return C.forEach(function(S){return S.onerror&&S.onerror(A)}),Promise.reject(A)})})}}})}})}};function Po(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],o=0,s=0;o<t.keys.length&&s<e.length;++o)me(t.keys[o],e[s])===0&&(r.push(n?Re(t.values[o]):t.values[o]),++s);return r.length===e.length?r:null}catch{return null}}var Ea={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return m(m({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var o=Po(r.keys,r.trans._cache,r.cache==="clone");return o?z.resolve(o):n.getMany(r).then(function(s){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Re(s):s},s})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}};function To(e,t){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!t.schema.primaryKey.outbound}function Ro(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Na={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,n=new Je(e.MIN_KEY,e.MAX_KEY);return m(m({},e),{transaction:function(r,o,s){if(J.subscr&&o!=="readonly")throw new F.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(J.querier));return e.transaction(r,o,s)},table:function(r){var o=e.table(r),s=o.schema,u=s.primaryKey,d=s.indexes,l=u.extractKey,p=u.outbound,y=u.autoIncrement&&d.filter(function(g){return g.compound&&g.keyPath.includes(u.keyPath)}),x=m(m({},o),{mutate:function(g){function b(B){return B="idb://".concat(t,"/").concat(r,"/").concat(B),A[B]||(A[B]=new Je)}var w,v,_,C=g.trans,A=g.mutatedParts||(g.mutatedParts={}),S=b(""),R=b(":dels"),K=g.type,H=g.type==="deleteRange"?[g.range]:g.type==="delete"?[g.keys]:g.values.length<50?[xr(u,g).filter(function(B){return B}),g.values]:[],M=H[0],D=H[1],H=g.trans._cache;return P(M)?(S.addKeys(M),(H=K==="delete"||M.length===D.length?Po(M,H):null)||R.addKeys(M),(H||D)&&(w=b,v=H,_=D,s.indexes.forEach(function(B){var V=w(B.name||"");function le(de){return de!=null?B.extractKey(de):null}function fe(de){return B.multiEntry&&P(de)?de.forEach(function(ot){return V.addKey(ot)}):V.addKey(de)}(v||_).forEach(function(de,Ye){var ie=v&&le(v[Ye]),Ye=_&&le(_[Ye]);me(ie,Ye)!==0&&(ie!=null&&fe(ie),Ye!=null&&fe(Ye))})}))):M?(D={from:(D=M.lower)!==null&&D!==void 0?D:e.MIN_KEY,to:(D=M.upper)!==null&&D!==void 0?D:e.MAX_KEY},R.add(D),S.add(D)):(S.add(n),R.add(n),s.indexes.forEach(function(B){return b(B.name).add(n)})),o.mutate(g).then(function(B){return!M||g.type!=="add"&&g.type!=="put"||(S.addKeys(B.results),y&&y.forEach(function(V){for(var le=g.values.map(function(ie){return V.extractKey(ie)}),fe=V.keyPath.findIndex(function(ie){return ie===u.keyPath}),de=0,ot=B.results.length;de<ot;++de)le[de][fe]=B.results[de];b(V.name).addKeys(le)})),C.mutatedParts=Mn(C.mutatedParts||{},A),B})}}),d=function(b){var w=b.query,b=w.index,w=w.range;return[b,new Je((b=w.lower)!==null&&b!==void 0?b:e.MIN_KEY,(w=w.upper)!==null&&w!==void 0?w:e.MAX_KEY)]},j={get:function(g){return[u,new Je(g.key)]},getMany:function(g){return[u,new Je().addKeys(g.keys)]},count:d,query:d,openCursor:d};return N(j).forEach(function(g){x[g]=function(b){var w=J.subscr,v=!!w,_=To(J,o)&&Ro(g,b)?b.obsSet={}:w;if(v){var C=function(D){return D="idb://".concat(t,"/").concat(r,"/").concat(D),_[D]||(_[D]=new Je)},A=C(""),S=C(":dels"),w=j[g](b),v=w[0],w=w[1];if((g==="query"&&v.isPrimaryKey&&!b.values?S:C(v.name||"")).add(w),!v.isPrimaryKey){if(g!=="count"){var R=g==="query"&&p&&b.values&&o.query(m(m({},b),{values:!1}));return o[g].apply(this,arguments).then(function(D){if(g==="query"){if(p&&b.values)return R.then(function(le){return le=le.result,A.addKeys(le),D});var H=b.values?D.result.map(l):D.result;(b.values?A:S).addKeys(H)}else if(g==="openCursor"){var B=D,V=b.values;return B&&Object.create(B,{key:{get:function(){return S.addKey(B.primaryKey),B.key}},primaryKey:{get:function(){var le=B.primaryKey;return S.addKey(le),le}},value:{get:function(){return V&&A.addKey(B.primaryKey),B.value}}})}return D})}S.add(n)}}return o[g].apply(this,arguments)}}),x}})}};function Mo(e,t,n){if(n.numFailures===0)return t;if(t.type==="deleteRange")return null;var r=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1;return n.numFailures===r?null:(t=m({},t),P(t.keys)&&(t.keys=t.keys.filter(function(o,s){return!(s in n.failures)})),"values"in t&&P(t.values)&&(t.values=t.values.filter(function(o,s){return!(s in n.failures)})),t)}function wr(e,t){return n=e,((r=t).lower===void 0||(r.lowerOpen?0<me(n,r.lower):0<=me(n,r.lower)))&&(e=e,(t=t).upper===void 0||(t.upperOpen?me(e,t.upper)<0:me(e,t.upper)<=0));var n,r}function Io(e,t,j,r,o,s){if(!j||j.length===0)return e;var u=t.query.index,l=u.multiEntry,p=t.query.range,y=r.schema.primaryKey.extractKey,x=u.extractKey,d=(u.lowLevelIndex||u).extractKey,j=j.reduce(function(g,b){var w=g,v=[];if(b.type==="add"||b.type==="put")for(var _=new Je,C=b.values.length-1;0<=C;--C){var A,S=b.values[C],R=y(S);_.hasKey(R)||(A=x(S),(l&&P(A)?A.some(function(B){return wr(B,p)}):wr(A,p))&&(_.addKey(R),v.push(S)))}switch(b.type){case"add":var K=new Je().addKeys(t.values?g.map(function(V){return y(V)}):g),w=g.concat(t.values?v.filter(function(V){return V=y(V),!K.hasKey(V)&&(K.addKey(V),!0)}):v.map(function(V){return y(V)}).filter(function(V){return!K.hasKey(V)&&(K.addKey(V),!0)}));break;case"put":var M=new Je().addKeys(b.values.map(function(V){return y(V)}));w=g.filter(function(V){return!M.hasKey(t.values?y(V):V)}).concat(t.values?v:v.map(function(V){return y(V)}));break;case"delete":var D=new Je().addKeys(b.keys);w=g.filter(function(V){return!D.hasKey(t.values?y(V):V)});break;case"deleteRange":var H=b.range;w=g.filter(function(V){return!wr(y(V),H)})}return w},e);return j===e?e:(j.sort(function(g,b){return me(d(g),d(b))||me(y(g),y(b))}),t.limit&&t.limit<1/0&&(j.length>t.limit?j.length=t.limit:e.length===t.limit&&j.length<t.limit&&(o.dirty=!0)),s?Object.freeze(j):j)}function Do(e,t){return me(e.lower,t.lower)===0&&me(e.upper,t.upper)===0&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Sa(e,t){return function(n,r,o,s){if(n===void 0)return r!==void 0?-1:0;if(r===void 0)return 1;if((r=me(n,r))===0){if(o&&s)return 0;if(o)return 1;if(s)return-1}return r}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(n,r,o,s){if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;if((r=me(n,r))===0){if(o&&s)return 0;if(o)return-1;if(s)return 1}return r}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Oa(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",function(){var o,s;e.subscribers.delete(n),e.subscribers.size===0&&(o=e,s=t,setTimeout(function(){o.subscribers.size===0&&Ie(s,o)},3e3))})}var Pa={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name;return m(m({},e),{transaction:function(n,r,o){var s,u,l=e.transaction(n,r,o);return r==="readwrite"&&(u=(s=new AbortController).signal,o=function(p){return function(){if(s.abort(),r==="readwrite"){for(var y=new Set,x=0,d=n;x<d.length;x++){var j=d[x],g=Nt["idb://".concat(t,"/").concat(j)];if(g){var b=e.table(j),w=g.optimisticOps.filter(function(V){return V.trans===l});if(l._explicit&&p&&l.mutatedParts)for(var v=0,_=Object.values(g.queries.query);v<_.length;v++)for(var C=0,A=(K=_[v]).slice();C<A.length;C++)pr((M=A[C]).obsSet,l.mutatedParts)&&(Ie(K,M),M.subscribers.forEach(function(V){return y.add(V)}));else if(0<w.length){g.optimisticOps=g.optimisticOps.filter(function(V){return V.trans!==l});for(var S=0,R=Object.values(g.queries.query);S<R.length;S++)for(var K,M,D,H=0,B=(K=R[S]).slice();H<B.length;H++)(M=B[H]).res!=null&&l.mutatedParts&&(p&&!M.dirty?(D=Object.isFrozen(M.res),D=Io(M.res,M.req,w,b,M,D),M.dirty?(Ie(K,M),M.subscribers.forEach(function(V){return y.add(V)})):D!==M.res&&(M.res=D,M.promise=z.resolve({result:D}))):(M.dirty&&Ie(K,M),M.subscribers.forEach(function(V){return y.add(V)})))}}}y.forEach(function(V){return V()})}}},l.addEventListener("abort",o(!1),{signal:u}),l.addEventListener("error",o(!1),{signal:u}),l.addEventListener("complete",o(!0),{signal:u})),l},table:function(n){var r=e.table(n),o=r.schema.primaryKey;return m(m({},r),{mutate:function(s){var u=J.trans;if(o.outbound||u.db._options.cache==="disabled"||u.explicit||u.idbtrans.mode!=="readwrite")return r.mutate(s);var l=Nt["idb://".concat(t,"/").concat(n)];return l?(u=r.mutate(s),s.type!=="add"&&s.type!=="put"||!(50<=s.values.length||xr(o,s).some(function(p){return p==null}))?(l.optimisticOps.push(s),s.mutatedParts&&In(s.mutatedParts),u.then(function(p){0<p.numFailures&&(Ie(l.optimisticOps,s),(p=Mo(0,s,p))&&l.optimisticOps.push(p),s.mutatedParts&&In(s.mutatedParts))}),u.catch(function(){Ie(l.optimisticOps,s),s.mutatedParts&&In(s.mutatedParts)})):u.then(function(p){var y=Mo(0,m(m({},s),{values:s.values.map(function(x,d){var j;return p.failures[d]?x:(x=(j=o.keyPath)!==null&&j!==void 0&&j.includes(".")?Re(x):m({},x),ae(x,o.keyPath,p.results[d]),x)})}),p);l.optimisticOps.push(y),queueMicrotask(function(){return s.mutatedParts&&In(s.mutatedParts)})}),u):r.mutate(s)},query:function(s){if(!To(J,r)||!Ro("query",s))return r.query(s);var u=((y=J.trans)===null||y===void 0?void 0:y.db._options.cache)==="immutable",d=J,l=d.requery,p=d.signal,y=function(b,w,v,_){var C=Nt["idb://".concat(b,"/").concat(w)];if(!C)return[];if(!(w=C.queries[v]))return[null,!1,C,null];var A=w[(_.query?_.query.index.name:null)||""];if(!A)return[null,!1,C,null];switch(v){case"query":var S=A.find(function(R){return R.req.limit===_.limit&&R.req.values===_.values&&Do(R.req.query.range,_.query.range)});return S?[S,!0,C,A]:[A.find(function(R){return("limit"in R.req?R.req.limit:1/0)>=_.limit&&(!_.values||R.req.values)&&Sa(R.req.query.range,_.query.range)}),!1,C,A];case"count":return S=A.find(function(R){return Do(R.req.query.range,_.query.range)}),[S,!!S,C,A]}}(t,n,"query",s),x=y[0],d=y[1],j=y[2],g=y[3];return x&&d?x.obsSet=s.obsSet:(d=r.query(s).then(function(b){var w=b.result;if(x&&(x.res=w),u){for(var v=0,_=w.length;v<_;++v)Object.freeze(w[v]);Object.freeze(w)}else b.result=Re(w);return b}).catch(function(b){return g&&x&&Ie(g,x),Promise.reject(b)}),x={obsSet:s.obsSet,promise:d,subscribers:new Set,type:"query",req:s,dirty:!1},g?g.push(x):(g=[x],(j=j||(Nt["idb://".concat(t,"/").concat(n)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[s.query.index.name||""]=g)),Oa(x,g,l,p),x.promise.then(function(b){return{result:Io(b.result,s,j==null?void 0:j.optimisticOps,r,x,u)}})}})}})}};function qn(e,t){return new Proxy(e,{get:function(n,r,o){return r==="db"?t:Reflect.get(n,r,o)}})}var ht=(Be.prototype.version=function(e){if(isNaN(e)||e<.1)throw new F.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new F.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(r){return r._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(xa),n.stores({}),this._state.autoSchema=!1,n)},Be.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||J.letThrough||this._vip)?e():new z(function(n,r){if(t._state.openComplete)return r(new F.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void r(new F.DatabaseClosed);t.open().catch(oe)}t._state.dbReadyPromise.then(n,r)}).then(e)},Be.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,o=e.name;return o&&this.unuse({stack:t,name:o}),e=this._middlewares[t]||(this._middlewares[t]=[]),e.push({stack:t,create:n,level:r??10,name:o}),e.sort(function(s,u){return s.level-u.level}),this},Be.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(o){return r?o.create!==r:!!n&&o.name!==n})),this},Be.prototype.open=function(){var e=this;return Ct(ze,function(){return ka(e)})},Be.prototype._close=function(){var e=this._state,t=qt.indexOf(this);if(0<=t&&qt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new z(function(n){e.dbReadyResolve=n}),e.openCanceller=new z(function(n,r){e.cancelOpen=r}))},Be.prototype.close=function(n){var t=(n===void 0?{disableAutoOpen:!0}:n).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new F.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new F.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},Be.prototype.delete=function(e){var t=this;e===void 0&&(e={disableAutoOpen:!0});var n=0<arguments.length&&typeof arguments[0]!="object",r=this._state;return new z(function(o,s){function u(){t.close(e);var l=t._deps.indexedDB.deleteDatabase(t.name);l.onsuccess=Te(function(){var p,y,x;p=t._deps,y=t.name,x=p.indexedDB,p=p.IDBKeyRange,fr(x)||y===jn||cr(x,p).delete(y).catch(oe),o()}),l.onerror=lt(s),l.onblocked=t._fireOnBlocked}if(n)throw new F.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(u):u()})},Be.prototype.backendDB=function(){return this.idbdb},Be.prototype.isOpen=function(){return this.idbdb!==null},Be.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},Be.prototype.hasFailed=function(){return this._state.dbOpenError!==null},Be.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Be.prototype,"tables",{get:function(){var e=this;return N(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),Be.prototype.transaction=function(){var e=(function(t,n,r){var o=arguments.length;if(o<2)throw new F.InvalidArgument("Too few arguments");for(var s=new Array(o-1);--o;)s[o-1]=arguments[o];return r=s.pop(),[t,Z(s),r]}).apply(this,arguments);return this._transaction.apply(this,e)},Be.prototype._transaction=function(e,t,n){var r=this,o=J.trans;o&&o.db===this&&e.indexOf("!")===-1||(o=null);var s,u,l=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");try{if(u=t.map(function(y){if(y=y instanceof r.Table?y.name:y,typeof y!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return y}),e=="r"||e===Zn)s=Zn;else{if(e!="rw"&&e!=Xn)throw new F.InvalidArgument("Invalid transaction mode: "+e);s=Xn}if(o){if(o.mode===Zn&&s===Xn){if(!l)throw new F.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&u.forEach(function(y){if(o&&o.storeNames.indexOf(y)===-1){if(!l)throw new F.SubTransaction("Table "+y+" not included in parent transaction.");o=null}}),l&&o&&!o.active&&(o=null)}}catch(y){return o?o._promise(null,function(x,d){d(y)}):qe(y)}var p=(function y(x,d,j,g,b){return z.resolve().then(function(){var w=J.transless||J,v=x._createTransaction(d,j,x._dbSchema,g);if(v.explicit=!0,w={trans:v,transless:w},g)v.idbtrans=g.idbtrans;else try{v.create(),v.idbtrans._explicit=!0,x._state.PR1398_maxLoop=3}catch(A){return A.name===mt.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return y(x,d,j,null,b)})):qe(A)}var _,C=te(b);return C&&Dt(),w=z.follow(function(){var A;(_=b.call(v,v))&&(C?(A=vt.bind(null,null),_.then(A,A)):typeof _.next=="function"&&typeof _.throw=="function"&&(_=vr(_)))},w),(_&&typeof _.then=="function"?z.resolve(_).then(function(A){return v.active?A:qe(new F.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):w.then(function(){return _})).then(function(A){return g&&v._resolve(),v._completion.then(function(){return A})}).catch(function(A){return v._reject(A),qe(A)})})}).bind(null,this,s,u,o,n);return o?o._promise(s,p,"lock"):J.trans?Ct(J.transless,function(){return r._whenReady(p)}):this._whenReady(p)},Be.prototype.table=function(e){if(!O(this._allTables,e))throw new F.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},Be);function Be(e,t){var n=this;this._middlewares={},this.verno=0;var r=Be.dependencies;this._options=t=m({addons:Be.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,cache:"cloned"},t),this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange},r=t.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,s,u,l,p,y={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:oe,dbReadyPromise:null,cancelOpen:oe,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:t.autoOpen};y.dbReadyPromise=new z(function(d){y.dbReadyResolve=d}),y.openCanceller=new z(function(d,j){y.cancelOpen=j}),this._state=y,this.name=e,this.on=Jt(this,"populate","blocked","versionchange","close",{ready:[Rt,oe]}),this.on.ready.subscribe=ye(this.on.ready.subscribe,function(d){return function(j,g){Be.vip(function(){var b,w=n._state;w.openComplete?(w.dbOpenError||z.resolve().then(j),g&&d(j)):w.onReadyBeingFired?(w.onReadyBeingFired.push(j),g&&d(j)):(d(j),b=n,g||d(function v(){b.on.ready.unsubscribe(j),b.on.ready.unsubscribe(v)}))})}}),this.Collection=(o=this,Yt(ha.prototype,function(_,v){this.db=o;var g=ho,b=null;if(v)try{g=v()}catch(C){b=C}var w=_._ctx,v=w.table,_=v.hook.reading.fire;this._ctx={table:v,index:w.index,isPrimKey:!w.index||v.schema.primKey.keyPath&&w.index===v.schema.primKey.name,range:g,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:b,or:w.or,valueMapper:_!==De?_:null}})),this.Table=(s=this,Yt(yo.prototype,function(d,j,g){this.db=s,this._tx=g,this.name=d,this.schema=j,this.hook=s._allTables[d]?s._allTables[d].hook:Jt(null,{creating:[Ae,oe],reading:[ft,De],updating:[pn,oe],deleting:[hn,oe]})})),this.Transaction=(u=this,Yt(ga.prototype,function(d,j,g,b,w){var v=this;this.db=u,this.mode=d,this.storeNames=j,this.schema=g,this.chromeTransactionDurability=b,this.idbtrans=null,this.on=Jt(this,"complete","error","abort"),this.parent=w||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(_,C){v._resolve=_,v._reject=C}),this._completion.then(function(){v.active=!1,v.on.complete.fire()},function(_){var C=v.active;return v.active=!1,v.on.error.fire(_),v.parent?v.parent._reject(_):C&&v.idbtrans&&v.idbtrans.abort(),qe(_)})})),this.Version=(l=this,Yt(_a.prototype,function(d){this.db=l,this._cfg={version:d,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(p=this,Yt(jo.prototype,function(d,j,g){if(this.db=p,this._ctx={table:d,index:j===":id"?null:j,or:g},this._cmp=this._ascending=me,this._descending=function(b,w){return me(w,b)},this._max=function(b,w){return 0<me(b,w)?b:w},this._min=function(b,w){return me(b,w)<0?b:w},this._IDBKeyRange=p._deps.IDBKeyRange,!this._IDBKeyRange)throw new F.MissingAPI})),this.on("versionchange",function(d){0<d.newVersion?console.warn("Another connection wants to upgrade database '".concat(n.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(n.name,"'. Closing db now to resume the delete request.")),n.close({disableAutoOpen:!1})}),this.on("blocked",function(d){!d.newVersion||d.newVersion<d.oldVersion?console.warn("Dexie.delete('".concat(n.name,"') was blocked")):console.warn("Upgrade '".concat(n.name,"' blocked by other connection holding version ").concat(d.oldVersion/10))}),this._maxKey=en(t.IDBKeyRange),this._createTransaction=function(d,j,g,b){return new n.Transaction(d,j,g,n._options.chromeTransactionDurability,b)},this._fireOnBlocked=function(d){n.on("blocked").fire(d),qt.filter(function(j){return j.name===n.name&&j!==n&&!j._state.vcFired}).map(function(j){return j.on("versionchange").fire(d)})},this.use(Ea),this.use(Pa),this.use(Na),this.use(Ca),this.use(Aa);var x=new Proxy(this,{get:function(d,j,g){if(j==="_vip")return!0;if(j==="table")return function(w){return qn(n.table(w),x)};var b=Reflect.get(d,j,g);return b instanceof yo?qn(b,x):j==="tables"?b.map(function(w){return qn(w,x)}):j==="_createTransaction"?function(){return qn(b.apply(this,arguments),x)}:b}});this.vip=x,r.forEach(function(d){return d(n)})}var Bn,it=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Ta=(jr.prototype.subscribe=function(e,t,n){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:t,complete:n})},jr.prototype[it]=function(){return this},jr);function jr(e){this._subscribe=e}try{Bn={indexedDB:E.indexedDB||E.mozIndexedDB||E.webkitIndexedDB||E.msIndexedDB,IDBKeyRange:E.IDBKeyRange||E.webkitIDBKeyRange}}catch{Bn={indexedDB:null,IDBKeyRange:null}}function qo(e){var t,n=!1,r=new Ta(function(o){var s=te(e),u,l=!1,p={},y={},x={get closed(){return l},unsubscribe:function(){l||(l=!0,u&&u.abort(),d&&wt.storagemutated.unsubscribe(g))}};o.start&&o.start(x);var d=!1,j=function(){return Gn(b)},g=function(w){Mn(p,w),pr(y,p)&&j()},b=function(){var w,v,_;!l&&Bn.indexedDB&&(p={},w={},u&&u.abort(),u=new AbortController,_=function(C){var A=Mt();try{s&&Dt();var S=yt(e,C);return S=s?S.finally(vt):S}finally{A&&It()}}(v={subscr:w,signal:u.signal,requery:j,querier:e,trans:null}),Promise.resolve(_).then(function(C){n=!0,t=C,l||v.signal.aborted||(p={},function(A){for(var S in A)if(O(A,S))return;return 1}(y=w)||d||(wt(Xt,g),d=!0),Gn(function(){return!l&&o.next&&o.next(C)}))},function(C){n=!1,["DatabaseClosedError","AbortError"].includes(C==null?void 0:C.name)||l||Gn(function(){l||o.error&&o.error(C)})}))};return setTimeout(j,0),x});return r.hasValue=function(){return n},r.getValue=function(){return t},r}var St=ht;function _r(e){var t=jt;try{jt=!0,wt.storagemutated.fire(e),yr(e,!0)}finally{jt=t}}Q(St,m(m({},Le),{delete:function(e){return new St(e,{addons:[]}).delete()},exists:function(e){return new St(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return t=St.dependencies,n=t.indexedDB,t=t.IDBKeyRange,(fr(n)?Promise.resolve(n.databases()).then(function(r){return r.map(function(o){return o.name}).filter(function(o){return o!==jn})}):cr(n,t).toCollection().primaryKeys()).then(e)}catch{return qe(new F.MissingAPI)}var t,n},defineClass:function(){return function(e){I(this,e)}},ignoreTransaction:function(e){return J.trans?Ct(J.transless,e):e()},vip:dr,async:function(e){return function(){try{var t=vr(e.apply(this,arguments));return t&&typeof t.then=="function"?t:z.resolve(t)}catch(n){return qe(n)}}},spawn:function(e,t,n){try{var r=vr(e.apply(n,t||[]));return r&&typeof r.then=="function"?r:z.resolve(r)}catch(o){return qe(o)}},currentTransaction:{get:function(){return J.trans||null}},waitFor:function(e,t){return t=z.resolve(typeof e=="function"?St.ignoreTransaction(e):e).timeout(t||6e4),J.trans?J.trans.waitFor(t):t},Promise:z,debug:{get:function(){return h},set:function(e){$(e)}},derive:G,extend:I,props:Q,override:ye,Events:Jt,on:wt,liveQuery:qo,extendObservabilitySet:Mn,getByKeyPath:se,setByKeyPath:ae,delByKeyPath:function(e,t){typeof t=="string"?ae(e,t,void 0):"length"in t&&[].map.call(t,function(n){ae(e,n,void 0)})},shallowClone:Oe,deepClone:Re,getObjectDiff:br,cmp:me,asap:ce,minKey:-1/0,addons:[],connections:qt,errnames:mt,dependencies:Bn,cache:Nt,semVer:"4.0.11",version:"4.0.11".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),St.maxKey=en(St.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(wt(Xt,function(e){jt||(e=new CustomEvent(rr,{detail:e}),jt=!0,dispatchEvent(e),jt=!1)}),addEventListener(rr,function(e){e=e.detail,jt||_r(e)}));var Lt,jt=!1,Bo=function(){};return typeof BroadcastChannel<"u"&&((Bo=function(){(Lt=new BroadcastChannel(rr)).onmessage=function(e){return e.data&&_r(e.data)}})(),typeof Lt.unref=="function"&&Lt.unref(),wt(Xt,function(e){jt||Lt.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!ht.disableBfCache&&e.persisted){h&&console.debug("Dexie: handling persisted pagehide"),Lt!=null&&Lt.close();for(var t=0,n=qt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!ht.disableBfCache&&e.persisted&&(h&&console.debug("Dexie: handling persisted pageshow"),Bo(),_r({all:new Je(-1/0,[[]])}))})),z.rejectionMapper=function(e,t){return!e||e instanceof Ce||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Ne[e.name]?e:(t=new Ne[e.name](t||e.message,e),"stack"in e&&q(t,"stack",{get:function(){return this.inner.stack}}),t)},$(h),m(ht,Object.freeze({__proto__:null,Dexie:ht,liveQuery:qo,Entity:po,cmp:me,PropModification:Gt,replacePrefix:function(e,t){return new Gt({replacePrefix:[e,t]})},add:function(e){return new Gt({add:e})},remove:function(e){return new Gt({remove:e})},default:ht,RangeSet:Je,mergeRanges:rn,rangesOverlap:Eo}),{default:ht}),ht})}(sn)),sn.exports}var Wo=Uo();const Ln=Lo(Wo),Sr=Symbol.for("Dexie"),an=globalThis[Sr]||(globalThis[Sr]=Ln);if(Ln.semVer!==an.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Ln.semVer} and ${an.semVer}`);const{liveQuery:$o,mergeRanges:Ra,rangesOverlap:Ma,RangeSet:Ia,cmp:Da,Entity:qa,PropModification:Ba,replacePrefix:Ka,add:La,remove:Fa}=an;function Qo(a,c,f){var m,k;typeof a=="function"?(m=c||[],k=f):(m=[],k=c);var E=T.useRef({hasResult:!1,result:k,error:null}),N=T.useReducer(function(L){return L+1},0);N[0];var P=N[1],I=T.useMemo(function(){var L=typeof a=="function"?a():a;if(!L||typeof L.subscribe!="function")throw a===L?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(!E.current.hasResult&&typeof window<"u"&&(typeof L.hasValue!="function"||L.hasValue()))if(typeof L.getValue=="function")E.current.result=L.getValue(),E.current.hasResult=!0;else{var Y=L.subscribe(function(O){E.current.result=O,E.current.hasResult=!0});typeof Y=="function"?Y():Y.unsubscribe()}return L},m);if(T.useDebugValue(E.current.result),T.useEffect(function(){var L=I.subscribe(function(Y){var O=E.current;(O.error!==null||O.result!==Y)&&(O.error=null,O.result=Y,O.hasResult=!0,P())},function(Y){var O=E.current;O.error!==Y&&(O.error=Y,P())});return typeof L=="function"?L:L.unsubscribe.bind(L)},m),E.current.error)throw E.current.error;return E.current.result}function Or(a,c,f){return Qo(function(){return $o(a)},c||[],f)}const un=a=>a>=200&&a<300?"bg-green-200 text-green-800":a>=300&&a<400?"bg-blue-200 text-blue-800":a>=400&&a<500?"bg-orange-600 text-orange-200":a>=500?"bg-red-800 text-red-100":"bg-gray-200 text-gray-800",Fn=a=>{if(!a)return"";switch(a.toUpperCase()){case"GET":return"text-[rgb(0,107,230)]";case"POST":return"text-[rgb(23,131,135)]";case"PATCH":return"text-[rgb(204,75,0)]";case"DELETE":return"text-red-700";default:return""}},Pr=a=>{if(a)return" border border-slate-500";switch(a.toUpperCase()){case"GET":return"text-green-700 border border-green-700";case"POST":return"text-sky-700 border border-sky-700";case"PUT":return"text-fuchsia-700 border border-fuchsia-700";case"PATCH":return"text-purple-700 border border-purple-700";case"DELETE":return"text-red-700 border border-red-700";case"OPTIONS":return"text-rose-700 border border-rose-700";case"HEAD":return"text-pink-700 border border-pink-700";default:return"text-gray-700 border border-gray-700"}},Jo=["bg-blue-100","border-blue-700"].join(" "),Yo="border-l-4",Tr=({operation:a,opId:c,onSelect:f,onRemove:m,selected:k})=>{var P,I,L,Y,O,Q;const E=re=>{f(re)},N=re=>{const q=new Date(re),G=String(q.getHours()).padStart(2,"0"),W=String(q.getMinutes()).padStart(2,"0"),he=String(q.getSeconds()).padStart(2,"0");return`${G}:${W}:${he}`};return i.jsx("li",{className:`flex items-center cursor-pointer hover:bg-gray-200 ${Yo} ${k?Jo:"border-transparent"}`,onClick:()=>{E(a)},children:i.jsxs("div",{className:"flex items-center p-2 w-full",children:[i.jsx("div",{className:"w-16 flex justify-center",children:i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${un((P=a==null?void 0:a.response)==null?void 0:P.status)}`,children:((I=a==null?void 0:a.response)==null?void 0:I.status)||"N/A"})}),i.jsx("div",{className:`w-20 text-center font-medium ${Fn((L=a==null?void 0:a.request)==null?void 0:L.method)}`,children:((Y=a==null?void 0:a.request)==null?void 0:Y.method)||"GET"}),i.jsx("div",{className:"flex-grow truncate text-left",children:(a==null?void 0:a.request.path)||(a==null?void 0:a.request.url)}),i.jsx("div",{className:"w-20 text-gray-900 text-center text-xs",children:(O=a==null?void 0:a.request)!=null&&O.timestamp?N(a.request.timestamp):"N/A"}),i.jsxs("div",{className:"w-16 text-gray-500 text-center text-xs",children:[(Q=a==null?void 0:a.timing)==null?void 0:Q.duration,"ms"]}),i.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer text-red-500 hover:text-red-700",onClick:re=>{re.stopPropagation(),m(c)},children:"✕"})]})})},Hn=({options:a,selected:c,onChange:f,placeholder:m="Add option...",colorFn:k})=>{const[E,N]=T.useState(""),[P,I]=T.useState(!1),[L,Y]=T.useState(0),O=T.useRef(null),Q=a.filter(W=>W.toLowerCase().includes(E.toLowerCase())&&!c.includes(W));T.useEffect(()=>{Y(0)},[E,c]);const re=W=>{c.includes(W)||f([...c,W]),N("")},q=W=>{f(c.filter(he=>he!==W))},G=W=>{W.key==="ArrowDown"?(W.preventDefault(),Y(he=>he+1<Q.length?he+1:he)):W.key==="ArrowUp"?(W.preventDefault(),Y(he=>he-1>=0?he-1:0)):W.key==="Enter"?(console.log("enter",L),W.preventDefault(),Q.length>0&&re(Q[L])):W.key==="Backspace"&&!E&&c.length>0&&q(c[c.length-1])};return i.jsxs("div",{className:"w-full max-w-md relative",children:[i.jsxs("div",{className:"flex flex-wrap items-center border border-gray-300 rounded-md shadow-sm px-2 py-1",children:[c.map(W=>i.jsxs("div",{className:`flex items-center rounded-full px-2 py-1 mr-2 my-1 text-xs ${k?k(W):"bg-indigo-100 text-indigo-700"}`,children:[i.jsx("span",{children:W}),i.jsx("button",{type:"button",onClick:()=>q(W),className:"ml-1 focus:outline-none cursor-pointer","aria-label":`Remove ${W}`,children:i.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
|
|
31
|
+
Check the top-level render call using <`+f+">."),$}var xe=T,Ce=Symbol.for("react.transitional.element"),we=Symbol.for("react.portal"),ie=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),Ke=Symbol.for("react.profiler"),de=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),Ee=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),he=Symbol.for("react.offscreen"),Me=Symbol.iterator,Ie=Symbol.for("react.client.reference"),Pe=xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ue=Object.prototype.hasOwnProperty,re=Object.assign,ke=Symbol.for("react.client.reference"),Ae=Array.isArray,We=0,Qe,lt,ft,Et,Y,At,pt;m.__reactDisabledLog=!0;var ve,ct,Nt=!1,et=new(typeof WeakMap=="function"?WeakMap:Map),z=Symbol.for("react.client.reference"),me,De={},$e={},Fe={};Ut.Fragment=ie,Ut.jsx=function(f,$,U,be,Re){return q(f,$,U,!1,be,Re)},Ut.jsxs=function(f,$,U,be,Re){return q(f,$,U,!0,be,Re)}}()),Ut}var Nn;function zo(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?ir.exports=Fo():ir.exports=Ho()),ir.exports}var i=zo(),ur={exports:{}},Vo=ur.exports,Sn;function Uo(){return Sn||(Sn=1,function(a,c){(function(d,m){a.exports=m()})(Vo,function(){var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(e,t)},m=function(){return(m=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function _(e,t,r){for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var E=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Ko,N=Object.keys,P=Array.isArray;function I(e,t){return typeof t!="object"||N(t).forEach(function(r){e[r]=t[r]}),e}typeof Promise>"u"||E.Promise||(E.Promise=Promise);var L=Object.getPrototypeOf,Z={}.hasOwnProperty;function S(e,t){return Z.call(e,t)}function Q(e,t){typeof t=="function"&&(t=t(L(e))),(typeof Reflect>"u"?N:Reflect.ownKeys)(t).forEach(function(r){q(e,r,t[r])})}var oe=Object.defineProperty;function q(e,t,r,n){oe(e,t,I(r&&S(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function X(e){return{from:function(t){return e.prototype=Object.create(t.prototype),q(e.prototype,"constructor",e),{extend:Q.bind(null,e.prototype)}}}}var W=Object.getOwnPropertyDescriptor,pe=[].slice;function te(e,t,r){return pe.call(e,t,r)}function xe(e,t){return t(e)}function Ce(e){if(!e)throw new Error("Assertion Failed")}function we(e){E.setImmediate?setImmediate(e):setTimeout(e,0)}function ie(e,t){if(typeof t=="string"&&S(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var r=[],n=0,o=t.length;n<o;++n){var s=ie(e,t[n]);r.push(s)}return r}var u=t.indexOf(".");if(u!==-1){var l=e[t.substr(0,u)];return l==null?void 0:ie(l,t.substr(u+1))}}function se(e,t,r){if(e&&t!==void 0&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){Ce(typeof r!="string"&&"length"in r);for(var n=0,o=t.length;n<o;++n)se(e,t[n],r[n])}else{var s,u,l=t.indexOf(".");l!==-1?(s=t.substr(0,l),(u=t.substr(l+1))===""?r===void 0?P(e)&&!isNaN(parseInt(s))?e.splice(s,1):delete e[s]:e[s]=r:se(l=!(l=e[s])||!S(e,s)?e[s]={}:l,u,r)):r===void 0?P(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=r}}function Ke(e){var t,r={};for(t in e)S(e,t)&&(r[t]=e[t]);return r}var de=[].concat;function ee(e){return de.apply([],e)}var _e="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(ee([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return E[e]}),le=new Set(_e.map(function(e){return E[e]})),ye=null;function Ee(e){return ye=new WeakMap,e=function t(r){if(!r||typeof r!="object")return r;var n=ye.get(r);if(n)return n;if(P(r)){n=[],ye.set(r,n);for(var o=0,s=r.length;o<s;++o)n.push(t(r[o]))}else if(le.has(r.constructor))n=r;else{var u,l=L(r);for(u in n=l===Object.prototype?{}:Object.create(l),ye.set(r,n),r)S(r,u)&&(n[u]=t(r[u]))}return n}(e),ye=null,e}var Oe={}.toString;function J(e){return Oe.call(e).slice(8,-1)}var he=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Me=typeof he=="symbol"?function(e){var t;return e!=null&&(t=e[he])&&t.apply(e)}:function(){return null};function Ie(e,t){return t=e.indexOf(t),0<=t&&e.splice(t,1),0<=t}var Pe={};function Ue(e){var t,r,n,o;if(arguments.length===1){if(P(e))return e.slice();if(this===Pe&&typeof e=="string")return[e];if(o=Me(e)){for(r=[];!(n=o.next()).done;)r.push(n.value);return r}if(e==null)return[e];if(typeof(t=e.length)!="number")return[e];for(r=new Array(t);t--;)r[t]=e[t];return r}for(t=arguments.length,r=new Array(t);t--;)r[t]=arguments[t];return r}var re=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},Re=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ut=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Re),ke={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 Ae(e,t){this.name=e,this.message=t}function We(e,t){return e+". Errors: "+Object.keys(t).map(function(r){return t[r].toString()}).filter(function(r,n,o){return o.indexOf(r)===n}).join(`
|
|
32
|
+
`)}function Qe(e,t,r,n){this.failures=t,this.failedKeys=n,this.successCount=r,this.message=We(e,t)}function lt(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(r){return t[r]}),this.failuresByPos=t,this.message=We(e,this.failures)}X(Ae).from(Error).extend({toString:function(){return this.name+": "+this.message}}),X(Qe).from(Ae),X(lt).from(Ae);var ft=ut.reduce(function(e,t){return e[t]=t+"Error",e},{}),Et=Ae,Y=ut.reduce(function(e,t){var r=t+"Error";function n(o,s){this.name=r,o?typeof o=="string"?(this.message="".concat(o).concat(s?`
|
|
33
|
+
`+s:""),this.inner=s||null):typeof o=="object"&&(this.message="".concat(o.name," ").concat(o.message),this.inner=o):(this.message=ke[t]||r,this.inner=null)}return X(n).from(Et),e[t]=n,e},{});Y.Syntax=SyntaxError,Y.Type=TypeError,Y.Range=RangeError;var At=Re.reduce(function(e,t){return e[t+"Error"]=Y[t],e},{}),pt=ut.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=Y[t]),e},{});function ve(){}function ct(e){return e}function Nt(e,t){return e==null||e===ct?t:function(r){return t(e(r))}}function et(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function z(e,t){return e===ve?t:function(){var r=e.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=t.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?et(n,this.onsuccess):n),o&&(this.onerror=this.onerror?et(o,this.onerror):o),s!==void 0?s:r}}function me(e,t){return e===ve?t:function(){e.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?et(r,this.onsuccess):r),n&&(this.onerror=this.onerror?et(n,this.onerror):n)}}function De(e,t){return e===ve?t:function(r){var n=e.apply(this,arguments);I(r,n);var o=this.onsuccess,s=this.onerror;return this.onsuccess=null,this.onerror=null,r=t.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?et(o,this.onsuccess):o),s&&(this.onerror=this.onerror?et(s,this.onerror):s),n===void 0?r===void 0?void 0:r:I(n,r)}}function $e(e,t){return e===ve?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function Fe(e,t){return e===ve?t:function(){var r=e.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,o=arguments.length,s=new Array(o);o--;)s[o]=arguments[o];return r.then(function(){return t.apply(n,s)})}return t.apply(this,arguments)}}pt.ModifyError=Qe,pt.DexieError=Ae,pt.BulkError=lt;var f=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function $(e){f=e}var U={},be=100,_e=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,L(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,L(t),e]}(),Re=_e[0],ut=_e[1],_e=_e[2],ut=ut&&ut.then,ne=Re&&Re.constructor,tt=!!_e,at=function(e,t){Gt.push([e,t]),it&&(queueMicrotask(la),it=!1)},Le=!0,it=!0,rt=[],nt=[],bt=ct,He={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ve,pgp:!1,env:{},finalize:ve},G=He,Gt=[],St=0,mr=[];function H(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=G;if(typeof e!="function"){if(e!==U)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Qr(this,this._value))}this._state=null,this._value=null,++t.ref,function r(n,o){try{o(function(s){if(n._state===null){if(s===n)throw new TypeError("A promise cannot be resolved with itself.");var u=n._lib&&qt();s&&typeof s.then=="function"?r(n,function(l,p){s instanceof H?s._then(l,p):s.then(l,p)}):(n._state=!0,n._value=s,uo(n)),u&&Bt()}},Qr.bind(null,n))}catch(s){Qr(n,s)}}(this,e)}var Wr={get:function(){var e=G,t=br;function r(n,o){var s=this,u=!e.global&&(e!==G||t!==br),l=u&&!wt(),p=new H(function(y,x){Jr(s,new io(co(n,e,u,l),co(o,e,u,l),y,x,e))});return this._consoleTask&&(p._consoleTask=this._consoleTask),p}return r.prototype=U,r},set:function(e){q(this,"then",e&&e.prototype===U?Wr:{get:function(){return e},set:Wr.set})}};function io(e,t,r,n,o){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=r,this.reject=n,this.psd=o}function Qr(e,t){var r,n;nt.push(t),e._state===null&&(r=e._lib&&qt(),t=bt(t),e._state=!1,e._value=t,n=e,rt.some(function(o){return o._value===n._value})||rt.push(n),uo(e),r&&Bt())}function uo(e){var t=e._listeners;e._listeners=[];for(var r=0,n=t.length;r<n;++r)Jr(e,t[r]);var o=e._PSD;--o.ref||o.finalize(),St===0&&(++St,at(function(){--St==0&&Yr()},[]))}function Jr(e,t){if(e._state!==null){var r=e._state?t.onFulfilled:t.onRejected;if(r===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++St,at(ua,[r,e,t])}else e._listeners.push(t)}function ua(e,t,r){try{var n,o=t._value;!t._state&&nt.length&&(nt=[]),n=f&&t._consoleTask?t._consoleTask.run(function(){return e(o)}):e(o),t._state||nt.indexOf(o)!==-1||function(s){for(var u=rt.length;u;)if(rt[--u]._value===s._value)return rt.splice(u,1)}(t),r.resolve(n)}catch(s){r.reject(s)}finally{--St==0&&Yr(),--r.psd.ref||r.psd.finalize()}}function la(){Ot(He,function(){qt()&&Bt()})}function qt(){var e=Le;return it=Le=!1,e}function Bt(){var e,t,r;do for(;0<Gt.length;)for(e=Gt,Gt=[],r=e.length,t=0;t<r;++t){var n=e[t];n[0].apply(null,n[1])}while(0<Gt.length);it=Le=!0}function Yr(){var e=rt;rt=[],e.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});for(var t=mr.slice(0),r=t.length;r;)t[--r]()}function gr(e){return new H(U,!1,e)}function Te(e,t){var r=G;return function(){var n=qt(),o=G;try{return jt(r,!0),e.apply(this,arguments)}catch(s){t&&t(s)}finally{jt(o,!1),n&&Bt()}}}Q(H.prototype,{then:Wr,_then:function(e,t){Jr(this,new io(null,null,e,t,G))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=e,r=arguments[1];return typeof t=="function"?this.then(null,function(n){return(n instanceof t?r:gr)(n)}):this.then(null,function(n){return(n&&n.name===t?r:gr)(n)})},finally:function(e){return this.then(function(t){return H.resolve(e()).then(function(){return t})},function(t){return H.resolve(e()).then(function(){return gr(t)})})},timeout:function(e,t){var r=this;return e<1/0?new H(function(n,o){var s=setTimeout(function(){return o(new Y.Timeout(t))},e);r.then(n,o).finally(clearTimeout.bind(null,s))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&q(H.prototype,Symbol.toStringTag,"Dexie.Promise"),He.env=lo(),Q(H,{all:function(){var e=Ue.apply(null,arguments).map(xr);return new H(function(t,r){e.length===0&&t([]);var n=e.length;e.forEach(function(o,s){return H.resolve(o).then(function(u){e[s]=u,--n||t(e)},r)})})},resolve:function(e){return e instanceof H?e:e&&typeof e.then=="function"?new H(function(t,r){e.then(t,r)}):new H(U,!0,e)},reject:gr,race:function(){var e=Ue.apply(null,arguments).map(xr);return new H(function(t,r){e.map(function(n){return H.resolve(n).then(t,r)})})},PSD:{get:function(){return G},set:function(e){return G=e}},totalEchoes:{get:function(){return br}},newPSD:xt,usePSD:Ot,scheduler:{get:function(){return at},set:function(e){at=e}},rejectionMapper:{get:function(){return bt},set:function(e){bt=e}},follow:function(e,t){return new H(function(r,n){return xt(function(o,s){var u=G;u.unhandleds=[],u.onunhandled=s,u.finalize=et(function(){var l,p=this;l=function(){p.unhandleds.length===0?o():s(p.unhandleds[0])},mr.push(function y(){l(),mr.splice(mr.indexOf(y),1)}),++St,at(function(){--St==0&&Yr()},[])},u.finalize),e()},t,r,n)})}}),ne&&(ne.allSettled&&q(H,"allSettled",function(){var e=Ue.apply(null,arguments).map(xr);return new H(function(t){e.length===0&&t([]);var r=e.length,n=new Array(r);e.forEach(function(o,s){return H.resolve(o).then(function(u){return n[s]={status:"fulfilled",value:u}},function(u){return n[s]={status:"rejected",reason:u}}).then(function(){return--r||t(n)})})})}),ne.any&&typeof AggregateError<"u"&&q(H,"any",function(){var e=Ue.apply(null,arguments).map(xr);return new H(function(t,r){e.length===0&&r(new AggregateError([]));var n=e.length,o=new Array(n);e.forEach(function(s,u){return H.resolve(s).then(function(l){return t(l)},function(l){o[u]=l,--n||r(new AggregateError(o))})})})}),ne.withResolvers&&(H.withResolvers=ne.withResolvers));var ze={awaits:0,echoes:0,id:0},ca=0,yr=[],vr=0,br=0,fa=0;function xt(e,t,r,n){var o=G,s=Object.create(o);return s.parent=o,s.ref=0,s.global=!1,s.id=++fa,He.env,s.env=tt?{Promise:H,PromiseProp:{value:H,configurable:!0,writable:!0},all:H.all,race:H.race,allSettled:H.allSettled,any:H.any,resolve:H.resolve,reject:H.reject}:{},t&&I(s,t),++o.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()},n=Ot(s,e,r,n),s.ref===0&&s.finalize(),n}function Kt(){return ze.id||(ze.id=++ca),++ze.awaits,ze.echoes+=be,ze.id}function wt(){return!!ze.awaits&&(--ze.awaits==0&&(ze.id=0),ze.echoes=ze.awaits*be,!0)}function xr(e){return ze.echoes&&e&&e.constructor===ne?(Kt(),e.then(function(t){return wt(),t},function(t){return wt(),qe(t)})):e}function da(){var e=yr[yr.length-1];yr.pop(),jt(e,!1)}function jt(e,t){var r,n=G;(t?!ze.echoes||vr++&&e===G:!vr||--vr&&e===G)||queueMicrotask(t?(function(o){++br,ze.echoes&&--ze.echoes!=0||(ze.echoes=ze.awaits=ze.id=0),yr.push(G),jt(o,!0)}).bind(null,e):da),e!==G&&(G=e,n===He&&(He.env=lo()),tt&&(r=He.env.Promise,t=e.env,(n.global||e.global)&&(Object.defineProperty(E,"Promise",t.PromiseProp),r.all=t.all,r.race=t.race,r.resolve=t.resolve,r.reject=t.reject,t.allSettled&&(r.allSettled=t.allSettled),t.any&&(r.any=t.any))))}function lo(){var e=E.Promise;return tt?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(E,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Ot(e,t,r,n,o){var s=G;try{return jt(e,!0),t(r,n,o)}finally{jt(s,!1)}}function co(e,t,r,n){return typeof e!="function"?e:function(){var o=G;r&&Kt(),jt(t,!0);try{return e.apply(this,arguments)}finally{jt(o,!1),n&&queueMicrotask(wt)}}}function Gr(e){Promise===ne&&ze.echoes===0?vr===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+ut).indexOf("[native code]")===-1&&(Kt=wt=ve);var qe=H.reject,Pt="",mt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",fo="String expected.",Lt=[],wr="__dbnames",Zr="readonly",Xr="readwrite";function Tt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ho={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jr(e){return typeof e!="string"||/\./.test(e)?function(t){return t}:function(t){return t[e]===void 0&&e in t&&delete(t=Ee(t))[e],t}}function po(){throw Y.Type()}function ge(e,t){try{var r=mo(e),n=mo(t);if(r!==n)return r==="Array"?1:n==="Array"?-1:r==="binary"?1:n==="binary"?-1:r==="string"?1:n==="string"?-1:r==="Date"?1:n!=="Date"?NaN:-1;switch(r){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(o,s){for(var u=o.length,l=s.length,p=u<l?u:l,y=0;y<p;++y)if(o[y]!==s[y])return o[y]<s[y]?-1:1;return u===l?0:u<l?-1:1}(go(e),go(t));case"Array":return function(o,s){for(var u=o.length,l=s.length,p=u<l?u:l,y=0;y<p;++y){var x=ge(o[y],s[y]);if(x!==0)return x}return u===l?0:u<l?-1:1}(e,t)}}catch{}return NaN}function mo(e){var t=typeof e;return t!="object"?t:ArrayBuffer.isView(e)?"binary":(e=J(e),e==="ArrayBuffer"?"binary":e)}function go(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var yo=(Se.prototype._trans=function(e,t,r){var n=this._tx||G.trans,o=this.name,s=f&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function u(y,x,h){if(!h.schema[o])throw new Y.NotFound("Table "+o+" not part of transaction");return t(h.idbtrans,h)}var l=qt();try{var p=n&&n.db._novip===this.db._novip?n===G.trans?n._promise(e,u,r):xt(function(){return n._promise(e,u,r)},{trans:n,transless:G.transless||G}):function y(x,h,j,g){if(x.idbdb&&(x._state.openComplete||G.letThrough||x._vip)){var b=x._createTransaction(h,j,x._dbSchema);try{b.create(),x._state.PR1398_maxLoop=3}catch(w){return w.name===ft.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return y(x,h,j,g)})):qe(w)}return b._promise(h,function(w,v){return xt(function(){return G.trans=b,g(w,v,b)})}).then(function(w){if(h==="readwrite")try{b.idbtrans.commit()}catch{}return h==="readonly"?w:b._completion.then(function(){return w})})}if(x._state.openComplete)return qe(new Y.DatabaseClosed(x._state.dbOpenError));if(!x._state.isBeingOpened){if(!x._state.autoOpen)return qe(new Y.DatabaseClosed);x.open().catch(ve)}return x._state.dbReadyPromise.then(function(){return y(x,h,j,g)})}(this.db,e,[this.name],u);return s&&(p._consoleTask=s,p=p.catch(function(y){return console.trace(y),qe(y)})),p}finally{l&&Bt()}},Se.prototype.get=function(e,t){var r=this;return e&&e.constructor===Object?this.where(e).first(t):e==null?qe(new Y.Type("Invalid argument to Table.get()")):this._trans("readonly",function(n){return r.core.get({trans:n,key:e}).then(function(o){return r.hook.reading.fire(o)})}).then(t)},Se.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(P(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=N(e);if(t.length===1)return this.where(t[0]).equals(e[t[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(l){if(l.compound&&t.every(function(y){return 0<=l.keyPath.indexOf(y)})){for(var p=0;p<t.length;++p)if(t.indexOf(l.keyPath[p])===-1)return!1;return!0}return!1}).sort(function(l,p){return l.keyPath.length-p.keyPath.length})[0];if(r&&this.db._maxKey!==Pt){var s=r.keyPath.slice(0,t.length);return this.where(s).equals(s.map(function(p){return e[p]}))}!r&&f&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var n=this.schema.idxByName;function o(l,p){return ge(l,p)===0}var u=t.reduce(function(h,p){var y=h[0],x=h[1],h=n[p],j=e[p];return[y||h,y||!h?Tt(x,h&&h.multi?function(g){return g=ie(g,p),P(g)&&g.some(function(b){return o(j,b)})}:function(g){return o(j,ie(g,p))}):x]},[null,null]),s=u[0],u=u[1];return s?this.where(s.name).equals(e[s.keyPath]).filter(u):r?this.filter(u):this.where(t).equals("")},Se.prototype.filter=function(e){return this.toCollection().and(e)},Se.prototype.count=function(e){return this.toCollection().count(e)},Se.prototype.offset=function(e){return this.toCollection().offset(e)},Se.prototype.limit=function(e){return this.toCollection().limit(e)},Se.prototype.each=function(e){return this.toCollection().each(e)},Se.prototype.toArray=function(e){return this.toCollection().toArray(e)},Se.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Se.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,P(e)?"[".concat(e.join("+"),"]"):e))},Se.prototype.reverse=function(){return this.toCollection().reverse()},Se.prototype.mapToClass=function(e){var t,r=this.db,n=this.name;function o(){return t!==null&&t.apply(this,arguments)||this}(this.schema.mappedClass=e).prototype instanceof po&&(function(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function x(){this.constructor=p}d(p,y),p.prototype=y===null?Object.create(y):(x.prototype=y.prototype,new x)}(o,t=e),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return n},e=o);for(var s=new Set,u=e.prototype;u;u=L(u))Object.getOwnPropertyNames(u).forEach(function(p){return s.add(p)});function l(p){if(!p)return p;var y,x=Object.create(e.prototype);for(y in p)if(!s.has(y))try{x[y]=p[y]}catch{}return x}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=l,this.hook("reading",l),e},Se.prototype.defineClass=function(){return this.mapToClass(function(e){I(this,e)})},Se.prototype.add=function(e,t){var r=this,n=this.schema.primKey,o=n.auto,s=n.keyPath,u=e;return s&&o&&(u=jr(s)(e)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"add",keys:t!=null?[t]:null,values:[u]})}).then(function(l){return l.numFailures?H.reject(l.failures[0]):l.lastResult}).then(function(l){if(s)try{se(e,s,l)}catch{}return l})},Se.prototype.update=function(e,t){return typeof e!="object"||P(e)?this.where(":id").equals(e).modify(t):(e=ie(e,this.schema.primKey.keyPath),e===void 0?qe(new Y.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t))},Se.prototype.put=function(e,t){var r=this,n=this.schema.primKey,o=n.auto,s=n.keyPath,u=e;return s&&o&&(u=jr(s)(e)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"put",values:[u],keys:t!=null?[t]:null})}).then(function(l){return l.numFailures?H.reject(l.failures[0]):l.lastResult}).then(function(l){if(s)try{se(e,s,l)}catch{}return l})},Se.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(r){return t.core.mutate({trans:r,type:"delete",keys:[e]})}).then(function(r){return r.numFailures?H.reject(r.failures[0]):void 0})},Se.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:ho})}).then(function(t){return t.numFailures?H.reject(t.failures[0]):void 0})},Se.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(r){return t.core.getMany({keys:e,trans:r}).then(function(n){return n.map(function(o){return t.hook.reading.fire(o)})})})},Se.prototype.bulkAdd=function(e,t,r){var n=this,o=Array.isArray(t)?t:void 0,s=(r=r||(o?void 0:t))?r.allKeys:void 0;return this._trans("readwrite",function(u){var y=n.schema.primKey,l=y.auto,y=y.keyPath;if(y&&o)throw new Y.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var p=e.length,y=y&&l?e.map(jr(y)):e;return n.core.mutate({trans:u,type:"add",keys:o,values:y,wantResults:s}).then(function(b){var h=b.numFailures,j=b.results,g=b.lastResult,b=b.failures;if(h===0)return s?j:g;throw new lt("".concat(n.name,".bulkAdd(): ").concat(h," of ").concat(p," operations failed"),b)})})},Se.prototype.bulkPut=function(e,t,r){var n=this,o=Array.isArray(t)?t:void 0,s=(r=r||(o?void 0:t))?r.allKeys:void 0;return this._trans("readwrite",function(u){var y=n.schema.primKey,l=y.auto,y=y.keyPath;if(y&&o)throw new Y.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");var p=e.length,y=y&&l?e.map(jr(y)):e;return n.core.mutate({trans:u,type:"put",keys:o,values:y,wantResults:s}).then(function(b){var h=b.numFailures,j=b.results,g=b.lastResult,b=b.failures;if(h===0)return s?j:g;throw new lt("".concat(n.name,".bulkPut(): ").concat(h," of ").concat(p," operations failed"),b)})})},Se.prototype.bulkUpdate=function(e){var t=this,r=this.core,n=e.map(function(u){return u.key}),o=e.map(function(u){return u.changes}),s=[];return this._trans("readwrite",function(u){return r.getMany({trans:u,keys:n,cache:"clone"}).then(function(l){var p=[],y=[];e.forEach(function(h,j){var g=h.key,b=h.changes,w=l[j];if(w){for(var v=0,k=Object.keys(b);v<k.length;v++){var C=k[v],A=b[C];if(C===t.schema.primKey.keyPath){if(ge(A,g)!==0)throw new Y.Constraint("Cannot update primary key in bulkUpdate()")}else se(w,C,A)}s.push(j),p.push(g),y.push(w)}});var x=p.length;return r.mutate({trans:u,type:"put",keys:p,values:y,updates:{keys:n,changeSpecs:o}}).then(function(h){var j=h.numFailures,g=h.failures;if(j===0)return x;for(var b=0,w=Object.keys(g);b<w.length;b++){var v,k=w[b],C=s[Number(k)];C!=null&&(v=g[k],delete g[k],g[C]=v)}throw new lt("".concat(t.name,".bulkUpdate(): ").concat(j," of ").concat(x," operations failed"),g)})})})},Se.prototype.bulkDelete=function(e){var t=this,r=e.length;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:e})}).then(function(u){var o=u.numFailures,s=u.lastResult,u=u.failures;if(o===0)return s;throw new lt("".concat(t.name,".bulkDelete(): ").concat(o," of ").concat(r," operations failed"),u)})},Se);function Se(){}function Zt(e){function t(u,l){if(l){for(var p=arguments.length,y=new Array(p-1);--p;)y[p-1]=arguments[p];return r[u].subscribe.apply(null,y),e}if(typeof u=="string")return r[u]}var r={};t.addEventType=s;for(var n=1,o=arguments.length;n<o;++n)s(arguments[n]);return t;function s(u,l,p){if(typeof u!="object"){var y;l=l||$e;var x={subscribers:[],fire:p=p||ve,subscribe:function(h){x.subscribers.indexOf(h)===-1&&(x.subscribers.push(h),x.fire=l(x.fire,h))},unsubscribe:function(h){x.subscribers=x.subscribers.filter(function(j){return j!==h}),x.fire=x.subscribers.reduce(l,p)}};return r[u]=t[u]=x}N(y=u).forEach(function(h){var j=y[h];if(P(j))s(h,y[h][0],y[h][1]);else{if(j!=="asap")throw new Y.InvalidArgument("Invalid event config");var g=s(h,ct,function(){for(var b=arguments.length,w=new Array(b);b--;)w[b]=arguments[b];g.subscribers.forEach(function(v){we(function(){v.apply(null,w)})})})}})}}function Xt(e,t){return X(t).from({prototype:e}),t}function Ft(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function en(e,t){e.filter=Tt(e.filter,t)}function tn(e,t,r){var n=e.replayFilter;e.replayFilter=n?function(){return Tt(n(),t())}:t,e.justLimit=r&&!n}function kr(e,t){if(e.isPrimKey)return t.primaryKey;var r=t.getIndexByKeyPath(e.index);if(!r)throw new Y.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return r}function vo(e,t,r){var n=kr(e,t.schema);return t.openCursor({trans:r,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:n,range:e.range}})}function _r(e,t,r,n){var o=e.replayFilter?Tt(e.filter,e.replayFilter()):e.filter;if(e.or){var s={},u=function(l,p,y){var x,h;o&&!o(p,y,function(j){return p.stop(j)},function(j){return p.fail(j)})||((h=""+(x=p.primaryKey))=="[object ArrayBuffer]"&&(h=""+new Uint8Array(x)),S(s,h)||(s[h]=!0,t(l,p,y)))};return Promise.all([e.or._iterate(u,r),bo(vo(e,n,r),e.algorithm,u,!e.keysOnly&&e.valueMapper)])}return bo(vo(e,n,r),Tt(e.algorithm,o),t,!e.keysOnly&&e.valueMapper)}function bo(e,t,r,n){var o=Te(n?function(s,u,l){return r(n(s),u,l)}:r);return e.then(function(s){if(s)return s.start(function(){var u=function(){return s.continue()};t&&!t(s,function(l){return u=l},function(l){s.stop(l),u=ve},function(l){s.fail(l),u=ve})||o(s.value,s,function(l){return u=l}),u()})})}var er=(xo.prototype.execute=function(e){var t=this["@@propmod"];if(t.add!==void 0){var r=t.add;if(P(r))return _(_([],P(e)?e:[],!0),r).sort();if(typeof r=="number")return(Number(e)||0)+r;if(typeof r=="bigint")try{return BigInt(e)+r}catch{return BigInt(0)+r}throw new TypeError("Invalid term ".concat(r))}if(t.remove!==void 0){var n=t.remove;if(P(n))return P(e)?e.filter(function(o){return!n.includes(o)}).sort():[];if(typeof n=="number")return Number(e)-n;if(typeof n=="bigint")try{return BigInt(e)-n}catch{return BigInt(0)-n}throw new TypeError("Invalid subtrahend ".concat(n))}return r=(r=t.replacePrefix)===null||r===void 0?void 0:r[0],r&&typeof e=="string"&&e.startsWith(r)?t.replacePrefix[1]+e.substring(r.length):e},xo);function xo(e){this["@@propmod"]=e}var ha=(je.prototype._read=function(e,t){var r=this._ctx;return r.error?r.table._trans(null,qe.bind(null,r.error)):r.table._trans("readonly",e).then(t)},je.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,qe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},je.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Tt(t.algorithm,e)},je.prototype._iterate=function(e,t){return _r(this._ctx,e,t,this._ctx.table.core)},je.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return e&&I(r,e),t._ctx=r,t},je.prototype.raw=function(){return this._ctx.valueMapper=null,this},je.prototype.each=function(e){var t=this._ctx;return this._read(function(r){return _r(t,e,r,t.table.core)})},je.prototype.count=function(e){var t=this;return this._read(function(r){var n=t._ctx,o=n.table.core;if(Ft(n,!0))return o.count({trans:r,query:{index:kr(n,o.schema),range:n.range}}).then(function(u){return Math.min(u,n.limit)});var s=0;return _r(n,function(){return++s,!1},r,o).then(function(){return s})}).then(e)},je.prototype.sortBy=function(e,t){var r=e.split(".").reverse(),n=r[0],o=r.length-1;function s(p,y){return y?s(p[r[y]],y-1):p[n]}var u=this._ctx.dir==="next"?1:-1;function l(p,y){return ge(s(p,o),s(y,o))*u}return this.toArray(function(p){return p.sort(l)}).then(t)},je.prototype.toArray=function(e){var t=this;return this._read(function(r){var n=t._ctx;if(n.dir==="next"&&Ft(n,!0)&&0<n.limit){var o=n.valueMapper,s=kr(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:s,range:n.range}}).then(function(l){return l=l.result,o?l.map(o):l})}var u=[];return _r(n,function(l){return u.push(l)},r,n.table.core).then(function(){return u})},e)},je.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,Ft(t)?tn(t,function(){var r=e;return function(n,o){return r===0||(r===1?--r:o(function(){n.advance(r),r=0}),!1)}}):tn(t,function(){var r=e;return function(){return--r<0}})),this},je.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),tn(this._ctx,function(){var t=e;return function(r,n,o){return--t<=0&&n(o),0<=t}},!0),this},je.prototype.until=function(e,t){return en(this._ctx,function(r,n,o){return!e(r.value)||(n(o),t)}),this},je.prototype.first=function(e){return this.limit(1).toArray(function(t){return t[0]}).then(e)},je.prototype.last=function(e){return this.reverse().first(e)},je.prototype.filter=function(e){var t;return en(this._ctx,function(r){return e(r.value)}),(t=this._ctx).isMatch=Tt(t.isMatch,e),this},je.prototype.and=function(e){return this.filter(e)},je.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},je.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},je.prototype.desc=function(){return this.reverse()},je.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(r,n){e(n.key,n)})},je.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},je.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(r,n){e(n.primaryKey,n)})},je.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var r=[];return this.each(function(n,o){r.push(o.key)}).then(function(){return r}).then(e)},je.prototype.primaryKeys=function(e){var t=this._ctx;if(t.dir==="next"&&Ft(t,!0)&&0<t.limit)return this._read(function(n){var o=kr(t,t.table.core.schema);return t.table.core.query({trans:n,values:!1,limit:t.limit,query:{index:o,range:t.range}})}).then(function(n){return n.result}).then(e);t.keysOnly=!t.isMatch;var r=[];return this.each(function(n,o){r.push(o.primaryKey)}).then(function(){return r}).then(e)},je.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},je.prototype.firstKey=function(e){return this.limit(1).keys(function(t){return t[0]}).then(e)},je.prototype.lastKey=function(e){return this.reverse().firstKey(e)},je.prototype.distinct=function(){var e=this._ctx,e=e.index&&e.table.schema.idxByName[e.index];if(!e||!e.multi)return this;var t={};return en(this._ctx,function(o){var n=o.primaryKey.toString(),o=S(t,n);return t[n]=!0,!o}),this},je.prototype.modify=function(e){var t=this,r=this._ctx;return this._write(function(n){var o,s,u;u=typeof e=="function"?e:(o=N(e),s=o.length,function(v){for(var k=!1,C=0;C<s;++C){var A=o[C],O=e[A],M=ie(v,A);O instanceof er?(se(v,A,O.execute(M)),k=!0):M!==O&&(se(v,A,O),k=!0)}return k});var l=r.table.core,h=l.schema.primaryKey,p=h.outbound,y=h.extractKey,x=200,h=t.db._options.modifyChunkSize;h&&(x=typeof h=="object"?h[l.name]||h["*"]||200:h);function j(v,A){var C=A.failures,A=A.numFailures;b+=v-A;for(var O=0,M=N(C);O<M.length;O++){var K=M[O];g.push(C[K])}}var g=[],b=0,w=[];return t.clone().primaryKeys().then(function(v){function k(A){var O=Math.min(x,v.length-A);return l.getMany({trans:n,keys:v.slice(A,A+O),cache:"immutable"}).then(function(M){for(var K=[],R=[],D=p?[]:null,F=[],B=0;B<O;++B){var V=M[B],ue={value:Ee(V),primKey:v[A+B]};u.call(ue,ue.value,ue)!==!1&&(ue.value==null?F.push(v[A+B]):p||ge(y(V),y(ue.value))===0?(R.push(ue.value),p&&D.push(v[A+B])):(F.push(v[A+B]),K.push(ue.value)))}return Promise.resolve(0<K.length&&l.mutate({trans:n,type:"add",values:K}).then(function(ce){for(var fe in ce.failures)F.splice(parseInt(fe),1);j(K.length,ce)})).then(function(){return(0<R.length||C&&typeof e=="object")&&l.mutate({trans:n,type:"put",keys:D,values:R,criteria:C,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<A}).then(function(ce){return j(R.length,ce)})}).then(function(){return(0<F.length||C&&e===rn)&&l.mutate({trans:n,type:"delete",keys:F,criteria:C,isAdditionalChunk:0<A}).then(function(ce){return j(F.length,ce)})}).then(function(){return v.length>A+O&&k(A+x)})})}var C=Ft(r)&&r.limit===1/0&&(typeof e!="function"||e===rn)&&{index:r.index,range:r.range};return k(0).then(function(){if(0<g.length)throw new Qe("Error modifying one or more objects",g,b,w);return v.length})})})},je.prototype.delete=function(){var e=this._ctx,t=e.range;return Ft(e)&&(e.isPrimKey||t.type===3)?this._write(function(r){var n=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:r,query:{index:n,range:o}}).then(function(s){return e.table.core.mutate({trans:r,type:"deleteRange",range:o}).then(function(u){var l=u.failures;if(u.lastResult,u.results,u=u.numFailures,u)throw new Qe("Could not delete some values",Object.keys(l).map(function(p){return l[p]}),s-u);return s-u})})}):this.modify(rn)},je);function je(){}var rn=function(e,t){return t.value=null};function pa(e,t){return e<t?-1:e===t?0:1}function ma(e,t){return t<e?-1:e===t?0:1}function ot(e,t,r){return e=e instanceof jo?new e.Collection(e):e,e._ctx.error=new(r||TypeError)(t),e}function Ht(e){return new e.Collection(e,function(){return wo("")}).limit(0)}function Cr(e,t,r,n){var o,s,u,l,p,y,x,h=r.length;if(!r.every(function(b){return typeof b=="string"}))return ot(e,fo);function j(b){o=b==="next"?function(v){return v.toUpperCase()}:function(v){return v.toLowerCase()},s=b==="next"?function(v){return v.toLowerCase()}:function(v){return v.toUpperCase()},u=b==="next"?pa:ma;var w=r.map(function(v){return{lower:s(v),upper:o(v)}}).sort(function(v,k){return u(v.lower,k.lower)});l=w.map(function(v){return v.upper}),p=w.map(function(v){return v.lower}),x=(y=b)==="next"?"":n}j("next"),e=new e.Collection(e,function(){return kt(l[0],p[h-1]+n)}),e._ondirectionchange=function(b){j(b)};var g=0;return e._addAlgorithm(function(b,w,v){var k=b.key;if(typeof k!="string")return!1;var C=s(k);if(t(C,p,g))return!0;for(var A=null,O=g;O<h;++O){var M=function(K,R,D,F,B,V){for(var ue=Math.min(K.length,F.length),ce=-1,fe=0;fe<ue;++fe){var st=R[fe];if(st!==F[fe])return B(K[fe],D[fe])<0?K.substr(0,fe)+D[fe]+D.substr(fe+1):B(K[fe],F[fe])<0?K.substr(0,fe)+F[fe]+D.substr(fe+1):0<=ce?K.substr(0,ce)+R[ce]+D.substr(ce+1):null;B(K[fe],st)<0&&(ce=fe)}return ue<F.length&&V==="next"?K+D.substr(K.length):ue<K.length&&V==="prev"?K.substr(0,D.length):ce<0?null:K.substr(0,ce)+F[ce]+D.substr(ce+1)}(k,C,l[O],p[O],u,y);M===null&&A===null?g=O+1:(A===null||0<u(A,M))&&(A=M)}return w(A!==null?function(){b.continue(A+x)}:v),!1}),e}function kt(e,t,r,n){return{type:2,lower:e,upper:t,lowerOpen:r,upperOpen:n}}function wo(e){return{type:1,lower:e,upper:e}}var jo=(Object.defineProperty(Ve.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Ve.prototype.between=function(e,t,r,n){r=r!==!1,n=n===!0;try{return 0<this._cmp(e,t)||this._cmp(e,t)===0&&(r||n)&&(!r||!n)?Ht(this):new this.Collection(this,function(){return kt(e,t,!r,!n)})}catch{return ot(this,mt)}},Ve.prototype.equals=function(e){return e==null?ot(this,mt):new this.Collection(this,function(){return wo(e)})},Ve.prototype.above=function(e){return e==null?ot(this,mt):new this.Collection(this,function(){return kt(e,void 0,!0)})},Ve.prototype.aboveOrEqual=function(e){return e==null?ot(this,mt):new this.Collection(this,function(){return kt(e,void 0,!1)})},Ve.prototype.below=function(e){return e==null?ot(this,mt):new this.Collection(this,function(){return kt(void 0,e,!1,!0)})},Ve.prototype.belowOrEqual=function(e){return e==null?ot(this,mt):new this.Collection(this,function(){return kt(void 0,e)})},Ve.prototype.startsWith=function(e){return typeof e!="string"?ot(this,fo):this.between(e,e+Pt,!0,!0)},Ve.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):Cr(this,function(t,r){return t.indexOf(r[0])===0},[e],Pt)},Ve.prototype.equalsIgnoreCase=function(e){return Cr(this,function(t,r){return t===r[0]},[e],"")},Ve.prototype.anyOfIgnoreCase=function(){var e=Ue.apply(Pe,arguments);return e.length===0?Ht(this):Cr(this,function(t,r){return r.indexOf(t)!==-1},e,"")},Ve.prototype.startsWithAnyOfIgnoreCase=function(){var e=Ue.apply(Pe,arguments);return e.length===0?Ht(this):Cr(this,function(t,r){return r.some(function(n){return t.indexOf(n)===0})},e,Pt)},Ve.prototype.anyOf=function(){var e=this,t=Ue.apply(Pe,arguments),r=this._cmp;try{t.sort(r)}catch{return ot(this,mt)}if(t.length===0)return Ht(this);var n=new this.Collection(this,function(){return kt(t[0],t[t.length-1])});n._ondirectionchange=function(s){r=s==="next"?e._ascending:e._descending,t.sort(r)};var o=0;return n._addAlgorithm(function(s,u,l){for(var p=s.key;0<r(p,t[o]);)if(++o===t.length)return u(l),!1;return r(p,t[o])===0||(u(function(){s.continue(t[o])}),!1)}),n},Ve.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Ve.prototype.noneOf=function(){var e=Ue.apply(Pe,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return ot(this,mt)}var t=e.reduce(function(r,n){return r?r.concat([[r[r.length-1][1],n]]):[[-1/0,n]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Ve.prototype.inAnyRange=function(k,t){var r=this,n=this._cmp,o=this._ascending,s=this._descending,u=this._min,l=this._max;if(k.length===0)return Ht(this);if(!k.every(function(C){return C[0]!==void 0&&C[1]!==void 0&&o(C[0],C[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 p=!t||t.includeLowers!==!1,y=t&&t.includeUppers===!0,x,h=o;function j(C,A){return h(C[0],A[0])}try{(x=k.reduce(function(C,A){for(var O=0,M=C.length;O<M;++O){var K=C[O];if(n(A[0],K[1])<0&&0<n(A[1],K[0])){K[0]=u(K[0],A[0]),K[1]=l(K[1],A[1]);break}}return O===M&&C.push(A),C},[])).sort(j)}catch{return ot(this,mt)}var g=0,b=y?function(C){return 0<o(C,x[g][1])}:function(C){return 0<=o(C,x[g][1])},w=p?function(C){return 0<s(C,x[g][0])}:function(C){return 0<=s(C,x[g][0])},v=b,k=new this.Collection(this,function(){return kt(x[0][0],x[x.length-1][1],!p,!y)});return k._ondirectionchange=function(C){h=C==="next"?(v=b,o):(v=w,s),x.sort(j)},k._addAlgorithm(function(C,A,O){for(var M,K=C.key;v(K);)if(++g===x.length)return A(O),!1;return!b(M=K)&&!w(M)||(r._cmp(K,x[g][1])===0||r._cmp(K,x[g][0])===0||A(function(){h===o?C.continue(x[g][0]):C.continue(x[g][1])}),!1)}),k},Ve.prototype.startsWithAnyOf=function(){var e=Ue.apply(Pe,arguments);return e.every(function(t){return typeof t=="string"})?e.length===0?Ht(this):this.inAnyRange(e.map(function(t){return[t,t+Pt]})):ot(this,"startsWithAnyOf() only works with strings")},Ve);function Ve(){}function dt(e){return Te(function(t){return tr(t),e(t.target.error),!1})}function tr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var rr="storagemutated",nn="x-storagemutated-1",_t=Zt(null,rr),ga=(ht.prototype._lock=function(){return Ce(!G.global),++this._reculock,this._reculock!==1||G.global||(G.lockOwnerFor=this),this},ht.prototype._unlock=function(){if(Ce(!G.global),--this._reculock==0)for(G.global||(G.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Ot(e[1],e[0])}catch{}}return this},ht.prototype._locked=function(){return this._reculock&&G.lockOwnerFor!==this},ht.prototype.create=function(e){var t=this;if(!this.mode)return this;var r=this.db.idbdb,n=this.db._state.dbOpenError;if(Ce(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new Y.DatabaseClosed(n);case"MissingAPIError":throw new Y.MissingAPI(n.message,n);default:throw new Y.OpenFailed(n)}if(!this.active)throw new Y.TransactionInactive;return Ce(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||r).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Te(function(o){tr(o),t._reject(e.error)}),e.onabort=Te(function(o){tr(o),t.active&&t._reject(new Y.Abort(e.error)),t.active=!1,t.on("abort").fire(o)}),e.oncomplete=Te(function(){t.active=!1,t._resolve(),"mutatedParts"in e&&_t.storagemutated.fire(e.mutatedParts)}),this},ht.prototype._promise=function(e,t,r){var n=this;if(e==="readwrite"&&this.mode!=="readwrite")return qe(new Y.ReadOnly("Transaction is readonly"));if(!this.active)return qe(new Y.TransactionInactive);if(this._locked())return new H(function(s,u){n._blockedFuncs.push([function(){n._promise(e,t,r).then(s,u)},G])});if(r)return xt(function(){var s=new H(function(u,l){n._lock();var p=t(u,l,n);p&&p.then&&p.then(u,l)});return s.finally(function(){return n._unlock()}),s._lib=!0,s});var o=new H(function(s,u){var l=t(s,u,n);l&&l.then&&l.then(s,u)});return o._lib=!0,o},ht.prototype._root=function(){return this.parent?this.parent._root():this},ht.prototype.waitFor=function(e){var t,r=this._root(),n=H.resolve(e);r._waitingFor?r._waitingFor=r._waitingFor.then(function(){return n}):(r._waitingFor=n,r._waitingQueue=[],t=r.idbtrans.objectStore(r.storeNames[0]),function s(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(t.get(-1/0).onsuccess=s)}());var o=r._waitingFor;return new H(function(s,u){n.then(function(l){return r._waitingQueue.push(Te(s.bind(null,l)))},function(l){return r._waitingQueue.push(Te(u.bind(null,l)))}).finally(function(){r._waitingFor===o&&(r._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 t=this._memoizedTables||(this._memoizedTables={});if(S(t,e))return t[e];var r=this.schema[e];if(!r)throw new Y.NotFound("Table "+e+" not part of transaction");return r=new this.db.Table(e,r,this),r.core=this.db.core.table(e),t[e]=r},ht);function ht(){}function on(e,t,r,n,o,s,u){return{name:e,keyPath:t,unique:r,multi:n,auto:o,compound:s,src:(r&&!u?"&":"")+(n?"*":"")+(o?"++":"")+ko(t)}}function ko(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function sn(e,t,r){return{name:e,primKey:t,indexes:r,mappedClass:null,idxByName:(n=function(o){return[o.name,o]},r.reduce(function(o,s,u){return u=n(s,u),u&&(o[u[0]]=u[1]),o},{}))};var n}var nr=function(e){try{return e.only([[]]),nr=function(){return[[]]},[[]]}catch{return nr=function(){return Pt},Pt}};function an(e){return e==null?function(){}:typeof e=="string"?(t=e).split(".").length===1?function(r){return r[t]}:function(r){return ie(r,t)}:function(r){return ie(r,e)};var t}function _o(e){return[].slice.call(e)}var ya=0;function or(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function va(e,t,p){function n(v){if(v.type===3)return null;if(v.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var g=v.lower,b=v.upper,w=v.lowerOpen,v=v.upperOpen;return g===void 0?b===void 0?null:t.upperBound(b,!!v):b===void 0?t.lowerBound(g,!!w):t.bound(g,b,!!w,!!v)}function o(j){var g,b=j.name;return{name:b,schema:j,mutate:function(w){var v=w.trans,k=w.type,C=w.keys,A=w.values,O=w.range;return new Promise(function(M,K){M=Te(M);var R=v.objectStore(b),D=R.keyPath==null,F=k==="put"||k==="add";if(!F&&k!=="delete"&&k!=="deleteRange")throw new Error("Invalid operation type: "+k);var B,V=(C||A||{length:1}).length;if(C&&A&&C.length!==A.length)throw new Error("Given keys array must have same length as given values array.");if(V===0)return M({numFailures:0,failures:{},results:[],lastResult:void 0});function ue(Ze){++st,tr(Ze)}var ce=[],fe=[],st=0;if(k==="deleteRange"){if(O.type===4)return M({numFailures:st,failures:fe,results:[],lastResult:void 0});O.type===3?ce.push(B=R.clear()):ce.push(B=R.delete(n(O)))}else{var D=F?D?[A,C]:[A,null]:[C,null],ae=D[0],Ye=D[1];if(F)for(var Ge=0;Ge<V;++Ge)ce.push(B=Ye&&Ye[Ge]!==void 0?R[k](ae[Ge],Ye[Ge]):R[k](ae[Ge])),B.onerror=ue;else for(Ge=0;Ge<V;++Ge)ce.push(B=R[k](ae[Ge])),B.onerror=ue}function Br(Ze){Ze=Ze.target.result,ce.forEach(function(It,Cn){return It.error!=null&&(fe[Cn]=It.error)}),M({numFailures:st,failures:fe,results:k==="delete"?C:ce.map(function(It){return It.result}),lastResult:Ze})}B.onerror=function(Ze){ue(Ze),Br(Ze)},B.onsuccess=Br})},getMany:function(w){var v=w.trans,k=w.keys;return new Promise(function(C,A){C=Te(C);for(var O,M=v.objectStore(b),K=k.length,R=new Array(K),D=0,F=0,B=function(ce){ce=ce.target,R[ce._pos]=ce.result,++F===D&&C(R)},V=dt(A),ue=0;ue<K;++ue)k[ue]!=null&&((O=M.get(k[ue]))._pos=ue,O.onsuccess=B,O.onerror=V,++D);D===0&&C(R)})},get:function(w){var v=w.trans,k=w.key;return new Promise(function(C,A){C=Te(C);var O=v.objectStore(b).get(k);O.onsuccess=function(M){return C(M.target.result)},O.onerror=dt(A)})},query:(g=y,function(w){return new Promise(function(v,k){v=Te(v);var C,A,O,D=w.trans,M=w.values,K=w.limit,B=w.query,R=K===1/0?void 0:K,F=B.index,B=B.range,D=D.objectStore(b),F=F.isPrimaryKey?D:D.index(F.name),B=n(B);if(K===0)return v({result:[]});g?((R=M?F.getAll(B,R):F.getAllKeys(B,R)).onsuccess=function(V){return v({result:V.target.result})},R.onerror=dt(k)):(C=0,A=!M&&"openKeyCursor"in F?F.openKeyCursor(B):F.openCursor(B),O=[],A.onsuccess=function(V){var ue=A.result;return ue?(O.push(M?ue.value:ue.primaryKey),++C===K?v({result:O}):void ue.continue()):v({result:O})},A.onerror=dt(k))})}),openCursor:function(w){var v=w.trans,k=w.values,C=w.query,A=w.reverse,O=w.unique;return new Promise(function(M,K){M=Te(M);var F=C.index,R=C.range,D=v.objectStore(b),D=F.isPrimaryKey?D:D.index(F.name),F=A?O?"prevunique":"prev":O?"nextunique":"next",B=!k&&"openKeyCursor"in D?D.openKeyCursor(n(R),F):D.openCursor(n(R),F);B.onerror=dt(K),B.onsuccess=Te(function(V){var ue,ce,fe,st,ae=B.result;ae?(ae.___id=++ya,ae.done=!1,ue=ae.continue.bind(ae),ce=(ce=ae.continuePrimaryKey)&&ce.bind(ae),fe=ae.advance.bind(ae),st=function(){throw new Error("Cursor not stopped")},ae.trans=v,ae.stop=ae.continue=ae.continuePrimaryKey=ae.advance=function(){throw new Error("Cursor not started")},ae.fail=Te(K),ae.next=function(){var Ye=this,Ge=1;return this.start(function(){return Ge--?Ye.continue():Ye.stop()}).then(function(){return Ye})},ae.start=function(Ye){function Ge(){if(B.result)try{Ye()}catch(Ze){ae.fail(Ze)}else ae.done=!0,ae.start=function(){throw new Error("Cursor behind last entry")},ae.stop()}var Br=new Promise(function(Ze,It){Ze=Te(Ze),B.onerror=dt(It),ae.fail=It,ae.stop=function(Cn){ae.stop=ae.continue=ae.continuePrimaryKey=ae.advance=st,Ze(Cn)}});return B.onsuccess=Te(function(Ze){B.onsuccess=Ge,Ge()}),ae.continue=ue,ae.continuePrimaryKey=ce,ae.advance=fe,Ge(),Br},M(ae)):M(null)},K)})},count:function(w){var v=w.query,k=w.trans,C=v.index,A=v.range;return new Promise(function(O,M){var K=k.objectStore(b),R=C.isPrimaryKey?K:K.index(C.name),K=n(A),R=K?R.count(K):R.count();R.onsuccess=Te(function(D){return O(D.target.result)}),R.onerror=dt(M)})}}}var s,u,l,x=(u=p,l=_o((s=e).objectStoreNames),{schema:{name:s.name,tables:l.map(function(j){return u.objectStore(j)}).map(function(j){var g=j.keyPath,v=j.autoIncrement,b=P(g),w={},v={name:j.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:g==null,compound:b,keyPath:g,autoIncrement:v,unique:!0,extractKey:an(g)},indexes:_o(j.indexNames).map(function(k){return j.index(k)}).map(function(O){var C=O.name,A=O.unique,M=O.multiEntry,O=O.keyPath,M={name:C,compound:P(O),keyPath:O,unique:A,multiEntry:M,extractKey:an(O)};return w[or(O)]=M}),getIndexByKeyPath:function(k){return w[or(k)]}};return w[":id"]=v.primaryKey,g!=null&&(w[or(g)]=v.primaryKey),v})},hasGetAll:0<l.length&&"getAll"in u.objectStore(l[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),p=x.schema,y=x.hasGetAll,x=p.tables.map(o),h={};return x.forEach(function(j){return h[j.name]=j}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(j){if(!h[j])throw new Error("Table '".concat(j,"' not found"));return h[j]},MIN_KEY:-1/0,MAX_KEY:nr(t),schema:p}}function ba(e,t,r,n){var o=r.IDBKeyRange;return r.indexedDB,{dbcore:(n=va(t,o,n),e.dbcore.reduce(function(s,u){return u=u.create,m(m({},s),u(s))},n))}}function Er(e,n){var r=n.db,n=ba(e._middlewares,r,e._deps,n);e.core=n.dbcore,e.tables.forEach(function(o){var s=o.name;e.core.schema.tables.some(function(u){return u.name===s})&&(o.core=e.core.table(s),e[s]instanceof e.Table&&(e[s].core=o.core))})}function Ar(e,t,r,n){r.forEach(function(o){var s=n[o];t.forEach(function(u){var l=function p(y,x){return W(y,x)||(y=L(y))&&p(y,x)}(u,o);(!l||"value"in l&&l.value===void 0)&&(u===e.Transaction.prototype||u instanceof e.Transaction?q(u,o,{get:function(){return this.table(o)},set:function(p){oe(this,o,{value:p,writable:!0,configurable:!0,enumerable:!0})}}):u[o]=new e.Table(o,s))})})}function un(e,t){t.forEach(function(r){for(var n in r)r[n]instanceof e.Table&&delete r[n]})}function xa(e,t){return e._cfg.version-t._cfg.version}function wa(e,t,r,n){var o=e._dbSchema;r.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=sn("$meta",Eo("")[0],[]),e._storeNames.push("$meta"));var s=e._createTransaction("readwrite",e._storeNames,o);s.create(r),s._completion.catch(n);var u=s._reject.bind(s),l=G.transless||G;xt(function(){return G.trans=s,G.transless=l,t!==0?(Er(e,r),y=t,((p=s).storeNames.includes("$meta")?p.table("$meta").get("version").then(function(x){return x??y}):H.resolve(y)).then(function(x){return j=x,g=s,b=r,w=[],x=(h=e)._versions,v=h._dbSchema=Sr(0,h.idbdb,b),(x=x.filter(function(k){return k._cfg.version>=j})).length!==0?(x.forEach(function(k){w.push(function(){var C=v,A=k._cfg.dbschema;Or(h,C,b),Or(h,A,b),v=h._dbSchema=A;var O=ln(C,A);O.add.forEach(function(F){cn(b,F[0],F[1].primKey,F[1].indexes)}),O.change.forEach(function(F){if(F.recreate)throw new Y.Upgrade("Not yet support for changing primary key");var B=b.objectStore(F.name);F.add.forEach(function(V){return Nr(B,V)}),F.change.forEach(function(V){B.deleteIndex(V.name),Nr(B,V)}),F.del.forEach(function(V){return B.deleteIndex(V)})});var M=k._cfg.contentUpgrade;if(M&&k._cfg.version>j){Er(h,b),g._memoizedTables={};var K=Ke(A);O.del.forEach(function(F){K[F]=C[F]}),un(h,[h.Transaction.prototype]),Ar(h,[h.Transaction.prototype],N(K),K),g.schema=K;var R,D=re(M);return D&&Kt(),O=H.follow(function(){var F;(R=M(g))&&D&&(F=wt.bind(null,null),R.then(F,F))}),R&&typeof R.then=="function"?H.resolve(R):O.then(function(){return R})}}),w.push(function(C){var A,O,M=k._cfg.dbschema;A=M,O=C,[].slice.call(O.db.objectStoreNames).forEach(function(K){return A[K]==null&&O.db.deleteObjectStore(K)}),un(h,[h.Transaction.prototype]),Ar(h,[h.Transaction.prototype],h._storeNames,h._dbSchema),g.schema=h._dbSchema}),w.push(function(C){h.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(h.idbdb.version/10)===k._cfg.version?(h.idbdb.deleteObjectStore("$meta"),delete h._dbSchema.$meta,h._storeNames=h._storeNames.filter(function(A){return A!=="$meta"})):C.objectStore("$meta").put(k._cfg.version,"version"))})}),function k(){return w.length?H.resolve(w.shift()(g.idbtrans)).then(k):H.resolve()}().then(function(){Co(v,b)})):H.resolve();var h,j,g,b,w,v}).catch(u)):(N(o).forEach(function(x){cn(r,x,o[x].primKey,o[x].indexes)}),Er(e,r),void H.follow(function(){return e.on.populate.fire(s)}).catch(u));var p,y})}function ja(e,t){Co(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var r=Sr(0,e.idbdb,t);Or(e,e._dbSchema,t);for(var n=0,o=ln(r,e._dbSchema).change;n<o.length;n++){var s=function(u){if(u.change.length||u.recreate)return console.warn("Unable to patch indexes of table ".concat(u.name," because it has changes on the type of index or primary key.")),{value:void 0};var l=t.objectStore(u.name);u.add.forEach(function(p){f&&console.debug("Dexie upgrade patch: Creating missing index ".concat(u.name,".").concat(p.src)),Nr(l,p)})}(o[n]);if(typeof s=="object")return s.value}}function ln(e,t){var r,n={del:[],add:[],change:[]};for(r in e)t[r]||n.del.push(r);for(r in t){var o=e[r],s=t[r];if(o){var u={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||o.primKey.auto!==s.primKey.auto)u.recreate=!0,n.change.push(u);else{var l=o.idxByName,p=s.idxByName,y=void 0;for(y in l)p[y]||u.del.push(y);for(y in p){var x=l[y],h=p[y];x?x.src!==h.src&&u.change.push(h):u.add.push(h)}(0<u.del.length||0<u.add.length||0<u.change.length)&&n.change.push(u)}}else n.add.push([r,s])}return n}function cn(e,t,r,n){var o=e.db.createObjectStore(t,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(function(s){return Nr(o,s)}),o}function Co(e,t){N(e).forEach(function(r){t.db.objectStoreNames.contains(r)||(f&&console.debug("Dexie: Creating missing table",r),cn(t,r,e[r].primKey,e[r].indexes))})}function Nr(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sr(e,t,r){var n={};return te(t.objectStoreNames,0).forEach(function(o){for(var s=r.objectStore(o),u=on(ko(y=s.keyPath),y||"",!0,!1,!!s.autoIncrement,y&&typeof y!="string",!0),l=[],p=0;p<s.indexNames.length;++p){var x=s.index(s.indexNames[p]),y=x.keyPath,x=on(x.name,y,!!x.unique,!!x.multiEntry,!1,y&&typeof y!="string",!1);l.push(x)}n[o]=sn(o,u,l)}),n}function Or(e,t,r){for(var n=r.db.objectStoreNames,o=0;o<n.length;++o){var s=n[o],u=r.objectStore(s);e._hasGetAll="getAll"in u;for(var l=0;l<u.indexNames.length;++l){var p=u.indexNames[l],y=u.index(p).keyPath,x=typeof y=="string"?y:"["+te(y).join("+")+"]";!t[s]||(y=t[s].idxByName[x])&&(y.name=p,delete t[s].idxByName[x],t[s].idxByName[p]=y)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&E.WorkerGlobalScope&&E instanceof E.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function Eo(e){return e.split(",").map(function(t,r){var n=(t=t.trim()).replace(/([&*]|\+\+)/g,""),o=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return on(n,o||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),P(o),r===0)})}var ka=(Pr.prototype._parseStoresSpec=function(e,t){N(e).forEach(function(r){if(e[r]!==null){var n=Eo(e[r]),o=n.shift();if(o.unique=!0,o.multi)throw new Y.Schema("Primary key cannot be multi-valued");n.forEach(function(s){if(s.auto)throw new Y.Schema("Only primary key can be marked as autoIncrement (++)");if(!s.keyPath)throw new Y.Schema("Index must have a name and cannot be an empty string")}),t[r]=sn(r,o,n)}})},Pr.prototype.stores=function(r){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?I(this._cfg.storesSource,r):r;var r=t._versions,n={},o={};return r.forEach(function(s){I(n,s._cfg.storesSource),o=s._cfg.dbschema={},s._parseStoresSpec(n,o)}),t._dbSchema=o,un(t,[t._allTables,t,t.Transaction.prototype]),Ar(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],N(o),o),t._storeNames=N(o),this},Pr.prototype.upgrade=function(e){return this._cfg.contentUpgrade=Fe(this._cfg.contentUpgrade||ve,e),this},Pr);function Pr(){}function fn(e,t){var r=e._dbNamesDB;return r||(r=e._dbNamesDB=new gt(wr,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),r.table("dbnames")}function dn(e){return e&&typeof e.databases=="function"}function hn(e){return xt(function(){return G.letThrough=!0,e()})}function pn(e){return!("from"in e)}var Je=function(e,t){if(!this){var r=new Je;return e&&"d"in e&&I(r,e),r}I(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function sr(e,t,r){var n=ge(t,r);if(!isNaN(n)){if(0<n)throw RangeError();if(pn(e))return I(e,{from:t,to:r,d:1});var o=e.l,n=e.r;if(ge(r,e.from)<0)return o?sr(o,t,r):e.l={from:t,to:r,d:1,l:null,r:null},No(e);if(0<ge(t,e.to))return n?sr(n,t,r):e.r={from:t,to:r,d:1,l:null,r:null},No(e);ge(t,e.from)<0&&(e.from=t,e.l=null,e.d=n?n.d+1:1),0<ge(r,e.to)&&(e.to=r,e.r=null,e.d=e.l?e.l.d+1:1),r=!e.r,o&&!e.l&&ar(e,o),n&&r&&ar(e,n)}}function ar(e,t){pn(t)||function r(n,p){var s=p.from,u=p.to,l=p.l,p=p.r;sr(n,s,u),l&&r(n,l),p&&r(n,p)}(e,t)}function Ao(e,t){var r=Tr(t),n=r.next();if(n.done)return!1;for(var o=n.value,s=Tr(e),u=s.next(o.from),l=u.value;!n.done&&!u.done;){if(ge(l.from,o.to)<=0&&0<=ge(l.to,o.from))return!0;ge(o.from,l.from)<0?o=(n=r.next(l.from)).value:l=(u=s.next(o.from)).value}return!1}function Tr(e){var t=pn(e)?null:{s:0,n:e};return{next:function(r){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ge(r,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ge(r,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function No(e){var t,r,n=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((r=e.l)===null||r===void 0?void 0:r.d)||0),o=1<n?"r":n<-1?"l":"";o&&(t=o=="r"?"l":"r",r=m({},e),n=e[o],e.from=n.from,e.to=n.to,e[o]=n[o],r[o]=n[t],(e[t]=r).d=So(r)),e.d=So(e)}function So(r){var t=r.r,r=r.l;return(t?r?Math.max(t.d,r.d):t.d:r?r.d:0)+1}function Mr(e,t){return N(t).forEach(function(r){e[r]?ar(e[r],t[r]):e[r]=function n(o){var s,u,l={};for(s in o)S(o,s)&&(u=o[s],l[s]=!u||typeof u!="object"||le.has(u.constructor)?u:n(u));return l}(t[r])}),e}function mn(e,t){return e.all||t.all||Object.keys(e).some(function(r){return t[r]&&Ao(t[r],e[r])})}Q(Je.prototype,((ut={add:function(e){return ar(this,e),this},addKey:function(e){return sr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(r){return sr(t,r,r)}),this},hasKey:function(e){var t=Tr(this).next(e).value;return t&&ge(t.from,e)<=0&&0<=ge(t.to,e)}})[he]=function(){return Tr(this)},ut));var Mt={},gn={},yn=!1;function Rr(e){Mr(gn,e),yn||(yn=!0,setTimeout(function(){yn=!1,vn(gn,!(gn={}))},0))}function vn(e,t){t===void 0&&(t=!1);var r=new Set;if(e.all)for(var n=0,o=Object.values(Mt);n<o.length;n++)Oo(u=o[n],e,r,t);else for(var s in e){var u,l=/^idb\:\/\/(.*)\/(.*)\//.exec(s);l&&(s=l[1],l=l[2],(u=Mt["idb://".concat(s,"/").concat(l)])&&Oo(u,e,r,t))}r.forEach(function(p){return p()})}function Oo(e,t,r,n){for(var o=[],s=0,u=Object.entries(e.queries.query);s<u.length;s++){for(var l=u[s],p=l[0],y=[],x=0,h=l[1];x<h.length;x++){var j=h[x];mn(t,j.obsSet)?j.subscribers.forEach(function(v){return r.add(v)}):n&&y.push(j)}n&&o.push([p,y])}if(n)for(var g=0,b=o;g<b.length;g++){var w=b[g],p=w[0],y=w[1];e.queries.query[p]=y}}function _a(e){var t=e._state,r=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?qe(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var n=t.openCanceller,o=Math.round(10*e.verno),s=!1;function u(){if(t.openCanceller!==n)throw new Y.DatabaseClosed("db.open() was cancelled")}function l(){return new H(function(j,g){if(u(),!r)throw new Y.MissingAPI;var b=e.name,w=t.autoSchema||!o?r.open(b):r.open(b,o);if(!w)throw new Y.MissingAPI;w.onerror=dt(g),w.onblocked=Te(e._fireOnBlocked),w.onupgradeneeded=Te(function(v){var k;x=w.transaction,t.autoSchema&&!e._options.allowEmptyDB?(w.onerror=tr,x.abort(),w.result.close(),(k=r.deleteDatabase(b)).onsuccess=k.onerror=Te(function(){g(new Y.NoSuchDatabase("Database ".concat(b," doesnt exist")))})):(x.onerror=dt(g),v=v.oldVersion>Math.pow(2,62)?0:v.oldVersion,h=v<1,e.idbdb=w.result,s&&ja(e,x),wa(e,v/10,x,g))},g),w.onsuccess=Te(function(){x=null;var v,k,C,A,O,M=e.idbdb=w.result,K=te(M.objectStoreNames);if(0<K.length)try{var R=M.transaction((A=K).length===1?A[0]:A,"readonly");if(t.autoSchema)k=M,C=R,(v=e).verno=k.version/10,C=v._dbSchema=Sr(0,k,C),v._storeNames=te(k.objectStoreNames,0),Ar(v,[v._allTables],N(C),C);else if(Or(e,e._dbSchema,R),((O=ln(Sr(0,(O=e).idbdb,R),O._dbSchema)).add.length||O.change.some(function(D){return D.add.length||D.change.length}))&&!s)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."),M.close(),o=M.version+1,s=!0,j(l());Er(e,R)}catch{}Lt.push(e),M.onversionchange=Te(function(D){t.vcFired=!0,e.on("versionchange").fire(D)}),M.onclose=Te(function(D){e.on("close").fire(D)}),h&&(O=e._deps,R=b,M=O.indexedDB,O=O.IDBKeyRange,dn(M)||R===wr||fn(M,O).put({name:R}).catch(ve)),j()},g)}).catch(function(j){switch(j==null?void 0:j.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),l();break;case"VersionError":if(0<o)return o=0,l()}return H.reject(j)})}var p,y=t.dbReadyResolve,x=null,h=!1;return H.race([n,(typeof navigator>"u"?H.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(j){function g(){return indexedDB.databases().finally(j)}p=setInterval(g,100),g()}).finally(function(){return clearInterval(p)}):Promise.resolve()).then(l)]).then(function(){return u(),t.onReadyBeingFired=[],H.resolve(hn(function(){return e.on.ready.fire(e.vip)})).then(function j(){if(0<t.onReadyBeingFired.length){var g=t.onReadyBeingFired.reduce(Fe,ve);return t.onReadyBeingFired=[],H.resolve(hn(function(){return g(e.vip)})).then(j)}})}).finally(function(){t.openCanceller===n&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(j){t.dbOpenError=j;try{x&&x.abort()}catch{}return n===t.openCanceller&&e._close(),qe(j)}).finally(function(){t.openComplete=!0,y()}).then(function(){var j;return h&&(j={},e.tables.forEach(function(g){g.schema.indexes.forEach(function(b){b.name&&(j["idb://".concat(e.name,"/").concat(g.name,"/").concat(b.name)]=new Je(-1/0,[[[]]]))}),j["idb://".concat(e.name,"/").concat(g.name,"/")]=j["idb://".concat(e.name,"/").concat(g.name,"/:dels")]=new Je(-1/0,[[[]]])}),_t(rr).fire(j),vn(j,!0)),e})}function bn(e){function t(s){return e.next(s)}var r=o(t),n=o(function(s){return e.throw(s)});function o(s){return function(p){var l=s(p),p=l.value;return l.done?p:p&&typeof p.then=="function"?p.then(r,n):P(p)?Promise.all(p).then(r,n):r(p)}}return o(t)()}function Ir(e,t,r){for(var n=P(e)?e.slice():[e],o=0;o<r;++o)n.push(t);return n}var Ca={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return m(m({},e),{table:function(t){var r=e.table(t),n=r.schema,o={},s=[];function u(h,j,g){var b=or(h),w=o[b]=o[b]||[],v=h==null?0:typeof h=="string"?1:h.length,k=0<j,k=m(m({},g),{name:k?"".concat(b,"(virtual-from:").concat(g.name,")"):g.name,lowLevelIndex:g,isVirtual:k,keyTail:j,keyLength:v,extractKey:an(h),unique:!k&&g.unique});return w.push(k),k.isPrimaryKey||s.push(k),1<v&&u(v===2?h[0]:h.slice(0,v-1),j+1,g),w.sort(function(C,A){return C.keyTail-A.keyTail}),k}t=u(n.primaryKey.keyPath,0,n.primaryKey),o[":id"]=[t];for(var l=0,p=n.indexes;l<p.length;l++){var y=p[l];u(y.keyPath,0,y)}function x(h){var j,g=h.query.index;return g.isVirtual?m(m({},h),{query:{index:g.lowLevelIndex,range:(j=h.query.range,g=g.keyTail,{type:j.type===1?2:j.type,lower:Ir(j.lower,j.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:Ir(j.upper,j.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0})}}):h}return m(m({},r),{schema:m(m({},n),{primaryKey:t,indexes:s,getIndexByKeyPath:function(h){return(h=o[or(h)])&&h[0]}}),count:function(h){return r.count(x(h))},query:function(h){return r.query(x(h))},openCursor:function(h){var j=h.query.index,g=j.keyTail,b=j.isVirtual,w=j.keyLength;return b?r.openCursor(x(h)).then(function(k){return k&&v(k)}):r.openCursor(h);function v(k){return Object.create(k,{continue:{value:function(C){C!=null?k.continue(Ir(C,h.reverse?e.MAX_KEY:e.MIN_KEY,g)):h.unique?k.continue(k.key.slice(0,w).concat(h.reverse?e.MIN_KEY:e.MAX_KEY,g)):k.continue()}},continuePrimaryKey:{value:function(C,A){k.continuePrimaryKey(Ir(C,e.MAX_KEY,g),A)}},primaryKey:{get:function(){return k.primaryKey}},key:{get:function(){var C=k.key;return w===1?C[0]:C.slice(0,w)}},value:{get:function(){return k.value}}})}}})}})}};function xn(e,t,r,n){return r=r||{},n=n||"",N(e).forEach(function(o){var s,u,l;S(t,o)?(s=e[o],u=t[o],typeof s=="object"&&typeof u=="object"&&s&&u?(l=J(s))!==J(u)?r[n+o]=t[o]:l==="Object"?xn(s,u,r,n+o+"."):s!==u&&(r[n+o]=t[o]):s!==u&&(r[n+o]=t[o])):r[n+o]=void 0}),N(t).forEach(function(o){S(e,o)||(r[n+o]=t[o])}),r}function wn(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Ea={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return m(m({},e),{table:function(t){var r=e.table(t),n=r.schema.primaryKey;return m(m({},r),{mutate:function(o){var s=G.trans,u=s.table(t).hook,l=u.deleting,p=u.creating,y=u.updating;switch(o.type){case"add":if(p.fire===ve)break;return s._promise("readwrite",function(){return x(o)},!0);case"put":if(p.fire===ve&&y.fire===ve)break;return s._promise("readwrite",function(){return x(o)},!0);case"delete":if(l.fire===ve)break;return s._promise("readwrite",function(){return x(o)},!0);case"deleteRange":if(l.fire===ve)break;return s._promise("readwrite",function(){return function h(j,g,b){return r.query({trans:j,values:!1,query:{index:n,range:g},limit:b}).then(function(w){var v=w.result;return x({type:"delete",keys:v,trans:j}).then(function(k){return 0<k.numFailures?Promise.reject(k.failures[0]):v.length<b?{failures:[],numFailures:0,lastResult:void 0}:h(j,m(m({},g),{lower:v[v.length-1],lowerOpen:!0}),b)})})}(o.trans,o.range,1e4)},!0)}return r.mutate(o);function x(h){var j,g,b,w=G.trans,v=h.keys||wn(n,h);if(!v)throw new Error("Keys missing");return(h=h.type==="add"||h.type==="put"?m(m({},h),{keys:v}):m({},h)).type!=="delete"&&(h.values=_([],h.values)),h.keys&&(h.keys=_([],h.keys)),j=r,b=v,((g=h).type==="add"?Promise.resolve([]):j.getMany({trans:g.trans,keys:b,cache:"immutable"})).then(function(k){var C=v.map(function(A,O){var M,K,R,D=k[O],F={onerror:null,onsuccess:null};return h.type==="delete"?l.fire.call(F,A,D,w):h.type==="add"||D===void 0?(M=p.fire.call(F,A,h.values[O],w),A==null&&M!=null&&(h.keys[O]=A=M,n.outbound||se(h.values[O],n.keyPath,A))):(M=xn(D,h.values[O]),(K=y.fire.call(F,M,A,D,w))&&(R=h.values[O],Object.keys(K).forEach(function(B){S(R,B)?R[B]=K[B]:se(R,B,K[B])}))),F});return r.mutate(h).then(function(A){for(var O=A.failures,M=A.results,K=A.numFailures,A=A.lastResult,R=0;R<v.length;++R){var D=(M||v)[R],F=C[R];D==null?F.onerror&&F.onerror(O[R]):F.onsuccess&&F.onsuccess(h.type==="put"&&k[R]?h.values[R]:D)}return{failures:O,results:M,numFailures:K,lastResult:A}}).catch(function(A){return C.forEach(function(O){return O.onerror&&O.onerror(A)}),Promise.reject(A)})})}}})}})}};function Po(e,t,r){try{if(!t||t.keys.length<e.length)return null;for(var n=[],o=0,s=0;o<t.keys.length&&s<e.length;++o)ge(t.keys[o],e[s])===0&&(n.push(r?Ee(t.values[o]):t.values[o]),++s);return n.length===e.length?n:null}catch{return null}}var Aa={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var r=e.table(t);return m(m({},r),{getMany:function(n){if(!n.cache)return r.getMany(n);var o=Po(n.keys,n.trans._cache,n.cache==="clone");return o?H.resolve(o):r.getMany(n).then(function(s){return n.trans._cache={keys:n.keys,values:n.cache==="clone"?Ee(s):s},s})},mutate:function(n){return n.type!=="add"&&(n.trans._cache=null),r.mutate(n)}})}}}};function To(e,t){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!t.schema.primaryKey.outbound}function Mo(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Na={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,r=new Je(e.MIN_KEY,e.MAX_KEY);return m(m({},e),{transaction:function(n,o,s){if(G.subscr&&o!=="readonly")throw new Y.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(G.querier));return e.transaction(n,o,s)},table:function(n){var o=e.table(n),s=o.schema,u=s.primaryKey,h=s.indexes,l=u.extractKey,p=u.outbound,y=u.autoIncrement&&h.filter(function(g){return g.compound&&g.keyPath.includes(u.keyPath)}),x=m(m({},o),{mutate:function(g){function b(B){return B="idb://".concat(t,"/").concat(n,"/").concat(B),A[B]||(A[B]=new Je)}var w,v,k,C=g.trans,A=g.mutatedParts||(g.mutatedParts={}),O=b(""),M=b(":dels"),K=g.type,F=g.type==="deleteRange"?[g.range]:g.type==="delete"?[g.keys]:g.values.length<50?[wn(u,g).filter(function(B){return B}),g.values]:[],R=F[0],D=F[1],F=g.trans._cache;return P(R)?(O.addKeys(R),(F=K==="delete"||R.length===D.length?Po(R,F):null)||M.addKeys(R),(F||D)&&(w=b,v=F,k=D,s.indexes.forEach(function(B){var V=w(B.name||"");function ue(fe){return fe!=null?B.extractKey(fe):null}function ce(fe){return B.multiEntry&&P(fe)?fe.forEach(function(st){return V.addKey(st)}):V.addKey(fe)}(v||k).forEach(function(fe,Ye){var ae=v&&ue(v[Ye]),Ye=k&&ue(k[Ye]);ge(ae,Ye)!==0&&(ae!=null&&ce(ae),Ye!=null&&ce(Ye))})}))):R?(D={from:(D=R.lower)!==null&&D!==void 0?D:e.MIN_KEY,to:(D=R.upper)!==null&&D!==void 0?D:e.MAX_KEY},M.add(D),O.add(D)):(O.add(r),M.add(r),s.indexes.forEach(function(B){return b(B.name).add(r)})),o.mutate(g).then(function(B){return!R||g.type!=="add"&&g.type!=="put"||(O.addKeys(B.results),y&&y.forEach(function(V){for(var ue=g.values.map(function(ae){return V.extractKey(ae)}),ce=V.keyPath.findIndex(function(ae){return ae===u.keyPath}),fe=0,st=B.results.length;fe<st;++fe)ue[fe][ce]=B.results[fe];b(V.name).addKeys(ue)})),C.mutatedParts=Mr(C.mutatedParts||{},A),B})}}),h=function(b){var w=b.query,b=w.index,w=w.range;return[b,new Je((b=w.lower)!==null&&b!==void 0?b:e.MIN_KEY,(w=w.upper)!==null&&w!==void 0?w:e.MAX_KEY)]},j={get:function(g){return[u,new Je(g.key)]},getMany:function(g){return[u,new Je().addKeys(g.keys)]},count:h,query:h,openCursor:h};return N(j).forEach(function(g){x[g]=function(b){var w=G.subscr,v=!!w,k=To(G,o)&&Mo(g,b)?b.obsSet={}:w;if(v){var C=function(D){return D="idb://".concat(t,"/").concat(n,"/").concat(D),k[D]||(k[D]=new Je)},A=C(""),O=C(":dels"),w=j[g](b),v=w[0],w=w[1];if((g==="query"&&v.isPrimaryKey&&!b.values?O:C(v.name||"")).add(w),!v.isPrimaryKey){if(g!=="count"){var M=g==="query"&&p&&b.values&&o.query(m(m({},b),{values:!1}));return o[g].apply(this,arguments).then(function(D){if(g==="query"){if(p&&b.values)return M.then(function(ue){return ue=ue.result,A.addKeys(ue),D});var F=b.values?D.result.map(l):D.result;(b.values?A:O).addKeys(F)}else if(g==="openCursor"){var B=D,V=b.values;return B&&Object.create(B,{key:{get:function(){return O.addKey(B.primaryKey),B.key}},primaryKey:{get:function(){var ue=B.primaryKey;return O.addKey(ue),ue}},value:{get:function(){return V&&A.addKey(B.primaryKey),B.value}}})}return D})}O.add(r)}}return o[g].apply(this,arguments)}}),x}})}};function Ro(e,t,r){if(r.numFailures===0)return t;if(t.type==="deleteRange")return null;var n=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1;return r.numFailures===n?null:(t=m({},t),P(t.keys)&&(t.keys=t.keys.filter(function(o,s){return!(s in r.failures)})),"values"in t&&P(t.values)&&(t.values=t.values.filter(function(o,s){return!(s in r.failures)})),t)}function jn(e,t){return r=e,((n=t).lower===void 0||(n.lowerOpen?0<ge(r,n.lower):0<=ge(r,n.lower)))&&(e=e,(t=t).upper===void 0||(t.upperOpen?ge(e,t.upper)<0:ge(e,t.upper)<=0));var r,n}function Io(e,t,j,n,o,s){if(!j||j.length===0)return e;var u=t.query.index,l=u.multiEntry,p=t.query.range,y=n.schema.primaryKey.extractKey,x=u.extractKey,h=(u.lowLevelIndex||u).extractKey,j=j.reduce(function(g,b){var w=g,v=[];if(b.type==="add"||b.type==="put")for(var k=new Je,C=b.values.length-1;0<=C;--C){var A,O=b.values[C],M=y(O);k.hasKey(M)||(A=x(O),(l&&P(A)?A.some(function(B){return jn(B,p)}):jn(A,p))&&(k.addKey(M),v.push(O)))}switch(b.type){case"add":var K=new Je().addKeys(t.values?g.map(function(V){return y(V)}):g),w=g.concat(t.values?v.filter(function(V){return V=y(V),!K.hasKey(V)&&(K.addKey(V),!0)}):v.map(function(V){return y(V)}).filter(function(V){return!K.hasKey(V)&&(K.addKey(V),!0)}));break;case"put":var R=new Je().addKeys(b.values.map(function(V){return y(V)}));w=g.filter(function(V){return!R.hasKey(t.values?y(V):V)}).concat(t.values?v:v.map(function(V){return y(V)}));break;case"delete":var D=new Je().addKeys(b.keys);w=g.filter(function(V){return!D.hasKey(t.values?y(V):V)});break;case"deleteRange":var F=b.range;w=g.filter(function(V){return!jn(y(V),F)})}return w},e);return j===e?e:(j.sort(function(g,b){return ge(h(g),h(b))||ge(y(g),y(b))}),t.limit&&t.limit<1/0&&(j.length>t.limit?j.length=t.limit:e.length===t.limit&&j.length<t.limit&&(o.dirty=!0)),s?Object.freeze(j):j)}function Do(e,t){return ge(e.lower,t.lower)===0&&ge(e.upper,t.upper)===0&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Sa(e,t){return function(r,n,o,s){if(r===void 0)return n!==void 0?-1:0;if(n===void 0)return 1;if((n=ge(r,n))===0){if(o&&s)return 0;if(o)return 1;if(s)return-1}return n}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(r,n,o,s){if(r===void 0)return n!==void 0?1:0;if(n===void 0)return-1;if((n=ge(r,n))===0){if(o&&s)return 0;if(o)return-1;if(s)return 1}return n}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Oa(e,t,r,n){e.subscribers.add(r),n.addEventListener("abort",function(){var o,s;e.subscribers.delete(r),e.subscribers.size===0&&(o=e,s=t,setTimeout(function(){o.subscribers.size===0&&Ie(s,o)},3e3))})}var Pa={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name;return m(m({},e),{transaction:function(r,n,o){var s,u,l=e.transaction(r,n,o);return n==="readwrite"&&(u=(s=new AbortController).signal,o=function(p){return function(){if(s.abort(),n==="readwrite"){for(var y=new Set,x=0,h=r;x<h.length;x++){var j=h[x],g=Mt["idb://".concat(t,"/").concat(j)];if(g){var b=e.table(j),w=g.optimisticOps.filter(function(V){return V.trans===l});if(l._explicit&&p&&l.mutatedParts)for(var v=0,k=Object.values(g.queries.query);v<k.length;v++)for(var C=0,A=(K=k[v]).slice();C<A.length;C++)mn((R=A[C]).obsSet,l.mutatedParts)&&(Ie(K,R),R.subscribers.forEach(function(V){return y.add(V)}));else if(0<w.length){g.optimisticOps=g.optimisticOps.filter(function(V){return V.trans!==l});for(var O=0,M=Object.values(g.queries.query);O<M.length;O++)for(var K,R,D,F=0,B=(K=M[O]).slice();F<B.length;F++)(R=B[F]).res!=null&&l.mutatedParts&&(p&&!R.dirty?(D=Object.isFrozen(R.res),D=Io(R.res,R.req,w,b,R,D),R.dirty?(Ie(K,R),R.subscribers.forEach(function(V){return y.add(V)})):D!==R.res&&(R.res=D,R.promise=H.resolve({result:D}))):(R.dirty&&Ie(K,R),R.subscribers.forEach(function(V){return y.add(V)})))}}}y.forEach(function(V){return V()})}}},l.addEventListener("abort",o(!1),{signal:u}),l.addEventListener("error",o(!1),{signal:u}),l.addEventListener("complete",o(!0),{signal:u})),l},table:function(r){var n=e.table(r),o=n.schema.primaryKey;return m(m({},n),{mutate:function(s){var u=G.trans;if(o.outbound||u.db._options.cache==="disabled"||u.explicit||u.idbtrans.mode!=="readwrite")return n.mutate(s);var l=Mt["idb://".concat(t,"/").concat(r)];return l?(u=n.mutate(s),s.type!=="add"&&s.type!=="put"||!(50<=s.values.length||wn(o,s).some(function(p){return p==null}))?(l.optimisticOps.push(s),s.mutatedParts&&Rr(s.mutatedParts),u.then(function(p){0<p.numFailures&&(Ie(l.optimisticOps,s),(p=Ro(0,s,p))&&l.optimisticOps.push(p),s.mutatedParts&&Rr(s.mutatedParts))}),u.catch(function(){Ie(l.optimisticOps,s),s.mutatedParts&&Rr(s.mutatedParts)})):u.then(function(p){var y=Ro(0,m(m({},s),{values:s.values.map(function(x,h){var j;return p.failures[h]?x:(x=(j=o.keyPath)!==null&&j!==void 0&&j.includes(".")?Ee(x):m({},x),se(x,o.keyPath,p.results[h]),x)})}),p);l.optimisticOps.push(y),queueMicrotask(function(){return s.mutatedParts&&Rr(s.mutatedParts)})}),u):n.mutate(s)},query:function(s){if(!To(G,n)||!Mo("query",s))return n.query(s);var u=((y=G.trans)===null||y===void 0?void 0:y.db._options.cache)==="immutable",h=G,l=h.requery,p=h.signal,y=function(b,w,v,k){var C=Mt["idb://".concat(b,"/").concat(w)];if(!C)return[];if(!(w=C.queries[v]))return[null,!1,C,null];var A=w[(k.query?k.query.index.name:null)||""];if(!A)return[null,!1,C,null];switch(v){case"query":var O=A.find(function(M){return M.req.limit===k.limit&&M.req.values===k.values&&Do(M.req.query.range,k.query.range)});return O?[O,!0,C,A]:[A.find(function(M){return("limit"in M.req?M.req.limit:1/0)>=k.limit&&(!k.values||M.req.values)&&Sa(M.req.query.range,k.query.range)}),!1,C,A];case"count":return O=A.find(function(M){return Do(M.req.query.range,k.query.range)}),[O,!!O,C,A]}}(t,r,"query",s),x=y[0],h=y[1],j=y[2],g=y[3];return x&&h?x.obsSet=s.obsSet:(h=n.query(s).then(function(b){var w=b.result;if(x&&(x.res=w),u){for(var v=0,k=w.length;v<k;++v)Object.freeze(w[v]);Object.freeze(w)}else b.result=Ee(w);return b}).catch(function(b){return g&&x&&Ie(g,x),Promise.reject(b)}),x={obsSet:s.obsSet,promise:h,subscribers:new Set,type:"query",req:s,dirty:!1},g?g.push(x):(g=[x],(j=j||(Mt["idb://".concat(t,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[s.query.index.name||""]=g)),Oa(x,g,l,p),x.promise.then(function(b){return{result:Io(b.result,s,j==null?void 0:j.optimisticOps,n,x,u)}})}})}})}};function Dr(e,t){return new Proxy(e,{get:function(r,n,o){return n==="db"?t:Reflect.get(r,n,o)}})}var gt=(Be.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 t=this._versions,r=t.filter(function(n){return n._cfg.version===e})[0];return r||(r=new this.Version(e),t.push(r),t.sort(xa),r.stores({}),this._state.autoSchema=!1,r)},Be.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||G.letThrough||this._vip)?e():new H(function(r,n){if(t._state.openComplete)return n(new Y.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new Y.DatabaseClosed);t.open().catch(ve)}t._state.dbReadyPromise.then(r,n)}).then(e)},Be.prototype.use=function(e){var t=e.stack,r=e.create,n=e.level,o=e.name;return o&&this.unuse({stack:t,name:o}),e=this._middlewares[t]||(this._middlewares[t]=[]),e.push({stack:t,create:r,level:n??10,name:o}),e.sort(function(s,u){return s.level-u.level}),this},Be.prototype.unuse=function(e){var t=e.stack,r=e.name,n=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(o){return n?o.create!==n:!!r&&o.name!==r})),this},Be.prototype.open=function(){var e=this;return Ot(He,function(){return _a(e)})},Be.prototype._close=function(){var e=this._state,t=Lt.indexOf(this);if(0<=t&&Lt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new H(function(r){e.dbReadyResolve=r}),e.openCanceller=new H(function(r,n){e.cancelOpen=n}))},Be.prototype.close=function(r){var t=(r===void 0?{disableAutoOpen:!0}:r).disableAutoOpen,r=this._state;t?(r.isBeingOpened&&r.cancelOpen(new Y.DatabaseClosed),this._close(),r.autoOpen=!1,r.dbOpenError=new Y.DatabaseClosed):(this._close(),r.autoOpen=this._options.autoOpen||r.isBeingOpened,r.openComplete=!1,r.dbOpenError=null)},Be.prototype.delete=function(e){var t=this;e===void 0&&(e={disableAutoOpen:!0});var r=0<arguments.length&&typeof arguments[0]!="object",n=this._state;return new H(function(o,s){function u(){t.close(e);var l=t._deps.indexedDB.deleteDatabase(t.name);l.onsuccess=Te(function(){var p,y,x;p=t._deps,y=t.name,x=p.indexedDB,p=p.IDBKeyRange,dn(x)||y===wr||fn(x,p).delete(y).catch(ve),o()}),l.onerror=dt(s),l.onblocked=t._fireOnBlocked}if(r)throw new Y.InvalidArgument("Invalid closeOptions argument to db.delete()");n.isBeingOpened?n.dbReadyPromise.then(u):u()})},Be.prototype.backendDB=function(){return this.idbdb},Be.prototype.isOpen=function(){return this.idbdb!==null},Be.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},Be.prototype.hasFailed=function(){return this._state.dbOpenError!==null},Be.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Be.prototype,"tables",{get:function(){var e=this;return N(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),Be.prototype.transaction=function(){var e=(function(t,r,n){var o=arguments.length;if(o<2)throw new Y.InvalidArgument("Too few arguments");for(var s=new Array(o-1);--o;)s[o-1]=arguments[o];return n=s.pop(),[t,ee(s),n]}).apply(this,arguments);return this._transaction.apply(this,e)},Be.prototype._transaction=function(e,t,r){var n=this,o=G.trans;o&&o.db===this&&e.indexOf("!")===-1||(o=null);var s,u,l=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");try{if(u=t.map(function(y){if(y=y instanceof n.Table?y.name:y,typeof y!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return y}),e=="r"||e===Zr)s=Zr;else{if(e!="rw"&&e!=Xr)throw new Y.InvalidArgument("Invalid transaction mode: "+e);s=Xr}if(o){if(o.mode===Zr&&s===Xr){if(!l)throw new Y.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&u.forEach(function(y){if(o&&o.storeNames.indexOf(y)===-1){if(!l)throw new Y.SubTransaction("Table "+y+" not included in parent transaction.");o=null}}),l&&o&&!o.active&&(o=null)}}catch(y){return o?o._promise(null,function(x,h){h(y)}):qe(y)}var p=(function y(x,h,j,g,b){return H.resolve().then(function(){var w=G.transless||G,v=x._createTransaction(h,j,x._dbSchema,g);if(v.explicit=!0,w={trans:v,transless:w},g)v.idbtrans=g.idbtrans;else try{v.create(),v.idbtrans._explicit=!0,x._state.PR1398_maxLoop=3}catch(A){return A.name===ft.InvalidState&&x.isOpen()&&0<--x._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),x.close({disableAutoOpen:!1}),x.open().then(function(){return y(x,h,j,null,b)})):qe(A)}var k,C=re(b);return C&&Kt(),w=H.follow(function(){var A;(k=b.call(v,v))&&(C?(A=wt.bind(null,null),k.then(A,A)):typeof k.next=="function"&&typeof k.throw=="function"&&(k=bn(k)))},w),(k&&typeof k.then=="function"?H.resolve(k).then(function(A){return v.active?A:qe(new Y.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):w.then(function(){return k})).then(function(A){return g&&v._resolve(),v._completion.then(function(){return A})}).catch(function(A){return v._reject(A),qe(A)})})}).bind(null,this,s,u,o,r);return o?o._promise(s,p,"lock"):G.trans?Ot(G.transless,function(){return n._whenReady(p)}):this._whenReady(p)},Be.prototype.table=function(e){if(!S(this._allTables,e))throw new Y.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},Be);function Be(e,t){var r=this;this._middlewares={},this.verno=0;var n=Be.dependencies;this._options=t=m({addons:Be.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,cache:"cloned"},t),this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange},n=t.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,s,u,l,p,y={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ve,dbReadyPromise:null,cancelOpen:ve,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:t.autoOpen};y.dbReadyPromise=new H(function(h){y.dbReadyResolve=h}),y.openCanceller=new H(function(h,j){y.cancelOpen=j}),this._state=y,this.name=e,this.on=Zt(this,"populate","blocked","versionchange","close",{ready:[Fe,ve]}),this.on.ready.subscribe=xe(this.on.ready.subscribe,function(h){return function(j,g){Be.vip(function(){var b,w=r._state;w.openComplete?(w.dbOpenError||H.resolve().then(j),g&&h(j)):w.onReadyBeingFired?(w.onReadyBeingFired.push(j),g&&h(j)):(h(j),b=r,g||h(function v(){b.on.ready.unsubscribe(j),b.on.ready.unsubscribe(v)}))})}}),this.Collection=(o=this,Xt(ha.prototype,function(k,v){this.db=o;var g=ho,b=null;if(v)try{g=v()}catch(C){b=C}var w=k._ctx,v=w.table,k=v.hook.reading.fire;this._ctx={table:v,index:w.index,isPrimKey:!w.index||v.schema.primKey.keyPath&&w.index===v.schema.primKey.name,range:g,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:b,or:w.or,valueMapper:k!==ct?k:null}})),this.Table=(s=this,Xt(yo.prototype,function(h,j,g){this.db=s,this._tx=g,this.name=h,this.schema=j,this.hook=s._allTables[h]?s._allTables[h].hook:Zt(null,{creating:[z,ve],reading:[Nt,ct],updating:[De,ve],deleting:[me,ve]})})),this.Transaction=(u=this,Xt(ga.prototype,function(h,j,g,b,w){var v=this;this.db=u,this.mode=h,this.storeNames=j,this.schema=g,this.chromeTransactionDurability=b,this.idbtrans=null,this.on=Zt(this,"complete","error","abort"),this.parent=w||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 H(function(k,C){v._resolve=k,v._reject=C}),this._completion.then(function(){v.active=!1,v.on.complete.fire()},function(k){var C=v.active;return v.active=!1,v.on.error.fire(k),v.parent?v.parent._reject(k):C&&v.idbtrans&&v.idbtrans.abort(),qe(k)})})),this.Version=(l=this,Xt(ka.prototype,function(h){this.db=l,this._cfg={version:h,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(p=this,Xt(jo.prototype,function(h,j,g){if(this.db=p,this._ctx={table:h,index:j===":id"?null:j,or:g},this._cmp=this._ascending=ge,this._descending=function(b,w){return ge(w,b)},this._max=function(b,w){return 0<ge(b,w)?b:w},this._min=function(b,w){return ge(b,w)<0?b:w},this._IDBKeyRange=p._deps.IDBKeyRange,!this._IDBKeyRange)throw new Y.MissingAPI})),this.on("versionchange",function(h){0<h.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})}),this.on("blocked",function(h){!h.newVersion||h.newVersion<h.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(h.oldVersion/10))}),this._maxKey=nr(t.IDBKeyRange),this._createTransaction=function(h,j,g,b){return new r.Transaction(h,j,g,r._options.chromeTransactionDurability,b)},this._fireOnBlocked=function(h){r.on("blocked").fire(h),Lt.filter(function(j){return j.name===r.name&&j!==r&&!j._state.vcFired}).map(function(j){return j.on("versionchange").fire(h)})},this.use(Aa),this.use(Pa),this.use(Na),this.use(Ca),this.use(Ea);var x=new Proxy(this,{get:function(h,j,g){if(j==="_vip")return!0;if(j==="table")return function(w){return Dr(r.table(w),x)};var b=Reflect.get(h,j,g);return b instanceof yo?Dr(b,x):j==="tables"?b.map(function(w){return Dr(w,x)}):j==="_createTransaction"?function(){return Dr(b.apply(this,arguments),x)}:b}});this.vip=x,n.forEach(function(h){return h(r)})}var qr,ut=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Ta=(kn.prototype.subscribe=function(e,t,r){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:t,complete:r})},kn.prototype[ut]=function(){return this},kn);function kn(e){this._subscribe=e}try{qr={indexedDB:E.indexedDB||E.mozIndexedDB||E.webkitIndexedDB||E.msIndexedDB,IDBKeyRange:E.IDBKeyRange||E.webkitIDBKeyRange}}catch{qr={indexedDB:null,IDBKeyRange:null}}function qo(e){var t,r=!1,n=new Ta(function(o){var s=re(e),u,l=!1,p={},y={},x={get closed(){return l},unsubscribe:function(){l||(l=!0,u&&u.abort(),h&&_t.storagemutated.unsubscribe(g))}};o.start&&o.start(x);var h=!1,j=function(){return Gr(b)},g=function(w){Mr(p,w),mn(y,p)&&j()},b=function(){var w,v,k;!l&&qr.indexedDB&&(p={},w={},u&&u.abort(),u=new AbortController,k=function(C){var A=qt();try{s&&Kt();var O=xt(e,C);return O=s?O.finally(wt):O}finally{A&&Bt()}}(v={subscr:w,signal:u.signal,requery:j,querier:e,trans:null}),Promise.resolve(k).then(function(C){r=!0,t=C,l||v.signal.aborted||(p={},function(A){for(var O in A)if(S(A,O))return;return 1}(y=w)||h||(_t(rr,g),h=!0),Gr(function(){return!l&&o.next&&o.next(C)}))},function(C){r=!1,["DatabaseClosedError","AbortError"].includes(C==null?void 0:C.name)||l||Gr(function(){l||o.error&&o.error(C)})}))};return setTimeout(j,0),x});return n.hasValue=function(){return r},n.getValue=function(){return t},n}var Rt=gt;function _n(e){var t=Ct;try{Ct=!0,_t.storagemutated.fire(e),vn(e,!0)}finally{Ct=t}}Q(Rt,m(m({},pt),{delete:function(e){return new Rt(e,{addons:[]}).delete()},exists:function(e){return new Rt(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return t=Rt.dependencies,r=t.indexedDB,t=t.IDBKeyRange,(dn(r)?Promise.resolve(r.databases()).then(function(n){return n.map(function(o){return o.name}).filter(function(o){return o!==wr})}):fn(r,t).toCollection().primaryKeys()).then(e)}catch{return qe(new Y.MissingAPI)}var t,r},defineClass:function(){return function(e){I(this,e)}},ignoreTransaction:function(e){return G.trans?Ot(G.transless,e):e()},vip:hn,async:function(e){return function(){try{var t=bn(e.apply(this,arguments));return t&&typeof t.then=="function"?t:H.resolve(t)}catch(r){return qe(r)}}},spawn:function(e,t,r){try{var n=bn(e.apply(r,t||[]));return n&&typeof n.then=="function"?n:H.resolve(n)}catch(o){return qe(o)}},currentTransaction:{get:function(){return G.trans||null}},waitFor:function(e,t){return t=H.resolve(typeof e=="function"?Rt.ignoreTransaction(e):e).timeout(t||6e4),G.trans?G.trans.waitFor(t):t},Promise:H,debug:{get:function(){return f},set:function(e){$(e)}},derive:X,extend:I,props:Q,override:xe,Events:Zt,on:_t,liveQuery:qo,extendObservabilitySet:Mr,getByKeyPath:ie,setByKeyPath:se,delByKeyPath:function(e,t){typeof t=="string"?se(e,t,void 0):"length"in t&&[].map.call(t,function(r){se(e,r,void 0)})},shallowClone:Ke,deepClone:Ee,getObjectDiff:xn,cmp:ge,asap:we,minKey:-1/0,addons:[],connections:Lt,errnames:ft,dependencies:qr,cache:Mt,semVer:"4.0.11",version:"4.0.11".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,r){return e+t/Math.pow(10,2*r)})})),Rt.maxKey=nr(Rt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(_t(rr,function(e){Ct||(e=new CustomEvent(nn,{detail:e}),Ct=!0,dispatchEvent(e),Ct=!1)}),addEventListener(nn,function(e){e=e.detail,Ct||_n(e)}));var zt,Ct=!1,Bo=function(){};return typeof BroadcastChannel<"u"&&((Bo=function(){(zt=new BroadcastChannel(nn)).onmessage=function(e){return e.data&&_n(e.data)}})(),typeof zt.unref=="function"&&zt.unref(),_t(rr,function(e){Ct||zt.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!gt.disableBfCache&&e.persisted){f&&console.debug("Dexie: handling persisted pagehide"),zt!=null&&zt.close();for(var t=0,r=Lt;t<r.length;t++)r[t].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!gt.disableBfCache&&e.persisted&&(f&&console.debug("Dexie: handling persisted pageshow"),Bo(),_n({all:new Je(-1/0,[[]])}))})),H.rejectionMapper=function(e,t){return!e||e instanceof Ae||e instanceof TypeError||e instanceof SyntaxError||!e.name||!At[e.name]?e:(t=new At[e.name](t||e.message,e),"stack"in e&&q(t,"stack",{get:function(){return this.inner.stack}}),t)},$(f),m(gt,Object.freeze({__proto__:null,Dexie:gt,liveQuery:qo,Entity:po,cmp:ge,PropModification:er,replacePrefix:function(e,t){return new er({replacePrefix:[e,t]})},add:function(e){return new er({add:e})},remove:function(e){return new er({remove:e})},default:gt,RangeSet:Je,mergeRanges:ar,rangesOverlap:Ao}),{default:gt}),gt})}(ur)),ur.exports}var $o=Uo();const Kr=Lo($o),On=Symbol.for("Dexie"),lr=globalThis[On]||(globalThis[On]=Kr);if(Kr.semVer!==lr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Kr.semVer} and ${lr.semVer}`);const{liveQuery:Wo,mergeRanges:Ma,rangesOverlap:Ra,RangeSet:Ia,cmp:Da,Entity:qa,PropModification:Ba,replacePrefix:Ka,add:La,remove:Fa}=lr;function Qo(a,c,d){var m,_;typeof a=="function"?(m=c||[],_=d):(m=[],_=c);var E=T.useRef({hasResult:!1,result:_,error:null}),N=T.useReducer(function(L){return L+1},0);N[0];var P=N[1],I=T.useMemo(function(){var L=typeof a=="function"?a():a;if(!L||typeof L.subscribe!="function")throw a===L?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(!E.current.hasResult&&typeof window<"u"&&(typeof L.hasValue!="function"||L.hasValue()))if(typeof L.getValue=="function")E.current.result=L.getValue(),E.current.hasResult=!0;else{var Z=L.subscribe(function(S){E.current.result=S,E.current.hasResult=!0});typeof Z=="function"?Z():Z.unsubscribe()}return L},m);if(T.useDebugValue(E.current.result),T.useEffect(function(){var L=I.subscribe(function(Z){var S=E.current;(S.error!==null||S.result!==Z)&&(S.error=null,S.result=Z,S.hasResult=!0,P())},function(Z){var S=E.current;S.error!==Z&&(S.error=Z,P())});return typeof L=="function"?L:L.unsubscribe.bind(L)},m),E.current.error)throw E.current.error;return E.current.result}function Pn(a,c,d){return Qo(function(){return Wo(a)},c||[],d)}const cr=a=>a>=200&&a<300?"bg-green-200 text-green-800":a>=300&&a<400?"bg-blue-200 text-blue-800":a>=400&&a<500?"bg-orange-600 text-orange-200":a>=500?"bg-red-800 text-red-100":"bg-gray-200 text-gray-800",Lr=a=>{if(!a)return"";switch(a.toUpperCase()){case"GET":return"text-[rgb(0,107,230)]";case"POST":return"text-[rgb(23,131,135)]";case"PATCH":return"text-[rgb(204,75,0)]";case"DELETE":return"text-red-700";default:return""}},Tn=a=>{if(a)return" border border-slate-500";switch(a.toUpperCase()){case"GET":return"text-green-700 border border-green-700";case"POST":return"text-sky-700 border border-sky-700";case"PUT":return"text-fuchsia-700 border border-fuchsia-700";case"PATCH":return"text-purple-700 border border-purple-700";case"DELETE":return"text-red-700 border border-red-700";case"OPTIONS":return"text-rose-700 border border-rose-700";case"HEAD":return"text-pink-700 border border-pink-700";default:return"text-gray-700 border border-gray-700"}},Jo=["bg-blue-100","border-blue-700"].join(" "),Yo="border-l-4",Mn=({operation:a,opId:c,onSelect:d,onRemove:m,selected:_})=>{var P,I,L,Z,S,Q;const E=oe=>{d(oe)},N=oe=>{const q=new Date(oe),X=String(q.getHours()).padStart(2,"0"),W=String(q.getMinutes()).padStart(2,"0"),pe=String(q.getSeconds()).padStart(2,"0");return`${X}:${W}:${pe}`};return i.jsx("li",{className:`flex items-center cursor-pointer hover:bg-gray-200 ${Yo} ${_?Jo:"border-transparent"}`,onClick:()=>{E(a)},children:i.jsxs("div",{className:"flex items-center p-2 w-full",children:[i.jsx("div",{className:"w-16 flex justify-center",children:i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${cr((P=a==null?void 0:a.response)==null?void 0:P.status)}`,children:((I=a==null?void 0:a.response)==null?void 0:I.status)||"N/A"})}),i.jsx("div",{className:`w-20 text-center font-medium ${Lr((L=a==null?void 0:a.request)==null?void 0:L.method)}`,children:((Z=a==null?void 0:a.request)==null?void 0:Z.method)||"GET"}),i.jsx("div",{className:"flex-grow truncate text-left",children:(a==null?void 0:a.request.path)||(a==null?void 0:a.request.url)}),i.jsx("div",{className:"w-20 text-gray-900 text-center text-xs",children:(S=a==null?void 0:a.request)!=null&&S.timestamp?N(a.request.timestamp):"N/A"}),i.jsxs("div",{className:"w-16 text-gray-500 text-center text-xs",children:[(Q=a==null?void 0:a.timing)==null?void 0:Q.duration,"ms"]}),i.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer text-red-500 hover:text-red-700",onClick:oe=>{oe.stopPropagation(),m(c)},children:"✕"})]})})},Fr=({options:a,selected:c,onChange:d,placeholder:m="Add option...",colorFn:_})=>{const[E,N]=T.useState(""),[P,I]=T.useState(!1),[L,Z]=T.useState(0),S=T.useRef(null),Q=a.filter(W=>W.toLowerCase().includes(E.toLowerCase())&&!c.includes(W));T.useEffect(()=>{Z(0)},[E,c]);const oe=W=>{c.includes(W)||d([...c,W]),N("")},q=W=>{d(c.filter(pe=>pe!==W))},X=W=>{W.key==="ArrowDown"?(W.preventDefault(),Z(pe=>pe+1<Q.length?pe+1:pe)):W.key==="ArrowUp"?(W.preventDefault(),Z(pe=>pe-1>=0?pe-1:0)):W.key==="Enter"?(console.log("enter",L),W.preventDefault(),Q.length>0&&oe(Q[L])):W.key==="Backspace"&&!E&&c.length>0&&q(c[c.length-1])};return i.jsxs("div",{className:"w-full max-w-md relative",children:[i.jsxs("div",{className:"flex flex-wrap items-center border border-gray-300 rounded-md shadow-sm px-2 py-1",children:[c.map(W=>i.jsxs("div",{className:`flex items-center rounded-full px-2 py-1 mr-2 my-1 text-xs ${_?_(W):"bg-indigo-100 text-indigo-700"}`,children:[i.jsx("span",{children:W}),i.jsx("button",{type:"button",onClick:()=>q(W),className:"ml-1 focus:outline-none cursor-pointer","aria-label":`Remove ${W}`,children:i.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
|
|
34
34
|
1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293
|
|
35
|
-
4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:"evenodd"})})})]},W)),i.jsx("input",{ref:
|
|
35
|
+
4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:"evenodd"})})})]},W)),i.jsx("input",{ref:S,type:"text",className:"flex-grow outline-none p-1",placeholder:c.length>0?"":m,value:E,onChange:W=>N(W.target.value),onKeyDown:X,onFocus:()=>I(!0),onBlur:()=>setTimeout(()=>I(!1),100)})]}),P&&Q.length>0&&i.jsx("ul",{className:"absolute left-0 right-0 border border-gray-300 mt-1 rounded-md shadow-lg bg-white max-h-40 overflow-y-auto z-10",children:Q.map((W,pe)=>i.jsx("li",{className:`cursor-pointer px-2 py-1 hover:bg-indigo-100 ${pe===L?"bg-indigo-200":""}`,onMouseEnter:()=>Z(pe),onMouseDown:()=>oe(W),children:W},W))})]})},Rn=({isOpen:a,onClose:c,sortField:d,sortDirection:m,filters:_,setSortField:E,setSortDirection:N,setFilters:P})=>{const I=()=>{E("time"),N("desc")},L=()=>{P({})},Z=q=>{const X=q.target.value;P(W=>({...W,timestampRange:X,customStart:void 0,customEnd:void 0}))},S=(q,X)=>{P(W=>({...W,timestampRange:{...typeof W.timestampRange=="object"&&W.timestampRange||{},[q]:X}}))},Q=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"],oe=["200","201","204","301","302","400","401","403","404","500","502","503"];return i.jsxs(i.Fragment,{children:[a&&i.jsx("div",{className:"fixed inset-0 bg-black opacity-50",style:{zIndex:9998},onClick:c}),i.jsxs("div",{className:`fixed top-0 left-0 h-full w-100 bg-white shadow-xl transform transition-transform duration-300
|
|
36
36
|
${a?"translate-x-0":"-translate-x-full"}
|
|
37
|
-
`,style:{zIndex:9999},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-300 bg-gray-50",children:[i.jsx("h2",{className:"pl-4 text-lg font-semibold text-gray-800",children:"Filter & Sort"}),i.jsx("button",{onClick:c,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"p-4 overflow-y-auto h-full",children:[i.jsxs("section",{className:"mb-6 ml-4 mr-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Sort By"}),i.jsx("button",{onClick:I,className:"text-xs text-blue-600 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"time",checked:f==="time",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Timestamp"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"statusCode",checked:f==="statusCode",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Status"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"method",checked:f==="method",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Method"})]})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"mb-2 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Sort Direction"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"asc",checked:m==="asc",onChange:q=>N(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Ascending"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"desc",checked:m==="desc",onChange:q=>N(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Descending"})]})]})]})]}),i.jsxs("section",{className:"mb-6 ml-4 mr-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Filters"}),i.jsx("button",{onClick:L,className:"text-xs text-blue-600 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Quick Time Range"}),i.jsxs("select",{value:typeof k.timestampRange=="string"?k.timestampRange:"",onChange:Y,className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[i.jsx("option",{value:"",children:"Any"}),i.jsx("option",{value:"5M",children:"Last 5 minutes"}),i.jsx("option",{value:"15M",children:"Last 15 minutes"}),i.jsx("option",{value:"30M",children:"Last 30 minutes"}),i.jsx("option",{value:"1H",children:"Last 1 hour"}),i.jsx("option",{value:"3H",children:"Last 3 hours"}),i.jsx("option",{value:"6H",children:"Last 6 hours"}),i.jsx("option",{value:"12H",children:"Last 12 hours"}),i.jsx("option",{value:"24H",children:"Last 24 hours"}),i.jsx("option",{value:"48H",children:"Last 48 hours"}),i.jsx("option",{value:"week",children:"Last Week"}),i.jsx("option",{value:"month",children:"Last Month"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Specific Time Range"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"datetime-local",value:typeof k.timestampRange=="object"&&k.timestampRange.start?k.timestampRange.start:"",onChange:q=>O("start",q.target.value),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"datetime-local",value:typeof k.timestampRange=="object"&&k.timestampRange.end?k.timestampRange.end:"",onChange:q=>O("end",q.target.value),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Status"}),i.jsx(Hn,{options:re,selected:k.status||[],onChange:q=>P(G=>({...G,status:q})),placeholder:"Add status code...",colorFn:un})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Method"}),i.jsx(Hn,{options:Q,selected:k.method||[],onChange:q=>P(G=>({...G,method:q})),placeholder:"Add method...",colorFn:Pr})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Path"}),i.jsx("input",{type:"text",placeholder:"e.g. /api/users",value:k.path||"",onChange:q=>P(G=>({...G,path:q.target.value})),className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Duration (ms)"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"number",placeholder:"Min",value:k.durationMin||"",onChange:q=>P(G=>({...G,durationMin:q.target.value})),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"number",placeholder:"Max",value:k.durationMax||"",onChange:q=>P(G=>({...G,durationMax:q.target.value})),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Host"}),i.jsx("input",{type:"text",placeholder:"e.g. localhost",value:k.host||"",onChange:q=>P(G=>({...G,host:q.target.value})),className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})]})]})]})},Mr=({currentPage:a,totalPages:c,onPageChange:f})=>{const k=((E,N)=>{const P=[];if(N<=7)for(let I=1;I<=N;I++)P.push(I);else if(E<=4){for(let I=1;I<=5;I++)P.push(I);P.push("ellipsis"),P.push(N)}else if(E>=N-3){P.push(1),P.push("ellipsis");for(let I=N-4;I<=N;I++)P.push(I)}else P.push(1),P.push("ellipsis"),P.push(E-1),P.push(E),P.push(E+1),P.push("ellipsis"),P.push(N);return P})(a,c);return i.jsx("nav",{className:"p-2 border-t border-gray-300",children:i.jsxs("ul",{className:"flex items-center justify-center -space-x-px h-8 text-sm",children:[i.jsx("li",{children:i.jsxs("button",{onClick:()=>f(a-1),disabled:a<=1,className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Previous"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 1 1 5l4 4"})})]})}),k.map((E,N)=>{if(E==="ellipsis")return i.jsx("li",{children:i.jsx("span",{className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 cursor-pointer",children:"..."})},`ellipsis-${N}`);const P=E===a;return i.jsx("li",{children:i.jsx("button",{onClick:()=>f(E),className:P?"z-10 flex items-center justify-center px-3 h-8 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-pointer":"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:E})},E)}),i.jsx("li",{children:i.jsxs("button",{onClick:()=>f(a+1),disabled:a>=c,className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Next"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})})]})})]})})},Ir=({open:a,onClose:c,onConfirmAll:f,onConfirmFiltered:m,hasFilters:k})=>a?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:c}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:i.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:i.jsx("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:k?"Clear Requests":"Clear All Requests"}),i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:k?"You have active filters. Would you like to clear only the filtered requests or all requests?":"Are you sure you want to clear all requests? This action cannot be undone."})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[i.jsx("button",{onClick:c,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),k&&i.jsx("button",{onClick:()=>{m(),c()},className:"px-4 py-2 bg-yellow-500 text-white rounded hover:bg-yellow-600 text-sm",children:"Clear Filtered"}),i.jsx("button",{onClick:()=>{f(),c()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Clear All"})]})]})]}):null,Dr=({text:a,align:c="center"})=>c==="left"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}):c==="right"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a})]}):i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}),qr=({operations:a,onSelect:c,onRemove:f,clearOperations:m,clearFilteredRequests:k,selectedOperation:E,currentPage:N,totalPages:P,totalCount:I,onPageChange:L,sortField:Y,sortDirection:O,filters:Q,setSortField:re,setSortDirection:q,setFilters:G})=>{const[W,he]=T.useState(!1),[ee,ye]=T.useState(!1),_e=Object.entries(Q||{}).reduce((ue,[Z,be])=>Z==="timestampRange"&&typeof be=="object"?be.start||be.end?ue+1:ue:be?ue+1:ue,0),ce=_e>0?"bg-green-500 text-white":"bg-blue-500 text-white",se=ue=>{const Z=new Date(ue),be=String(Z.getDate()).padStart(2,"0"),ke=String(Z.getMonth()+1).padStart(2,"0");return`${Z.getFullYear()}-${ke}-${be}`},Oe=(ue=>ue.reduce((Z,be)=>{const ke=be.request.timestamp?se(be.request.timestamp):"N/A";return Z[ke]||(Z[ke]=[]),Z[ke].push(be),Z},{}))(a);return i.jsxs("div",{className:"flex flex-col h-full relative",children:[i.jsxs("div",{className:"p-4 flex justify-between items-center",children:[i.jsxs("span",{className:"font-bold text-xl",children:["Requests (",a.length," of ",I,")"]}),i.jsxs("div",{className:"space-x-2 relative",children:[i.jsxs("button",{className:`relative px-3 py-1 rounded text-xs cursor-pointer ${ce}`,onClick:()=>he(!0),children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})}),_e>0&&i.jsx("span",{className:"absolute -top-1 -right-1 bg-green-700 text-white text-[10px] font-bold w-4 h-4 flex items-center justify-center rounded-full",children:_e})]}),i.jsx("button",{className:"px-3 py-1 bg-red-500 text-white rounded text-xs cursor-pointer",onClick:()=>ye(!0),children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})]})]}),i.jsxs("div",{className:"flex items-center bg-gray-200 p-2 border-b border-gray-300 text-sm font-bold cursor-pointer",onClick:()=>he(!0),children:[i.jsx("div",{className:"w-16 text-center",children:"Status"}),i.jsx("div",{className:"w-20 text-center",children:"Method"}),i.jsx("div",{className:"flex-grow text-left",children:"Path"}),i.jsx("div",{className:"w-20 text-center",children:"Timestamp"}),i.jsx("div",{className:"w-16 text-right",children:"Duration"}),i.jsx("div",{className:"w-10"})]}),i.jsx("ul",{className:"overflow-y-auto flex-grow",style:{maxHeight:"calc(100vh - 40px - 100px - 49px)"},children:a.length===0?i.jsx("li",{className:"flex items-center justify-center h-full text-gray-500 text-2xl",children:"No operations"}):Object.entries(Oe).map(([ue,Z])=>i.jsxs(T.Fragment,{children:[i.jsx("li",{children:i.jsx(Dr,{text:ue,align:"center"})}),Z.map((be,ke)=>{const Re=be.id||ke;return i.jsx(Tr,{opId:Re,operation:be,onSelect:c,onRemove:f,selected:E&&E.id===Re},Re)})]},ue))}),i.jsx(Mr,{currentPage:N,totalPages:P,onPageChange:L}),i.jsx(Rr,{isOpen:W,onClose:()=>he(!1),sortField:Y,sortDirection:O,filters:Q,setSortField:re,setSortDirection:q,setFilters:G}),i.jsx(Ir,{open:ee,onClose:()=>ye(!1),onConfirmAll:m,onConfirmFiltered:k,hasFilters:_e>0})]})},zt=({message:a,subMessage:c,onClose:f,type:m="success"})=>{const[N,P]=T.useState(3e3),[I,L]=T.useState(!1);T.useEffect(()=>{const G=setInterval(()=>{I||P(W=>W<=50?(clearInterval(G),f(),0):W-50)},50);return()=>clearInterval(G)},[I,f]);const Y=N/3e3*100,O=m==="error"?"border-red-500":"border-green-500",Q=m==="error"?"text-red-500":"text-green-500",re=m==="error"?"bg-red-500":"bg-green-500",q=m==="error"?"M12 9v2m0 4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z":"M9 12.75L11.25 15L15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z";return i.jsx("div",{className:"fixed top-4 right-4 z-50 w-80",onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),children:i.jsx("div",{className:`bg-white border-l-4 ${O} p-2 shadow-lg rounded-lg`,children:i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("svg",{className:`h-6 w-6 ${Q}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:q})})}),i.jsxs("div",{className:"ml-1 flex-1",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900",children:a}),c&&i.jsx("p",{className:"mt-1 text-sm text-gray-500 break-words",children:c}),i.jsx("div",{className:`w-full h-1 rounded-t-lg ${re}`,style:{width:`${Y}%`}})]}),i.jsx("div",{className:"ml-auto pl-1",children:i.jsxs("button",{onClick:f,className:`text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${m==="error"?"red":"green"}-500`,children:[i.jsx("span",{className:"sr-only",children:"Close"}),i.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 0 1 1.414 0L10 8.586l4.293-4.293a1 1 0 1 1 1.414 1.414L11.414 10l4.293 4.293a1 1 0 0 1-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 1 1-1.414-1.414L8.586 10 4.293 5.707a1 1 0 0 1 0-1.414z",clipRule:"evenodd"})})]})})]})})})},Br=({operation:a})=>{var Q,re,q,G,W,he,ee,ye,_e;const[c,f]=T.useState(!1),[m,k]=T.useState(!1),[E,N]=T.useState(!1),P=ce=>{if(!ce)return"N/A";const se=new Date(ce),ae=se.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),Oe=se.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});return`${ae} at ${Oe}`},I=()=>{if(!(a!=null&&a.request))return;const{request:ce}=a,{method:se,url:ae,headers:Oe,body:ue}=ce;let Z=`curl -X ${se} '${ae}'`;return Oe&&Oe.forEach(be=>{Z+=` -H '${be.name}: ${be.value}'`}),ue&&(Z+=` --data '${ue}'`),Z},L=()=>{const ce=I();navigator.clipboard.writeText(ce).then(()=>{f(!0)}).catch(se=>{console.error("[Inspectr] Failed to copy cURL command:",se)})},Y=()=>{navigator.clipboard.writeText(a.request.url).then(()=>{k(!0)}).catch(ce=>{console.error("[Inspectr] Failed to copy URL:",ce)})},O=()=>{const{meta:ce,timing:se,response:ae,...Oe}=a;fetch("/api/replay",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Oe)}).then(ue=>{if(!ue.ok)throw new Error("Replay failed");return ue.json()}).then(()=>{N(!0)}).catch(ue=>{console.error("[Inspectr] Failed to replay request:",ue)})};return i.jsxs("div",{className:"mb-4 p-4 bg-white border border-gray-300 rounded shadow relative",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h2",{className:"font-bold text-2xl",children:"Request Details"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsxs("button",{onClick:L,className:"flex items-center space-x-2 px-2 py-1 border border-slate-600 text-slate-600 rounded focus:outline-none cursor-pointer",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})}),i.jsx("span",{className:"text-xs",children:"Copy as cURL"})]}),i.jsxs("button",{onClick:O,className:"flex items-center space-x-2 px-2 py-1 border border-slate-600 text-slate-600 rounded focus:outline-none cursor-pointer",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),i.jsx("span",{className:"text-xs",children:"Replay"})]})]})]}),i.jsxs("div",{className:"flex flex-col space-y-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 font-mono text-lg",children:[i.jsx("span",{className:`font-bold ${Fn((Q=a==null?void 0:a.request)==null?void 0:Q.method)}`,children:(re=a==null?void 0:a.request)==null?void 0:re.method}),i.jsx("span",{className:"text-blue-600",children:(q=a==null?void 0:a.request)==null?void 0:q.path}),i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${un((G=a==null?void 0:a.response)==null?void 0:G.status)}`,children:(W=a==null?void 0:a.response)==null?void 0:W.status}),i.jsx("span",{className:"text-sm",children:(he=a==null?void 0:a.response)==null?void 0:he.status_text})]}),i.jsxs("div",{className:"flex items-center text-gray-600",children:[i.jsx("span",{onClick:Y,className:"cursor-pointer",children:(ee=a==null?void 0:a.request)==null?void 0:ee.url}),i.jsx("button",{onClick:Y,className:"cursor-pointer pl-1",children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"icon-xs",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})})})]}),i.jsxs("div",{className:"text-gray-500 text-xs",children:["Received on"," ",i.jsx("span",{className:"font-semibold",children:P((ye=a==null?void 0:a.request)==null?void 0:ye.timestamp)})," • Took ",i.jsxs("span",{className:"font-semibold",children:[(_e=a==null?void 0:a.timing)==null?void 0:_e.duration,"ms"]})," to respond"]})]}),c&&i.jsx(zt,{message:"cURL command copied!",subMessage:"You can now paste it into your terminal.",onClose:()=>f(!1)}),m&&i.jsx(zt,{message:"URL copied!",subMessage:"The request URL has been copied to your clipboard.",onClose:()=>k(!1)}),E&&i.jsx(zt,{message:"Replay sent!",subMessage:"The request event has been replayd.",onClose:()=>N(!1)})]})};function Go(a,c,f){return c in a?Object.defineProperty(a,c,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[c]=f,a}function Kr(a,c){var f=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(k){return Object.getOwnPropertyDescriptor(a,k).enumerable})),f.push.apply(f,m)}return f}function Lr(a){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?Kr(Object(f),!0).forEach(function(m){Go(a,m,f[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(f)):Kr(Object(f)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(f,m))})}return a}function Zo(a,c){if(a==null)return{};var f={},m=Object.keys(a),k,E;for(E=0;E<m.length;E++)k=m[E],!(c.indexOf(k)>=0)&&(f[k]=a[k]);return f}function Xo(a,c){if(a==null)return{};var f=Zo(a,c),m,k;if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(a);for(k=0;k<E.length;k++)m=E[k],!(c.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(f[m]=a[m])}return f}function es(a,c){return ts(a)||ns(a,c)||rs(a,c)||os()}function ts(a){if(Array.isArray(a))return a}function ns(a,c){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(a)))){var f=[],m=!0,k=!1,E=void 0;try{for(var N=a[Symbol.iterator](),P;!(m=(P=N.next()).done)&&(f.push(P.value),!(c&&f.length===c));m=!0);}catch(I){k=!0,E=I}finally{try{!m&&N.return!=null&&N.return()}finally{if(k)throw E}}return f}}function rs(a,c){if(a){if(typeof a=="string")return Fr(a,c);var f=Object.prototype.toString.call(a).slice(8,-1);if(f==="Object"&&a.constructor&&(f=a.constructor.name),f==="Map"||f==="Set")return Array.from(a);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return Fr(a,c)}}function Fr(a,c){(c==null||c>a.length)&&(c=a.length);for(var f=0,m=new Array(c);f<c;f++)m[f]=a[f];return m}function os(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
38
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ss(a,c,
|
|
37
|
+
`,style:{zIndex:9999},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-300 bg-gray-50",children:[i.jsx("h2",{className:"pl-4 text-lg font-semibold text-gray-800",children:"Filter & Sort"}),i.jsx("button",{onClick:c,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"p-4 overflow-y-auto h-full",children:[i.jsxs("section",{className:"mb-6 ml-4 mr-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Sort By"}),i.jsx("button",{onClick:I,className:"text-xs text-blue-600 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"time",checked:d==="time",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Timestamp"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"statusCode",checked:d==="statusCode",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Status"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortField",value:"method",checked:d==="method",onChange:q=>E(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Method"})]})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"mb-2 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Sort Direction"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"asc",checked:m==="asc",onChange:q=>N(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Ascending"})]}),i.jsxs("label",{className:"flex items-center",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"desc",checked:m==="desc",onChange:q=>N(q.target.value),className:"form-radio text-blue-600"}),i.jsx("span",{className:"ml-3 text-gray-700",children:"Descending"})]})]})]})]}),i.jsxs("section",{className:"mb-6 ml-4 mr-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Filters"}),i.jsx("button",{onClick:L,className:"text-xs text-blue-600 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Quick Time Range"}),i.jsxs("select",{value:typeof _.timestampRange=="string"?_.timestampRange:"",onChange:Z,className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[i.jsx("option",{value:"",children:"Any"}),i.jsx("option",{value:"5M",children:"Last 5 minutes"}),i.jsx("option",{value:"15M",children:"Last 15 minutes"}),i.jsx("option",{value:"30M",children:"Last 30 minutes"}),i.jsx("option",{value:"1H",children:"Last 1 hour"}),i.jsx("option",{value:"3H",children:"Last 3 hours"}),i.jsx("option",{value:"6H",children:"Last 6 hours"}),i.jsx("option",{value:"12H",children:"Last 12 hours"}),i.jsx("option",{value:"24H",children:"Last 24 hours"}),i.jsx("option",{value:"48H",children:"Last 48 hours"}),i.jsx("option",{value:"week",children:"Last Week"}),i.jsx("option",{value:"month",children:"Last Month"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Specific Time Range"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"datetime-local",value:typeof _.timestampRange=="object"&&_.timestampRange.start?_.timestampRange.start:"",onChange:q=>S("start",q.target.value),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"datetime-local",value:typeof _.timestampRange=="object"&&_.timestampRange.end?_.timestampRange.end:"",onChange:q=>S("end",q.target.value),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Status"}),i.jsx(Fr,{options:oe,selected:_.status||[],onChange:q=>P(X=>({...X,status:q})),placeholder:"Add status code...",colorFn:cr})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Method"}),i.jsx(Fr,{options:Q,selected:_.method||[],onChange:q=>P(X=>({...X,method:q})),placeholder:"Add method...",colorFn:Tn})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Path"}),i.jsx("input",{type:"text",placeholder:"e.g. /api/users",value:_.path||"",onChange:q=>P(X=>({...X,path:q.target.value})),className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Duration (ms)"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"number",placeholder:"Min",value:_.durationMin||"",onChange:q=>P(X=>({...X,durationMin:q.target.value})),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"number",placeholder:"Max",value:_.durationMax||"",onChange:q=>P(X=>({...X,durationMax:q.target.value})),className:"w-1/2 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Host"}),i.jsx("input",{type:"text",placeholder:"e.g. localhost",value:_.host||"",onChange:q=>P(X=>({...X,host:q.target.value})),className:"block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})]})]})]})},In=({currentPage:a,totalPages:c,onPageChange:d})=>{const _=((E,N)=>{const P=[];if(N<=7)for(let I=1;I<=N;I++)P.push(I);else if(E<=4){for(let I=1;I<=5;I++)P.push(I);P.push("ellipsis"),P.push(N)}else if(E>=N-3){P.push(1),P.push("ellipsis");for(let I=N-4;I<=N;I++)P.push(I)}else P.push(1),P.push("ellipsis"),P.push(E-1),P.push(E),P.push(E+1),P.push("ellipsis"),P.push(N);return P})(a,c);return i.jsx("nav",{className:"p-2 border-t border-gray-300",children:i.jsxs("ul",{className:"flex items-center justify-center -space-x-px h-8 text-sm",children:[i.jsx("li",{children:i.jsxs("button",{onClick:()=>d(a-1),disabled:a<=1,className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Previous"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 1 1 5l4 4"})})]})}),_.map((E,N)=>{if(E==="ellipsis")return i.jsx("li",{children:i.jsx("span",{className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 cursor-pointer",children:"..."})},`ellipsis-${N}`);const P=E===a;return i.jsx("li",{children:i.jsx("button",{onClick:()=>d(E),className:P?"z-10 flex items-center justify-center px-3 h-8 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-pointer":"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:E})},E)}),i.jsx("li",{children:i.jsxs("button",{onClick:()=>d(a+1),disabled:a>=c,className:"flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Next"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})})]})})]})})},Dn=({open:a,onClose:c,onConfirmAll:d,onConfirmFiltered:m,hasFilters:_})=>a?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:c}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:i.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:i.jsx("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:_?"Clear Requests":"Clear All Requests"}),i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:_?"You have active filters. Would you like to clear only the filtered requests or all requests?":"Are you sure you want to clear all requests? This action cannot be undone."})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[i.jsx("button",{onClick:c,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),_&&i.jsx("button",{onClick:()=>{m(),c()},className:"px-4 py-2 bg-yellow-500 text-white rounded hover:bg-yellow-600 text-sm",children:"Clear Filtered"}),i.jsx("button",{onClick:()=>{d(),c()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Clear All"})]})]})]}):null,qn=({text:a,align:c="center"})=>c==="left"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}):c==="right"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a})]}):i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:a}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}),Bn=({operations:a,onSelect:c,onRemove:d,clearOperations:m,clearFilteredRequests:_,selectedOperation:E,currentPage:N,totalPages:P,totalCount:I,onPageChange:L,sortField:Z,sortDirection:S,filters:Q,setSortField:oe,setSortDirection:q,setFilters:X})=>{const[W,pe]=T.useState(!1),[te,xe]=T.useState(!1),Ce=Object.entries(Q||{}).reduce((de,[ee,le])=>ee==="timestampRange"&&typeof le=="object"?le.start||le.end?de+1:de:le?de+1:de,0),we=Ce>0?"bg-green-500 text-white":"bg-blue-500 text-white",ie=de=>{const ee=new Date(de),le=String(ee.getDate()).padStart(2,"0"),ye=String(ee.getMonth()+1).padStart(2,"0");return`${ee.getFullYear()}-${ye}-${le}`},Ke=(de=>de.reduce((ee,le)=>{const ye=le.request.timestamp?ie(le.request.timestamp):"N/A";return ee[ye]||(ee[ye]=[]),ee[ye].push(le),ee},{}))(a);return i.jsxs("div",{className:"flex flex-col h-full relative",children:[i.jsxs("div",{className:"p-4 flex justify-between items-center",children:[i.jsxs("span",{className:"font-bold text-xl",children:["Requests (",a.length," of ",I,")"]}),i.jsxs("div",{className:"space-x-2 relative",children:[i.jsxs("button",{className:`relative px-3 py-1 rounded text-xs cursor-pointer ${we}`,onClick:()=>pe(!0),children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})}),Ce>0&&i.jsx("span",{className:"absolute -top-1 -right-1 bg-green-700 text-white text-[10px] font-bold w-4 h-4 flex items-center justify-center rounded-full",children:Ce})]}),i.jsx("button",{className:"px-3 py-1 bg-red-500 text-white rounded text-xs cursor-pointer",onClick:()=>xe(!0),children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})]})]}),i.jsxs("div",{className:"flex items-center bg-gray-200 p-2 border-b border-gray-300 text-sm font-bold cursor-pointer",onClick:()=>pe(!0),children:[i.jsx("div",{className:"w-16 text-center",children:"Status"}),i.jsx("div",{className:"w-20 text-center",children:"Method"}),i.jsx("div",{className:"flex-grow text-left",children:"Path"}),i.jsx("div",{className:"w-20 text-center",children:"Timestamp"}),i.jsx("div",{className:"w-16 text-right",children:"Duration"}),i.jsx("div",{className:"w-10"})]}),i.jsx("ul",{className:"overflow-y-auto flex-grow",style:{maxHeight:"calc(100vh - 40px - 100px - 49px)"},children:a.length===0?i.jsx("li",{className:"flex items-center justify-center h-full text-gray-500 text-2xl",children:"No operations"}):Object.entries(Ke).map(([de,ee])=>i.jsxs(T.Fragment,{children:[i.jsx("li",{children:i.jsx(qn,{text:de,align:"center"})}),ee.map((le,ye)=>{const Ee=le.id||ye;return i.jsx(Mn,{opId:Ee,operation:le,onSelect:c,onRemove:d,selected:E&&E.id===Ee},Ee)})]},de))}),i.jsx(In,{currentPage:N,totalPages:P,onPageChange:L}),i.jsx(Rn,{isOpen:W,onClose:()=>pe(!1),sortField:Z,sortDirection:S,filters:Q,setSortField:oe,setSortDirection:q,setFilters:X}),i.jsx(Dn,{open:te,onClose:()=>xe(!1),onConfirmAll:m,onConfirmFiltered:_,hasFilters:Ce>0})]})},$t=({message:a,subMessage:c,onClose:d,type:m="success"})=>{const[N,P]=T.useState(3e3),[I,L]=T.useState(!1);T.useEffect(()=>{const X=setInterval(()=>{I||P(W=>W<=50?(clearInterval(X),d(),0):W-50)},50);return()=>clearInterval(X)},[I,d]);const Z=N/3e3*100,S=m==="error"?"border-red-500":"border-green-500",Q=m==="error"?"text-red-500":"text-green-500",oe=m==="error"?"bg-red-500":"bg-green-500",q=m==="error"?"M12 9v2m0 4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z":"M9 12.75L11.25 15L15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z";return i.jsx("div",{className:"fixed top-4 right-4 z-50 w-80",onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),children:i.jsx("div",{className:`bg-white border-l-4 ${S} p-2 shadow-lg rounded-lg`,children:i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("svg",{className:`h-6 w-6 ${Q}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:q})})}),i.jsxs("div",{className:"ml-1 flex-1",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900",children:a}),c&&i.jsx("p",{className:"mt-1 text-sm text-gray-500 break-words",children:c}),i.jsx("div",{className:`w-full h-1 rounded-t-lg ${oe}`,style:{width:`${Z}%`}})]}),i.jsx("div",{className:"ml-auto pl-1",children:i.jsxs("button",{onClick:d,className:`text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${m==="error"?"red":"green"}-500`,children:[i.jsx("span",{className:"sr-only",children:"Close"}),i.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 0 1 1.414 0L10 8.586l4.293-4.293a1 1 0 1 1 1.414 1.414L11.414 10l4.293 4.293a1 1 0 0 1-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 1 1-1.414-1.414L8.586 10 4.293 5.707a1 1 0 0 1 0-1.414z",clipRule:"evenodd"})})]})})]})})})},Kn=({operation:a})=>{var te,xe,Ce,we,ie,se,Ke,de,ee;const[c,d]=T.useState(!1),[m,_]=T.useState(!1),[E,N]=T.useState(!1),[P,I]=T.useState(!1),[L,Z]=T.useState(!1),S=le=>{if(!le)return"N/A";const ye=new Date(le),Ee=ye.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),Oe=ye.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});return`${Ee} at ${Oe}`},Q=()=>{if(!(a!=null&&a.request))return;const{request:le}=a,{method:ye,url:Ee,headers:Oe,body:J}=le;let he=`curl -X ${ye} '${Ee}'`;return Oe&&Oe.forEach(Me=>{he+=` -H '${Me.name}: ${Me.value}'`}),J&&(he+=` --data '${J}'`),he},oe=()=>{const le=Q();navigator.clipboard.writeText(le).then(()=>{d(!0),setTimeout(()=>d(!1),2500)}).catch(ye=>{console.error("[Inspectr] Failed to copy cURL command:",ye),_(!0)})},q=()=>{navigator.clipboard.writeText(a.request.url).then(()=>{N(!0)}).catch(le=>{console.error("[Inspectr] Failed to copy URL:",le)})},X=()=>{const{meta:le,timing:ye,response:Ee,...Oe}=a;fetch("/api/replay",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Oe)}).then(J=>{if(!J.ok)throw new Error("Replay failed");return J.json()}).then(()=>{Z(!0),setTimeout(()=>Z(!1),2500)}).catch(J=>{console.error("[Inspectr] Failed to replay request:",J),I(!0)})},W="flex items-center space-x-2 px-2 py-1 border border-slate-600 text-slate-600 rounded focus:outline-none cursor-pointer transition-transform duration-150 ease-in-out active:scale-95 active:bg-slate-200 active:ring active:ring-slate-300",pe=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})});return i.jsxs("div",{className:"mb-4 p-4 bg-white border border-gray-300 rounded shadow relative",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h2",{className:"font-bold text-2xl",children:"Request Details"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsxs("button",{onClick:oe,className:W,children:[c?i.jsx(pe,{}):i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})}),i.jsx("span",{className:"text-xs",children:c?"Copied cURL":"Copy as cURL"})]}),i.jsxs("button",{onClick:X,className:W,children:[L?i.jsx(pe,{}):i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),i.jsx("span",{className:"text-xs",children:L?"Replayed":"Replay"})]})]})]}),i.jsxs("div",{className:"flex flex-col space-y-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 font-mono text-lg",children:[i.jsx("span",{className:`font-bold ${Lr((te=a==null?void 0:a.request)==null?void 0:te.method)}`,children:(xe=a==null?void 0:a.request)==null?void 0:xe.method}),i.jsx("span",{className:"text-blue-600",children:(Ce=a==null?void 0:a.request)==null?void 0:Ce.path}),i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${cr((we=a==null?void 0:a.response)==null?void 0:we.status)}`,children:(ie=a==null?void 0:a.response)==null?void 0:ie.status}),i.jsx("span",{className:"text-sm",children:(se=a==null?void 0:a.response)==null?void 0:se.status_text})]}),i.jsxs("div",{className:"flex items-center text-gray-600",children:[i.jsx("span",{onClick:q,className:"cursor-pointer",children:(Ke=a==null?void 0:a.request)==null?void 0:Ke.url}),i.jsx("button",{onClick:q,className:"cursor-pointer pl-1",children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"icon-xs",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})})})]}),i.jsxs("div",{className:"text-gray-500 text-xs",children:["Received on"," ",i.jsx("span",{className:"font-semibold",children:S((de=a==null?void 0:a.request)==null?void 0:de.timestamp)})," • Took ",i.jsxs("span",{className:"font-semibold",children:[(ee=a==null?void 0:a.timing)==null?void 0:ee.duration,"ms"]})," to respond"]})]}),m&&i.jsx($t,{message:"Failed to copy cURL command!",subMessage:"Please try again.",onClose:()=>_(!1)}),E&&i.jsx($t,{message:"URL copied!",subMessage:"The request URL has been copied to your clipboard.",onClose:()=>N(!1)}),P&&i.jsx($t,{message:"Replay failed!",subMessage:"Failed to replay the request. Please try again.",onClose:()=>I(!1)})]})};function Go(a,c,d){return c in a?Object.defineProperty(a,c,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[c]=d,a}function Ln(a,c){var d=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(_){return Object.getOwnPropertyDescriptor(a,_).enumerable})),d.push.apply(d,m)}return d}function Fn(a){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?Ln(Object(d),!0).forEach(function(m){Go(a,m,d[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(d)):Ln(Object(d)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(d,m))})}return a}function Zo(a,c){if(a==null)return{};var d={},m=Object.keys(a),_,E;for(E=0;E<m.length;E++)_=m[E],!(c.indexOf(_)>=0)&&(d[_]=a[_]);return d}function Xo(a,c){if(a==null)return{};var d=Zo(a,c),m,_;if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(a);for(_=0;_<E.length;_++)m=E[_],!(c.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(d[m]=a[m])}return d}function es(a,c){return ts(a)||rs(a,c)||ns(a,c)||os()}function ts(a){if(Array.isArray(a))return a}function rs(a,c){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(a)))){var d=[],m=!0,_=!1,E=void 0;try{for(var N=a[Symbol.iterator](),P;!(m=(P=N.next()).done)&&(d.push(P.value),!(c&&d.length===c));m=!0);}catch(I){_=!0,E=I}finally{try{!m&&N.return!=null&&N.return()}finally{if(_)throw E}}return d}}function ns(a,c){if(a){if(typeof a=="string")return Hn(a,c);var d=Object.prototype.toString.call(a).slice(8,-1);if(d==="Object"&&a.constructor&&(d=a.constructor.name),d==="Map"||d==="Set")return Array.from(a);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return Hn(a,c)}}function Hn(a,c){(c==null||c>a.length)&&(c=a.length);for(var d=0,m=new Array(c);d<c;d++)m[d]=a[d];return m}function os(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
38
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ss(a,c,d){return c in a?Object.defineProperty(a,c,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[c]=d,a}function zn(a,c){var d=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(_){return Object.getOwnPropertyDescriptor(a,_).enumerable})),d.push.apply(d,m)}return d}function Vn(a){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?zn(Object(d),!0).forEach(function(m){ss(a,m,d[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(d)):zn(Object(d)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(d,m))})}return a}function as(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];return function(m){return c.reduceRight(function(_,E){return E(_)},m)}}function Wt(a){return function c(){for(var d=this,m=arguments.length,_=new Array(m),E=0;E<m;E++)_[E]=arguments[E];return _.length>=a.length?a.apply(this,_):function(){for(var N=arguments.length,P=new Array(N),I=0;I<N;I++)P[I]=arguments[I];return c.apply(d,[].concat(_,P))}}}function fr(a){return{}.toString.call(a).includes("Object")}function is(a){return!Object.keys(a).length}function Qt(a){return typeof a=="function"}function us(a,c){return Object.prototype.hasOwnProperty.call(a,c)}function ls(a,c){return fr(c)||yt("changeType"),Object.keys(c).some(function(d){return!us(a,d)})&&yt("changeField"),c}function cs(a){Qt(a)||yt("selectorType")}function fs(a){Qt(a)||fr(a)||yt("handlerType"),fr(a)&&Object.values(a).some(function(c){return!Qt(c)})&&yt("handlersType")}function ds(a){a||yt("initialIsRequired"),fr(a)||yt("initialType"),is(a)&&yt("initialContent")}function hs(a,c){throw new Error(a[c]||a.default)}var ps={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},yt=Wt(hs)(ps),dr={changes:ls,selector:cs,handler:fs,initial:ds};function ms(a){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};dr.initial(a),dr.handler(c);var d={current:a},m=Wt(vs)(d,c),_=Wt(ys)(d),E=Wt(dr.changes)(a),N=Wt(gs)(d);function P(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(Z){return Z};return dr.selector(L),L(d.current)}function I(L){as(m,_,E,N)(L)}return[P,I]}function gs(a,c){return Qt(c)?c(a.current):c}function ys(a,c){return a.current=Vn(Vn({},a.current),c),c}function vs(a,c,d){return Qt(c)?c(a.current):Object.keys(d).forEach(function(m){var _;return(_=c[m])===null||_===void 0?void 0:_.call(c,a.current[m])}),d}var bs={create:ms},xs={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function ws(a){return function c(){for(var d=this,m=arguments.length,_=new Array(m),E=0;E<m;E++)_[E]=arguments[E];return _.length>=a.length?a.apply(this,_):function(){for(var N=arguments.length,P=new Array(N),I=0;I<N;I++)P[I]=arguments[I];return c.apply(d,[].concat(_,P))}}}function js(a){return{}.toString.call(a).includes("Object")}function ks(a){return a||$n("configIsRequired"),js(a)||$n("configType"),a.urls?(_s(),{paths:{vs:a.urls.monacoBase}}):a}function _s(){console.warn(Un.deprecation)}function Cs(a,c){throw new Error(a[c]||a.default)}var Un={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
39
39
|
You are using deprecated way of configuration.
|
|
40
40
|
|
|
41
41
|
Instead of using
|
|
@@ -44,6 +44,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
44
44
|
monaco.config({ paths: { vs: '...' } })
|
|
45
45
|
|
|
46
46
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
47
|
-
`},Ur=ws(Cs)(Vr),As={config:_s},Es=function(){for(var c=arguments.length,f=new Array(c),m=0;m<c;m++)f[m]=arguments[m];return function(k){return f.reduceRight(function(E,N){return N(E)},k)}};function Wr(a,c){return Object.keys(c).forEach(function(f){c[f]instanceof Object&&a[f]&&Object.assign(c[f],Wr(a[f],c[f]))}),Lr(Lr({},a),c)}var Ns={type:"cancelation",msg:"operation is manually canceled"};function zn(a){var c=!1,f=new Promise(function(m,k){a.then(function(E){return c?k(Ns):m(E)}),a.catch(k)});return f.cancel=function(){return c=!0},f}var Ss=bs.create({config:xs,isInitialized:!1,resolve:null,reject:null,monaco:null}),$r=es(Ss,2),Wt=$r[0],fn=$r[1];function Os(a){var c=As.config(a),f=c.monaco,m=Xo(c,["monaco"]);fn(function(k){return{config:Wr(k.config,m),monaco:f}})}function Ps(){var a=Wt(function(c){var f=c.monaco,m=c.isInitialized,k=c.resolve;return{monaco:f,isInitialized:m,resolve:k}});if(!a.isInitialized){if(fn({isInitialized:!0}),a.monaco)return a.resolve(a.monaco),zn(Vn);if(window.monaco&&window.monaco.editor)return Qr(window.monaco),a.resolve(window.monaco),zn(Vn);Es(Ts,Ms)(Is)}return zn(Vn)}function Ts(a){return document.body.appendChild(a)}function Rs(a){var c=document.createElement("script");return a&&(c.src=a),c}function Ms(a){var c=Wt(function(m){var k=m.config,E=m.reject;return{config:k,reject:E}}),f=Rs("".concat(c.config.paths.vs,"/loader.js"));return f.onload=function(){return a()},f.onerror=c.reject,f}function Is(){var a=Wt(function(f){var m=f.config,k=f.resolve,E=f.reject;return{config:m,resolve:k,reject:E}}),c=window.require;c.config(a.config),c(["vs/editor/editor.main"],function(f){Qr(f),a.resolve(f)},function(f){a.reject(f)})}function Qr(a){Wt().monaco||fn({monaco:a})}function Ds(){return Wt(function(a){var c=a.monaco;return c})}var Vn=new Promise(function(a,c){return fn({resolve:a,reject:c})}),Jr={config:Os,init:Ps,__getMonacoInstance:Ds},qs={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Un=qs,Bs={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ks=Bs;function Ls({children:a}){return T.createElement("div",{style:Ks.container},a)}var Fs=Ls,Hs=Fs;function zs({width:a,height:c,isEditorReady:f,loading:m,_ref:k,className:E,wrapperProps:N}){return T.createElement("section",{style:{...Un.wrapper,width:a,height:c},...N},!f&&T.createElement(Hs,null,m),T.createElement("div",{ref:k,style:{...Un.fullWidth,...!f&&Un.hide},className:E}))}var Vs=zs,Yr=T.memo(Vs);function Us(a){T.useEffect(a,[])}var Gr=Us;function Ws(a,c,f=!0){let m=T.useRef(!0);T.useEffect(m.current||!f?()=>{m.current=!1}:a,c)}var Xe=Ws;function $t(){}function Pt(a,c,f,m){return $s(a,m)||Qs(a,c,f,m)}function $s(a,c){return a.editor.getModel(Zr(a,c))}function Qs(a,c,f,m){return a.editor.createModel(c,f,m?Zr(a,m):void 0)}function Zr(a,c){return a.Uri.parse(c)}function Js({original:a,modified:c,language:f,originalLanguage:m,modifiedLanguage:k,originalModelPath:E,modifiedModelPath:N,keepCurrentOriginalModel:P=!1,keepCurrentModifiedModel:I=!1,theme:L="light",loading:Y="Loading...",options:O={},height:Q="100%",width:re="100%",className:q,wrapperProps:G={},beforeMount:W=$t,onMount:he=$t}){let[ee,ye]=T.useState(!1),[_e,ce]=T.useState(!0),se=T.useRef(null),ae=T.useRef(null),Oe=T.useRef(null),ue=T.useRef(he),Z=T.useRef(W),be=T.useRef(!1);Gr(()=>{let X=Jr.init();return X.then(ve=>(ae.current=ve)&&ce(!1)).catch(ve=>(ve==null?void 0:ve.type)!=="cancelation"&&console.error("Monaco initialization: error:",ve)),()=>se.current?Qe():X.cancel()}),Xe(()=>{if(se.current&&ae.current){let X=se.current.getOriginalEditor(),ve=Pt(ae.current,a||"",m||f||"text",E||"");ve!==X.getModel()&&X.setModel(ve)}},[E],ee),Xe(()=>{if(se.current&&ae.current){let X=se.current.getModifiedEditor(),ve=Pt(ae.current,c||"",k||f||"text",N||"");ve!==X.getModel()&&X.setModel(ve)}},[N],ee),Xe(()=>{let X=se.current.getModifiedEditor();X.getOption(ae.current.editor.EditorOption.readOnly)?X.setValue(c||""):c!==X.getValue()&&(X.executeEdits("",[{range:X.getModel().getFullModelRange(),text:c||"",forceMoveMarkers:!0}]),X.pushUndoStop())},[c],ee),Xe(()=>{var X,ve;(ve=(X=se.current)==null?void 0:X.getModel())==null||ve.original.setValue(a||"")},[a],ee),Xe(()=>{let{original:X,modified:ve}=se.current.getModel();ae.current.editor.setModelLanguage(X,m||f||"text"),ae.current.editor.setModelLanguage(ve,k||f||"text")},[f,m,k],ee),Xe(()=>{var X;(X=ae.current)==null||X.editor.setTheme(L)},[L],ee),Xe(()=>{var X;(X=se.current)==null||X.updateOptions(O)},[O],ee);let ke=T.useCallback(()=>{var Ke;if(!ae.current)return;Z.current(ae.current);let X=Pt(ae.current,a||"",m||f||"text",E||""),ve=Pt(ae.current,c||"",k||f||"text",N||"");(Ke=se.current)==null||Ke.setModel({original:X,modified:ve})},[f,c,k,a,m,E,N]),Re=T.useCallback(()=>{var X;!be.current&&Oe.current&&(se.current=ae.current.editor.createDiffEditor(Oe.current,{automaticLayout:!0,...O}),ke(),(X=ae.current)==null||X.editor.setTheme(L),ye(!0),be.current=!0)},[O,L,ke]);T.useEffect(()=>{ee&&ue.current(se.current,ae.current)},[ee]),T.useEffect(()=>{!_e&&!ee&&Re()},[_e,ee,Re]);function Qe(){var ve,Ke,Ie,Pe;let X=(ve=se.current)==null?void 0:ve.getModel();P||((Ke=X==null?void 0:X.original)==null||Ke.dispose()),I||((Ie=X==null?void 0:X.modified)==null||Ie.dispose()),(Pe=se.current)==null||Pe.dispose()}return T.createElement(Yr,{width:re,height:Q,isEditorReady:ee,loading:Y,_ref:Oe,className:q,wrapperProps:G})}var Ys=Js;T.memo(Ys);function Gs(a){let c=T.useRef();return T.useEffect(()=>{c.current=a},[a]),c.current}var Zs=Gs,dn=new Map;function Xs({defaultValue:a,defaultLanguage:c,defaultPath:f,value:m,language:k,path:E,theme:N="light",line:P,loading:I="Loading...",options:L={},overrideServices:Y={},saveViewState:O=!0,keepCurrentModel:Q=!1,width:re="100%",height:q="100%",className:G,wrapperProps:W={},beforeMount:he=$t,onMount:ee=$t,onChange:ye,onValidate:_e=$t}){let[ce,se]=T.useState(!1),[ae,Oe]=T.useState(!0),ue=T.useRef(null),Z=T.useRef(null),be=T.useRef(null),ke=T.useRef(ee),Re=T.useRef(he),Qe=T.useRef(),X=T.useRef(m),ve=Zs(E),Ke=T.useRef(!1),Ie=T.useRef(!1);Gr(()=>{let te=Jr.init();return te.then(we=>(ue.current=we)&&Oe(!1)).catch(we=>(we==null?void 0:we.type)!=="cancelation"&&console.error("Monaco initialization: error:",we)),()=>Z.current?We():te.cancel()}),Xe(()=>{var we,Ce,He,$e;let te=Pt(ue.current,a||m||"",c||k||"",E||f||"");te!==((we=Z.current)==null?void 0:we.getModel())&&(O&&dn.set(ve,(Ce=Z.current)==null?void 0:Ce.saveViewState()),(He=Z.current)==null||He.setModel(te),O&&(($e=Z.current)==null||$e.restoreViewState(dn.get(E))))},[E],ce),Xe(()=>{var te;(te=Z.current)==null||te.updateOptions(L)},[L],ce),Xe(()=>{!Z.current||m===void 0||(Z.current.getOption(ue.current.editor.EditorOption.readOnly)?Z.current.setValue(m):m!==Z.current.getValue()&&(Ie.current=!0,Z.current.executeEdits("",[{range:Z.current.getModel().getFullModelRange(),text:m,forceMoveMarkers:!0}]),Z.current.pushUndoStop(),Ie.current=!1))},[m],ce),Xe(()=>{var we,Ce;let te=(we=Z.current)==null?void 0:we.getModel();te&&k&&((Ce=ue.current)==null||Ce.editor.setModelLanguage(te,k))},[k],ce),Xe(()=>{var te;P!==void 0&&((te=Z.current)==null||te.revealLine(P))},[P],ce),Xe(()=>{var te;(te=ue.current)==null||te.editor.setTheme(N)},[N],ce);let Pe=T.useCallback(()=>{var te;if(!(!be.current||!ue.current)&&!Ke.current){Re.current(ue.current);let we=E||f,Ce=Pt(ue.current,m||a||"",c||k||"",we||"");Z.current=(te=ue.current)==null?void 0:te.editor.create(be.current,{model:Ce,automaticLayout:!0,...L},Y),O&&Z.current.restoreViewState(dn.get(we)),ue.current.editor.setTheme(N),P!==void 0&&Z.current.revealLine(P),se(!0),Ke.current=!0}},[a,c,f,m,k,E,L,Y,O,N,P]);T.useEffect(()=>{ce&&ke.current(Z.current,ue.current)},[ce]),T.useEffect(()=>{!ae&&!ce&&Pe()},[ae,ce,Pe]),X.current=m,T.useEffect(()=>{var te,we;ce&&ye&&((te=Qe.current)==null||te.dispose(),Qe.current=(we=Z.current)==null?void 0:we.onDidChangeModelContent(Ce=>{Ie.current||ye(Z.current.getValue(),Ce)}))},[ce,ye]),T.useEffect(()=>{if(ce){let te=ue.current.editor.onDidChangeMarkers(we=>{var He;let Ce=(He=Z.current.getModel())==null?void 0:He.uri;if(Ce&&we.find($e=>$e.path===Ce.path)){let $e=ue.current.editor.getModelMarkers({resource:Ce});_e==null||_e($e)}});return()=>{te==null||te.dispose()}}return()=>{}},[ce,_e]);function We(){var te,we;(te=Qe.current)==null||te.dispose(),Q?O&&dn.set(E,Z.current.saveViewState()):(we=Z.current.getModel())==null||we.dispose(),Z.current.dispose()}return T.createElement(Yr,{width:re,height:q,isEditorReady:ce,loading:I,_ref:be,className:G,wrapperProps:W})}var ea=Xs,ta=T.memo(ea),Xr=ta;const eo=({open:a,onClose:c,decoded:f})=>{var E,N,P;if(!a)return null;const m=()=>{const I=JSON.stringify(f,null,2);navigator.clipboard.writeText(I).then(()=>{}).catch(L=>{console.error("Failed to copy JWT:",L)})},k=I=>I?new Date(I*1e3).toLocaleString():"N/A";return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:c}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-blue-100 rounded-full p-2",children:i.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Decoded JWT"}),i.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Below is the decoded JWT information."})]})]}),i.jsx("button",{onClick:c,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"relative mt-4",children:[i.jsx("button",{onClick:m,className:"absolute top-2 right-2 z-10 cursor-pointer bg-gray-200 p-1 rounded hover:bg-gray-300",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",fill:"currentColor",className:"w-5 h-5",children:i.jsx("path",{d:"M48.186 92.137c0-8.392 6.49-14.89 16.264-14.89s29.827-.225 29.827-.225-.306-6.99-.306-15.88c0-8.888 7.954-14.96 17.49-14.96 9.538 0 56.786.401 61.422.401 4.636 0 8.397 1.719 13.594 5.67 5.196 3.953 13.052 10.56 16.942 14.962 3.89 4.402 5.532 6.972 5.532 10.604 0 3.633 0 76.856-.06 85.34-.059 8.485-7.877 14.757-17.134 14.881-9.257.124-29.135.124-29.135.124s.466 6.275.466 15.15-8.106 15.811-17.317 16.056c-9.21.245-71.944-.49-80.884-.245-8.94.245-16.975-6.794-16.975-15.422s.274-93.175.274-101.566zm16.734 3.946l-1.152 92.853a3.96 3.96 0 0 0 3.958 4.012l73.913.22a3.865 3.865 0 0 0 3.91-3.978l-.218-8.892a1.988 1.988 0 0 0-2.046-1.953s-21.866.64-31.767.293c-9.902-.348-16.672-6.807-16.675-15.516-.003-8.709.003-69.142.003-69.142a1.989 1.989 0 0 0-2.007-1.993l-23.871.082a4.077 4.077 0 0 0-4.048 4.014zm106.508-35.258c-1.666-1.45-3.016-.84-3.016 1.372v17.255c0 1.106.894 2.007 1.997 2.013l20.868.101c2.204.011 2.641-1.156.976-2.606l-20.825-18.135zm-57.606.847a2.002 2.002 0 0 0-2.02 1.988l-.626 96.291a2.968 2.968 0 0 0 2.978 2.997l75.2-.186a2.054 2.054 0 0 0 2.044-2.012l1.268-62.421a1.951 1.951 0 0 0-1.96-2.004s-26.172.042-30.783.042c-4.611 0-7.535-2.222-7.535-6.482S152.3 63.92 152.3 63.92a2.033 2.033 0 0 0-2.015-2.018l-36.464-.23z",stroke:"#979797",fillRule:"evenodd"})})}),i.jsx("pre",{className:"bg-gray-100 p-2 rounded text-xs text-gray-700 overflow-x-auto",children:JSON.stringify(f,null,2)}),f&&i.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[((E=f==null?void 0:f.payload)==null?void 0:E.iat)&&i.jsxs("p",{children:["Issued At (iat): ",k(f.payload.iat)]}),((N=f==null?void 0:f.payload)==null?void 0:N.nbf)&&i.jsxs("p",{children:["Not Before (nbf): ",k(f.payload.nbf)]}),((P=f==null?void 0:f.payload)==null?void 0:P.exp)&&i.jsxs("p",{children:["Expires At (exp): ",k(f.payload.exp)]})]})]}),i.jsx("div",{className:"mt-6 flex justify-end",children:i.jsx("button",{onClick:c,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Close"})})]})]})},Wn=({textToCopy:a,copiedTimeout:c=2500})=>{const[f,m]=T.useState(!1),k=()=>{navigator.clipboard.writeText(a).then(()=>{m(!0),setTimeout(()=>m(!1),c)}).catch(E=>{console.error("Failed to copy text:",E)})};return i.jsx("div",{className:"flex items-center rounded px-2 font-sans text-xs text-token-text-secondary",children:i.jsx("span",{"data-state":f?"copied":"closed",children:i.jsxs("button",{onClick:k,className:"flex gap-1 items-center select-none px-4 py-1 cursor-pointer","aria-label":"Copy",children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"icon-xs",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})}),f?"Copied":"Copy"]})})})},to=a=>{let c=a.replace(/-/g,"+").replace(/_/g,"/");for(;c.length%4;)c+="=";return c},na=a=>{try{const c=a.split(".");if(c.length!==3)return null;const f=JSON.parse(atob(to(c[0]))),m=JSON.parse(atob(to(c[1])));return{header:f,payload:m,signature:c[2]}}catch(c){return console.error("Failed to decode JWT:",c),null}},ra=a=>typeof a!="string"?!1:((a.startsWith("Bearer ")||a.startsWith("bearer "))&&(a=a.slice(7).trim()),/^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+$/.test(a)),no=({operation:a})=>{var q,G,W,he;const[c,f]=T.useState(!1),[m,k]=T.useState(!1),[E,N]=T.useState(!1),[P,I]=T.useState(null),L=ee=>{const ye=ee.startsWith("Bearer ")||ee.startsWith("bearer ")?ee.slice(7).trim():ee,_e=na(ye);_e&&(I(_e),N(!0))},Y=ee=>ee.map(ye=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-slate-500 text-xs",children:ye.name}),i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-xs",children:i.jsxs("div",{className:"flex flex-wrap items-center",children:[i.jsx("span",{className:"min-w-0 break-all flex-1",children:ye.value}),ra(ye.value)&&i.jsx("button",{onClick:()=>L(ye.value),className:"ml-2 p-1 text-blue-500 text-xs border border-slate-600 rounded cursor-pointer",children:i.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})})]})})]},ye.name)),O=a.request.body,Q=!O||typeof O=="object"&&Object.keys(O).length===0||typeof O=="string"&&(O.trim()===""||O.trim()==="{}"),re=ee=>{try{const ye=JSON.parse(ee);return JSON.stringify(ye,null,2)}catch{return ee}};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>f(!c),children:["Query Parameters (",(((q=a==null?void 0:a.request)==null?void 0:q.query_params)??[]).length,")"]}),c&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Key"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:Y(((G=a==null?void 0:a.request)==null?void 0:G.query_params)??[])})]})})]}),i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>k(!m),children:["Headers (",(((W=a==null?void 0:a.request)==null?void 0:W.headers)??[]).length,")"]}),m&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Header"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:Y(((he=a==null?void 0:a.request)==null?void 0:he.headers)??[])})]})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center bg-gray-200",children:[i.jsx("button",{className:"p-2 text-left font-bold flex-grow",children:"Request Body"}),i.jsx(Wn,{textToCopy:re(O)})]}),Q?i.jsx("div",{className:"p-4 bg-white rounded-b shadow",children:"No payload"}):i.jsx("div",{className:"bg-white rounded-b shadow p-0 h-100",children:i.jsx(Xr,{height:"100%",defaultLanguage:"json",value:re(O),options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})]}),i.jsx(eo,{open:E,decoded:P,onClose:()=>{N(!1),I(null)}})]})},ro=({operation:a})=>{var P,I;const[c,f]=T.useState(!1),m=L=>L.map(Y=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-slate-500 text-xs",children:Y.name}),i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-xs",children:i.jsx("div",{className:"flex flex-wrap items-center",children:i.jsx("span",{className:"min-w-0 break-all flex-1",children:Y.value})})})]},Y.name)),k=a.response.body,E=!k||typeof k=="object"&&Object.keys(k).length===0||typeof k=="string"&&(k.trim()===""||k.trim()==="{}"),N=L=>{try{const Y=JSON.parse(L);return JSON.stringify(Y,null,2)}catch{return L}};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>f(!c),children:["Headers (",(((P=a==null?void 0:a.response)==null?void 0:P.headers)??[]).length,")"]}),c&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Header"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:m(((I=a==null?void 0:a.response)==null?void 0:I.headers)??[])})]})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center bg-gray-200",children:[i.jsx("button",{className:"p-2 text-left font-bold flex-grow",children:"Response Body"}),i.jsx(Wn,{textToCopy:N(k)})]}),E?i.jsx("div",{className:"p-4 bg-white rounded-b shadow",children:"No payload"}):i.jsx("div",{className:"bg-white rounded-b shadow p-0 h-100",children:i.jsx(Xr,{height:"100%",defaultLanguage:"json",value:N(k),options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})]})]})},oo=({operation:a,currentTab:c,setCurrentTab:f})=>a?i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(Br,{operation:a}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("button",{className:`px-4 py-2 rounded-t ${c==="request"?"bg-blue-600 text-white":"bg-gray-200 text-gray-700"}`,onClick:()=>f("request"),children:"Request"}),i.jsx("button",{className:`px-4 py-2 rounded-t ${c==="response"?"bg-blue-600 text-white":"bg-gray-200 text-gray-700"}`,onClick:()=>f("response"),children:"Response"})]}),i.jsx("div",{className:"p-4 bg-white border border-gray-300 rounded-b shadow flex-grow overflow-y-auto",style:{maxHeight:"calc(100vh - 270px)"},children:c==="request"?i.jsx(no,{operation:a}):i.jsx(ro,{operation:a})})]}):i.jsx("div",{className:"text-gray-500",children:"No request selected."}),oa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAACHxJREFUeJztnX+MFGcdxiul8UWMcECtlSIcR+GKYKsHhTu9dsQr9PhxV+TSEtTYVqXVHnD9AZWWhkG7tY1pY2uUtrYRQhZbTyC1Ftyilhg1Ri0Ww4gh1pomeze3O8ZaClZ68PoZ50gu6+zdLjd732FmnuT5j5DvPJ/bfZ93fu155yVKlChRokSJEg1FatLssXi09ByxE6FfjHfjU/g/+HE8TnquWKgv/D9jXeCf4irp+SItAj4f/9wn/DN+EL9Les7IinCXDxC+63/ij0vPGUn1LbivDQLA9Y+lZ42kCPZ6fLoEACdxrfS8kZL7vY5/XUL4Z7xVeuZIiUA/XOJf/xn/FV8kPXdkRJj3lBG+7tsffEF67kjI3ekOUj0zuAVfjtfg7/R5pfTskRBBzsJvFQn/V8kOOAARosL34tfxOwU+VST8N8ZMr7+sPe3svW27o295Kq+/uDWvb3o0rz/3zbxe9UCu5wYzd1/bppySPr7QizDvxr1lfs9/a+0zPW3tO53TRQBoAPSuuDe3Qfr4Qi/C/FuZ4b9dbXxm0rrO/CsA0AMA0CvuyR2VPr7Qi0APlQng+Y5dzlUA6C0BwEHp4wu9CPQ6/O8yKuaC23c7z3V05vUgAE7wFbRU+vhCL+XtdJvwdvzDfn7VB0AWV92xx+kEQAYAGQBkAJABQAYAGQBkAPAsABayCCdnR89Gyjv1/CMfADukZ4uFCHoC/pMPgOukZ4uFCLq2yLpwofRssRBBf8on/C7puWIjwr7ZB8A+6bnOSRHceHxbvxNlpfi3PgA2r3/BWXXX806aFpSmBaVpQWlaUJoWlKYFpWlBaVpQmhaUpgWlP70xt6P1ztz2pWty3792dc/TTTf1PGWssp9obLO/29Bq3zJ/iT1WOp+Kqq/NfK/MjVYxLwTAcwDQANAl7AP0io05DQANAA0ADQANAA0AXd9i63nN9qNzmrqjW1UJ7WP4HwGEfxxXA+BokACuvNa2ATBdOqeKidDq8b8CAJB979S6KgCcCBhAHgCzpHOqmAjuAnfxDADA4TWdr05av9fRAX8F7QLACOmcKirCm4ifxFaJdk9BFJ6e3r9hnzMTABYALABYALAAYAHAAoAFAAsAFgAsAFgAsABgAcACgAUACwAWACwAHG5osR+bv9hOrh0XirAb8JsFALZJzxUbEXaz8m667Q/gIem5YiPCXumzBrRLzxUbEfZXfAC0Ss8VGxH2Rh8Ac6XnCq2Ud0FlKV6Nbw3AewsBjJ919bS7M85aWpBJCzJpQSYtyKQFmbQgkxZk0oJMWpBJCzJpQSYtyKQFmbQgkxZk0oJMWpBJCzJpQSY11GQfYNYt6DYvb+w2Z9d3mTPndJkzrugyp83KbqqpzS6fOj0b7oqqvLuW9wfQ8wf08vs7xwLgtaD3AQDQANAA0ADQANAA0ADQANDVl2ZfnDItO0Y656IinDZV3n2bZ+Newq/CWQEAp6fUZJdL51xUbjup9F8/zhP+hTgnAEBPrsneKp1zURHOlfjtCgPIEf4HsCMA4ASfgI9K51xUyjvd3KG8uxUqBeB1wp+Mjw0zgC4AtLMGnC+d87CKwDsLAFjl/h8rv54bCYCLADCh5c7cOABULVrd8z4AjAbAKAC8u6HFvgAAIyJ9PeBspLx7goYEINEQlAAQVgJAWAmAsxAhVeGpATnj04IUbqQFGbQggxZk0IIMWpBBCzJoQQYtyKAFGbQggxZksAgbLMIGLchgETZoQQaLsMEibLAIG7Qgg0XYoAUZtCCDFmTQggxakEELMmouy1ZL5zqolPd0y2Oq/Acsyt0HTMHHh7mGnqaGPk0NHSWdc1Ep767mSoZ/BsCH8JsCG7FeNmKLpHMuKsJZW+HwXR8j/PcLnoq4QzrnoiKcxcPwCdCEPwHbAgBO8QkI70MehDMKb1XFn2YMxPU3b5kIgL8LANjOGhD+t3IR0iX4amwE4G2FAMbWNkwHwPwht6Ab7QUAuAYATQBYAIBPFm1BtdkZ0rmKSHmPrRZ+Cj4hPVdsRNhf9gFwg/RcsZEbtg+Au6Tnio0Ie5H6/4s8j0jPFRsp/zuq09JznbMivDr88hCr6Esb9jl1QdbQhhb70LzF9jzpfCoqghuDfx/AXuDI6m2vXBL4PqDZ/sOcpu7w3nYyVBFcIz4WAAAbj1//gnM84I3YMQA0SudUMSnvfW+5AAC4zwzXAOBIwAB6ADBTOqeKiuA2K+91kkOFsAQAewIE8M68ZnuLdD4Vl/KuGSzs2+GaJfpFHwApACwBQAoAKQCkAJACQAoAKQCkAJACwP0A+BoAtgxwb+jmhlZ72fwldnjP9UuKsG/0AfAz6bliI8K+ygeAu5Yk9/AMhwj6UuX/tsQPSs8WCxH0OHzQB8D10rPFQgQ9Aj/jA+BZ6dkiJ0IdqbwbfN3TFf2fF/Z7xcH/NmS0oF8O8pzwQVpQR9um3Ejp4wu9lPeMQanXld2HQZpv3+38oIR9gPve0C9JH1/oRaBHy9yQZTp2OXPXdeZPlvDaykPSxxd6EeiRMgGcvHjusskA+F0JAF6WPr7Qi0BX4RNlQtjavrO7GQC9g7w3tE36+EIv5T1ls0x5L/TYVuCXigB4a3R13Ufa087DADgAgAMAOACAXwBgf98bs1pZhOP1dEvQIugZ+I0iEP6IJ/b7t251na28W1vC+1zXuSTl3fj1kwG+in6DP4+vwd/APcp7u9bj0rNHRoS5rsz1wf3dgc9Kzx0ZEWZNGfsE139RyS9rBCvl/VZkqQCSW1iClvJeBlLKDcDupctJ0vNGTsr7NaXDJQDYKT1rZKW8p3EGejGI24CukJ4zsurr+XsGAPBV6RkjL+VdqPG70WsHfo/0fLGQ8h6J/bbyzh/l8X0q+W354ZdKLtAnSpQoUaJEicrRfwFj5g/5zsKE0wAAAABJRU5ErkJggg==",so=({apiEndpoint:a,setApiEndpoint:c,connectionStatus:f,channelCode:m,setChannelCode:k,channel:E,setChannel:N,onRegister:P})=>{const[I,L]=T.useState(!1),[Y,O]=T.useState(a),[Q,re]=T.useState(m),[q,G]=T.useState(E);T.useEffect(()=>{O(a),re(m),G(E)},[a,m,E]),T.useEffect(()=>{if(typeof window<"u"){const ye=localStorage.getItem("apiEndpoint")||window.location.origin+"/api";O(ye),c(ye)}},[c]);const W=()=>{typeof window<"u"&&localStorage.setItem("apiEndpoint",Y),c(Y)},he=()=>{typeof window<"u"&&(localStorage.setItem("channelCode",Q),localStorage.setItem("channel",q)),k(Q),N(q),P(Q,q,"",!0)};return i.jsxs("div",{className:"fixed bottom-0 left-0 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between bg-gray-200 px-4 py-2 w-full cursor-pointer select-none",onClick:()=>L(ee=>!ee),children:[i.jsx("div",{className:"flex items-center gap-4",children:i.jsxs("span",{className:`px-2 py-1 rounded-full text-xs font-semibold flex items-center
|
|
48
|
-
${
|
|
49
|
-
${f==="connected"?"bg-green-800":f==="reconnecting"?"bg-yellow-800":"bg-red-800"}`}),f.charAt(0).toUpperCase()+f.slice(1)]})}),i.jsxs("a",{href:"https://github.com/inspectr-hq/inspectr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2",onClick:ee=>ee.stopPropagation(),children:[i.jsx("img",{src:oa,alt:"Inspectr Logo",className:"h-6"}),i.jsx("span",{className:"text-gray-700 font-semibold text-sm",children:"Inspectr"})]})]}),i.jsx("div",{className:`bg-gray-100 border-t border-gray-300 transition-all duration-300 overflow-hidden ${I?"max-h-96 opacity-100 py-4":"max-h-0 opacity-0 py-0"}`,children:i.jsxs("div",{className:"px-6",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-800 mb-4",children:"Configuration"}),i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Inspectr API Endpoint"}),i.jsx("input",{type:"text",placeholder:"Enter API Endpoint...",value:Y,onChange:ee=>O(ee.target.value),className:"w-full border bg-white border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:W,className:"mt-2 bg-blue-600 text-white px-3 py-1.5 rounded-md text-sm",children:"Save"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Channel"}),i.jsx("input",{type:"text",placeholder:"Enter Channel...",value:q,onChange:ee=>G(ee.target.value),className:"w-full bg-white border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:he,className:"mt-2 bg-green-600 text-white px-3 py-1.5 rounded-md text-sm",children:"Register"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Access Code"}),i.jsx("input",{type:"text",placeholder:"Enter Access Code...",value:Q,onChange:ee=>re(ee.target.value),className:"w-full border bg-white border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})})]})};class sa{constructor(){this.db=new an("InspectrDB"),this.db.version(1).stores({events:"id, time, method, statusCode, path, duration, server"})}transformEvent(c){var E;const{id:f,time:m,data:k}=c;return{id:f,time:m,operation_id:k.operation_id,method:k.request.method,url:k.request.url,server:k.request.server,path:k.request.path,clientIp:k.request.client_ip,duration:k.timing.duration,statusCode:(E=k.response)==null?void 0:E.status,raw:c}}async upsertEvent(c){const f=this.transformEvent(c);return await this.db.events.put(f)}async deleteEvent(c){return await this.db.events.delete(c)}async getEvent(c){return await this.db.events.get(c)}async queryEvents(c={}){const{filters:f={},sort:m={field:"time",order:"desc"},page:k=1,pageSize:E=20}=c;let N=this.db.events.toCollection();if(f.timestampRange){if(typeof f.timestampRange=="string"){let O=new Date;switch(f.timestampRange){case"15M":O.setMinutes(O.getMinutes()-15);break;case"30M":O.setMinutes(O.getMinutes()-30);break;case"1H":O.setHours(O.getHours()-1);break;case"3H":O.setHours(O.getHours()-3);break;case"6H":O.setHours(O.getHours()-6);break;case"12H":O.setHours(O.getHours()-12);break;case"24H":O.setHours(O.getHours()-24);break;case"48H":O.setHours(O.getHours()-48);break;case"week":O.setDate(O.getDate()-7);break;case"month":O.setMonth(O.getMonth()-1);break}N=N.filter(Q=>new Date(Q.time)>=O)}else if(typeof f.timestampRange=="object"){if(f.timestampRange.start&&f.timestampRange.end){const O=new Date(f.timestampRange.start),Q=new Date(f.timestampRange.end);N=N.filter(re=>{const q=new Date(re.time);return q>=O&&q<=Q})}else if(f.timestampRange.start){const O=new Date(f.timestampRange.start);N=N.filter(Q=>new Date(Q.time)>=O)}else if(f.timestampRange.end){const O=new Date(f.timestampRange.end);N=N.filter(Q=>new Date(Q.time)<=O)}}}if(f.status&&Array.isArray(f.status)&&f.status.length>0&&(N=N.filter(O=>f.status.includes(String(O.statusCode)))),f.method&&Array.isArray(f.method)&&f.method.length>0){const O=f.method.map(Q=>Q.toLowerCase());N=N.filter(Q=>O.includes(Q.method.toLowerCase()))}f.path&&(N=N.filter(O=>O.path.includes(f.path))),f.durationMin&&(N=N.filter(O=>Number(O.duration)>=Number(f.durationMin))),f.durationMax&&(N=N.filter(O=>Number(O.duration)<=Number(f.durationMax))),f.host&&(N=N.filter(O=>O.server.toLowerCase().includes(f.host.toLowerCase())));let P;if(typeof N.orderBy=="function")try{P=N.orderBy(m.field),m.order==="desc"&&(P=P.reverse())}catch(O){console.error("[EventDB] orderBy error, fallback sorting:",O),P=(await N.toArray()).sort((re,q)=>{const G=m.field;return re[G]<q[G]?m.order==="asc"?-1:1:re[G]>q[G]?m.order==="asc"?1:-1:0})}else P=(await N.toArray()).sort((Q,re)=>{const q=m.field;return Q[q]<re[q]?m.order==="asc"?-1:1:Q[q]>re[q]?m.order==="asc"?1:-1:0});const I=(k-1)*E;let L;return Array.isArray(P)?L=P.slice(I,I+E):typeof P.offset=="function"?L=await P.offset(I).limit(E).toArray():L=[],L.map(O=>({id:O.id,...O.raw.data}))}async clearEvents(){return await this.db.events.clear()}}const _t=new sa,aa=typeof window<"u"&&window.location.hostname==="localhost",ao=typeof window<"u"&&localStorage.getItem("debug")==="true";ao&&console.log("[Inspectr] Debug Mode enabled");const ia=({apiEndpoint:a="/api"})=>{const[c,f]=T.useState(null),[m,k]=T.useState("request"),[E,N]=T.useState(a),[P,I]=T.useState("disconnected"),[L,Y]=T.useState(""),[O,Q]=T.useState(""),[re,q]=T.useState(""),[G,W]=T.useState(""),[he,ee]=T.useState(""),[ye,_e]=T.useState(!1),[ce,se]=T.useState(null),ae=100,[Oe,ue]=T.useState(1),[Z,be]=T.useState("time"),[ke,Re]=T.useState("desc"),[Qe,X]=T.useState({}),ve=T.useRef(!1),Ke=T.useRef(0),Ie=T.useRef(!1),Pe=6,We=5e3,te=Or(()=>_t.queryEvents({sort:{field:Z,order:ke},filters:Qe,page:Oe,pageSize:ae}),[Oe,Z,ke,Qe]),we=Or(()=>_t.db.events.count(),[]),Ce=we?Math.ceil(we/ae):1;T.useEffect(()=>{if(typeof window>"u")return;const F=new URLSearchParams(window.location.search),Ne=F.get("channelCode"),Le=F.get("channel"),oe=F.get("token");if(Ne||Le||oe)console.log("🔍 Found credentials in query params"),Ne&&(Q(Ne),localStorage.setItem("channelCode",Ne)),Le&&(q(Le),localStorage.setItem("channel",Le)),oe&&(W(oe),localStorage.setItem("token",oe)),window.history.replaceState({},"",`${window.location.pathname}${F.toString()?"?"+F.toString():""}`);else{const De=localStorage.getItem("channelCode"),ft=localStorage.getItem("channel"),pe=localStorage.getItem("token");De&&ft&&pe?(console.log("✅ Using stored credentials from localStorage"),Q(De),q(ft),W(pe)):aa&&(console.log("🔄 Fetching /app/config (Localhost, No credentials found)"),fetch("/app/config").then(Ae=>Ae.json()).then(Ae=>{Ae!=null&&Ae.token&&(Ae!=null&&Ae.sse_endpoint)&&(Ae!=null&&Ae.channel_code)&&(console.log("✅ Loaded from /app/config:",Ae),Q(Ae.channel_code),localStorage.setItem("channelCode",Ae.channel_code),q(Ae.channel),localStorage.setItem("channel",Ae.channel),W(Ae.token),localStorage.setItem("token",Ae.token),Y(Ae.sse_endpoint),localStorage.setItem("sseEndpoint",Ae.sse_endpoint))}).catch(Ae=>console.error("❌ Failed to load /app/config:",Ae)))}_e(!0)},[]),T.useEffect(()=>{ye&&(console.log("🔄 Auto-registering with stored credentials:",re,O),re&&O?He(O,re):console.log("⚠️ Missing credentials for auto-registration, skipping."))},[ye,re,O]);const He=async(F=O,Ne=re,Le=G,oe)=>{try{let De={};F&&Ne?De={channel:Ne,channel_code:F}:Le&&(De={token:Le}),console.log("📤 Registering with:",De);const pe=await(await fetch(`${E}/register`,{method:"POST",headers:{"Content-Type":"application/json","x-inspectr-client":"inspectr-app"},body:JSON.stringify(De)})).json();if(pe!=null&&pe.token&&(pe!=null&&pe.sse_endpoint)&&(pe!=null&&pe.channel_code))return console.log("✅ Registration successful"),Ke.current=0,Ie.current=!1,Q(pe.channel_code),localStorage.setItem("channelCode",pe.channel_code),q(pe.channel),localStorage.setItem("channel",pe.channel),W(pe.token),localStorage.setItem("token",pe.token),ee(pe.expires),localStorage.setItem("expires",pe.expires),Y(pe.sse_endpoint),localStorage.setItem("sseEndpoint",pe.sse_endpoint),oe&&se({message:"Registration Successful",subMessage:"Your channel and access code have been registered."}),I("connected"),!0;throw console.error("❌ Registration failed:",pe),se({message:"Registration Failed",subMessage:"Please check your channel and access code.",type:"error"}),new Error("Registration failed")}catch(De){throw console.error("❌ Registration error:",De),se({message:"Registration Error",subMessage:"An error occurred during registration.",type:"error"}),De}},$e=()=>{Ke.current<Pe?(Ke.current+=1,console.log(`🔄 Attempting re-registration (${Ke.current}/${Pe}) in ${We/1e3} seconds...`),setTimeout(async()=>{try{await He()}catch(F){console.log("❌ Re-registration attempt failed:",F),$e()}},We)):(console.log(`❌ Re-registration failed after ${Pe} attempts. Giving up.`),Ke.current=0,Ie.current=!0,I("disconnected"))};T.useEffect(()=>{if(!L)return;const F=()=>`req-${Math.random().toString(36).substr(2,9)}`,Ne=new EventSource(L);return console.log(`🔄 SSE connecting with ${L}`),Ne.onopen=()=>{console.log("📡️ SSE connection opened."),ve.current=!0,I("connected")},Ne.onmessage=Le=>{try{const oe=JSON.parse(Le.data);ao&&console.log("[Inspectr] Received event:",oe),oe.id||(oe.id=F()),_t.upsertEvent(oe).catch(De=>console.error("Error saving event to DB:",De))}catch(oe){console.error("Error parsing SSE Inspectr data:",oe)}},Ne.onerror=Le=>{if(console.error("❌ SSE connection error:",Le),ve.current=!1,I("reconnecting"),Ie.current){console.log("❌ Maximum re-registration attempts reached. Closing EventSource."),I("disconnected"),Ne.close();return}!Ie.current&&Ke.current===0&&(console.log("🔄 Starting re-registration retry loop due to SSE error."),$e())},()=>{console.log("Closing SSE EventSource connection"),Ne.close(),I("disconnected")}},[L]),T.useEffect(()=>{!c&&te&&te.length>0&&f(te[0])},[te,c]);const ut=()=>{f(null),_t.clearEvents().catch(F=>console.error("Error clearing events from DB:",F))},mt=async()=>{try{const F=await _t.queryEvents({filters:Qe,sort:{field:"time",order:"desc"},page:1,pageSize:Number.MAX_SAFE_INTEGER});await Promise.all(F.map(Ne=>_t.deleteEvent(Ne.id))),c&&F.some(Ne=>Ne.id===c.id)&&f(null)}catch(F){console.error("Error clearing filtered operations:",F)}},Tt=F=>{c&&(c.id||"")===F&&f(null),_t.deleteEvent(F).catch(Ne=>console.error("Error deleting event from DB:",Ne))};return i.jsxs("div",{className:"flex flex-col h-screen",children:[i.jsxs("div",{className:"flex flex-grow",children:[i.jsx("div",{className:"w-1/3 border-r border-gray-300 overflow-y-auto",children:i.jsx(qr,{operations:te||[],onSelect:f,onRemove:Tt,clearOperations:ut,clearFilteredOperations:mt,selectedOperation:c,currentPage:Oe,totalPages:Ce,totalCount:we||0,onPageChange:ue,sortField:Z,sortDirection:ke,filters:Qe,setSortField:be,setSortDirection:Re,setFilters:X})}),i.jsx("div",{className:"w-2/3 p-4 h-full overflow-y-auto",children:i.jsx("div",{className:"flex flex-col h-full",children:i.jsx(oo,{operation:c,currentTab:m,setCurrentTab:k})})})]}),i.jsx(so,{apiEndpoint:E,setApiEndpoint:N,connectionStatus:P,channelCode:O,setChannelCode:Q,channel:re,setChannel:q,onRegister:He}),ce&&i.jsx(zt,{message:ce.message,subMessage:ce.subMessage,type:ce.type,onClose:()=>se(null)})]})};Ee.CopyButton=Wn,Ee.DialogConfirmClear=Ir,Ee.DialogJwt=eo,Ee.DividerText=Dr,Ee.InspectrApp=ia,Ee.RequestContent=no,Ee.RequestDetail=Br,Ee.RequestDetailsPanel=oo,Ee.RequestList=qr,Ee.RequestListItem=Tr,Ee.RequestListPagination=Mr,Ee.RequestListSidePanel=Rr,Ee.ResponseContent=ro,Ee.SettingsPanel=so,Ee.TagsInput=Hn,Ee.ToastNotification=zt,Ee.getMethodTagClass=Pr,Ee.getMethodTextClass=Fn,Ee.getStatusClass=un,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})});
|
|
47
|
+
`},$n=ws(Cs)(Un),Es={config:ks},As=function(){for(var c=arguments.length,d=new Array(c),m=0;m<c;m++)d[m]=arguments[m];return function(_){return d.reduceRight(function(E,N){return N(E)},_)}};function Wn(a,c){return Object.keys(c).forEach(function(d){c[d]instanceof Object&&a[d]&&Object.assign(c[d],Wn(a[d],c[d]))}),Fn(Fn({},a),c)}var Ns={type:"cancelation",msg:"operation is manually canceled"};function Hr(a){var c=!1,d=new Promise(function(m,_){a.then(function(E){return c?_(Ns):m(E)}),a.catch(_)});return d.cancel=function(){return c=!0},d}var Ss=bs.create({config:xs,isInitialized:!1,resolve:null,reject:null,monaco:null}),Qn=es(Ss,2),Jt=Qn[0],hr=Qn[1];function Os(a){var c=Es.config(a),d=c.monaco,m=Xo(c,["monaco"]);hr(function(_){return{config:Wn(_.config,m),monaco:d}})}function Ps(){var a=Jt(function(c){var d=c.monaco,m=c.isInitialized,_=c.resolve;return{monaco:d,isInitialized:m,resolve:_}});if(!a.isInitialized){if(hr({isInitialized:!0}),a.monaco)return a.resolve(a.monaco),Hr(zr);if(window.monaco&&window.monaco.editor)return Jn(window.monaco),a.resolve(window.monaco),Hr(zr);As(Ts,Rs)(Is)}return Hr(zr)}function Ts(a){return document.body.appendChild(a)}function Ms(a){var c=document.createElement("script");return a&&(c.src=a),c}function Rs(a){var c=Jt(function(m){var _=m.config,E=m.reject;return{config:_,reject:E}}),d=Ms("".concat(c.config.paths.vs,"/loader.js"));return d.onload=function(){return a()},d.onerror=c.reject,d}function Is(){var a=Jt(function(d){var m=d.config,_=d.resolve,E=d.reject;return{config:m,resolve:_,reject:E}}),c=window.require;c.config(a.config),c(["vs/editor/editor.main"],function(d){Jn(d),a.resolve(d)},function(d){a.reject(d)})}function Jn(a){Jt().monaco||hr({monaco:a})}function Ds(){return Jt(function(a){var c=a.monaco;return c})}var zr=new Promise(function(a,c){return hr({resolve:a,reject:c})}),Yn={config:Os,init:Ps,__getMonacoInstance:Ds},qs={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Vr=qs,Bs={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ks=Bs;function Ls({children:a}){return T.createElement("div",{style:Ks.container},a)}var Fs=Ls,Hs=Fs;function zs({width:a,height:c,isEditorReady:d,loading:m,_ref:_,className:E,wrapperProps:N}){return T.createElement("section",{style:{...Vr.wrapper,width:a,height:c},...N},!d&&T.createElement(Hs,null,m),T.createElement("div",{ref:_,style:{...Vr.fullWidth,...!d&&Vr.hide},className:E}))}var Vs=zs,Gn=T.memo(Vs);function Us(a){T.useEffect(a,[])}var Zn=Us;function $s(a,c,d=!0){let m=T.useRef(!0);T.useEffect(m.current||!d?()=>{m.current=!1}:a,c)}var Xe=$s;function Yt(){}function Dt(a,c,d,m){return Ws(a,m)||Qs(a,c,d,m)}function Ws(a,c){return a.editor.getModel(Xn(a,c))}function Qs(a,c,d,m){return a.editor.createModel(c,d,m?Xn(a,m):void 0)}function Xn(a,c){return a.Uri.parse(c)}function Js({original:a,modified:c,language:d,originalLanguage:m,modifiedLanguage:_,originalModelPath:E,modifiedModelPath:N,keepCurrentOriginalModel:P=!1,keepCurrentModifiedModel:I=!1,theme:L="light",loading:Z="Loading...",options:S={},height:Q="100%",width:oe="100%",className:q,wrapperProps:X={},beforeMount:W=Yt,onMount:pe=Yt}){let[te,xe]=T.useState(!1),[Ce,we]=T.useState(!0),ie=T.useRef(null),se=T.useRef(null),Ke=T.useRef(null),de=T.useRef(pe),ee=T.useRef(W),le=T.useRef(!1);Zn(()=>{let J=Yn.init();return J.then(he=>(se.current=he)&&we(!1)).catch(he=>(he==null?void 0:he.type)!=="cancelation"&&console.error("Monaco initialization: error:",he)),()=>ie.current?Oe():J.cancel()}),Xe(()=>{if(ie.current&&se.current){let J=ie.current.getOriginalEditor(),he=Dt(se.current,a||"",m||d||"text",E||"");he!==J.getModel()&&J.setModel(he)}},[E],te),Xe(()=>{if(ie.current&&se.current){let J=ie.current.getModifiedEditor(),he=Dt(se.current,c||"",_||d||"text",N||"");he!==J.getModel()&&J.setModel(he)}},[N],te),Xe(()=>{let J=ie.current.getModifiedEditor();J.getOption(se.current.editor.EditorOption.readOnly)?J.setValue(c||""):c!==J.getValue()&&(J.executeEdits("",[{range:J.getModel().getFullModelRange(),text:c||"",forceMoveMarkers:!0}]),J.pushUndoStop())},[c],te),Xe(()=>{var J,he;(he=(J=ie.current)==null?void 0:J.getModel())==null||he.original.setValue(a||"")},[a],te),Xe(()=>{let{original:J,modified:he}=ie.current.getModel();se.current.editor.setModelLanguage(J,m||d||"text"),se.current.editor.setModelLanguage(he,_||d||"text")},[d,m,_],te),Xe(()=>{var J;(J=se.current)==null||J.editor.setTheme(L)},[L],te),Xe(()=>{var J;(J=ie.current)==null||J.updateOptions(S)},[S],te);let ye=T.useCallback(()=>{var Me;if(!se.current)return;ee.current(se.current);let J=Dt(se.current,a||"",m||d||"text",E||""),he=Dt(se.current,c||"",_||d||"text",N||"");(Me=ie.current)==null||Me.setModel({original:J,modified:he})},[d,c,_,a,m,E,N]),Ee=T.useCallback(()=>{var J;!le.current&&Ke.current&&(ie.current=se.current.editor.createDiffEditor(Ke.current,{automaticLayout:!0,...S}),ye(),(J=se.current)==null||J.editor.setTheme(L),xe(!0),le.current=!0)},[S,L,ye]);T.useEffect(()=>{te&&de.current(ie.current,se.current)},[te]),T.useEffect(()=>{!Ce&&!te&&Ee()},[Ce,te,Ee]);function Oe(){var he,Me,Ie,Pe;let J=(he=ie.current)==null?void 0:he.getModel();P||((Me=J==null?void 0:J.original)==null||Me.dispose()),I||((Ie=J==null?void 0:J.modified)==null||Ie.dispose()),(Pe=ie.current)==null||Pe.dispose()}return T.createElement(Gn,{width:oe,height:Q,isEditorReady:te,loading:Z,_ref:Ke,className:q,wrapperProps:X})}var Ys=Js;T.memo(Ys);function Gs(a){let c=T.useRef();return T.useEffect(()=>{c.current=a},[a]),c.current}var Zs=Gs,pr=new Map;function Xs({defaultValue:a,defaultLanguage:c,defaultPath:d,value:m,language:_,path:E,theme:N="light",line:P,loading:I="Loading...",options:L={},overrideServices:Z={},saveViewState:S=!0,keepCurrentModel:Q=!1,width:oe="100%",height:q="100%",className:X,wrapperProps:W={},beforeMount:pe=Yt,onMount:te=Yt,onChange:xe,onValidate:Ce=Yt}){let[we,ie]=T.useState(!1),[se,Ke]=T.useState(!0),de=T.useRef(null),ee=T.useRef(null),le=T.useRef(null),ye=T.useRef(te),Ee=T.useRef(pe),Oe=T.useRef(),J=T.useRef(m),he=Zs(E),Me=T.useRef(!1),Ie=T.useRef(!1);Zn(()=>{let re=Yn.init();return re.then(ke=>(de.current=ke)&&Ke(!1)).catch(ke=>(ke==null?void 0:ke.type)!=="cancelation"&&console.error("Monaco initialization: error:",ke)),()=>ee.current?Ue():re.cancel()}),Xe(()=>{var ke,Ae,We,Qe;let re=Dt(de.current,a||m||"",c||_||"",E||d||"");re!==((ke=ee.current)==null?void 0:ke.getModel())&&(S&&pr.set(he,(Ae=ee.current)==null?void 0:Ae.saveViewState()),(We=ee.current)==null||We.setModel(re),S&&((Qe=ee.current)==null||Qe.restoreViewState(pr.get(E))))},[E],we),Xe(()=>{var re;(re=ee.current)==null||re.updateOptions(L)},[L],we),Xe(()=>{!ee.current||m===void 0||(ee.current.getOption(de.current.editor.EditorOption.readOnly)?ee.current.setValue(m):m!==ee.current.getValue()&&(Ie.current=!0,ee.current.executeEdits("",[{range:ee.current.getModel().getFullModelRange(),text:m,forceMoveMarkers:!0}]),ee.current.pushUndoStop(),Ie.current=!1))},[m],we),Xe(()=>{var ke,Ae;let re=(ke=ee.current)==null?void 0:ke.getModel();re&&_&&((Ae=de.current)==null||Ae.editor.setModelLanguage(re,_))},[_],we),Xe(()=>{var re;P!==void 0&&((re=ee.current)==null||re.revealLine(P))},[P],we),Xe(()=>{var re;(re=de.current)==null||re.editor.setTheme(N)},[N],we);let Pe=T.useCallback(()=>{var re;if(!(!le.current||!de.current)&&!Me.current){Ee.current(de.current);let ke=E||d,Ae=Dt(de.current,m||a||"",c||_||"",ke||"");ee.current=(re=de.current)==null?void 0:re.editor.create(le.current,{model:Ae,automaticLayout:!0,...L},Z),S&&ee.current.restoreViewState(pr.get(ke)),de.current.editor.setTheme(N),P!==void 0&&ee.current.revealLine(P),ie(!0),Me.current=!0}},[a,c,d,m,_,E,L,Z,S,N,P]);T.useEffect(()=>{we&&ye.current(ee.current,de.current)},[we]),T.useEffect(()=>{!se&&!we&&Pe()},[se,we,Pe]),J.current=m,T.useEffect(()=>{var re,ke;we&&xe&&((re=Oe.current)==null||re.dispose(),Oe.current=(ke=ee.current)==null?void 0:ke.onDidChangeModelContent(Ae=>{Ie.current||xe(ee.current.getValue(),Ae)}))},[we,xe]),T.useEffect(()=>{if(we){let re=de.current.editor.onDidChangeMarkers(ke=>{var We;let Ae=(We=ee.current.getModel())==null?void 0:We.uri;if(Ae&&ke.find(Qe=>Qe.path===Ae.path)){let Qe=de.current.editor.getModelMarkers({resource:Ae});Ce==null||Ce(Qe)}});return()=>{re==null||re.dispose()}}return()=>{}},[we,Ce]);function Ue(){var re,ke;(re=Oe.current)==null||re.dispose(),Q?S&&pr.set(E,ee.current.saveViewState()):(ke=ee.current.getModel())==null||ke.dispose(),ee.current.dispose()}return T.createElement(Gn,{width:oe,height:q,isEditorReady:we,loading:I,_ref:le,className:X,wrapperProps:W})}var ea=Xs,ta=T.memo(ea),eo=ta;const to=({open:a,onClose:c,decoded:d})=>{var E,N,P;if(!a)return null;const m=()=>{const I=JSON.stringify(d,null,2);navigator.clipboard.writeText(I).then(()=>{}).catch(L=>{console.error("Failed to copy JWT:",L)})},_=I=>I?new Date(I*1e3).toLocaleString():"N/A";return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:c}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-blue-100 rounded-full p-2",children:i.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Decoded JWT"}),i.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Below is the decoded JWT information."})]})]}),i.jsx("button",{onClick:c,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"relative mt-4",children:[i.jsx("button",{onClick:m,className:"absolute top-2 right-2 z-10 cursor-pointer bg-gray-200 p-1 rounded hover:bg-gray-300",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",fill:"currentColor",className:"w-5 h-5",children:i.jsx("path",{d:"M48.186 92.137c0-8.392 6.49-14.89 16.264-14.89s29.827-.225 29.827-.225-.306-6.99-.306-15.88c0-8.888 7.954-14.96 17.49-14.96 9.538 0 56.786.401 61.422.401 4.636 0 8.397 1.719 13.594 5.67 5.196 3.953 13.052 10.56 16.942 14.962 3.89 4.402 5.532 6.972 5.532 10.604 0 3.633 0 76.856-.06 85.34-.059 8.485-7.877 14.757-17.134 14.881-9.257.124-29.135.124-29.135.124s.466 6.275.466 15.15-8.106 15.811-17.317 16.056c-9.21.245-71.944-.49-80.884-.245-8.94.245-16.975-6.794-16.975-15.422s.274-93.175.274-101.566zm16.734 3.946l-1.152 92.853a3.96 3.96 0 0 0 3.958 4.012l73.913.22a3.865 3.865 0 0 0 3.91-3.978l-.218-8.892a1.988 1.988 0 0 0-2.046-1.953s-21.866.64-31.767.293c-9.902-.348-16.672-6.807-16.675-15.516-.003-8.709.003-69.142.003-69.142a1.989 1.989 0 0 0-2.007-1.993l-23.871.082a4.077 4.077 0 0 0-4.048 4.014zm106.508-35.258c-1.666-1.45-3.016-.84-3.016 1.372v17.255c0 1.106.894 2.007 1.997 2.013l20.868.101c2.204.011 2.641-1.156.976-2.606l-20.825-18.135zm-57.606.847a2.002 2.002 0 0 0-2.02 1.988l-.626 96.291a2.968 2.968 0 0 0 2.978 2.997l75.2-.186a2.054 2.054 0 0 0 2.044-2.012l1.268-62.421a1.951 1.951 0 0 0-1.96-2.004s-26.172.042-30.783.042c-4.611 0-7.535-2.222-7.535-6.482S152.3 63.92 152.3 63.92a2.033 2.033 0 0 0-2.015-2.018l-36.464-.23z",stroke:"#979797",fillRule:"evenodd"})})}),i.jsx("pre",{className:"bg-gray-100 p-2 rounded text-xs text-gray-700 overflow-x-auto",children:JSON.stringify(d,null,2)}),d&&i.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[((E=d==null?void 0:d.payload)==null?void 0:E.iat)&&i.jsxs("p",{children:["Issued At (iat): ",_(d.payload.iat)]}),((N=d==null?void 0:d.payload)==null?void 0:N.nbf)&&i.jsxs("p",{children:["Not Before (nbf): ",_(d.payload.nbf)]}),((P=d==null?void 0:d.payload)==null?void 0:P.exp)&&i.jsxs("p",{children:["Expires At (exp): ",_(d.payload.exp)]})]})]}),i.jsx("div",{className:"mt-6 flex justify-end",children:i.jsx("button",{onClick:c,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Close"})})]})]})},Ur=({textToCopy:a,copiedTimeout:c=2500})=>{const[d,m]=T.useState(!1),_=()=>{navigator.clipboard.writeText(a).then(()=>{m(!0),setTimeout(()=>m(!1),c)}).catch(N=>{console.error("Failed to copy text:",N)})},E=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})});return i.jsx("div",{className:"flex items-center rounded px-2 font-sans text-xs text-token-text-secondary",children:i.jsx("span",{"data-state":d?"copied":"closed",children:i.jsxs("button",{onClick:_,className:"flex gap-1 items-center select-none px-4 py-1 cursor-pointer","aria-label":"Copy",children:[d?i.jsx(E,{}):i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"icon-xs",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})}),d?"Copied":"Copy"]})})})},ro=a=>{let c=a.replace(/-/g,"+").replace(/_/g,"/");for(;c.length%4;)c+="=";return c},ra=a=>{try{const c=a.split(".");if(c.length!==3)return null;const d=JSON.parse(atob(ro(c[0]))),m=JSON.parse(atob(ro(c[1])));return{header:d,payload:m,signature:c[2]}}catch(c){return console.error("Failed to decode JWT:",c),null}},na=a=>typeof a!="string"?!1:((a.startsWith("Bearer ")||a.startsWith("bearer "))&&(a=a.slice(7).trim()),/^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+$/.test(a)),no=({operation:a})=>{var q,X,W,pe;const[c,d]=T.useState(!1),[m,_]=T.useState(!1),[E,N]=T.useState(!1),[P,I]=T.useState(null),L=te=>{const xe=te.startsWith("Bearer ")||te.startsWith("bearer ")?te.slice(7).trim():te,Ce=ra(xe);Ce&&(I(Ce),N(!0))},Z=te=>te.map(xe=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-slate-500 text-xs",children:xe.name}),i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-xs",children:i.jsxs("div",{className:"flex flex-wrap items-center",children:[i.jsx("span",{className:"min-w-0 break-all flex-1",children:xe.value}),na(xe.value)&&i.jsx("button",{onClick:()=>L(xe.value),className:"ml-2 p-1 text-blue-500 text-xs border border-slate-600 rounded cursor-pointer",children:i.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})})]})})]},xe.name)),S=a.request.body,Q=!S||typeof S=="object"&&Object.keys(S).length===0||typeof S=="string"&&(S.trim()===""||S.trim()==="{}"),oe=te=>{try{const xe=JSON.parse(te);return JSON.stringify(xe,null,2)}catch{return te}};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>d(!c),children:["Query Parameters (",(((q=a==null?void 0:a.request)==null?void 0:q.query_params)??[]).length,")"]}),c&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Key"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:Z(((X=a==null?void 0:a.request)==null?void 0:X.query_params)??[])})]})})]}),i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>_(!m),children:["Headers (",(((W=a==null?void 0:a.request)==null?void 0:W.headers)??[]).length,")"]}),m&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Header"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:Z(((pe=a==null?void 0:a.request)==null?void 0:pe.headers)??[])})]})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center bg-gray-200",children:[i.jsx("button",{className:"p-2 text-left font-bold flex-grow",children:"Request Body"}),i.jsx(Ur,{textToCopy:oe(S)})]}),Q?i.jsx("div",{className:"p-4 bg-white rounded-b shadow",children:"No payload"}):i.jsx("div",{className:"bg-white rounded-b shadow p-0 h-100",children:i.jsx(eo,{height:"100%",defaultLanguage:"json",value:oe(S),options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})]}),i.jsx(to,{open:E,decoded:P,onClose:()=>{N(!1),I(null)}})]})},oo=({operation:a})=>{var P,I;const[c,d]=T.useState(!1),m=L=>L.map(Z=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-slate-500 text-xs",children:Z.name}),i.jsx("td",{className:"border border-slate-200 px-2 py-1 font-mono text-xs",children:i.jsx("div",{className:"flex flex-wrap items-center",children:i.jsx("span",{className:"min-w-0 break-all flex-1",children:Z.value})})})]},Z.name)),_=a.response.body,E=!_||typeof _=="object"&&Object.keys(_).length===0||typeof _=="string"&&(_.trim()===""||_.trim()==="{}"),N=L=>{try{const Z=JSON.parse(L);return JSON.stringify(Z,null,2)}catch{return L}};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 cursor-pointer",onClick:()=>d(!c),children:["Headers (",(((P=a==null?void 0:a.response)==null?void 0:P.headers)??[]).length,")"]}),c&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"w-full border-collapse border border-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100",children:[i.jsx("th",{className:"border border-slate-200 px-2 py-1 w-1/4 text-left",children:"Header"}),i.jsx("th",{className:"border border-slate-200 px-2 py-1 text-left",children:"Value"})]})}),i.jsx("tbody",{children:m(((I=a==null?void 0:a.response)==null?void 0:I.headers)??[])})]})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center bg-gray-200",children:[i.jsx("button",{className:"p-2 text-left font-bold flex-grow",children:"Response Body"}),i.jsx(Ur,{textToCopy:N(_)})]}),E?i.jsx("div",{className:"p-4 bg-white rounded-b shadow",children:"No payload"}):i.jsx("div",{className:"bg-white rounded-b shadow p-0 h-100",children:i.jsx(eo,{height:"100%",defaultLanguage:"json",value:N(_),options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})]})]})},so=({operation:a,currentTab:c,setCurrentTab:d})=>a?i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(Kn,{operation:a}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("button",{className:`px-4 py-2 rounded-t ${c==="request"?"bg-blue-600 text-white":"bg-gray-200 text-gray-700"}`,onClick:()=>d("request"),children:"Request"}),i.jsx("button",{className:`px-4 py-2 rounded-t ${c==="response"?"bg-blue-600 text-white":"bg-gray-200 text-gray-700"}`,onClick:()=>d("response"),children:"Response"})]}),i.jsx("div",{className:"p-4 bg-white border border-gray-300 rounded-b shadow flex-grow overflow-y-auto",style:{maxHeight:"calc(100vh - 270px)"},children:c==="request"?i.jsx(no,{operation:a}):i.jsx(oo,{operation:a})})]}):i.jsx("div",{className:"text-gray-500",children:"No request selected."}),oa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAACHxJREFUeJztnX+MFGcdxiul8UWMcECtlSIcR+GKYKsHhTu9dsQr9PhxV+TSEtTYVqXVHnD9AZWWhkG7tY1pY2uUtrYRQhZbTyC1Ftyilhg1Ri0Ww4gh1pomeze3O8ZaClZ68PoZ50gu6+zdLjd732FmnuT5j5DvPJ/bfZ93fu155yVKlChRokSJEg1FatLssXi09ByxE6FfjHfjU/g/+HE8TnquWKgv/D9jXeCf4irp+SItAj4f/9wn/DN+EL9Les7IinCXDxC+63/ij0vPGUn1LbivDQLA9Y+lZ42kCPZ6fLoEACdxrfS8kZL7vY5/XUL4Z7xVeuZIiUA/XOJf/xn/FV8kPXdkRJj3lBG+7tsffEF67kjI3ekOUj0zuAVfjtfg7/R5pfTskRBBzsJvFQn/V8kOOAARosL34tfxOwU+VST8N8ZMr7+sPe3svW27o295Kq+/uDWvb3o0rz/3zbxe9UCu5wYzd1/bppySPr7QizDvxr1lfs9/a+0zPW3tO53TRQBoAPSuuDe3Qfr4Qi/C/FuZ4b9dbXxm0rrO/CsA0AMA0CvuyR2VPr7Qi0APlQng+Y5dzlUA6C0BwEHp4wu9CPQ6/O8yKuaC23c7z3V05vUgAE7wFbRU+vhCL+XtdJvwdvzDfn7VB0AWV92xx+kEQAYAGQBkAJABQAYAGQBkAPAsABayCCdnR89Gyjv1/CMfADukZ4uFCHoC/pMPgOukZ4uFCLq2yLpwofRssRBBf8on/C7puWIjwr7ZB8A+6bnOSRHceHxbvxNlpfi3PgA2r3/BWXXX806aFpSmBaVpQWlaUJoWlKYFpWlBaVpQmhaUpgWlP70xt6P1ztz2pWty3792dc/TTTf1PGWssp9obLO/29Bq3zJ/iT1WOp+Kqq/NfK/MjVYxLwTAcwDQANAl7AP0io05DQANAA0ADQANAA0AXd9i63nN9qNzmrqjW1UJ7WP4HwGEfxxXA+BokACuvNa2ATBdOqeKidDq8b8CAJB979S6KgCcCBhAHgCzpHOqmAjuAnfxDADA4TWdr05av9fRAX8F7QLACOmcKirCm4ifxFaJdk9BFJ6e3r9hnzMTABYALABYALAAYAHAAoAFAAsAFgAsAFgAsABgAcACgAUACwAWACwAHG5osR+bv9hOrh0XirAb8JsFALZJzxUbEXaz8m667Q/gIem5YiPCXumzBrRLzxUbEfZXfAC0Ss8VGxH2Rh8Ac6XnCq2Ud0FlKV6Nbw3AewsBjJ919bS7M85aWpBJCzJpQSYtyKQFmbQgkxZk0oJMWpBJCzJpQSYtyKQFmbQgkxZk0oJMWpBJCzJpQSY11GQfYNYt6DYvb+w2Z9d3mTPndJkzrugyp83KbqqpzS6fOj0b7oqqvLuW9wfQ8wf08vs7xwLgtaD3AQDQANAA0ADQANAA0ADQANDVl2ZfnDItO0Y656IinDZV3n2bZ+Newq/CWQEAp6fUZJdL51xUbjup9F8/zhP+hTgnAEBPrsneKp1zURHOlfjtCgPIEf4HsCMA4ASfgI9K51xUyjvd3KG8uxUqBeB1wp+Mjw0zgC4AtLMGnC+d87CKwDsLAFjl/h8rv54bCYCLADCh5c7cOABULVrd8z4AjAbAKAC8u6HFvgAAIyJ9PeBspLx7goYEINEQlAAQVgJAWAmAsxAhVeGpATnj04IUbqQFGbQggxZk0IIMWpBBCzJoQQYtyKAFGbQggxZksAgbLMIGLchgETZoQQaLsMEibLAIG7Qgg0XYoAUZtCCDFmTQggxakEELMmouy1ZL5zqolPd0y2Oq/Acsyt0HTMHHh7mGnqaGPk0NHSWdc1Ep767mSoZ/BsCH8JsCG7FeNmKLpHMuKsJZW+HwXR8j/PcLnoq4QzrnoiKcxcPwCdCEPwHbAgBO8QkI70MehDMKb1XFn2YMxPU3b5kIgL8LANjOGhD+t3IR0iX4amwE4G2FAMbWNkwHwPwht6Ab7QUAuAYATQBYAIBPFm1BtdkZ0rmKSHmPrRZ+Cj4hPVdsRNhf9gFwg/RcsZEbtg+Au6Tnio0Ie5H6/4s8j0jPFRsp/zuq09JznbMivDr88hCr6Esb9jl1QdbQhhb70LzF9jzpfCoqghuDfx/AXuDI6m2vXBL4PqDZ/sOcpu7w3nYyVBFcIz4WAAAbj1//gnM84I3YMQA0SudUMSnvfW+5AAC4zwzXAOBIwAB6ADBTOqeKiuA2K+91kkOFsAQAewIE8M68ZnuLdD4Vl/KuGSzs2+GaJfpFHwApACwBQAoAKQCkAJACQAoAKQCkAJACwP0A+BoAtgxwb+jmhlZ72fwldnjP9UuKsG/0AfAz6bliI8K+ygeAu5Yk9/AMhwj6UuX/tsQPSs8WCxH0OHzQB8D10rPFQgQ9Aj/jA+BZ6dkiJ0IdqbwbfN3TFf2fF/Z7xcH/NmS0oF8O8pzwQVpQR9um3Ejp4wu9lPeMQanXld2HQZpv3+38oIR9gPve0C9JH1/oRaBHy9yQZTp2OXPXdeZPlvDaykPSxxd6EeiRMgGcvHjusskA+F0JAF6WPr7Qi0BX4RNlQtjavrO7GQC9g7w3tE36+EIv5T1ls0x5L/TYVuCXigB4a3R13Ufa087DADgAgAMAOACAXwBgf98bs1pZhOP1dEvQIugZ+I0iEP6IJ/b7t251na28W1vC+1zXuSTl3fj1kwG+in6DP4+vwd/APcp7u9bj0rNHRoS5rsz1wf3dgc9Kzx0ZEWZNGfsE139RyS9rBCvl/VZkqQCSW1iClvJeBlLKDcDupctJ0vNGTsr7NaXDJQDYKT1rZKW8p3EGejGI24CukJ4zsurr+XsGAPBV6RkjL+VdqPG70WsHfo/0fLGQ8h6J/bbyzh/l8X0q+W354ZdKLtAnSpQoUaJEicrRfwFj5g/5zsKE0wAAAABJRU5ErkJggg==",ao=({apiEndpoint:a,setApiEndpoint:c,connectionStatus:d,channelCode:m,setChannelCode:_,channel:E,setChannel:N,onRegister:P})=>{const[I,L]=T.useState(!1),[Z,S]=T.useState(a),[Q,oe]=T.useState(m),[q,X]=T.useState(E);T.useEffect(()=>{S(a),oe(m),X(E)},[a,m,E]),T.useEffect(()=>{if(typeof window<"u"){const xe=localStorage.getItem("apiEndpoint")||window.location.origin+"/api";S(xe),c(xe)}},[c]);const W=()=>{typeof window<"u"&&localStorage.setItem("apiEndpoint",Z),c(Z)},pe=()=>{typeof window<"u"&&(localStorage.setItem("channelCode",Q),localStorage.setItem("channel",q)),_(Q),N(q),P(Q,q,"",!0)};return i.jsxs("div",{className:"fixed bottom-0 left-0 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between bg-gray-200 px-4 py-2 w-full cursor-pointer select-none",onClick:()=>L(te=>!te),children:[i.jsx("div",{className:"flex items-center gap-4",children:i.jsxs("span",{className:`px-2 py-1 rounded-full text-xs font-semibold flex items-center
|
|
48
|
+
${d==="connected"?"bg-green-500 text-white":d==="reconnecting"?"bg-yellow-500 text-black":"bg-red-500"}`,children:[i.jsx("span",{className:`w-2 h-2 rounded-full mr-1
|
|
49
|
+
${d==="connected"?"bg-green-800":d==="reconnecting"?"bg-yellow-800":"bg-red-800"}`}),d.charAt(0).toUpperCase()+d.slice(1)]})}),i.jsxs("a",{href:"https://github.com/inspectr-hq/inspectr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2",onClick:te=>te.stopPropagation(),children:[i.jsx("img",{src:oa,alt:"Inspectr Logo",className:"h-6"}),i.jsx("span",{className:"text-gray-700 font-semibold text-sm",children:"Inspectr"})]})]}),i.jsx("div",{className:`bg-gray-100 border-t border-gray-300 transition-all duration-300 overflow-hidden ${I?"max-h-96 opacity-100 py-4":"max-h-0 opacity-0 py-0"}`,children:i.jsxs("div",{className:"px-6",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-800 mb-4",children:"Configuration"}),i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Inspectr API Endpoint"}),i.jsx("input",{type:"text",placeholder:"Enter API Endpoint...",value:Z,onChange:te=>S(te.target.value),className:"w-full border bg-white border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:W,className:"mt-2 bg-blue-600 text-white px-3 py-1.5 rounded-md text-sm",children:"Save"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Channel"}),i.jsx("input",{type:"text",placeholder:"Enter Channel...",value:q,onChange:te=>X(te.target.value),className:"w-full bg-white border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:pe,className:"mt-2 bg-green-600 text-white px-3 py-1.5 rounded-md text-sm",children:"Register"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Access Code"}),i.jsx("input",{type:"text",placeholder:"Enter Access Code...",value:Q,onChange:te=>oe(te.target.value),className:"w-full border bg-white border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})})]})};class sa{constructor(){this.db=new lr("InspectrDB"),this.db.version(1).stores({events:"id, time, operation_id, method, status_code, path, duration, server"})}transformEvent(c){var N;const{id:d,time:m,data:_,operation_id:E}=c;return{id:d,time:m,operation_id:E,method:_.request.method,url:_.request.url,server:_.request.server,path:_.request.path,client_ip:_.request.client_ip,duration:_.timing.duration,status_code:(N=_.response)==null?void 0:N.status,raw:c}}async upsertEvent(c){const d=this.transformEvent(c);return await this.db.events.put(d)}async deleteEvent(c){return await this.db.events.delete(c)}async getEvent(c){return await this.db.events.get(c)}async queryEvents(c={}){const{filters:d={},sort:m={field:"time",order:"desc"},page:_=1,pageSize:E=20}=c;let N=this.db.events.toCollection();if(d.timestampRange){if(typeof d.timestampRange=="string"){let S=new Date;switch(d.timestampRange){case"5M":S.setMinutes(S.getMinutes()-5);break;case"15M":S.setMinutes(S.getMinutes()-15);break;case"30M":S.setMinutes(S.getMinutes()-30);break;case"1H":S.setHours(S.getHours()-1);break;case"3H":S.setHours(S.getHours()-3);break;case"6H":S.setHours(S.getHours()-6);break;case"12H":S.setHours(S.getHours()-12);break;case"24H":S.setHours(S.getHours()-24);break;case"48H":S.setHours(S.getHours()-48);break;case"week":S.setDate(S.getDate()-7);break;case"month":S.setMonth(S.getMonth()-1);break}N=N.filter(Q=>new Date(Q.time)>=S)}else if(typeof d.timestampRange=="object"){if(d.timestampRange.start&&d.timestampRange.end){const S=new Date(d.timestampRange.start),Q=new Date(d.timestampRange.end);N=N.filter(oe=>{const q=new Date(oe.time);return q>=S&&q<=Q})}else if(d.timestampRange.start){const S=new Date(d.timestampRange.start);N=N.filter(Q=>new Date(Q.time)>=S)}else if(d.timestampRange.end){const S=new Date(d.timestampRange.end);N=N.filter(Q=>new Date(Q.time)<=S)}}}if(d.status&&Array.isArray(d.status)&&d.status.length>0&&(N=N.filter(S=>d.status.includes(String(S.status_code)))),d.method&&Array.isArray(d.method)&&d.method.length>0){const S=d.method.map(Q=>Q.toLowerCase());N=N.filter(Q=>S.includes(Q.method.toLowerCase()))}d.path&&(N=N.filter(S=>S.path.includes(d.path))),d.durationMin&&(N=N.filter(S=>Number(S.duration)>=Number(d.durationMin))),d.durationMax&&(N=N.filter(S=>Number(S.duration)<=Number(d.durationMax))),d.host&&(N=N.filter(S=>S.server.toLowerCase().includes(d.host.toLowerCase())));let P;if(typeof N.orderBy=="function")try{P=N.orderBy(m.field),m.order==="desc"&&(P=P.reverse())}catch(S){console.error("[EventDB] orderBy error, fallback sorting:",S),P=(await N.toArray()).sort((oe,q)=>{const X=m.field;return oe[X]<q[X]?m.order==="asc"?-1:1:oe[X]>q[X]?m.order==="asc"?1:-1:0})}else P=(await N.toArray()).sort((Q,oe)=>{const q=m.field;return Q[q]<oe[q]?m.order==="asc"?-1:1:Q[q]>oe[q]?m.order==="asc"?1:-1:0});const I=(_-1)*E;let L;return Array.isArray(P)?L=P.slice(I,I+E):typeof P.offset=="function"?L=await P.offset(I).limit(E).toArray():L=[],L.map(S=>({id:S.id,...S.raw.data}))}async clearEvents(){return await this.db.events.clear()}}const vt=new sa,aa=typeof window<"u"&&window.location.hostname==="localhost",$r=typeof window<"u"&&localStorage.getItem("debug")==="true";$r&&console.log("[Inspectr] Debug Mode enabled");const ia=({apiEndpoint:a="/api"})=>{const[c,d]=T.useState(null),[m,_]=T.useState("request"),[E,N]=T.useState(a),[P,I]=T.useState("disconnected"),[L,Z]=T.useState(""),[S,Q]=T.useState(""),[oe,q]=T.useState(""),[X,W]=T.useState(""),[pe,te]=T.useState(""),[xe,Ce]=T.useState(!1),[we,ie]=T.useState(null),se=100,[Ke,de]=T.useState(1),[ee,le]=T.useState("time"),[ye,Ee]=T.useState("desc"),[Oe,J]=T.useState({}),he=T.useRef(!1),Me=T.useRef(0),Ie=T.useRef(!1),Pe=6,Ue=5e3,re=Pn(()=>($r&&console.log("[Inspectr] filters",Oe),vt.queryEvents({sort:{field:ee,order:ye},filters:Oe,page:Ke,pageSize:se})),[Ke,ee,ye,Oe]),ke=Pn(()=>vt.db.events.count(),[]),Ae=ke?Math.ceil(ke/se):1,We=()=>{const z=new URLSearchParams(window.location.search),me=z.get("channelCode"),De=z.get("channel"),$e=z.get("token");return me||De||$e?(console.log("🔍 Found credentials in query params"),me&&(Q(me),localStorage.setItem("channelCode",me)),De&&(q(De),localStorage.setItem("channel",De)),$e&&(W($e),localStorage.setItem("token",$e)),window.history.replaceState({},"",`${window.location.pathname}${z.toString()?"?"+z.toString():""}`),!0):!1},Qe=()=>{const z=localStorage.getItem("channelCode"),me=localStorage.getItem("channel"),De=localStorage.getItem("token");return z&&me&&De?(console.log("✅ Using stored credentials from localStorage"),Q(z),q(me),W(De),!0):!1},lt=async()=>{console.log("🔄 Fetching /app/config (Localhost, No credentials found)");try{const z=await et();z!=null&&z.token&&(z!=null&&z.sse_endpoint)&&(z!=null&&z.channel_code)&&(console.log("✅ Loaded from /app/config:",z),Q(z.channel_code),localStorage.setItem("channelCode",z.channel_code),q(z.channel),localStorage.setItem("channel",z.channel),W(z.token),localStorage.setItem("token",z.token),Z(z.sse_endpoint),localStorage.setItem("sseEndpoint",z.sse_endpoint))}catch(z){console.error("❌ Failed to load /app/config:",z)}};T.useEffect(()=>{(async()=>{typeof window>"u"||(We()||!Qe()&&aa&&await lt(),Ce(!0))})()},[]),T.useEffect(()=>{xe&&(console.log("🔄 Auto-registering with stored credentials:",oe,S),oe&&S?ft(S,oe):console.log("⚠️ Missing credentials for auto-registration, skipping."))},[xe,oe,S]);const ft=async(z=S,me=oe,De=X,$e)=>{try{let Fe={};z&&me?Fe={channel:me,channel_code:z}:De&&(Fe={token:De}),console.log("📤 Registering with:",Fe);const f=await Nt(Fe);if(f!=null&&f.token&&(f!=null&&f.sse_endpoint)&&(f!=null&&f.channel_code))return console.log("✅ Registration successful"),Me.current=0,Ie.current=!1,Q(f.channel_code),localStorage.setItem("channelCode",f.channel_code),q(f.channel),localStorage.setItem("channel",f.channel),W(f.token),localStorage.setItem("token",f.token),te(f.expires),localStorage.setItem("expires",f.expires),Z(f.sse_endpoint),localStorage.setItem("sseEndpoint",f.sse_endpoint),$e&&ie({message:"Registration Successful",subMessage:"Your channel and access code have been registered."}),I("connected"),!0;throw console.error("❌ Registration failed:",f),ie({message:"Registration Failed",subMessage:"Please check your channel and access code.",type:"error"}),new Error("Registration failed")}catch(Fe){throw console.error("❌ Registration error:",Fe),ie({message:"Registration Error",subMessage:"An error occurred during registration.",type:"error"}),Fe}},Et=()=>{Me.current<Pe?(Me.current+=1,console.log(`🔄 Attempting re-registration (${Me.current}/${Pe}) in ${Ue/1e3} seconds...`),setTimeout(async()=>{try{await ft()}catch(z){console.log("❌ Re-registration attempt failed:",z),Et()}},Ue)):(console.log(`❌ Re-registration failed after ${Pe} attempts. Giving up.`),Me.current=0,Ie.current=!0,I("disconnected"))};T.useEffect(()=>{if(!L)return;const z=localStorage.getItem("lastEventId");let me=L;z&&(me+=me.includes("?")?`&last_event_id=${z}`:`?last_event_id=${z}`);const De=()=>`req-${Math.random().toString(36).substr(2,9)}`,$e=new EventSource(me);return console.log(`🔄 SSE connecting with ${me}`),$e.onopen=()=>{console.log("📡️ SSE connection opened."),he.current=!0,I("connected")},$e.onmessage=Fe=>{try{const f=JSON.parse(Fe.data);$r&&console.log("[Inspectr] Received event:",f),f.id||(f.id=De()),f.operation_id&&localStorage.setItem("lastEventId",f.operation_id),vt.upsertEvent(f).catch($=>console.error("Error saving event to DB:",$))}catch(f){console.error("Error parsing SSE Inspectr data:",f)}},$e.onerror=Fe=>{if(console.error("❌ SSE connection error:",Fe),he.current=!1,I("reconnecting"),Ie.current){console.log("❌ Maximum re-registration attempts reached. Closing EventSource."),I("disconnected"),$e.close();return}!Ie.current&&Me.current===0&&(console.log("🔄 Starting re-registration retry loop due to SSE error."),Et())},()=>{console.log("Closing SSE EventSource connection"),$e.close(),I("disconnected")}},[L]),T.useEffect(()=>{!c&&re&&re.length>0&&d(re[0])},[re,c]);const Y=()=>{d(null),vt.clearEvents().catch(z=>console.error("Error clearing events from DB:",z)),ve().catch(z=>console.error("Error deleting operations from Inspectr:",z)),localStorage.removeItem("lastEventId")},At=async()=>{try{const z=await vt.queryEvents({filters:Oe,sort:{field:"time",order:"desc"},page:1,pageSize:Number.MAX_SAFE_INTEGER});await Promise.all(z.map(async me=>{await vt.deleteEvent(me.id),await ct(me.operation_id)})),c&&z.some(me=>me.id===c.id)&&d(null)}catch(z){console.error("Error clearing filtered operations:",z)}},pt=async z=>{c&&(c.id||"")===z&&d(null);const me=await vt.getEvent(z);vt.deleteEvent(z).catch(De=>console.error("Error deleting event from DB:",De)),ct(me.operation_id).catch(De=>console.error("Error deleting operation from Inspectr:",De))},ve=async()=>{try{if(!(await fetch(`${E}/operations`,{method:"DELETE",headers:{"Content-Type":"application/json","x-inspectr-client":"inspectr-app"}})).ok)throw new Error("Failed to delete all operations")}catch(z){console.error("Error deleting all operations:",z),ie({message:"Error deleting all operations",subMessage:z.message,type:"error"})}},ct=async z=>{try{if(!(await fetch(`${E}/operations/${z}`,{method:"DELETE",headers:{"Content-Type":"application/json","x-inspectr-client":"inspectr-app"}})).ok)throw new Error(`Failed to delete operation ${z}`)}catch(me){console.error(`Error deleting operation ${z}:`,me),ie({message:"Error deleting operation",subMessage:me.message,type:"error"})}},Nt=async z=>{const me=await fetch(`${E}/register`,{method:"POST",headers:{"Content-Type":"application/json","x-inspectr-client":"inspectr-app"},body:JSON.stringify(z)});if(!me.ok)throw new Error(`Registration API call failed with status ${me.status}`);return await me.json()},et=async()=>{const z=await fetch("/app/config");if(!z.ok)throw new Error(`Failed to fetch config: ${z.status}`);return await z.json()};return i.jsxs("div",{className:"flex flex-col h-screen",children:[i.jsxs("div",{className:"flex flex-grow",children:[i.jsx("div",{className:"w-1/3 border-r border-gray-300 overflow-y-auto",children:i.jsx(Bn,{operations:re||[],onSelect:d,onRemove:pt,clearOperations:Y,clearFilteredOperations:At,selectedOperation:c,currentPage:Ke,totalPages:Ae,totalCount:ke||0,onPageChange:de,sortField:ee,sortDirection:ye,filters:Oe,setSortField:le,setSortDirection:Ee,setFilters:J})}),i.jsx("div",{className:"w-2/3 p-4 h-full overflow-y-auto",children:i.jsx("div",{className:"flex flex-col h-full",children:i.jsx(so,{operation:c,currentTab:m,setCurrentTab:_})})})]}),i.jsx(ao,{apiEndpoint:E,setApiEndpoint:N,connectionStatus:P,channelCode:S,setChannelCode:Q,channel:oe,setChannel:q,onRegister:ft}),we&&i.jsx($t,{message:we.message,subMessage:we.subMessage,type:we.type,onClose:()=>ie(null)})]})};Ne.CopyButton=Ur,Ne.DialogConfirmClear=Dn,Ne.DialogJwt=to,Ne.DividerText=qn,Ne.InspectrApp=ia,Ne.RequestContent=no,Ne.RequestDetail=Kn,Ne.RequestDetailsPanel=so,Ne.RequestList=Bn,Ne.RequestListItem=Mn,Ne.RequestListPagination=In,Ne.RequestListSidePanel=Rn,Ne.ResponseContent=oo,Ne.SettingsPanel=ao,Ne.TagsInput=Fr,Ne.ToastNotification=$t,Ne.getMethodTagClass=Tn,Ne.getMethodTextClass=Lr,Ne.getStatusClass=cr,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
|