Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Created October 17, 2020 03:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wellington1993/b27e2e1b43c7709cd60bc9e2c5a02bdb to your computer and use it in GitHub Desktop.
Save wellington1993/b27e2e1b43c7709cd60bc9e2c5a02bdb to your computer and use it in GitHub Desktop.
/*! Copyright (c) 2020 WhatsApp Inc. All Rights Reserved. */!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s="jdfddifba")}({bbieaaebag:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},bcdgbaaibb:function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,a,o,u,c=1,s={},f=!1,l=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){v(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){v(e.data)},r=function(e){a.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,r=function(e){var t=l.createElement("script");t.onreadystatechange=function(){v(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(v,0,e)}:(o="setImmediate$"+Math.random()+"$",u=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&v(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",u,!1):e.attachEvent("onmessage",u),r=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return s[c]=i,r(c),c++},d.clearImmediate=h}function h(e){delete s[e]}function v(e){if(f)setTimeout(v,0,e);else{var t=s[e];if(t){f=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{h(e),f=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n("bgdiiijdd"),n("ddghcccjbh"))},bcdieeaibb:function(e,t,n){var r=n("bedeadcjdb"),i=n("cgaegfgegc");function a(t,n,o){return i()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},a.apply(null,arguments)}e.exports=a},bchejfgdg:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("dfadhaifh")),a=r(n("hbddjfeei")),o=r(n("diaegabbjd")),u=r(n("eaidjcib")),c=r(n("dgcdacjddi")),s=r(n("ffedgcdgj")),f=r(n("ccddaicfff")),l=r(n("cgeeeeddea")),d=(n("dhdjjbcibj"),r(n("cahfddcdga"))),h=n("bfagiaicdd");function v(){var e=(0,i.default)(["Operation "," failed with args: "]);return v=function(){return e},e}function p(){var e=(0,i.default)(["idb faild to do Operation: "," on Table: ",". Failed with error"]);return p=function(){return e},e}var y=n("geadgcffe").default;function g(){return(g=(0,s.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("feature is not yet implemented");case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return m.apply(this,arguments)}function m(){return(m=(0,s.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("feature is not yet implemented");case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _=function(){function e(t,n,r,i,a){(0,u.default)(this,e),this.table=t,this.view=r,this.db=n,this.propFilter=i,this.tableEncryptedColumns=new Map(Object.keys(a).map((function(e){return[e,a[e]]})))}var t,n,r,i,d,h,v,p,m,_;return(0,c.default)(e,[{key:"asyncView",value:(_=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasEncryptedColumn()){e.next=2;break}return e.abrupt("return",this.view(t));case 2:return e.next=4,this._decryptColumns(t);case 4:return n=e.sent,e.abrupt("return",this.view(n));case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_decryptColumns",value:(m=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,l.default)("object"==typeof t,"Called `_decryptColumns` with primitive value"),n=Array.from(this.tableEncryptedColumns.entries()).map((function(e){var n=(0,a.default)(e,2),r=n[0],i=n[1],o=t[r];return(null==o?void 0:o._data)&&(null==o?void 0:o.iv)?b(o,r,i).then((function(e){t[r]=e})):o})),e.next=4,Promise.all(n);case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"_encryptColumns",value:function(e){var t=Array.from(this.tableEncryptedColumns.entries()).map((function(t){var n=(0,a.default)(t,2),r=n[0],i=n[1],o=e[r];return null==o?o:function(){return g.apply(this,arguments)}(o,r,i).then((function(t){e[r]=t}))}));return Promise.all(t).then((function(){return e}))}},{key:"_addAndEncrypt",value:(p=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasEncryptedColumn()){e.next=2;break}return e.abrupt("return",this.table.add(t));case 2:return e.next=4,this._encryptSingleUpdate(t);case 4:return n=e.sent,e.abrupt("return",this.table.add(n));case 6:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_putAndEncrypt",value:(v=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasEncryptedColumn()){e.next=2;break}return e.abrupt("return",this.table.put(t));case 2:return e.next=4,this._encryptColumns(t);case 4:return n=e.sent,e.abrupt("return",this.table.put(n));case 6:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"_bulkAddAndEncrypt",value:function(e){var t=this;return this._hasEncryptedColumn()?this._encryptBulkUpdates(e).then((function(e){return t.table.bulkAdd(e)})):this.table.bulkAdd(e)}},{key:"_bulkPutAndEncrypt",value:(h=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasEncryptedColumn()){e.next=2;break}return e.abrupt("return",this.table.bulkPut(t));case 2:return e.next=4,this._encryptBulkUpdates(t);case 4:return n=e.sent,e.abrupt("return",this.table.bulkPut(n));case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"_encryptBulkUpdates",value:function(e){var t=this;if(!this._hasEncryptedColumn())return y.resolve(e);var n=[],r=e.map((function(e,r){return t._encryptColumns(e).then((function(e){n[r]=e}))}));return Promise.all(r).then((function(){return n}))}},{key:"_encryptSingleUpdate",value:(d=(0,s.default)(o.default.mark((function e(t){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasEncryptedColumn()){e.next=2;break}return e.abrupt("return",t);case 2:return e.next=4,this._encryptColumns(t);case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"asyncViewMap",value:(i=(0,s.default)(o.default.mark((function e(t){var n,r,i=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=[],this._hasEncryptedColumn()){e.next=3;break}return e.abrupt("return",t.map((function(e){return e?i.view(e):null})));case 3:return r=t.map((function(e,t){return(null!=e?i.asyncView(e):y.resolve(null)).then((function(e){n[t]=e}))})),e.next=6,Promise.all(r);case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"create",value:function(e){var t=this,n=this.propFilter(e);return y.resolve(this._addAndEncrypt(n)).catch((function(e){throw I(e,"create",t.table.name),e}))}},{key:"createOrReplace",value:function(e){var t=this,n=this.propFilter(e);return y.resolve(this._putAndEncrypt(n)).catch((function(e){throw I(e,"createOrReplace",t.table.name),e}))}},{key:"createOrMerge",value:(r=(0,s.default)(o.default.mark((function e(t,n){var r,i,a=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.propFilter(n),e.next=3,this._encryptColumns(r);case 3:return i=e.sent,e.abrupt("return",y.resolve(this.db.transaction("rw",this.table,(function(){a.table.where(":id").equals(t).modify((function(e){Object.assign(e,i)})).then((function(e){if(1!==e)return a.table.add(i)}))})).then((function(){}))).catch((function(e){throw I(e,"createOrMerge",a.table.name),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"get",value:function(e){var t=this;return y.resolve(this.table.get(e)).then((function(e){return e?t.asyncView(e):null})).catch((function(e){throw I(e,"get",t.table.name),e}))}},{key:"merge",value:(n=(0,s.default)(o.default.mark((function e(t,n){var r,i,a=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.propFilter(n),e.next=3,this._encryptSingleUpdate(r);case 3:return i=e.sent,e.abrupt("return",y.resolve(this.table.update(t,i)).catch((function(e){throw I(e,"merge",a.table.name),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"remove",value:function(e){var t=this;return y.resolve(this.table.delete(e)).catch((function(e){throw I(e,"remove",t.table.name),e}))}},{key:"bulkCreate",value:function(e){var t=this,n=e.map((function(e){return t.propFilter(e)}));return y.resolve(this.db.transaction("rw",this.table,(function(){return t._bulkAddAndEncrypt(n)}))).catch((function(e){throw I(e,"bulkCreate",t.table.name),e}))}},{key:"bulkCreateOrReplace",value:function(e){var t=this,n=e.map((function(e){return t.propFilter(e)}));return y.resolve(this.db.transaction("rw",this.table,(function(){return t._bulkPutAndEncrypt(n)}))).catch((function(e){throw I(e,"bulkCreateOrReplace",t.table.name),e}))}},{key:"bulkCreateOrMerge",value:(t=(0,s.default)(o.default.mark((function e(t){var n,r,i,a,u,c=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=(0,s.default)(o.default.mark((function e(t){var n,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.table.where(":id").anyOf(Array.from(t.keys())),e.next=3,n.modify((function(e){Object.assign(e,t.get(e[r])),t.delete(e[r])}));case 3:return a=Array.from(t.values()),e.abrupt("return",a);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)},a=function(){return u.apply(this,arguments)},n=new Map,r=this._primaryKey(),i=this,e.next=7,this._encryptBulkUpdates(t);case 7:return e.sent.forEach((function(e){var t=c.propFilter(e);(0,l.default)(r in t,"Called `bulkCreateOrMerge` with item(s) not including the primary key"),n.set(t[r],t)})),e.abrupt("return",y.resolve(this.db.transaction("rw",this.table,(function(){return a(n).then((function(e){return 0===e.length?y.resolve():c.table.bulkPut(e)}))}))).catch((function(e){throw I(e,"bulkCreateOrMerge",c.table.name),e})));case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"bulkGet",value:function(e){var t=this;return y.resolve(this.db.transaction("r",this.table,(function(){var n=e.map((function(e){return t.table.get(e)}));return f.default.Promise.all(n)}))).then((function(e){return t.asyncViewMap(e)})).catch((function(e){throw I(e,"bulkGet",t.table.name),e}))}},{key:"bulkRemove",value:function(e){var t=this;return y.resolve(this.db.transaction("rw",this.table,(function(){return t.table.bulkDelete(e)}))).catch((function(e){throw I(e,"bulkRemove",t.table.name),e}))}},{key:"all",value:function(e){var t=this,n=x(this.table.orderBy(e&&e.index?E(e.index):":id"),e),r=null;switch(null==e?void 0:e.returnKeyType){case"keys":r=y.resolve(n.keys());break;case"primary_key":r=y.resolve(n.primaryKeys());break;default:r=y.resolve(n.toArray()).then((function(e){return t.asyncViewMap(e)}))}return r.catch((function(e){throw I(e,"all",t.table.name),e}))}},{key:"count",value:function(){var e=this;return y.resolve(this.table.count()).catch((function(t){throw I(t,"count",e.table.name),t}))}},{key:"equals",value:function(e,t,n){var r=this;return y.resolve(x(this.table.where(E(e)).equals(t),n).toArray()).then((function(e){return r.asyncViewMap(e)})).catch((function(e){throw I(e,"equals",r.table.name),e}))}},{key:"anyOf",value:function(e,t,n){var r=this;return y.resolve(x(this.table.where(E(e)).anyOf(t),n).toArray()).then((function(e){return r.asyncViewMap(e)})).catch((function(e){throw I(e,"anyOf",r.table.name),e}))}},{key:"greaterThan",value:function(e,t,n){var r=this,i=n&&n.inclusive?this.table.where(E(e)).aboveOrEqual(t):this.table.where(E(e)).above(t);return y.resolve(x(i,n).toArray()).then((function(e){return r.asyncViewMap(e)})).catch((function(e){throw I(e,"greaterThan",r.table.name),e}))}},{key:"lessThan",value:function(e,t,n){var r=this,i=n&&n.inclusive?this.table.where(E(e)).belowOrEqual(t):this.table.where(E(e)).below(t);return y.resolve(x(i,n).toArray()).then((function(e){return r.asyncViewMap(e)})).catch((function(e){throw I(e,"lessThan",r.table.name),e}))}},{key:"between",value:function(e,t,n,r){var i=this,a=x(this.table.where(E(e)).between(t,n,!(!r||!r.lowerInclusive),!(!r||!r.upperInclusive)),r),o=null;switch(null==r?void 0:r.returnKeyType){case"keys":o=y.resolve(a.keys());break;case"primary_key":o=y.resolve(a.primaryKeys());break;default:o=y.resolve(a.toArray()).then((function(e){return i.asyncViewMap(e)}))}return o.catch((function(e){throw I(e,"between",i.table.name),e}))}},{key:"forEachSortedBy",value:function(e,t){var n=this;return this.table.orderBy(e).each(function(){var e=(0,s.default)(o.default.mark((function e(r){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._decryptColumns(r);case 2:return i=e.sent,e.abrupt("return",t(i));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()).catch((function(e){throw I(e,"forEachSortedBy",n.table.name),e}))}},{key:"forEach",value:function(e){var t=this;return this.table.each(function(){var n=(0,s.default)(o.default.mark((function n(r){var i;return o.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t._decryptColumns(r);case 2:return i=n.sent,n.abrupt("return",e(i));case 4:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}()).catch((function(e){throw I(e,"forEach",t.table.name),e}))}},{key:"clear",value:function(){var e=this;return y.resolve(this.table.clear()).catch((function(t){throw I(t,"clear",e.table.name),t}))}},{key:"_primaryKey",value:function(){return this.table.schema.primKey.name}},{key:"_hasEncryptedColumn",value:function(){return this.tableEncryptedColumns.size>0}}]),e}(),w=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O;(0,u.default)(this,e),this.tableNames=new Map,this.tableColumns=new Map,this.tableEncryptedColumns=new Map,this.name=t,this.db=new f.default(this.name),this.transformSchema=n}return(0,c.default)(e,[{key:"initialize",value:function(e,t,n){var r=this;return function(e,t,n,r,i){return Promise.reduce(e,(function(e,a){return i((0,h.cloneSchema)(a)).then((function(i){(0,l.default)(!(i.name in e),"Multiple tables resulted in the same transformed name"),t.set(a.name,i.name),n.set(a.name,i.columns.map((function(e){return e.name}))),r.set(a.name,i.encryptedColumns||{});var o=i.columns.filter((function(e){return e.primaryKey}));(0,l.default)(o.length>=1,'No primary key was defined for "'.concat(a.name,'"'));var u=[j(o)].concat(i.indexes.map(k)).join(", ");return e[i.name]=u,e}))}),{})}(t,this.tableNames,this.tableColumns,this.tableEncryptedColumns,this.transformSchema).then((function(t){r.db.version(e+1).stores(t).upgrade((function(e){var t;if(n)return null===(t=e[n.name])||void 0===t?void 0:t.toCollection().modify(n.callback)}))}))}},{key:"open",value:function(){return y.resolve(this.db.open())}},{key:"transact",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rw";return y.resolve(this.db.transaction(n,e,(function(){return t()})))}},{key:"close",value:function(){return this.db.close(),y.resolve()}},{key:"view",value:function(e,t,n){(0,l.default)(this.tableNames.has(e),'Attemped to get view for uninitialized table "'.concat(e,'"')),(0,l.default)(this.tableColumns.has(e),'Attemped to get columns for uninitialized table "'.concat(e,'"'));var r=n?function(e){if(!e)return function(e){return e};return function(t){var n={};return e.forEach((function(e){t.hasOwnProperty(e)&&(n[e]=t[e])})),n}}(this.tableColumns.get(e)):function(e){return e};return new _(this.db.table(this.tableNames.get(e)),this.db,t,r,(0,d.default)(this.tableEncryptedColumns.get(e),"this.tableEncryptedColumns.get(table)"))}},{key:"available",value:function(){return y.resolve(!0)}},{key:"reset",value:function(){var e=this;return this.tableNames=new Map,y.resolve(this.db.delete()).finally((function(){e.db=new f.default(e.name)}))}}]),e}();function j(e){if(e.length>1)return e.forEach((function(e){(0,l.default)(e.primaryKey&&e.primaryKey===h.PRIMARY_KEY_TYPE.COMPOSITE,"Invalid column passed to `formatPrimaryKey`")})),"[".concat(e.map((function(e){return e.name})).join("+"),"]");var t=e[0];return(0,l.default)(t.primaryKey&&t.primaryKey!==h.PRIMARY_KEY_TYPE.COMPOSITE,"Invalid column passed to `formatPrimaryKey`"),t.primaryKey===h.PRIMARY_KEY_TYPE.AUTO_INCREMENT?"".concat(t.name,"++"):t.name}function k(e){switch(e.type){case h.INDEX_TYPE.SIMPLE:return e.column;case h.INDEX_TYPE.COMPOSITE:return"[".concat(e.columns.join("+"),"]");case h.INDEX_TYPE.ARRAY:return"*".concat(e.column);case h.INDEX_TYPE.UNIQUE:return"&".concat(e.column)}throw new Error('Cannot format index of type "'.concat(e.type,'"'))}function E(e){return 1===e.length?e[0]:"[".concat(e.join("+"),"]")}function x(e,t){var n=e;return t&&t.reverse&&(n=n.reverse()),t&&null!=t.offset&&(n=n.offset(t.offset)),t&&null!=t.limit&&0!==t.limit&&(n=n.limit(t.limit)),n}function O(e){return y.resolve(e)}function I(e,t,n){__LOG__(3,!0)(p(),t,n),__LOG__(1)(v(),t)}t.default=w},bdbhhedcfi:function(e,t,n){"use strict";function r(e,t){var n=function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];var o=t?t.apply(this,i):i[0];if(!o)return e.apply(this,i);var u=n.cache;if(u.has(o))return u.get(o);var c=e.apply(this,i);return n.cache=u.set(o,c)||u,c};return n.cache=new(r.Cache||Map),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r.Cache=Map;var i=r;t.default=i},bdeiidaeje:function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},bdhhdbcefi:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).column=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this,n=e.columns.find((function(e){return e.name===t.column}));(0,s.default)(n,'Attempted to add index on non-existent column "'.concat(this.column,'" in "').concat(e.name,'"')),(0,s.default)(n&&(!n.primaryKey||n.primaryKey===l.PRIMARY_KEY_TYPE.COMPOSITE),'Cannot add index on primary key on table "'.concat(e.name,'"')),(0,s.default)(!e.indexes.some((function(e){return(e.type===l.INDEX_TYPE.ARRAY||e.type===l.INDEX_TYPE.SIMPLE||e.type===l.INDEX_TYPE.UNIQUE)&&(0,l.indexContainsColumn)(e,t.column)})),'Attempted to add index "'.concat(this.column,'" which already exists in "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e);return t.indexes.push(this._getIndex()),t}},{key:"_getIndex",value:function(){return{type:l.INDEX_TYPE.ARRAY,column:this.column}}}]),t}(f.default);t.default=d},bdhjjchdia:function(e,t,n){var r=n("cjedcdbdii"),i=n("bedeadcjdb"),a=n("bdeiidaeje"),o=n("bcdieeaibb");function u(t){var n="function"==typeof Map?new Map:void 0;return e.exports=u=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},u(t)}e.exports=u},bedeadcjdb:function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},bedffdibce:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeMessagesFromHistory=function(){return Promise.resolve()},self.Promise=n("geadgcffe").default},bfagiaicdd:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.emptySchema=function(e){return{name:e,columns:[],indexes:[],encryptedColumns:{}}},t.cloneSchema=function(e){return{name:e.name,columns:e.columns.map((function(e){return u({},e)})),indexes:e.indexes.map(l),encryptedColumns:u({},e.encryptedColumns||{})}},t.freezeSchema=function(e){return Object.freeze({name:e.name,columns:Object.freeze(e.columns.map(Object.freeze)),indexes:Object.freeze(e.indexes.map(f)),encryptedColumns:Object.freeze(u({},e.encryptedColumns||{}))})},t.findIndex=function(e,t){return e.indexes.findIndex((function(e){return function(e,t){if(e.type!==t.type)return!1;switch(e.type){case s.SIMPLE:case s.ARRAY:case s.UNIQUE:return(0,a.default)(t.type===e.type,"Index types are not equal"),e.column===t.column;case s.COMPOSITE:return(0,a.default)(t.type===e.type,"Index types are not equal"),e.columns.length===t.columns.length&&!e.columns.some((function(e){return!t.columns.includes(e)}))}throw new Error("cannot compare unknown indexes of types: ".concat(e.type,", ").concat(t.type))}(t,e)}))},t.indexContainsColumn=function(e,t){switch(e.type){case s.SIMPLE:case s.ARRAY:case s.UNIQUE:return e.column===t;case s.COMPOSITE:return!!e.columns.find((function(e){return e===t}))}throw new Error("cannot check indexes of unknown index type: ".concat(e.type))},t.INDEX_TYPE=t.PRIMARY_KEY_TYPE=void 0;var i=r(n("bhabhhjdch")),a=r(n("cgeeeeddea"));n("dhdjjbcibj");function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var c=Object.freeze({AUTO_INCREMENT:"auto-increment",USER_DEFINED:"user-defined",COMPOSITE:"composite"});t.PRIMARY_KEY_TYPE=c;var s=Object.freeze({SIMPLE:"simple",COMPOSITE:"composite",ARRAY:"array",UNIQUE:"unique"});function f(e){switch(e.type){case s.SIMPLE:return Object.freeze({type:s.SIMPLE,column:e.column});case s.ARRAY:return Object.freeze({type:s.ARRAY,column:e.column});case s.COMPOSITE:return Object.freeze({type:s.COMPOSITE,columns:Object.freeze(e.columns.map(Object.freeze))});case s.UNIQUE:return Object.freeze({type:s.UNIQUE,column:e.column})}throw new Error("cannot freeze index of unknown type: ".concat(e.type))}function l(e){switch(e.type){case s.SIMPLE:return{type:s.SIMPLE,column:e.column};case s.UNIQUE:return{type:s.UNIQUE,column:e.column};case s.COMPOSITE:return{type:s.COMPOSITE,columns:e.columns.map((function(e){return e}))};case s.ARRAY:return{type:s.ARRAY,column:e.column}}throw new Error("cannot clone unknown index type: ".concat(e.type))}t.INDEX_TYPE=s},bfcgiihhaf:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.initializeWithoutGKs=function(){null==l&&((0,c.createStorage)(),(0,u.addTable)(),(0,o.addTable)(),(0,s.addTable)(),l=(0,c.getStorage)().initialize().catch((function(e){throw __LOG__(4,!0,new Error)(f()),SEND_LOGS("Failed to initialize model storage"),e})));return l},t.destroy=function(){return(0,c.destroyStorage)().catch((function(){return d.resolve(new a.default(c.DATABASE_NAME).delete())})).finally((function(){l=null}))},t.clearInitializePromise=function(){l=null},Object.defineProperty(t,"getCollectionVersionTable",{enumerable:!0,get:function(){return o.getTable}}),Object.defineProperty(t,"getPendingMutationsTable",{enumerable:!0,get:function(){return u.getTable}}),Object.defineProperty(t,"getSyncActionsTable",{enumerable:!0,get:function(){return s.getTable}});var i=r(n("dfadhaifh")),a=r(n("ccddaicfff")),o=n("eafdicgcb"),u=n("cfaiaedcf"),c=n("ffjiicch"),s=n("ecjageddib");function f(){var e=(0,i.default)(["Assertion failed!"]);return f=function(){return e},e}var l,d=n("geadgcffe").default},bfefjaegfe:function(e,t,n){"use strict";var r=n("ebjighhbai");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("bbieaaebag")),a=r(n("hedaedjec")),o=n("cdiijcehcb"),u=new Uint8Array(10),c=new Uint8Array(0),s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,i.default)(this,e),t instanceof ArrayBuffer?(this._buffer=new Uint8Array(t),this._readEndIndex=this._writeIndex=t.byteLength):t instanceof Uint8Array&&(this._buffer=t,this._readEndIndex=this._writeIndex=t.length),this._bytesTrashed=0,this._earliestIndex=this._readIndex=0,this._view=null,this._littleEndian=n,this._hiddenReads=0,this._hiddenWrites=0}return(0,a.default)(e,[{key:"size",value:function(){return this._readEndIndex-this._readIndex}},{key:"peek",value:function(e,t){this._hiddenReads++;var n=this._readIndex,r=this._bytesTrashed;try{return e(this,t)}finally{this._hiddenReads--,this._readIndex=n-(this._bytesTrashed-r)}}},{key:"advance",value:function(e){p(this,e)}},{key:"readUint8",value:function(){return this._buffer[p(this,1)]}},{key:"readInt8",value:function(){var e=p(this,1);return v(this).getInt8(e)}},{key:"readUint16",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian,t=p(this,2);return v(this).getUint16(t,e)}},{key:"readInt32",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian,t=p(this,4);return v(this).getInt32(t,e)}},{key:"readUint32",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian,t=p(this,4);return v(this).getUint32(t,e)}},{key:"readInt64",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian;return b(!0,e,this)}},{key:"readUint64",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian;return b(!1,e,this)}},{key:"readFloat32",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian,t=p(this,4);return v(this).getFloat32(t,e)}},{key:"readFloat64",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._littleEndian,t=p(this,8);return v(this).getFloat64(t,e)}},{key:"readVarInt",value:function(){var e,t=this._readIndex,n=this._readEndIndex-t,r=this._buffer;n<=0&&p(this,1);var i=r[t];for(e=1;e<n&&e<11&&128&i;e++)i=r[t+e];var a=e;if(a>10||10===a&&r[t+9]>1)throw new Error("ParseError: varint exceeds 64 bits");128&i&&p(this,a+1),p(this,a);var o=0,u=0;for(e=0;e<3&&e<a;e++,u+=7)o|=(127&r[t+e])<<u;if(a<4)return o;var c=0;for(u=0,e=3;e<6&&e<a;e++,u+=7)c|=(127&r[t+e])<<u;if(a<5)return c<<21|o;if(a<7)return 2097152*c+o;var s=0;for(u=0,e=6;e<9&&e<a;e++,u+=7)s|=(127&r[t+e])<<u;return 10===a&&(s|=(1&r[t+9])<<21),_(!0,s<<10|c>>11,c<<21|o)}},{key:"readVarIntToHex",value:function(){var e,t=this._readIndex,n=this._buffer,r=t,i=0,a=0,u=[];do{if(p(this,1),e=n[r++],0===i)u.push(o.HEX_LOWER[15&e]),i=3,a=(127&e)>>4;else{var c=(e&15>>i)<<i|a;u.push(o.HEX_LOWER[c]);var s=e>>4-i&15;a=(127&e)>>7-(i-=1),(s>0||a>0||128&e)&&u.push(o.HEX_LOWER[s])}}while(128&e);return a>0&&u.push(o.HEX_LOWER[a]),String.fromCharCode.apply(String,u.reverse())}},{key:"readBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.size();if(0===e)return new ArrayBuffer(0);var t=p(this,e),n=this._buffer,r=t+n.byteOffset,i=n.buffer;return 0===r&&this._readIndex===i.byteLength?i:i.slice(r,r+e)}},{key:"readByteArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.size();if(0===e)return new Uint8Array(0);var t=p(this,e);return this._buffer.subarray(t,t+e)}},{key:"readBinary",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.size(),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;if(0===t)return new e(void 0,n);var r=p(this,t),i=this._buffer.subarray(r,r+t);return new e(i,n)}},{key:"indexOf",value:function(e){if(0===e.length)return 0;for(var t=this._buffer,n=this._readEndIndex,r=this._readIndex,i=0,a=r,o=r;o<n;o++)if(t[o]===e[i]){if(0===i&&(a=o),++i===e.byteLength)return o-r-e.byteLength+1}else i>0&&(i=0,o=a);return-1}},{key:"readString",value:function(e){for(var t,n=p(this,e),r=n+e,i=this._buffer,a=[],o=n;o<r;o++){a.length>5e3&&(t||(t=[]),t.push(String.fromCharCode.apply(String,a)),a=[]);var u=0|i[o];if(0==(128&u))a.push(u);else if(192==(224&u)){var c=w(i,o+1,r);if(c){o++;var s=(31&u)<<6|63&c;s>=128?a.push(s):a.push(65533)}else a.push(65533)}else if(224==(240&u)){var f=w(i,o+1,r),l=w(i,o+2,r);if(f&&l){o+=2;var d=(15&u)<<12|(63&f)<<6|63&l;d>=2048&&!(55296<=d&&d<57344)?a.push(d):a.push(65533)}else f?(o++,a.push(65533)):a.push(65533)}else if(240==(248&u)){var h=w(i,o+1,r),v=w(i,o+2,r),y=w(i,o+3,r);if(h&&v&&y){o+=3;var g=(7&u)<<18|(63&h)<<12|(63&v)<<6|63&y;if(g>=65536&&g<=1114111){var b=g-65536;a.push(55296|b>>10,56320|1023&b)}else a.push(65533)}else h&&v?(o+=2,a.push(65533)):h?(o++,a.push(65533)):a.push(65533)}else a.push(65533)}var m=String.fromCharCode.apply(String,a);return t?(t.push(m),t.join("")):m}},{key:"ensureCapacity",value:function(e){g(this,this._readIndex+e)}},{key:"ensureAdditionalCapacity",value:function(e){g(this,this._writeIndex+e)}},{key:"write",value:function(){for(var t=0;t<arguments.length;t++){var n=t<0||arguments.length<=t?void 0:arguments[t];"string"==typeof n?this.writeString(n):"number"==typeof n?this.writeUint8(n):n instanceof e?this.writeBinary(n):n instanceof ArrayBuffer?this.writeBuffer(n):n instanceof Uint8Array&&this.writeByteArray(n)}}},{key:"writeUint8",value:function(e){h(e,0,256,"uint8");var t=y(this,1);this._buffer[t]=e}},{key:"writeInt8",value:function(e){h(e,-128,128,"signed int8");var t=y(this,1);this._buffer[t]=e}},{key:"writeUint16",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,0,65536,"uint16");var n=y(this,2);v(this).setUint16(n,e,t)}},{key:"writeInt16",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,-32768,32768,"signed int16");var n=y(this,2);v(this).setInt16(n,e,t)}},{key:"writeUint32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,0,4294967296,"uint32");var n=y(this,4);v(this).setUint32(n,e,t)}},{key:"writeInt32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,-2147483648,2147483648,"signed int32");var n=y(this,4);v(this).setInt32(n,e,t)}},{key:"writeUint64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,0,0x10000000000000000,"uint64"),m(e,t,this)}},{key:"writeInt64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian;h(e,-0x8000000000000000,0x8000000000000000,"signed int64"),m(e,t,this)}},{key:"writeFloat32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian,n=y(this,4);v(this).setFloat32(n,e,t)}},{key:"writeFloat64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._littleEndian,n=y(this,8);v(this).setFloat64(n,e,t)}},{key:"writeVarInt",value:function(e){var t=e;h(t,-0x8000000000000000,0x8000000000000000,"varint (signed int64)");var n=t<0;n&&(t=-t);for(var r=(t<128?1:t<16384&&2)||t<2097152&&3||t<268435456&&4||t<34359738368&&5||t<4398046511104&&6||t<562949953421312&&7||t<72057594037927940&&8||9,i=y(this,n?10:r),a=this._buffer,o=t,u=i,c=r;c>4;c--){var s=Math.floor(o/128),f=o-128*s;a[u++]=128|127&f,o=s}for(;c>1;c--)a[u++]=128|127&o,o>>=7;if(a[u++]=o,n){for(var l=i;l<u;l++)a[l]=128|127&~a[l];for(var d=u;d<i+9;d++)a[d]=255;a[i+9]=1;for(var v=255,p=i;p<i+9&&255===v;p++)v=a[p],a[p]=255===v?128:v+1}}},{key:"writeVarIntFromHex",value:function(e){var t=e.replace(/^0+/,"")||"0",n=(0,o.hexOrThrow)(t),r=t.length;if(r>16)throw new Error("WriteError: given hex exceeded 64 bits");for(var i=y(this,(r<2?1:2===r&&n<"80"&&1)||r<4&&2||4===r&&n<"4000"&&2||r<6&&3||6===r&&n<"200000"&&3||r<8&&4||8===r&&n<"10000000"&&4||r<9&&5||9===r&&n<"800000000"&&5||r<11&&6||11===r&&n<"40000000000"&&6||r<13&&7||13===r&&n<"2000000000000"&&7||r<15&&8||15===r&&n<"100000000000000"&&8||n<"8000000000000000"&&9||10),a=this._buffer,u=0,c=0,s=i,f=r-1;f>=0;){if(3===u){var l=(0,o.hexAt)(n,f)<<3|c;a[s]=127&l,u=0,c=0,f--}else{var d=c|(0,o.hexAt)(n,f)<<u|(0===f?0:(0,o.hexAt)(n,f-1)<<u+4);a[s]=127&d,c=d>>7,u++,f-=2}(f>=0||c>0)&&(a[s]|=128),s++}c>0&&(a[s]=c)}},{key:"writeBinary",value:function(e){var t=e._readIndex,n=e._readEndIndex;if(t!==n){var r=y(this,n-t);this._buffer.set(e._buffer.subarray(t,n),r)}}},{key:"writeBuffer",value:function(e){this.writeByteArray(new Uint8Array(e))}},{key:"writeByteArray",value:function(e){var t=y(this,e.length);this._buffer.set(e,t)}},{key:"writeBufferView",value:function(e){this.writeByteArray(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}},{key:"writeString",value:function(e){for(var t=y(this,d(e)),n=this._buffer,r=e.length,i=0;i<r;i++){var a=e.charCodeAt(i);if(a<128)n[t++]=a;else if(a<2048)n[t++]=192|a>>6,n[t++]=128|63&a;else if(a<55296||57344<=a)n[t++]=224|a>>12,n[t++]=128|a>>6&63,n[t++]=128|63&a;else if(55296<=a&&a<56320&&i+1!==r){var o=e.charCodeAt(i+1);if(56320<=o&&o<57344){i++;var u=65536+((1023&a)<<10|1023&o);n[t++]=240|u>>18,n[t++]=128|u>>12&63,n[t++]=128|u>>6&63,n[t++]=128|63&u}else n[t++]=239,n[t++]=191,n[t++]=189}else n[t++]=239,n[t++]=191,n[t++]=189}}},{key:"writeHex",value:function(e){var t=e.length;if(t%2!=0)throw new Error('WriteError: given hex "'.concat(e,'" which is not a multiple of 8-bits.'));for(var n=(0,o.hexOrThrow)(e),r=y(this,t>>1),i=this._buffer,a=0,u=0;a<t;a+=2,u++)i[r+u]=(0,o.hexAt)(n,a)<<4|(0,o.hexAt)(n,a+1)}},{key:"writeBytes",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=0;r<t.length;r++)h(t[r],0,256,"byte");for(var i=y(this,t.length),a=this._buffer,o=0;o<t.length;o++)a[i+o]=arguments[o]}},{key:"writeWithVarIntLength",value:function(e,t){var n=this._writeIndex;!function(e,t,n){e._hiddenWrites++;var r=e._writeIndex,i=e._bytesTrashed;try{t(e,n),r=e._writeIndex,i=e._bytesTrashed}finally{e._hiddenWrites--,e._writeIndex=r-(e._bytesTrashed-i)}}(this,e,t);var r=this._writeIndex;this.writeVarInt(r-n);for(var i=this._writeIndex-r,a=this._buffer,o=0;o<i;o++)u[o]=a[r+o];for(var c=r-1;c>=n;c--)a[c+i]=a[c];for(var s=0;s<i;s++)a[n+s]=u[s]}}],[{key:"build",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=0;a<n.length;a++){var o=n[a];"string"==typeof o?i+=d(o):"number"==typeof o?i++:o instanceof e?i+=o.size():o instanceof ArrayBuffer?i+=o.byteLength:o instanceof Uint8Array&&(i+=o.length)}var u=new e;return u.ensureCapacity(i),u.write.apply(u,arguments),u}},{key:"onLongLong",value:function(e){throw new Error("ReadError: integer exceeded 53 bits (".concat(e,")"))}}]),e}();t.default=s;var f="",l=0;function d(e){if(e===f)return l;for(var t=e.length,n=0,r=0;r<t;r++){var i=e.charCodeAt(r);if(i<128)n++;else if(i<2048)n+=2;else if(i<55296||57344<=i&&i<=65535)n+=3;else if(55296<=i&&i<56320&&r+1!==t){var a=e.charCodeAt(r+1);56320<=a&&a<57344?(r++,n+=4):n+=3}else n+=3}return f=e,l=n}function h(e,t,n,r){if("number"!=typeof e||e!=e||Math.floor(e)!==e||e<t||e>=n)throw new TypeError("string"==typeof e?'WriteError: string "'.concat(e,'" is not a valid ').concat(r):"WriteError: ".concat(String(e)," is not a valid ").concat(r))}function v(e){return e._view||(e._view=new DataView(e._buffer.buffer,e._buffer.byteOffset))}function p(e,t){if(t<0)throw new Error("ReadError: given negative number of bytes to read");var n=e._readIndex,r=n+t;if(r>e._readEndIndex)throw new Error(n===e._readEndIndex?"ReadError: tried to read from depleted binary":"ReadError: tried to read beyond end of binary");return e._readIndex=r,e._hiddenReads||(e._earliestIndex=r),n}function y(e,t){var n=g(e,e._writeIndex+t),r=e._writeIndex;return e._writeIndex=n,e._hiddenWrites||(e._readEndIndex=n),r}function g(e,t){var n=e._buffer;if(t<=n.length)return t;var r=e._earliestIndex,i=t-r,a=Math.max(i,2*(n.length-r),64),o=new Uint8Array(a);return r?(o.set(n.subarray(r)),e._bytesTrashed+=r,e._readIndex-=r,e._readEndIndex-=r,e._writeIndex-=r,e._earliestIndex=0):o.set(n),e._buffer=o,e._view=null,i}function b(e,t,n){var r=p(n,8),i=v(n);return _(e,i.getInt32(t?r+4:r,t),i.getInt32(t?r:r+4,t))}function m(e,t,n){var r=y(n,8),i=e<0,a=i?-e:e,o=Math.floor(a/4294967296),u=v(n);if(u.setUint32(t?r+4:r,o,t),u.setUint32(t?r:r+4,a-4294967296*o,t),i){for(var c=n._buffer,s=r;s<r+8;s++)c[s]=255&~c[s];var f=255;if(t)for(var l=r;l<r+8&&255===f;l++)f=c[l],c[l]=255===f?0:f+1;else for(var d=r+7;d>=r&&255===f;d--)f=c[d],c[d]=255===f?0:f+1}}function _(e,t,n){var r=t>>21,i=4294967296*(t>=0?t:e?t:4294967296+t)+(n>=0?n:4294967296+n);return 0===r||e&&-1===r&&(2097151&t||n)?i:s.onLongLong(i,e,t,n)}function w(e,t,n){if(t>=n)return 0;var r=0|e[t];return 128==(192&r)?r:0}s.numUtf8Bytes=d},bfejgijfbh:function(e,t,n){var r=n("deaafaigjj");function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=a?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=e[o]}return n.default=e,t&&t.set(e,n),n}},bfffgggjic:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("bjehdcaaj")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=r(n("ciefddeegi")),d=n("bfagiaicdd"),h=function(e){function t(){return(0,i.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,s.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){(0,c.default)((0,u.default)(t.prototype),"validate",this).call(this,e),(0,f.default)(this.columns&&1===this.columns.length,"Attempted to add UserDefinedPrimaryKey over wrong number of columns")}},{key:"apply",value:function(e){var t=(0,d.cloneSchema)(e);return t.columns.unshift({name:this.columns[0],primaryKey:d.PRIMARY_KEY_TYPE.AUTO_INCREMENT}),t}}]),t}(l.default);t.default=h},bgdiiijdd:function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},bgjhiaabcf:function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n("bcdgbaaibb"),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n("bgdiiijdd"))},bhabhhjdch:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},bhabjiggjj:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.buildHandshakePayload=function(e){return{__command:a.HANDSHAKE_COMMAND,__port:e}},t.extractPortFromHandshakePayload=function(e){if(null!=e&&null!=e.__command&&e.__command===a.HANDSHAKE_COMMAND){if(null!=e.__port)return(0,i.default)(e.__port instanceof MessagePort,"Malformed connection payload"),e.__port}};var i=r(n("cgeeeeddea")),a=n("cggbhfdifh")},bhfcfhafdj:function(e,t,n){var r=n("bjihhfbihe"),i=n("jfjadidfi"),a=n("gfefdcejf"),o=n("hihjbfggf");e.exports=function(e){return r(e)||i(e)||a(e)||o()}},bhjiahgdac:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).keyPath=e,n.column=e.split(".")[0],n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this,n=e.columns.find((function(e){return e.name===t.column}));(0,s.default)(n,'Attempted to add index on non-existent column "'.concat(this.column,'" in "').concat(e.name,'"')),(0,s.default)(n&&(!n.primaryKey||n.primaryKey===l.PRIMARY_KEY_TYPE.COMPOSITE),'Cannot add index on primary key on table "'.concat(e.name,'"')),(0,s.default)(!e.indexes.some((function(e){return(e.type===l.INDEX_TYPE.ARRAY||e.type===l.INDEX_TYPE.SIMPLE||e.type===l.INDEX_TYPE.UNIQUE)&&(0,l.indexContainsColumn)(e,t.column)})),'Attempted to add index "'.concat(this.column,'" which already exists in "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e);return t.indexes.push(this._getIndex()),t}},{key:"_getIndex",value:function(){return{type:l.INDEX_TYPE.SIMPLE,column:this.keyPath}}}]),t}(f.default);t.default=d},bjcfcciaea:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.sortMutations=function(e){return(0,i.default)(e).sort(_)};var i=r(n("bhfcfhafdj")),a=r(n("cgeeeeddea")),o=r(n("bdhhdbcefi")),u=r(n("diaiajeedf")),c=r(n("djfjgifhj")),s=r(n("dhdjjbcibj")),f=r(n("bhjiahgdac")),l=r(n("dighidfgbc")),d=r(n("bfffgggjic")),h=r(n("cfagigdiib")),v=r(n("dgjadadgcb")),p=r(n("caiahabcfd")),y=r(n("ceccbdjfci")),g=r(n("dfbiiieiig")),b=r(n("ebhdfjjdeb")),m=[y.default,v.default,g.default,p.default,d.default,b.default,h.default,u.default,f.default,o.default,c.default,l.default,s.default];function _(e,t){var n=m.indexOf(e.constructor),r=m.indexOf(t.constructor);return(0,a.default)(-1!==n,"Mutation ".concat(e.constructor.name," is not a known mutation type")),(0,a.default)(-1!==r,"Mutation ".concat(e.constructor.name," is not a known mutation type")),n-r}},bjehdcaaj:function(e,t,n){var r=n("dejaibbcca");function i(t,n,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(n):a.value}},i(t,n,a||t)}e.exports=i},bjgidhichc:function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="function"==typeof WeakMap?new WeakMap:new Map;function a(e){var t=i.get(e);if(void 0!==t)return t;var n=Object.getOwnPropertyNames(e),r=new Set(n.map((function(t){return e[t]})));return i.set(e,r),r}var o=Object.preventExtensions(Object.defineProperties(Object.create(null),{isValid:{value(e){return a(this).has(e)}},cast:{value(e){return this.isValid(e)?e:void 0}},members:{value(){return a(this).values()}}}));function u(e){var t=Object.create(o);for(var n in e)e.hasOwnProperty(n)&&Object.defineProperty(t,n,{value:e[n]});return Object.preventExtensions(t),t}var c=Object.preventExtensions(Object.defineProperties(Object.create(null),{isValid:{value(e){return"string"==typeof e&&r.call(this,e)}},cast:{value(e){return this.isValid(e)?e:void 0}},members:{value(){return Object.getOwnPropertyNames(this)}}}));u.Mirrored=function(e){for(var t=Object.create(c),n=0,r=e.length;n<r;++n)Object.defineProperty(t,e[n],{value:e[n]});return Object.preventExtensions(t),t},Object.freeze(u),Object.freeze(u.Mirrored),e.exports=u},bjihhfbihe:function(e,t,n){var r=n("cgigihhddi");e.exports=function(e){if(Array.isArray(e))return r(e)}},cabjcaaibi:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.addTable=function(){(0,a.getStorage)().add("chat").version((0,u.chatCreateTable)(),[new o.default("id"),new i.default("t"),new i.default("unreadCount"),new i.default("archive"),new i.default("isReadOnly"),new i.default("isAnnounceGrpRestrict"),new i.default("modifyTag"),new i.default("muteExpiration"),new i.default("name"),new i.default("notSpam"),new i.default("pin"),new i.default("changeNumberOldJid"),new i.default("changeNumberNewJid"),new i.default("lastReceivedKey"),new i.default("endOfHistoryTransfer"),new i.default("ephemeralDuration"),new i.default("ephemeralSettingTimestamp")]).view((function(e){return{id:e.id,t:e.t,unreadCount:e.unreadCount,archive:e.archive,isReadOnly:e.isReadOnly,isAnnounceGrpRestrict:e.isAnnounceGrpRestrict,modifyTag:e.modifyTag,muteExpiration:e.muteExpiration,name:e.name,notSpam:e.notSpam,pin:e.pin,changeNumberOldJid:e.changeNumberOldJid,changeNumberNewJid:e.changeNumberNewJid,lastReceivedKey:e.lastReceivedKey,endOfHistoryTransfer:e.endOfHistoryTransfer,ephemeralDuration:e.ephemeralDuration,ephemeralSettingTimestamp:e.ephemeralSettingTimestamp}}))},t.getTable=function(){return(0,a.getStorage)().table("chat")};var i=r(n("diaiajeedf")),a=n("ffjiicch"),o=r(n("ebhdfjjdeb")),u=n("dijiihaecd")},cahfddcdga:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"?";if(null==e)throw new Error("Unexpected null or undefined: ".concat(t));return e}},caiahabcfd:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).name=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this,n=e.columns.find((function(e){return e.name===t.name}));(0,s.default)(n,'Attempted to remove column "'.concat(this.name,'" from "').concat(e.name,"\" but it doesn't exist")),(0,s.default)(!n.primaryKey,'Attempted to remove primary key column "'.concat(this.name,'". Removing primary keys is not supported.')),(0,s.default)(!e.indexes.some((function(e){return(0,l.indexContainsColumn)(e,t.name)})),'Attempted to remove column "'.concat(this.name,'" from "').concat(e.name,'" but an index exists with the column'))}},{key:"apply",value:function(e){var t=this,n=(0,l.cloneSchema)(e);return n.columns.splice(n.columns.findIndex((function(e){return e.name===t.name})),1),n}}]),t}(f.default);t.default=d},cbefiijcca:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.buildInvocationPayload=function(e){var t=e.invocationId,n=e.method,r=e.args;return{__id:t,__command:o.INVOCATION_COMMAND,__method:n,__args:r}},t.unwrapInvocationPayload=function(e){if(null!=e&&e.__command===o.INVOCATION_COMMAND){(0,i.default)(e.__id,"Invocation ID missing");var t=(0,a.extractInvocationId)(e.__id);(0,i.default)(null!=t&&e.__method&&"string"==typeof e.__method&&e.__id&&e.__args&&Array.isArray(e.__args),"Malformed invocation message");var n=e,r=n.__method,u=n.__args;return{method:r,args:u,invocationId:t}}};var i=r(n("cgeeeeddea")),a=n("cgcccbajji"),o=n("cggbhfdifh")},ccacajdfje:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},ccddaicfff:function(e,t,n){"use strict";n.r(t),function(e,n){var r=Object.keys,i=Array.isArray,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:e;function o(e,t){return"object"!=typeof t?e:(r(t).forEach((function(n){e[n]=t[n]})),e)}var u=Object.getPrototypeOf,c={}.hasOwnProperty;function s(e,t){return c.call(e,t)}function f(e,t){"function"==typeof t&&(t=t(u(e))),r(t).forEach((function(n){d(e,n,t[n])}))}var l=Object.defineProperty;function d(e,t,n,r){l(e,t,o(n&&s(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),d(e.prototype,"constructor",e),{extend:f.bind(null,e.prototype)}}}}var v=Object.getOwnPropertyDescriptor;var p=[].slice;function y(e,t,n){return p.call(e,t,n)}function g(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function m(e){a.setImmediate?n(e):setTimeout(e,0)}function _(e,t){return e.reduce((function(e,n,r){var i=t(n,r);return i&&(e[i[0]]=i[1]),e}),{})}function w(e,t){return function(){try{e.apply(this,arguments)}catch(e){t(e)}}}function j(e,t,n){try{e.apply(null,n)}catch(e){t&&t(e)}}function k(e,t){if(s(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var a=k(e,t[r]);n.push(a)}return n}var o=t.indexOf(".");if(-1!==o){var u=e[t.substr(0,o)];return void 0===u?void 0:k(u,t.substr(o+1))}}function E(e,t,n){if(e&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)E(e,t[r],n[r])}else{var a=t.indexOf(".");if(-1!==a){var o=t.substr(0,a),u=t.substr(a+1);if(""===u)void 0===n?delete e[o]:e[o]=n;else{var c=e[o];c||(c=e[o]={}),E(c,u,n)}}else void 0===n?delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)s(e,n)&&(t[n]=e[n]);return t}var O=[].concat;function I(e){return O.apply([],e)}var P="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(I([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return a[e]})).map((function(e){return a[e]}));function A(e){if(!e||"object"!=typeof e)return e;var t;if(i(e)){t=[];for(var n=0,r=e.length;n<r;++n)t.push(A(e[n]))}else if(P.indexOf(e.constructor)>=0)t=e;else for(var a in t=e.constructor?Object.create(e.constructor.prototype):{},e)s(e,a)&&(t[a]=A(e[a]));return t}function S(e,t,n,i){return n=n||{},i=i||"",r(e).forEach((function(r){if(s(t,r)){var a=e[r],o=t[r];"object"==typeof a&&"object"==typeof o&&a&&o&&""+a.constructor==""+o.constructor?S(a,o,n,i+r+"."):a!==o&&(n[i+r]=t[r])}else n[i+r]=void 0})),r(t).forEach((function(r){s(e,r)||(n[i+r]=t[r])})),n}var T="undefined"!=typeof Symbol&&Symbol.iterator,C=T?function(e){var t;return null!=e&&(t=e[T])&&t.apply(e)}:function(){return null},M={};function R(e){var t,n,r,a;if(1===arguments.length){if(i(e))return e.slice();if(this===M&&"string"==typeof e)return[e];if(a=C(e)){for(n=[];!(r=a.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var N="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function D(e,t){N=e,F=t}var F=function(){return!0},L=!new Error("").stack;function K(){if(L)try{throw K.arguments,new Error}catch(e){return e}return new Error}function U(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(F).map((function(e){return"\n"+e})).join("")):""}var B=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Y=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(B),V={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function z(e,t){this._e=K(),this.name=e,this.message=t}function q(e,t,n,r){this._e=K(),this.failures=t,this.failedKeys=r,this.successCount=n}function H(e,t){this._e=K(),this.name="BulkError",this.failures=t,this.message=function(e,t){return e+". Errors: "+t.map((function(e){return e.toString()})).filter((function(e,t,n){return n.indexOf(e)===t})).join("\n")}(e,t)}h(z).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+U(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(q).from(z),h(H).from(z);var W=Y.reduce((function(e,t){return e[t]=t+"Error",e}),{}),G=z,X=Y.reduce((function(e,t){var n=t+"Error";function r(e,r){this._e=K(),this.name=n,e?"string"==typeof e?(this.message=e,this.inner=r||null):"object"==typeof e&&(this.message=e.name+" "+e.message,this.inner=e):(this.message=V[t]||n,this.inner=null)}return h(r).from(G),e[t]=r,e}),{});X.Syntax=SyntaxError,X.Type=TypeError,X.Range=RangeError;var Q=B.reduce((function(e,t){return e[t+"Error"]=X[t],e}),{});var J=Y.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=X[t]),e}),{});function $(){}function Z(e){return e}function ee(e,t){return null==e||e===Z?t:function(n){return t(e(n))}}function te(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ne(e,t){return e===$?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?te(r,this.onsuccess):r),i&&(this.onerror=this.onerror?te(i,this.onerror):i),void 0!==a?a:n}}function re(e,t){return e===$?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?te(n,this.onsuccess):n),r&&(this.onerror=this.onerror?te(r,this.onerror):r)}}function ie(e,t){return e===$?t:function(n){var r=e.apply(this,arguments);o(n,r);var i=this.onsuccess,a=this.onerror;this.onsuccess=null,this.onerror=null;var u=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?te(i,this.onsuccess):i),a&&(this.onerror=this.onerror?te(a,this.onerror):a),void 0===r?void 0===u?void 0:u:o(r,u)}}function ae(e,t){return e===$?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function oe(e,t){return e===$?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,a=new Array(i);i--;)a[i]=arguments[i];return n.then((function(){return t.apply(r,a)}))}return t.apply(this,arguments)}}J.ModifyError=q,J.DexieError=z,J.BulkError=H;var ue={},ce=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var e=a.Promise;return e?[e.resolve(),e.prototype,e.resolve()]:[]}}(),se=ce[0],fe=ce[1],le=ce[2],de=fe&&fe.then,he=se&&se.constructor,ve=ce[3],pe=!!le,ye=!1,ge=le?function(){le.then(Ke)}:a.setImmediate?n.bind(null,Ke):a.MutationObserver?function(){var e=document.createElement("div");new MutationObserver((function(){Ke(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Ke,0)},be=function(e,t){Ie.push([e,t]),_e&&(ge(),_e=!1)},me=!0,_e=!0,we=[],je=[],ke=null,Ee=Z,xe={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ct,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(e){try{ct(e[0],e[1])}catch(e){}}))}},Oe=xe,Ie=[],Pe=0,Ae=[];function Se(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=$,this._lib=!1;var t=this._PSD=Oe;if(N&&(this._stackHolder=K(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ue)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Me(this,e)}var Te={get:function(){var e=Oe,t=Xe;function n(n,r){var i=this,a=!e.global&&(e!==Oe||t!==Xe);a&&Ze();var o=new Se((function(t,o){De(i,new Ce(ot(n,e,a),ot(r,e,a),t,o,e))}));return N&&Le(o,this),o}return n.prototype=ue,n},set:function(e){d(this,"then",e&&e.prototype===ue?Te:{get:function(){return e},set:Te.set})}};function Ce(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function Me(e,t){try{t((function(t){if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Me(e,(function(e,n){t instanceof Se?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Ne(e)),n&&Be()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(je.push(t),null===e._state){var n=e._lib&&Ue();t=Ee(t),e._state=!1,e._value=t,N&&null!==t&&"object"==typeof t&&!t._promise&&j((function(){var n=function e(t,n){var r;return v(t,n)||(r=u(t))&&e(r,n)}(t,"stack");t._promise=e,d(t,"stack",{get:function(){return ye?n&&(n.get?n.get.apply(t):n.value):e.stack}})})),function(e){we.some((function(t){return t._value===e._value}))||we.push(e)}(e),Ne(e),n&&Be()}}function Ne(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)De(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===Pe&&(++Pe,be((function(){0==--Pe&&Ye()}),[]))}function De(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Pe,be(Fe,[n,e,t])}else e._listeners.push(t)}function Fe(e,t,n){try{ke=t;var r,i=t._value;t._state?r=e(i):(je.length&&(je=[]),r=e(i),-1===je.indexOf(i)&&function(e){var t=we.length;for(;t;)if(we[--t]._value===e._value)return void we.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{ke=null,0==--Pe&&Ye(),--n.psd.ref||n.psd.finalize()}}function Le(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Ke(){Ue()&&Be()}function Ue(){var e=me;return me=!1,_e=!1,e}function Be(){var e,t,n;do{for(;Ie.length>0;)for(e=Ie,Ie=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ie.length>0);me=!0,_e=!0}function Ye(){var e=we;we=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=Ae.slice(0),n=t.length;n;)t[--n]()}function Ve(e){return new Se(ue,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),i=Oe;try{return rt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{rt(i,!1),r&&Be()}}}f(Se.prototype,{then:Te,_then:function(e,t){De(this,new Ce(null,null,e,t,Oe))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return e instanceof t?n(e):Ve(e)})):this.then(null,(function(e){return e&&e.name===t?n(e):Ve(e)}))},finally:function(e){return this.then((function(t){return e(),t}),(function(t){return e(),Ve(t)}))},stack:{get:function(){if(this._stack)return this._stack;try{ye=!0;var e=function e(t,n,r){if(n.length===r)return n;var i="";if(!1===t._state){var a,o,u=t._value;null!=u?(a=u.name||"Error",o=u.message||u,i=U(u,0)):(a=u,o=""),n.push(a+(o?": "+o:"")+i)}N&&((i=U(t._stackHolder,2))&&-1===n.indexOf(i)&&n.push(i),t._prev&&e(t._prev,n,r));return n}(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ye=!1}}},timeout:function(e,t){var n=this;return e<1/0?new Se((function(r,i){var a=setTimeout((function(){return i(new X.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,a))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(Se.prototype,Symbol.toStringTag,"Promise"),xe.env=it(),f(Se,{all:function(){var e=R.apply(null,arguments).map(et);return new Se((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,a){return Se.resolve(i).then((function(n){e[a]=n,--r||t(e)}),n)}))}))},resolve:function(e){if(e instanceof Se)return e;if(e&&"function"==typeof e.then)return new Se((function(t,n){e.then(t,n)}));var t=new Se(ue,!0,e);return Le(t,ke),t},reject:Ve,race:function(){var e=R.apply(null,arguments).map(et);return new Se((function(t,n){e.map((function(e){return Se.resolve(e).then(t,n)}))}))},PSD:{get:function(){return Oe},set:function(e){return Oe=e}},newPSD:Je,usePSD:at,scheduler:{get:function(){return be},set:function(e){be=e}},rejectionMapper:{get:function(){return Ee},set:function(e){Ee=e}},follow:function(e,t){return new Se((function(n,r){return Je((function(t,n){var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=te((function(){var e=this;!function(e){Ae.push((function t(){e(),Ae.splice(Ae.indexOf(t),1)})),++Pe,be((function(){0==--Pe&&Ye()}),[])}((function(){0===e.unhandleds.length?t():n(e.unhandleds[0])}))}),r.finalize),e()}),t,n,r)}))}});var qe={awaits:0,echoes:0,id:0},He=0,We=[],Ge=0,Xe=0,Qe=0;function Je(e,t,n,r){var i=Oe,a=Object.create(i);a.parent=i,a.ref=0,a.global=!1,a.id=++Qe;var u=xe.env;a.env=pe?{Promise:Se,PromiseProp:{value:Se,configurable:!0,writable:!0},all:Se.all,race:Se.race,resolve:Se.resolve,reject:Se.reject,nthen:ut(u.nthen,a),gthen:ut(u.gthen,a)}:{},t&&o(a,t),++i.ref,a.finalize=function(){--this.parent.ref||this.parent.finalize()};var c=at(a,e,n,r);return 0===a.ref&&a.finalize(),c}function $e(){return qe.id||(qe.id=++He),++qe.awaits,qe.echoes+=7,qe.id}function Ze(e){!qe.awaits||e&&e!==qe.id||(0==--qe.awaits&&(qe.id=0),qe.echoes=7*qe.awaits)}function et(e){return qe.echoes&&e&&e.constructor===he?($e(),e.then((function(e){return Ze(),e}),(function(e){return Ze(),st(e)}))):e}function tt(e){++Xe,qe.echoes&&0!=--qe.echoes||(qe.echoes=qe.id=0),We.push(Oe),rt(e,!0)}function nt(){var e=We[We.length-1];We.pop(),rt(e,!1)}function rt(e,t){var n,r=Oe;if((t?!qe.echoes||Ge++&&e===Oe:!Ge||--Ge&&e===Oe)||(n=t?tt.bind(null,e):nt,de.call(se,n)),e!==Oe&&(Oe=e,r===xe&&(xe.env=it()),pe)){var i=xe.env.Promise,o=e.env;fe.then=o.nthen,i.prototype.then=o.gthen,(r.global||e.global)&&(Object.defineProperty(a,"Promise",o.PromiseProp),i.all=o.all,i.race=o.race,i.resolve=o.resolve,i.reject=o.reject)}}function it(){var e=a.Promise;return pe?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:e.all,race:e.race,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function at(e,t,n,r,i){var a=Oe;try{return rt(e,!0),t(n,r,i)}finally{rt(a,!1)}}function ot(e,t,n){return"function"!=typeof e?e:function(){var r=Oe;n&&$e(),rt(t,!0);try{return e.apply(this,arguments)}finally{rt(r,!1)}}}function ut(e,t){return function(n,r){return e.call(this,ot(n,t,!1),ot(r,t,!1))}}function ct(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,i={promise:t,reason:e};if(a.document&&document.createEvent?((r=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),o(r,i)):a.CustomEvent&&o(r=new CustomEvent("unhandledrejection",{detail:i}),i),r&&a.dispatchEvent&&(dispatchEvent(r),!a.PromiseRejectionEvent&&a.onunhandledrejection))try{a.onunhandledrejection(r)}catch(e){}r.defaultPrevented||console.warn("Unhandled rejection: "+(e.stack||e))}catch(e){}}var st=Se.reject;function ft(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,a=new Array(i-1);--i;)a[i-1]=arguments[i];return t[n].subscribe.apply(null,a),e}if("string"==typeof n)return t[n]};n.addEventType=u;for(var a=1,o=arguments.length;a<o;++a)u(arguments[a]);return n;function u(e,r,i){if("object"==typeof e)return c(e);r||(r=ae),i||(i=$);var a={subscribers:[],fire:i,subscribe:function(e){-1===a.subscribers.indexOf(e)&&(a.subscribers.push(e),a.fire=r(a.fire,e))},unsubscribe:function(e){a.subscribers=a.subscribers.filter((function(t){return t!==e})),a.fire=a.subscribers.reduce(r,i)}};return t[e]=n[e]=a,a}function c(e){r(e).forEach((function(t){var n=e[t];if(i(n))u(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new X.InvalidArgument("Invalid event config");var r=u(t,Z,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach((function(e){m((function(){e.apply(null,t)}))}))}))}}))}}var lt,dt=String.fromCharCode(65535),ht=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(e){return dt}}(),vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",pt=[],yt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),gt=yt,bt=yt,mt=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)};function _t(e,t){var n,u,c,l,h,v=_t.dependencies,p=o({addons:_t.addons,autoOpen:!0,indexedDB:v.indexedDB,IDBKeyRange:v.IDBKeyRange},t),m=p.addons,O=p.autoOpen,P=p.indexedDB,T=p.IDBKeyRange,C=this._dbSchema={},D=[],F=[],L={},B=null,Y=null,V=!1,z=null,W=!1,G="readwrite",Q=this,J=new Se((function(e){n=e})),te=new Se((function(e,t){u=t})),ae=!0,ue=!!Tt(P);function ce(e){this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function se(e,t,n){var i=Q._createTransaction(G,F,C);i.create(t),i._completion.catch(n);var a=i._reject.bind(i);Je((function(){Oe.trans=i,0===e?(r(C).forEach((function(e){fe(t,e,C[e].primKey,C[e].indexes)})),Se.follow((function(){return Q.on.populate.fire(i)})).catch(a)):function(e,t,n){var i=[],a=D.filter((function(t){return t._cfg.version===e}))[0];if(!a)throw new X.Upgrade("Dexie specification of currently installed DB version is missing");C=Q._dbSchema=a._cfg.dbschema;var o=!1;function u(){return i.length?Se.resolve(i.shift()(t.idbtrans)).then(u):Se.resolve()}return D.filter((function(t){return t._cfg.version>e})).forEach((function(e){i.push((function(){var r=C,i=e._cfg.dbschema;Re(r,n),Re(i,n),C=Q._dbSchema=i;var a=function(e,t){var n={del:[],add:[],change:[]};for(var r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],a=t[r];if(i){var o={name:r,def:a,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==a.primKey.src)o.recreate=!0,n.change.push(o);else{var u=i.idxByName,c=a.idxByName;for(var s in u)c[s]||o.del.push(s);for(s in c){var f=u[s],l=c[s];f?f.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,a])}return n}(r,i);if(a.add.forEach((function(e){fe(n,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new X.Upgrade("Not yet support for changing primary key");var t=n.objectStore(e.name);e.add.forEach((function(e){le(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),le(t,e)})),e.del.forEach((function(e){t.deleteIndex(e)}))})),e._cfg.contentUpgrade)return o=!0,Se.follow((function(){e._cfg.contentUpgrade(t)}))})),i.push((function(t){o&&gt||function(e,t){for(var n=0;n<t.db.objectStoreNames.length;++n){var r=t.db.objectStoreNames[n];null==e[r]&&t.db.deleteObjectStore(r)}}(e._cfg.dbschema,t)}))})),u().then((function(){!function(e,t){r(e).forEach((function(n){t.db.objectStoreNames.contains(n)||fe(t,n,e[n].primKey,e[n].indexes)}))}(C,n)}))}(e,i,t).catch(a)}))}function fe(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){le(i,e)})),i}function le(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function de(e,t,n){var r=arguments.length;if(r<2)throw new X.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var a=I(i);return[e,a,n]}function pe(e,t,n){this.name=e,this.schema=t,this._tx=n,this.hook=L[e]?L[e].hook:ft(null,{creating:[ne,$],reading:[ee,Z],updating:[ie,$],deleting:[re,$]})}function ye(e,t,n){return(n?xt:kt)((function(n){e.push(n),t&&t()}))}function ge(e,t,n,r,i){return new Se((function(a,o){var u=n.length,c=u-1;if(0===u)return a();if(r){var s,f=xt(o),l=jt(null);j((function(){for(var r=0;r<u;++r){s={onsuccess:null,onerror:null};var o=n[r];i.call(s,o[0],o[1],t);var d=e.delete(o[0]);d._hookCtx=s,d.onerror=f,d.onsuccess=r===c?jt(a):l}}),(function(e){throw s.onerror&&s.onerror(e),e}))}else for(var d=0;d<u;++d){var h=e.delete(n[d]);h.onerror=kt(o),d===c&&(h.onsuccess=ze((function(){return a()})))}}))}function be(e,t,n,r){var i=this;this.db=Q,this.mode=e,this.storeNames=t,this.idbtrans=null,this.on=ft(this,"complete","error","abort"),this.parent=r||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 Se((function(e,t){i._resolve=e,i._reject=t})),this._completion.then((function(){i.active=!1,i.on.complete.fire()}),(function(e){var t=i.active;return i.active=!1,i.on.error.fire(e),i.parent?i.parent._reject(e):t&&i.idbtrans&&i.idbtrans.abort(),st(e)}))}function me(e,t,n){this._ctx={table:e,index:":id"===t?null:t,or:n}}function _e(e,t){var n=null,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx,a=i.table;this._ctx={table:a,index:i.index,isPrimKey:!i.index||a.schema.primKey.keyPath&&i.index===a.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:a.hook.reading.fire}}function we(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function je(e,t){return e._cfg.version-t._cfg.version}function ke(e,t,n){t.forEach((function(t){var r=n[t];e.forEach((function(e){t in e||(e===be.prototype||e instanceof be?d(e,t,{get:function(){return this.table(t)}}):e[t]=new pe(t,r))}))}))}function Ee(e,t,n,r,i,a){var o=ze(a?function(e,t,r){return n(a(e),t,r)}:n,i);e.onerror||(e.onerror=kt(i)),e.onsuccess=w(t?function(){var n=e.result;if(n){var a=function(){n.continue()};t(n,(function(e){a=e}),r,i)&&o(n.value,n,(function(e){a=e})),a()}else r()}:function(){var t=e.result;if(t){var n=function(){t.continue()};o(t.value,t,(function(e){n=e})),n()}else r()},i)}function xe(e,t){return P.cmp(e,t)}function Ie(e,t){return xe(e,t)>0?e:t}function Pe(e,t){return P.cmp(e,t)}function Ae(e,t){return P.cmp(t,e)}function Te(e,t){return e<t?-1:e===t?0:1}function Ce(e,t){return e>t?-1:e===t?0:1}function Me(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}function Re(e,t){for(var n=t.db.objectStoreNames,r=0;r<n.length;++r){var i=n[r],o=t.objectStore(i);c="getAll"in o;for(var u=0;u<o.indexNames.length;++u){var s=o.indexNames[u],f=o.index(s).keyPath,l="string"==typeof f?f:"["+y(f).join("+")+"]";if(e[i]){var d=e[i].idxByName[l];d&&(d.name=s)}}}/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(c=!1)}function Ne(e){Q.on("blocked").fire(e),pt.filter((function(e){return e.name===Q.name&&e!==Q&&!e._vcFired})).map((function(t){return t.on("versionchange").fire(e)}))}this.version=function(e){if(B||V)throw new X.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=D.filter((function(t){return t._cfg.version===e}))[0];return t||(t=new ce(e),D.push(t),D.sort(je),ae=!1,t)},o(ce.prototype,{stores:function(e){this._cfg.storesSource=this._cfg.storesSource?o(this._cfg.storesSource,e):e;var t={};D.forEach((function(e){o(t,e._cfg.storesSource)}));var n=this._cfg.dbschema={};return this._parseStoresSpec(t,n),C=Q._dbSchema=n,[L,Q,be.prototype].forEach((function(e){for(var t in e)e[t]instanceof pe&&delete e[t]})),ke([L,Q,be.prototype,this._cfg.tables],r(n),n),F=r(n),this},upgrade:function(e){return this._cfg.contentUpgrade=e,this},_parseStoresSpec:function(e,t){r(e).forEach((function(n){if(null!==e[n]){var r={},a=function(e){var t=[];return e.split(",").forEach((function(e){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;t.push(new Pt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),i(r),/\./.test(e)))})),t}(e[n]),o=a.shift();if(o.multi)throw new X.Schema("Primary key cannot be multi-valued");o.keyPath&&E(r,o.keyPath,o.auto?0:o.keyPath),a.forEach((function(e){if(e.auto)throw new X.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new X.Schema("Index must have a name and cannot be an empty string");E(r,e.keyPath,e.compound?e.keyPath.map((function(){return""})):"")})),t[n]=new At(n,o,a,r)}}))}}),this._allTables=L,this._createTransaction=function(e,t,n,r){return new be(e,t,n,r)},this._whenReady=function(e){return W||Oe.letThrough?e():new Se((function(e,t){if(!V){if(!O)return void t(new X.DatabaseClosed);Q.open().catch($)}J.then(e,t)})).then(e)},this.verno=0,this.open=function(){if(V||B)return J.then((function(){return Y?st(Y):Q}));N&&(te._stackHolder=K()),V=!0,Y=null,W=!1;var t=n,i=null;return Se.race([te,new Se((function(t,n){if(!P)throw new X.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var a=ae?P.open(e):P.open(e,Math.round(10*Q.verno));if(!a)throw new X.MissingAPI("IndexedDB API not available");a.onerror=kt(n),a.onblocked=ze(Ne),a.onupgradeneeded=ze((function(t){if(i=a.transaction,ae&&!Q._allowEmptyDB){a.onerror=Ot,i.abort(),a.result.close();var r=P.deleteDatabase(e);r.onsuccess=r.onerror=ze((function(){n(new X.NoSuchDatabase("Database "+e+" doesnt exist"))}))}else{i.onerror=kt(n),se((t.oldVersion>Math.pow(2,62)?0:t.oldVersion)/10,i,n)}}),n),a.onsuccess=ze((function(){if(i=null,B=a.result,pt.push(Q),ae)!function(){if(Q.verno=B.version/10,Q._dbSchema=C={},0===(F=y(B.objectStoreNames,0)).length)return;var e=B.transaction(St(F),"readonly");F.forEach((function(t){for(var n=e.objectStore(t),r=n.keyPath,i=r&&"string"==typeof r&&-1!==r.indexOf("."),a=new Pt(r,r||"",!1,!1,!!n.autoIncrement,r&&"string"!=typeof r,i),o=[],u=0;u<n.indexNames.length;++u){var c=n.index(n.indexNames[u]);i=(r=c.keyPath)&&"string"==typeof r&&-1!==r.indexOf(".");var s=new Pt(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);o.push(s)}C[t]=new At(t,a,o,{})})),ke([L],r(C),C)}();else if(B.objectStoreNames.length>0)try{Re(C,B.transaction(St(B.objectStoreNames),"readonly"))}catch(e){}B.onversionchange=ze((function(e){Q._vcFired=!0,Q.on("versionchange").fire(e)})),ue||"__dbnames"===e||lt.dbnames.put({name:e}).catch($),t()}),n)}))]).then((function(){return z=[],Se.resolve(_t.vip(Q.on.ready.fire)).then((function e(){if(z.length>0){var t=z.reduce(oe,$);return z=[],Se.resolve(_t.vip(t)).then(e)}}))})).finally((function(){z=null})).then((function(){return V=!1,Q})).catch((function(e){try{i&&i.abort()}catch(e){}return V=!1,Q.close(),st(Y=e)})).finally((function(){W=!0,t()}))},this.close=function(){var e=pt.indexOf(Q);if(e>=0&&pt.splice(e,1),B){try{B.close()}catch(e){}B=null}O=!1,Y=new X.DatabaseClosed,V&&u(Y),J=new Se((function(e){n=e})),te=new Se((function(e,t){u=t}))},this.delete=function(){var t=arguments.length>0;return new Se((function(n,r){if(t)throw new X.InvalidArgument("Arguments not allowed in db.delete()");function i(){Q.close();var t=P.deleteDatabase(e);t.onsuccess=ze((function(){ue||lt.dbnames.delete(e).catch($),n()})),t.onerror=kt(r),t.onblocked=Ne}V?J.then(i):i()}))},this.backendDB=function(){return B},this.isOpen=function(){return null!==B},this.hasBeenClosed=function(){return Y&&Y instanceof X.DatabaseClosed},this.hasFailed=function(){return null!==Y},this.dynamicallyOpened=function(){return ae},this.name=e,f(this,{tables:{get:function(){return r(L).map((function(e){return L[e]}))}}}),this.on=ft(this,"populate","blocked","versionchange",{ready:[oe,$]}),this.on.ready.subscribe=g(this.on.ready.subscribe,(function(e){return function(t,n){_t.vip((function(){W?(Y||Se.resolve().then(t),n&&e(t)):z?(z.push(t),n&&e(t)):(e(t),n||e((function e(){Q.on.ready.unsubscribe(t),Q.on.ready.unsubscribe(e)})))}))}})),this.transaction=function(){var e=de.apply(this,arguments);return this._transaction.apply(this,e)},this._transaction=function(e,t,n){var r=Oe.trans;r&&r.db===Q&&-1===e.indexOf("!")||(r=null);var i=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{var a=t.map((function(e){var t=e instanceof pe?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}));if("r"==e||"readonly"==e)e="readonly";else{if("rw"!=e&&e!=G)throw new X.InvalidArgument("Invalid transaction mode: "+e);e=G}if(r){if("readonly"===r.mode&&e===G){if(!i)throw new X.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&a.forEach((function(e){if(r&&-1===r.storeNames.indexOf(e)){if(!i)throw new X.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),i&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,(function(t,n){n(e)})):st(e)}return r?r._promise(e,o,"lock"):Oe.trans?at(Oe.transless,(function(){return Q._whenReady(o)})):Q._whenReady(o);function o(){return Se.resolve().then((function(){var t,i=Oe.transless||Oe,o=Q._createTransaction(e,a,C,r),u={trans:o,transless:i};r?o.idbtrans=r.idbtrans:o.create(),n.constructor===ve&&$e();var c=Se.follow((function(){if(t=n.call(o,o))if(t.constructor===he){var e=Ze.bind(null,null);t.then(e,e)}else"function"==typeof t.next&&"function"==typeof t.throw&&(t=It(t))}),u);return(t&&"function"==typeof t.then?Se.resolve(t).then((function(e){return o.active?e:st(new X.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):c.then((function(){return t}))).then((function(e){return r&&o._resolve(),o._completion.then((function(){return e}))})).catch((function(e){return o._reject(e),st(e)}))}))}},this.table=function(e){if(!s(L,e))throw new X.InvalidTable("Table "+e+" does not exist");return L[e]},f(pe.prototype,{_trans:function(e,t,n){var r=this._tx||Oe.trans;return r&&r.db===Q?r===Oe.trans?r._promise(e,t,n):Je((function(){return r._promise(e,t,n)}),{trans:r,transless:Oe.transless||Oe}):function e(t,n,r){if(W||Oe.letThrough){var i=Q._createTransaction(t,n,C);try{i.create()}catch(e){return st(e)}return i._promise(t,(function(e,t){return Je((function(){return Oe.trans=i,r(e,t,i)}))})).then((function(e){return i._completion.then((function(){return e}))}))}if(!V){if(!O)return st(new X.DatabaseClosed);Q.open().catch($)}return J.then((function(){return e(t,n,r)}))}(e,[this.name],t)},_idbstore:function(e,t,n){var r=this.name;return this._trans(e,(function(e,n,i){if(-1===i.storeNames.indexOf(r))throw new X.NotFound("Table"+r+" not part of transaction");return t(e,n,i.idbtrans.objectStore(r),i)}),n)},get:function(e,t){if(e&&e.constructor===Object)return this.where(e).first(t);var n=this;return this._idbstore("readonly",(function(t,r,i){var a=i.get(e);a.onerror=kt(r),a.onsuccess=ze((function(){t(n.hook.reading.fire(a.result))}),r)})).then(t)},where:function(e){if("string"==typeof e)return new me(this,e);if(i(e))return new me(this,"["+e.join("+")+"]");var t=r(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(e){return e.compound&&t.every((function(t){return e.keyPath.indexOf(t)>=0}))&&e.keyPath.every((function(e){return t.indexOf(e)>=0}))}))[0];if(n&&ht!==dt)return this.where(n.name).equals(n.keyPath.map((function(t){return e[t]})));n||console.warn("The query "+JSON.stringify(e)+" on "+this.name+" would benefit of a compound index ["+t.join("+")+"]");var a=this.schema.idxByName,o=t.reduce((function(t,n){return[t[0]||a[n],t[0]||!a[n]?Me(t[1],(function(t){return""+k(t,n)==""+e[n]})):t[1]]}),[null,null]),u=o[0];return u?this.where(u.name).equals(e[u.keyPath]).filter(o[1]):n?this.filter(o[1]):this.where(t).equals("")},count:function(e){return this.toCollection().count(e)},offset:function(e){return this.toCollection().offset(e)},limit:function(e){return this.toCollection().limit(e)},reverse:function(){return this.toCollection().reverse()},filter:function(e){return this.toCollection().and(e)},each:function(e){return this.toCollection().each(e)},toArray:function(e){return this.toCollection().toArray(e)},orderBy:function(e){return new _e(new me(this,i(e)?"["+e.join("+")+"]":e))},toCollection:function(){return new _e(new me(this))},mapToClass:function(e,t){this.schema.mappedClass=e;var n=Object.create(e.prototype);t&&wt(n,t),this.schema.instanceTemplate=n;var r=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(s(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),e},defineClass:function(e){return this.mapToClass(_t.defineClass(e),e)},bulkDelete:function(e){return this.hook.deleting.fire===$?this._idbstore(G,(function(t,n,r,i){t(ge(r,i,e,!1,$))})):this.where(":id").anyOf(e).delete().then((function(){}))},bulkPut:function(e,t){var n=this;return this._idbstore(G,(function(r,i,a){if(!a.keyPath&&!n.schema.primKey.auto&&!t)throw new X.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(a.keyPath&&t)throw new X.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==e.length)throw new X.InvalidArgument("Arguments objects and keys must have the same length");if(0===e.length)return r();var o,u,c=function(e){0===s.length?r(e):i(new H(n.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))},s=[],f=e.length,l=n;if(n.hook.creating.fire===$&&n.hook.updating.fire===$){u=ye(s);for(var d=0,h=e.length;d<h;++d)(o=t?a.put(e[d],t[d]):a.put(e[d])).onerror=u;o.onerror=ye(s,c),o.onsuccess=Et(c)}else{var v=t||a.keyPath&&e.map((function(e){return k(e,a.keyPath)})),p=v&&_(v,(function(t,n){return null!=t&&[t,e[n]]}));(v?l.where(":id").anyOf(v.filter((function(e){return null!=e}))).modify((function(){this.value=p[this.primKey],p[this.primKey]=null})).catch(q,(function(e){s=e.failures})).then((function(){for(var n=[],r=t&&[],i=v.length-1;i>=0;--i){var a=v[i];(null==a||p[a])&&(n.push(e[i]),t&&r.push(a),null!=a&&(p[a]=null))}return n.reverse(),t&&r.reverse(),l.bulkAdd(n,r)})).then((function(e){var t=v[v.length-1];return null!=t?t:e})):l.bulkAdd(e)).then(c).catch(H,(function(e){s=s.concat(e.failures),c()})).catch(i)}}),"locked")},bulkAdd:function(e,t){var n=this,r=this.hook.creating.fire;return this._idbstore(G,(function(i,a,o,u){if(!o.keyPath&&!n.schema.primKey.auto&&!t)throw new X.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new X.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==e.length)throw new X.InvalidArgument("Arguments objects and keys must have the same length");if(0===e.length)return i();function c(e){0===d.length?i(e):a(new H(n.name+".bulkAdd(): "+d.length+" of "+h+" operations failed",d))}var s,f,l,d=[],h=e.length;if(r!==$){var v,p=o.keyPath;f=ye(d,null,!0),l=jt(null),j((function(){for(var n=0,i=e.length;n<i;++n){v={onerror:null,onsuccess:null};var a=t&&t[n],c=e[n],d=t?a:p?k(c,p):void 0,h=r.call(v,d,c,u);null==d&&null!=h&&(p?E(c=A(c),p,h):a=h),(s=null!=a?o.add(c,a):o.add(c))._hookCtx=v,n<i-1&&(s.onerror=f,v.onsuccess&&(s.onsuccess=l))}}),(function(e){throw v.onerror&&v.onerror(e),e})),s.onerror=ye(d,c,!0),s.onsuccess=jt(c)}else{f=ye(d);for(var y=0,g=e.length;y<g;++y)(s=t?o.add(e[y],t[y]):o.add(e[y])).onerror=f;s.onerror=ye(d,c),s.onsuccess=Et(c)}}))},add:function(e,t){var n=this.hook.creating.fire;return this._idbstore(G,(function(r,i,a,o){var u={onsuccess:null,onerror:null};if(n!==$){var c=null!=t?t:a.keyPath?k(e,a.keyPath):void 0,s=n.call(u,c,e,o);null==c&&null!=s&&(a.keyPath?E(e,a.keyPath,s):t=s)}try{var f=null!=t?a.add(e,t):a.add(e);f._hookCtx=u,f.onerror=xt(i),f.onsuccess=jt((function(t){var n=a.keyPath;n&&E(e,n,t),r(t)}))}catch(e){throw u.onerror&&u.onerror(e),e}}))},put:function(e,t){var n=this,r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==$||i!==$){var a=this.schema.primKey.keyPath,o=void 0!==t?t:a&&k(e,a);return null==o?this.add(e):(e=A(e),this._trans(G,(function(){return n.where(":id").equals(o).modify((function(){this.value=e})).then((function(r){return 0===r?n.add(e,t):o}))}),"locked"))}return this._idbstore(G,(function(n,r,i){var a=void 0!==t?i.put(e,t):i.put(e);a.onerror=kt(r),a.onsuccess=ze((function(t){var r=i.keyPath;r&&E(e,r,t.target.result),n(a.result)}))}))},delete:function(e){return this.hook.deleting.subscribers.length?this.where(":id").equals(e).delete():this._idbstore(G,(function(t,n,r){var i=r.delete(e);i.onerror=kt(n),i.onsuccess=ze((function(){t(i.result)}))}))},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(G,(function(e,t,n){var r=n.clear();r.onerror=kt(t),r.onsuccess=ze((function(){e(r.result)}))}))},update:function(e,t){if("object"!=typeof t||i(t))throw new X.InvalidArgument("Modifications must be an object.");if("object"!=typeof e||i(e))return this.where(":id").equals(e).modify(t);r(t).forEach((function(n){E(e,n,t[n])}));var n=k(e,this.schema.primKey.keyPath);return void 0===n?st(new X.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(n).modify(t)}}),f(be.prototype,{_lock:function(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this},_unlock:function(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{at(e[1],e[0])}catch(e){}}return this},_locked:function(){return this._reculock&&Oe.lockOwnerFor!==this},create:function(e){var t=this;if(!this.mode)return this;if(b(!this.idbtrans),!e&&!B)switch(Y&&Y.name){case"DatabaseClosedError":throw new X.DatabaseClosed(Y);case"MissingAPIError":throw new X.MissingAPI(Y.message,Y);default:throw new X.OpenFailed(Y)}if(!this.active)throw new X.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||B.transaction(St(this.storeNames),this.mode)).onerror=ze((function(n){Ot(n),t._reject(e.error)})),e.onabort=ze((function(n){Ot(n),t.active&&t._reject(new X.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=ze((function(){t.active=!1,t._resolve()})),this},_promise:function(e,t,n){var r=this;if(e===G&&this.mode!==G)return st(new X.ReadOnly("Transaction is readonly"));if(!this.active)return st(new X.TransactionInactive);if(this._locked())return new Se((function(i,a){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,a)},Oe])}));if(n)return Je((function(){var e=new Se((function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var i=new Se((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(e){var t=this._root();if(e=Se.resolve(e),t._waitingFor)t._waitingFor=t._waitingFor.then((function(){return e}));else{t._waitingFor=e,t._waitingQueue=[];var n=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(n.get(-1/0).onsuccess=e)}()}var r=t._waitingFor;return new Se((function(n,i){e.then((function(e){return t._waitingQueue.push(ze(n.bind(null,e)))}),(function(e){return t._waitingQueue.push(ze(i.bind(null,e)))})).finally((function(){t._waitingFor===r&&(t._waitingFor=null)}))}))},abort:function(){this.active&&this._reject(new X.Abort),this.active=!1},tables:{get:(l="Transaction.tables",h=function(){return L},function(){return console.warn(l+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+U(K(),1)),h.apply(this,arguments)})},table:function(e){return new pe(e,Q.table(e).schema,this)}}),f(me.prototype,(function(){function e(e,t,n){var r=e instanceof me?new _e(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function t(e){return new _e(e,(function(){return T.only("")})).limit(0)}function n(e,t,n,r,i,a){for(var o=Math.min(e.length,r.length),u=-1,c=0;c<o;++c){var s=t[c];if(s!==r[c])return i(e[c],n[c])<0?e.substr(0,c)+n[c]+n.substr(c+1):i(e[c],r[c])<0?e.substr(0,c)+r[c]+n.substr(c+1):u>=0?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[c],s)<0&&(u=c)}return o<r.length&&"next"===a?e+n.substr(e.length):o<e.length&&"prev"===a?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}function r(t,r,i,a){var o,u,c,s,f,l,d,h=i.length;if(!i.every((function(e){return"string"==typeof e})))return e(t,"String expected.");function v(e){o=function(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}(e),u=function(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}(e),c="next"===e?Te:Ce;var t=i.map((function(e){return{lower:u(e),upper:o(e)}})).sort((function(e,t){return c(e.lower,t.lower)}));s=t.map((function(e){return e.upper})),f=t.map((function(e){return e.lower})),l=e,d="next"===e?"":a}v("next");var p=new _e(t,(function(){return T.bound(s[0],f[h-1]+a)}));p._ondirectionchange=function(e){v(e)};var y=0;return p._addAlgorithm((function(e,t,i){var a=e.key;if("string"!=typeof a)return!1;var o=u(a);if(r(o,f,y))return!0;for(var v=null,p=y;p<h;++p){var g=n(a,o,s[p],f[p],c,l);null===g&&null===v?y=p+1:(null===v||c(v,g)>0)&&(v=g)}return t(null!==v?function(){e.continue(v+d)}:i),!1})),p}return{between:function(n,r,i,a){i=!1!==i,a=!0===a;try{return xe(n,r)>0||0===xe(n,r)&&(i||a)&&(!i||!a)?t(this):new _e(this,(function(){return T.bound(n,r,!i,!a)}))}catch(t){return e(this,vt)}},equals:function(e){return new _e(this,(function(){return T.only(e)}))},above:function(e){return new _e(this,(function(){return T.lowerBound(e,!0)}))},aboveOrEqual:function(e){return new _e(this,(function(){return T.lowerBound(e)}))},below:function(e){return new _e(this,(function(){return T.upperBound(e,!0)}))},belowOrEqual:function(e){return new _e(this,(function(){return T.upperBound(e)}))},startsWith:function(t){return"string"!=typeof t?e(this,"String expected."):this.between(t,t+dt,!0,!0)},startsWithIgnoreCase:function(e){return""===e?this.startsWith(e):r(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],dt)},equalsIgnoreCase:function(e){return r(this,(function(e,t){return e===t[0]}),[e],"")},anyOfIgnoreCase:function(){var e=R.apply(M,arguments);return 0===e.length?t(this):r(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},startsWithAnyOfIgnoreCase:function(){var e=R.apply(M,arguments);return 0===e.length?t(this):r(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,dt)},anyOf:function(){var n=R.apply(M,arguments),r=Pe;try{n.sort(r)}catch(t){return e(this,vt)}if(0===n.length)return t(this);var i=new _e(this,(function(){return T.bound(n[0],n[n.length-1])}));i._ondirectionchange=function(e){r="next"===e?Pe:Ae,n.sort(r)};var a=0;return i._addAlgorithm((function(e,t,i){for(var o=e.key;r(o,n[a])>0;)if(++a===n.length)return t(i),!1;return 0===r(o,n[a])||(t((function(){e.continue(n[a])})),!1)})),i},notEqual:function(e){return this.inAnyRange([[-1/0,e],[e,ht]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=R.apply(M,arguments);if(0===t.length)return new _e(this);try{t.sort(Pe)}catch(t){return e(this,vt)}var n=t.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]}),null);return n.push([t[t.length-1],ht]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(n,r){if(0===n.length)return t(this);if(!n.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&Pe(e[0],e[1])<=0})))return e(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",X.InvalidArgument);var i=!r||!1!==r.includeLowers,a=r&&!0===r.includeUppers;var o,u=Pe;function c(e,t){return u(e[0],t[0])}try{(o=n.reduce((function(e,t){for(var n=0,r=e.length;n<r;++n){var i=e[n];if(xe(t[0],i[1])<0&&xe(t[1],i[0])>0){i[0]=(a=i[0],o=t[0],xe(a,o)<0?a:o),i[1]=Ie(i[1],t[1]);break}}var a,o;return n===r&&e.push(t),e}),[])).sort(c)}catch(t){return e(this,vt)}var s=0,f=a?function(e){return Pe(e,o[s][1])>0}:function(e){return Pe(e,o[s][1])>=0},l=i?function(e){return Ae(e,o[s][0])>0}:function(e){return Ae(e,o[s][0])>=0};var d=f,h=new _e(this,(function(){return T.bound(o[0][0],o[o.length-1][1],!i,!a)}));return h._ondirectionchange=function(e){"next"===e?(d=f,u=Pe):(d=l,u=Ae),o.sort(c)},h._addAlgorithm((function(e,t,n){for(var r=e.key;d(r);)if(++s===o.length)return t(n),!1;return!!function(e){return!f(e)&&!l(e)}(r)||0!==xe(r,o[s][1])&&0!==xe(r,o[s][0])&&(t((function(){u===Pe?e.continue(o[s][0]):e.continue(o[s][1])})),!1)})),h},startsWithAnyOf:function(){var n=R.apply(M,arguments);return n.every((function(e){return"string"==typeof e}))?0===n.length?t(this):this.inAnyRange(n.map((function(e){return[e,e+dt]}))):e(this,"startsWithAnyOf() only works with strings")}}})),f(_e.prototype,(function(){function e(e,t){e.filter=Me(e.filter,t)}function t(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Me(r(),t())}:t,e.justLimit=n&&!r}function n(e,t){if(e.isPrimKey)return t;var n=e.table.schema.idxByName[e.index];if(!n)throw new X.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return t.index(n.name)}function i(e,t){var r=n(e,t);return e.keysOnly&&"openKeyCursor"in r?r.openKeyCursor(e.range||null,e.dir+e.unique):r.openCursor(e.range||null,e.dir+e.unique)}function a(e,t,n,r,a){var o=e.replayFilter?Me(e.filter,e.replayFilter()):e.filter;e.or?function(){var u={},c=0;function f(){2==++c&&n()}function l(e,n,i){if(!o||o(n,i,f,r)){var a=n.primaryKey,c=""+a;"[object ArrayBuffer]"===c&&(c=""+new Uint8Array(a)),s(u,c)||(u[c]=!0,t(e,n,i))}}e.or._iterate(l,f,r,a),Ee(i(e,a),e.algorithm,l,f,r,!e.keysOnly&&e.valueMapper)}():Ee(i(e,a),Me(e.algorithm,o),t,n,r,!e.keysOnly&&e.valueMapper)}return{_read:function(e,t){var n=this._ctx;return n.error?n.table._trans(null,st.bind(null,n.error)):n.table._idbstore("readonly",e).then(t)},_write:function(e){var t=this._ctx;return t.error?t.table._trans(null,st.bind(null,t.error)):t.table._idbstore(G,e,"locked")},_addAlgorithm:function(e){var t=this._ctx;t.algorithm=Me(t.algorithm,e)},_iterate:function(e,t,n,r){return a(this._ctx,e,t,n,r)},clone:function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&o(n,e),t._ctx=n,t},raw:function(){return this._ctx.valueMapper=null,this},each:function(e){var t=this._ctx;return this._read((function(n,r,i){a(t,e,n,r,i)}))},count:function(e){var t=this._ctx;if(we(t,!0))return this._read((function(e,r,i){var a=n(t,i),o=t.range?a.count(t.range):a.count();o.onerror=kt(r),o.onsuccess=function(n){e(Math.min(n.target.result,t.limit))}}),e);var r=0;return this._read((function(e,n,i){a(t,(function(){return++r,!1}),(function(){e(r)}),n,i)}),e)},sortBy:function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function a(e,t){return t?a(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function u(e,t){var n=a(e,i),r=a(t,i);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(u)})).then(t)},toArray:function(e){var t=this._ctx;return this._read((function(e,r,i){if(c&&"next"===t.dir&&we(t,!0)&&t.limit>0){var o=t.table.hook.reading.fire,u=n(t,i),s=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);s.onerror=kt(r),s.onsuccess=Et(o===Z?e:function(t){try{e(t.map(o))}catch(e){r(e)}})}else{var f=[];a(t,(function(e){f.push(e)}),(function(){e(f)}),r,i)}}),e)},offset:function(e){var n=this._ctx;return e<=0?this:(n.offset+=e,we(n)?t(n,(function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n((function(){e.advance(t),t=0})),!1))}})):t(n,(function(){var t=e;return function(){return--t<0}})),this)},limit:function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),t(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this},until:function(t,n){return e(this._ctx,(function(e,r,i){return!t(e.value)||(r(i),n)})),this},first:function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},last:function(e){return this.reverse().first(e)},filter:function(t){return e(this._ctx,(function(e){return t(e.value)})),function(e,t){e.isMatch=Me(e.isMatch,t)}(this._ctx,t),this},and:function(e){return this.filter(e)},or:function(e){return new me(this._ctx.table,e,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},eachUniqueKey:function(e){return this._ctx.unique="unique",this.eachKey(e)},eachPrimaryKey:function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},keys:function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},primaryKeys:function(e){var t=this._ctx;if(c&&"next"===t.dir&&we(t,!0)&&t.limit>0)return this._read((function(e,r,i){var a=n(t,i),o=t.limit<1/0?a.getAllKeys(t.range,t.limit):a.getAllKeys(t.range);o.onerror=kt(r),o.onsuccess=Et(e)})).then(e);t.keysOnly=!t.isMatch;var r=[];return this.each((function(e,t){r.push(t.primaryKey)})).then((function(){return r})).then(e)},uniqueKeys:function(e){return this._ctx.unique="unique",this.keys(e)},firstKey:function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},lastKey:function(e){return this.reverse().firstKey(e)},distinct:function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return e(this._ctx,(function(e){var t=e.primaryKey.toString(),n=s(r,t);return r[t]=!0,!n})),this},modify:function(e){var t=this,n=this._ctx.table.hook,i=n.updating.fire,a=n.deleting.fire;return this._write((function(n,u,c,f){var l;if("function"==typeof e)l=i===$&&a===$?e:function(t){var n=A(t);if(!1===e.call(this,t,this))return!1;if(s(this,"value")){var o=S(n,this.value),u=i.call(this,o,this.primKey,n,f);u&&(t=this.value,r(u).forEach((function(e){E(t,e,u[e])})))}else a.call(this,this.primKey,t,f)};else if(i===$){var d=r(e),h=d.length;l=function(t){for(var n=!1,r=0;r<h;++r){var i=d[r],a=e[i];k(t,i)!==a&&(E(t,i,a),n=!0)}return n}}else{var v=e;e=x(v),l=function(t){var n=!1,a=i.call(this,e,this.primKey,A(t),f);return a&&o(e,a),r(e).forEach((function(r){var i=e[r];k(t,r)!==i&&(E(t,r,i),n=!0)})),a&&(e=x(v)),n}}var p=0,y=0,g=!1,b=[],m=[],_=null;function w(e){return e&&(b.push(e),m.push(_)),u(new q("Error modifying one or more objects",b,y,m))}function O(){g&&y+b.length===p&&(b.length>0?w():n(y))}t.clone().raw()._iterate((function(e,t){_=t.primaryKey;var n={primKey:t.primaryKey,value:e,onsuccess:null,onerror:null};function r(e){return b.push(e),m.push(n.primKey),O(),!0}if(!1!==l.call(n,e,n)){var i=!s(n,"value");++p,j((function(){var e=i?t.delete():t.update(n.value);e._hookCtx=n,e.onerror=xt(r),e.onsuccess=jt((function(){++y,O()}))}),r)}else n.onsuccess&&n.onsuccess(n.value)}),(function(){g=!0,O()}),w,c)}))},delete:function(){var e=this,t=this._ctx,n=t.range,r=t.table.hook.deleting.fire,i=r!==$;if(!i&&we(t)&&(t.isPrimKey&&!bt||!n))return this._write((function(e,t,r){var i=kt(t),a=n?r.count(n):r.count();a.onerror=i,a.onsuccess=function(){var o=a.result;j((function(){var t=n?r.delete(n):r.clear();t.onerror=i,t.onsuccess=function(){return e(o)}}),(function(e){return t(e)}))}}));var a=i?2e3:1e4;return this._write((function(n,o,u,c){var s=0,f=e.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(a).raw(),l=[],d=function(){return f.each(i?function(e,t){l.push([t.primaryKey,t.value])}:function(e,t){l.push(t.primaryKey)}).then((function(){return i?l.sort((function(e,t){return Pe(e[0],t[0])})):l.sort(Pe),ge(u,c,l,i,r)})).then((function(){var e=l.length;return s+=e,l=[],e<a?s:d()}))};n(d())}))}}})),o(this,{Collection:_e,Table:pe,Transaction:be,Version:ce,WhereClause:me}),Q.on("versionchange",(function(e){e.newVersion>0?console.warn("Another connection wants to upgrade database '"+Q.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+Q.name+"'. Closing db now to resume the delete request."),Q.close()})),Q.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('"+Q.name+"') was blocked"):console.warn("Upgrade '"+Q.name+"' blocked by other connection holding version "+e.oldVersion/10)})),m.forEach((function(e){e(Q)}))}function wt(e,t){return r(t).forEach((function(n){var r=function e(t){if("function"==typeof t)return new t;if(i(t))return[e(t[0])];if(t&&"object"==typeof t){var n={};return wt(n,t),n}return t}(t[n]);e[n]=r})),e}function jt(e){return ze((function(t){var n=t.target,r=n._hookCtx,i=r.value||n.result,a=r&&r.onsuccess;a&&a(i),e&&e(i)}),e)}function kt(e){return ze((function(t){return Ot(t),e(t.target.error),!1}))}function Et(e){return ze((function(t){e(t.target.result)}))}function xt(e){return ze((function(t){var n=t.target,r=n.error,i=n._hookCtx,a=i&&i.onerror;return a&&a(r),Ot(t),e(r),!1}))}function Ot(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}function It(e){var t=function(t){return e.next(t)},n=a(t),r=a((function(t){return e.throw(t)}));function a(e){return function(t){var a=e(t),o=a.value;return a.done?o:o&&"function"==typeof o.then?o.then(n,r):i(o)?Se.all(o).then(n,r):n(o)}}return a(t)()}function Pt(e,t,n,r,i,a,o){this.name=e,this.keyPath=t,this.unique=n,this.multi=r,this.auto=i,this.compound=a,this.dotted=o;var u="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(n?"&":"")+(r?"*":"")+(i?"++":"")+u}function At(e,t,n,r){this.name=e,this.primKey=t||new Pt,this.indexes=n||[new Pt],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=_(n,(function(e){return[e.name,e]}))}function St(e){return 1===e.length?e[0]:e}function Tt(e){var t=e&&(e.getDatabaseNames||e.webkitGetDatabaseNames);return t&&t.bind(e)}D(N,mt),f(_t,J),f(_t,{delete:function(e){var t=new _t(e),n=t.delete();return n.onblocked=function(e){return t.on("blocked",e),this},n},exists:function(e){return new _t(e).open().then((function(e){return e.close(),!0})).catch(_t.NoSuchDatabaseError,(function(){return!1}))},getDatabaseNames:function(e){var t=Tt(_t.dependencies.indexedDB);return t?new Se((function(e,n){var r=t();r.onsuccess=function(t){e(y(t.target.result,0))},r.onerror=kt(n)})).then(e):lt.dbnames.toCollection().primaryKeys(e)},defineClass:function(){return function(e){e&&o(this,e)}},applyStructure:wt,ignoreTransaction:function(e){return Oe.trans?at(Oe.transless,e):e()},vip:function(e){return Je((function(){return Oe.letThrough=!0,e()}))},async:function(e){return function(){try{var t=It(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Se.resolve(t)}catch(e){return st(e)}}},spawn:function(e,t,n){try{var r=It(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Se.resolve(r)}catch(e){return st(e)}},currentTransaction:{get:function(){return Oe.trans||null}},waitFor:function(e,t){var n=Se.resolve("function"==typeof e?_t.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Se,debug:{get:function(){return N},set:function(e){D(e,"dexie"===e?function(){return!0}:mt)}},derive:h,extend:o,props:f,override:g,Events:ft,getByKeyPath:k,setByKeyPath:E,delByKeyPath:function(e,t){"string"==typeof t?E(e,t,void 0):"length"in t&&[].map.call(t,(function(t){E(e,t,void 0)}))},shallowClone:x,deepClone:A,getObjectDiff:S,asap:m,maxKey:ht,minKey:-1/0,addons:[],connections:pt,MultiModifyError:X.Modify,errnames:W,IndexSpec:Pt,TableSchema:At,dependencies:function(){try{return{indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch(e){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:"{version}",version:"{version}".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)})),default:_t,Dexie:_t}),Se.rejectionMapper=function(e,t){if(!e||e instanceof z||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Q[e.name])return e;var n=new Q[e.name](t||e.message,e);return"stack"in e&&d(n,"stack",{get:function(){return this.inner.stack}}),n},(lt=new _t("__dbnames")).version(1).stores({dbnames:"name"}),function(){try{void 0!==typeof localStorage&&void 0!==a.document&&(JSON.parse(localStorage.getItem("Dexie.DatabaseNames")||"[]").forEach((function(e){return lt.dbnames.put({name:e}).catch($)})),localStorage.removeItem("Dexie.DatabaseNames"))}catch(e){}}(),t.default=_t}.call(this,n("bgdiiijdd"),n("bgjhiaabcf").setImmediate)},cdiffgjfcb:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.NotInitializedError=t.NoSuchTableError=t.NoSuchDatabaseError=t.NoFallbackError=t.DuplicateTableError=t.DuplicateDatabaseError=t.AlreadyInitializedError=void 0;var i=r(n("dgcdacjddi")),a=r(n("eaidjcib")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("bdhjjchdia")),f=r(n("dhciggahgi")),l=r(n("dfagheagjg")),d=r(n("chcbgfgiji")),h=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.AlreadyInitializedError=h;var v=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.DuplicateDatabaseError=v;var p=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.DuplicateTableError=p;var y=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.NoFallbackError=y;var g=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.NoSuchDatabaseError=g;var b=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.NoSuchTableError=b;var m=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.NotInitializedError=m;var _=function(){function e(t){(0,a.default)(this,e),this.tables=new Map,this.views=new Map,this.state=1,this.versions=new l.default,this._database=t}return(0,i.default)(e,[{key:"add",value:function(e){if(this.tables.has(e))throw new p('Table "'.concat(e,'" already added. Reuse the definition.'));var t=new d.default(e,this.versions);return this.tables.set(e,t),t}},{key:"_getBackingDB",value:function(){return this._database}},{key:"_unsafeGetOrCreateView",value:function(e){if(this.views.has(e))return this.views.get(e);var t=this._database.view(e.name,e.rowview,e.shouldEnablePropFilter);return this.views.set(e,t),t}},{key:"_guardInitializedThunk",value:function(e){var t=this;return function(){if(3&t.state)throw new m("Storage must be initialized before accessing a table!");return e()}}},{key:"table",value:function(e){var t=this,n=this.tables.get(e);if(!n)throw new b("Unknown table ".concat(e," requested, ensure table is defined!"));if(!this._getBackingDB())throw new g('Unable to find associated database with table "'.concat(e,'"'));return new f.default(this._guardInitializedThunk((function(){return t._unsafeGetOrCreateView(n)})))}},{key:"lock",value:function(e,t){var n=this;if(3&this.state)throw new m("Initialize storage before attempting to lock tables!");for(var r=0;r<e.length;++r)if(!this.tables.has(e[r]))throw new b('Requested lock of unknown table "'.concat(e[r],'"'));var i=e.map((function(e){var t=n.tables.get(e);if(t)return t;throw new b('Requested lock of unknown table "'.concat(e,'"'))})).map((function(e){return n._unsafeGetOrCreateView(e)}));return this._getBackingDB().transact(e,(function(){return t(i)}))}},{key:"_getUpgraderForCurrentVersion",value:function(e,t){for(var n=0;n<e.length;n++)if(e[n].maxVersion===t){var r=e[n].upgraders.get(t);if(r)return{name:e[n].name,callback:r}}}},{key:"initialize",value:function(){var e=this;if(4&this.state)throw new h("Storage instance has already been initialized");return this.versions.validate(),(this._database?this._database.available():Promise.reject(new g('"'.concat(this._database.constructor.name,'" failed availability check!')))).then((function(){var t=Array.from(e.tables.values()),n=e._getBackingDB();if(t&&n){var r=new Array(e.versions.max+1);return Promise.each(r,(function(r,i){var a=i,o=t.map((function(e){return e.schema(a)})).filter(Boolean);return n.initialize(i,o,e._getUpgraderForCurrentVersion(t,a))})).then((function(){return n.open()}))}})).then((function(){return e.state=4})).then((function(){}))}},{key:"purge",value:function(){return this.state=2,this.views=new Map,this._getBackingDB().reset().then((function(){}))}}]),e}();t.default=_},cdiijcehcb:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomHex=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),a(t)},t.toHex=a,t.toLowerCaseHex=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(i[r>>4],i[15&r])}return String.fromCharCode.apply(String,t)},t.parseHex=function(e){var t=u(e);if(t.length%2!=0)throw new Error('parseHex given hex "'.concat(t,'" which is not a multiple of 8-bits.'));for(var n=new Uint8Array(t.length>>1),r=0,i=0;r<t.length;r+=2,i++)n[i]=o(t,r)<<4|o(t,r+1);return n.buffer},t.hexAt=o,t.hexOrThrow=u,t.bytesToBuffer=function(e){var t=e.buffer;return 0===e.byteOffset&&e.length===t.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.length)},t.bytesToDebugString=function(e){var t=!0,n=e.length;for(;t&&n;){var r=e[--n];t=32<=r&&r<127}return t?JSON.stringify(String.fromCharCode.apply(String,e)):a(e)},t.HEX_LOWER=void 0;var r=[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70],i=[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102];function a(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];t.push(r[i>>4],r[15&i])}return String.fromCharCode.apply(String,t)}function o(e,t){var n=e.charCodeAt(t);return n<=57?n-48:n<=70?10+n-65:10+n-97}function u(e){if(/[^0-9a-fA-F]/.test(e))throw new Error('"'.concat(e,'" is not a valid hex'));return e}t.HEX_LOWER=i},ceccbdjfci:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("bhfcfhafdj")),a=r(n("eaidjcib")),o=r(n("dgcdacjddi")),u=r(n("ffceefejc")),c=r(n("cjedcdbdii")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=r(n("chejdieege")),d=n("bfagiaicdd"),h=function(e){function t(e){var n;return(0,a.default)(this,t),(n=(0,u.default)(this,(0,c.default)(t).call(this))).columns=(0,i.default)(e).sort(),n}return(0,s.default)(t,e),(0,o.default)(t,[{key:"validate",value:function(e){(0,f.default)(-1!==(0,d.findIndex)(e,this._getIndex()),"Attempted to remove non-existent index [".concat(String(this.columns),'] on "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,d.cloneSchema)(e),n=(0,d.findIndex)(e,this._getIndex());return t.indexes.splice(n,1),t}},{key:"_getIndex",value:function(){return{type:d.INDEX_TYPE.COMPOSITE,columns:this.columns}}}]),t}(l.default);t.default=h},cfagigdiib:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("bjehdcaaj")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=r(n("ciefddeegi")),d=n("bfagiaicdd"),h=function(e){function t(){return(0,i.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,s.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){(0,c.default)((0,u.default)(t.prototype),"validate",this).call(this,e),(0,f.default)(this.columns&&this.columns.length>1,"Attempted to add composite primary key for only 1 column")}},{key:"apply",value:function(e){var t=(0,d.cloneSchema)(e);return this.columns.forEach((function(e){t.columns.push({name:e,primaryKey:d.PRIMARY_KEY_TYPE.COMPOSITE})})),t}}]),t}(l.default);t.default=h},cfaiaedcf:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.addTable=function(){(0,u.getStorage)().add("pending-mutations").version((0,c.pendingMutationsCreateTable)(),[new o.default("id"),new i.default("collection"),new i.default("index"),new i.default("value"),new i.default("type"),new i.default("timestamp"),new a.default("collection")]).version((0,c.pendingMutationsAddVersion)(),[new i.default("version")]).view((function(e){return e}))},t.getTable=function(){return(0,u.getStorage)().table("pending-mutations")};var i=r(n("diaiajeedf")),a=r(n("bhjiahgdac")),o=r(n("bfffgggjic")),u=n("ffjiicch"),c=n("dijiihaecd")},cfjecfhbfg:function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},cgaegfgegc:function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},cgcccbajji:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genInvocationId=function(){return r++},t.extractInvocationId=function(e){if(null!=e&&"number"==typeof e)return e};var r=1},cgeeeeddea:function(e,t,n){"use strict";e.exports=function(e,t,n,r,i,a,o,u){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,a,o,u],f=0;(c=new Error(t.replace(/%s/g,(function(){return s[f++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},cggbhfdifh:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESPONSE_COMMAND=t.INVOCATION_COMMAND=t.HANDSHAKE_COMMAND=void 0;t.HANDSHAKE_COMMAND="@@handshake";t.INVOCATION_COMMAND="@@invoke";t.RESPONSE_COMMAND="@@response"},cgigihhddi:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},chcbgfgiji:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("cgeeeeddea")),u=n("bfagiaicdd"),c=n("bjcfcciaea");function s(e){return e}var f=function(){function e(t,n){(0,i.default)(this,e),this.maxVersion=-1,this.versions=new Map,this.upgraders=new Map,this.shouldEnablePropFilter=!0,this.name=t,this.versionManager=n}return(0,a.default)(e,[{key:"version",value:function(e,t,n){this.versionManager.claim(e),(0,o.default)(!this.versions.has(e),'Table "'.concat(this.name,'" already has version #').concat(+e," defined!")),(0,o.default)(e>this.maxVersion,"Versions for table ".concat(this.name," must be defined in order")),this.maxVersion=e;var r=this.schema(e)||(0,u.emptySchema)(this.name),i=(0,c.sortMutations)(t).reduce((function(e,t){return t.validate(e),t.apply(e)}),(0,u.cloneSchema)(r));return this.versions.set(e,(0,u.freezeSchema)(i)),this.upgraders.set(e,n),this}},{key:"delete",value:function(){return this}},{key:"view",value:function(e){return this.rowview=e,this}},{key:"enablePropFilter",value:function(e){return this.shouldEnablePropFilter=e,this}},{key:"schema",value:function(e){var t=this.versions.get(e);if(t)return t;var n=Array.from(this.versions.keys()).map(s).sort((function(e,t){return e-t})).filter((function(t){return t<e})).pop();return n||0===n?this.versions.get(n)||(0,u.emptySchema)(this.name):null}}]),e}();t.default=f},chejdieege:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("cgeeeeddea")),u=function(){function e(){(0,i.default)(this,e),(0,o.default)("Mutation"!==this.constructor.name,"Cannot instantiate abstract class Mutation")}return(0,a.default)(e,[{key:"validate",value:function(){throw new Error("Subclasses of Mutaton must implement `validate`")}},{key:"apply",value:function(){throw new Error("Subclasses of Mutaton must implement `apply`")}}]),e}();t.default=u},chjdedjjda:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.buildResponsePayload=function(e,t){return{__id:e,__command:o.RESPONSE_COMMAND,__result:t}},t.unwrapResponsePayload=function(e){if(null!=e&&e.__command===o.RESPONSE_COMMAND){(0,i.default)(null!=e.__id,"Invocation ID missing");var t=(0,a.extractInvocationId)(e.__id);return(0,i.default)(null!=t&&e.hasOwnProperty("__result"),"Malformed response message"),{result:e.__result,invocationId:t}}};var i=r(n("cgeeeeddea")),a=n("cgcccbajji"),o=n("cggbhfdifh")},ciefddeegi:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("bhfcfhafdj")),a=r(n("eaidjcib")),o=r(n("dgcdacjddi")),u=r(n("ffceefejc")),c=r(n("cjedcdbdii")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=function(e){function t(e){var n;return(0,a.default)(this,t),n=(0,u.default)(this,(0,c.default)(t).call(this)),(0,f.default)("AbstractPrimaryKey"!==n.constructor.name,"Cannot instantiate abstract class AbstractPrimaryKey"),Array.isArray(e)?n.columns=(0,i.default)(e):n.columns=[e],n}return(0,s.default)(t,e),(0,o.default)(t,[{key:"validate",value:function(e){(0,f.default)(0===e.columns.length,"Attempted to add primary key after other columns")}},{key:"apply",value:function(){throw new Error("Subclass of `AbstractPrimaryKey` must implement `apply` method")}}]),t}(r(n("chejdieege")).default);t.default=l},cjedcdbdii:function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},cjhficgjgc:function(e,t,n){"use strict";var r=n("bfejgijfbh"),i=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return Promise.resolve(e)};i(n("bhabhhjdch")),i(n("bfefjaegfe")),n("dibgccbbif"),r(n("jfbhhdedh")),i(n("dfeaddeccc"))},dbeffhcjcb:function(e,t,n){"use strict";var r=n("bfejgijfbh"),i=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i(n("bhfcfhafdj")),o=i(n("eaidjcib")),u=i(n("dgcdacjddi")),c=n("cbefiijcca"),s=r(n("jfbhhdedh")),f=n("chjdedjjda"),l=new(function(){function e(){(0,o.default)(this,e),this._onMessage=function(e,t){var n=t.data,r=(0,c.unwrapInvocationPayload)(n);if(null!=r){var i=r.method,o=r.args,u=r.invocationId,l=s.get();l[i].apply(l,(0,a.default)(o)).then((function(t){e.postMessage((0,f.buildResponsePayload)(u,t))}))}}}return(0,u.default)(e,[{key:"respondTo",value:function(e){var t=this;e.addEventListener("message",(function(n){return t._onMessage(e,n)})),e.start()}}]),e}());t.default=l},dbjagcfebh:function(e,t,n){var r=n("bedeadcjdb");e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},ddghcccjbh:function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,s=[],f=!1,l=-1;function d(){f&&c&&(f=!1,c.length?s=c.concat(s):l=-1,s.length&&h())}function h(){if(!f){var e=u(d);f=!0;for(var t=s.length;t;){for(c=s,s=[];++l<t;)c&&c[l].run();l=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new v(e,t)),1!==s.length||f||u(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},deaafaigjj:function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},dejaibbcca:function(e,t,n){var r=n("cjedcdbdii");e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},dfadhaifh:function(e,t){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}},dfagheagjg:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.MissingVersionError=t.InvalidVersionError=t.DuplicateVersionError=void 0;var i=r(n("dgcdacjddi")),a=r(n("eaidjcib")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("bdhjjchdia")),f=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.DuplicateVersionError=f;var l=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.InvalidVersionError=l;var d=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,c.default)(t,e),t}((0,s.default)(Error));t.MissingVersionError=d;var h=function(){function e(){(0,a.default)(this,e),this.versions=new Set,this._max=-1}return(0,i.default)(e,[{key:"claim",value:function(e){if(e<0)throw new l("Versions must by greater than or equal to zero!");if(this.versions.has(e))throw new f("Version #".concat(e," has already been claimed!"));this.versions.add(e),this._max=Math.max(this.max,e)}},{key:"version",value:function(e){if(e<0)throw new l("Versions must by greater than or equal to zero!");return e}},{key:"validate",value:function(){for(var e=0;e<=this.max;++e)if(!this.versions.has(e))throw new d("Schema version #".concat(e," is missing!"))}},{key:"max",get:function(){return this._max}}]),e}();t.default=h},dfbiiieiig:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).column=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){(0,s.default)(-1!==(0,l.findIndex)(e,this._getIndex()),'Attempted to remove non-existent index "'.concat(this.column,'" on "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e),n=(0,l.findIndex)(e,this._getIndex());return t.indexes.splice(n,1),t}},{key:"_getIndex",value:function(){return{type:l.INDEX_TYPE.SIMPLE,column:this.column}}}]),t}(f.default);t.default=d},dfeaddeccc:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=self.crypto,i=r&&(r.subtle||r.webkitSubtle||r.subtle);t.default=i},dgcdacjddi:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},dgcjhgajfb:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncModelType=t.SyncActionState=t.CollectionSyncState=t.CollectionState=t.CollectionName=t.Actions=t.FINITE_FAILURE_EXPIRY_DURATION=t.BACKOFF_BASE=t.BACKOFF_MAX_TIMEOUT=t.BACKOFF_MIN_TIMEOUT=void 0;t.BACKOFF_MIN_TIMEOUT=1e3;t.BACKOFF_MAX_TIMEOUT=36e5;t.BACKOFF_BASE=2;t.FINITE_FAILURE_EXPIRY_DURATION=6048e5;var r=n("bjgidhichc")({Star:"star",Contact:"contact",Mute:"mute",Pin:"pin",SettingPushName:"setting_pushName",SettingSecurityNotification:"setting_securityNotification",LabelEdit:"label_edit",LabelMessage:"label_message",LabelContact:"label_contact",LabelChat:"label_chat",QuickReply:"quick_reply",LocaleSetting:"setting_locale"});t.Actions=r;var i=n("bjgidhichc")({InboxMetadata:"inbox_metadata",Generic:"generic",Unknown:"unknown"});t.CollectionName=i;var a=n("bjgidhichc").Mirrored(["Success","SuccessHasMore","Conflict","ErrorRetry","ErrorFatal"]);t.CollectionState=a;var o=n("bjgidhichc").Mirrored(["UpToDate","Dirty","FailingFiniteRetry","Fatal"]);t.CollectionSyncState=o;var u=n("bjgidhichc").Mirrored(["Success","Failed","Orphan","Unsupported"]);t.SyncActionState=u;var c=n("bjgidhichc").Mirrored(["Msg","Chat","Contact"]);t.SyncModelType=c},dgehfbdejh:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n("bedffdibce"),a=n("diedefahjf"),o=r(n("iciefchfa")),u={whoAmI:()=>o.default.invoke("whoAmI",[]),logImpl:(e,t,n)=>o.default.invoke("logImpl",[e,t,n]),initFromStorage:()=>(0,a.init)(),removeMessagesFromHistory:e=>(0,i.removeMessagesFromHistory)(e)};t.default=u},dgiiciaafc:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:String,a=(0,i.default)(e,t.map(r)).join(""),o=n?4e3:Number.POSITIVE_INFINITY;a.length>o&&(a=a.slice(0,o).replace(/\s+$/," [truncated]"));return a};var i=r(n("edaidbcjh"))},dgjadadgcb:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).column=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){(0,s.default)(-1!==(0,l.findIndex)(e,this._getIndex()),'Attempted to remove non-existent index "'.concat(this.column,'" on "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e),n=(0,l.findIndex)(e,this._getIndex());return t.indexes.splice(n,1),t}},{key:"_getIndex",value:function(){return{type:l.INDEX_TYPE.ARRAY,column:this.column}}}]),t}(f.default);t.default=d},dhciggahgi:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=function(){function e(t){(0,i.default)(this,e),this._view=t}return(0,a.default)(e,[{key:"_read",value:function(e){return e(this._view())}},{key:"_write",value:function(e){return e(this._view())}},{key:"create",value:function(e){return this._write((function(t){return t.create(e)}))}},{key:"createOrReplace",value:function(e){return this._write((function(t){return t.createOrReplace(e)}))}},{key:"createOrMerge",value:function(e,t){return this._write((function(n){return n.createOrMerge(e,t)}))}},{key:"get",value:function(e){return this._read((function(t){return t.get(e)}))}},{key:"merge",value:function(e,t){return this._write((function(n){return n.merge(e,t)}))}},{key:"remove",value:function(e){return this._write((function(t){return t.remove(e)}))}},{key:"bulkCreate",value:function(e){return this._write((function(t){return t.bulkCreate(e)}))}},{key:"bulkCreateOrReplace",value:function(e){return this._write((function(t){return t.bulkCreateOrReplace(e)}))}},{key:"bulkCreateOrMerge",value:function(e){return this._write((function(t){return t.bulkCreateOrMerge(e)}))}},{key:"bulkGet",value:function(e){return this._read((function(t){return t.bulkGet(e)}))}},{key:"bulkRemove",value:function(e){return this._write((function(t){return t.bulkRemove(e)}))}},{key:"all",value:function(e){return this._read((function(t){return t.all(e)}))}},{key:"count",value:function(){return this._read((function(e){return e.count()}))}},{key:"equals",value:function(e,t,n){return this._read((function(r){return r.equals(e,t,n)}))}},{key:"anyOf",value:function(e,t,n){return this._read((function(r){return r.anyOf(e,t,n)}))}},{key:"greaterThan",value:function(e,t,n){return this._read((function(r){return r.greaterThan(e,t,n)}))}},{key:"lessThan",value:function(e,t,n){return this._read((function(r){return r.lessThan(e,t,n)}))}},{key:"between",value:function(e,t,n,r){return this._read((function(i){return i.between(e,t,n,r)}))}},{key:"forEachSortedBy",value:function(e,t){return this._read((function(n){return n.forEachSortedBy(e,t)}))}},{key:"forEach",value:function(e){return this._read((function(t){return t.forEach(e)}))}},{key:"clear",value:function(){return this._write((function(e){return e.clear()}))}}]),e}();t.default=o},dhdjjbcibj:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ENCRYPTED_VALUE_TYPE=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=Object.freeze({STRING:"String",ARRAY_BUFFER:"ArrayBuffer"});t.ENCRYPTED_VALUE_TYPE=d;var h=function(e){function t(e,n){var r;return(0,i.default)(this,t),(r=(0,o.default)(this,(0,u.default)(t).call(this))).name=e,r.dataType=n,r}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this;(0,s.default)(!e.columns.find((function(e){return e.name===t.name})),'Attempted to add encrypted column "'.concat(this.name,'" to "').concat(e.name,'" but it already exists'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e);return t.columns.push({name:this.name}),t.encryptedColumns[this.name]=this.dataType,t}}]),t}(f.default);t.default=h},diaegabbjd:function(e,t,n){e.exports=n("jfegaeiac")},diaiajeedf:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).name=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this;(0,s.default)(!e.columns.find((function(e){return e.name===t.name})),'Attempted to add column "'.concat(this.name,'" to "').concat(e.name,'" but it already exists'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e);return t.columns.push({name:this.name}),t}}]),t}(f.default);t.default=d},dibgccbbif:function(e,t,n){"use strict";var r=n("ebjighhbai");Object.defineProperty(t,"__esModule",{value:!0}),t.encodeB64=function(e){return o(e,43,47,!0)},t.encodeB64UrlSafe=function(e){return o(e,45,95,!1)},t.decodeB64=function(e){var t=c(e,43,47,61);if(t)return t.buffer;throw new Error("Base64.decode given invalid string")},t.decodeB64UrlSafe=function(e){var t=c(e,45,95,-1);if(t)return t.buffer;throw new Error("Base64.decode given invalid string")},t.decodeB64ToJsArray=function(e){var t=e instanceof ArrayBuffer?new Uint8Array(e):c(e,43,47,61);return t&&Array.prototype.slice.call(t)},t.sizeWhenB64Decoded=function(e){return Math.floor(3*e.length/4)},t.BASE64_DATA_URL_SCHEME=void 0;var i=r(n("fecdihjci"));function a(){var e=(0,i.default)(["Found unexpected character code while decoding B64 at index ",", length ",": ",""]);return a=function(){return e},e}function o(e,t,n,r){var i=Array.isArray(e)||e instanceof ArrayBuffer?new Uint8Array(e):e;if(i.length<=3e3)return u(i,t,n,r);for(var a=[],o=0;o<i.length;o+=3e3)a.push(u(i.subarray(o,o+3e3),t,n,r));return a.join("")}function u(e,t,n,r){for(var i=Math.ceil(4*e.length/3),a=4*Math.ceil(e.length/3),o=new Array(a),u=0,c=0;u<a;u+=4,c+=3){var s=e[c]<<16|e[c+1]<<8|e[c+2];o[u]=s>>18,o[u+1]=s>>12&63,o[u+2]=s>>6&63,o[u+3]=63&s}for(var f=0;f<i;f++){var l=o[f];o[f]=l<26?65+l:l<52?71+l:l<62?l-4:62===l?t:n}for(var d=i;d<a;d++)o[d]=61;var h=String.fromCharCode.apply(String,o);return r?h:h.substring(0,i)}function c(e,t,n,r){for(var i=e.length,o=new Int32Array(i+i%4),u=0;u<i;u++){var c=e.charCodeAt(u);if(65<=c&&c<=90)o[u]=c-65;else if(97<=c&&c<=122)o[u]=c-71;else if(48<=c&&c<=57)o[u]=c+4;else if(c===t)o[u]=62;else{if(c!==n){if(c===r){i=u;break}return self.ERROR&&__LOG__(4,!1,new Error)(a(),u,i,c),null}o[u]=63}}for(var s=o.length/4,f=0,l=0;f<s;f++,l+=4)o[f]=o[l]<<18|o[l+1]<<12|o[l+2]<<6|o[l+3];for(var d=Math.floor(3*i/4),h=new Uint8Array(d),v=0,p=0;p+3<=d;v++,p+=3){var y=o[v];h[p]=y>>16,h[p+1]=y>>8&255,h[p+2]=255&y}switch(d-p){case 2:h[p]=o[v]>>16,h[p+1]=o[v]>>8&255;break;case 1:h[p]=o[v]>>16}return h}t.BASE64_DATA_URL_SCHEME="data:image/jpeg;base64,"},diedefahjf:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.init=function(){return(0,i.initializeWithoutGKs)().then((function(){return(0,r.getTable)().all().then((function(e){return Promise.all(e.map((function(e){var t=e.id||"";return(0,a.getTable)().between(["internalId"],"".concat(e.id,"_/"),"".concat(e.id,"_g"),{reverse:!0,limit:20}).then((function(e){return e.length>0&&null!=e[0].isOffline?{chatId:t,messages:[e[0]]}:{chatId:t,messages:e.reverse()}}))}))).then((function(t){return[e,t]}))}))}))};var r=n("cabjcaaibi"),i=n("bfcgiihhaf"),a=n("djebbjdaej");self.Promise=n("geadgcffe").default},dighidfgbc:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("dbjagcfebh")),s=r(n("cgeeeeddea")),f=r(n("chejdieege")),l=n("bfagiaicdd"),d=function(e){function t(e){var n;return(0,i.default)(this,t),(n=(0,o.default)(this,(0,u.default)(t).call(this))).column=e,n}return(0,c.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){var t=this,n=e.columns.find((function(e){return e.name===t.column}));(0,s.default)(n,'Attempted to add index on non-existent column "'.concat(this.column,'" in "').concat(e.name,'"')),(0,s.default)(n&&(!n.primaryKey||n.primaryKey===l.PRIMARY_KEY_TYPE.COMPOSITE),'Cannot add index on primary key on table "'.concat(e.name,'"')),(0,s.default)(!e.indexes.some((function(e){return(e.type===l.INDEX_TYPE.ARRAY||e.type===l.INDEX_TYPE.SIMPLE||e.type===l.INDEX_TYPE.UNIQUE)&&(0,l.indexContainsColumn)(e,t.column)})),'Attempted to add index "'.concat(this.column,'" which already exists in "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,l.cloneSchema)(e);return t.indexes.push(this._getIndex()),t}},{key:"_getIndex",value:function(){return{type:l.INDEX_TYPE.UNIQUE,column:this.column}}}]),t}(f.default);t.default=d},dijbahidec:function(e,t,n){"use strict";var r=n("bfejgijfbh"),i=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){a||((0,o.default)("undefined"!=typeof DedicatedWorkerGlobalScope&&self instanceof DedicatedWorkerGlobalScope,"Connect can only be called in WebWorker scope"),self.addEventListener("message",p),a=Promise.resolve(u.default.init()),f.default.setConnectionManager(u.default),d.set(c.default));return a};var a,o=i(n("cgeeeeddea")),u=i(n("eacbeadej")),c=i(n("dgehfbdejh")),s=n("bhabjiggjj"),f=i(n("iciefchfa")),l=i(n("dbeffhcjcb")),d=r(n("jfbhhdedh")),h=i(n("cahfddcdga")),v=[];function p(e){var t=e.data;if(!u.default.isConnected()){var n=(0,s.extractPortFromHandshakePayload)(t);if(null!=n)return u.default.connectVia(n),e.stopImmediatePropagation(),l.default.respondTo(n),void(0,h.default)(a,"connection").then((function(){self.removeEventListener("message",p),v.forEach((function(e){self.dispatchEvent(e)}))}))}v.push(e)}},dijfaihfc:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},dijiihaecd:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pendingMutationsCreateTable=function(){return(0,r.getStorage)().versions.version(0)},t.collectionVersionCreateTable=function(){return(0,r.getStorage)().versions.version(1)},t.syncActionsCreateTable=function(){return(0,r.getStorage)().versions.version(2)},t.syncActionsAddVersion=function(){return(0,r.getStorage)().versions.version(3)},t.pendingMutationsAddVersion=function(){return(0,r.getStorage)().versions.version(4)},t.syncActionsAddModelIdAndType=function(){return(0,r.getStorage)().versions.version(5)},t.contactCreateTable=function(){return(0,r.getStorage)().versions.version(6)},t.blocklistCreateTable=function(){return(0,r.getStorage)().versions.version(7)},t.profilePicThumbCreateTable=function(){return(0,r.getStorage)().versions.version(8)},t.chatCreateTable=function(){return(0,r.getStorage)().versions.version(9)},t.messageCreateTable=function(){return(0,r.getStorage)().versions.version(10)},t.messageInfoCreateTable=function(){return(0,r.getStorage)().versions.version(11)},t.participantCreateTable=function(){return(0,r.getStorage)().versions.version(12)},t.orphanReceiptCreateTable=function(){return(0,r.getStorage)().versions.version(13)},t.deviceListCreateTable=function(){return(0,r.getStorage)().versions.version(14)},t.inactiveReceiptCreateTable=function(){return(0,r.getStorage)().versions.version(15)},t.verifiedBusinessNameCreateTable=function(){return(0,r.getStorage)().versions.version(16)},t.historySyncNotificationsCreateTable=function(){return(0,r.getStorage)().versions.version(17)},t.encryptedMutationsCreateTable=function(){return(0,r.getStorage)().versions.version(18)},t.labelCreateTable=function(){return(0,r.getStorage)().versions.version(19)},t.labelAssociationCreateTable=function(){return(0,r.getStorage)().versions.version(20)},t.quickReplyCreateTable=function(){return(0,r.getStorage)().versions.version(21)},t.labelAssociationAddLabelIdIndex=function(){return(0,r.getStorage)().versions.version(22)},t.contactRemoveLabels=function(){return(0,r.getStorage)().versions.version(23)},t.deviceListAddCurrentIndex=function(){return(0,r.getStorage)().versions.version(24)},t.messageAddExpiredTimestamp=function(){return(0,r.getStorage)().versions.version(25)},t.labelAssociationAddAssociationIdTypeIndex=function(){return(0,r.getStorage)().versions.version(26)},t.labelRemoveColorAddColorIndex=function(){return(0,r.getStorage)().versions.version(27)};var r=n("ffjiicch")},djebbjdaej:function(e,t,n){"use strict";var r=n("bfejgijfbh"),i=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.addTable=function(){(0,l.getStorage)().add("message").version((0,h.messageCreateTable)(),[new d.default("id"),new o.default("internalId"),new f.default("internalId"),new o.default("rowId"),new f.default("rowId"),new c.default("body",c.ENCRYPTED_VALUE_TYPE.STRING),new o.default("type"),new o.default("subtype"),new o.default("t"),new o.default("notifyName"),new o.default("from"),new o.default("to"),new o.default("author"),new o.default("self"),new o.default("ack"),new o.default("invis"),new o.default("star"),new o.default("isStarred"),new s.default("isStarred"),new o.default("mentionedJidList"),new o.default("count"),new o.default("devicesAdded"),new o.default("devicesRemoved"),new o.default("isSelfDevicesChanged"),new o.default("isThisDeviceAdded"),new o.default("recipients"),new o.default("protocolMessageKey"),new o.default("templateParams"),new o.default("chatId"),new u.default(["internalId","isStarred"]),new o.default("vcardWAids"),new a.default("vcardWAids"),new o.default("hasLink"),new o.default("isMediaMsg"),new o.default("isDocMsg"),new u.default(["internalId","isMediaMsg"]),new u.default(["internalId","isDocMsg"]),new u.default(["internalId","hasLink"]),new o.default("offline"),new o.default("isOffline"),new c.default("offlineBuffer",c.ENCRYPTED_VALUE_TYPE.ARRAY_BUFFER),new f.default("isOffline"),new o.default("ephemeralStartTimestamp"),new o.default("ephemeralDuration"),new o.default("ephemeralSettingTimestamp"),new o.default("ephemeralOutOfSync")]).version((0,h.messageAddExpiredTimestamp)(),[new o.default("expiredTimestamp"),new s.default("expiredTimestamp")]).view((function(e){return e})).enablePropFilter(!1)},t.getTable=function(){return(0,l.getStorage)().table("message")};var a=i(n("bdhhdbcefi")),o=i(n("diaiajeedf")),u=i(n("djfjgifhj")),c=r(n("dhdjjbcibj")),s=i(n("bhjiahgdac")),f=i(n("dighidfgbc")),l=n("ffjiicch"),d=i(n("ebhdfjjdeb")),h=n("dijiihaecd")},djecdhecha:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},djfjgifhj:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("bhfcfhafdj")),a=r(n("eaidjcib")),o=r(n("dgcdacjddi")),u=r(n("ffceefejc")),c=r(n("cjedcdbdii")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=r(n("chejdieege")),d=n("bfagiaicdd"),h=function(e){function t(e){var n;return(0,a.default)(this,t),(n=(0,u.default)(this,(0,c.default)(t).call(this))).columns=(0,i.default)(e),n}return(0,s.default)(t,e),(0,o.default)(t,[{key:"validate",value:function(e){var t=this;this.columns.forEach((function(t){(0,f.default)(e.columns.find((function(e){return e.name===t})),'Attempted to add index on non-existent column "'.concat(t,'" in "').concat(e.name,'"'))})),(0,f.default)(this.columns.length>1,"Attempted to add composite index for only 1 column"),(0,f.default)(-1===(0,d.findIndex)(e,this._getIndex()),"Attempted to add index [".concat(String(this.columns),'], which already exists in "').concat(e.name,'"'));var n=e.columns.filter((function(e){return e.primaryKey&&e.primaryKey===d.PRIMARY_KEY_TYPE.COMPOSITE})).map((function(e){return e.name}));(0,f.default)(n.length!==this.columns.length||n.some((function(e){return!t.columns.includes(e)})),"Attempted to add index [".concat(String(this.columns),'], which already is the primary key in "').concat(e.name,'"'))}},{key:"apply",value:function(e){var t=(0,d.cloneSchema)(e);return t.indexes.push(this._getIndex()),t}},{key:"_getIndex",value:function(){return{type:d.INDEX_TYPE.COMPOSITE,columns:this.columns}}}]),t}(l.default);t.default=h},djghaahgac:function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}}},eacbeadej:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("cgeeeeddea")),u=r(n("cahfddcdga")),c=new(function(){function e(){(0,i.default)(this,e)}return(0,a.default)(e,[{key:"init",value:function(){var e=this;return this._promise||(this._promise=new Promise((function(t){e._resolver=t})).timeout(5e3)),this._promise}},{key:"isConnected",value:function(){return null!=this._port}},{key:"getPort",value:function(){return this._port}},{key:"waitForConnection",value:function(){return(0,u.default)(this._promise,"ConnectionManager Initialization Promise")}},{key:"connectVia",value:function(e){if(this.isConnected())throw new Error("Connection already established");(0,o.default)(this._resolver,"ConnectionManager not initialized"),this._port=e,this._resolver()}}]),e}());t.default=c},eafdicgcb:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.addTable=function(){(0,a.getStorage)().add("collection-version").version((0,u.collectionVersionCreateTable)(),[new o.default("collection"),new i.default("version"),new i.default("state"),new i.default("finiteFailureStartTime")]).view((function(e){return e}))},t.getTable=function(){return(0,a.getStorage)().table("collection-version")};var i=r(n("diaiajeedf")),a=n("ffjiicch"),o=r(n("ebhdfjjdeb")),u=n("dijiihaecd")},eaidjcib:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},ebhdfjjdeb:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("ffceefejc")),u=r(n("cjedcdbdii")),c=r(n("bjehdcaaj")),s=r(n("dbjagcfebh")),f=r(n("cgeeeeddea")),l=r(n("ciefddeegi")),d=n("bfagiaicdd"),h=function(e){function t(){return(0,i.default)(this,t),(0,o.default)(this,(0,u.default)(t).apply(this,arguments))}return(0,s.default)(t,e),(0,a.default)(t,[{key:"validate",value:function(e){(0,c.default)((0,u.default)(t.prototype),"validate",this).call(this,e),(0,f.default)(this.columns&&1===this.columns.length,"Attempted to add UserDefinedPrimaryKey over wrong number of columns")}},{key:"apply",value:function(e){var t=(0,d.cloneSchema)(e);return t.columns.unshift({name:this.columns[0],primaryKey:d.PRIMARY_KEY_TYPE.USER_DEFINED}),t}}]),t}(l.default);t.default=h},ebjighhbai:function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},ecjageddib:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.addTable=function(){(0,s.getStorage)().add("sync-actions").version((0,l.syncActionsCreateTable)(),[new f.default("index"),new i.default("value"),new i.default("actionState"),new i.default("timestamp"),new i.default("keyId"),new o.default("actionState"),new a.default(["index","actionState"])]).version((0,l.syncActionsAddVersion)(),[new i.default("type"),new i.default("version"),new u.default("timestamp")]).version((0,l.syncActionsAddModelIdAndType)(),[new i.default("modelId"),new i.default("modelType"),new a.default(["modelId","modelType","actionState"]),new c.default(["index","actionState"])]).view((function(e){return e}))},t.getTable=function(){return(0,s.getStorage)().table("sync-actions")};var i=r(n("diaiajeedf")),a=r(n("djfjgifhj")),o=r(n("bhjiahgdac")),u=(n("dgcjhgajfb"),r(n("caiahabcfd"))),c=r(n("ceccbdjfci")),s=n("ffjiicch"),f=r(n("ebhdfjjdeb")),l=n("dijiihaecd")},edaidbcjh:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var n=[],r=e.length,i=t.length,a=Math.max(r,i),o=0;o<a;o++)o<r&&n.push(e[o]),o<i&&n.push(t[o]);return n}},fecdihjci:function(e,t){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}},ffceefejc:function(e,t,n){var r=n("deaafaigjj"),i=n("djecdhecha");e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},ffedgcdgj:function(e,t){function n(e,t,n,r,i,a,o){try{var u=e[a](o),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var o=e.apply(t,r);function u(e){n(o,i,a,u,c,"next",e)}function c(e){n(o,i,a,u,c,"throw",e)}u(void 0)}))}}},ffjiicch:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.createStorage=function(){var e=new o.default("model-storage",a.default);c=new u.default(e)},t.getStorage=function(){return(0,i.default)(null!=c,"[model-storage] Storage should be created first before being accessed"),c},t.destroyStorage=function(){if(null==c)return Promise.reject(new Error("[model-storage] Storage should be created first before being destroyed"));return c.purge().then((function(){c=null})).catch((function(e){throw c=null,e}))},t.DATABASE_NAME=void 0;var i=r(n("cgeeeeddea")),a=r(n("cjhficgjgc")),o=r(n("bchejfgdg")),u=r(n("cdiffgjfcb"));t.DATABASE_NAME="model-storage";var c=null},geadgcffe:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var n,r="undefined"!=typeof Promise?Promise:null,i=0,a=[],o=[],u=[],c={sentinel:"CONTINUE_AS_IF_NO_HANDLER"},s={sentinel:"RETRY_ASYNCHRONOUSLY"},f={sentinel:"TO_STRING"},l={sentinel:"DID_ERROR"},d=null,h=[];function v(e,t){var n=this;this._flags=0,this._value=void 0,this._onFulfilled=void 0,this._onRejected=void 0,this._context=void 0,this._resolveLevel=0,this._control=void 0,this.x=void 0,this._thenableParent=null,this._parent=void 0,this._child=void 0,this._children=void 0,this.control=void 0,t&&(this._context=t.this),"function"==typeof e&&(this._onFulfilled=e,this._flags|=4,this._flags|=256,q(e,this._context,(function(e){return D(n,0,!0,!1,e)}),(function(e){return D(n,0,!1,!1,e)})))}function p(e){if(void 0===e)return n;if(R(e))return e;var t=new v;return D(t,0,!0,!1,e),G(t,512),t}function y(e){var t=new v;return t._value=e,G(t,514),h.push(t),t}function g(e){var t=arguments.length-1;if(0===t)return this.then(void 0,e);for(var n=new Array(t),r=0;r<t;r++)n[r]=K(arguments[r]);var i=U(n,arguments[t]),a=N(this,void 0,i);return a._onRejected&&G(a,128),a}function b(e){return new v((function(t,n){var r=e.length;if(0!==r)for(var i=new Array(e.length),a=0;a<e.length;a++)i[a]=N(e[a],o,n);else t([]);function o(e){if(0==--r){for(var n=[],a=0;a<i.length;a++){var o=i[a];n.push(o&&3&o._flags?o._value:e)}t(n)}return e}}))}function m(e,t){this.errors=e||[],this.message=t||"".concat(this.errors.length," errors")}function _(e){var t="";if(128&e._flags)t=(e._onFulfilled||e._onRejected).call(e._context,f);else if(e._control)t=".addRawControl(".concat(e._control.name,", ").concat(e._control.foo,")");else if(16&e._flags)t=".endWithControls(".concat(Object.keys(e.control),")");else if(512&e._flags)t=1&e._flags?"Promise.resolve(".concat(void 0===e._value?"":e._value,")"):"Promise.reject(".concat(void 0===e._value?"":e._value,")");else if(256&e._flags)switch(3&e._flags){case 2:case 0:case 1:t="new Promise(".concat(e._onFulfilled,")")}else e._onFulfilled&&e._onRejected?t=".then(".concat(e._onFulfilled,", ").concat(e._onRejected,")"):e._onFulfilled?t=".then(".concat(e._onFulfilled,")"):e._onRejected&&(t=".catch(".concat(e._onRejected,")"));return t}function w(e,t){return new v((function(n){var r=M(t);R(r)&&G(r,8),setTimeout(n,e,r)}))}function j(e){this.message=e||"StackPromise timed out"}function k(e,t){var n;if(arguments.length>2){n=new Array(arguments.length-2);for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r]}return new v((function(r){r(e.apply(t,n))}))}function E(e,t,n,r){this.name=e,this.foo=t,this.lightning=!!n,this.canRunMultipleTimes=!!r}function x(e,t){return function(){for(var n,r,i=e._parent;i&&!(3&i._flags)&&!(16&i._flags);i=i._parent)!i._control||i._control.name!==t||4&i._flags||(n=i);if(!n)return v.NO_ACTIVE_CONTROL;if(n._control.canRunMultipleTimes||G(n,4),arguments.length>0){r=new Array(arguments.length);for(var a=0;a<arguments.length;a++)r[a]=arguments[a]}return n._control.foo.call(n._context,(function(e){return F(n,n._resolveLevel,!0,!1,e)}),(function(e){return F(n,n._resolveLevel,!1,!1,e)}),n._parent,r)}}function O(e){this.message=e,this.stack=new Error(e||this.name).stack}v.resolve=p,v.reject=y,v.prototype.then=function(e,t){"function"!=typeof e&&(e=void 0),"function"!=typeof t&&(t=void 0);var n=new v;n._onFulfilled=e,n._onRejected=t,n._context=this._context,64&this._flags&&G(n,64);var r=3&this._flags;return 0===r?T(this,n):(G(this,8),(1===r?e:t)?(n._parent=this,o.push(n),A()):(n._parent=this,G(n,r),n._value=this._value,2===r&&h.push(n))),n},v.prototype.catch=g,v.prototype.catchType=g,v.prototype.catchTypes=g,v.prototype.catchTypes3=g,v.prototype.catchEqualTo=g,v.prototype.catchConditional=g,v.prototype.end=function(e){var t=this.then();if(G(t,16),t.control={},t._context=void 0,e){var n=e.controls;if(n)for(var r=0;r<n.length;r++){var i=n[r];t.control[i]=x(t,i)}return t}},v.prototype.endWithControls=function(){var e=this.then();G(e,16),e.control={},e._context=void 0;for(var t=0;t<arguments.length;t++){var n=arguments[t];e.control[n]=x(e,n)}return e},v.all=b,v.allSettled=function(e){return new v((function(t){var n=Array.from(e),r=n.length;if(0!==r)for(var i=new Array(n.length),a=c(!1),o=c(!0),u=0;u<n.length;u++)i[u]=N(n[u],a,o);else t([]);function c(e){return function(n){var a=e?{status:"rejected",reason:n}:{status:"fulfilled",value:n};if(0==--r){for(var o=[],u=0;u<i.length;u++){var c=i[u];o.push(c&&3&c._flags?c._value:a)}t(o)}return a}}}))},v.any=function(e){return new v((function(t,n){var r=e.length;0===r&&n(new m([],"StackPromise.any called with []"));var i=new Array(e.length);function a(e){if(0==--r){for(var t=[],a=0;a<i.length;a++){var o=i[a];t.push(o&&3&o._flags?o._value:e)}n(new m(t))}return e}for(var o=0;o<e.length;o++)i[o]=N(e[o],t,a)}))},v.props=function(e){var t=Object.keys(e),n=v.all(t.map((function(t){return e[t]})));function r(e){for(var n={},r=0;r<e.length;r++)n[t[r]]=e[r];return n}switch(3&n._flags){case 2:return n;case 0:return G(n.then(r),32);case 1:return n._value=r(n._value),n}},v.map=function(e,t){var n=!0;var r=b(e.map((function(e,r){return p(e).then(function(e){return function(r){return n&&t(r,e)}}(r))})));switch(3&r._flags){case 2:n=!1;break;case 0:G(r=r.catch((function(){return n=!1,c})),32)}return r},v.reduce=function(e,t,n){return p(e).reduce(t,n)},v.prototype.reduce=function(e,t){return t=M(t),N(this,(function(n,r){if(0===n.length)return t;if(r)return s;for(var i=new Array(n.length),a=0;a<n.length;a++){var o=i[a]=M(n[a]);R(o)&&G(o,8)}var u=this,c=0;return function n(){for(var r=i.length;;){var a=c,o=i[a];if(R(o))switch(3&o._flags){case 2:return o;case 0:return o.then(n);case 1:o=o._value}if(R(t))switch(3&t._flags){case 2:return t;case 0:return t.then(n);case 1:t=t._value}var s=e.call(u,t,o,a,r);if(++c===r)return s;if(R(s=M(s)))switch(3&s._flags){case 2:return s;case 0:return t=s,s.then(n);case 1:G(s,8),t=s._value}else t=s}}()}))},v.each=function(e,t){return p(e).each(t)},v.prototype.each=function(e){var t=[];return this.reduce((function(n,r,i,a){return t.push(r),e.call(this,r,i,a)})).then((function(){return t}))},v.mapSeries=function(e,t){return p(e).mapSeries(t)},v.prototype.mapSeries=function(e){return this.reduce((function(t,n,r,i){var a=M(e.call(this,n,r,i));return R(a)?a.then((function(e){return t.push(e),t})):(t.push(a),t)}),[])},v.race=function(e){var t=M(e);if(R(t)){var n=t.then((function(e){return v.race(e)}));return n._context=void 0,n._flags&=-65,n}return new v((function(e,n){for(var r=0;r<t.length;r++){var i=M(t[r]);if(!R(i)||3&i._flags)for(e(i),r++;r<t.length;r++){var a=t[r];R(a)&&G(a,8)}else i.then(e,n)}}))},m.prototype=Object.create(Error.prototype,{name:{value:"AggregateError"}}),v.AggregateError=m,v.onPossiblyUnhandledRejection=function(e,t){console.error("StackPromise did not catch ".concat(e),t,e)},v.prototype.toString=function(){for(var e,t=[],n=this,r=!1;n;n=n._parent){e=n,!r&&3&n._flags&&(r=!0,512&n._flags||(1&n._flags?t.push("[resolved value: ".concat(n._value,"]")):t.push("[rejected reason: ".concat(n._value,"]"))));var i=_(n);1024&n._flags&&(i="~".concat(i)),t.push(i)}return t.reverse(),768&e._flags||(t[0]="[Promise]".concat(t[0])),t.join("\n")},v.delay=w,v.prototype.delay=function(e){return this.then((function(t){return w(e,t)}))},v.prototype.timeout=function(e,t){if(0!=(3&this._flags))return this.then();var n;function r(r){return r===f?".timeout(".concat(e,", ").concat(t,")"):(clearTimeout(n),c)}var i=this.then(r,r);return G(i,160),n=setTimeout((function(e,t){3&e._flags||F(e,0,!1,!1,t instanceof Error?t:new j(t))}),e,i,t),i},j.prototype=Object.create(Error.prototype,{name:{value:"TimeoutError"}}),v.TimeoutError=j,v.prototype.isFulfilled=function(){return!!(1&this._flags)},v.prototype.isRejected=function(){return!!(2&this._flags)},v.prototype.isPending=function(){return!(3&this._flags)},v.prototype.value=function(){if(1&this._flags)return this._value;throw new Error(2&this._flags?"value() called on StackPromise that was rejected":"value() called on StackPromise that is pending")},v.prototype.reason=function(){if(2&this._flags)return this._value;throw new Error(1&this._flags?"reason() called on StackPromise that was fulfilled, not rejected":"reason() called on StackPromise that is pending")},v.callSynchronously=k,v.wrap=function(e){return function(){var t,n,r=this;if(arguments.length>0){t=new Array(arguments.length);for(var i=0;i<arguments.length;i++)t[i]=arguments[i]}var a=function(i){if(i===f)return".wrap(".concat(e,").apply(").concat(r,", [").concat(t,"])");var a=e.apply(r,t);return R(a)&&8&a._flags&&G(n,8),a};return G(n=p().then(a),128),n}},v.wrapSync=function(e){return function(){try{return p(e.apply(this,arguments))}catch(e){return y(e)}}},v.loop=function(e,t){return p(t).loop(e)},v.prototype.loop=function(e){var t=N(this.then((function(n){var r=this,i=0,a=function(e){return F(t,0,!0,!1,e)};return function n(o){return k(e,r,a,o,i++).then((function(e){if(!(3&t._flags))return n(e)}))}(n)})),(function(t){return t===f?".loop(".concat(e,")"):c}));return G(t,128),t},v.prototype.checkpoint=function(e){function t(t){return t===f?".checkpoint(".concat(e,")"):2&e._flags?e:c}e=p(e);var n=this.then(t,t);return G(n,128),n},v.prototype.finally=function(e){function t(t){return t===f?".finally(".concat(e,")"):(e.call(this,t),c)}return G(this.then(t,t),128)},v.prototype.get=function(e){var t=this.then((function(t){return t===f?".get('".concat(e,"')"):t[e]}));return G(t,128),t},v.prototype.tap=function(e){return G("function"!=typeof e?this.then(S):this.then((function(t){return t===f?".tap(".concat(e,")"):(e.call(this,t),c)})),128)},v.prototype.spread=function(e){var t=this.then((function(t){return t===f?".spread(".concat(e,")"):e.apply(this,t)}));return G(t,128),t},v.prototype.throw=function(e){return this.then((function(){return y(e)}))},v.Control=E,v.NO_ACTIVE_CONTROL=new Error("No active control was found."),v.prototype.addControl=function(e){if(!(e instanceof E))throw new Error("addControl must be given Control, but got ".concat(e));var t=this.then(e.lightning?void 0:S);return t._control=e,t},v.prototype.addRawControl=function(e,t,n,r){return this.addControl(new E(e,t,n,r))},v.prototype.addResolveControl=function(e,t,n,r){return this.addControl(new E(e,(function(e,n,r,i){try{e(t.apply(this,i))}catch(e){n(e)}}),n,r))},v.prototype.addRejectControl=function(e,t,n,r){return this.addControl(new E(e,(function(e,n,r,i){try{n(t.apply(this,i))}catch(e){n(e)}}),n,r))},O.prototype=Object.create(Error.prototype,{name:{value:"CancellationError"}}),v.CancellationError=O;var I,P=new E("cancel",(function(e,t,n,r){t(new O(r&&r[0]))}),!1,!1);function A(){var t,n;0===i&&(o.length||h.length)&&(i=1,I||(n=0,I="undefined"==typeof MutationObserver||self&&self.navigator&&self.navigator.standalone?r?function(){r.resolve().then(z)}:"function"==typeof e?function(){e(z)}:function(){setTimeout(z,0)}:(t=document.createTextNode(""),new MutationObserver(z).observe(t,{characterData:!0}),function(){t.data=n=1-n})),I())}function S(e){return e===f?".tap()":c}function T(e,t){G(e,8),t._parent=e,e._children?e._children.push(t):e._child?(e._children=[e._child,t],e._child=void 0):e._child=t}function C(e){if(e&&("object"==typeof e||"function"==typeof e)){var t;try{t=e.then}catch(e){return d=e,l}if("function"==typeof t)return t}}function M(e){if(!e||R(e))return e;var t=C(e);if(t===l)return y(d);if(t){var n=new v((function(n,r){t.call(e,n,r)}));return n._thenableParent=e,n}return e}function R(e){return e instanceof v}function N(e,t,n){var r,i,a,o,u=R(e=M(e)),f=!1;if(u){if(!(3&e._flags))return G(e.then(t,n),32);G(e,8),f=!!(64&e._flags),a=e._context,r=1&e._flags?t:n,i=e._value}else r=t,i=e;if(!r)return p(e).then();if((i=W(r,a,i,!0))===l)o=y(d);else{if(i===s)return p(e).then(t,n);if(i===c)return u?e.then():p(e);o=p(i)}return f&&(o=o.cancellable()),void 0!==a&&((o=o.then())._context=a),o}function D(e,t,n,r,i){if(t===e._resolveLevel){var a=++e._resolveLevel;if(G(e,4),e._thenableParent=null,n)if(i===e)e._parent=void 0,B(e,!1,r,new TypeError("promise resolved to itself"));else if(R(i)){var o=3&i._flags;0===o?T(i,e):(e._parent=i,G(e,1024),G(i,8),B(e,1===o,r,i._value))}else{var u=C(i);u===l?(e._parent=void 0,B(e,!1,r,d)):u?(e._parent=void 0,e._thenableParent=i,q(u,i,(function(t){return D(e,a,!0,!1,t)}),(function(t){return D(e,a,!1,!1,t)}))):B(e,!0,r,i)}else B(e,!1,r,i)}}function F(e,t,n,r,i){t===e._resolveLevel&&(L(e),D(e,t,n,r,i))}function L(e){if(e._parent){var t=e._parent;if(e._parent=void 0,t._child===e)t._child=void 0;else if(t._children){for(var n=t._children,r=0;r<n.length;r++)if(n[r]===e){n.splice(r,1);break}0===n.length&&(t._children=void 0)}}}function K(e){if(null==e)throw new Error("Invalid .catch guard ".concat(e));if("function"==typeof e)return e;if("object"==typeof e)throw new Error("Object guards in .catch are currently unsupported");return function(t){return t===e}}function U(e,t){return function(n,r){return n===f?".catch(..., ".concat(t,")"):e&&!function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r===Error||r.prototype instanceof Error){if(t instanceof r)return!0}else if(r(t))return!0}return!1}(e,n)?c:r?s:t.call(this,n)}}function B(e,t,n,r){if(G(e,4|(t?1:2)),e._value=r,e._child)Y(e._child,t,n,r),e._child=void 0;else if(e._children){var i=e._children;e._children=void 0;for(var a=0;a<i.length;a++)Y(i[a],t,n,r)}else t||8&e._flags||h.push(e)}function Y(e,t,n,r){e._resolveLevel++;var i=H(e,t);if(i&&32&e._flags){G(e,4);var a=W(i,e._context,r,!0);if(a!==s)return void(a===l?(e._parent=void 0,B(e,!1,n,d)):a===c?B(e,t,n,r):(e._parent=void 0,D(e,e._resolveLevel,!0,n,a)));e._flags&=-5}i?((n?u:o).push(e),A()):B(e,t,n,r)}function V(e,t){for(;0!==e.length;)t.push(e.pop())}function z(){for(;0!==a.length||0!==o.length;){0===a.length&&V(o,a);var e=a.pop(),t=e._parent,n=!!(t&&1&t._flags),r=t&&t._value,f=H(e,n);if(G(e,4),f){var p=void 0;do{p=W(f,e._context,r,!1)}while(p===s);p===l?(r=d,n=!1,e._parent=void 0):p!==c&&(r=p,n=!0,e._parent=void 0)}3&e._flags||(D(e,e._resolveLevel,n,!0,r),V(u,a))}for(i--;0!==h.length;){var y=h.pop();8&y._flags||v.onPossiblyUnhandledRejection(y._value,y)}}function q(e,t,n,r){try{e.call(t,n,r)}catch(e){r(e)}}function H(e,t){if(!(4&e._flags))return t?e._onFulfilled:e._onRejected}function W(e,t,n,r){try{return r?e.call(t,n,!0):e.call(t,n)}catch(e){return d=e,l}}function G(e,t){return e._flags|=t,e}v.prototype.addCancelControl=function(){return G(this.addControl(P),64)},v.sit=function(e,t){var n=new v;return n._control=new E(e,(function(e,n,r,i){e(t?t.apply(void 0,i):i&&i[0])})),n},v.prototype.cancellable=function(){return G(this.then(),64)},v.prototype.uncancellable=function(){var e=this.then();return e._flags&=-65,e},v.prototype.cancel=function(e){for(var t,n=this;n&&!(3&n._flags);n=n._parent)64&n._flags&&(t=n);if(t)if(void 0===e&&(e=new O),H(t,!1)){var r=new v;L(t),T(r,t),F(r,0,!1,!1,e)}else F(t,t._resolveLevel,!1,!1,e)},D(n=new v,0,!0,!1,void 0)}).call(this,n("bgjhiaabcf").setImmediate)},gfefdcejf:function(e,t,n){var r=n("cgigihhddi");e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},hbddjfeei:function(e,t,n){var r=n("dijfaihfc"),i=n("djghaahgac"),a=n("gfefdcejf"),o=n("ccacajdfje");e.exports=function(e,t){return r(e)||i(e,t)||a(e,t)||o()}},hedaedjec:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},hihjbfggf:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},iciefchfa:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n("eaidjcib")),a=r(n("dgcdacjddi")),o=r(n("cgeeeeddea")),u=n("cbefiijcca"),c=n("cgcccbajji"),s=r(n("cahfddcdga")),f=n("chjdedjjda"),l=new(function(){function e(){var t=this;(0,i.default)(this,e),this._pending=new Map,this._onResponseReceipt=function(e){var n=(0,f.unwrapResponsePayload)(e.data);if(null!=n){var r=n.invocationId,i=n.result;if(t._pending.has(r))(0,(0,s.default)(t._pending.get(r),"_this._pending.get(invocationId)").resolve)(i),t._pending.delete(r)}}}return(0,a.default)(e,[{key:"setConnectionManager",value:function(e){var t=this;this._conn=e,e.waitForConnection().then((function(){var n=(0,s.default)(e.getPort(),"Port obtained from ConnectionManager after connection");n.addEventListener("message",t._onResponseReceipt),n.start()}))}},{key:"invoke",value:function(e,t){var n=this;return(0,o.default)(this._conn,"Connection has not been inited"),this._conn.waitForConnection().then((function(){(0,o.default)(n._conn,"Connection has not been inited");var r=(0,s.default)(n._conn.getPort(),"Port obtained from ConnectionManager after connection"),i=(0,c.genInvocationId)();return r.postMessage((0,u.buildInvocationPayload)({invocationId:i,method:e,args:t})),new Promise((function(e,t){n._pending.set(i,{resolve:e,reject:t})}))}))}}]),e}());t.default=l},jdfddifba:function(e,t,n){self.Promise=n("geadgcffe").default;var r=n("jfbhhdedh"),i=r.log,a=r.sendLogs;self.__LOG__=i,self.SEND_LOGS=a;(0,n("dijbahidec").default)().then((function(){self.addEventListener("message",(function(){}))}))},jfbhhdedh:function(e,t,n){"use strict";var r=n("cfjecfhbfg");Object.defineProperty(t,"__esModule",{value:!0}),t.set=function(e){i=e},t.get=c,t.sendLogs=function(){throw new Error("Not yet implemented")},t.log=void 0;var i,a=r(n("dgiiciaafc")),o=r(n("bdbhhedcfi")),u=r(n("cahfddcdga"));function c(){return(0,u.default)(i,"InvocationInterface was not inited")}var s=(0,o.default)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];var s,f=(0,a.default)(r,o,!t);return n&&(s={name:n.name,stack:n.stack}),c().logImpl(e,f,s),f}}),(function(e,t,n){return n?null:"".concat(e).concat(t?"Verbose":"")}));t.log=s},jfegaeiac:function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new j(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var u=m(o,n);if(u){if(u===s)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var f=c(e,t,n);if("normal"===f.type){if(r=n.done?"completed":"suspendedYield",f.arg===s)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(r="completed",n.method="throw",n.arg=f.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var s={};function f(){}function l(){}function d(){}var h={};h[i]=function(){return this};var v=Object.getPrototypeOf,p=v&&v(v(k([])));p&&p!==t&&n.call(p,i)&&(h=p);var y=d.prototype=f.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,u){var s=c(e[i],e,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,u)}),(function(e){r("throw",e,o,u)})):t.resolve(l).then((function(e){f.value=e,o(f)}),(function(e){return r("throw",e,o,u)}))}u(s.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function m(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,m(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function k(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=y.constructor=d,d.constructor=l,d[o]=l.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},g(b.prototype),b.prototype[a]=function(){return this},e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(y),y[o]="Generator",y[i]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=k,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,s):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},jfjadidfi:function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment