@nylas/react 1.1.0-canary.11 → 1.1.0-canary.12
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/add-circle-icon_21.entry-172d31c3.js +6726 -0
- package/dist/add-circle-icon_21.entry-71af48f1.cjs +41 -0
- package/dist/{archive-icon_7.entry-24f31e46.cjs → archive-icon_7.entry-59d9e24f.cjs} +1 -1
- package/dist/{archive-icon_7.entry-3c5e3ccf.js → archive-icon_7.entry-e892a458.js} +1 -1
- package/dist/{arrow-icon.entry-813bffe9.js → arrow-icon.entry-060b9b4f.js} +1 -1
- package/dist/{arrow-icon.entry-562eb541.cjs → arrow-icon.entry-834b8066.cjs} +1 -1
- package/dist/{bold-icon_3.entry-c0e7d524.js → bold-icon_3.entry-0f038db3.js} +1 -1
- package/dist/{bold-icon_3.entry-e8b034fe.cjs → bold-icon_3.entry-eb0fcdaa.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-7d4fdb1b.cjs → calendar-cancel-icon.entry-27a6f628.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-0b0219cb.js → calendar-cancel-icon.entry-96156441.js} +1 -1
- package/dist/{calendar-check-icon_2.entry-88025f63.cjs → calendar-check-icon_2.entry-b6d6d220.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-6ecd2faa.js → calendar-check-icon_2.entry-c7c13e3e.js} +1 -1
- package/dist/{calendar-icon.entry-b753520f.cjs → calendar-icon.entry-e7f6a9a8.cjs} +1 -1
- package/dist/{calendar-icon.entry-34d8ef69.js → calendar-icon.entry-f088fb14.js} +1 -1
- package/dist/{chevron-icon_3.entry-0aeb4cfa.cjs → chevron-icon_3.entry-8c6e6f74.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-ae55fd65.js → chevron-icon_3.entry-90a3e89c.js} +1 -1
- package/dist/{close-icon.entry-c80da833.cjs → close-icon.entry-175b9674.cjs} +1 -1
- package/dist/{close-icon.entry-ae66c827.js → close-icon.entry-e694948f.js} +1 -1
- package/dist/{constants-f34b9c6e-b9f975af.cjs → constants-f34b9c6e-593e21cc.cjs} +1 -1
- package/dist/{constants-f34b9c6e-d0f5cd19.js → constants-f34b9c6e-91f6ad05.js} +1 -1
- package/dist/{document-refresh-icon.entry-36405467.cjs → document-refresh-icon.entry-a54c74b9.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-7d370f85.js → document-refresh-icon.entry-ca98d879.js} +1 -1
- package/dist/{elements-dc5b338e-0dbb4f67.cjs → elements-dc5b338e-60f95088.cjs} +1 -1
- package/dist/{elements-dc5b338e-524cb111.js → elements-dc5b338e-68eab1e5.js} +1 -1
- package/dist/{focus-visible-e8093c16-7e94a4f3.cjs → focus-visible-e8093c16-a0869441.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-17ab1557.js → focus-visible-e8093c16-b5d785fc.js} +1 -1
- package/dist/{forward-icon_6.entry-a479b39e.cjs → forward-icon_6.entry-4b321b9a.cjs} +1 -1
- package/dist/{forward-icon_6.entry-384cc3c5.js → forward-icon_6.entry-84ac76ac.js} +2 -2
- package/dist/global-37eeb0cd-6c5934cf.cjs +1 -0
- package/dist/global-37eeb0cd-b42e0abc.js +4 -0
- package/dist/{globe-icon.entry-58b9f3fc.js → globe-icon.entry-14a60f32.js} +1 -1
- package/dist/{globe-icon.entry-0c848856.cjs → globe-icon.entry-ef04c8bf.cjs} +1 -1
- package/dist/{google-logo-icon_4.entry-3dce1b83.js → google-logo-icon_4.entry-4fa3cb8e.js} +47 -52
- package/dist/google-logo-icon_4.entry-ffeec491.cjs +1 -0
- package/dist/{index-33f74306.cjs → index-3a004ec1.cjs} +10 -10
- package/dist/{index-20ea5b0c.js → index-4c7e8f2f.js} +161 -158
- package/dist/index-92989ac4-69175657.js +902 -0
- package/dist/index-92989ac4-6f32ff2a.cjs +6 -0
- package/dist/{index.es-be19d2df-f732308a.cjs → index.es-9190f785-60475c4c.cjs} +6 -6
- package/dist/{index.es-be19d2df-c2fdca63.js → index.es-9190f785-69269065.js} +12 -13
- package/dist/{info-icon_2.entry-98965833.js → info-icon_2.entry-45f6f01f.js} +1 -1
- package/dist/{info-icon_2.entry-dd0a0633.cjs → info-icon_2.entry-fb099090.cjs} +1 -1
- package/dist/{loading-icon.entry-abd81cea.js → loading-icon.entry-67c8b1fa.js} +1 -1
- package/dist/{loading-icon.entry-46821f18.cjs → loading-icon.entry-eaabff41.cjs} +1 -1
- package/dist/{mailbox-store-76540d24-7bf14e45.cjs → mailbox-store-29139d89-dd9d3d1b.cjs} +1 -1
- package/dist/{mailbox-store-76540d24-dfb53045.js → mailbox-store-29139d89-e3513416.js} +2 -2
- package/dist/{nylas-additional-participants.entry-d35d7af5.cjs → nylas-additional-participants.entry-6413fc87.cjs} +1 -1
- package/dist/{nylas-additional-participants.entry-f6ed34d6.js → nylas-additional-participants.entry-a1fb4ef4.js} +2 -2
- package/dist/{nylas-booked-event-card_10.entry-534e587c.cjs → nylas-booked-event-card_10.entry-ce660783.cjs} +1 -1
- package/dist/{nylas-booked-event-card_10.entry-8efe8335.js → nylas-booked-event-card_10.entry-e435ff63.js} +3 -3
- package/dist/{nylas-custom-booking-flow.entry-12d09496.cjs → nylas-custom-booking-flow.entry-3e690bb7.cjs} +1 -1
- package/dist/{nylas-custom-booking-flow.entry-0e7b605d.js → nylas-custom-booking-flow.entry-56075ecd.js} +2 -2
- package/dist/{nylas-form-card.entry-7dd86dde.js → nylas-form-card.entry-33ff95e1.js} +2 -2
- package/dist/{nylas-form-card.entry-94579d1d.cjs → nylas-form-card.entry-64d7be4d.cjs} +1 -1
- package/dist/{nylas-if-state.entry-32ea90ea.cjs → nylas-if-state.entry-1e4b0a58.cjs} +1 -1
- package/dist/{nylas-if-state.entry-92cbc0b9.js → nylas-if-state.entry-3d22bca7.js} +2 -2
- package/dist/{nylas-list-folders.entry-8595a9b7.cjs → nylas-list-folders.entry-3da37b1c.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-cab222c9.js → nylas-list-folders.entry-e634780d.js} +2 -2
- package/dist/{nylas-list-threads.entry-8e9294a3.js → nylas-list-threads.entry-26dbb8ff.js} +2 -2
- package/dist/{nylas-list-threads.entry-3fef6316.cjs → nylas-list-threads.entry-ef4743af.cjs} +1 -1
- package/dist/{nylas-login.entry-bc885e04.cjs → nylas-login.entry-a76e4aae.cjs} +1 -1
- package/dist/{nylas-login.entry-bd1d5b6f.js → nylas-login.entry-ff7d9db5.js} +2 -2
- package/dist/{nylas-mailbox-pagination.entry-74d3b376.cjs → nylas-mailbox-pagination.entry-565ee29b.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-58657a09.js → nylas-mailbox-pagination.entry-fcb3cc47.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-8b73b9f4.cjs → nylas-mailbox-toolbar-button.entry-3a94b1e9.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-d7817b46.js → nylas-mailbox-toolbar-button.entry-ae13c538.js} +2 -2
- package/dist/{nylas-mailbox.entry-0bddc2fd.js → nylas-mailbox.entry-6d86abe9.js} +7 -6
- package/dist/nylas-mailbox.entry-8f41c35a.cjs +1 -0
- package/dist/{nylas-provider.entry-2e24192d.js → nylas-provider.entry-01e0944e.js} +6 -5
- package/dist/nylas-provider.entry-65f0f8da.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-7dc20e4d.cjs +2 -0
- package/dist/nylas-scheduler-editor.entry-8f62880a.js +1391 -0
- package/dist/nylas-scheduling.entry-1b6628a3.cjs +1 -0
- package/dist/{nylas-scheduling.entry-3f170361.js → nylas-scheduling.entry-f15b3106.js} +40 -38
- package/dist/{nylas-threads-refresh.entry-3b9f57c3.cjs → nylas-threads-refresh.entry-d62d0574.cjs} +1 -1
- package/dist/{nylas-threads-refresh.entry-f2967405.js → nylas-threads-refresh.entry-d7727ccb.js} +2 -2
- package/dist/{nylas-threads-search.entry-e70bbf70.js → nylas-threads-search.entry-4803d20b.js} +2 -2
- package/dist/{nylas-threads-search.entry-3e0b4fdc.cjs → nylas-threads-search.entry-eec50b1b.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-4f39f045.js → nylas-view-thread.entry-2b85f8e2.js} +2 -2
- package/dist/{nylas-view-thread.entry-b23080b7.cjs → nylas-view-thread.entry-5da789da.cjs} +1 -1
- package/dist/{people-icon.entry-7f3b95e9.js → people-icon.entry-63f63064.js} +1 -1
- package/dist/{people-icon.entry-15cd7d77.cjs → people-icon.entry-b6426fe6.cjs} +1 -1
- package/dist/{play-icon_2.entry-2172886a.cjs → play-icon_2.entry-2b8094d7.cjs} +1 -1
- package/dist/{play-icon_2.entry-13065065.js → play-icon_2.entry-a3262db3.js} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-61067a7f.cjs → refresh-icon.entry-542f680c.cjs} +1 -1
- package/dist/{refresh-icon.entry-fbfa185e.js → refresh-icon.entry-64679ef7.js} +1 -1
- package/dist/{register-component-83e24412-b666e56b.js → register-component-83e24412-51af5293.js} +1 -1
- package/dist/{register-component-83e24412-445c6ad9.cjs → register-component-83e24412-d76a2962.cjs} +1 -1
- package/dist/{scheduler-config-store-ec3b6190-8bde49c6.cjs → scheduler-config-store-ec3b6190-2710b76a.cjs} +1 -1
- package/dist/{scheduler-config-store-ec3b6190-fa81c492.js → scheduler-config-store-ec3b6190-df09ddc0.js} +1 -1
- package/dist/scheduler-store-dabdbc4f-404dc261.cjs +1 -0
- package/dist/{scheduler-store-8ca9003d-8da2c12d.js → scheduler-store-dabdbc4f-6f6096d6.js} +41 -28
- package/dist/{time-period-selector.entry-5e083fd3.js → time-period-selector.entry-8e6954f5.js} +1 -1
- package/dist/{time-period-selector.entry-febf55eb.cjs → time-period-selector.entry-c5faae46.cjs} +1 -1
- package/dist/{translate-icon.entry-8ce0a713.cjs → translate-icon.entry-49a653f0.cjs} +1 -1
- package/dist/{translate-icon.entry-10db7d36.js → translate-icon.entry-57dedacf.js} +1 -1
- package/dist/{warning-icon.entry-470e449d.js → warning-icon.entry-a7977526.js} +1 -1
- package/dist/{warning-icon.entry-b8217553.cjs → warning-icon.entry-bce861bd.cjs} +1 -1
- package/package.json +2 -2
- package/dist/add-circle-icon_21.entry-71e60262.js +0 -1755
- package/dist/add-circle-icon_21.entry-95dda099.cjs +0 -1
- package/dist/google-logo-icon_4.entry-e1e63fd0.cjs +0 -1
- package/dist/nylas-mailbox.entry-762f5062.cjs +0 -1
- package/dist/nylas-provider.entry-f8ba7a6e.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-8189b099.js +0 -2269
- package/dist/nylas-scheduler-editor.entry-a642f833.cjs +0 -7
- package/dist/nylas-scheduling.entry-13087b5f.cjs +0 -1
- package/dist/scheduler-store-8ca9003d-57b3f7a7.cjs +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const v=require("./global-37eeb0cd-6c5934cf.cjs"),j=require("./index-3a004ec1.cjs");var A=[],E=[],b=typeof Uint8Array<"u"?Uint8Array:Array,C=!1;function d(){C=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=n.length;r<i;++r)A[r]=n[r],E[n.charCodeAt(r)]=r;E["-".charCodeAt(0)]=62,E["_".charCodeAt(0)]=63}function rr(n){C||d();var r,i,t,e,u,o,h=n.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=n[h-2]==="="?2:n[h-1]==="="?1:0,o=new b(h*3/4-u),t=u>0?h-4:h;var a=0;for(r=0,i=0;r<t;r+=4,i+=3)e=E[n.charCodeAt(r)]<<18|E[n.charCodeAt(r+1)]<<12|E[n.charCodeAt(r+2)]<<6|E[n.charCodeAt(r+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return u===2?(e=E[n.charCodeAt(r)]<<2|E[n.charCodeAt(r+1)]>>4,o[a++]=e&255):u===1&&(e=E[n.charCodeAt(r)]<<10|E[n.charCodeAt(r+1)]<<4|E[n.charCodeAt(r+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function ir(n){return A[n>>18&63]+A[n>>12&63]+A[n>>6&63]+A[n&63]}function nr(n,r,i){for(var t,e=[],u=r;u<i;u+=3)t=(n[u]<<16)+(n[u+1]<<8)+n[u+2],e.push(ir(t));return e.join("")}function M(n){C||d();for(var r,i=n.length,t=i%3,e="",u=[],o=16383,h=0,a=i-t;h<a;h+=o)u.push(nr(n,h,h+o>a?a:h+o));return t===1?(r=n[i-1],e+=A[r>>2],e+=A[r<<4&63],e+="=="):t===2&&(r=(n[i-2]<<8)+n[i-1],e+=A[r>>10],e+=A[r>>4&63],e+=A[r<<2&63],e+="="),u.push(e),u.join("")}function I(n,r,i,t,e){var u,o,h=e*8-t-1,a=(1<<h)-1,p=a>>1,l=-7,c=i?e-1:0,F=i?-1:1,w=n[r+c];for(c+=F,u=w&(1<<-l)-1,w>>=-l,l+=h;l>0;u=u*256+n[r+c],c+=F,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=t;l>0;o=o*256+n[r+c],c+=F,l-=8);if(u===0)u=1-p;else{if(u===a)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,t),u=u-p}return(w?-1:1)*o*Math.pow(2,u-t)}function L(n,r,i,t,e,u){var o,h,a,p=u*8-e-1,l=(1<<p)-1,c=l>>1,F=e===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=t?0:u-1,_=t?1:-1,Q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+c>=1?r+=F/a:r+=F*Math.pow(2,1-c),r*a>=2&&(o++,a/=2),o+c>=l?(h=0,o=l):o+c>=1?(h=(r*a-1)*Math.pow(2,e),o=o+c):(h=r*Math.pow(2,c-1)*Math.pow(2,e),o=0));e>=8;n[i+w]=h&255,w+=_,h/=256,e-=8);for(o=o<<e|h,p+=e;p>0;n[i+w]=o&255,w+=_,o/=256,p-=8);n[i+w-_]|=Q*128}var tr={}.toString,W=Array.isArray||function(n){return tr.call(n)=="[object Array]"};/*!
|
|
2
|
+
* The buffer module from node.js, for the browser.
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/var er=50;f.TYPED_ARRAY_SUPPORT=v.global$1.TYPED_ARRAY_SUPPORT!==void 0?v.global$1.TYPED_ARRAY_SUPPORT:!0;function D(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(n,r){if(D()<r)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(r),n.__proto__=f.prototype):(n===null&&(n=new f(r)),n.length=r),n}function f(n,r,i){if(!f.TYPED_ARRAY_SUPPORT&&!(this instanceof f))return new f(n,r,i);if(typeof n=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return P(this,n)}return G(this,n,r,i)}f.poolSize=8192;f._augment=function(n){return n.__proto__=f.prototype,n};function G(n,r,i,t){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?fr(n,r,i,t):typeof r=="string"?or(n,r,i):hr(n,r)}f.from=function(n,r,i){return G(null,n,r,i)};f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array);function H(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function ur(n,r,i,t){return H(r),r<=0?R(n,r):i!==void 0?typeof t=="string"?R(n,r).fill(i,t):R(n,r).fill(i):R(n,r)}f.alloc=function(n,r,i){return ur(null,n,r,i)};function P(n,r){if(H(r),n=R(n,r<0?0:S(r)|0),!f.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)n[i]=0;return n}f.allocUnsafe=function(n){return P(null,n)};f.allocUnsafeSlow=function(n){return P(null,n)};function or(n,r,i){if((typeof i!="string"||i==="")&&(i="utf8"),!f.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var t=V(r,i)|0;n=R(n,t);var e=n.write(r,i);return e!==t&&(n=n.slice(0,e)),n}function Y(n,r){var i=r.length<0?0:S(r.length)|0;n=R(n,i);for(var t=0;t<i;t+=1)n[t]=r[t]&255;return n}function fr(n,r,i,t){if(i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(t||0))throw new RangeError("'length' is out of bounds");return i===void 0&&t===void 0?r=new Uint8Array(r):t===void 0?r=new Uint8Array(r,i):r=new Uint8Array(r,i,t),f.TYPED_ARRAY_SUPPORT?(n=r,n.__proto__=f.prototype):n=Y(n,r),n}function hr(n,r){if(y(r)){var i=S(r.length)|0;return n=R(n,i),n.length===0||r.copy(n,0,0,i),n}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Tr(r.length)?R(n,0):Y(n,r);if(r.type==="Buffer"&&W(r.data))return Y(n,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function S(n){if(n>=D())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D().toString(16)+" bytes");return n|0}f.isBuffer=Dr;function y(n){return!!(n!=null&&n._isBuffer)}f.compare=function(r,i){if(!y(r)||!y(i))throw new TypeError("Arguments must be Buffers");if(r===i)return 0;for(var t=r.length,e=i.length,u=0,o=Math.min(t,e);u<o;++u)if(r[u]!==i[u]){t=r[u],e=i[u];break}return t<e?-1:e<t?1:0};f.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(r,i){if(!W(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return f.alloc(0);var t;if(i===void 0)for(i=0,t=0;t<r.length;++t)i+=r[t].length;var e=f.allocUnsafe(i),u=0;for(t=0;t<r.length;++t){var o=r[t];if(!y(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(e,u),u+=o.length}return e};function V(n,r){if(y(n))return n.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var i=n.length;if(i===0)return 0;for(var t=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return m(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Z(n).length;default:if(t)return m(n).length;r=(""+r).toLowerCase(),t=!0}}f.byteLength=V;function ar(n,r,i){var t=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,r>>>=0,i<=r))return"";for(n||(n="utf8");;)switch(n){case"hex":return yr(this,r,i);case"utf8":case"utf-8":return $(this,r,i);case"ascii":return Fr(this,r,i);case"latin1":case"binary":return Ar(this,r,i);case"base64":return wr(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rr(this,r,i);default:if(t)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),t=!0}}f.prototype._isBuffer=!0;function g(n,r,i){var t=n[r];n[r]=n[i],n[i]=t}f.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<r;i+=2)g(this,i,i+1);return this};f.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<r;i+=4)g(this,i,i+3),g(this,i+1,i+2);return this};f.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<r;i+=8)g(this,i,i+7),g(this,i+1,i+6),g(this,i+2,i+5),g(this,i+3,i+4);return this};f.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?$(this,0,r):ar.apply(this,arguments)};f.prototype.equals=function(r){if(!y(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:f.compare(this,r)===0};f.prototype.inspect=function(){var r="",i=er;return this.length>0&&(r=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(r+=" ... ")),"<Buffer "+r+">"};f.prototype.compare=function(r,i,t,e,u){if(!y(r))throw new TypeError("Argument must be a Buffer");if(i===void 0&&(i=0),t===void 0&&(t=r?r.length:0),e===void 0&&(e=0),u===void 0&&(u=this.length),i<0||t>r.length||e<0||u>this.length)throw new RangeError("out of range index");if(e>=u&&i>=t)return 0;if(e>=u)return-1;if(i>=t)return 1;if(i>>>=0,t>>>=0,e>>>=0,u>>>=0,this===r)return 0;for(var o=u-e,h=t-i,a=Math.min(o,h),p=this.slice(e,u),l=r.slice(i,t),c=0;c<a;++c)if(p[c]!==l[c]){o=p[c],h=l[c];break}return o<h?-1:h<o?1:0};function J(n,r,i,t,e){if(n.length===0)return-1;if(typeof i=="string"?(t=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=e?0:n.length-1),i<0&&(i=n.length+i),i>=n.length){if(e)return-1;i=n.length-1}else if(i<0)if(e)i=0;else return-1;if(typeof r=="string"&&(r=f.from(r,t)),y(r))return r.length===0?-1:k(n,r,i,t,e);if(typeof r=="number")return r=r&255,f.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?e?Uint8Array.prototype.indexOf.call(n,r,i):Uint8Array.prototype.lastIndexOf.call(n,r,i):k(n,[r],i,t,e);throw new TypeError("val must be string, number or Buffer")}function k(n,r,i,t,e){var u=1,o=n.length,h=r.length;if(t!==void 0&&(t=String(t).toLowerCase(),t==="ucs2"||t==="ucs-2"||t==="utf16le"||t==="utf-16le")){if(n.length<2||r.length<2)return-1;u=2,o/=2,h/=2,i/=2}function a(w,_){return u===1?w[_]:w.readUInt16BE(_*u)}var p;if(e){var l=-1;for(p=i;p<o;p++)if(a(n,p)===a(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===h)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(i+h>o&&(i=o-h),p=i;p>=0;p--){for(var c=!0,F=0;F<h;F++)if(a(n,p+F)!==a(r,F)){c=!1;break}if(c)return p}return-1}f.prototype.includes=function(r,i,t){return this.indexOf(r,i,t)!==-1};f.prototype.indexOf=function(r,i,t){return J(this,r,i,t,!0)};f.prototype.lastIndexOf=function(r,i,t){return J(this,r,i,t,!1)};function cr(n,r,i,t){i=Number(i)||0;var e=n.length-i;t?(t=Number(t),t>e&&(t=e)):t=e;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");t>u/2&&(t=u/2);for(var o=0;o<t;++o){var h=parseInt(r.substr(o*2,2),16);if(isNaN(h))return o;n[i+o]=h}return o}function pr(n,r,i,t){return T(m(r,n.length-i),n,i,t)}function X(n,r,i,t){return T(Br(r),n,i,t)}function lr(n,r,i,t){return X(n,r,i,t)}function sr(n,r,i,t){return T(Z(r),n,i,t)}function xr(n,r,i,t){return T(Ur(r,n.length-i),n,i,t)}f.prototype.write=function(r,i,t,e){if(i===void 0)e="utf8",t=this.length,i=0;else if(t===void 0&&typeof i=="string")e=i,t=this.length,i=0;else if(isFinite(i))i=i|0,isFinite(t)?(t=t|0,e===void 0&&(e="utf8")):(e=t,t=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-i;if((t===void 0||t>u)&&(t=u),r.length>0&&(t<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var o=!1;;)switch(e){case"hex":return cr(this,r,i,t);case"utf8":case"utf-8":return pr(this,r,i,t);case"ascii":return X(this,r,i,t);case"latin1":case"binary":return lr(this,r,i,t);case"base64":return sr(this,r,i,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xr(this,r,i,t);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),o=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wr(n,r,i){return r===0&&i===n.length?M(n):M(n.slice(r,i))}function $(n,r,i){i=Math.min(n.length,i);for(var t=[],e=r;e<i;){var u=n[e],o=null,h=u>239?4:u>223?3:u>191?2:1;if(e+h<=i){var a,p,l,c;switch(h){case 1:u<128&&(o=u);break;case 2:a=n[e+1],(a&192)===128&&(c=(u&31)<<6|a&63,c>127&&(o=c));break;case 3:a=n[e+1],p=n[e+2],(a&192)===128&&(p&192)===128&&(c=(u&15)<<12|(a&63)<<6|p&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:a=n[e+1],p=n[e+2],l=n[e+3],(a&192)===128&&(p&192)===128&&(l&192)===128&&(c=(u&15)<<18|(a&63)<<12|(p&63)<<6|l&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,h=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),e+=h}return Er(t)}var N=4096;function Er(n){var r=n.length;if(r<=N)return String.fromCharCode.apply(String,n);for(var i="",t=0;t<r;)i+=String.fromCharCode.apply(String,n.slice(t,t+=N));return i}function Fr(n,r,i){var t="";i=Math.min(n.length,i);for(var e=r;e<i;++e)t+=String.fromCharCode(n[e]&127);return t}function Ar(n,r,i){var t="";i=Math.min(n.length,i);for(var e=r;e<i;++e)t+=String.fromCharCode(n[e]);return t}function yr(n,r,i){var t=n.length;(!r||r<0)&&(r=0),(!i||i<0||i>t)&&(i=t);for(var e="",u=r;u<i;++u)e+=Ir(n[u]);return e}function Rr(n,r,i){for(var t=n.slice(r,i),e="",u=0;u<t.length;u+=2)e+=String.fromCharCode(t[u]+t[u+1]*256);return e}f.prototype.slice=function(r,i){var t=this.length;r=~~r,i=i===void 0?t:~~i,r<0?(r+=t,r<0&&(r=0)):r>t&&(r=t),i<0?(i+=t,i<0&&(i=0)):i>t&&(i=t),i<r&&(i=r);var e;if(f.TYPED_ARRAY_SUPPORT)e=this.subarray(r,i),e.__proto__=f.prototype;else{var u=i-r;e=new f(u,void 0);for(var o=0;o<u;++o)e[o]=this[o+r]}return e};function s(n,r,i){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+r>i)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function(r,i,t){r=r|0,i=i|0,t||s(r,i,this.length);for(var e=this[r],u=1,o=0;++o<i&&(u*=256);)e+=this[r+o]*u;return e};f.prototype.readUIntBE=function(r,i,t){r=r|0,i=i|0,t||s(r,i,this.length);for(var e=this[r+--i],u=1;i>0&&(u*=256);)e+=this[r+--i]*u;return e};f.prototype.readUInt8=function(r,i){return i||s(r,1,this.length),this[r]};f.prototype.readUInt16LE=function(r,i){return i||s(r,2,this.length),this[r]|this[r+1]<<8};f.prototype.readUInt16BE=function(r,i){return i||s(r,2,this.length),this[r]<<8|this[r+1]};f.prototype.readUInt32LE=function(r,i){return i||s(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};f.prototype.readUInt32BE=function(r,i){return i||s(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};f.prototype.readIntLE=function(r,i,t){r=r|0,i=i|0,t||s(r,i,this.length);for(var e=this[r],u=1,o=0;++o<i&&(u*=256);)e+=this[r+o]*u;return u*=128,e>=u&&(e-=Math.pow(2,8*i)),e};f.prototype.readIntBE=function(r,i,t){r=r|0,i=i|0,t||s(r,i,this.length);for(var e=i,u=1,o=this[r+--e];e>0&&(u*=256);)o+=this[r+--e]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*i)),o};f.prototype.readInt8=function(r,i){return i||s(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};f.prototype.readInt16LE=function(r,i){i||s(r,2,this.length);var t=this[r]|this[r+1]<<8;return t&32768?t|4294901760:t};f.prototype.readInt16BE=function(r,i){i||s(r,2,this.length);var t=this[r+1]|this[r]<<8;return t&32768?t|4294901760:t};f.prototype.readInt32LE=function(r,i){return i||s(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};f.prototype.readInt32BE=function(r,i){return i||s(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};f.prototype.readFloatLE=function(r,i){return i||s(r,4,this.length),I(this,r,!0,23,4)};f.prototype.readFloatBE=function(r,i){return i||s(r,4,this.length),I(this,r,!1,23,4)};f.prototype.readDoubleLE=function(r,i){return i||s(r,8,this.length),I(this,r,!0,52,8)};f.prototype.readDoubleBE=function(r,i){return i||s(r,8,this.length),I(this,r,!1,52,8)};function x(n,r,i,t,e,u){if(!y(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>e||r<u)throw new RangeError('"value" argument is out of bounds');if(i+t>n.length)throw new RangeError("Index out of range")}f.prototype.writeUIntLE=function(r,i,t,e){if(r=+r,i=i|0,t=t|0,!e){var u=Math.pow(2,8*t)-1;x(this,r,i,t,u,0)}var o=1,h=0;for(this[i]=r&255;++h<t&&(o*=256);)this[i+h]=r/o&255;return i+t};f.prototype.writeUIntBE=function(r,i,t,e){if(r=+r,i=i|0,t=t|0,!e){var u=Math.pow(2,8*t)-1;x(this,r,i,t,u,0)}var o=t-1,h=1;for(this[i+o]=r&255;--o>=0&&(h*=256);)this[i+o]=r/h&255;return i+t};f.prototype.writeUInt8=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,1,255,0),f.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[i]=r&255,i+1};function B(n,r,i,t){r<0&&(r=65535+r+1);for(var e=0,u=Math.min(n.length-i,2);e<u;++e)n[i+e]=(r&255<<8*(t?e:1-e))>>>(t?e:1-e)*8}f.prototype.writeUInt16LE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):B(this,r,i,!0),i+2};f.prototype.writeUInt16BE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):B(this,r,i,!1),i+2};function U(n,r,i,t){r<0&&(r=4294967295+r+1);for(var e=0,u=Math.min(n.length-i,4);e<u;++e)n[i+e]=r>>>(t?e:3-e)*8&255}f.prototype.writeUInt32LE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[i+3]=r>>>24,this[i+2]=r>>>16,this[i+1]=r>>>8,this[i]=r&255):U(this,r,i,!0),i+4};f.prototype.writeUInt32BE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):U(this,r,i,!1),i+4};f.prototype.writeIntLE=function(r,i,t,e){if(r=+r,i=i|0,!e){var u=Math.pow(2,8*t-1);x(this,r,i,t,u-1,-u)}var o=0,h=1,a=0;for(this[i]=r&255;++o<t&&(h*=256);)r<0&&a===0&&this[i+o-1]!==0&&(a=1),this[i+o]=(r/h>>0)-a&255;return i+t};f.prototype.writeIntBE=function(r,i,t,e){if(r=+r,i=i|0,!e){var u=Math.pow(2,8*t-1);x(this,r,i,t,u-1,-u)}var o=t-1,h=1,a=0;for(this[i+o]=r&255;--o>=0&&(h*=256);)r<0&&a===0&&this[i+o+1]!==0&&(a=1),this[i+o]=(r/h>>0)-a&255;return i+t};f.prototype.writeInt8=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,1,127,-128),f.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[i]=r&255,i+1};f.prototype.writeInt16LE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):B(this,r,i,!0),i+2};f.prototype.writeInt16BE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):B(this,r,i,!1),i+2};f.prototype.writeInt32LE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8,this[i+2]=r>>>16,this[i+3]=r>>>24):U(this,r,i,!0),i+4};f.prototype.writeInt32BE=function(r,i,t){return r=+r,i=i|0,t||x(this,r,i,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),f.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):U(this,r,i,!1),i+4};function q(n,r,i,t,e,u){if(i+t>n.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function z(n,r,i,t,e){return e||q(n,r,i,4),L(n,r,i,t,23,4),i+4}f.prototype.writeFloatLE=function(r,i,t){return z(this,r,i,!0,t)};f.prototype.writeFloatBE=function(r,i,t){return z(this,r,i,!1,t)};function O(n,r,i,t,e){return e||q(n,r,i,8),L(n,r,i,t,52,8),i+8}f.prototype.writeDoubleLE=function(r,i,t){return O(this,r,i,!0,t)};f.prototype.writeDoubleBE=function(r,i,t){return O(this,r,i,!1,t)};f.prototype.copy=function(r,i,t,e){if(t||(t=0),!e&&e!==0&&(e=this.length),i>=r.length&&(i=r.length),i||(i=0),e>0&&e<t&&(e=t),e===t||r.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(t<0||t>=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),r.length-i<e-t&&(e=r.length-i+t);var u=e-t,o;if(this===r&&t<i&&i<e)for(o=u-1;o>=0;--o)r[o+i]=this[o+t];else if(u<1e3||!f.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+i]=this[o+t];else Uint8Array.prototype.set.call(r,this.subarray(t,t+u),i);return u};f.prototype.fill=function(r,i,t,e){if(typeof r=="string"){if(typeof i=="string"?(e=i,i=0,t=this.length):typeof t=="string"&&(e=t,t=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(e!==void 0&&typeof e!="string")throw new TypeError("encoding must be a string");if(typeof e=="string"&&!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e)}else typeof r=="number"&&(r=r&255);if(i<0||this.length<i||this.length<t)throw new RangeError("Out of range index");if(t<=i)return this;i=i>>>0,t=t===void 0?this.length:t>>>0,r||(r=0);var o;if(typeof r=="number")for(o=i;o<t;++o)this[o]=r;else{var h=y(r)?r:m(new f(r,e).toString()),a=h.length;for(o=0;o<t-i;++o)this[o+i]=h[o%a]}return this};var gr=/[^+\/0-9A-Za-z-_]/g;function _r(n){if(n=mr(n).replace(gr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function mr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Ir(n){return n<16?"0"+n.toString(16):n.toString(16)}function m(n,r){r=r||1/0;for(var i,t=n.length,e=null,u=[],o=0;o<t;++o){if(i=n.charCodeAt(o),i>55295&&i<57344){if(!e){if(i>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===t){(r-=3)>-1&&u.push(239,191,189);continue}e=i;continue}if(i<56320){(r-=3)>-1&&u.push(239,191,189),e=i;continue}i=(e-55296<<10|i-56320)+65536}else e&&(r-=3)>-1&&u.push(239,191,189);if(e=null,i<128){if((r-=1)<0)break;u.push(i)}else if(i<2048){if((r-=2)<0)break;u.push(i>>6|192,i&63|128)}else if(i<65536){if((r-=3)<0)break;u.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((r-=4)<0)break;u.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return u}function Br(n){for(var r=[],i=0;i<n.length;++i)r.push(n.charCodeAt(i)&255);return r}function Ur(n,r){for(var i,t,e,u=[],o=0;o<n.length&&!((r-=2)<0);++o)i=n.charCodeAt(o),t=i>>8,e=i%256,u.push(e),u.push(t);return u}function Z(n){return rr(_r(n))}function T(n,r,i,t){for(var e=0;e<t&&!(e+i>=r.length||e>=n.length);++e)r[e+i]=n[e];return e}function Tr(n){return n!==n}function Dr(n){return n!=null&&(!!n._isBuffer||K(n)||Yr(n))}function K(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Yr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&K(n.slice(0,0))}var Cr=j.commonjsGlobal.process;exports.Buffer=f;exports.process=Cr;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";const T=require("./index-33f74306.cjs");class rr{constructor(e,n,r=!0,s){this.automaticComponentRegistration=!0,this.registeredComponents={},this.propStateRegistrations=new Map,this.eventListenerRegistrations=new Map,this.host=e,this.stores=n,this.automaticComponentRegistration=r,this.eventOverrides=s,T.debug(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:s}),this.registerComponent=this.registerComponent.bind(this),this.getStore=this.getStore.bind(this),Object.keys(this.stores).forEach(i=>{this.propStateRegistrations.set(i,new Map)})}async componentWillLoad(e){T.debug(`[${this.hostTagName}] Will load`),this.setupStoreListeners(),this.nylasConnector=e;const n=Array.from(this.host.querySelectorAll("*")).filter(r=>r.tagName.toLowerCase().startsWith("nylas-"));T.debug(`[${this.hostTagName}] Found ${n.length} child component(s).`,{childComponents:n}),n.forEach(r=>{const s=r;if(!s){T.debug(`[~${this.hostTagName}] Component ${s.tagName} does not have a name. Skipping.`);return}if(!s.registerNylasComponent){T.debug(`[~${this.hostTagName}] Component ${s.tagName} is not a component that can be registered. Skipping.`,{component:s});return}const i={element:s,name:s.tagName.toLowerCase(),getStoresToProp:s.getStoresToProp,storeToProps:s.storeToProps,stateToProps:s.stateToProps,authToProp:s.authToProp,eventToProps:s.eventToProps,connectorToProp:s.connectorToProp,localPropsToProp:s.localPropsToProp};this.registerComponent(i)})}async componentDidLoad(){T.debug(`[${this.hostTagName}] Did load`)}async componentDisconnected(){Object.values(this.stores).forEach(e=>{e.dispose()})}async registerComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);return}this.registerComponent(e.detail)}async unregisterComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);return}this.unregisterComponent(e.detail)}registerComponent(e){T.debug(`[${this.hostTagName}] Registering component ${e.name}.`);const n=e.element.dataset.nylasId;if(n&&this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);return}const{stateToProps:r,getStoresToProp:s,eventToProps:i,storeToProps:o,connectorToProp:u,localPropsToProp:a,element:c}=e;c.dataset.nylasId=T.uniqueID(),this.registeredComponents[c.dataset.nylasId]=e;const d=this.eventOverrides;i==null||i.forEach((l,h)=>{var y;const f=this.nylasConnector,m=async g=>{T.debug(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`,{event:g}),h in d&&(T.debug(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`),await d[h](g,f)),g.defaultPrevented||await l(g,f)},p=e.element.dataset.nylasId;p&&!this.eventListenerRegistrations.has(p)&&this.eventListenerRegistrations.set(p,[]),p&&((y=this.eventListenerRegistrations.get(p))==null||y.push([c,h,m])),T.debug(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);const v=T.formatEventName(h.toString());T.debug(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`),c.addEventListener(v,m)}),r==null||r.forEach((l,h)=>{var y,g,b,k;const[f,m]=h.split("."),v=this.getStore(f).state[m];if(!c.dataset.nylasId){T.debug(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`,{component:e});return}this.propStateRegistrations.has(f)||this.propStateRegistrations.set(f,new Map),(y=this.propStateRegistrations.get(f))!=null&&y.has(m)?(k=(b=this.propStateRegistrations.get(f))==null?void 0:b.get(m))==null||k.push({elementId:c.dataset.nylasId,propKey:l}):(g=this.propStateRegistrations.get(f))==null||g.set(m,[{elementId:c.dataset.nylasId,propKey:l}]),c[l.toString()]=v,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`,{stateValue:v})}),a==null||a.forEach((l,h)=>{const f=this.host[h];c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`,{value:h,mappedPropValue:f})}),s&&(c[s==null?void 0:s.toString()]=this.getStore,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)),o==null||o.forEach((l,h)=>{const f=this.getStore(h);c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`,{store:f})}),u&&(c[u==null?void 0:u.toString()]=this.nylasConnector,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`,{connectorToProp:u})),T.debug(`[${this.hostTagName}] Component ${e.name} registered.`)}unregisterComponent(e){T.debug(`[${this.hostTagName}] Unregistering component ${e.name}.`);const n=e.element.dataset.nylasId;if(!n){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}if(this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach((s,i)=>{s.forEach((o,u)=>{var d,l;const a=(d=this.propStateRegistrations.get(i))==null?void 0:d.get(u),c=a==null?void 0:a.filter(h=>h.elementId!==n);c&&((l=this.propStateRegistrations.get(i))==null||l.set(u,c))})});const r=this.eventListenerRegistrations.get(n);r==null||r.forEach(([s,i,o])=>{const u=T.formatEventName(i.toString());T.debug(`[${this.hostTagName}] Removing event listener for "${u}" on "${s.tagName}"`),s.removeEventListener(u,o)}),delete this.registeredComponents[n]}getStore(e){const n=this.stores[e];if(!n)throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);return n}async setupStoreListeners(){const e=this;Object.entries(this.stores).forEach(([n,r])=>{T.debug(`[${e.hostTagName}] Listening for changes in "${n}" store.`),r.use({set(s,i,o){var c;if(T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" changed`,{newValue:i,oldValue:o}),i===o){T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" unchanged. Skipping.`);return}const u=e.registeredComponents;if(!u){T.debug(`[${e.hostTagName}] No registered components found. Skipping.`);return}const a=((c=e.propStateRegistrations.get(n))==null?void 0:c.get(s.toString()))||[];T.debug(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`,{props:a,propStateRegistrations:e.propStateRegistrations}),a.forEach(({elementId:d,propKey:l})=>{const h=u[d];if(!h){T.debug(`[${e.hostTagName}] Component "${d}" not found. Skipping.`,{component:h});return}const m=e.getStore(n).state[s];h.element[l.toString()]=m,T.debug(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`,{stateValue:m})})}})})}get hostTagName(){var e,n;return((n=(e=this.host)==null?void 0:e.tagName)==null?void 0:n.toLowerCase())??"nylas-provider"}}class sr extends rr{}const Sn=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};var ir=Object.defineProperty,or=(t,e,n)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ut=(t,e,n)=>(or(t,typeof e!="symbol"?e+"":e,n),n),Pn=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(Pn||{});const ar=t=>t!==null&&typeof t=="object"&&"error"in t;class ur extends Error{constructor(e){super(e==null?void 0:e.message),ut(this,"apiError"),this.name="NylasAPIError",this.stack=new Error().stack,this.apiError=e}}async function hn(t){const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),r=Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Sn,$=Object.keys,M=Array.isArray;function U(t,e){return typeof e!="object"||$(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||K.Promise||(K.Promise=Promise);const Be=Object.getPrototypeOf,lr={}.hasOwnProperty;function z(t,e){return lr.call(t,e)}function Pe(t,e){typeof e=="function"&&(e=e(Be(t))),(typeof Reflect>"u"?$:Reflect.ownKeys)(e).forEach(n=>{ee(t,n,e[n])})}const En=Object.defineProperty;function ee(t,e,n,r){En(t,e,U(n&&z(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ke(t){return{from:function(e){return t.prototype=Object.create(e.prototype),ee(t.prototype,"constructor",t),{extend:Pe.bind(null,t.prototype)}}}}const cr=Object.getOwnPropertyDescriptor;function Jt(t,e){let n;return cr(t,e)||(n=Be(t))&&Jt(n,e)}const hr=[].slice;function lt(t,e,n){return hr.call(t,e,n)}function Cn(t,e){return e(t)}function Ie(t){if(!t)throw new Error("Assertion Failed")}function Tn(t){K.setImmediate?setImmediate(t):setTimeout(t,0)}function An(t,e){return t.reduce((n,r,s)=>{var i=e(r,s);return i&&(n[i[0]]=i[1]),n},{})}function te(t,e){if(z(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,s=e.length;r<s;++r){var i=te(t,e[r]);n.push(i)}return n}var o=e.indexOf(".");if(o!==-1){var u=t[e.substr(0,o)];return u===void 0?void 0:te(u,e.substr(o+1))}}function H(t,e,n){if(t&&e!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Ie(typeof n!="string"&&"length"in n);for(var r=0,s=e.length;r<s;++r)H(t,e[r],n[r])}else{var i=e.indexOf(".");if(i!==-1){var o=e.substr(0,i),u=e.substr(i+1);if(u==="")n===void 0?M(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=n;else{var a=t[o];a&&z(t,o)||(a=t[o]={}),H(a,u,n)}}else n===void 0?M(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=n}}function On(t){var e={};for(var n in t)z(t,n)&&(e[n]=t[n]);return e}const dr=[].concat;function In(t){return dr.apply([],t)}const Kn="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(In([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>K[t]),fr=Kn.map(t=>K[t]);An(Kn,t=>[t,!0]);let se=null;function We(t){se=typeof WeakMap<"u"&&new WeakMap;const e=Ct(t);return se=null,e}function Ct(t){if(!t||typeof t!="object")return t;let e=se&&se.get(t);if(e)return e;if(M(t)){e=[],se&&se.set(t,e);for(var n=0,r=t.length;n<r;++n)e.push(Ct(t[n]))}else if(fr.indexOf(t.constructor)>=0)e=t;else{const i=Be(t);for(var s in e=i===Object.prototype?{}:Object.create(i),se&&se.set(t,e),t)z(t,s)&&(e[s]=Ct(t[s]))}return e}const{toString:pr}={};function Tt(t){return pr.call(t).slice(8,-1)}const At=typeof Symbol<"u"?Symbol.iterator:"@@iterator",mr=typeof At=="symbol"?function(t){var e;return t!=null&&(e=t[At])&&e.apply(t)}:function(){return null},_e={};function J(t){var e,n,r,s;if(arguments.length===1){if(M(t))return t.slice();if(this===_e&&typeof t=="string")return[t];if(s=mr(t)){for(n=[];!(r=s.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Zt=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var G=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function jn(t,e){G=t,Rn=e}var Rn=()=>!0;const gr=!new Error("").stack;function Ee(){if(gr)try{throw new Error}catch(t){return t}return new Error}function Ot(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(`
|
|
1
|
+
"use strict";const T=require("./index-3a004ec1.cjs"),nr=require("./global-37eeb0cd-6c5934cf.cjs");class rr{constructor(e,n,r=!0,s){this.automaticComponentRegistration=!0,this.registeredComponents={},this.propStateRegistrations=new Map,this.eventListenerRegistrations=new Map,this.host=e,this.stores=n,this.automaticComponentRegistration=r,this.eventOverrides=s,T.debug(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:s}),this.registerComponent=this.registerComponent.bind(this),this.getStore=this.getStore.bind(this),Object.keys(this.stores).forEach(i=>{this.propStateRegistrations.set(i,new Map)})}async componentWillLoad(e){T.debug(`[${this.hostTagName}] Will load`),this.setupStoreListeners(),this.nylasConnector=e;const n=Array.from(this.host.querySelectorAll("*")).filter(r=>r.tagName.toLowerCase().startsWith("nylas-"));T.debug(`[${this.hostTagName}] Found ${n.length} child component(s).`,{childComponents:n}),n.forEach(r=>{const s=r;if(!s){T.debug(`[~${this.hostTagName}] Component ${s.tagName} does not have a name. Skipping.`);return}if(!s.registerNylasComponent){T.debug(`[~${this.hostTagName}] Component ${s.tagName} is not a component that can be registered. Skipping.`,{component:s});return}const i={element:s,name:s.tagName.toLowerCase(),getStoresToProp:s.getStoresToProp,storeToProps:s.storeToProps,stateToProps:s.stateToProps,authToProp:s.authToProp,eventToProps:s.eventToProps,connectorToProp:s.connectorToProp,localPropsToProp:s.localPropsToProp};this.registerComponent(i)})}async componentDidLoad(){T.debug(`[${this.hostTagName}] Did load`)}async componentDisconnected(){Object.values(this.stores).forEach(e=>{e.dispose()})}async registerComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);return}this.registerComponent(e.detail)}async unregisterComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);return}this.unregisterComponent(e.detail)}registerComponent(e){T.debug(`[${this.hostTagName}] Registering component ${e.name}.`);const n=e.element.dataset.nylasId;if(n&&this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);return}const{stateToProps:r,getStoresToProp:s,eventToProps:i,storeToProps:o,connectorToProp:u,localPropsToProp:a,element:c}=e;c.dataset.nylasId=T.uniqueID(),this.registeredComponents[c.dataset.nylasId]=e;const d=this.eventOverrides;i==null||i.forEach((l,h)=>{var y;const f=this.nylasConnector,m=async g=>{T.debug(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`,{event:g}),h in d&&(T.debug(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`),await d[h](g,f)),g.defaultPrevented||await l(g,f)},p=e.element.dataset.nylasId;p&&!this.eventListenerRegistrations.has(p)&&this.eventListenerRegistrations.set(p,[]),p&&((y=this.eventListenerRegistrations.get(p))==null||y.push([c,h,m])),T.debug(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);const v=T.formatEventName(h.toString());T.debug(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`),c.addEventListener(v,m)}),r==null||r.forEach((l,h)=>{var y,g,b,k;const[f,m]=h.split("."),v=this.getStore(f).state[m];if(!c.dataset.nylasId){T.debug(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`,{component:e});return}this.propStateRegistrations.has(f)||this.propStateRegistrations.set(f,new Map),(y=this.propStateRegistrations.get(f))!=null&&y.has(m)?(k=(b=this.propStateRegistrations.get(f))==null?void 0:b.get(m))==null||k.push({elementId:c.dataset.nylasId,propKey:l}):(g=this.propStateRegistrations.get(f))==null||g.set(m,[{elementId:c.dataset.nylasId,propKey:l}]),c[l.toString()]=v,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`,{stateValue:v})}),a==null||a.forEach((l,h)=>{const f=this.host[h];c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`,{value:h,mappedPropValue:f})}),s&&(c[s==null?void 0:s.toString()]=this.getStore,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)),o==null||o.forEach((l,h)=>{const f=this.getStore(h);c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`,{store:f})}),u&&(c[u==null?void 0:u.toString()]=this.nylasConnector,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`,{connectorToProp:u})),T.debug(`[${this.hostTagName}] Component ${e.name} registered.`)}unregisterComponent(e){T.debug(`[${this.hostTagName}] Unregistering component ${e.name}.`);const n=e.element.dataset.nylasId;if(!n){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}if(this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach((s,i)=>{s.forEach((o,u)=>{var d,l;const a=(d=this.propStateRegistrations.get(i))==null?void 0:d.get(u),c=a==null?void 0:a.filter(h=>h.elementId!==n);c&&((l=this.propStateRegistrations.get(i))==null||l.set(u,c))})});const r=this.eventListenerRegistrations.get(n);r==null||r.forEach(([s,i,o])=>{const u=T.formatEventName(i.toString());T.debug(`[${this.hostTagName}] Removing event listener for "${u}" on "${s.tagName}"`),s.removeEventListener(u,o)}),delete this.registeredComponents[n]}getStore(e){const n=this.stores[e];if(!n)throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);return n}async setupStoreListeners(){const e=this;Object.entries(this.stores).forEach(([n,r])=>{T.debug(`[${e.hostTagName}] Listening for changes in "${n}" store.`),r.use({set(s,i,o){var c;if(T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" changed`,{newValue:i,oldValue:o}),i===o){T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" unchanged. Skipping.`);return}const u=e.registeredComponents;if(!u){T.debug(`[${e.hostTagName}] No registered components found. Skipping.`);return}const a=((c=e.propStateRegistrations.get(n))==null?void 0:c.get(s.toString()))||[];T.debug(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`,{props:a,propStateRegistrations:e.propStateRegistrations}),a.forEach(({elementId:d,propKey:l})=>{const h=u[d];if(!h){T.debug(`[${e.hostTagName}] Component "${d}" not found. Skipping.`,{component:h});return}const m=e.getStore(n).state[s];h.element[l.toString()]=m,T.debug(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`,{stateValue:m})})}})})}get hostTagName(){var e,n;return((n=(e=this.host)==null?void 0:e.tagName)==null?void 0:n.toLowerCase())??"nylas-provider"}}class sr extends rr{}var ir=Object.defineProperty,or=(t,e,n)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ut=(t,e,n)=>(or(t,typeof e!="symbol"?e+"":e,n),n),Sn=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(Sn||{});const ar=t=>t!==null&&typeof t=="object"&&"error"in t;class ur extends Error{constructor(e){super(e==null?void 0:e.message),ut(this,"apiError"),this.name="NylasAPIError",this.stack=new Error().stack,this.apiError=e}}async function hn(t){const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),r=Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:nr.global$1,$=Object.keys,q=Array.isArray;function U(t,e){return typeof e!="object"||$(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||K.Promise||(K.Promise=Promise);const Be=Object.getPrototypeOf,lr={}.hasOwnProperty;function z(t,e){return lr.call(t,e)}function Pe(t,e){typeof e=="function"&&(e=e(Be(t))),(typeof Reflect>"u"?$:Reflect.ownKeys)(e).forEach(n=>{ee(t,n,e[n])})}const Pn=Object.defineProperty;function ee(t,e,n,r){Pn(t,e,U(n&&z(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ke(t){return{from:function(e){return t.prototype=Object.create(e.prototype),ee(t.prototype,"constructor",t),{extend:Pe.bind(null,t.prototype)}}}}const cr=Object.getOwnPropertyDescriptor;function Jt(t,e){let n;return cr(t,e)||(n=Be(t))&&Jt(n,e)}const hr=[].slice;function lt(t,e,n){return hr.call(t,e,n)}function En(t,e){return e(t)}function Ie(t){if(!t)throw new Error("Assertion Failed")}function Cn(t){K.setImmediate?setImmediate(t):setTimeout(t,0)}function Tn(t,e){return t.reduce((n,r,s)=>{var i=e(r,s);return i&&(n[i[0]]=i[1]),n},{})}function te(t,e){if(z(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,s=e.length;r<s;++r){var i=te(t,e[r]);n.push(i)}return n}var o=e.indexOf(".");if(o!==-1){var u=t[e.substr(0,o)];return u===void 0?void 0:te(u,e.substr(o+1))}}function H(t,e,n){if(t&&e!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Ie(typeof n!="string"&&"length"in n);for(var r=0,s=e.length;r<s;++r)H(t,e[r],n[r])}else{var i=e.indexOf(".");if(i!==-1){var o=e.substr(0,i),u=e.substr(i+1);if(u==="")n===void 0?q(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=n;else{var a=t[o];a&&z(t,o)||(a=t[o]={}),H(a,u,n)}}else n===void 0?q(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=n}}function An(t){var e={};for(var n in t)z(t,n)&&(e[n]=t[n]);return e}const dr=[].concat;function On(t){return dr.apply([],t)}const In="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>K[t]),fr=In.map(t=>K[t]);Tn(In,t=>[t,!0]);let se=null;function We(t){se=typeof WeakMap<"u"&&new WeakMap;const e=Ct(t);return se=null,e}function Ct(t){if(!t||typeof t!="object")return t;let e=se&&se.get(t);if(e)return e;if(q(t)){e=[],se&&se.set(t,e);for(var n=0,r=t.length;n<r;++n)e.push(Ct(t[n]))}else if(fr.indexOf(t.constructor)>=0)e=t;else{const i=Be(t);for(var s in e=i===Object.prototype?{}:Object.create(i),se&&se.set(t,e),t)z(t,s)&&(e[s]=Ct(t[s]))}return e}const{toString:pr}={};function Tt(t){return pr.call(t).slice(8,-1)}const At=typeof Symbol<"u"?Symbol.iterator:"@@iterator",mr=typeof At=="symbol"?function(t){var e;return t!=null&&(e=t[At])&&e.apply(t)}:function(){return null},_e={};function J(t){var e,n,r,s;if(arguments.length===1){if(q(t))return t.slice();if(this===_e&&typeof t=="string")return[t];if(s=mr(t)){for(n=[];!(r=s.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Zt=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var G=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Kn(t,e){G=t,jn=e}var jn=()=>!0;const gr=!new Error("").stack;function Ee(){if(gr)try{throw new Error}catch(t){return t}return new Error}function Ot(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(`
|
|
2
2
|
`).length),n.split(`
|
|
3
|
-
`).slice(e).filter(
|
|
4
|
-
`+r).join("")):""}var
|
|
5
|
-
`)}function ct(t,e,n,r){this._e=Ee(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message
|
|
6
|
-
`+i:""}`,this.inner=i||null):typeof s=="object"&&(this.message=`${s.name} ${s.message}`,this.inner=s):(this.message=yr[e]||n,this.inner=null)}return ke(r).from(vr),t[e]=r,t},{});C.Syntax=SyntaxError,C.Type=TypeError,C.Range=RangeError;var dn=
|
|
7
|
-
From previous: `);return this._state!==null&&(this._stack=t),t}finally{jt=!1}}},timeout:function(t,e){return t<1/0?new S((n,r)=>{var s=setTimeout(()=>r(new C.Timeout(e)),t);this.then(n,r).finally(clearTimeout.bind(null,s))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&ee(S.prototype,Symbol.toStringTag,"Dexie.Promise"),Se.env=Vn(),Pe(S,{all:function(){var t=J.apply(null,arguments).map(Xe);return new S(function(e,n){t.length===0&&e([]);var r=t.length;t.forEach((s,i)=>S.resolve(s).then(o=>{t[i]=o,--r||e(t)},n))})},resolve:t=>{if(t instanceof S)return t;if(t&&typeof t.then=="function")return new S((n,r)=>{t.then(n,r)});var e=new S(Me,!0,t);return Un(e,Nt),e},reject:Ge,race:function(){var t=J.apply(null,arguments).map(Xe);return new S((e,n)=>{t.map(r=>S.resolve(r).then(e,n))})},PSD:{get:()=>E,set:t=>E=t},totalEchoes:{get:()=>ft},newPSD:oe,usePSD:Te,scheduler:{get:()=>Re,set:t=>{Re=t}},rejectionMapper:{get:()=>$t,set:t=>{$t=t}},follow:(t,e)=>new S((n,r)=>oe((s,i)=>{var o=E;o.unhandleds=[],o.onunhandled=i,o.finalize=me(function(){(function(u){function a(){u(),st.splice(st.indexOf(a),1)}st.push(a),++fe,Re(()=>{--fe==0&&on()},[])})(()=>{this.unhandleds.length===0?s():i(this.unhandleds[0])})},o.finalize),t()},e,n,r))}),nt&&(nt.allSettled&&ee(S,"allSettled",function(){const t=J.apply(null,arguments).map(Xe);return new S(e=>{t.length===0&&e([]);let n=t.length;const r=new Array(n);t.forEach((s,i)=>S.resolve(s).then(o=>r[i]={status:"fulfilled",value:o},o=>r[i]={status:"rejected",reason:o}).then(()=>--n||e(r)))})}),nt.any&&typeof AggregateError<"u"&&ee(S,"any",function(){const t=J.apply(null,arguments).map(Xe);return new S((e,n)=>{t.length===0&&n(new AggregateError([]));let r=t.length;const s=new Array(r);t.forEach((i,o)=>S.resolve(i).then(u=>e(u),u=>{s[o]=u,--r||n(new AggregateError(s))}))})}));const F={awaits:0,echoes:0,id:0};var Er=0,it=[],wt=0,ft=0,Cr=0;function oe(t,e,n,r){var s=E,i=Object.create(s);i.parent=s,i.ref=0,i.global=!1,i.id=++Cr;var o=Se.env;i.env=rn?{Promise:S,PromiseProp:{value:S,configurable:!0,writable:!0},all:S.all,race:S.race,allSettled:S.allSettled,any:S.any,resolve:S.resolve,reject:S.reject,nthen:fn(o.nthen,i),gthen:fn(o.gthen,i)}:{},e&&U(i,e),++s.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=Te(i,t,n,r);return i.ref===0&&i.finalize(),u}function Ce(){return F.id||(F.id=++Er),++F.awaits,F.echoes+=Dn,F.id}function ne(){return!!F.awaits&&(--F.awaits==0&&(F.id=0),F.echoes=F.awaits*Dn,!0)}function Xe(t){return F.echoes&&t&&t.constructor===nt?(Ce(),t.then(e=>(ne(),e),e=>(ne(),D(e)))):t}function Tr(t){++ft,F.echoes&&--F.echoes!=0||(F.echoes=F.id=0),it.push(E),ae(t,!0)}function Ar(){var t=it[it.length-1];it.pop(),ae(t,!1)}function ae(t,e){var n=E;if((e?!F.echoes||wt++&&t===E:!wt||--wt&&t===E)||Wn(e?Tr.bind(null,t):Ar),t!==E&&(E=t,n===Se&&(Se.env=Vn()),rn)){var r=Se.env.Promise,s=t.env;ht.then=s.nthen,r.prototype.then=s.gthen,(n.global||t.global)&&(Object.defineProperty(K,"Promise",s.PromiseProp),r.all=s.all,r.race=s.race,r.resolve=s.resolve,r.reject=s.reject,s.allSettled&&(r.allSettled=s.allSettled),s.any&&(r.any=s.any))}}function Vn(){var t=K.Promise;return rn?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(K,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:ht.then,gthen:t.prototype.then}:{}}function Te(t,e,n,r,s){var i=E;try{return ae(t,!0),e(n,r,s)}finally{ae(i,!1)}}function Wn(t){Bn.call(It,t)}function pt(t,e,n,r){return typeof t!="function"?t:function(){var s=E;n&&Ce(),ae(e,!0);try{return t.apply(this,arguments)}finally{ae(s,!1),r&&Wn(ne)}}}function fn(t,e){return function(n,r){return t.call(this,pt(n,e),pt(r,e))}}(""+Bn).indexOf("[native code]")===-1&&(Ce=ne=I);const pn="unhandledrejection";function mn(t,e){var n;try{n=e.onuncatched(t)}catch{}if(n!==!1)try{var r,s={promise:e,reason:t};if(K.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(pn,!0,!0),U(r,s)):K.CustomEvent&&U(r=new CustomEvent(pn,{detail:s}),s),r&&K.dispatchEvent&&(dispatchEvent(r),!K.PromiseRejectionEvent&&K.onunhandledrejection))try{K.onunhandledrejection(r)}catch{}G&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var D=S.reject;function Ft(t,e,n,r){if(t.idbdb&&(t._state.openComplete||E.letThrough||t._vip)){var s=t._createTransaction(e,n,t._dbSchema);try{s.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===tn.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ft(t,e,n,r))):D(i)}return s._promise(e,(i,o)=>oe(()=>(E.trans=s,r(i,o,s)))).then(i=>s._completion.then(()=>i))}if(t._state.openComplete)return D(new C.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return D(new C.DatabaseClosed);t.open().catch(I)}return t._state.dbReadyPromise.then(()=>Ft(t,e,n,r))}const gn="3.2.4",he=String.fromCharCode(65535),Mt=-1/0,X="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",zn="String expected.",Ne=[],yt=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Or=yt,Ir=yt,Hn=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),vt="__dbnames",_t="readonly",kt="readwrite";function ge(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}const Yn={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Qe(t){return typeof t!="string"||/\./.test(t)?e=>e:e=>(e[t]===void 0&&t in e&&delete(e=We(e))[t],e)}class Kr{_trans(e,n,r){const s=this._tx||E.trans,i=this.name;function o(a,c,d){if(!d.schema[i])throw new C.NotFound("Table "+i+" not part of transaction");return n(d.idbtrans,d)}const u=ze();try{return s&&s.db===this.db?s===E.trans?s._promise(e,o,r):oe(()=>s._promise(e,o,r),{trans:s,transless:E.transless||E}):Ft(this.db,e,[this.name],o)}finally{u&&He()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:e}).then(s=>this.hook.reading.fire(s))).then(n)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(M(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const n=$(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter(c=>c.compound&&n.every(d=>c.keyPath.indexOf(d)>=0)&&c.keyPath.every(d=>n.indexOf(d)>=0))[0];if(r&&this.db._maxKey!==he)return this.where(r.name).equals(r.keyPath.map(c=>e[c]));!r&&G&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:s}=this.schema,i=this.db._deps.indexedDB;function o(c,d){try{return i.cmp(c,d)===0}catch{return!1}}const[u,a]=n.reduce(([c,d],l)=>{const h=s[l],f=e[l];return[c||h,c||!h?ge(d,h&&h.multi?m=>{const p=te(m,l);return M(p)&&p.some(v=>o(f,v))}:m=>o(f,te(m,l))):d]},[null,null]);return u?this.where(u.name).equals(e[u.keyPath]).filter(a):r?this.filter(a):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,M(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const n=r=>{if(!r)return r;const s=Object.create(e.prototype);for(var i in r)if(z(r,i))try{s[i]=r[i]}catch{}return s};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){return this.mapToClass(function(e){U(this,e)})}add(e,n){const{auto:r,keyPath:s}=this.schema.primKey;let i=e;return s&&r&&(i=Qe(s)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"add",keys:n!=null?[n]:null,values:[i]})).then(o=>o.numFailures?S.reject(o.failures[0]):o.lastResult).then(o=>{if(s)try{H(e,s,o)}catch{}return o})}update(e,n){if(typeof e!="object"||M(e))return this.where(":id").equals(e).modify(n);{const r=te(e,this.schema.primKey.keyPath);if(r===void 0)return D(new C.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?$(n).forEach(s=>{H(e,s,n[s])}):n(e,{value:e,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}}put(e,n){const{auto:r,keyPath:s}=this.schema.primKey;let i=e;return s&&r&&(i=Qe(s)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"put",values:[i],keys:n!=null?[n]:null})).then(o=>o.numFailures?S.reject(o.failures[0]):o.lastResult).then(o=>{if(s)try{H(e,s,o)}catch{}return o})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(n=>n.numFailures?S.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Yn})).then(e=>e.numFailures?S.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(r=>r.map(s=>this.hook.reading.fire(s))))}bulkAdd(e,n,r){const s=Array.isArray(n)?n:void 0,i=(r=r||(s?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:u,keyPath:a}=this.schema.primKey;if(a&&s)throw new C.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new C.InvalidArgument("Arguments objects and keys must have the same length");const c=e.length;let d=a&&u?e.map(Qe(a)):e;return this.core.mutate({trans:o,type:"add",keys:s,values:d,wantResults:i}).then(({numFailures:l,results:h,lastResult:f,failures:m})=>{if(l===0)return i?h:f;throw new je(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`,m)})})}bulkPut(e,n,r){const s=Array.isArray(n)?n:void 0,i=(r=r||(s?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:u,keyPath:a}=this.schema.primKey;if(a&&s)throw new C.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new C.InvalidArgument("Arguments objects and keys must have the same length");const c=e.length;let d=a&&u?e.map(Qe(a)):e;return this.core.mutate({trans:o,type:"put",keys:s,values:d,wantResults:i}).then(({numFailures:l,results:h,lastResult:f,failures:m})=>{if(l===0)return i?h:f;throw new je(`${this.name}.bulkPut(): ${l} of ${c} operations failed`,m)})})}bulkDelete(e){const n=e.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:e})).then(({numFailures:r,lastResult:s,failures:i})=>{if(r===0)return s;throw new je(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,i)})}}function $e(t){var e={},n=function(o,u){if(u){for(var a=arguments.length,c=new Array(a-1);--a;)c[a-1]=arguments[a];return e[o].subscribe.apply(null,c),t}if(typeof o=="string")return e[o]};n.addEventType=i;for(var r=1,s=arguments.length;r<s;++r)i(arguments[r]);return n;function i(o,u,a){if(typeof o!="object"){var c;u||(u=xr),a||(a=I);var d={subscribers:[],fire:a,subscribe:function(l){d.subscribers.indexOf(l)===-1&&(d.subscribers.push(l),d.fire=u(d.fire,l))},unsubscribe:function(l){d.subscribers=d.subscribers.filter(function(h){return h!==l}),d.fire=d.subscribers.reduce(u,a)}};return e[o]=n[o]=d,d}$(c=o).forEach(function(l){var h=c[l];if(M(h))i(l,c[l][0],c[l][1]);else{if(h!=="asap")throw new C.InvalidArgument("Invalid event config");var f=i(l,Fe,function(){for(var m=arguments.length,p=new Array(m);m--;)p[m]=arguments[m];f.subscribers.forEach(function(v){Tn(function(){v.apply(null,p)})})})}})}}function Oe(t,e){return ke(e).from({prototype:t}),e}function be(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function xt(t,e){t.filter=ge(t.filter,e)}function St(t,e,n){var r=t.replayFilter;t.replayFilter=r?()=>ge(r(),e()):e,t.justLimit=n&&!r}function ot(t,e){if(t.isPrimKey)return e.primaryKey;const n=e.getIndexByKeyPath(t.index);if(!n)throw new C.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function yn(t,e,n){const r=ot(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function Je(t,e,n,r){const s=t.replayFilter?ge(t.filter,t.replayFilter()):t.filter;if(t.or){const i={},o=(u,a,c)=>{if(!s||s(a,c,h=>a.stop(h),h=>a.fail(h))){var d=a.primaryKey,l=""+d;l==="[object ArrayBuffer]"&&(l=""+new Uint8Array(d)),z(i,l)||(i[l]=!0,e(u,a,c))}};return Promise.all([t.or._iterate(o,n),vn(yn(t,r,n),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return vn(yn(t,r,n),ge(t.algorithm,s),e,!t.keysOnly&&t.valueMapper)}function vn(t,e,n,r){var s=j(r?(i,o,u)=>n(r(i),o,u):n);return t.then(i=>{if(i)return i.start(()=>{var o=()=>i.continue();e&&!e(i,u=>o=u,u=>{i.stop(u),o=I},u=>{i.fail(u),o=I})||s(i.value,i,u=>o=u),o()})})}function L(t,e){try{const n=bn(t),r=bn(e);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:t<e?-1:0;case"binary":return function(s,i){const o=s.length,u=i.length,a=o<u?o:u;for(let c=0;c<a;++c)if(s[c]!==i[c])return s[c]<i[c]?-1:1;return o===u?0:o<u?-1:1}(wn(t),wn(e));case"Array":return function(s,i){const o=s.length,u=i.length,a=o<u?o:u;for(let c=0;c<a;++c){const d=L(s[c],i[c]);if(d!==0)return d}return o===u?0:o<u?-1:1}(t,e)}}catch{}return NaN}function bn(t){const e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";const n=Tt(t);return n==="ArrayBuffer"?"binary":n}function wn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class jr{_read(e,n){var r=this._ctx;return r.error?r.table._trans(null,D.bind(null,r.error)):r.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,D.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=ge(n.algorithm,e)}_iterate(e,n){return Je(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return e&&U(r,e),n._ctx=r,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(r=>Je(n,e,r,n.table.core))}count(e){return this._read(n=>{const r=this._ctx,s=r.table.core;if(be(r,!0))return s.count({trans:n,query:{index:ot(r,s.schema),range:r.range}}).then(o=>Math.min(o,r.limit));var i=0;return Je(r,()=>(++i,!1),n,s).then(()=>i)}).then(e)}sortBy(e,n){const r=e.split(".").reverse(),s=r[0],i=r.length-1;function o(c,d){return d?o(c[r[d]],d-1):c[s]}var u=this._ctx.dir==="next"?1:-1;function a(c,d){var l=o(c,i),h=o(d,i);return l<h?-u:l>h?u:0}return this.toArray(function(c){return c.sort(a)}).then(n)}toArray(e){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&be(r,!0)&&r.limit>0){const{valueMapper:s}=r,i=ot(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:i,range:r.range}}).then(({result:o})=>s?o.map(s):o)}{const s=[];return Je(r,i=>s.push(i),n,r.table.core).then(()=>s)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,be(n)?St(n,()=>{var r=e;return(s,i)=>r===0||(r===1?(--r,!1):(i(()=>{s.advance(r),r=0}),!1))}):St(n,()=>{var r=e;return()=>--r<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),St(this._ctx,()=>{var n=e;return function(r,s,i){return--n<=0&&s(i),n>=0}},!0),this}until(e,n){return xt(this._ctx,function(r,s,i){return!e(r.value)||(s(i),n)}),this}first(e){return this.limit(1).toArray(function(n){return n[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){var n,r;return xt(this._ctx,function(s){return e(s.value)}),n=this._ctx,r=e,n.isMatch=ge(n.isMatch,r),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.key,s)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.primaryKey,s)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.key)}).then(function(){return r}).then(e)}primaryKeys(e){var n=this._ctx;if(n.dir==="next"&&be(n,!0)&&n.limit>0)return this._read(s=>{var i=ot(n,n.table.core.schema);return n.table.core.query({trans:s,values:!1,limit:n.limit,query:{index:i,range:n.range}})}).then(({result:s})=>s).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.primaryKey)}).then(function(){return r}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(n){return n[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var r={};return xt(this._ctx,function(s){var i=s.primaryKey.toString(),o=z(r,i);return r[i]=!0,!o}),this}modify(e){var n=this._ctx;return this._write(r=>{var s;if(typeof e=="function")s=e;else{var i=$(e),o=i.length;s=function(p){for(var v=!1,y=0;y<o;++y){var g=i[y],b=e[g];te(p,g)!==b&&(H(p,g,b),v=!0)}return v}}const u=n.table.core,{outbound:a,extractKey:c}=u.schema.primaryKey,d=this.db._options.modifyChunkSize||200,l=[];let h=0;const f=[],m=(p,v)=>{const{failures:y,numFailures:g}=v;h+=p-g;for(let b of $(y))l.push(y[b])};return this.clone().primaryKeys().then(p=>{const v=y=>{const g=Math.min(d,p.length-y);return u.getMany({trans:r,keys:p.slice(y,y+g),cache:"immutable"}).then(b=>{const k=[],P=[],x=a?[]:null,w=[];for(let _=0;_<g;++_){const R=b[_],O={value:We(R),primKey:p[y+_]};s.call(O,O.value,O)!==!1&&(O.value==null?w.push(p[y+_]):a||L(c(R),c(O.value))===0?(P.push(O.value),a&&x.push(p[y+_])):(w.push(p[y+_]),k.push(O.value)))}const A=be(n)&&n.limit===1/0&&(typeof e!="function"||e===Pt)&&{index:n.index,range:n.range};return Promise.resolve(k.length>0&&u.mutate({trans:r,type:"add",values:k}).then(_=>{for(let R in _.failures)w.splice(parseInt(R),1);m(k.length,_)})).then(()=>(P.length>0||A&&typeof e=="object")&&u.mutate({trans:r,type:"put",keys:x,values:P,criteria:A,changeSpec:typeof e!="function"&&e}).then(_=>m(P.length,_))).then(()=>(w.length>0||A&&e===Pt)&&u.mutate({trans:r,type:"delete",keys:w,criteria:A}).then(_=>m(w.length,_))).then(()=>p.length>y+g&&v(y+d))})};return v(0).then(()=>{if(l.length>0)throw new ct("Error modifying one or more objects",l,h,f);return p.length})})})}delete(){var e=this._ctx,n=e.range;return be(e)&&(e.isPrimKey&&!Ir||n.type===3)?this._write(r=>{const{primaryKey:s}=e.table.core.schema,i=n;return e.table.core.count({trans:r,query:{index:s,range:i}}).then(o=>e.table.core.mutate({trans:r,type:"deleteRange",range:i}).then(({failures:u,lastResult:a,results:c,numFailures:d})=>{if(d)throw new ct("Could not delete some values",Object.keys(u).map(l=>u[l]),o-d);return o-d}))}):this.modify(Pt)}}const Pt=(t,e)=>e.value=null;function Rr(t,e){return t<e?-1:t===e?0:1}function Nr(t,e){return t>e?-1:t===e?0:1}function W(t,e,n){var r=t instanceof Xn?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function we(t){return new t.Collection(t,()=>Gn("")).limit(0)}function $r(t,e,n,r,s,i){for(var o=Math.min(t.length,r.length),u=-1,a=0;a<o;++a){var c=e[a];if(c!==r[a])return s(t[a],n[a])<0?t.substr(0,a)+n[a]+n.substr(a+1):s(t[a],r[a])<0?t.substr(0,a)+r[a]+n.substr(a+1):u>=0?t.substr(0,u)+e[u]+n.substr(u+1):null;s(t[a],c)<0&&(u=a)}return o<r.length&&i==="next"?t+n.substr(t.length):o<t.length&&i==="prev"?t.substr(0,n.length):u<0?null:t.substr(0,u)+r[u]+n.substr(u+1)}function Ze(t,e,n,r){var s,i,o,u,a,c,d,l=n.length;if(!n.every(p=>typeof p=="string"))return W(t,zn);function h(p){s=function(y){return y==="next"?g=>g.toUpperCase():g=>g.toLowerCase()}(p),i=function(y){return y==="next"?g=>g.toLowerCase():g=>g.toUpperCase()}(p),o=p==="next"?Rr:Nr;var v=n.map(function(y){return{lower:i(y),upper:s(y)}}).sort(function(y,g){return o(y.lower,g.lower)});u=v.map(function(y){return y.upper}),a=v.map(function(y){return y.lower}),c=p,d=p==="next"?"":r}h("next");var f=new t.Collection(t,()=>re(u[0],a[l-1]+r));f._ondirectionchange=function(p){h(p)};var m=0;return f._addAlgorithm(function(p,v,y){var g=p.key;if(typeof g!="string")return!1;var b=i(g);if(e(b,a,m))return!0;for(var k=null,P=m;P<l;++P){var x=$r(g,b,u[P],a[P],o,c);x===null&&k===null?m=P+1:(k===null||o(k,x)>0)&&(k=x)}return v(k!==null?function(){p.continue(k+d)}:y),!1}),f}function re(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function Gn(t){return{type:1,lower:t,upper:t}}class Xn{get Collection(){return this._ctx.table.db.Collection}between(e,n,r,s){r=r!==!1,s=s===!0;try{return this._cmp(e,n)>0||this._cmp(e,n)===0&&(r||s)&&(!r||!s)?we(this):new this.Collection(this,()=>re(e,n,!r,!s))}catch{return W(this,X)}}equals(e){return e==null?W(this,X):new this.Collection(this,()=>Gn(e))}above(e){return e==null?W(this,X):new this.Collection(this,()=>re(e,void 0,!0))}aboveOrEqual(e){return e==null?W(this,X):new this.Collection(this,()=>re(e,void 0,!1))}below(e){return e==null?W(this,X):new this.Collection(this,()=>re(void 0,e,!1,!0))}belowOrEqual(e){return e==null?W(this,X):new this.Collection(this,()=>re(void 0,e))}startsWith(e){return typeof e!="string"?W(this,zn):this.between(e,e+he,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):Ze(this,(n,r)=>n.indexOf(r[0])===0,[e],he)}equalsIgnoreCase(e){return Ze(this,(n,r)=>n===r[0],[e],"")}anyOfIgnoreCase(){var e=J.apply(_e,arguments);return e.length===0?we(this):Ze(this,(n,r)=>r.indexOf(n)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=J.apply(_e,arguments);return e.length===0?we(this):Ze(this,(n,r)=>r.some(s=>n.indexOf(s)===0),e,he)}anyOf(){const e=J.apply(_e,arguments);let n=this._cmp;try{e.sort(n)}catch{return W(this,X)}if(e.length===0)return we(this);const r=new this.Collection(this,()=>re(e[0],e[e.length-1]));r._ondirectionchange=i=>{n=i==="next"?this._ascending:this._descending,e.sort(n)};let s=0;return r._addAlgorithm((i,o,u)=>{const a=i.key;for(;n(a,e[s])>0;)if(++s,s===e.length)return o(u),!1;return n(a,e[s])===0||(o(()=>{i.continue(e[s])}),!1)}),r}notEqual(e){return this.inAnyRange([[Mt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=J.apply(_e,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return W(this,X)}const n=e.reduce((r,s)=>r?r.concat([[r[r.length-1][1],s]]):[[Mt,s]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){const r=this._cmp,s=this._ascending,i=this._descending,o=this._min,u=this._max;if(e.length===0)return we(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&s(g[0],g[1])<=0))return W(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",C.InvalidArgument);const a=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;let d,l=s;function h(g,b){return l(g[0],b[0])}try{d=e.reduce(function(g,b){let k=0,P=g.length;for(;k<P;++k){const x=g[k];if(r(b[0],x[1])<0&&r(b[1],x[0])>0){x[0]=o(x[0],b[0]),x[1]=u(x[1],b[1]);break}}return k===P&&g.push(b),g},[]),d.sort(h)}catch{return W(this,X)}let f=0;const m=c?g=>s(g,d[f][1])>0:g=>s(g,d[f][1])>=0,p=a?g=>i(g,d[f][0])>0:g=>i(g,d[f][0])>=0;let v=m;const y=new this.Collection(this,()=>re(d[0][0],d[d.length-1][1],!a,!c));return y._ondirectionchange=g=>{g==="next"?(v=m,l=s):(v=p,l=i),d.sort(h)},y._addAlgorithm((g,b,k)=>{for(var P=g.key;v(P);)if(++f,f===d.length)return b(k),!1;return!!function(x){return!m(x)&&!p(x)}(P)||(this._cmp(P,d[f][1])===0||this._cmp(P,d[f][0])===0||b(()=>{l===s?g.continue(d[f][0]):g.continue(d[f][1])}),!1)}),y}startsWithAnyOf(){const e=J.apply(_e,arguments);return e.every(n=>typeof n=="string")?e.length===0?we(this):this.inAnyRange(e.map(n=>[n,n+he])):W(this,"startsWithAnyOf() only works with strings")}}function Y(t){return j(function(e){return qe(e),t(e.target.error),!1})}function qe(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const Le="storagemutated",ie="x-storagemutated-1",ue=$e(null,Le);class Dr{_lock(){return Ie(!E.global),++this._reculock,this._reculock!==1||E.global||(E.lockOwnerFor=this),this}_unlock(){if(Ie(!E.global),--this._reculock==0)for(E.global||(E.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Te(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&E.lockOwnerFor!==this}create(e){if(!this.mode)return this;const n=this.db.idbdb,r=this.db._state.dbOpenError;if(Ie(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new C.DatabaseClosed(r);case"MissingAPIError":throw new C.MissingAPI(r.message,r);default:throw new C.OpenFailed(r)}if(!this.active)throw new C.TransactionInactive;return Ie(this._completion._state===null),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=j(s=>{qe(s),this._reject(e.error)}),e.onabort=j(s=>{qe(s),this.active&&this._reject(new C.Abort(e.error)),this.active=!1,this.on("abort").fire(s)}),e.oncomplete=j(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&ue.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,r){if(e==="readwrite"&&this.mode!=="readwrite")return D(new C.ReadOnly("Transaction is readonly"));if(!this.active)return D(new C.TransactionInactive);if(this._locked())return new S((i,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,r).then(i,o)},E])});if(r)return oe(()=>{var i=new S((o,u)=>{this._lock();const a=n(o,u,this);a&&a.then&&a.then(o,u)});return i.finally(()=>this._unlock()),i._lib=!0,i});var s=new S((i,o)=>{var u=n(i,o,this);u&&u.then&&u.then(i,o)});return s._lib=!0,s}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();const r=S.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var s=n.idbtrans.objectStore(n.storeNames[0]);(function o(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(s.get(-1/0).onsuccess=o)})()}var i=n._waitingFor;return new S((o,u)=>{r.then(a=>n._waitingQueue.push(j(o.bind(null,a))),a=>n._waitingQueue.push(j(u.bind(null,a)))).finally(()=>{n._waitingFor===i&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new C.Abort))}table(e){const n=this._memoizedTables||(this._memoizedTables={});if(z(n,e))return n[e];const r=this.schema[e];if(!r)throw new C.NotFound("Table "+e+" not part of transaction");const s=new this.db.Table(e,r,this);return s.core=this.db.core.table(e),n[e]=s,s}}function qt(t,e,n,r,s,i,o){return{name:t,keyPath:e,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+Qn(e)}}function Qn(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Jn(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:An(n,r=>[r.name,r])}}let Ue=t=>{try{return t.only([[]]),Ue=()=>[[]],[[]]}catch{return Ue=()=>he,he}};function Lt(t){return t==null?()=>{}:typeof t=="string"?function(e){return e.split(".").length===1?n=>n[e]:n=>te(n,e)}(t):e=>te(e,t)}function _n(t){return[].slice.call(t)}let Br=0;function De(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Fr(t,e,n){function r(a){if(a.type===3)return null;if(a.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:c,upper:d,lowerOpen:l,upperOpen:h}=a;return c===void 0?d===void 0?null:e.upperBound(d,!!h):d===void 0?e.lowerBound(c,!!l):e.bound(c,d,!!l,!!h)}const{schema:s,hasGetAll:i}=function(a,c){const d=_n(a.objectStoreNames);return{schema:{name:a.name,tables:d.map(l=>c.objectStore(l)).map(l=>{const{keyPath:h,autoIncrement:f}=l,m=M(h),p=h==null,v={},y={name:l.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:p,compound:m,keyPath:h,autoIncrement:f,unique:!0,extractKey:Lt(h)},indexes:_n(l.indexNames).map(g=>l.index(g)).map(g=>{const{name:b,unique:k,multiEntry:P,keyPath:x}=g,w={name:b,compound:M(x),keyPath:x,unique:k,multiEntry:P,extractKey:Lt(x)};return v[De(x)]=w,w}),getIndexByKeyPath:g=>v[De(g)]};return v[":id"]=y.primaryKey,h!=null&&(v[De(h)]=y.primaryKey),y})},hasGetAll:d.length>0&&"getAll"in c.objectStore(d[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,n),o=s.tables.map(a=>function(c){const d=c.name;return{name:d,schema:c,mutate:function({trans:l,type:h,keys:f,values:m,range:p}){return new Promise((v,y)=>{v=j(v);const g=l.objectStore(d),b=g.keyPath==null,k=h==="put"||h==="add";if(!k&&h!=="delete"&&h!=="deleteRange")throw new Error("Invalid operation type: "+h);const{length:P}=f||m||{length:1};if(f&&m&&f.length!==m.length)throw new Error("Given keys array must have same length as given values array.");if(P===0)return v({numFailures:0,failures:{},results:[],lastResult:void 0});let x;const w=[],A=[];let _=0;const R=q=>{++_,qe(q)};if(h==="deleteRange"){if(p.type===4)return v({numFailures:_,failures:A,results:[],lastResult:void 0});p.type===3?w.push(x=g.clear()):w.push(x=g.delete(r(p)))}else{const[q,B]=k?b?[m,f]:[m,null]:[f,null];if(k)for(let N=0;N<P;++N)w.push(x=B&&B[N]!==void 0?g[h](q[N],B[N]):g[h](q[N])),x.onerror=R;else for(let N=0;N<P;++N)w.push(x=g[h](q[N])),x.onerror=R}const O=q=>{const B=q.target.result;w.forEach((N,ye)=>N.error!=null&&(A[ye]=N.error)),v({numFailures:_,failures:A,results:h==="delete"?f:w.map(N=>N.result),lastResult:B})};x.onerror=q=>{R(q),O(q)},x.onsuccess=O})},getMany:({trans:l,keys:h})=>new Promise((f,m)=>{f=j(f);const p=l.objectStore(d),v=h.length,y=new Array(v);let g,b=0,k=0;const P=w=>{const A=w.target;y[A._pos]=A.result,++k===b&&f(y)},x=Y(m);for(let w=0;w<v;++w)h[w]!=null&&(g=p.get(h[w]),g._pos=w,g.onsuccess=P,g.onerror=x,++b);b===0&&f(y)}),get:({trans:l,key:h})=>new Promise((f,m)=>{f=j(f);const p=l.objectStore(d).get(h);p.onsuccess=v=>f(v.target.result),p.onerror=Y(m)}),query:function(l){return h=>new Promise((f,m)=>{f=j(f);const{trans:p,values:v,limit:y,query:g}=h,b=y===1/0?void 0:y,{index:k,range:P}=g,x=p.objectStore(d),w=k.isPrimaryKey?x:x.index(k.name),A=r(P);if(y===0)return f({result:[]});if(l){const _=v?w.getAll(A,b):w.getAllKeys(A,b);_.onsuccess=R=>f({result:R.target.result}),_.onerror=Y(m)}else{let _=0;const R=v||!("openKeyCursor"in w)?w.openCursor(A):w.openKeyCursor(A),O=[];R.onsuccess=q=>{const B=R.result;return B?(O.push(v?B.value:B.primaryKey),++_===y?f({result:O}):void B.continue()):f({result:O})},R.onerror=Y(m)}})}(i),openCursor:function({trans:l,values:h,query:f,reverse:m,unique:p}){return new Promise((v,y)=>{v=j(v);const{index:g,range:b}=f,k=l.objectStore(d),P=g.isPrimaryKey?k:k.index(g.name),x=m?p?"prevunique":"prev":p?"nextunique":"next",w=h||!("openKeyCursor"in P)?P.openCursor(r(b),x):P.openKeyCursor(r(b),x);w.onerror=Y(y),w.onsuccess=j(A=>{const _=w.result;if(!_)return void v(null);_.___id=++Br,_.done=!1;const R=_.continue.bind(_);let O=_.continuePrimaryKey;O&&(O=O.bind(_));const q=_.advance.bind(_),B=()=>{throw new Error("Cursor not stopped")};_.trans=l,_.stop=_.continue=_.continuePrimaryKey=_.advance=()=>{throw new Error("Cursor not started")},_.fail=j(y),_.next=function(){let N=1;return this.start(()=>N--?this.continue():this.stop()).then(()=>this)},_.start=N=>{const ye=new Promise((V,le)=>{V=j(V),w.onerror=Y(le),_.fail=le,_.stop=Ae=>{_.stop=_.continue=_.continuePrimaryKey=_.advance=B,V(Ae)}}),ve=()=>{if(w.result)try{N()}catch(V){_.fail(V)}else _.done=!0,_.start=()=>{throw new Error("Cursor behind last entry")},_.stop()};return w.onsuccess=j(V=>{w.onsuccess=ve,ve()}),_.continue=R,_.continuePrimaryKey=O,_.advance=q,ve(),ye},v(_)},y)})},count({query:l,trans:h}){const{index:f,range:m}=l;return new Promise((p,v)=>{const y=h.objectStore(d),g=f.isPrimaryKey?y:y.index(f.name),b=r(m),k=b?g.count(b):g.count();k.onsuccess=j(P=>p(P.target.result)),k.onerror=Y(v)})}}}(a)),u={};return o.forEach(a=>u[a.name]=a),{stack:"dbcore",transaction:t.transaction.bind(t),table(a){if(!u[a])throw new Error(`Table '${a}' not found`);return u[a]},MIN_KEY:-1/0,MAX_KEY:Ue(e),schema:s}}function Ut({_novip:t},e){const n=e.db,r=function(s,i,{IDBKeyRange:o,indexedDB:u},a){return{dbcore:function(c,d){return d.reduce((l,{create:h})=>({...l,...h(l)}),c)}(Fr(i,o,a),s.dbcore)}}(t._middlewares,n,t._deps,e);t.core=r.dbcore,t.tables.forEach(s=>{const i=s.name;t.core.schema.tables.some(o=>o.name===i)&&(s.core=t.core.table(i),t[i]instanceof t.Table&&(t[i].core=s.core))})}function mt({_novip:t},e,n,r){n.forEach(s=>{const i=r[s];e.forEach(o=>{const u=Jt(o,s);(!u||"value"in u&&u.value===void 0)&&(o===t.Transaction.prototype||o instanceof t.Transaction?ee(o,s,{get(){return this.table(s)},set(a){En(this,s,{value:a,writable:!0,configurable:!0,enumerable:!0})}}):o[s]=new t.Table(s,i))})})}function Vt({_novip:t},e){e.forEach(n=>{for(let r in n)n[r]instanceof t.Table&&delete n[r]})}function Mr(t,e){return t._cfg.version-e._cfg.version}function qr(t,e,n,r){const s=t._dbSchema,i=t._createTransaction("readwrite",t._storeNames,s);i.create(n),i._completion.catch(r);const o=i._reject.bind(i),u=E.transless||E;oe(()=>{E.trans=i,E.transless=u,e===0?($(s).forEach(a=>{Et(n,a,s[a].primKey,s[a].indexes)}),Ut(t,n),S.follow(()=>t.on.populate.fire(i)).catch(o)):function({_novip:a},c,d,l){const h=[],f=a._versions;let m=a._dbSchema=zt(a,a.idbdb,l),p=!1;const v=f.filter(g=>g._cfg.version>=c);function y(){return h.length?S.resolve(h.shift()(d.idbtrans)).then(y):S.resolve()}return v.forEach(g=>{h.push(()=>{const b=m,k=g._cfg.dbschema;Ht(a,b,l),Ht(a,k,l),m=a._dbSchema=k;const P=Zn(b,k);P.add.forEach(w=>{Et(l,w[0],w[1].primKey,w[1].indexes)}),P.change.forEach(w=>{if(w.recreate)throw new C.Upgrade("Not yet support for changing primary key");{const A=l.objectStore(w.name);w.add.forEach(_=>Wt(A,_)),w.change.forEach(_=>{A.deleteIndex(_.name),Wt(A,_)}),w.del.forEach(_=>A.deleteIndex(_))}});const x=g._cfg.contentUpgrade;if(x&&g._cfg.version>c){Ut(a,l),d._memoizedTables={},p=!0;let w=On(k);P.del.forEach(O=>{w[O]=b[O]}),Vt(a,[a.Transaction.prototype]),mt(a,[a.Transaction.prototype],$(w),w),d.schema=w;const A=Zt(x);let _;A&&Ce();const R=S.follow(()=>{if(_=x(d),_&&A){var O=ne.bind(null,null);_.then(O,O)}});return _&&typeof _.then=="function"?S.resolve(_):R.then(()=>_)}}),h.push(b=>{(!p||!Or)&&function(k,P){[].slice.call(P.db.objectStoreNames).forEach(x=>k[x]==null&&P.db.deleteObjectStore(x))}(g._cfg.dbschema,b),Vt(a,[a.Transaction.prototype]),mt(a,[a.Transaction.prototype],a._storeNames,a._dbSchema),d.schema=a._dbSchema})}),y().then(()=>{var g,b;b=l,$(g=m).forEach(k=>{b.db.objectStoreNames.contains(k)||Et(b,k,g[k].primKey,g[k].indexes)})})}(t,e,i,n).catch(o)})}function Zn(t,e){const n={del:[],add:[],change:[]};let r;for(r in t)e[r]||n.del.push(r);for(r in e){const s=t[r],i=e[r];if(s){const o={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!yt)o.recreate=!0,n.change.push(o);else{const u=s.idxByName,a=i.idxByName;let c;for(c in u)a[c]||o.del.push(c);for(c in a){const d=u[c],l=a[c];d?d.src!==l.src&&o.change.push(l):o.add.push(l)}(o.del.length>0||o.add.length>0||o.change.length>0)&&n.change.push(o)}}else n.add.push([r,i])}return n}function Et(t,e,n,r){const s=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(i=>Wt(s,i)),s}function Wt(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function zt(t,e,n){const r={};return lt(e.objectStoreNames,0).forEach(s=>{const i=n.objectStore(s);let o=i.keyPath;const u=qt(Qn(o),o||"",!1,!1,!!i.autoIncrement,o&&typeof o!="string",!0),a=[];for(let d=0;d<i.indexNames.length;++d){const l=i.index(i.indexNames[d]);o=l.keyPath;var c=qt(l.name,o,!!l.unique,!!l.multiEntry,!1,o&&typeof o!="string",!1);a.push(c)}r[s]=Jn(s,u,a)}),r}function Ht({_novip:t},e,n){const r=n.db.objectStoreNames;for(let s=0;s<r.length;++s){const i=r[s],o=n.objectStore(i);t._hasGetAll="getAll"in o;for(let u=0;u<o.indexNames.length;++u){const a=o.indexNames[u],c=o.index(a).keyPath,d=typeof c=="string"?c:"["+lt(c).join("+")+"]";if(e[i]){const l=e[i].idxByName[d];l&&(l.name=a,delete e[i].idxByName[d],e[i].idxByName[a]=l)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&K.WorkerGlobalScope&&K instanceof K.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Lr{_parseStoresSpec(e,n){$(e).forEach(r=>{if(e[r]!==null){var s=e[r].split(",").map((o,u)=>{const a=(o=o.trim()).replace(/([&*]|\+\+)/g,""),c=/^\[/.test(a)?a.match(/^\[(.*)\]$/)[1].split("+"):a;return qt(a,c||null,/\&/.test(o),/\*/.test(o),/\+\+/.test(o),M(c),u===0)}),i=s.shift();if(i.multi)throw new C.Schema("Primary key cannot be multi-valued");s.forEach(o=>{if(o.auto)throw new C.Schema("Only primary key can be marked as autoIncrement (++)");if(!o.keyPath)throw new C.Schema("Index must have a name and cannot be an empty string")}),n[r]=Jn(r,i,s)}})}stores(e){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?U(this._cfg.storesSource,e):e;const r=n._versions,s={};let i={};return r.forEach(o=>{U(s,o._cfg.storesSource),i=o._cfg.dbschema={},o._parseStoresSpec(s,i)}),n._dbSchema=i,Vt(n,[n._allTables,n,n.Transaction.prototype]),mt(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],$(i),i),n._storeNames=$(i),this}upgrade(e){return this._cfg.contentUpgrade=nn(this._cfg.contentUpgrade||I,e),this}}function an(t,e){let n=t._dbNamesDB;return n||(n=t._dbNamesDB=new pe(vt,{addons:[],indexedDB:t,IDBKeyRange:e}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function un(t){return t&&typeof t.databases=="function"}function Yt(t){return oe(function(){return E.letThrough=!0,t()})}function Ur(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()}function Vr(t){const e=t._state,{indexedDB:n}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?D(e.dbOpenError):t);G&&(e.openCanceller._stackHolder=Ee()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;const r=e.openCanceller;function s(){if(e.openCanceller!==r)throw new C.DatabaseClosed("db.open() was cancelled")}let i=e.dbReadyResolve,o=null,u=!1;return S.race([r,(typeof navigator>"u"?S.resolve():Ur()).then(()=>new S((a,c)=>{if(s(),!n)throw new C.MissingAPI;const d=t.name,l=e.autoSchema?n.open(d):n.open(d,Math.round(10*t.verno));if(!l)throw new C.MissingAPI;l.onerror=Y(c),l.onblocked=j(t._fireOnBlocked),l.onupgradeneeded=j(h=>{if(o=l.transaction,e.autoSchema&&!t._options.allowEmptyDB){l.onerror=qe,o.abort(),l.result.close();const m=n.deleteDatabase(d);m.onsuccess=m.onerror=j(()=>{c(new C.NoSuchDatabase(`Database ${d} doesnt exist`))})}else{o.onerror=Y(c);var f=h.oldVersion>Math.pow(2,62)?0:h.oldVersion;u=f<1,t._novip.idbdb=l.result,qr(t,f/10,o,c)}},c),l.onsuccess=j(()=>{o=null;const h=t._novip.idbdb=l.result,f=lt(h.objectStoreNames);if(f.length>0)try{const p=h.transaction((m=f).length===1?m[0]:m,"readonly");e.autoSchema?function({_novip:v},y,g){v.verno=y.version/10;const b=v._dbSchema=zt(0,y,g);v._storeNames=lt(y.objectStoreNames,0),mt(v,[v._allTables],$(b),b)}(t,h,p):(Ht(t,t._dbSchema,p),function(v,y){const g=Zn(zt(0,v.idbdb,y),v._dbSchema);return!(g.add.length||g.change.some(b=>b.add.length||b.change.length))}(t,p)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Ut(t,p)}catch{}var m;Ne.push(t),h.onversionchange=j(p=>{e.vcFired=!0,t.on("versionchange").fire(p)}),h.onclose=j(p=>{t.on("close").fire(p)}),u&&function({indexedDB:p,IDBKeyRange:v},y){!un(p)&&y!==vt&&an(p,v).put({name:y}).catch(I)}(t._deps,d),a()},c)}))]).then(()=>(s(),e.onReadyBeingFired=[],S.resolve(Yt(()=>t.on.ready.fire(t.vip))).then(function a(){if(e.onReadyBeingFired.length>0){let c=e.onReadyBeingFired.reduce(nn,I);return e.onReadyBeingFired=[],S.resolve(Yt(()=>c(t.vip))).then(a)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(a=>{e.dbOpenError=a;try{o&&o.abort()}catch{}return r===e.openCanceller&&t._close(),D(a)}).finally(()=>{e.openComplete=!0,i()})}function Gt(t){var e=i=>t.next(i),n=s(e),r=s(i=>t.throw(i));function s(i){return o=>{var u=i(o),a=u.value;return u.done?a:a&&typeof a.then=="function"?a.then(n,r):M(a)?Promise.all(a).then(n,r):n(a)}}return s(e)()}function Wr(t,e,n){var r=arguments.length;if(r<2)throw new C.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[t,In(s),n]}function er(t,e,n,r,s){return S.resolve().then(()=>{const i=E.transless||E,o=t._createTransaction(e,n,t._dbSchema,r),u={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(l){return l.name===tn.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>er(t,e,n,null,s))):D(l)}const a=Zt(s);let c;a&&Ce();const d=S.follow(()=>{if(c=s.call(o,o),c)if(a){var l=ne.bind(null,null);c.then(l,l)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=Gt(c))},u);return(c&&typeof c.then=="function"?S.resolve(c).then(l=>o.active?l:D(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):d.then(()=>c)).then(l=>(r&&o._resolve(),o._completion.then(()=>l))).catch(l=>(o._reject(l),D(l)))})}function et(t,e,n){const r=M(t)?t.slice():[t];for(let s=0;s<n;++s)r.push(e);return r}const zr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return{...t,table(e){const n=t.table(e),{schema:r}=n,s={},i=[];function o(c,d,l){const h=De(c),f=s[h]=s[h]||[],m=c==null?0:typeof c=="string"?1:c.length,p=d>0,v={...l,isVirtual:p,keyTail:d,keyLength:m,extractKey:Lt(c),unique:!p&&l.unique};return f.push(v),v.isPrimaryKey||i.push(v),m>1&&o(m===2?c[0]:c.slice(0,m-1),d+1,l),f.sort((y,g)=>y.keyTail-g.keyTail),v}const u=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[u];for(const c of r.indexes)o(c.keyPath,0,c);function a(c){const d=c.query.index;return d.isVirtual?{...c,query:{index:d,range:(l=c.query.range,h=d.keyTail,{type:l.type===1?2:l.type,lower:et(l.lower,l.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:et(l.upper,l.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0})}}:c;var l,h}return{...n,schema:{...r,primaryKey:u,indexes:i,getIndexByKeyPath:function(c){const d=s[De(c)];return d&&d[0]}},count:c=>n.count(a(c)),query:c=>n.query(a(c)),openCursor(c){const{keyTail:d,isVirtual:l,keyLength:h}=c.query.index;return l?n.openCursor(a(c)).then(f=>f&&function(m){return Object.create(m,{continue:{value:function(p){p!=null?m.continue(et(p,c.reverse?t.MAX_KEY:t.MIN_KEY,d)):c.unique?m.continue(m.key.slice(0,h).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,d)):m.continue()}},continuePrimaryKey:{value(p,v){m.continuePrimaryKey(et(p,t.MAX_KEY,d),v)}},primaryKey:{get:()=>m.primaryKey},key:{get(){const p=m.key;return h===1?p[0]:p.slice(0,h)}},value:{get:()=>m.value}})}(f)):n.openCursor(c)}}}}}};function ln(t,e,n,r){return n=n||{},r=r||"",$(t).forEach(s=>{if(z(e,s)){var i=t[s],o=e[s];if(typeof i=="object"&&typeof o=="object"&&i&&o){const u=Tt(i);u!==Tt(o)?n[r+s]=e[s]:u==="Object"?ln(i,o,n,r+s+"."):i!==o&&(n[r+s]=e[s])}else i!==o&&(n[r+s]=e[s])}else n[r+s]=void 0}),$(e).forEach(s=>{z(t,s)||(n[r+s]=e[s])}),n}const Hr={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(e){const n=t.table(e),{primaryKey:r}=n.schema;return{...n,mutate(s){const i=E.trans,{deleting:o,creating:u,updating:a}=i.table(e).hook;switch(s.type){case"add":if(u.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"put":if(u.fire===I&&a.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"delete":if(o.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"deleteRange":if(o.fire===I)break;return i._promise("readwrite",()=>function(l){return d(l.trans,l.range,1e4)}(s),!0)}return n.mutate(s);function c(l){const h=E.trans,f=l.keys||function(m,p){return p.type==="delete"?p.keys:p.keys||p.values.map(m.extractKey)}(r,l);if(!f)throw new Error("Keys missing");return(l=l.type==="add"||l.type==="put"?{...l,keys:f}:{...l}).type!=="delete"&&(l.values=[...l.values]),l.keys&&(l.keys=[...l.keys]),function(m,p,v){return p.type==="add"?Promise.resolve([]):m.getMany({trans:p.trans,keys:v,cache:"immutable"})}(n,l,f).then(m=>{const p=f.map((v,y)=>{const g=m[y],b={onerror:null,onsuccess:null};if(l.type==="delete")o.fire.call(b,v,g,h);else if(l.type==="add"||g===void 0){const k=u.fire.call(b,v,l.values[y],h);v==null&&k!=null&&(v=k,l.keys[y]=v,r.outbound||H(l.values[y],r.keyPath,v))}else{const k=ln(g,l.values[y]),P=a.fire.call(b,k,v,g,h);if(P){const x=l.values[y];Object.keys(P).forEach(w=>{z(x,w)?x[w]=P[w]:H(x,w,P[w])})}}return b});return n.mutate(l).then(({failures:v,results:y,numFailures:g,lastResult:b})=>{for(let k=0;k<f.length;++k){const P=y?y[k]:f[k],x=p[k];P==null?x.onerror&&x.onerror(v[k]):x.onsuccess&&x.onsuccess(l.type==="put"&&m[k]?l.values[k]:P)}return{failures:v,results:y,numFailures:g,lastResult:b}}).catch(v=>(p.forEach(y=>y.onerror&&y.onerror(v)),Promise.reject(v)))})}function d(l,h,f){return n.query({trans:l,values:!1,query:{index:r,range:h},limit:f}).then(({result:m})=>c({type:"delete",keys:m,trans:l}).then(p=>p.numFailures>0?Promise.reject(p.failures[0]):m.length<f?{failures:[],numFailures:0,lastResult:void 0}:d(l,{...h,lower:m[m.length-1],lowerOpen:!0},f)))}}}}})};function tr(t,e,n){try{if(!e||e.keys.length<t.length)return null;const r=[];for(let s=0,i=0;s<e.keys.length&&i<t.length;++s)L(e.keys[s],t[i])===0&&(r.push(n?We(e.values[s]):e.values[s]),++i);return r.length===t.length?r:null}catch{return null}}const Yr={stack:"dbcore",level:-1,create:t=>({table:e=>{const n=t.table(e);return{...n,getMany:r=>{if(!r.cache)return n.getMany(r);const s=tr(r.keys,r.trans._cache,r.cache==="clone");return s?S.resolve(s):n.getMany(r).then(i=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?We(i):i},i))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))}}})};function cn(t){return!("from"in t)}const Q=function(t,e){if(!this){const n=new Q;return t&&"d"in t&&U(n,t),n}U(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Ve(t,e,n){const r=L(e,n);if(isNaN(r))return;if(r>0)throw RangeError();if(cn(t))return U(t,{from:e,to:n,d:1});const s=t.l,i=t.r;if(L(n,t.from)<0)return s?Ve(s,e,n):t.l={from:e,to:n,d:1,l:null,r:null},kn(t);if(L(e,t.to)>0)return i?Ve(i,e,n):t.r={from:e,to:n,d:1,l:null,r:null},kn(t);L(e,t.from)<0&&(t.from=e,t.l=null,t.d=i?i.d+1:1),L(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);const o=!t.r;s&&!t.l&>(t,s),i&&o&>(t,i)}function gt(t,e){cn(e)||function n(r,{from:s,to:i,l:o,r:u}){Ve(r,s,i),o&&n(r,o),u&&n(r,u)}(t,e)}function Gr(t,e){const n=Xt(e);let r=n.next();if(r.done)return!1;let s=r.value;const i=Xt(t);let o=i.next(s.from),u=o.value;for(;!r.done&&!o.done;){if(L(u.from,s.to)<=0&&L(u.to,s.from)>=0)return!0;L(s.from,u.from)<0?s=(r=n.next(u.from)).value:u=(o=i.next(s.from)).value}return!1}function Xt(t){let e=cn(t)?null:{s:0,n:t};return{next(n){const r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&L(n,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||L(n,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function kn(t){var e,n;const r=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((n=t.l)===null||n===void 0?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const i=s==="r"?"l":"r",o={...t},u=t[s];t.from=u.from,t.to=u.to,t[s]=u[s],o[s]=u[i],t[i]=o,o.d=xn(o)}t.d=xn(t)}function xn({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}Pe(Q.prototype,{add(t){return gt(this,t),this},addKey(t){return Ve(this,t,t),this},addKeys(t){return t.forEach(e=>Ve(this,e,e)),this},[At](){return Xt(this)}});const Xr={stack:"dbcore",level:0,create:t=>{const e=t.schema.name,n=new Q(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const s=t.table(r),{schema:i}=s,{primaryKey:o}=i,{extractKey:u,outbound:a}=o,c={...s,mutate:h=>{const f=h.trans,m=f.mutatedParts||(f.mutatedParts={}),p=x=>{const w=`idb://${e}/${r}/${x}`;return m[w]||(m[w]=new Q)},v=p(""),y=p(":dels"),{type:g}=h;let[b,k]=h.type==="deleteRange"?[h.range]:h.type==="delete"?[h.keys]:h.values.length<50?[[],h.values]:[];const P=h.trans._cache;return s.mutate(h).then(x=>{if(M(b)){g!=="delete"&&(b=x.results),v.addKeys(b);const w=tr(b,P);w||g==="add"||y.addKeys(b),(w||k)&&function(A,_,R,O){function q(B){const N=A(B.name||"");function ye(V){return V!=null?B.extractKey(V):null}const ve=V=>B.multiEntry&&M(V)?V.forEach(le=>N.addKey(le)):N.addKey(V);(R||O).forEach((V,le)=>{const Ae=R&&ye(R[le]),bt=O&&ye(O[le]);L(Ae,bt)!==0&&(Ae!=null&&ve(Ae),bt!=null&&ve(bt))})}_.indexes.forEach(q)}(p,i,w,k)}else if(b){const w={from:b.lower,to:b.upper};y.add(w),v.add(w)}else v.add(n),y.add(n),i.indexes.forEach(w=>p(w.name).add(n));return x})}},d=({query:{index:h,range:f}})=>{var m,p;return[h,new Q((m=f.lower)!==null&&m!==void 0?m:t.MIN_KEY,(p=f.upper)!==null&&p!==void 0?p:t.MAX_KEY)]},l={get:h=>[o,new Q(h.key)],getMany:h=>[o,new Q().addKeys(h.keys)],count:d,query:d,openCursor:d};return $(l).forEach(h=>{c[h]=function(f){const{subscr:m}=E;if(m){const p=k=>{const P=`idb://${e}/${r}/${k}`;return m[P]||(m[P]=new Q)},v=p(""),y=p(":dels"),[g,b]=l[h](f);if(p(g.name||"").add(b),!g.isPrimaryKey){if(h!=="count"){const k=h==="query"&&a&&f.values&&s.query({...f,values:!1});return s[h].apply(this,arguments).then(P=>{if(h==="query"){if(a&&f.values)return k.then(({result:w})=>(v.addKeys(w),P));const x=f.values?P.result.map(u):P.result;f.values?v.addKeys(x):y.addKeys(x)}else if(h==="openCursor"){const x=P,w=f.values;return x&&Object.create(x,{key:{get:()=>(y.addKey(x.primaryKey),x.key)},primaryKey:{get(){const A=x.primaryKey;return y.addKey(A),A}},value:{get:()=>(w&&v.addKey(x.primaryKey),x.value)}})}return P})}y.add(n)}}return s[h].apply(this,arguments)}}),c}}}};class pe{constructor(e,n){this._middlewares={},this.verno=0;const r=pe.dependencies;this._options=n={addons:pe.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:s}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:I,dbReadyPromise:null,cancelOpen:I,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var o;i.dbReadyPromise=new S(u=>{i.dbReadyResolve=u}),i.openCanceller=new S((u,a)=>{i.cancelOpen=a}),this._state=i,this.name=e,this.on=$e(this,"populate","blocked","versionchange","close",{ready:[nn,I]}),this.on.ready.subscribe=Cn(this.on.ready.subscribe,u=>(a,c)=>{pe.vip(()=>{const d=this._state;if(d.openComplete)d.dbOpenError||S.resolve().then(a),c&&u(a);else if(d.onReadyBeingFired)d.onReadyBeingFired.push(a),c&&u(a);else{u(a);const l=this;c||u(function h(){l.on.ready.unsubscribe(a),l.on.ready.unsubscribe(h)})}})}),this.Collection=(o=this,Oe(jr.prototype,function(u,a){this.db=o;let c=Yn,d=null;if(a)try{c=a()}catch(m){d=m}const l=u._ctx,h=l.table,f=h.hook.reading.fire;this._ctx={table:h,index:l.index,isPrimKey:!l.index||h.schema.primKey.keyPath&&l.index===h.schema.primKey.name,range:c,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:d,or:l.or,valueMapper:f!==Fe?f:null}})),this.Table=function(u){return Oe(Kr.prototype,function(a,c,d){this.db=u,this._tx=d,this.name=a,this.schema=c,this.hook=u._allTables[a]?u._allTables[a].hook:$e(null,{creating:[wr,I],reading:[br,Fe],updating:[kr,I],deleting:[_r,I]})})}(this),this.Transaction=function(u){return Oe(Dr.prototype,function(a,c,d,l,h){this.db=u,this.mode=a,this.storeNames=c,this.schema=d,this.chromeTransactionDurability=l,this.idbtrans=null,this.on=$e(this,"complete","error","abort"),this.parent=h||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 S((f,m)=>{this._resolve=f,this._reject=m}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},f=>{var m=this.active;return this.active=!1,this.on.error.fire(f),this.parent?this.parent._reject(f):m&&this.idbtrans&&this.idbtrans.abort(),D(f)})})}(this),this.Version=function(u){return Oe(Lr.prototype,function(a){this.db=u,this._cfg={version:a,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(u){return Oe(Xn.prototype,function(a,c,d){this.db=u,this._ctx={table:a,index:c===":id"?null:c,or:d};const l=u._deps.indexedDB;if(!l)throw new C.MissingAPI;this._cmp=this._ascending=l.cmp.bind(l),this._descending=(h,f)=>l.cmp(f,h),this._max=(h,f)=>l.cmp(h,f)>0?h:f,this._min=(h,f)=>l.cmp(h,f)<0?h:f,this._IDBKeyRange=u._deps.IDBKeyRange})}(this),this.on("versionchange",u=>{u.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",u=>{!u.newVersion||u.newVersion<u.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion/10}`)}),this._maxKey=Ue(n.IDBKeyRange),this._createTransaction=(u,a,c,d)=>new this.Transaction(u,a,c,this._options.chromeTransactionDurability,d),this._fireOnBlocked=u=>{this.on("blocked").fire(u),Ne.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(u))},this.use(zr),this.use(Hr),this.use(Xr),this.use(Yr),this.vip=Object.create(this,{_vip:{value:!0}}),s.forEach(u=>u(this))}version(e){if(isNaN(e)||e<.1)throw new C.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new C.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const n=this._versions;var r=n.filter(s=>s._cfg.version===e)[0];return r||(r=new this.Version(e),n.push(r),n.sort(Mr),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(e){return this.idbdb&&(this._state.openComplete||E.letThrough||this._vip)?e():new S((n,r)=>{if(this._state.openComplete)return r(new C.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void r(new C.DatabaseClosed);this.open().catch(I)}this._state.dbReadyPromise.then(n,r)}).then(e)}use({stack:e,create:n,level:r,name:s}){s&&this.unuse({stack:e,name:s});const i=this._middlewares[e]||(this._middlewares[e]=[]);return i.push({stack:e,create:n,level:r??10,name:s}),i.sort((o,u)=>o.level-u.level),this}unuse({stack:e,name:n,create:r}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(s=>r?s.create!==r:!!n&&s.name!==n)),this}open(){return Vr(this)}_close(){const e=this._state,n=Ne.indexOf(this);if(n>=0&&Ne.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new S(r=>{e.dbReadyResolve=r}),e.openCanceller=new S((r,s)=>{e.cancelOpen=s})}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new C.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,n=this._state;return new S((r,s)=>{const i=()=>{this.close();var o=this._deps.indexedDB.deleteDatabase(this.name);o.onsuccess=j(()=>{(function({indexedDB:u,IDBKeyRange:a},c){!un(u)&&c!==vt&&an(u,a).delete(c).catch(I)})(this._deps,this.name),r()}),o.onerror=Y(s),o.onblocked=this._fireOnBlocked};if(e)throw new C.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(i):i()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return $(this._allTables).map(e=>this._allTables[e])}transaction(){const e=Wr.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,r){let s=E.trans;s&&s.db===this&&e.indexOf("!")===-1||(s=null);const i=e.indexOf("?")!==-1;let o,u;e=e.replace("!","").replace("?","");try{if(u=n.map(c=>{var d=c instanceof this.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),e=="r"||e===_t)o=_t;else{if(e!="rw"&&e!=kt)throw new C.InvalidArgument("Invalid transaction mode: "+e);o=kt}if(s){if(s.mode===_t&&o===kt){if(!i)throw new C.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");s=null}s&&u.forEach(c=>{if(s&&s.storeNames.indexOf(c)===-1){if(!i)throw new C.SubTransaction("Table "+c+" not included in parent transaction.");s=null}}),i&&s&&!s.active&&(s=null)}}catch(c){return s?s._promise(null,(d,l)=>{l(c)}):D(c)}const a=er.bind(null,this,o,u,s,r);return s?s._promise(o,a,"lock"):E.trans?Te(E.transless,()=>this._whenReady(a)):this._whenReady(a)}table(e){if(!z(this._allTables,e))throw new C.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Qr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class Jr{constructor(e){this._subscribe=e}subscribe(e,n,r){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:n,complete:r})}[Qr](){return this}}function nr(t,e){return $(e).forEach(n=>{gt(t[n]||(t[n]=new Q),e[n])}),t}function Zr(t){let e,n=!1;const r=new Jr(s=>{const i=Zt(t);let o=!1,u={},a={};const c={get closed(){return o},unsubscribe:()=>{o=!0,ue.storagemutated.unsubscribe(f)}};s.start&&s.start(c);let d=!1,l=!1;function h(){return $(a).some(p=>u[p]&&Gr(u[p],a[p]))}const f=p=>{nr(u,p),h()&&m()},m=()=>{if(d||o)return;u={};const p={},v=function(y){i&&Ce();const g=()=>oe(t,{subscr:y,trans:null}),b=E.trans?Te(E.transless,g):g();return i&&b.then(ne,ne),b}(p);l||(ue(Le,f),l=!0),d=!0,Promise.resolve(v).then(y=>{n=!0,e=y,d=!1,o||(h()?m():(u={},a=p,s.next&&s.next(y)))},y=>{d=!1,n=!1,s.error&&s.error(y),c.unsubscribe()})};return m(),c});return r.hasValue=()=>n,r.getValue=()=>e,r}let Qt;try{Qt={indexedDB:K.indexedDB||K.mozIndexedDB||K.webkitIndexedDB||K.msIndexedDB,IDBKeyRange:K.IDBKeyRange||K.webkitIDBKeyRange}}catch{Qt={indexedDB:null,IDBKeyRange:null}}const ce=pe;function at(t){let e=Z;try{Z=!0,ue.storagemutated.fire(t)}finally{Z=e}}Pe(ce,{...tt,delete:t=>new ce(t,{addons:[]}).delete(),exists:t=>new ce(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(t){try{return function({indexedDB:e,IDBKeyRange:n}){return un(e)?Promise.resolve(e.databases()).then(r=>r.map(s=>s.name).filter(s=>s!==vt)):an(e,n).toCollection().primaryKeys()}(ce.dependencies).then(t)}catch{return D(new C.MissingAPI)}},defineClass:()=>function(t){U(this,t)},ignoreTransaction:t=>E.trans?Te(E.transless,t):t(),vip:Yt,async:function(t){return function(){try{var e=Gt(t.apply(this,arguments));return e&&typeof e.then=="function"?e:S.resolve(e)}catch(n){return D(n)}}},spawn:function(t,e,n){try{var r=Gt(t.apply(n,e||[]));return r&&typeof r.then=="function"?r:S.resolve(r)}catch(s){return D(s)}},currentTransaction:{get:()=>E.trans||null},waitFor:function(t,e){const n=S.resolve(typeof t=="function"?ce.ignoreTransaction(t):t).timeout(e||6e4);return E.trans?E.trans.waitFor(n):n},Promise:S,debug:{get:()=>G,set:t=>{jn(t,t==="dexie"?()=>!0:Hn)}},derive:ke,extend:U,props:Pe,override:Cn,Events:$e,on:ue,liveQuery:Zr,extendObservabilitySet:nr,getByKeyPath:te,setByKeyPath:H,delByKeyPath:function(t,e){typeof e=="string"?H(t,e,void 0):"length"in e&&[].map.call(e,function(n){H(t,n,void 0)})},shallowClone:On,deepClone:We,getObjectDiff:ln,cmp:L,asap:Tn,minKey:Mt,addons:[],connections:Ne,errnames:tn,dependencies:Qt,semVer:gn,version:gn.split(".").map(t=>parseInt(t)).reduce((t,e,n)=>t+e/Math.pow(10,2*n))}),ce.maxKey=Ue(ce.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(ue(Le,t=>{if(!Z){let e;yt?(e=document.createEvent("CustomEvent"),e.initCustomEvent(ie,!0,!0,t)):e=new CustomEvent(ie,{detail:t}),Z=!0,dispatchEvent(e),Z=!1}}),addEventListener(ie,({detail:t})=>{Z||at(t)}));let Z=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(ie);typeof t.unref=="function"&&t.unref(),ue(Le,e=>{Z||t.postMessage(e)}),t.onmessage=e=>{e.data&&at(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){ue(Le,e=>{try{Z||(typeof localStorage<"u"&&localStorage.setItem(ie,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:ie,changedParts:e})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",e=>{if(e.key===ie){const n=JSON.parse(e.newValue);n&&at(n.changedParts)}});const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",function({data:e}){e&&e.type===ie&&at(e.changedParts)})}S.rejectionMapper=function(t,e){if(!t||t instanceof xe||t instanceof TypeError||t instanceof SyntaxError||!t.name||!dn[t.name])return t;var n=new dn[t.name](e||t.message,t);return"stack"in t&&ee(n,"stack",{get:function(){return this.inner.stack}}),n},jn(G,Hn);class es extends pe{constructor(){super("NylasAuthDatabase"),ut(this,"grant"),ut(this,"pkce"),this.version(1).stores({grant:"++id,token",pkce:"++id,codeVerifier"}),this.grant=this.table("grant"),this.pkce=this.table("pkce")}}class ts{constructor(){ut(this,"theDB"),this.theDB=new es}async setCodeVerifier(e){await this.theDB.pkce.put({id:1,codeVerifier:e},1)}async getCodeVerifier(){const[e]=await this.theDB.pkce.toArray();return e?e.codeVerifier:null}async getTokenInfo(){const e=await this.theDB.grant.get(1);return e?e.token:null}async setTokenInfo(e){await this.theDB.grant.put({id:1,token:e},1)}async reset(){await this.theDB.grant.clear()}}function ns(t){const e="NylasAuth";if(!t)throw new Error("NylasAuth requires a config object");let n=null;if(t.storageType==="indexeddb"&&(n=new ts),!n)throw new Error("NylasAuth requires a storage object");const r=[{type:"read-only",value:"https://www.googleapis.com/auth/gmail.readonly"},{type:"modify",value:"https://www.googleapis.com/auth/gmail.modify"},{type:"compose",value:"https://www.googleapis.com/auth/gmail.compose"},{type:"insert",value:"https://www.googleapis.com/auth/gmail.insert"},{type:"labels",value:"https://www.googleapis.com/auth/gmail.labels"},{type:"metadata",value:"https://www.googleapis.com/auth/gmail.metadata"},{type:"settings.basic",value:"https://www.googleapis.com/auth/gmail.settings.basic"},{type:"settings.sharing",value:"https://www.googleapis.com/auth/gmail.settings.sharing"}],s=[{type:"read-only",value:"https://outlook.office.com/mail.read"},{type:"modify",value:"https://outlook.office.com/mail.readwrite"},{type:"send",value:"https://outlook.office.com/mail.send"},{type:"offline",value:"offline_access"}];async function i(o,u,a,c=!0,d,l){const h=await(n==null?void 0:n.getTokenInfo()),f=new URL(o,d??t.apiUri),m=new Headers;m.append("Accept","application/json"),m.append("Content-Type","application/json"),m.append("User-Agent",e),h&&m.append("Authorization",`Bearer ${h.access_token}`);const p=await fetch(f.toString(),{method:u||"GET",headers:m,mode:"cors",referrer:location.origin,body:a?JSON.stringify(a):void 0,...l||{}});return c?await p.json():p.body}return{config:t,async getHostedAuthRedirectURL(o=t.defaultScopes,u,a){const c=await hn(Math.random().toString()),d=await hn(c);await(n==null?void 0:n.setCodeVerifier(c));const l=new URL(`${t.apiUri}/v3/connect/auth`);return l.searchParams.set("client_id",t.clientId),l.searchParams.set("response_type","code"),l.searchParams.set("scope",o.join(" ")),l.searchParams.set("redirect_uri",t.redirectURI),l.searchParams.set("access_type","offline"),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method","S256"),l.searchParams.set("options","rotate_refresh_token"),a&&l.searchParams.set("provider",a),u&&l.searchParams.set("login_hint",u),l.toString()},nylasAPIRequest:i,async exchangeAuthCodeForTokenInfo(o){if(!o)return null;const u=await(n==null?void 0:n.getCodeVerifier()),a=await this.nylasAPIRequest("/v3/connect/token","POST",{code:o,client_id:t.clientId,grant_type:"authorization_code",redirect_uri:t.redirectURI,code_verifier:u});return"error"in a||await(n==null?void 0:n.setTokenInfo(a)),a},async nylasDownloadFileRequest(o,u="GET",a){const c=await(n==null?void 0:n.getTokenInfo()),d=new URL(o,t.apiUri),l=new Headers;return l.append("Accept","application/json"),l.append("Content-Type","application/octet-stream"),l.append("User-Agent",e),c&&l.append("Authorization",`Bearer ${c.access_token}`),(await fetch(d.toString(),{method:u,headers:l,mode:"cors",referrer:location.origin,body:a?JSON.stringify(a):void 0})).blob()},async logout(){const o=await(n==null?void 0:n.getTokenInfo());o&&await this.nylasAPIRequest(`/v3/connect/revoke?token=${o.access_token}`,"POST"),await(n==null?void 0:n.reset())},async isAuthenticated(){return!!await(n==null?void 0:n.getTokenInfo())},async getTokenInfo(){const o=await(n==null?void 0:n.getTokenInfo());if(!o)return null;const{access_token:u,...a}=o;return a},async isAccessTokenValid(){const o=await(n==null?void 0:n.getTokenInfo());return o?"data"in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${o.id_token}`,"GET"):!1},async refreshAccessToken(){const o=await(n==null?void 0:n.getTokenInfo());if(!o)return null;const u=await this.nylasAPIRequest("/v3/connect/token","POST",{client_id:t.clientId,grant_type:"refresh_token",refresh_token:o.refresh_token});return"error"in u||await(n==null?void 0:n.setTokenInfo(u)),u},async hasScopeByType(o="email",u){const a=await(n==null?void 0:n.getTokenInfo());if(!a)return!1;const c=a.scope.toLowerCase().split(" ");let d=[];const l=Array.isArray(u)?u:[u];return o==="email"&&(d=[...s,...r].filter(h=>l.includes(h.type))),d.every(h=>c.includes(h.value))},async hasScope(o){const u=await(n==null?void 0:n.getTokenInfo());if(!u)return!1;const a=u.scope.toLowerCase().split(" ");return(Array.isArray(o)?o:[o]).some(c=>a.includes(c.toLowerCase()))}}}exports.NylasBaseProvider=sr;exports.Xr=ar;exports.Zr=ur;exports.es=ns;exports.global$1=Sn;exports.nr=Pn;
|
|
3
|
+
`).slice(e).filter(jn).map(r=>`
|
|
4
|
+
`+r).join("")):""}var Rn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],en=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Rn),yr={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function xe(t,e){this._e=Ee(),this.name=t,this.message=e}function Nn(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,s)=>s.indexOf(n)===r).join(`
|
|
5
|
+
`)}function ct(t,e,n,r){this._e=Ee(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message=Nn(t,e)}function je(t,e){this._e=Ee(),this.name="BulkError",this.failures=Object.keys(e).map(n=>e[n]),this.failuresByPos=e,this.message=Nn(t,e)}ke(xe).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Ot(this._e,2))}},toString:function(){return this.name+": "+this.message}}),ke(ct).from(xe),ke(je).from(xe);var tn=en.reduce((t,e)=>(t[e]=e+"Error",t),{});const vr=xe;var C=en.reduce((t,e)=>{var n=e+"Error";function r(s,i){this._e=Ee(),this.name=n,s?typeof s=="string"?(this.message=`${s}${i?`
|
|
6
|
+
`+i:""}`,this.inner=i||null):typeof s=="object"&&(this.message=`${s.name} ${s.message}`,this.inner=s):(this.message=yr[e]||n,this.inner=null)}return ke(r).from(vr),t[e]=r,t},{});C.Syntax=SyntaxError,C.Type=TypeError,C.Range=RangeError;var dn=Rn.reduce((t,e)=>(t[e+"Error"]=C[e],t),{}),tt=en.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=C[e]),t),{});function I(){}function Fe(t){return t}function br(t,e){return t==null||t===Fe?e:function(n){return e(t(n))}}function me(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function wr(t,e){return t===I?e:function(){var n=t.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?me(r,this.onsuccess):r),s&&(this.onerror=this.onerror?me(s,this.onerror):s),i!==void 0?i:n}}function _r(t,e){return t===I?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?me(n,this.onsuccess):n),r&&(this.onerror=this.onerror?me(r,this.onerror):r)}}function kr(t,e){return t===I?e:function(n){var r=t.apply(this,arguments);U(n,r);var s=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return s&&(this.onsuccess=this.onsuccess?me(s,this.onsuccess):s),i&&(this.onerror=this.onerror?me(i,this.onerror):i),r===void 0?o===void 0?void 0:o:U(r,o)}}function xr(t,e){return t===I?e:function(){return e.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function nn(t,e){return t===I?e:function(){var n=t.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then(function(){return e.apply(r,i)})}return e.apply(this,arguments)}}tt.ModifyError=ct,tt.DexieError=xe,tt.BulkError=je;var qe={};const $n=100,[It,ht,Kt]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,Be(t),t];const e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Be(e),t]})(),Dn=ht&&ht.then,nt=It&&It.constructor,rn=!!Kt;var jt=!1,Sr=Kt?()=>{Kt.then(Ye)}:K.setImmediate?setImmediate.bind(null,Ye):K.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{Ye(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Ye,0)},Re=function(t,e){Ke.push([t,e]),dt&&(Sr(),dt=!1)},Rt=!0,dt=!0,de=[],rt=[],Nt=null,$t=Fe,Se={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:mn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{mn(t[0],t[1])}catch{}})}},E=Se,Ke=[],fe=0,st=[];function S(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=I,this._lib=!1;var e=this._PSD=E;if(G&&(this._stackHolder=Ee(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==qe)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Bt(this,this._value))}this._state=null,this._value=null,++e.ref,Fn(this,t)}const Dt={get:function(){var t=E,e=ft;function n(r,s){var i=!t.global&&(t!==E||e!==ft);const o=i&&!ne();var u=new S((a,c)=>{sn(this,new Bn(pt(r,t,i,o),pt(s,t,i,o),a,c,t))});return G&&Ln(u,this),u}return n.prototype=qe,n},set:function(t){ee(this,"then",t&&t.prototype===qe?Dt:{get:function(){return t},set:Dt.set})}};function Bn(t,e,n,r,s){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=n,this.reject=r,this.psd=s}function Fn(t,e){try{e(n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&ze();n&&typeof n.then=="function"?Fn(t,(s,i)=>{n instanceof S?n._then(s,i):n.then(s,i)}):(t._state=!0,t._value=n,qn(t)),r&&He()}},Bt.bind(null,t))}catch(n){Bt(t,n)}}function Bt(t,e){if(rt.push(e),t._state===null){var n=t._lib&&ze();e=$t(e),t._state=!1,t._value=e,G&&e!==null&&typeof e=="object"&&!e._promise&&function(r,s,i){try{r.apply(null,i)}catch(o){s&&s(o)}}(()=>{var r=Jt(e,"stack");e._promise=t,ee(e,"stack",{get:()=>jt?r&&(r.get?r.get.apply(e):r.value):t.stack})}),function(r){de.some(s=>s._value===r._value)||de.push(r)}(t),qn(t),n&&He()}}function qn(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n<r;++n)sn(t,e[n]);var s=t._PSD;--s.ref||s.finalize(),fe===0&&(++fe,Re(()=>{--fe==0&&on()},[]))}function sn(t,e){if(t._state!==null){var n=t._state?e.onFulfilled:e.onRejected;if(n===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++fe,Re(Pr,[n,t,e])}else t._listeners.push(e)}function Pr(t,e,n){try{Nt=e;var r,s=e._value;e._state?r=t(s):(rt.length&&(rt=[]),r=t(s),rt.indexOf(s)===-1&&function(i){for(var o=de.length;o;)if(de[--o]._value===i._value)return void de.splice(o,1)}(e)),n.resolve(r)}catch(i){n.reject(i)}finally{Nt=null,--fe==0&&on(),--n.psd.ref||n.psd.finalize()}}function Mn(t,e,n){if(e.length===n)return e;var r="";if(t._state===!1){var s,i,o=t._value;o!=null?(s=o.name||"Error",i=o.message||o,r=Ot(o,0)):(s=o,i=""),e.push(s+(i?": "+i:"")+r)}return G&&((r=Ot(t._stackHolder,2))&&e.indexOf(r)===-1&&e.push(r),t._prev&&Mn(t._prev,e,n)),e}function Ln(t,e){var n=e?e._numPrev+1:0;n<100&&(t._prev=e,t._numPrev=n)}function Ye(){ze()&&He()}function ze(){var t=Rt;return Rt=!1,dt=!1,t}function He(){var t,e,n;do for(;Ke.length>0;)for(t=Ke,Ke=[],n=t.length,e=0;e<n;++e){var r=t[e];r[0].apply(null,r[1])}while(Ke.length>0);Rt=!0,dt=!0}function on(){var t=de;de=[],t.forEach(r=>{r._PSD.onunhandled.call(null,r._value,r)});for(var e=st.slice(0),n=e.length;n;)e[--n]()}function Ge(t){return new S(qe,!1,t)}function j(t,e){var n=E;return function(){var r=ze(),s=E;try{return ae(n,!0),t.apply(this,arguments)}catch(i){e&&e(i)}finally{ae(s,!1),r&&He()}}}Pe(S.prototype,{then:Dt,_then:function(t,e){sn(this,new Bn(null,null,t,e,E))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],n=arguments[1];return typeof e=="function"?this.then(null,r=>r instanceof e?n(r):Ge(r)):this.then(null,r=>r&&r.name===e?n(r):Ge(r))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),Ge(e)))},stack:{get:function(){if(this._stack)return this._stack;try{jt=!0;var t=Mn(this,[],20).join(`
|
|
7
|
+
From previous: `);return this._state!==null&&(this._stack=t),t}finally{jt=!1}}},timeout:function(t,e){return t<1/0?new S((n,r)=>{var s=setTimeout(()=>r(new C.Timeout(e)),t);this.then(n,r).finally(clearTimeout.bind(null,s))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&ee(S.prototype,Symbol.toStringTag,"Dexie.Promise"),Se.env=Un(),Pe(S,{all:function(){var t=J.apply(null,arguments).map(Xe);return new S(function(e,n){t.length===0&&e([]);var r=t.length;t.forEach((s,i)=>S.resolve(s).then(o=>{t[i]=o,--r||e(t)},n))})},resolve:t=>{if(t instanceof S)return t;if(t&&typeof t.then=="function")return new S((n,r)=>{t.then(n,r)});var e=new S(qe,!0,t);return Ln(e,Nt),e},reject:Ge,race:function(){var t=J.apply(null,arguments).map(Xe);return new S((e,n)=>{t.map(r=>S.resolve(r).then(e,n))})},PSD:{get:()=>E,set:t=>E=t},totalEchoes:{get:()=>ft},newPSD:oe,usePSD:Te,scheduler:{get:()=>Re,set:t=>{Re=t}},rejectionMapper:{get:()=>$t,set:t=>{$t=t}},follow:(t,e)=>new S((n,r)=>oe((s,i)=>{var o=E;o.unhandleds=[],o.onunhandled=i,o.finalize=me(function(){(function(u){function a(){u(),st.splice(st.indexOf(a),1)}st.push(a),++fe,Re(()=>{--fe==0&&on()},[])})(()=>{this.unhandleds.length===0?s():i(this.unhandleds[0])})},o.finalize),t()},e,n,r))}),nt&&(nt.allSettled&&ee(S,"allSettled",function(){const t=J.apply(null,arguments).map(Xe);return new S(e=>{t.length===0&&e([]);let n=t.length;const r=new Array(n);t.forEach((s,i)=>S.resolve(s).then(o=>r[i]={status:"fulfilled",value:o},o=>r[i]={status:"rejected",reason:o}).then(()=>--n||e(r)))})}),nt.any&&typeof AggregateError<"u"&&ee(S,"any",function(){const t=J.apply(null,arguments).map(Xe);return new S((e,n)=>{t.length===0&&n(new AggregateError([]));let r=t.length;const s=new Array(r);t.forEach((i,o)=>S.resolve(i).then(u=>e(u),u=>{s[o]=u,--r||n(new AggregateError(s))}))})}));const F={awaits:0,echoes:0,id:0};var Er=0,it=[],wt=0,ft=0,Cr=0;function oe(t,e,n,r){var s=E,i=Object.create(s);i.parent=s,i.ref=0,i.global=!1,i.id=++Cr;var o=Se.env;i.env=rn?{Promise:S,PromiseProp:{value:S,configurable:!0,writable:!0},all:S.all,race:S.race,allSettled:S.allSettled,any:S.any,resolve:S.resolve,reject:S.reject,nthen:fn(o.nthen,i),gthen:fn(o.gthen,i)}:{},e&&U(i,e),++s.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=Te(i,t,n,r);return i.ref===0&&i.finalize(),u}function Ce(){return F.id||(F.id=++Er),++F.awaits,F.echoes+=$n,F.id}function ne(){return!!F.awaits&&(--F.awaits==0&&(F.id=0),F.echoes=F.awaits*$n,!0)}function Xe(t){return F.echoes&&t&&t.constructor===nt?(Ce(),t.then(e=>(ne(),e),e=>(ne(),D(e)))):t}function Tr(t){++ft,F.echoes&&--F.echoes!=0||(F.echoes=F.id=0),it.push(E),ae(t,!0)}function Ar(){var t=it[it.length-1];it.pop(),ae(t,!1)}function ae(t,e){var n=E;if((e?!F.echoes||wt++&&t===E:!wt||--wt&&t===E)||Vn(e?Tr.bind(null,t):Ar),t!==E&&(E=t,n===Se&&(Se.env=Un()),rn)){var r=Se.env.Promise,s=t.env;ht.then=s.nthen,r.prototype.then=s.gthen,(n.global||t.global)&&(Object.defineProperty(K,"Promise",s.PromiseProp),r.all=s.all,r.race=s.race,r.resolve=s.resolve,r.reject=s.reject,s.allSettled&&(r.allSettled=s.allSettled),s.any&&(r.any=s.any))}}function Un(){var t=K.Promise;return rn?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(K,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:ht.then,gthen:t.prototype.then}:{}}function Te(t,e,n,r,s){var i=E;try{return ae(t,!0),e(n,r,s)}finally{ae(i,!1)}}function Vn(t){Dn.call(It,t)}function pt(t,e,n,r){return typeof t!="function"?t:function(){var s=E;n&&Ce(),ae(e,!0);try{return t.apply(this,arguments)}finally{ae(s,!1),r&&Vn(ne)}}}function fn(t,e){return function(n,r){return t.call(this,pt(n,e),pt(r,e))}}(""+Dn).indexOf("[native code]")===-1&&(Ce=ne=I);const pn="unhandledrejection";function mn(t,e){var n;try{n=e.onuncatched(t)}catch{}if(n!==!1)try{var r,s={promise:e,reason:t};if(K.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(pn,!0,!0),U(r,s)):K.CustomEvent&&U(r=new CustomEvent(pn,{detail:s}),s),r&&K.dispatchEvent&&(dispatchEvent(r),!K.PromiseRejectionEvent&&K.onunhandledrejection))try{K.onunhandledrejection(r)}catch{}G&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var D=S.reject;function Ft(t,e,n,r){if(t.idbdb&&(t._state.openComplete||E.letThrough||t._vip)){var s=t._createTransaction(e,n,t._dbSchema);try{s.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===tn.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ft(t,e,n,r))):D(i)}return s._promise(e,(i,o)=>oe(()=>(E.trans=s,r(i,o,s)))).then(i=>s._completion.then(()=>i))}if(t._state.openComplete)return D(new C.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return D(new C.DatabaseClosed);t.open().catch(I)}return t._state.dbReadyPromise.then(()=>Ft(t,e,n,r))}const gn="3.2.4",he=String.fromCharCode(65535),qt=-1/0,X="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Wn="String expected.",Ne=[],yt=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Or=yt,Ir=yt,zn=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),vt="__dbnames",_t="readonly",kt="readwrite";function ge(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}const Hn={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Qe(t){return typeof t!="string"||/\./.test(t)?e=>e:e=>(e[t]===void 0&&t in e&&delete(e=We(e))[t],e)}class Kr{_trans(e,n,r){const s=this._tx||E.trans,i=this.name;function o(a,c,d){if(!d.schema[i])throw new C.NotFound("Table "+i+" not part of transaction");return n(d.idbtrans,d)}const u=ze();try{return s&&s.db===this.db?s===E.trans?s._promise(e,o,r):oe(()=>s._promise(e,o,r),{trans:s,transless:E.transless||E}):Ft(this.db,e,[this.name],o)}finally{u&&He()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:e}).then(s=>this.hook.reading.fire(s))).then(n)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(q(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const n=$(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter(c=>c.compound&&n.every(d=>c.keyPath.indexOf(d)>=0)&&c.keyPath.every(d=>n.indexOf(d)>=0))[0];if(r&&this.db._maxKey!==he)return this.where(r.name).equals(r.keyPath.map(c=>e[c]));!r&&G&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:s}=this.schema,i=this.db._deps.indexedDB;function o(c,d){try{return i.cmp(c,d)===0}catch{return!1}}const[u,a]=n.reduce(([c,d],l)=>{const h=s[l],f=e[l];return[c||h,c||!h?ge(d,h&&h.multi?m=>{const p=te(m,l);return q(p)&&p.some(v=>o(f,v))}:m=>o(f,te(m,l))):d]},[null,null]);return u?this.where(u.name).equals(e[u.keyPath]).filter(a):r?this.filter(a):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,q(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const n=r=>{if(!r)return r;const s=Object.create(e.prototype);for(var i in r)if(z(r,i))try{s[i]=r[i]}catch{}return s};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){return this.mapToClass(function(e){U(this,e)})}add(e,n){const{auto:r,keyPath:s}=this.schema.primKey;let i=e;return s&&r&&(i=Qe(s)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"add",keys:n!=null?[n]:null,values:[i]})).then(o=>o.numFailures?S.reject(o.failures[0]):o.lastResult).then(o=>{if(s)try{H(e,s,o)}catch{}return o})}update(e,n){if(typeof e!="object"||q(e))return this.where(":id").equals(e).modify(n);{const r=te(e,this.schema.primKey.keyPath);if(r===void 0)return D(new C.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?$(n).forEach(s=>{H(e,s,n[s])}):n(e,{value:e,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}}put(e,n){const{auto:r,keyPath:s}=this.schema.primKey;let i=e;return s&&r&&(i=Qe(s)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"put",values:[i],keys:n!=null?[n]:null})).then(o=>o.numFailures?S.reject(o.failures[0]):o.lastResult).then(o=>{if(s)try{H(e,s,o)}catch{}return o})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(n=>n.numFailures?S.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Hn})).then(e=>e.numFailures?S.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(r=>r.map(s=>this.hook.reading.fire(s))))}bulkAdd(e,n,r){const s=Array.isArray(n)?n:void 0,i=(r=r||(s?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:u,keyPath:a}=this.schema.primKey;if(a&&s)throw new C.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new C.InvalidArgument("Arguments objects and keys must have the same length");const c=e.length;let d=a&&u?e.map(Qe(a)):e;return this.core.mutate({trans:o,type:"add",keys:s,values:d,wantResults:i}).then(({numFailures:l,results:h,lastResult:f,failures:m})=>{if(l===0)return i?h:f;throw new je(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`,m)})})}bulkPut(e,n,r){const s=Array.isArray(n)?n:void 0,i=(r=r||(s?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",o=>{const{auto:u,keyPath:a}=this.schema.primKey;if(a&&s)throw new C.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new C.InvalidArgument("Arguments objects and keys must have the same length");const c=e.length;let d=a&&u?e.map(Qe(a)):e;return this.core.mutate({trans:o,type:"put",keys:s,values:d,wantResults:i}).then(({numFailures:l,results:h,lastResult:f,failures:m})=>{if(l===0)return i?h:f;throw new je(`${this.name}.bulkPut(): ${l} of ${c} operations failed`,m)})})}bulkDelete(e){const n=e.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:e})).then(({numFailures:r,lastResult:s,failures:i})=>{if(r===0)return s;throw new je(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,i)})}}function $e(t){var e={},n=function(o,u){if(u){for(var a=arguments.length,c=new Array(a-1);--a;)c[a-1]=arguments[a];return e[o].subscribe.apply(null,c),t}if(typeof o=="string")return e[o]};n.addEventType=i;for(var r=1,s=arguments.length;r<s;++r)i(arguments[r]);return n;function i(o,u,a){if(typeof o!="object"){var c;u||(u=xr),a||(a=I);var d={subscribers:[],fire:a,subscribe:function(l){d.subscribers.indexOf(l)===-1&&(d.subscribers.push(l),d.fire=u(d.fire,l))},unsubscribe:function(l){d.subscribers=d.subscribers.filter(function(h){return h!==l}),d.fire=d.subscribers.reduce(u,a)}};return e[o]=n[o]=d,d}$(c=o).forEach(function(l){var h=c[l];if(q(h))i(l,c[l][0],c[l][1]);else{if(h!=="asap")throw new C.InvalidArgument("Invalid event config");var f=i(l,Fe,function(){for(var m=arguments.length,p=new Array(m);m--;)p[m]=arguments[m];f.subscribers.forEach(function(v){Cn(function(){v.apply(null,p)})})})}})}}function Oe(t,e){return ke(e).from({prototype:t}),e}function be(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function xt(t,e){t.filter=ge(t.filter,e)}function St(t,e,n){var r=t.replayFilter;t.replayFilter=r?()=>ge(r(),e()):e,t.justLimit=n&&!r}function ot(t,e){if(t.isPrimKey)return e.primaryKey;const n=e.getIndexByKeyPath(t.index);if(!n)throw new C.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function yn(t,e,n){const r=ot(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function Je(t,e,n,r){const s=t.replayFilter?ge(t.filter,t.replayFilter()):t.filter;if(t.or){const i={},o=(u,a,c)=>{if(!s||s(a,c,h=>a.stop(h),h=>a.fail(h))){var d=a.primaryKey,l=""+d;l==="[object ArrayBuffer]"&&(l=""+new Uint8Array(d)),z(i,l)||(i[l]=!0,e(u,a,c))}};return Promise.all([t.or._iterate(o,n),vn(yn(t,r,n),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return vn(yn(t,r,n),ge(t.algorithm,s),e,!t.keysOnly&&t.valueMapper)}function vn(t,e,n,r){var s=j(r?(i,o,u)=>n(r(i),o,u):n);return t.then(i=>{if(i)return i.start(()=>{var o=()=>i.continue();e&&!e(i,u=>o=u,u=>{i.stop(u),o=I},u=>{i.fail(u),o=I})||s(i.value,i,u=>o=u),o()})})}function L(t,e){try{const n=bn(t),r=bn(e);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:t<e?-1:0;case"binary":return function(s,i){const o=s.length,u=i.length,a=o<u?o:u;for(let c=0;c<a;++c)if(s[c]!==i[c])return s[c]<i[c]?-1:1;return o===u?0:o<u?-1:1}(wn(t),wn(e));case"Array":return function(s,i){const o=s.length,u=i.length,a=o<u?o:u;for(let c=0;c<a;++c){const d=L(s[c],i[c]);if(d!==0)return d}return o===u?0:o<u?-1:1}(t,e)}}catch{}return NaN}function bn(t){const e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";const n=Tt(t);return n==="ArrayBuffer"?"binary":n}function wn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class jr{_read(e,n){var r=this._ctx;return r.error?r.table._trans(null,D.bind(null,r.error)):r.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,D.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=ge(n.algorithm,e)}_iterate(e,n){return Je(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return e&&U(r,e),n._ctx=r,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(r=>Je(n,e,r,n.table.core))}count(e){return this._read(n=>{const r=this._ctx,s=r.table.core;if(be(r,!0))return s.count({trans:n,query:{index:ot(r,s.schema),range:r.range}}).then(o=>Math.min(o,r.limit));var i=0;return Je(r,()=>(++i,!1),n,s).then(()=>i)}).then(e)}sortBy(e,n){const r=e.split(".").reverse(),s=r[0],i=r.length-1;function o(c,d){return d?o(c[r[d]],d-1):c[s]}var u=this._ctx.dir==="next"?1:-1;function a(c,d){var l=o(c,i),h=o(d,i);return l<h?-u:l>h?u:0}return this.toArray(function(c){return c.sort(a)}).then(n)}toArray(e){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&be(r,!0)&&r.limit>0){const{valueMapper:s}=r,i=ot(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:i,range:r.range}}).then(({result:o})=>s?o.map(s):o)}{const s=[];return Je(r,i=>s.push(i),n,r.table.core).then(()=>s)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,be(n)?St(n,()=>{var r=e;return(s,i)=>r===0||(r===1?(--r,!1):(i(()=>{s.advance(r),r=0}),!1))}):St(n,()=>{var r=e;return()=>--r<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),St(this._ctx,()=>{var n=e;return function(r,s,i){return--n<=0&&s(i),n>=0}},!0),this}until(e,n){return xt(this._ctx,function(r,s,i){return!e(r.value)||(s(i),n)}),this}first(e){return this.limit(1).toArray(function(n){return n[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){var n,r;return xt(this._ctx,function(s){return e(s.value)}),n=this._ctx,r=e,n.isMatch=ge(n.isMatch,r),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.key,s)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.primaryKey,s)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.key)}).then(function(){return r}).then(e)}primaryKeys(e){var n=this._ctx;if(n.dir==="next"&&be(n,!0)&&n.limit>0)return this._read(s=>{var i=ot(n,n.table.core.schema);return n.table.core.query({trans:s,values:!1,limit:n.limit,query:{index:i,range:n.range}})}).then(({result:s})=>s).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.primaryKey)}).then(function(){return r}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(n){return n[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var r={};return xt(this._ctx,function(s){var i=s.primaryKey.toString(),o=z(r,i);return r[i]=!0,!o}),this}modify(e){var n=this._ctx;return this._write(r=>{var s;if(typeof e=="function")s=e;else{var i=$(e),o=i.length;s=function(p){for(var v=!1,y=0;y<o;++y){var g=i[y],b=e[g];te(p,g)!==b&&(H(p,g,b),v=!0)}return v}}const u=n.table.core,{outbound:a,extractKey:c}=u.schema.primaryKey,d=this.db._options.modifyChunkSize||200,l=[];let h=0;const f=[],m=(p,v)=>{const{failures:y,numFailures:g}=v;h+=p-g;for(let b of $(y))l.push(y[b])};return this.clone().primaryKeys().then(p=>{const v=y=>{const g=Math.min(d,p.length-y);return u.getMany({trans:r,keys:p.slice(y,y+g),cache:"immutable"}).then(b=>{const k=[],P=[],x=a?[]:null,w=[];for(let _=0;_<g;++_){const R=b[_],O={value:We(R),primKey:p[y+_]};s.call(O,O.value,O)!==!1&&(O.value==null?w.push(p[y+_]):a||L(c(R),c(O.value))===0?(P.push(O.value),a&&x.push(p[y+_])):(w.push(p[y+_]),k.push(O.value)))}const A=be(n)&&n.limit===1/0&&(typeof e!="function"||e===Pt)&&{index:n.index,range:n.range};return Promise.resolve(k.length>0&&u.mutate({trans:r,type:"add",values:k}).then(_=>{for(let R in _.failures)w.splice(parseInt(R),1);m(k.length,_)})).then(()=>(P.length>0||A&&typeof e=="object")&&u.mutate({trans:r,type:"put",keys:x,values:P,criteria:A,changeSpec:typeof e!="function"&&e}).then(_=>m(P.length,_))).then(()=>(w.length>0||A&&e===Pt)&&u.mutate({trans:r,type:"delete",keys:w,criteria:A}).then(_=>m(w.length,_))).then(()=>p.length>y+g&&v(y+d))})};return v(0).then(()=>{if(l.length>0)throw new ct("Error modifying one or more objects",l,h,f);return p.length})})})}delete(){var e=this._ctx,n=e.range;return be(e)&&(e.isPrimKey&&!Ir||n.type===3)?this._write(r=>{const{primaryKey:s}=e.table.core.schema,i=n;return e.table.core.count({trans:r,query:{index:s,range:i}}).then(o=>e.table.core.mutate({trans:r,type:"deleteRange",range:i}).then(({failures:u,lastResult:a,results:c,numFailures:d})=>{if(d)throw new ct("Could not delete some values",Object.keys(u).map(l=>u[l]),o-d);return o-d}))}):this.modify(Pt)}}const Pt=(t,e)=>e.value=null;function Rr(t,e){return t<e?-1:t===e?0:1}function Nr(t,e){return t>e?-1:t===e?0:1}function W(t,e,n){var r=t instanceof Gn?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function we(t){return new t.Collection(t,()=>Yn("")).limit(0)}function $r(t,e,n,r,s,i){for(var o=Math.min(t.length,r.length),u=-1,a=0;a<o;++a){var c=e[a];if(c!==r[a])return s(t[a],n[a])<0?t.substr(0,a)+n[a]+n.substr(a+1):s(t[a],r[a])<0?t.substr(0,a)+r[a]+n.substr(a+1):u>=0?t.substr(0,u)+e[u]+n.substr(u+1):null;s(t[a],c)<0&&(u=a)}return o<r.length&&i==="next"?t+n.substr(t.length):o<t.length&&i==="prev"?t.substr(0,n.length):u<0?null:t.substr(0,u)+r[u]+n.substr(u+1)}function Ze(t,e,n,r){var s,i,o,u,a,c,d,l=n.length;if(!n.every(p=>typeof p=="string"))return W(t,Wn);function h(p){s=function(y){return y==="next"?g=>g.toUpperCase():g=>g.toLowerCase()}(p),i=function(y){return y==="next"?g=>g.toLowerCase():g=>g.toUpperCase()}(p),o=p==="next"?Rr:Nr;var v=n.map(function(y){return{lower:i(y),upper:s(y)}}).sort(function(y,g){return o(y.lower,g.lower)});u=v.map(function(y){return y.upper}),a=v.map(function(y){return y.lower}),c=p,d=p==="next"?"":r}h("next");var f=new t.Collection(t,()=>re(u[0],a[l-1]+r));f._ondirectionchange=function(p){h(p)};var m=0;return f._addAlgorithm(function(p,v,y){var g=p.key;if(typeof g!="string")return!1;var b=i(g);if(e(b,a,m))return!0;for(var k=null,P=m;P<l;++P){var x=$r(g,b,u[P],a[P],o,c);x===null&&k===null?m=P+1:(k===null||o(k,x)>0)&&(k=x)}return v(k!==null?function(){p.continue(k+d)}:y),!1}),f}function re(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function Yn(t){return{type:1,lower:t,upper:t}}class Gn{get Collection(){return this._ctx.table.db.Collection}between(e,n,r,s){r=r!==!1,s=s===!0;try{return this._cmp(e,n)>0||this._cmp(e,n)===0&&(r||s)&&(!r||!s)?we(this):new this.Collection(this,()=>re(e,n,!r,!s))}catch{return W(this,X)}}equals(e){return e==null?W(this,X):new this.Collection(this,()=>Yn(e))}above(e){return e==null?W(this,X):new this.Collection(this,()=>re(e,void 0,!0))}aboveOrEqual(e){return e==null?W(this,X):new this.Collection(this,()=>re(e,void 0,!1))}below(e){return e==null?W(this,X):new this.Collection(this,()=>re(void 0,e,!1,!0))}belowOrEqual(e){return e==null?W(this,X):new this.Collection(this,()=>re(void 0,e))}startsWith(e){return typeof e!="string"?W(this,Wn):this.between(e,e+he,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):Ze(this,(n,r)=>n.indexOf(r[0])===0,[e],he)}equalsIgnoreCase(e){return Ze(this,(n,r)=>n===r[0],[e],"")}anyOfIgnoreCase(){var e=J.apply(_e,arguments);return e.length===0?we(this):Ze(this,(n,r)=>r.indexOf(n)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=J.apply(_e,arguments);return e.length===0?we(this):Ze(this,(n,r)=>r.some(s=>n.indexOf(s)===0),e,he)}anyOf(){const e=J.apply(_e,arguments);let n=this._cmp;try{e.sort(n)}catch{return W(this,X)}if(e.length===0)return we(this);const r=new this.Collection(this,()=>re(e[0],e[e.length-1]));r._ondirectionchange=i=>{n=i==="next"?this._ascending:this._descending,e.sort(n)};let s=0;return r._addAlgorithm((i,o,u)=>{const a=i.key;for(;n(a,e[s])>0;)if(++s,s===e.length)return o(u),!1;return n(a,e[s])===0||(o(()=>{i.continue(e[s])}),!1)}),r}notEqual(e){return this.inAnyRange([[qt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=J.apply(_e,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return W(this,X)}const n=e.reduce((r,s)=>r?r.concat([[r[r.length-1][1],s]]):[[qt,s]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){const r=this._cmp,s=this._ascending,i=this._descending,o=this._min,u=this._max;if(e.length===0)return we(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&s(g[0],g[1])<=0))return W(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",C.InvalidArgument);const a=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;let d,l=s;function h(g,b){return l(g[0],b[0])}try{d=e.reduce(function(g,b){let k=0,P=g.length;for(;k<P;++k){const x=g[k];if(r(b[0],x[1])<0&&r(b[1],x[0])>0){x[0]=o(x[0],b[0]),x[1]=u(x[1],b[1]);break}}return k===P&&g.push(b),g},[]),d.sort(h)}catch{return W(this,X)}let f=0;const m=c?g=>s(g,d[f][1])>0:g=>s(g,d[f][1])>=0,p=a?g=>i(g,d[f][0])>0:g=>i(g,d[f][0])>=0;let v=m;const y=new this.Collection(this,()=>re(d[0][0],d[d.length-1][1],!a,!c));return y._ondirectionchange=g=>{g==="next"?(v=m,l=s):(v=p,l=i),d.sort(h)},y._addAlgorithm((g,b,k)=>{for(var P=g.key;v(P);)if(++f,f===d.length)return b(k),!1;return!!function(x){return!m(x)&&!p(x)}(P)||(this._cmp(P,d[f][1])===0||this._cmp(P,d[f][0])===0||b(()=>{l===s?g.continue(d[f][0]):g.continue(d[f][1])}),!1)}),y}startsWithAnyOf(){const e=J.apply(_e,arguments);return e.every(n=>typeof n=="string")?e.length===0?we(this):this.inAnyRange(e.map(n=>[n,n+he])):W(this,"startsWithAnyOf() only works with strings")}}function Y(t){return j(function(e){return Me(e),t(e.target.error),!1})}function Me(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const Le="storagemutated",ie="x-storagemutated-1",ue=$e(null,Le);class Dr{_lock(){return Ie(!E.global),++this._reculock,this._reculock!==1||E.global||(E.lockOwnerFor=this),this}_unlock(){if(Ie(!E.global),--this._reculock==0)for(E.global||(E.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Te(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&E.lockOwnerFor!==this}create(e){if(!this.mode)return this;const n=this.db.idbdb,r=this.db._state.dbOpenError;if(Ie(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new C.DatabaseClosed(r);case"MissingAPIError":throw new C.MissingAPI(r.message,r);default:throw new C.OpenFailed(r)}if(!this.active)throw new C.TransactionInactive;return Ie(this._completion._state===null),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=j(s=>{Me(s),this._reject(e.error)}),e.onabort=j(s=>{Me(s),this.active&&this._reject(new C.Abort(e.error)),this.active=!1,this.on("abort").fire(s)}),e.oncomplete=j(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&ue.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,r){if(e==="readwrite"&&this.mode!=="readwrite")return D(new C.ReadOnly("Transaction is readonly"));if(!this.active)return D(new C.TransactionInactive);if(this._locked())return new S((i,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,r).then(i,o)},E])});if(r)return oe(()=>{var i=new S((o,u)=>{this._lock();const a=n(o,u,this);a&&a.then&&a.then(o,u)});return i.finally(()=>this._unlock()),i._lib=!0,i});var s=new S((i,o)=>{var u=n(i,o,this);u&&u.then&&u.then(i,o)});return s._lib=!0,s}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();const r=S.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var s=n.idbtrans.objectStore(n.storeNames[0]);(function o(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(s.get(-1/0).onsuccess=o)})()}var i=n._waitingFor;return new S((o,u)=>{r.then(a=>n._waitingQueue.push(j(o.bind(null,a))),a=>n._waitingQueue.push(j(u.bind(null,a)))).finally(()=>{n._waitingFor===i&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new C.Abort))}table(e){const n=this._memoizedTables||(this._memoizedTables={});if(z(n,e))return n[e];const r=this.schema[e];if(!r)throw new C.NotFound("Table "+e+" not part of transaction");const s=new this.db.Table(e,r,this);return s.core=this.db.core.table(e),n[e]=s,s}}function Mt(t,e,n,r,s,i,o){return{name:t,keyPath:e,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+Xn(e)}}function Xn(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Qn(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:Tn(n,r=>[r.name,r])}}let Ue=t=>{try{return t.only([[]]),Ue=()=>[[]],[[]]}catch{return Ue=()=>he,he}};function Lt(t){return t==null?()=>{}:typeof t=="string"?function(e){return e.split(".").length===1?n=>n[e]:n=>te(n,e)}(t):e=>te(e,t)}function _n(t){return[].slice.call(t)}let Br=0;function De(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Fr(t,e,n){function r(a){if(a.type===3)return null;if(a.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:c,upper:d,lowerOpen:l,upperOpen:h}=a;return c===void 0?d===void 0?null:e.upperBound(d,!!h):d===void 0?e.lowerBound(c,!!l):e.bound(c,d,!!l,!!h)}const{schema:s,hasGetAll:i}=function(a,c){const d=_n(a.objectStoreNames);return{schema:{name:a.name,tables:d.map(l=>c.objectStore(l)).map(l=>{const{keyPath:h,autoIncrement:f}=l,m=q(h),p=h==null,v={},y={name:l.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:p,compound:m,keyPath:h,autoIncrement:f,unique:!0,extractKey:Lt(h)},indexes:_n(l.indexNames).map(g=>l.index(g)).map(g=>{const{name:b,unique:k,multiEntry:P,keyPath:x}=g,w={name:b,compound:q(x),keyPath:x,unique:k,multiEntry:P,extractKey:Lt(x)};return v[De(x)]=w,w}),getIndexByKeyPath:g=>v[De(g)]};return v[":id"]=y.primaryKey,h!=null&&(v[De(h)]=y.primaryKey),y})},hasGetAll:d.length>0&&"getAll"in c.objectStore(d[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,n),o=s.tables.map(a=>function(c){const d=c.name;return{name:d,schema:c,mutate:function({trans:l,type:h,keys:f,values:m,range:p}){return new Promise((v,y)=>{v=j(v);const g=l.objectStore(d),b=g.keyPath==null,k=h==="put"||h==="add";if(!k&&h!=="delete"&&h!=="deleteRange")throw new Error("Invalid operation type: "+h);const{length:P}=f||m||{length:1};if(f&&m&&f.length!==m.length)throw new Error("Given keys array must have same length as given values array.");if(P===0)return v({numFailures:0,failures:{},results:[],lastResult:void 0});let x;const w=[],A=[];let _=0;const R=M=>{++_,Me(M)};if(h==="deleteRange"){if(p.type===4)return v({numFailures:_,failures:A,results:[],lastResult:void 0});p.type===3?w.push(x=g.clear()):w.push(x=g.delete(r(p)))}else{const[M,B]=k?b?[m,f]:[m,null]:[f,null];if(k)for(let N=0;N<P;++N)w.push(x=B&&B[N]!==void 0?g[h](M[N],B[N]):g[h](M[N])),x.onerror=R;else for(let N=0;N<P;++N)w.push(x=g[h](M[N])),x.onerror=R}const O=M=>{const B=M.target.result;w.forEach((N,ye)=>N.error!=null&&(A[ye]=N.error)),v({numFailures:_,failures:A,results:h==="delete"?f:w.map(N=>N.result),lastResult:B})};x.onerror=M=>{R(M),O(M)},x.onsuccess=O})},getMany:({trans:l,keys:h})=>new Promise((f,m)=>{f=j(f);const p=l.objectStore(d),v=h.length,y=new Array(v);let g,b=0,k=0;const P=w=>{const A=w.target;y[A._pos]=A.result,++k===b&&f(y)},x=Y(m);for(let w=0;w<v;++w)h[w]!=null&&(g=p.get(h[w]),g._pos=w,g.onsuccess=P,g.onerror=x,++b);b===0&&f(y)}),get:({trans:l,key:h})=>new Promise((f,m)=>{f=j(f);const p=l.objectStore(d).get(h);p.onsuccess=v=>f(v.target.result),p.onerror=Y(m)}),query:function(l){return h=>new Promise((f,m)=>{f=j(f);const{trans:p,values:v,limit:y,query:g}=h,b=y===1/0?void 0:y,{index:k,range:P}=g,x=p.objectStore(d),w=k.isPrimaryKey?x:x.index(k.name),A=r(P);if(y===0)return f({result:[]});if(l){const _=v?w.getAll(A,b):w.getAllKeys(A,b);_.onsuccess=R=>f({result:R.target.result}),_.onerror=Y(m)}else{let _=0;const R=v||!("openKeyCursor"in w)?w.openCursor(A):w.openKeyCursor(A),O=[];R.onsuccess=M=>{const B=R.result;return B?(O.push(v?B.value:B.primaryKey),++_===y?f({result:O}):void B.continue()):f({result:O})},R.onerror=Y(m)}})}(i),openCursor:function({trans:l,values:h,query:f,reverse:m,unique:p}){return new Promise((v,y)=>{v=j(v);const{index:g,range:b}=f,k=l.objectStore(d),P=g.isPrimaryKey?k:k.index(g.name),x=m?p?"prevunique":"prev":p?"nextunique":"next",w=h||!("openKeyCursor"in P)?P.openCursor(r(b),x):P.openKeyCursor(r(b),x);w.onerror=Y(y),w.onsuccess=j(A=>{const _=w.result;if(!_)return void v(null);_.___id=++Br,_.done=!1;const R=_.continue.bind(_);let O=_.continuePrimaryKey;O&&(O=O.bind(_));const M=_.advance.bind(_),B=()=>{throw new Error("Cursor not stopped")};_.trans=l,_.stop=_.continue=_.continuePrimaryKey=_.advance=()=>{throw new Error("Cursor not started")},_.fail=j(y),_.next=function(){let N=1;return this.start(()=>N--?this.continue():this.stop()).then(()=>this)},_.start=N=>{const ye=new Promise((V,le)=>{V=j(V),w.onerror=Y(le),_.fail=le,_.stop=Ae=>{_.stop=_.continue=_.continuePrimaryKey=_.advance=B,V(Ae)}}),ve=()=>{if(w.result)try{N()}catch(V){_.fail(V)}else _.done=!0,_.start=()=>{throw new Error("Cursor behind last entry")},_.stop()};return w.onsuccess=j(V=>{w.onsuccess=ve,ve()}),_.continue=R,_.continuePrimaryKey=O,_.advance=M,ve(),ye},v(_)},y)})},count({query:l,trans:h}){const{index:f,range:m}=l;return new Promise((p,v)=>{const y=h.objectStore(d),g=f.isPrimaryKey?y:y.index(f.name),b=r(m),k=b?g.count(b):g.count();k.onsuccess=j(P=>p(P.target.result)),k.onerror=Y(v)})}}}(a)),u={};return o.forEach(a=>u[a.name]=a),{stack:"dbcore",transaction:t.transaction.bind(t),table(a){if(!u[a])throw new Error(`Table '${a}' not found`);return u[a]},MIN_KEY:-1/0,MAX_KEY:Ue(e),schema:s}}function Ut({_novip:t},e){const n=e.db,r=function(s,i,{IDBKeyRange:o,indexedDB:u},a){return{dbcore:function(c,d){return d.reduce((l,{create:h})=>({...l,...h(l)}),c)}(Fr(i,o,a),s.dbcore)}}(t._middlewares,n,t._deps,e);t.core=r.dbcore,t.tables.forEach(s=>{const i=s.name;t.core.schema.tables.some(o=>o.name===i)&&(s.core=t.core.table(i),t[i]instanceof t.Table&&(t[i].core=s.core))})}function mt({_novip:t},e,n,r){n.forEach(s=>{const i=r[s];e.forEach(o=>{const u=Jt(o,s);(!u||"value"in u&&u.value===void 0)&&(o===t.Transaction.prototype||o instanceof t.Transaction?ee(o,s,{get(){return this.table(s)},set(a){Pn(this,s,{value:a,writable:!0,configurable:!0,enumerable:!0})}}):o[s]=new t.Table(s,i))})})}function Vt({_novip:t},e){e.forEach(n=>{for(let r in n)n[r]instanceof t.Table&&delete n[r]})}function qr(t,e){return t._cfg.version-e._cfg.version}function Mr(t,e,n,r){const s=t._dbSchema,i=t._createTransaction("readwrite",t._storeNames,s);i.create(n),i._completion.catch(r);const o=i._reject.bind(i),u=E.transless||E;oe(()=>{E.trans=i,E.transless=u,e===0?($(s).forEach(a=>{Et(n,a,s[a].primKey,s[a].indexes)}),Ut(t,n),S.follow(()=>t.on.populate.fire(i)).catch(o)):function({_novip:a},c,d,l){const h=[],f=a._versions;let m=a._dbSchema=zt(a,a.idbdb,l),p=!1;const v=f.filter(g=>g._cfg.version>=c);function y(){return h.length?S.resolve(h.shift()(d.idbtrans)).then(y):S.resolve()}return v.forEach(g=>{h.push(()=>{const b=m,k=g._cfg.dbschema;Ht(a,b,l),Ht(a,k,l),m=a._dbSchema=k;const P=Jn(b,k);P.add.forEach(w=>{Et(l,w[0],w[1].primKey,w[1].indexes)}),P.change.forEach(w=>{if(w.recreate)throw new C.Upgrade("Not yet support for changing primary key");{const A=l.objectStore(w.name);w.add.forEach(_=>Wt(A,_)),w.change.forEach(_=>{A.deleteIndex(_.name),Wt(A,_)}),w.del.forEach(_=>A.deleteIndex(_))}});const x=g._cfg.contentUpgrade;if(x&&g._cfg.version>c){Ut(a,l),d._memoizedTables={},p=!0;let w=An(k);P.del.forEach(O=>{w[O]=b[O]}),Vt(a,[a.Transaction.prototype]),mt(a,[a.Transaction.prototype],$(w),w),d.schema=w;const A=Zt(x);let _;A&&Ce();const R=S.follow(()=>{if(_=x(d),_&&A){var O=ne.bind(null,null);_.then(O,O)}});return _&&typeof _.then=="function"?S.resolve(_):R.then(()=>_)}}),h.push(b=>{(!p||!Or)&&function(k,P){[].slice.call(P.db.objectStoreNames).forEach(x=>k[x]==null&&P.db.deleteObjectStore(x))}(g._cfg.dbschema,b),Vt(a,[a.Transaction.prototype]),mt(a,[a.Transaction.prototype],a._storeNames,a._dbSchema),d.schema=a._dbSchema})}),y().then(()=>{var g,b;b=l,$(g=m).forEach(k=>{b.db.objectStoreNames.contains(k)||Et(b,k,g[k].primKey,g[k].indexes)})})}(t,e,i,n).catch(o)})}function Jn(t,e){const n={del:[],add:[],change:[]};let r;for(r in t)e[r]||n.del.push(r);for(r in e){const s=t[r],i=e[r];if(s){const o={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!yt)o.recreate=!0,n.change.push(o);else{const u=s.idxByName,a=i.idxByName;let c;for(c in u)a[c]||o.del.push(c);for(c in a){const d=u[c],l=a[c];d?d.src!==l.src&&o.change.push(l):o.add.push(l)}(o.del.length>0||o.add.length>0||o.change.length>0)&&n.change.push(o)}}else n.add.push([r,i])}return n}function Et(t,e,n,r){const s=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(i=>Wt(s,i)),s}function Wt(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function zt(t,e,n){const r={};return lt(e.objectStoreNames,0).forEach(s=>{const i=n.objectStore(s);let o=i.keyPath;const u=Mt(Xn(o),o||"",!1,!1,!!i.autoIncrement,o&&typeof o!="string",!0),a=[];for(let d=0;d<i.indexNames.length;++d){const l=i.index(i.indexNames[d]);o=l.keyPath;var c=Mt(l.name,o,!!l.unique,!!l.multiEntry,!1,o&&typeof o!="string",!1);a.push(c)}r[s]=Qn(s,u,a)}),r}function Ht({_novip:t},e,n){const r=n.db.objectStoreNames;for(let s=0;s<r.length;++s){const i=r[s],o=n.objectStore(i);t._hasGetAll="getAll"in o;for(let u=0;u<o.indexNames.length;++u){const a=o.indexNames[u],c=o.index(a).keyPath,d=typeof c=="string"?c:"["+lt(c).join("+")+"]";if(e[i]){const l=e[i].idxByName[d];l&&(l.name=a,delete e[i].idxByName[d],e[i].idxByName[a]=l)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&K.WorkerGlobalScope&&K instanceof K.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Lr{_parseStoresSpec(e,n){$(e).forEach(r=>{if(e[r]!==null){var s=e[r].split(",").map((o,u)=>{const a=(o=o.trim()).replace(/([&*]|\+\+)/g,""),c=/^\[/.test(a)?a.match(/^\[(.*)\]$/)[1].split("+"):a;return Mt(a,c||null,/\&/.test(o),/\*/.test(o),/\+\+/.test(o),q(c),u===0)}),i=s.shift();if(i.multi)throw new C.Schema("Primary key cannot be multi-valued");s.forEach(o=>{if(o.auto)throw new C.Schema("Only primary key can be marked as autoIncrement (++)");if(!o.keyPath)throw new C.Schema("Index must have a name and cannot be an empty string")}),n[r]=Qn(r,i,s)}})}stores(e){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?U(this._cfg.storesSource,e):e;const r=n._versions,s={};let i={};return r.forEach(o=>{U(s,o._cfg.storesSource),i=o._cfg.dbschema={},o._parseStoresSpec(s,i)}),n._dbSchema=i,Vt(n,[n._allTables,n,n.Transaction.prototype]),mt(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],$(i),i),n._storeNames=$(i),this}upgrade(e){return this._cfg.contentUpgrade=nn(this._cfg.contentUpgrade||I,e),this}}function an(t,e){let n=t._dbNamesDB;return n||(n=t._dbNamesDB=new pe(vt,{addons:[],indexedDB:t,IDBKeyRange:e}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function un(t){return t&&typeof t.databases=="function"}function Yt(t){return oe(function(){return E.letThrough=!0,t()})}function Ur(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()}function Vr(t){const e=t._state,{indexedDB:n}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?D(e.dbOpenError):t);G&&(e.openCanceller._stackHolder=Ee()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;const r=e.openCanceller;function s(){if(e.openCanceller!==r)throw new C.DatabaseClosed("db.open() was cancelled")}let i=e.dbReadyResolve,o=null,u=!1;return S.race([r,(typeof navigator>"u"?S.resolve():Ur()).then(()=>new S((a,c)=>{if(s(),!n)throw new C.MissingAPI;const d=t.name,l=e.autoSchema?n.open(d):n.open(d,Math.round(10*t.verno));if(!l)throw new C.MissingAPI;l.onerror=Y(c),l.onblocked=j(t._fireOnBlocked),l.onupgradeneeded=j(h=>{if(o=l.transaction,e.autoSchema&&!t._options.allowEmptyDB){l.onerror=Me,o.abort(),l.result.close();const m=n.deleteDatabase(d);m.onsuccess=m.onerror=j(()=>{c(new C.NoSuchDatabase(`Database ${d} doesnt exist`))})}else{o.onerror=Y(c);var f=h.oldVersion>Math.pow(2,62)?0:h.oldVersion;u=f<1,t._novip.idbdb=l.result,Mr(t,f/10,o,c)}},c),l.onsuccess=j(()=>{o=null;const h=t._novip.idbdb=l.result,f=lt(h.objectStoreNames);if(f.length>0)try{const p=h.transaction((m=f).length===1?m[0]:m,"readonly");e.autoSchema?function({_novip:v},y,g){v.verno=y.version/10;const b=v._dbSchema=zt(0,y,g);v._storeNames=lt(y.objectStoreNames,0),mt(v,[v._allTables],$(b),b)}(t,h,p):(Ht(t,t._dbSchema,p),function(v,y){const g=Jn(zt(0,v.idbdb,y),v._dbSchema);return!(g.add.length||g.change.some(b=>b.add.length||b.change.length))}(t,p)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Ut(t,p)}catch{}var m;Ne.push(t),h.onversionchange=j(p=>{e.vcFired=!0,t.on("versionchange").fire(p)}),h.onclose=j(p=>{t.on("close").fire(p)}),u&&function({indexedDB:p,IDBKeyRange:v},y){!un(p)&&y!==vt&&an(p,v).put({name:y}).catch(I)}(t._deps,d),a()},c)}))]).then(()=>(s(),e.onReadyBeingFired=[],S.resolve(Yt(()=>t.on.ready.fire(t.vip))).then(function a(){if(e.onReadyBeingFired.length>0){let c=e.onReadyBeingFired.reduce(nn,I);return e.onReadyBeingFired=[],S.resolve(Yt(()=>c(t.vip))).then(a)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(a=>{e.dbOpenError=a;try{o&&o.abort()}catch{}return r===e.openCanceller&&t._close(),D(a)}).finally(()=>{e.openComplete=!0,i()})}function Gt(t){var e=i=>t.next(i),n=s(e),r=s(i=>t.throw(i));function s(i){return o=>{var u=i(o),a=u.value;return u.done?a:a&&typeof a.then=="function"?a.then(n,r):q(a)?Promise.all(a).then(n,r):n(a)}}return s(e)()}function Wr(t,e,n){var r=arguments.length;if(r<2)throw new C.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[t,On(s),n]}function Zn(t,e,n,r,s){return S.resolve().then(()=>{const i=E.transless||E,o=t._createTransaction(e,n,t._dbSchema,r),u={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(l){return l.name===tn.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Zn(t,e,n,null,s))):D(l)}const a=Zt(s);let c;a&&Ce();const d=S.follow(()=>{if(c=s.call(o,o),c)if(a){var l=ne.bind(null,null);c.then(l,l)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=Gt(c))},u);return(c&&typeof c.then=="function"?S.resolve(c).then(l=>o.active?l:D(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):d.then(()=>c)).then(l=>(r&&o._resolve(),o._completion.then(()=>l))).catch(l=>(o._reject(l),D(l)))})}function et(t,e,n){const r=q(t)?t.slice():[t];for(let s=0;s<n;++s)r.push(e);return r}const zr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return{...t,table(e){const n=t.table(e),{schema:r}=n,s={},i=[];function o(c,d,l){const h=De(c),f=s[h]=s[h]||[],m=c==null?0:typeof c=="string"?1:c.length,p=d>0,v={...l,isVirtual:p,keyTail:d,keyLength:m,extractKey:Lt(c),unique:!p&&l.unique};return f.push(v),v.isPrimaryKey||i.push(v),m>1&&o(m===2?c[0]:c.slice(0,m-1),d+1,l),f.sort((y,g)=>y.keyTail-g.keyTail),v}const u=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[u];for(const c of r.indexes)o(c.keyPath,0,c);function a(c){const d=c.query.index;return d.isVirtual?{...c,query:{index:d,range:(l=c.query.range,h=d.keyTail,{type:l.type===1?2:l.type,lower:et(l.lower,l.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:et(l.upper,l.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0})}}:c;var l,h}return{...n,schema:{...r,primaryKey:u,indexes:i,getIndexByKeyPath:function(c){const d=s[De(c)];return d&&d[0]}},count:c=>n.count(a(c)),query:c=>n.query(a(c)),openCursor(c){const{keyTail:d,isVirtual:l,keyLength:h}=c.query.index;return l?n.openCursor(a(c)).then(f=>f&&function(m){return Object.create(m,{continue:{value:function(p){p!=null?m.continue(et(p,c.reverse?t.MAX_KEY:t.MIN_KEY,d)):c.unique?m.continue(m.key.slice(0,h).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,d)):m.continue()}},continuePrimaryKey:{value(p,v){m.continuePrimaryKey(et(p,t.MAX_KEY,d),v)}},primaryKey:{get:()=>m.primaryKey},key:{get(){const p=m.key;return h===1?p[0]:p.slice(0,h)}},value:{get:()=>m.value}})}(f)):n.openCursor(c)}}}}}};function ln(t,e,n,r){return n=n||{},r=r||"",$(t).forEach(s=>{if(z(e,s)){var i=t[s],o=e[s];if(typeof i=="object"&&typeof o=="object"&&i&&o){const u=Tt(i);u!==Tt(o)?n[r+s]=e[s]:u==="Object"?ln(i,o,n,r+s+"."):i!==o&&(n[r+s]=e[s])}else i!==o&&(n[r+s]=e[s])}else n[r+s]=void 0}),$(e).forEach(s=>{z(t,s)||(n[r+s]=e[s])}),n}const Hr={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(e){const n=t.table(e),{primaryKey:r}=n.schema;return{...n,mutate(s){const i=E.trans,{deleting:o,creating:u,updating:a}=i.table(e).hook;switch(s.type){case"add":if(u.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"put":if(u.fire===I&&a.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"delete":if(o.fire===I)break;return i._promise("readwrite",()=>c(s),!0);case"deleteRange":if(o.fire===I)break;return i._promise("readwrite",()=>function(l){return d(l.trans,l.range,1e4)}(s),!0)}return n.mutate(s);function c(l){const h=E.trans,f=l.keys||function(m,p){return p.type==="delete"?p.keys:p.keys||p.values.map(m.extractKey)}(r,l);if(!f)throw new Error("Keys missing");return(l=l.type==="add"||l.type==="put"?{...l,keys:f}:{...l}).type!=="delete"&&(l.values=[...l.values]),l.keys&&(l.keys=[...l.keys]),function(m,p,v){return p.type==="add"?Promise.resolve([]):m.getMany({trans:p.trans,keys:v,cache:"immutable"})}(n,l,f).then(m=>{const p=f.map((v,y)=>{const g=m[y],b={onerror:null,onsuccess:null};if(l.type==="delete")o.fire.call(b,v,g,h);else if(l.type==="add"||g===void 0){const k=u.fire.call(b,v,l.values[y],h);v==null&&k!=null&&(v=k,l.keys[y]=v,r.outbound||H(l.values[y],r.keyPath,v))}else{const k=ln(g,l.values[y]),P=a.fire.call(b,k,v,g,h);if(P){const x=l.values[y];Object.keys(P).forEach(w=>{z(x,w)?x[w]=P[w]:H(x,w,P[w])})}}return b});return n.mutate(l).then(({failures:v,results:y,numFailures:g,lastResult:b})=>{for(let k=0;k<f.length;++k){const P=y?y[k]:f[k],x=p[k];P==null?x.onerror&&x.onerror(v[k]):x.onsuccess&&x.onsuccess(l.type==="put"&&m[k]?l.values[k]:P)}return{failures:v,results:y,numFailures:g,lastResult:b}}).catch(v=>(p.forEach(y=>y.onerror&&y.onerror(v)),Promise.reject(v)))})}function d(l,h,f){return n.query({trans:l,values:!1,query:{index:r,range:h},limit:f}).then(({result:m})=>c({type:"delete",keys:m,trans:l}).then(p=>p.numFailures>0?Promise.reject(p.failures[0]):m.length<f?{failures:[],numFailures:0,lastResult:void 0}:d(l,{...h,lower:m[m.length-1],lowerOpen:!0},f)))}}}}})};function er(t,e,n){try{if(!e||e.keys.length<t.length)return null;const r=[];for(let s=0,i=0;s<e.keys.length&&i<t.length;++s)L(e.keys[s],t[i])===0&&(r.push(n?We(e.values[s]):e.values[s]),++i);return r.length===t.length?r:null}catch{return null}}const Yr={stack:"dbcore",level:-1,create:t=>({table:e=>{const n=t.table(e);return{...n,getMany:r=>{if(!r.cache)return n.getMany(r);const s=er(r.keys,r.trans._cache,r.cache==="clone");return s?S.resolve(s):n.getMany(r).then(i=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?We(i):i},i))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))}}})};function cn(t){return!("from"in t)}const Q=function(t,e){if(!this){const n=new Q;return t&&"d"in t&&U(n,t),n}U(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Ve(t,e,n){const r=L(e,n);if(isNaN(r))return;if(r>0)throw RangeError();if(cn(t))return U(t,{from:e,to:n,d:1});const s=t.l,i=t.r;if(L(n,t.from)<0)return s?Ve(s,e,n):t.l={from:e,to:n,d:1,l:null,r:null},kn(t);if(L(e,t.to)>0)return i?Ve(i,e,n):t.r={from:e,to:n,d:1,l:null,r:null},kn(t);L(e,t.from)<0&&(t.from=e,t.l=null,t.d=i?i.d+1:1),L(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);const o=!t.r;s&&!t.l&>(t,s),i&&o&>(t,i)}function gt(t,e){cn(e)||function n(r,{from:s,to:i,l:o,r:u}){Ve(r,s,i),o&&n(r,o),u&&n(r,u)}(t,e)}function Gr(t,e){const n=Xt(e);let r=n.next();if(r.done)return!1;let s=r.value;const i=Xt(t);let o=i.next(s.from),u=o.value;for(;!r.done&&!o.done;){if(L(u.from,s.to)<=0&&L(u.to,s.from)>=0)return!0;L(s.from,u.from)<0?s=(r=n.next(u.from)).value:u=(o=i.next(s.from)).value}return!1}function Xt(t){let e=cn(t)?null:{s:0,n:t};return{next(n){const r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&L(n,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||L(n,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function kn(t){var e,n;const r=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((n=t.l)===null||n===void 0?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const i=s==="r"?"l":"r",o={...t},u=t[s];t.from=u.from,t.to=u.to,t[s]=u[s],o[s]=u[i],t[i]=o,o.d=xn(o)}t.d=xn(t)}function xn({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}Pe(Q.prototype,{add(t){return gt(this,t),this},addKey(t){return Ve(this,t,t),this},addKeys(t){return t.forEach(e=>Ve(this,e,e)),this},[At](){return Xt(this)}});const Xr={stack:"dbcore",level:0,create:t=>{const e=t.schema.name,n=new Q(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const s=t.table(r),{schema:i}=s,{primaryKey:o}=i,{extractKey:u,outbound:a}=o,c={...s,mutate:h=>{const f=h.trans,m=f.mutatedParts||(f.mutatedParts={}),p=x=>{const w=`idb://${e}/${r}/${x}`;return m[w]||(m[w]=new Q)},v=p(""),y=p(":dels"),{type:g}=h;let[b,k]=h.type==="deleteRange"?[h.range]:h.type==="delete"?[h.keys]:h.values.length<50?[[],h.values]:[];const P=h.trans._cache;return s.mutate(h).then(x=>{if(q(b)){g!=="delete"&&(b=x.results),v.addKeys(b);const w=er(b,P);w||g==="add"||y.addKeys(b),(w||k)&&function(A,_,R,O){function M(B){const N=A(B.name||"");function ye(V){return V!=null?B.extractKey(V):null}const ve=V=>B.multiEntry&&q(V)?V.forEach(le=>N.addKey(le)):N.addKey(V);(R||O).forEach((V,le)=>{const Ae=R&&ye(R[le]),bt=O&&ye(O[le]);L(Ae,bt)!==0&&(Ae!=null&&ve(Ae),bt!=null&&ve(bt))})}_.indexes.forEach(M)}(p,i,w,k)}else if(b){const w={from:b.lower,to:b.upper};y.add(w),v.add(w)}else v.add(n),y.add(n),i.indexes.forEach(w=>p(w.name).add(n));return x})}},d=({query:{index:h,range:f}})=>{var m,p;return[h,new Q((m=f.lower)!==null&&m!==void 0?m:t.MIN_KEY,(p=f.upper)!==null&&p!==void 0?p:t.MAX_KEY)]},l={get:h=>[o,new Q(h.key)],getMany:h=>[o,new Q().addKeys(h.keys)],count:d,query:d,openCursor:d};return $(l).forEach(h=>{c[h]=function(f){const{subscr:m}=E;if(m){const p=k=>{const P=`idb://${e}/${r}/${k}`;return m[P]||(m[P]=new Q)},v=p(""),y=p(":dels"),[g,b]=l[h](f);if(p(g.name||"").add(b),!g.isPrimaryKey){if(h!=="count"){const k=h==="query"&&a&&f.values&&s.query({...f,values:!1});return s[h].apply(this,arguments).then(P=>{if(h==="query"){if(a&&f.values)return k.then(({result:w})=>(v.addKeys(w),P));const x=f.values?P.result.map(u):P.result;f.values?v.addKeys(x):y.addKeys(x)}else if(h==="openCursor"){const x=P,w=f.values;return x&&Object.create(x,{key:{get:()=>(y.addKey(x.primaryKey),x.key)},primaryKey:{get(){const A=x.primaryKey;return y.addKey(A),A}},value:{get:()=>(w&&v.addKey(x.primaryKey),x.value)}})}return P})}y.add(n)}}return s[h].apply(this,arguments)}}),c}}}};class pe{constructor(e,n){this._middlewares={},this.verno=0;const r=pe.dependencies;this._options=n={addons:pe.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:s}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:I,dbReadyPromise:null,cancelOpen:I,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var o;i.dbReadyPromise=new S(u=>{i.dbReadyResolve=u}),i.openCanceller=new S((u,a)=>{i.cancelOpen=a}),this._state=i,this.name=e,this.on=$e(this,"populate","blocked","versionchange","close",{ready:[nn,I]}),this.on.ready.subscribe=En(this.on.ready.subscribe,u=>(a,c)=>{pe.vip(()=>{const d=this._state;if(d.openComplete)d.dbOpenError||S.resolve().then(a),c&&u(a);else if(d.onReadyBeingFired)d.onReadyBeingFired.push(a),c&&u(a);else{u(a);const l=this;c||u(function h(){l.on.ready.unsubscribe(a),l.on.ready.unsubscribe(h)})}})}),this.Collection=(o=this,Oe(jr.prototype,function(u,a){this.db=o;let c=Hn,d=null;if(a)try{c=a()}catch(m){d=m}const l=u._ctx,h=l.table,f=h.hook.reading.fire;this._ctx={table:h,index:l.index,isPrimKey:!l.index||h.schema.primKey.keyPath&&l.index===h.schema.primKey.name,range:c,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:d,or:l.or,valueMapper:f!==Fe?f:null}})),this.Table=function(u){return Oe(Kr.prototype,function(a,c,d){this.db=u,this._tx=d,this.name=a,this.schema=c,this.hook=u._allTables[a]?u._allTables[a].hook:$e(null,{creating:[wr,I],reading:[br,Fe],updating:[kr,I],deleting:[_r,I]})})}(this),this.Transaction=function(u){return Oe(Dr.prototype,function(a,c,d,l,h){this.db=u,this.mode=a,this.storeNames=c,this.schema=d,this.chromeTransactionDurability=l,this.idbtrans=null,this.on=$e(this,"complete","error","abort"),this.parent=h||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 S((f,m)=>{this._resolve=f,this._reject=m}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},f=>{var m=this.active;return this.active=!1,this.on.error.fire(f),this.parent?this.parent._reject(f):m&&this.idbtrans&&this.idbtrans.abort(),D(f)})})}(this),this.Version=function(u){return Oe(Lr.prototype,function(a){this.db=u,this._cfg={version:a,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(u){return Oe(Gn.prototype,function(a,c,d){this.db=u,this._ctx={table:a,index:c===":id"?null:c,or:d};const l=u._deps.indexedDB;if(!l)throw new C.MissingAPI;this._cmp=this._ascending=l.cmp.bind(l),this._descending=(h,f)=>l.cmp(f,h),this._max=(h,f)=>l.cmp(h,f)>0?h:f,this._min=(h,f)=>l.cmp(h,f)<0?h:f,this._IDBKeyRange=u._deps.IDBKeyRange})}(this),this.on("versionchange",u=>{u.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",u=>{!u.newVersion||u.newVersion<u.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion/10}`)}),this._maxKey=Ue(n.IDBKeyRange),this._createTransaction=(u,a,c,d)=>new this.Transaction(u,a,c,this._options.chromeTransactionDurability,d),this._fireOnBlocked=u=>{this.on("blocked").fire(u),Ne.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(u))},this.use(zr),this.use(Hr),this.use(Xr),this.use(Yr),this.vip=Object.create(this,{_vip:{value:!0}}),s.forEach(u=>u(this))}version(e){if(isNaN(e)||e<.1)throw new C.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new C.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const n=this._versions;var r=n.filter(s=>s._cfg.version===e)[0];return r||(r=new this.Version(e),n.push(r),n.sort(qr),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(e){return this.idbdb&&(this._state.openComplete||E.letThrough||this._vip)?e():new S((n,r)=>{if(this._state.openComplete)return r(new C.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void r(new C.DatabaseClosed);this.open().catch(I)}this._state.dbReadyPromise.then(n,r)}).then(e)}use({stack:e,create:n,level:r,name:s}){s&&this.unuse({stack:e,name:s});const i=this._middlewares[e]||(this._middlewares[e]=[]);return i.push({stack:e,create:n,level:r??10,name:s}),i.sort((o,u)=>o.level-u.level),this}unuse({stack:e,name:n,create:r}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(s=>r?s.create!==r:!!n&&s.name!==n)),this}open(){return Vr(this)}_close(){const e=this._state,n=Ne.indexOf(this);if(n>=0&&Ne.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new S(r=>{e.dbReadyResolve=r}),e.openCanceller=new S((r,s)=>{e.cancelOpen=s})}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new C.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,n=this._state;return new S((r,s)=>{const i=()=>{this.close();var o=this._deps.indexedDB.deleteDatabase(this.name);o.onsuccess=j(()=>{(function({indexedDB:u,IDBKeyRange:a},c){!un(u)&&c!==vt&&an(u,a).delete(c).catch(I)})(this._deps,this.name),r()}),o.onerror=Y(s),o.onblocked=this._fireOnBlocked};if(e)throw new C.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(i):i()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return $(this._allTables).map(e=>this._allTables[e])}transaction(){const e=Wr.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,r){let s=E.trans;s&&s.db===this&&e.indexOf("!")===-1||(s=null);const i=e.indexOf("?")!==-1;let o,u;e=e.replace("!","").replace("?","");try{if(u=n.map(c=>{var d=c instanceof this.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),e=="r"||e===_t)o=_t;else{if(e!="rw"&&e!=kt)throw new C.InvalidArgument("Invalid transaction mode: "+e);o=kt}if(s){if(s.mode===_t&&o===kt){if(!i)throw new C.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");s=null}s&&u.forEach(c=>{if(s&&s.storeNames.indexOf(c)===-1){if(!i)throw new C.SubTransaction("Table "+c+" not included in parent transaction.");s=null}}),i&&s&&!s.active&&(s=null)}}catch(c){return s?s._promise(null,(d,l)=>{l(c)}):D(c)}const a=Zn.bind(null,this,o,u,s,r);return s?s._promise(o,a,"lock"):E.trans?Te(E.transless,()=>this._whenReady(a)):this._whenReady(a)}table(e){if(!z(this._allTables,e))throw new C.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Qr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class Jr{constructor(e){this._subscribe=e}subscribe(e,n,r){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:n,complete:r})}[Qr](){return this}}function tr(t,e){return $(e).forEach(n=>{gt(t[n]||(t[n]=new Q),e[n])}),t}function Zr(t){let e,n=!1;const r=new Jr(s=>{const i=Zt(t);let o=!1,u={},a={};const c={get closed(){return o},unsubscribe:()=>{o=!0,ue.storagemutated.unsubscribe(f)}};s.start&&s.start(c);let d=!1,l=!1;function h(){return $(a).some(p=>u[p]&&Gr(u[p],a[p]))}const f=p=>{tr(u,p),h()&&m()},m=()=>{if(d||o)return;u={};const p={},v=function(y){i&&Ce();const g=()=>oe(t,{subscr:y,trans:null}),b=E.trans?Te(E.transless,g):g();return i&&b.then(ne,ne),b}(p);l||(ue(Le,f),l=!0),d=!0,Promise.resolve(v).then(y=>{n=!0,e=y,d=!1,o||(h()?m():(u={},a=p,s.next&&s.next(y)))},y=>{d=!1,n=!1,s.error&&s.error(y),c.unsubscribe()})};return m(),c});return r.hasValue=()=>n,r.getValue=()=>e,r}let Qt;try{Qt={indexedDB:K.indexedDB||K.mozIndexedDB||K.webkitIndexedDB||K.msIndexedDB,IDBKeyRange:K.IDBKeyRange||K.webkitIDBKeyRange}}catch{Qt={indexedDB:null,IDBKeyRange:null}}const ce=pe;function at(t){let e=Z;try{Z=!0,ue.storagemutated.fire(t)}finally{Z=e}}Pe(ce,{...tt,delete:t=>new ce(t,{addons:[]}).delete(),exists:t=>new ce(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(t){try{return function({indexedDB:e,IDBKeyRange:n}){return un(e)?Promise.resolve(e.databases()).then(r=>r.map(s=>s.name).filter(s=>s!==vt)):an(e,n).toCollection().primaryKeys()}(ce.dependencies).then(t)}catch{return D(new C.MissingAPI)}},defineClass:()=>function(t){U(this,t)},ignoreTransaction:t=>E.trans?Te(E.transless,t):t(),vip:Yt,async:function(t){return function(){try{var e=Gt(t.apply(this,arguments));return e&&typeof e.then=="function"?e:S.resolve(e)}catch(n){return D(n)}}},spawn:function(t,e,n){try{var r=Gt(t.apply(n,e||[]));return r&&typeof r.then=="function"?r:S.resolve(r)}catch(s){return D(s)}},currentTransaction:{get:()=>E.trans||null},waitFor:function(t,e){const n=S.resolve(typeof t=="function"?ce.ignoreTransaction(t):t).timeout(e||6e4);return E.trans?E.trans.waitFor(n):n},Promise:S,debug:{get:()=>G,set:t=>{Kn(t,t==="dexie"?()=>!0:zn)}},derive:ke,extend:U,props:Pe,override:En,Events:$e,on:ue,liveQuery:Zr,extendObservabilitySet:tr,getByKeyPath:te,setByKeyPath:H,delByKeyPath:function(t,e){typeof e=="string"?H(t,e,void 0):"length"in e&&[].map.call(e,function(n){H(t,n,void 0)})},shallowClone:An,deepClone:We,getObjectDiff:ln,cmp:L,asap:Cn,minKey:qt,addons:[],connections:Ne,errnames:tn,dependencies:Qt,semVer:gn,version:gn.split(".").map(t=>parseInt(t)).reduce((t,e,n)=>t+e/Math.pow(10,2*n))}),ce.maxKey=Ue(ce.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(ue(Le,t=>{if(!Z){let e;yt?(e=document.createEvent("CustomEvent"),e.initCustomEvent(ie,!0,!0,t)):e=new CustomEvent(ie,{detail:t}),Z=!0,dispatchEvent(e),Z=!1}}),addEventListener(ie,({detail:t})=>{Z||at(t)}));let Z=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(ie);typeof t.unref=="function"&&t.unref(),ue(Le,e=>{Z||t.postMessage(e)}),t.onmessage=e=>{e.data&&at(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){ue(Le,e=>{try{Z||(typeof localStorage<"u"&&localStorage.setItem(ie,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:ie,changedParts:e})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",e=>{if(e.key===ie){const n=JSON.parse(e.newValue);n&&at(n.changedParts)}});const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",function({data:e}){e&&e.type===ie&&at(e.changedParts)})}S.rejectionMapper=function(t,e){if(!t||t instanceof xe||t instanceof TypeError||t instanceof SyntaxError||!t.name||!dn[t.name])return t;var n=new dn[t.name](e||t.message,t);return"stack"in t&&ee(n,"stack",{get:function(){return this.inner.stack}}),n},Kn(G,zn);class es extends pe{constructor(){super("NylasAuthDatabase"),ut(this,"grant"),ut(this,"pkce"),this.version(1).stores({grant:"++id,token",pkce:"++id,codeVerifier"}),this.grant=this.table("grant"),this.pkce=this.table("pkce")}}class ts{constructor(){ut(this,"theDB"),this.theDB=new es}async setCodeVerifier(e){await this.theDB.pkce.put({id:1,codeVerifier:e},1)}async getCodeVerifier(){const[e]=await this.theDB.pkce.toArray();return e?e.codeVerifier:null}async getTokenInfo(){const e=await this.theDB.grant.get(1);return e?e.token:null}async setTokenInfo(e){await this.theDB.grant.put({id:1,token:e},1)}async reset(){await this.theDB.grant.clear()}}function ns(t){const e="NylasAuth";if(!t)throw new Error("NylasAuth requires a config object");let n=null;if(t.storageType==="indexeddb"&&(n=new ts),!n)throw new Error("NylasAuth requires a storage object");const r=[{type:"read-only",value:"https://www.googleapis.com/auth/gmail.readonly"},{type:"modify",value:"https://www.googleapis.com/auth/gmail.modify"},{type:"compose",value:"https://www.googleapis.com/auth/gmail.compose"},{type:"insert",value:"https://www.googleapis.com/auth/gmail.insert"},{type:"labels",value:"https://www.googleapis.com/auth/gmail.labels"},{type:"metadata",value:"https://www.googleapis.com/auth/gmail.metadata"},{type:"settings.basic",value:"https://www.googleapis.com/auth/gmail.settings.basic"},{type:"settings.sharing",value:"https://www.googleapis.com/auth/gmail.settings.sharing"}],s=[{type:"read-only",value:"https://outlook.office.com/mail.read"},{type:"modify",value:"https://outlook.office.com/mail.readwrite"},{type:"send",value:"https://outlook.office.com/mail.send"},{type:"offline",value:"offline_access"}];async function i(o,u,a,c=!0,d,l){const h=await(n==null?void 0:n.getTokenInfo()),f=new URL(o,d??t.apiUri),m=new Headers;m.append("Accept","application/json"),m.append("Content-Type","application/json"),m.append("User-Agent",e),h&&m.append("Authorization",`Bearer ${h.access_token}`);const p=await fetch(f.toString(),{method:u||"GET",headers:m,mode:"cors",referrer:location.origin,body:a?JSON.stringify(a):void 0,...l||{}});return c?await p.json():p.body}return{config:t,async getHostedAuthRedirectURL(o=t.defaultScopes,u,a){const c=await hn(Math.random().toString()),d=await hn(c);await(n==null?void 0:n.setCodeVerifier(c));const l=new URL(`${t.apiUri}/v3/connect/auth`);return l.searchParams.set("client_id",t.clientId),l.searchParams.set("response_type","code"),l.searchParams.set("scope",o.join(" ")),l.searchParams.set("redirect_uri",t.redirectURI),l.searchParams.set("access_type","offline"),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method","S256"),l.searchParams.set("options","rotate_refresh_token"),a&&l.searchParams.set("provider",a),u&&l.searchParams.set("login_hint",u),l.toString()},nylasAPIRequest:i,async exchangeAuthCodeForTokenInfo(o){if(!o)return null;const u=await(n==null?void 0:n.getCodeVerifier()),a=await this.nylasAPIRequest("/v3/connect/token","POST",{code:o,client_id:t.clientId,grant_type:"authorization_code",redirect_uri:t.redirectURI,code_verifier:u});return"error"in a||await(n==null?void 0:n.setTokenInfo(a)),a},async nylasDownloadFileRequest(o,u="GET",a){const c=await(n==null?void 0:n.getTokenInfo()),d=new URL(o,t.apiUri),l=new Headers;return l.append("Accept","application/json"),l.append("Content-Type","application/octet-stream"),l.append("User-Agent",e),c&&l.append("Authorization",`Bearer ${c.access_token}`),(await fetch(d.toString(),{method:u,headers:l,mode:"cors",referrer:location.origin,body:a?JSON.stringify(a):void 0})).blob()},async logout(){const o=await(n==null?void 0:n.getTokenInfo());o&&await this.nylasAPIRequest(`/v3/connect/revoke?token=${o.access_token}`,"POST"),await(n==null?void 0:n.reset())},async isAuthenticated(){return!!await(n==null?void 0:n.getTokenInfo())},async getTokenInfo(){const o=await(n==null?void 0:n.getTokenInfo());if(!o)return null;const{access_token:u,...a}=o;return a},async isAccessTokenValid(){const o=await(n==null?void 0:n.getTokenInfo());return o?"data"in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${o.id_token}`,"GET"):!1},async refreshAccessToken(){const o=await(n==null?void 0:n.getTokenInfo());if(!o)return null;const u=await this.nylasAPIRequest("/v3/connect/token","POST",{client_id:t.clientId,grant_type:"refresh_token",refresh_token:o.refresh_token});return"error"in u||await(n==null?void 0:n.setTokenInfo(u)),u},async hasScopeByType(o="email",u){const a=await(n==null?void 0:n.getTokenInfo());if(!a)return!1;const c=a.scope.toLowerCase().split(" ");let d=[];const l=Array.isArray(u)?u:[u];return o==="email"&&(d=[...s,...r].filter(h=>l.includes(h.type))),d.every(h=>c.includes(h.value))},async hasScope(o){const u=await(n==null?void 0:n.getTokenInfo());if(!u)return!1;const a=u.scope.toLowerCase().split(" ");return(Array.isArray(o)?o:[o]).some(c=>a.includes(c.toLowerCase()))}}}exports.NylasBaseProvider=sr;exports.Xr=ar;exports.Zr=ur;exports.es=ns;exports.nr=Sn;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { d as T, u as nr, l as hn } from "./index-
|
|
2
|
-
|
|
1
|
+
import { d as T, u as nr, l as hn } from "./index-4c7e8f2f.js";
|
|
2
|
+
import { g as rr } from "./global-37eeb0cd-b42e0abc.js";
|
|
3
|
+
class sr {
|
|
3
4
|
constructor(e, n, r = !0, s) {
|
|
4
5
|
this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
|
|
5
6
|
this.propStateRegistrations.set(i, /* @__PURE__ */ new Map());
|
|
@@ -163,12 +164,11 @@ class rr {
|
|
|
163
164
|
return ((n = (e = this.host) == null ? void 0 : e.tagName) == null ? void 0 : n.toLowerCase()) ?? "nylas-provider";
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
|
-
class
|
|
167
|
+
class rs extends sr {
|
|
167
168
|
}
|
|
168
|
-
const sr = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {};
|
|
169
169
|
var ir = Object.defineProperty, or = (t, e, n) => e in t ? ir(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ut = (t, e, n) => (or(t, typeof e != "symbol" ? e + "" : e, n), n), ar = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(ar || {});
|
|
170
|
-
const
|
|
171
|
-
class
|
|
170
|
+
const ss = (t) => t !== null && typeof t == "object" && "error" in t;
|
|
171
|
+
class is extends Error {
|
|
172
172
|
constructor(e) {
|
|
173
173
|
super(e == null ? void 0 : e.message), ut(this, "apiError"), this.name = "NylasAPIError", this.stack = new Error().stack, this.apiError = e;
|
|
174
174
|
}
|
|
@@ -177,7 +177,7 @@ async function dn(t) {
|
|
|
177
177
|
const e = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", e), r = Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
178
178
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
179
179
|
}
|
|
180
|
-
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window :
|
|
180
|
+
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : rr, $ = Object.keys, M = Array.isArray;
|
|
181
181
|
function U(t, e) {
|
|
182
182
|
return typeof e != "object" || $(e).forEach(function(n) {
|
|
183
183
|
t[n] = e[n];
|
|
@@ -2925,7 +2925,7 @@ class es {
|
|
|
2925
2925
|
await this.theDB.grant.clear();
|
|
2926
2926
|
}
|
|
2927
2927
|
}
|
|
2928
|
-
function
|
|
2928
|
+
function os(t) {
|
|
2929
2929
|
const e = "NylasAuth";
|
|
2930
2930
|
if (!t)
|
|
2931
2931
|
throw new Error("NylasAuth requires a config object");
|
|
@@ -3128,10 +3128,9 @@ function is(t) {
|
|
|
3128
3128
|
};
|
|
3129
3129
|
}
|
|
3130
3130
|
export {
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
sr as g,
|
|
3131
|
+
rs as N,
|
|
3132
|
+
ss as X,
|
|
3133
|
+
is as Z,
|
|
3134
|
+
os as e,
|
|
3136
3135
|
ar as n
|
|
3137
3136
|
};
|