@liascript/exporter 2.5.8--0.10.30 → 2.6.0--0.10.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +162 -0
  2. package/dist/assets/capacitor/{Browser.2af01b1f.js → Browser.5082dda8.js} +1 -1
  3. package/dist/assets/capacitor/index.3881155a.js +2 -0
  4. package/dist/assets/capacitor/index.bf88b71e.js +1 -0
  5. package/dist/assets/capacitor/index.html +1 -1
  6. package/dist/assets/indexeddb/{Browser.6b8ed70b.js → Browser.649e16ad.js} +1 -1
  7. package/dist/assets/indexeddb/{Browser.1b782839.js → Browser.d375e114.js} +1 -1
  8. package/dist/assets/indexeddb/index.a0cf34b4.js +1 -0
  9. package/dist/assets/indexeddb/index.b213d7fb.js +1 -0
  10. package/dist/assets/{scorm1.2/index.3f87aa11.js → indexeddb/index.c239bf26.js} +1 -1
  11. package/dist/assets/indexeddb/index.eb14aca6.js +1 -0
  12. package/dist/assets/indexeddb/index.html +1 -1
  13. package/dist/assets/pdf/Base.dfce8330.js +1 -0
  14. package/dist/assets/pdf/index.1a4303bf.js +1 -0
  15. package/dist/assets/pdf/index.40f97d1a.js +1 -0
  16. package/dist/assets/pdf/index.html +1 -1
  17. package/dist/assets/scorm1.2/index.1a43c3cf.js +1 -0
  18. package/dist/assets/scorm1.2/index.697f72c7.js +1 -0
  19. package/dist/assets/scorm1.2/index.a0cf34b4.js +1 -0
  20. package/dist/assets/{scorm2004/index.3f87aa11.js → scorm1.2/index.c239bf26.js} +1 -1
  21. package/dist/assets/scorm1.2/index.html +1 -1
  22. package/dist/assets/scorm2004/index.42ca750d.js +1 -0
  23. package/dist/assets/scorm2004/index.a0cf34b4.js +1 -0
  24. package/dist/assets/scorm2004/index.c239bf26.js +1 -0
  25. package/dist/assets/scorm2004/index.d364acfd.js +1 -0
  26. package/dist/assets/scorm2004/index.html +1 -1
  27. package/dist/assets/web/Base.54729a0c.js +1 -0
  28. package/dist/assets/web/Base.74505e58.js +1 -0
  29. package/dist/assets/web/index.a0cf34b4.js +1 -0
  30. package/dist/assets/web/index.a1534295.js +1 -0
  31. package/dist/assets/web/index.ade7f70f.js +1 -0
  32. package/dist/assets/web/index.c239bf26.js +1 -0
  33. package/dist/assets/web/index.html +1 -1
  34. package/dist/index.js +1 -1
  35. package/package.json +3 -1
  36. package/src/export/helper.ts +23 -0
  37. package/src/export/rdf.ts +227 -0
  38. package/src/index.ts +27 -3
  39. package/dist/assets/capacitor/index.6418b617.js +0 -1
  40. package/dist/assets/capacitor/index.9cc0286d.js +0 -2
  41. package/dist/assets/indexeddb/index.1a32b3c6.js +0 -1
  42. package/dist/assets/indexeddb/index.4890a134.js +0 -1
  43. package/dist/assets/indexeddb/index.907e0468.js +0 -1
  44. package/dist/assets/indexeddb/index.f7bddd51.js +0 -1
  45. package/dist/assets/pdf/Base.1408401d.js +0 -1
  46. package/dist/assets/pdf/index.ba366374.js +0 -1
  47. package/dist/assets/pdf/index.ff442846.js +0 -1
  48. package/dist/assets/scorm1.2/index.4a92e335.js +0 -1
  49. package/dist/assets/scorm1.2/index.607bde0c.js +0 -1
  50. package/dist/assets/scorm1.2/index.c71d23fb.js +0 -1
  51. package/dist/assets/scorm2004/index.250ec73b.js +0 -1
  52. package/dist/assets/scorm2004/index.2ed9b743.js +0 -1
  53. package/dist/assets/scorm2004/index.c71d23fb.js +0 -1
  54. package/dist/assets/web/Base.1b8501a4.js +0 -1
  55. package/dist/assets/web/Base.ec3f3075.js +0 -1
  56. package/dist/assets/web/index.1021a2ea.js +0 -1
  57. package/dist/assets/web/index.47a12822.js +0 -1
  58. package/dist/assets/web/index.4890a134.js +0 -1
  59. package/dist/assets/web/index.f7bddd51.js +0 -1
package/README.md CHANGED
@@ -134,6 +134,15 @@ Project settings:
134
134
  --project-category-blur Enable this and the categories will be blurred instead of deleted.
135
135
  --project-generate-pdf PDFs are automatically generated and added to every card.
136
136
  --project-generate-cache Only generate new files, if they do not exist.
137
+
138
+ RDF settings:
139
+
140
+ --rdf-format Output format n-quads, json-ld (defaults to json-ld).
141
+ --rdf-preview Output the result to the console.
142
+ --rdf-url Refer to an external URL when parsing a local project.
143
+ --rdf-type Course frm schmema.org is applied as default, overwrite this with EducationalResource, etc.
144
+ --rdf-license Add a license-URL, otherwise if url was provided as input, this will check for an existing LICENSE file.
145
+ --rdf-educationalLevel Typically beginner, intermediate or advanced, and formal sets of level indicators.
137
146
  ```
138
147
 
139
148
  ### SCORM1.2
@@ -674,6 +683,159 @@ Such as, for which projects you want to generate a pdf and pass also all additio
674
683
  Simply pass all arguments as `arguments` with the long name and without the starting dashes.
675
684
  This way you can generate a very detailed project configuration and overview.
676
685
 
686
+
687
+ ### RDF & JSON-LD
688
+
689
+ The LiaScript metainformation can be exported to RDF, either as json-ld or as n-quads. The option `--pdf-preview` generates a console output that can be used to inspect the result. Otherwise the result is stored in a file, defined by `-o`, the file-ending is either `.jsonld` or `.np`, depending on the `--rdf-format`
690
+
691
+ ``` shell
692
+ liaex --format rdf --rdf-preview -i https://raw.githubusercontent.com/liaScript/docs/master/README.md
693
+
694
+ {
695
+ "@context": "http://schema.org",
696
+ "@id": "https://raw.githubusercontent.com/liaScript/docs/master/README.md",
697
+ "@type": "Course",
698
+ "author": {
699
+ "@type": "Person",
700
+ "email": "LiaScript@web.de",
701
+ "name": "André Dietrich"
702
+ },
703
+ "description": "This document shall provide an entire compendium and course on the development of Open-courSes with [LiaScript](https://LiaScript.github.io). As the language and the systems grows, also this document will be updated. Feel free to fork or copy it, translations are very welcome...",
704
+ "image": {
705
+ "@type": "ImageObject",
706
+ "url": "https://liascript.github.io/img/bg-showcase-1.jpg"
707
+ },
708
+ "inLanguage": "en",
709
+ "name": "LiaScript",
710
+ "url": "https://LiaScript.github.io/course/?https://raw.githubusercontent.com/liaScript/docs/master/README.md",
711
+ "version": "22.0.2"
712
+ }
713
+ ```
714
+
715
+ The result as n-quads looks like this:
716
+
717
+ ``` shell
718
+ liaex --format rdf --rdf-preview --rdf-format n-quads -i https://raw.githubusercontent.com/liaScript/docs/master/README.md
719
+
720
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/author> _:b0 .
721
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/description> "This document shall provide an entire compendium and course on the development of Open-courSes with [LiaScript](https://LiaScript.github.io). As the language and the systems grows, also this document will be updated. Feel free to fork or copy it, translations are very welcome..." .
722
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/image> _:b1 .
723
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/inLanguage> "en" .
724
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/name> "LiaScript" .
725
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/url> "https://LiaScript.github.io/course/?https://raw.githubusercontent.com/liaScript/docs/master/README.md" .
726
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://schema.org/version> "22.0.2" .
727
+ <https://raw.githubusercontent.com/liaScript/docs/master/README.md> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Course> .
728
+ _:b0 <http://schema.org/email> "LiaScript@web.de" .
729
+ _:b0 <http://schema.org/name> "André Dietrich" .
730
+ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
731
+ _:b1 <http://schema.org/url> "https://liascript.github.io/img/bg-showcase-1.jpg" .
732
+ _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/ImageObject> .
733
+ ```
734
+
735
+ If you are working on a local repository and you want to add the remote URL, you can specify `--rdf-url` and run it with a local file as input:
736
+
737
+ ``` shell
738
+ liaex --format rdf --rdf-preview -i ../LiaBooks/docs/README.md --rdf-url https://raw.githubusercontent.com/liaScript/docs/master/README.md
739
+
740
+ {
741
+ "@context": "http://schema.org",
742
+ "@id": "https://raw.githubusercontent.com/liaScript/docs/master/README.md",
743
+ "@type": "Course",
744
+ "author": {
745
+ "@type": "Person",
746
+ "email": "LiaScript@web.de",
747
+ "name": "André Dietrich"
748
+ },
749
+ "description": "This document shall provide an entire compendium and course on the development of Open-courSes with [LiaScript](https://LiaScript.github.io). As the language and the systems grows, also this document will be updated. Feel free to fork or copy it, translations are very welcome...",
750
+ "image": {
751
+ "@type": "ImageObject",
752
+ "url": "https://liascript.github.io/img/bg-showcase-1.jpg"
753
+ },
754
+ "inLanguage": "en",
755
+ "name": "LiaScript",
756
+ "url": "https://LiaScript.github.io/course/?https://raw.githubusercontent.com/liaScript/docs/master/README.md",
757
+ "version": "22.0.2"
758
+ }
759
+ ```
760
+
761
+ ---
762
+
763
+ Local course but without `--rdf-url`
764
+
765
+ ```
766
+ liaex --format rdf --rdf-preview -i ../LiaBooks/docs/README.md
767
+
768
+ {
769
+ "@context": "http://schema.org",
770
+ "@type": "Course",
771
+ "author": {
772
+ "@type": "Person",
773
+ "email": "LiaScript@web.de",
774
+ "name": "André Dietrich"
775
+ },
776
+ "description": "This document shall provide an entire compendium and course on the development of Open-courSes with [LiaScript](https://LiaScript.github.io). As the language and the systems grows, also this document will be updated. Feel free to fork or copy it, translations are very welcome...",
777
+ "image": {
778
+ "@type": "ImageObject",
779
+ "url": "https://liascript.github.io/img/bg-showcase-1.jpg"
780
+ },
781
+ "inLanguage": "en",
782
+ "name": "LiaScript",
783
+ "version": "22.0.2"
784
+ }
785
+ ```
786
+
787
+ * `--rdf-type`: By default this type of resource is associated with `Course`, but you can use this param if you want to define `EducationalResource` or something else...
788
+ * `--rdf-educationalLevel`: This is currently not defined, but can be injected, typically these are beginner, intermediate, advanced, ...
789
+ * `--rdf-license`: Use this to specify the URL of the associated license to your course. This tool will automatically check if there is a LICENSE file in your project root and add this.
790
+
791
+ #### What LiaScript meta-information is used
792
+
793
+ ``` markdown
794
+ <!--
795
+ author: Your Name
796
+ email: author@email.com
797
+ comment: Some basic information about your course
798
+ version: 12.0.2
799
+ logo: https://someimageURL.jpg
800
+ tags: keyword 1, keyword 2, keyword 3
801
+ language: en
802
+ -->
803
+
804
+ # Title of the course
805
+ ...
806
+
807
+ ```
808
+
809
+ This will be translated to:
810
+
811
+ ``` json
812
+ {
813
+ "@context": "http://schema.org",
814
+ "@id": "https://raw.githubusercontent.com/.../master/README.md",
815
+ "@type": "Course",
816
+ "author": {
817
+ "@type": "Person",
818
+ "email": "author@email.com",
819
+ "name": "Your Name"
820
+ },
821
+ "description": "Some basic information about your course",
822
+ "image": {
823
+ "@type": "ImageObject",
824
+ "url": "https://someimageURL.jpg"
825
+ },
826
+ "inLanguage": "en",
827
+ "name": "Title of the course",
828
+ "url": "https://LiaScript.github.io/course/?https://raw.githubusercontent.com/.../master/README.md",
829
+ "version": "12.0.2",
830
+ "keywords": [
831
+ "keyword 1",
832
+ "keyword 2",
833
+ "keyword 3"
834
+ ]
835
+ }
836
+ ```
837
+
838
+
677
839
  ## TODOs & Contributions
678
840
 
679
841
  * Further exporter
@@ -1 +1 @@
1
- function n(n,t,e,r){Object.defineProperty(n,t,{get:e,set:r,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},e=t.parcelRequire55a5;e.register("69Imb",(function(t,r){n(t.exports,"Connector",(()=>u));var i=e("c2mfX"),o=e("2LHsS"),a=e("7DJp1");class u extends a.Connector{constructor(){super(),this.database=new o.LiaDB}hasIndex(){return!0}async open(n,t,e){return await this.database.open(n,t,{table:"code",id:e})}load(n){return this.database.load(n)}store(n){return this.database.store(n)}update(n,t){this.database.transaction(n,t)}slide(n){this.database.slide(n)}async getIndex(){return await this.database.listIndex()}deleteFromIndex(n){this.database.deleteIndex(n)}storeToIndex(n){this.database.storeIndex(n)}restoreFromIndex(n,t){return this.database.restore(n,t)}async reset(n,t){n&&t&&(await this.database.reset(n,t),i.default.info("DB: reset => ",n,t))}getFromIndex(n){return this.database.getIndex(n)}}})),e.register("2LHsS",(function(t,r){n(t.exports,"LiaDB",(()=>a));var i=e("iNagF"),o=e("c2mfX");class a{constructor(){this.dbIndex=new(0,i.default)("Index"),this.dbIndex.version(1).stores({courses:"&id,updated,author,created,title"}),this.version=0}open_(n){let t=new(0,i.default)(n);return t.version(1).stores({code:"[id+version], version",quiz:"[id+version], version",survey:"[id+version], version",task:"[id+version], version",offline:"[id+version], version"}),t}async open(n,t,e){this.version=t,this.db=this.open_(n);try{await this.db.open()}catch(n){o.default.warn("DB: open -> ",n.message),this.db=null}if(e&&this.db){return await this.db[e.table].get({id:e.id,version:t})}}async store(n,t){this.db&&0!==this.version&&(o.default.warn(`liaDB: event(store), table(${n.table}), id(${n.id}), data(${n.data})`),await this.db[n.table].put({id:n.id,version:null!=t?t:this.version,data:n.data,created:(new Date).getTime()}))}async load(n,t){if(!this.db)return;o.default.info("loading => ",n.table,n.id);const e=await this.db[n.table].get({id:n.id,version:null!=t?t:this.version});return e?(o.default.info("restore table",n.table),e.data):null}async slide(n){try{let t=await this.db.offline.get({id:0,version:this.version});t.data.section_active=n,await this.db.offline.put(t)}catch(t){o.default.warn("DB: could not update slide => ",n)}}async transaction(n,t){if(!this.db||0===this.version)return;let e=this.db;await e.transaction("rw",e[n.table],(async()=>{const r=await e[n.table].get({id:n.id,version:this.version});r.data&&(r.data=t(r.data),await e[n.table].put(r))}))}async restore(n,t){if(await this.dbIndex.courses.get(n)){let e=this.open_(n);const r=await e.offline.get({id:0,version:null!=t?t:this.version});return void 0===r?null:r.data}}async getIndex(n){try{return await this.dbIndex.courses.get(n)}catch(n){o.default.warn("DB: getIndex -> ",n.message)}return null}async listIndex(n="updated",t=!1){const e=await this.dbIndex.courses.orderBy(n).toArray();return t||e.reverse(),e}async storeIndex(n){if(!this.dbIndex.isOpen())return void o.default.warn("DB: storeIndex ... db is closed");const t=new Date;let e=await this.dbIndex.courses.get(n.readme);if(e||(e={id:n.readme,title:n.definition.str_title,author:n.definition.author,created:t.getTime(),updated:null,updated_str:null,data:{}}),e.updated=t.getTime(),e.updated_str=t.toLocaleDateString(),e.data[n.version]){if(e.data[n.version].version!==n.definition.version){e.data[n.version]=n.definition,e.data[n.version].title=n.title,o.default.info("storing new version to index",e);let r=this.open_(n.readme);await r.open(),await r.offline.put({id:0,version:n.version,data:n,created:t.getTime()})}}else e.data[n.version]=n.definition,e.data[n.version].title=n.title,o.default.info("storing new version to index",e),await this.db.offline.put({id:0,version:n.version,data:n,created:t.getTime()});this.dbIndex.courses.put(e).then((function(n){o.default.info("DB: storeIndex",n)}))}async deleteIndex(n){await Promise.all([this.dbIndex.courses.delete(n),i.default.delete(n)])}async reset(n,t){const e=this.open_(n);await e.open(),await Promise.all([e.code.where("version").equals(t).delete(),e.quiz.where("version").equals(t).delete(),e.survey.where("version").equals(t).delete(),e.task.where("version").equals(t).delete()])}}})),e.register("iNagF",(function(e,r){n(e.exports,"default",(()=>zt));var i=Object.keys,o=Array.isArray,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:t;function u(n,t){return"object"!=typeof t||i(t).forEach((function(e){n[e]=t[e]})),n}var s=Object.getPrototypeOf,c={}.hasOwnProperty;function l(n,t){return c.call(n,t)}function f(n,t){"function"==typeof t&&(t=t(s(n))),i(t).forEach((function(e){d(n,e,t[e])}))}var h=Object.defineProperty;function d(n,t,e,r){h(n,t,u(e&&l(e,"get")&&"function"==typeof e.get?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function v(n){return{from:function(t){return n.prototype=Object.create(t.prototype),d(n.prototype,"constructor",n),{extend:f.bind(null,n.prototype)}}}}var p=Object.getOwnPropertyDescriptor;function y(n,t){var e;return p(n,t)||(e=s(n))&&y(e,t)}var g=[].slice;function m(n,t,e){return g.call(n,t,e)}function b(n,t){return t(n)}function w(n){if(!n)throw new Error("Assertion Failed")}function _(n){a.setImmediate?setImmediate(n):setTimeout(n,0)}function x(n,t){return n.reduce((function(n,e,r){var i=t(e,r);return i&&(n[i[0]]=i[1]),n}),{})}function k(n,t){return function(){try{n.apply(this,arguments)}catch(n){t(n)}}}function I(n,t,e){try{n.apply(null,e)}catch(n){t&&t(n)}}function S(n,t){if(l(n,t))return n[t];if(!t)return n;if("string"!=typeof t){for(var e=[],r=0,i=t.length;r<i;++r){var o=S(n,t[r]);e.push(o)}return e}var a=t.indexOf(".");if(-1!==a){var u=n[t.substr(0,a)];return void 0===u?void 0:S(u,t.substr(a+1))}}function P(n,t,e){if(n&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(n)))if("string"!=typeof t&&"length"in t){w("string"!=typeof e&&"length"in e);for(var r=0,i=t.length;r<i;++r)P(n,t[r],e[r])}else{var o=t.indexOf(".");if(-1!==o){var a=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===e?delete n[a]:n[a]=e;else{var s=n[a];s||(s=n[a]={}),P(s,u,e)}}else void 0===e?delete n[t]:n[t]=e}}function j(n){var t={};for(var e in n)l(n,e)&&(t[e]=n[e]);return t}var O=[].concat;function E(n){return O.apply([],n)}var D="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(E([8,16,32,64].map((function(n){return["Int","Uint","Float"].map((function(t){return t+n+"Array"}))})))).filter((function(n){return a[n]})).map((function(n){return a[n]}));function A(n){if(!n||"object"!=typeof n)return n;var t;if(o(n)){t=[];for(var e=0,r=n.length;e<r;++e)t.push(A(n[e]))}else if(D.indexOf(n.constructor)>=0)t=n;else for(var i in t=n.constructor?Object.create(n.constructor.prototype):{},n)l(n,i)&&(t[i]=A(n[i]));return t}function C(n,t,e,r){return e=e||{},r=r||"",i(n).forEach((function(i){if(l(t,i)){var o=n[i],a=t[i];"object"==typeof o&&"object"==typeof a&&o&&a&&""+o.constructor==""+a.constructor?C(o,a,e,r+i+"."):o!==a&&(e[r+i]=t[i])}else e[r+i]=void 0})),i(t).forEach((function(i){l(n,i)||(e[r+i]=t[i])})),e}var T="undefined"!=typeof Symbol&&Symbol.iterator,K=T?function(n){var t;return null!=n&&(t=n[T])&&t.apply(n)}:function(){return null},B={};function F(n){var t,e,r,i;if(1===arguments.length){if(o(n))return n.slice();if(this===B&&"string"==typeof n)return[n];if(i=K(n)){for(e=[];!(r=i.next()).done;)e.push(r.value);return e}if(null==n)return[n];if("number"==typeof(t=n.length)){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}var N="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function q(n,t){N=n,M=t}var M=function(){return!0},R=!new Error("").stack;function L(){if(R)try{throw L.arguments,new Error}catch(n){return n}return new Error}function U(n,t){var e=n.stack;return e?(t=t||0,0===e.indexOf(n.name)&&(t+=(n.name+n.message).split("\n").length),e.split("\n").slice(t).filter(M).map((function(n){return"\n"+n})).join("")):""}var z=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(z),W={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function H(n,t){this._e=L(),this.name=n,this.message=t}function J(n,t,e,r){this._e=L(),this.failures=t,this.failedKeys=r,this.successCount=e}function Q(n,t){this._e=L(),this.name="BulkError",this.failures=t,this.message=function(n,t){return n+". Errors: "+t.map((function(n){return n.toString()})).filter((function(n,t,e){return e.indexOf(n)===t})).join("\n")}(n,t)}v(H).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}}),v(J).from(H),v(Q).from(H);var G=V.reduce((function(n,t){return n[t]=t+"Error",n}),{}),$=H,Y=V.reduce((function(n,t){var e=t+"Error";function r(n,r){this._e=L(),this.name=e,n?"string"==typeof n?(this.message=n,this.inner=r||null):"object"==typeof n&&(this.message=n.name+" "+n.message,this.inner=n):(this.message=W[t]||e,this.inner=null)}return v(r).from($),n[t]=r,n}),{});Y.Syntax=SyntaxError,Y.Type=TypeError,Y.Range=RangeError;var X=z.reduce((function(n,t){return n[t+"Error"]=Y[t],n}),{});var Z=V.reduce((function(n,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(n[t+"Error"]=Y[t]),n}),{});function nn(){}function tn(n){return n}function en(n,t){return null==n||n===tn?t:function(e){return t(n(e))}}function rn(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function on(n,t){return n===nn?t:function(){var e=n.apply(this,arguments);void 0!==e&&(arguments[0]=e);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?rn(r,this.onsuccess):r),i&&(this.onerror=this.onerror?rn(i,this.onerror):i),void 0!==o?o:e}}function an(n,t){return n===nn?t:function(){n.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?rn(e,this.onsuccess):e),r&&(this.onerror=this.onerror?rn(r,this.onerror):r)}}function un(n,t){return n===nn?t:function(e){var r=n.apply(this,arguments);u(e,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?rn(i,this.onsuccess):i),o&&(this.onerror=this.onerror?rn(o,this.onerror):o),void 0===r?void 0===a?void 0:a:u(r,a)}}function sn(n,t){return n===nn?t:function(){return!1!==t.apply(this,arguments)&&n.apply(this,arguments)}}function cn(n,t){return n===nn?t:function(){var e=n.apply(this,arguments);if(e&&"function"==typeof e.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return e.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}Z.ModifyError=J,Z.DexieError=H,Z.BulkError=Q;var ln={},fn=100,hn=7,dn=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var n=a.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}(),vn=dn[0],pn=dn[1],yn=dn[2],gn=pn&&pn.then,mn=vn&&vn.constructor,bn=dn[3],wn=!!yn,_n=!1,xn=yn?function(){yn.then(Wn)}:a.setImmediate?setImmediate.bind(null,Wn):a.MutationObserver?function(){var n=document.createElement("div");new MutationObserver((function(){Wn(),n=null})).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(Wn,0)},kn=function(n,t){Cn.push([n,t]),Sn&&(xn(),Sn=!1)},In=!0,Sn=!0,Pn=[],jn=[],On=null,En=tn,Dn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:pt,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(n){try{pt(n[0],n[1])}catch(n){}}))}},An=Dn,Cn=[],Tn=0,Kn=[];function Bn(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=nn,this._lib=!1;var t=this._PSD=An;if(N&&(this._stackHolder=L(),this._prev=null,this._numPrev=0),"function"!=typeof n){if(n!==ln)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Mn(this,this._value))}this._state=null,this._value=null,++t.ref,qn(this,n)}var Fn={get:function(){var n=An,t=tt;function e(e,r){var i=this,o=!n.global&&(n!==An||t!==tt);o&&ot();var a=new Bn((function(t,a){Ln(i,new Nn(ht(e,n,o),ht(r,n,o),t,a,n))}));return N&&Vn(a,this),a}return e.prototype=ln,e},set:function(n){d(this,"then",n&&n.prototype===ln?Fn:{get:function(){return n},set:Fn.set})}};function Nn(n,t,e,r,i){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=i}function qn(n,t){try{t((function(t){if(null===n._state){if(t===n)throw new TypeError("A promise cannot be resolved with itself.");var e=n._lib&&Hn();t&&"function"==typeof t.then?qn(n,(function(n,e){t instanceof Bn?t._then(n,e):t.then(n,e)})):(n._state=!0,n._value=t,Rn(n)),e&&Jn()}}),Mn.bind(null,n))}catch(t){Mn(n,t)}}function Mn(n,t){if(jn.push(t),null===n._state){var e=n._lib&&Hn();t=En(t),n._state=!1,n._value=t,N&&null!==t&&"object"==typeof t&&!t._promise&&I((function(){var e=y(t,"stack");t._promise=n,d(t,"stack",{get:function(){return _n?e&&(e.get?e.get.apply(t):e.value):n.stack}})})),function(n){Pn.some((function(t){return t._value===n._value}))||Pn.push(n)}(n),Rn(n),e&&Jn()}}function Rn(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)Ln(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===Tn&&(++Tn,kn((function(){0==--Tn&&Qn()}),[]))}function Ln(n,t){if(null!==n._state){var e=n._state?t.onFulfilled:t.onRejected;if(null===e)return(n._state?t.resolve:t.reject)(n._value);++t.psd.ref,++Tn,kn(Un,[e,n,t])}else n._listeners.push(t)}function Un(n,t,e){try{On=t;var r,i=t._value;t._state?r=n(i):(jn.length&&(jn=[]),r=n(i),-1===jn.indexOf(i)&&function(n){var t=Pn.length;for(;t;)if(Pn[--t]._value===n._value)return void Pn.splice(t,1)}(t)),e.resolve(r)}catch(n){e.reject(n)}finally{On=null,0==--Tn&&Qn(),--e.psd.ref||e.psd.finalize()}}function zn(n,t,e){if(t.length===e)return t;var r="";if(!1===n._state){var i,o,a=n._value;null!=a?(i=a.name||"Error",o=a.message||a,r=U(a,0)):(i=a,o=""),t.push(i+(o?": "+o:"")+r)}return N&&((r=U(n._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),n._prev&&zn(n._prev,t,e)),t}function Vn(n,t){var e=t?t._numPrev+1:0;e<fn&&(n._prev=t,n._numPrev=e)}function Wn(){Hn()&&Jn()}function Hn(){var n=In;return In=!1,Sn=!1,n}function Jn(){var n,t,e;do{for(;Cn.length>0;)for(n=Cn,Cn=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}}while(Cn.length>0);In=!0,Sn=!0}function Qn(){var n=Pn;Pn=[],n.forEach((function(n){n._PSD.onunhandled.call(null,n._value,n)}));for(var t=Kn.slice(0),e=t.length;e;)t[--e]()}function Gn(n){return new Bn(ln,!1,n)}function $n(n,t){var e=An;return function(){var r=Hn(),i=An;try{return ct(e,!0),n.apply(this,arguments)}catch(n){t&&t(n)}finally{ct(i,!1),r&&Jn()}}}f(Bn.prototype,{then:Fn,_then:function(n,t){Ln(this,new Nn(null,null,n,t,An))},catch:function(n){if(1===arguments.length)return this.then(null,n);var t=arguments[0],e=arguments[1];return"function"==typeof t?this.then(null,(function(n){return n instanceof t?e(n):Gn(n)})):this.then(null,(function(n){return n&&n.name===t?e(n):Gn(n)}))},finally:function(n){return this.then((function(t){return n(),t}),(function(t){return n(),Gn(t)}))},stack:{get:function(){if(this._stack)return this._stack;try{_n=!0;var n=zn(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=n),n}finally{_n=!1}}},timeout:function(n,t){var e=this;return n<1/0?new Bn((function(r,i){var o=setTimeout((function(){return i(new Y.Timeout(t))}),n);e.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(Bn.prototype,Symbol.toStringTag,"Promise"),Dn.env=lt(),f(Bn,{all:function(){var n=F.apply(null,arguments).map(at);return new Bn((function(t,e){0===n.length&&t([]);var r=n.length;n.forEach((function(i,o){return Bn.resolve(i).then((function(e){n[o]=e,--r||t(n)}),e)}))}))},resolve:function(n){if(n instanceof Bn)return n;if(n&&"function"==typeof n.then)return new Bn((function(t,e){n.then(t,e)}));var t=new Bn(ln,!0,n);return Vn(t,On),t},reject:Gn,race:function(){var n=F.apply(null,arguments).map(at);return new Bn((function(t,e){n.map((function(n){return Bn.resolve(n).then(t,e)}))}))},PSD:{get:function(){return An},set:function(n){return An=n}},newPSD:rt,usePSD:ft,scheduler:{get:function(){return kn},set:function(n){kn=n}},rejectionMapper:{get:function(){return En},set:function(n){En=n}},follow:function(n,t){return new Bn((function(e,r){return rt((function(t,e){var r=An;r.unhandleds=[],r.onunhandled=e,r.finalize=rn((function(){var n=this;!function(n){function t(){n(),Kn.splice(Kn.indexOf(t),1)}Kn.push(t),++Tn,kn((function(){0==--Tn&&Qn()}),[])}((function(){0===n.unhandleds.length?t():e(n.unhandleds[0])}))}),r.finalize),n()}),t,e,r)}))}});var Yn={awaits:0,echoes:0,id:0},Xn=0,Zn=[],nt=0,tt=0,et=0;function rt(n,t,e,r){var i=An,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++et;var a=Dn.env;o.env=wn?{Promise:Bn,PromiseProp:{value:Bn,configurable:!0,writable:!0},all:Bn.all,race:Bn.race,resolve:Bn.resolve,reject:Bn.reject,nthen:dt(a.nthen,o),gthen:dt(a.gthen,o)}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=ft(o,n,e,r);return 0===o.ref&&o.finalize(),s}function it(){return Yn.id||(Yn.id=++Xn),++Yn.awaits,Yn.echoes+=hn,Yn.id}function ot(n){!Yn.awaits||n&&n!==Yn.id||(0==--Yn.awaits&&(Yn.id=0),Yn.echoes=Yn.awaits*hn)}function at(n){return Yn.echoes&&n&&n.constructor===mn?(it(),n.then((function(n){return ot(),n}),(function(n){return ot(),yt(n)}))):n}function ut(n){++tt,Yn.echoes&&0!=--Yn.echoes||(Yn.echoes=Yn.id=0),Zn.push(An),ct(n,!0)}function st(){var n=Zn[Zn.length-1];Zn.pop(),ct(n,!1)}function ct(n,t){var e,r=An;if((t?!Yn.echoes||nt++&&n===An:!nt||--nt&&n===An)||(e=t?ut.bind(null,n):st,gn.call(vn,e)),n!==An&&(An=n,r===Dn&&(Dn.env=lt()),wn)){var i=Dn.env.Promise,o=n.env;pn.then=o.nthen,i.prototype.then=o.gthen,(r.global||n.global)&&(Object.defineProperty(a,"Promise",o.PromiseProp),i.all=o.all,i.race=o.race,i.resolve=o.resolve,i.reject=o.reject)}}function lt(){var n=a.Promise;return wn?{Promise:n,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:n.all,race:n.race,resolve:n.resolve,reject:n.reject,nthen:pn.then,gthen:n.prototype.then}:{}}function ft(n,t,e,r,i){var o=An;try{return ct(n,!0),t(e,r,i)}finally{ct(o,!1)}}function ht(n,t,e){return"function"!=typeof n?n:function(){var r=An;e&&it(),ct(t,!0);try{return n.apply(this,arguments)}finally{ct(r,!1)}}}function dt(n,t){return function(e,r){return n.call(this,ht(e,t,!1),ht(r,t,!1))}}var vt="unhandledrejection";function pt(n,t){var e;try{e=t.onuncatched(n)}catch(n){}if(!1!==e)try{var r,i={promise:t,reason:n};if(a.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(vt,!0,!0),u(r,i)):a.CustomEvent&&u(r=new CustomEvent(vt,{detail:i}),i),r&&a.dispatchEvent&&(dispatchEvent(r),!a.PromiseRejectionEvent&&a.onunhandledrejection))try{a.onunhandledrejection(r)}catch(n){}r.defaultPrevented||console.warn("Unhandled rejection: "+(n.stack||n))}catch(n){}}var yt=Bn.reject;function gt(n){var t={},e=function(e,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[e].subscribe.apply(null,o),n}if("string"==typeof e)return t[e]};e.addEventType=u;for(var r=1,a=arguments.length;r<a;++r)u(arguments[r]);return e;function u(n,r,a){if("object"!=typeof n){var s;r||(r=sn),a||(a=nn);var c={subscribers:[],fire:a,subscribe:function(n){-1===c.subscribers.indexOf(n)&&(c.subscribers.push(n),c.fire=r(c.fire,n))},unsubscribe:function(n){c.subscribers=c.subscribers.filter((function(t){return t!==n})),c.fire=c.subscribers.reduce(r,a)}};return t[n]=e[n]=c,c}i(s=n).forEach((function(n){var t=s[n];if(o(t))u(n,s[n][0],s[n][1]);else{if("asap"!==t)throw new Y.InvalidArgument("Invalid event config");var e=u(n,tn,(function(){for(var n=arguments.length,t=new Array(n);n--;)t[n]=arguments[n];e.subscribers.forEach((function(n){_((function(){n.apply(null,t)}))}))}))}}))}}var mt,bt="{version}",wt=String.fromCharCode(65535),_t=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return wt}}(),xt=-1/0,kt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",It="String expected.",St=[],Pt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),jt=Pt,Ot=Pt,Et=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};function Dt(n,t){var e,r,s,c,h,v=Dt.dependencies,p=u({addons:Dt.addons,autoOpen:!0,indexedDB:v.indexedDB,IDBKeyRange:v.IDBKeyRange},t),y=p.addons,g=p.autoOpen,_=p.indexedDB,O=p.IDBKeyRange,D=this._dbSchema={},T=[],K=[],q={},M=null,R=null,z=!1,V=null,W=!1,H="readonly",G="readwrite",$=this,X=new Bn((function(n){e=n})),Z=new Bn((function(n,t){r=t})),rn=!0,sn=!!Ut(_);function ln(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function fn(n,t,e){var r=$._createTransaction(G,K,D);r.create(t),r._completion.catch(e);var o=r._reject.bind(r);rt((function(){An.trans=r,0===n?(i(D).forEach((function(n){hn(t,n,D[n].primKey,D[n].indexes)})),Bn.follow((function(){return $.on.populate.fire(r)})).catch(o)):function(n,t,e){var r=[],o=T.filter((function(t){return t._cfg.version===n}))[0];if(!o)throw new Y.Upgrade("Dexie specification of currently installed DB version is missing");D=$._dbSchema=o._cfg.dbschema;var a=!1,u=T.filter((function(t){return t._cfg.version>n}));function s(){return r.length?Bn.resolve(r.shift()(t.idbtrans)).then(s):Bn.resolve()}return u.forEach((function(n){r.push((function(){var r=D,i=n._cfg.dbschema;Nn(r,e),Nn(i,e),D=$._dbSchema=i;var o=function(n,t){var e={del:[],add:[],change:[]};for(var r in n)t[r]||e.del.push(r);for(r in t){var i=n[r],o=t[r];if(i){var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)a.recreate=!0,e.change.push(a);else{var u=i.idxByName,s=o.idxByName;for(var c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&e.change.push(a)}}else e.add.push([r,o])}return e}(r,i);if(o.add.forEach((function(n){hn(e,n[0],n[1].primKey,n[1].indexes)})),o.change.forEach((function(n){if(n.recreate)throw new Y.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach((function(n){dn(t,n)})),n.change.forEach((function(n){t.deleteIndex(n.name),dn(t,n)})),n.del.forEach((function(n){t.deleteIndex(n)}))})),n._cfg.contentUpgrade)return a=!0,Bn.follow((function(){n._cfg.contentUpgrade(t)}))})),r.push((function(t){a&&jt||function(n,t){for(var e=0;e<t.db.objectStoreNames.length;++e){var r=t.db.objectStoreNames[e];null==n[r]&&t.db.deleteObjectStore(r)}}(n._cfg.dbschema,t)}))})),s().then((function(){!function(n,t){i(n).forEach((function(e){t.db.objectStoreNames.contains(e)||hn(t,e,n[e].primKey,n[e].indexes)}))}(D,e)}))}(n,r,t).catch(o)}))}function hn(n,t,e,r){var i=n.db.createObjectStore(t,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach((function(n){dn(i,n)})),i}function dn(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function vn(n,t,e){if(W||An.letThrough){var r=$._createTransaction(n,t,D);try{r.create()}catch(n){return yt(n)}return r._promise(n,(function(n,t){return rt((function(){return An.trans=r,e(n,t,r)}))})).then((function(n){return r._completion.then((function(){return n}))}))}if(!z){if(!g)return yt(new Y.DatabaseClosed);$.open().catch(nn)}return X.then((function(){return vn(n,t,e)}))}function pn(n,t,e){var r=arguments.length;if(r<2)throw new Y.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[n,E(i),e]}function yn(n,t,e){this.name=n,this.schema=t,this._tx=e,this.hook=q[n]?q[n].hook:gt(null,{creating:[on,nn],reading:[en,tn],updating:[un,nn],deleting:[an,nn]})}function gn(n,t,e){return(e?Ft:Kt)((function(e){n.push(e),t&&t()}))}function wn(n,t,e,r,i){return new Bn((function(o,a){var u=e.length,s=u-1;if(0===u)return o();if(r){var c,l=Ft(a),f=Tt(null);I((function(){for(var r=0;r<u;++r){c={onsuccess:null,onerror:null};var a=e[r];i.call(c,a[0],a[1],t);var h=n.delete(a[0]);h._hookCtx=c,h.onerror=l,h.onsuccess=r===s?Tt(o):f}}),(function(n){throw c.onerror&&c.onerror(n),n}))}else for(var h=0;h<u;++h){var d=n.delete(e[h]);d.onerror=Kt(a),h===s&&(d.onsuccess=$n((function(){return o()})))}}))}function _n(n,t,e,r){var i=this;this.db=$,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=gt(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 Bn((function(n,t){i._resolve=n,i._reject=t})),this._completion.then((function(){i.active=!1,i.on.complete.fire()}),(function(n){var t=i.active;return i.active=!1,i.on.error.fire(n),i.parent?i.parent._reject(n):t&&i.idbtrans&&i.idbtrans.abort(),yt(n)}))}function xn(n,t,e){this._ctx={table:n,index:":id"===t?null:t,or:e}}function kn(n,t){var e=null,r=null;if(t)try{e=t()}catch(n){r=n}var i=n._ctx,o=i.table;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:o.hook.reading.fire}}function In(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Sn(n,t){return n._cfg.version-t._cfg.version}function Pn(n,t,e){t.forEach((function(t){var r=e[t];n.forEach((function(n){t in n||(n===_n.prototype||n instanceof _n?d(n,t,{get:function(){return this.table(t)}}):n[t]=new yn(t,r))}))}))}function jn(n,t,e,r,i,o){var a=$n(o?function(n,t,r){return e(o(n),t,r)}:e,i);n.onerror||(n.onerror=Kt(i)),n.onsuccess=k(t?function(){var e=n.result;if(e){var o=function(){e.continue()};t(e,(function(n){o=n}),r,i)&&a(e.value,e,(function(n){o=n})),o()}else r()}:function(){var t=n.result;if(t){var e=function(){t.continue()};a(t.value,t,(function(n){e=n})),e()}else r()},i)}function On(n,t){return _.cmp(n,t)}function En(n,t){return On(n,t)>0?n:t}function Dn(n,t){return _.cmp(n,t)}function Cn(n,t){return _.cmp(t,n)}function Tn(n,t){return n<t?-1:n===t?0:1}function Kn(n,t){return n>t?-1:n===t?0:1}function Fn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function Nn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);s="getAll"in o;for(var u=0;u<o.indexNames.length;++u){var c=o.indexNames[u],l=o.index(c).keyPath,f="string"==typeof l?l:"["+m(l).join("+")+"]";if(n[i]){var h=n[i].idxByName[f];h&&(h.name=c)}}}/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(s=!1)}function qn(n){$.on("blocked").fire(n),St.filter((function(n){return n.name===$.name&&n!==$&&!n._vcFired})).map((function(t){return t.on("versionchange").fire(n)}))}this.version=function(n){if(M||z)throw new Y.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=T.filter((function(t){return t._cfg.version===n}))[0];return t||(t=new ln(n),T.push(t),T.sort(Sn),rn=!1,t)},u(ln.prototype,{stores:function(n){this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,n):n;var t={};T.forEach((function(n){u(t,n._cfg.storesSource)}));var e=this._cfg.dbschema={};return this._parseStoresSpec(t,e),D=$._dbSchema=e,[q,$,_n.prototype].forEach((function(n){for(var t in n)n[t]instanceof yn&&delete n[t]})),Pn([q,$,_n.prototype,this._cfg.tables],i(e),e),K=i(e),this},upgrade:function(n){return this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){i(n).forEach((function(e){if(null!==n[e]){var r={},i=function(n){var t=[];return n.split(",").forEach((function(n){var e=(n=n.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;t.push(new Mt(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),o(r),/\./.test(n)))})),t}(n[e]),a=i.shift();if(a.multi)throw new Y.Schema("Primary key cannot be multi-valued");a.keyPath&&P(r,a.keyPath,a.auto?0:a.keyPath),i.forEach((function(n){if(n.auto)throw new Y.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new Y.Schema("Index must have a name and cannot be an empty string");P(r,n.keyPath,n.compound?n.keyPath.map((function(){return""})):"")})),t[e]=new Rt(e,a,i,r)}}))}}),this._allTables=q,this._createTransaction=function(n,t,e,r){return new _n(n,t,e,r)},this._whenReady=function(n){return W||An.letThrough?n():new Bn((function(n,t){if(!z){if(!g)return void t(new Y.DatabaseClosed);$.open().catch(nn)}X.then(n,t)})).then(n)},this.verno=0,this.open=function(){if(z||M)return X.then((function(){return R?yt(R):$}));N&&(Z._stackHolder=L()),z=!0,R=null,W=!1;var t=e,r=null;return Bn.race([Z,new Bn((function(t,e){if(!_)throw new Y.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 o=rn?_.open(n):_.open(n,Math.round(10*$.verno));if(!o)throw new Y.MissingAPI("IndexedDB API not available");o.onerror=Kt(e),o.onblocked=$n(qn),o.onupgradeneeded=$n((function(t){if(r=o.transaction,rn&&!$._allowEmptyDB){o.onerror=Nt,r.abort(),o.result.close();var i=_.deleteDatabase(n);i.onsuccess=i.onerror=$n((function(){e(new Y.NoSuchDatabase("Database "+n+" doesnt exist"))}))}else{r.onerror=Kt(e),fn((t.oldVersion>Math.pow(2,62)?0:t.oldVersion)/10,r,e)}}),e),o.onsuccess=$n((function(){if(r=null,M=o.result,St.push($),rn)!function(){if($.verno=M.version/10,$._dbSchema=D={},0===(K=m(M.objectStoreNames,0)).length)return;var n=M.transaction(Lt(K),"readonly");K.forEach((function(t){for(var e=n.objectStore(t),r=e.keyPath,i=r&&"string"==typeof r&&-1!==r.indexOf("."),o=new Mt(r,r||"",!1,!1,!!e.autoIncrement,r&&"string"!=typeof r,i),a=[],u=0;u<e.indexNames.length;++u){var s=e.index(e.indexNames[u]);i=(r=s.keyPath)&&"string"==typeof r&&-1!==r.indexOf(".");var c=new Mt(s.name,r,!!s.unique,!!s.multiEntry,!1,r&&"string"!=typeof r,i);a.push(c)}D[t]=new Rt(t,o,a,{})})),Pn([q],i(D),D)}();else if(M.objectStoreNames.length>0)try{Nn(D,M.transaction(Lt(M.objectStoreNames),H))}catch(n){}M.onversionchange=$n((function(n){$._vcFired=!0,$.on("versionchange").fire(n)})),sn||"__dbnames"===n||mt.dbnames.put({name:n}).catch(nn),t()}),e)}))]).then((function(){return V=[],Bn.resolve(Dt.vip($.on.ready.fire)).then((function n(){if(V.length>0){var t=V.reduce(cn,nn);return V=[],Bn.resolve(Dt.vip(t)).then(n)}}))})).finally((function(){V=null})).then((function(){return z=!1,$})).catch((function(n){try{r&&r.abort()}catch(n){}return z=!1,$.close(),yt(R=n)})).finally((function(){W=!0,t()}))},this.close=function(){var n=St.indexOf($);if(n>=0&&St.splice(n,1),M){try{M.close()}catch(n){}M=null}g=!1,R=new Y.DatabaseClosed,z&&r(R),X=new Bn((function(n){e=n})),Z=new Bn((function(n,t){r=t}))},this.delete=function(){var t=arguments.length>0;return new Bn((function(e,r){if(t)throw new Y.InvalidArgument("Arguments not allowed in db.delete()");function i(){$.close();var t=_.deleteDatabase(n);t.onsuccess=$n((function(){sn||mt.dbnames.delete(n).catch(nn),e()})),t.onerror=Kt(r),t.onblocked=qn}z?X.then(i):i()}))},this.backendDB=function(){return M},this.isOpen=function(){return null!==M},this.hasBeenClosed=function(){return R&&R instanceof Y.DatabaseClosed},this.hasFailed=function(){return null!==R},this.dynamicallyOpened=function(){return rn},this.name=n,f(this,{tables:{get:function(){return i(q).map((function(n){return q[n]}))}}}),this.on=gt(this,"populate","blocked","versionchange",{ready:[cn,nn]}),this.on.ready.subscribe=b(this.on.ready.subscribe,(function(n){return function(t,e){Dt.vip((function(){W?(R||Bn.resolve().then(t),e&&n(t)):V?(V.push(t),e&&n(t)):(n(t),e||n((function n(){$.on.ready.unsubscribe(t),$.on.ready.unsubscribe(n)})))}))}})),this.transaction=function(){var n=pn.apply(this,arguments);return this._transaction.apply(this,n)},this._transaction=function(n,t,e){var r=An.trans;r&&r.db===$&&-1===n.indexOf("!")||(r=null);var i=-1!==n.indexOf("?");n=n.replace("!","").replace("?","");try{var o=t.map((function(n){var t=n instanceof yn?n.name:n;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}));if("r"==n||n==H)n=H;else{if("rw"!=n&&n!=G)throw new Y.InvalidArgument("Invalid transaction mode: "+n);n=G}if(r){if(r.mode===H&&n===G){if(!i)throw new Y.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((function(n){if(r&&-1===r.storeNames.indexOf(n)){if(!i)throw new Y.SubTransaction("Table "+n+" not included in parent transaction.");r=null}})),i&&r&&!r.active&&(r=null)}}catch(n){return r?r._promise(null,(function(t,e){e(n)})):yt(n)}return r?r._promise(n,a,"lock"):An.trans?ft(An.transless,(function(){return $._whenReady(a)})):$._whenReady(a);function a(){return Bn.resolve().then((function(){var t,i=An.transless||An,a=$._createTransaction(n,o,D,r),u={trans:a,transless:i};r?a.idbtrans=r.idbtrans:a.create(),e.constructor===bn&&it();var s=Bn.follow((function(){if(t=e.call(a,a))if(t.constructor===mn){var n=ot.bind(null,null);t.then(n,n)}else"function"==typeof t.next&&"function"==typeof t.throw&&(t=qt(t))}),u);return(t&&"function"==typeof t.then?Bn.resolve(t).then((function(n){return a.active?n:yt(new Y.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):s.then((function(){return t}))).then((function(n){return r&&a._resolve(),a._completion.then((function(){return n}))})).catch((function(n){return a._reject(n),yt(n)}))}))}},this.table=function(n){if(!l(q,n))throw new Y.InvalidTable("Table "+n+" does not exist");return q[n]},f(yn.prototype,{_trans:function(n,t,e){var r=this._tx||An.trans;return r&&r.db===$?r===An.trans?r._promise(n,t,e):rt((function(){return r._promise(n,t,e)}),{trans:r,transless:An.transless||An}):vn(n,[this.name],t)},_idbstore:function(n,t,e){var r=this.name;return this._trans(n,(function(n,e,i){if(-1===i.storeNames.indexOf(r))throw new Y.NotFound("Table"+r+" not part of transaction");return t(n,e,i.idbtrans.objectStore(r),i)}),e)},get:function(n,t){if(n&&n.constructor===Object)return this.where(n).first(t);var e=this;return this._idbstore(H,(function(t,r,i){var o=i.get(n);o.onerror=Kt(r),o.onsuccess=$n((function(){t(e.hook.reading.fire(o.result))}),r)})).then(t)},where:function(n){if("string"==typeof n)return new xn(this,n);if(o(n))return new xn(this,"["+n.join("+")+"]");var t=i(n);if(1===t.length)return this.where(t[0]).equals(n[t[0]]);var e=this.schema.indexes.concat(this.schema.primKey).filter((function(n){return n.compound&&t.every((function(t){return n.keyPath.indexOf(t)>=0}))&&n.keyPath.every((function(n){return t.indexOf(n)>=0}))}))[0];if(e&&_t!==wt)return this.where(e.name).equals(e.keyPath.map((function(t){return n[t]})));e||console.warn("The query "+JSON.stringify(n)+" on "+this.name+" would benefit of a compound index ["+t.join("+")+"]");var r=this.schema.idxByName,a=t.reduce((function(t,e){return[t[0]||r[e],t[0]||!r[e]?Fn(t[1],(function(t){return""+S(t,e)==""+n[e]})):t[1]]}),[null,null]),u=a[0];return u?this.where(u.name).equals(n[u.keyPath]).filter(a[1]):e?this.filter(a[1]):this.where(t).equals("")},count:function(n){return this.toCollection().count(n)},offset:function(n){return this.toCollection().offset(n)},limit:function(n){return this.toCollection().limit(n)},reverse:function(){return this.toCollection().reverse()},filter:function(n){return this.toCollection().and(n)},each:function(n){return this.toCollection().each(n)},toArray:function(n){return this.toCollection().toArray(n)},orderBy:function(n){return new kn(new xn(this,o(n)?"["+n.join("+")+"]":n))},toCollection:function(){return new kn(new xn(this))},mapToClass:function(n,t){this.schema.mappedClass=n;var e=Object.create(n.prototype);t&&Ct(e,t),this.schema.instanceTemplate=e;var r=function(t){if(!t)return t;var e=Object.create(n.prototype);for(var r in t)if(l(t,r))try{e[r]=t[r]}catch(n){}return e};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),n},defineClass:function(n){return this.mapToClass(Dt.defineClass(n),n)},bulkDelete:function(n){return this.hook.deleting.fire===nn?this._idbstore(G,(function(t,e,r,i){t(wn(r,i,n,!1,nn))})):this.where(":id").anyOf(n).delete().then((function(){}))},bulkPut:function(n,t){var e=this;return this._idbstore(G,(function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new Y.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new Y.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return r();var a,u,s=function(n){0===c.length?r(n):i(new Q(e.name+".bulkPut(): "+c.length+" of "+l+" operations failed",c))},c=[],l=n.length,f=e;if(e.hook.creating.fire===nn&&e.hook.updating.fire===nn){u=gn(c);for(var h=0,d=n.length;h<d;++h)(a=t?o.put(n[h],t[h]):o.put(n[h])).onerror=u;a.onerror=gn(c,s),a.onsuccess=Bt(s)}else{var v=t||o.keyPath&&n.map((function(n){return S(n,o.keyPath)})),p=v&&x(v,(function(t,e){return null!=t&&[t,n[e]]})),y=v?f.where(":id").anyOf(v.filter((function(n){return null!=n}))).modify((function(){this.value=p[this.primKey],p[this.primKey]=null})).catch(J,(function(n){c=n.failures})).then((function(){for(var e=[],r=t&&[],i=v.length-1;i>=0;--i){var o=v[i];(null==o||p[o])&&(e.push(n[i]),t&&r.push(o),null!=o&&(p[o]=null))}return e.reverse(),t&&r.reverse(),f.bulkAdd(e,r)})).then((function(n){var t=v[v.length-1];return null!=t?t:n})):f.bulkAdd(n);y.then(s).catch(Q,(function(n){c=c.concat(n.failures),s()})).catch(i)}}),"locked")},bulkAdd:function(n,t){var e=this,r=this.hook.creating.fire;return this._idbstore(G,(function(i,o,a,u){if(!a.keyPath&&!e.schema.primKey.auto&&!t)throw new Y.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(a.keyPath&&t)throw new Y.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return i();function s(n){0===h.length?i(n):o(new Q(e.name+".bulkAdd(): "+h.length+" of "+d+" operations failed",h))}var c,l,f,h=[],d=n.length;if(r!==nn){var v,p=a.keyPath;l=gn(h,null,!0),f=Tt(null),I((function(){for(var e=0,i=n.length;e<i;++e){v={onerror:null,onsuccess:null};var o=t&&t[e],s=n[e],h=t?o:p?S(s,p):void 0,d=r.call(v,h,s,u);null==h&&null!=d&&(p?P(s=A(s),p,d):o=d),(c=null!=o?a.add(s,o):a.add(s))._hookCtx=v,e<i-1&&(c.onerror=l,v.onsuccess&&(c.onsuccess=f))}}),(function(n){throw v.onerror&&v.onerror(n),n})),c.onerror=gn(h,s,!0),c.onsuccess=Tt(s)}else{l=gn(h);for(var y=0,g=n.length;y<g;++y)(c=t?a.add(n[y],t[y]):a.add(n[y])).onerror=l;c.onerror=gn(h,s),c.onsuccess=Bt(s)}}))},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(G,(function(r,i,o,a){var u={onsuccess:null,onerror:null};if(e!==nn){var s=null!=t?t:o.keyPath?S(n,o.keyPath):void 0,c=e.call(u,s,n,a);null==s&&null!=c&&(o.keyPath?P(n,o.keyPath,c):t=c)}try{var l=null!=t?o.add(n,t):o.add(n);l._hookCtx=u,l.onerror=Ft(i),l.onsuccess=Tt((function(t){var e=o.keyPath;e&&P(n,e,t),r(t)}))}catch(n){throw u.onerror&&u.onerror(n),n}}))},put:function(n,t){var e=this,r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==nn||i!==nn){var o=this.schema.primKey.keyPath,a=void 0!==t?t:o&&S(n,o);return null==a?this.add(n):(n=A(n),this._trans(G,(function(){return e.where(":id").equals(a).modify((function(){this.value=n})).then((function(r){return 0===r?e.add(n,t):a}))}),"locked"))}return this._idbstore(G,(function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=Kt(r),o.onsuccess=$n((function(t){var r=i.keyPath;r&&P(n,r,t.target.result),e(o.result)}))}))},delete:function(n){return this.hook.deleting.subscribers.length?this.where(":id").equals(n).delete():this._idbstore(G,(function(t,e,r){var i=r.delete(n);i.onerror=Kt(e),i.onsuccess=$n((function(){t(i.result)}))}))},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(G,(function(n,t,e){var r=e.clear();r.onerror=Kt(t),r.onsuccess=$n((function(){n(r.result)}))}))},update:function(n,t){if("object"!=typeof t||o(t))throw new Y.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||o(n))return this.where(":id").equals(n).modify(t);i(t).forEach((function(e){P(n,e,t[e])}));var e=S(n,this.schema.primKey.keyPath);return void 0===e?yt(new Y.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),f(_n.prototype,{_lock:function(){return w(!An.global),++this._reculock,1!==this._reculock||An.global||(An.lockOwnerFor=this),this},_unlock:function(){if(w(!An.global),0==--this._reculock)for(An.global||(An.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{ft(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&An.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(w(!this.idbtrans),!n&&!M)switch(R&&R.name){case"DatabaseClosedError":throw new Y.DatabaseClosed(R);case"MissingAPIError":throw new Y.MissingAPI(R.message,R);default:throw new Y.OpenFailed(R)}if(!this.active)throw new Y.TransactionInactive;return w(null===this._completion._state),(n=this.idbtrans=n||M.transaction(Lt(this.storeNames),this.mode)).onerror=$n((function(e){Nt(e),t._reject(n.error)})),n.onabort=$n((function(e){Nt(e),t.active&&t._reject(new Y.Abort(n.error)),t.active=!1,t.on("abort").fire(e)})),n.oncomplete=$n((function(){t.active=!1,t._resolve()})),this},_promise:function(n,t,e){var r=this;if(n===G&&this.mode!==G)return yt(new Y.ReadOnly("Transaction is readonly"));if(!this.active)return yt(new Y.TransactionInactive);if(this._locked())return new Bn((function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},An])}));if(e)return rt((function(){var n=new Bn((function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)}));return n.finally((function(){return r._unlock()})),n._lib=!0,n}));var i=new Bn((function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)}));return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=Bn.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then((function(){return n}));else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-1/0).onsuccess=n)}()}var r=t._waitingFor;return new Bn((function(e,i){n.then((function(n){return t._waitingQueue.push($n(e.bind(null,n)))}),(function(n){return t._waitingQueue.push($n(i.bind(null,n)))})).finally((function(){t._waitingFor===r&&(t._waitingFor=null)}))}))},abort:function(){this.active&&this._reject(new Y.Abort),this.active=!1},tables:{get:(c="Transaction.tables",h=function(){return q},function(){return console.warn(c+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+U(L(),1)),h.apply(this,arguments)})},table:function(n){return new yn(n,$.table(n).schema,this)}}),f(xn.prototype,(function(){function n(n,t,e){var r=n instanceof xn?new kn(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new kn(n,(function(){return O.only("")})).limit(0)}function e(n,t,e,r,i,o){for(var a=Math.min(n.length,r.length),u=-1,s=0;s<a;++s){var c=t[s];if(c!==r[s])return i(n[s],e[s])<0?n.substr(0,s)+e[s]+e.substr(s+1):i(n[s],r[s])<0?n.substr(0,s)+r[s]+e.substr(s+1):u>=0?n.substr(0,u)+t[u]+e.substr(u+1):null;i(n[s],c)<0&&(u=s)}return a<r.length&&"next"===o?n+e.substr(n.length):a<n.length&&"prev"===o?n.substr(0,e.length):u<0?null:n.substr(0,u)+r[u]+e.substr(u+1)}function r(t,r,i,o){var a,u,s,c,l,f,h,d=i.length;if(!i.every((function(n){return"string"==typeof n})))return n(t,It);function v(n){a=function(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}(n),u=function(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}(n),s="next"===n?Tn:Kn;var t=i.map((function(n){return{lower:u(n),upper:a(n)}})).sort((function(n,t){return s(n.lower,t.lower)}));c=t.map((function(n){return n.upper})),l=t.map((function(n){return n.lower})),f=n,h="next"===n?"":o}v("next");var p=new kn(t,(function(){return O.bound(c[0],l[d-1]+o)}));p._ondirectionchange=function(n){v(n)};var y=0;return p._addAlgorithm((function(n,t,i){var o=n.key;if("string"!=typeof o)return!1;var a=u(o);if(r(a,l,y))return!0;for(var v=null,p=y;p<d;++p){var g=e(o,a,c[p],l[p],s,f);null===g&&null===v?y=p+1:(null===v||s(v,g)>0)&&(v=g)}return t(null!==v?function(){n.continue(v+h)}:i),!1})),p}return{between:function(e,r,i,o){i=!1!==i,o=!0===o;try{return On(e,r)>0||0===On(e,r)&&(i||o)&&(!i||!o)?t(this):new kn(this,(function(){return O.bound(e,r,!i,!o)}))}catch(t){return n(this,kt)}},equals:function(n){return new kn(this,(function(){return O.only(n)}))},above:function(n){return new kn(this,(function(){return O.lowerBound(n,!0)}))},aboveOrEqual:function(n){return new kn(this,(function(){return O.lowerBound(n)}))},below:function(n){return new kn(this,(function(){return O.upperBound(n,!0)}))},belowOrEqual:function(n){return new kn(this,(function(){return O.upperBound(n)}))},startsWith:function(t){return"string"!=typeof t?n(this,It):this.between(t,t+wt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):r(this,(function(n,t){return 0===n.indexOf(t[0])}),[n],wt)},equalsIgnoreCase:function(n){return r(this,(function(n,t){return n===t[0]}),[n],"")},anyOfIgnoreCase:function(){var n=F.apply(B,arguments);return 0===n.length?t(this):r(this,(function(n,t){return-1!==t.indexOf(n)}),n,"")},startsWithAnyOfIgnoreCase:function(){var n=F.apply(B,arguments);return 0===n.length?t(this):r(this,(function(n,t){return t.some((function(t){return 0===n.indexOf(t)}))}),n,wt)},anyOf:function(){var e=F.apply(B,arguments),r=Dn;try{e.sort(r)}catch(t){return n(this,kt)}if(0===e.length)return t(this);var i=new kn(this,(function(){return O.bound(e[0],e[e.length-1])}));i._ondirectionchange=function(n){r="next"===n?Dn:Cn,e.sort(r)};var o=0;return i._addAlgorithm((function(n,t,i){for(var a=n.key;r(a,e[o])>0;)if(++o===e.length)return t(i),!1;return 0===r(a,e[o])||(t((function(){n.continue(e[o])})),!1)})),i},notEqual:function(n){return this.inAnyRange([[xt,n],[n,_t]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=F.apply(B,arguments);if(0===t.length)return new kn(this);try{t.sort(Dn)}catch(t){return n(this,kt)}var e=t.reduce((function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[xt,t]]}),null);return e.push([t[t.length-1],_t]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(e,r){if(0===e.length)return t(this);if(!e.every((function(n){return void 0!==n[0]&&void 0!==n[1]&&Dn(n[0],n[1])<=0})))return n(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Y.InvalidArgument);var i=!r||!1!==r.includeLowers,o=r&&!0===r.includeUppers;var a,u=Dn;function s(n,t){return u(n[0],t[0])}try{a=e.reduce((function(n,t){for(var e=0,r=n.length;e<r;++e){var i=n[e];if(On(t[0],i[1])<0&&On(t[1],i[0])>0){i[0]=On(o=i[0],a=t[0])<0?o:a,i[1]=En(i[1],t[1]);break}}var o,a;return e===r&&n.push(t),n}),[]),a.sort(s)}catch(t){return n(this,kt)}var c=0,l=o?function(n){return Dn(n,a[c][1])>0}:function(n){return Dn(n,a[c][1])>=0},f=i?function(n){return Cn(n,a[c][0])>0}:function(n){return Cn(n,a[c][0])>=0};var h=l,d=new kn(this,(function(){return O.bound(a[0][0],a[a.length-1][1],!i,!o)}));return d._ondirectionchange=function(n){"next"===n?(h=l,u=Dn):(h=f,u=Cn),a.sort(s)},d._addAlgorithm((function(n,t,e){for(var r=n.key;h(r);)if(++c===a.length)return t(e),!1;return!!function(n){return!l(n)&&!f(n)}(r)||(0===On(r,a[c][1])||0===On(r,a[c][0])||t((function(){u===Dn?n.continue(a[c][0]):n.continue(a[c][1])})),!1)})),d},startsWithAnyOf:function(){var e=F.apply(B,arguments);return e.every((function(n){return"string"==typeof n}))?0===e.length?t(this):this.inAnyRange(e.map((function(n){return[n,n+wt]}))):n(this,"startsWithAnyOf() only works with strings")}}})),f(kn.prototype,(function(){function n(n,t){n.filter=Fn(n.filter,t)}function t(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return Fn(r(),t())}:t,n.justLimit=e&&!r}function e(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new Y.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return t.index(e.name)}function r(n,t){var r=e(n,t);return n.keysOnly&&"openKeyCursor"in r?r.openKeyCursor(n.range||null,n.dir+n.unique):r.openCursor(n.range||null,n.dir+n.unique)}function o(n,t,e,i,o){var a=n.replayFilter?Fn(n.filter,n.replayFilter()):n.filter;n.or?function(){var u={},s=0;function c(){2==++s&&e()}function f(n,e,r){if(!a||a(e,r,c,i)){var o=e.primaryKey,s=""+o;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(o)),l(u,s)||(u[s]=!0,t(n,e,r))}}n.or._iterate(f,c,i,o),jn(r(n,o),n.algorithm,f,c,i,!n.keysOnly&&n.valueMapper)}():jn(r(n,o),Fn(n.algorithm,a),t,e,i,!n.keysOnly&&n.valueMapper)}return{_read:function(n,t){var e=this._ctx;return e.error?e.table._trans(null,yt.bind(null,e.error)):e.table._idbstore(H,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,yt.bind(null,t.error)):t.table._idbstore(G,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=Fn(t.algorithm,n)},_iterate:function(n,t,e,r){return o(this._ctx,n,t,e,r)},clone:function(n){var t=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return n&&u(e,n),t._ctx=e,t},raw:function(){return this._ctx.valueMapper=null,this},each:function(n){var t=this._ctx;return this._read((function(e,r,i){o(t,n,e,r,i)}))},count:function(n){var t=this._ctx;if(In(t,!0))return this._read((function(n,r,i){var o=e(t,i),a=t.range?o.count(t.range):o.count();a.onerror=Kt(r),a.onsuccess=function(e){n(Math.min(e.target.result,t.limit))}}),n);var r=0;return this._read((function(n,e,i){o(t,(function(){return++r,!1}),(function(){n(r)}),e,i)}),n)},sortBy:function(n,t){var e=n.split(".").reverse(),r=e[0],i=e.length-1;function o(n,t){return t?o(n[e[t]],t-1):n[r]}var a="next"===this._ctx.dir?1:-1;function u(n,t){var e=o(n,i),r=o(t,i);return e<r?-a:e>r?a:0}return this.toArray((function(n){return n.sort(u)})).then(t)},toArray:function(n){var t=this._ctx;return this._read((function(n,r,i){if(s&&"next"===t.dir&&In(t,!0)&&t.limit>0){var a=t.table.hook.reading.fire,u=e(t,i),c=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);c.onerror=Kt(r),c.onsuccess=Bt(a===tn?n:function(t){try{n(t.map(a))}catch(n){r(n)}})}else{var l=[];o(t,(function(n){l.push(n)}),(function(){n(l)}),r,i)}}),n)},offset:function(n){var e=this._ctx;return n<=0||(e.offset+=n,In(e)?t(e,(function(){var t=n;return function(n,e){return 0===t||(1===t?(--t,!1):(e((function(){n.advance(t),t=0})),!1))}})):t(e,(function(){var t=n;return function(){return--t<0}}))),this},limit:function(n){return this._ctx.limit=Math.min(this._ctx.limit,n),t(this._ctx,(function(){var t=n;return function(n,e,r){return--t<=0&&e(r),t>=0}}),!0),this},until:function(t,e){return n(this._ctx,(function(n,r,i){return!t(n.value)||(r(i),e)})),this},first:function(n){return this.limit(1).toArray((function(n){return n[0]})).then(n)},last:function(n){return this.reverse().first(n)},filter:function(t){return n(this._ctx,(function(n){return t(n.value)})),function(n,t){n.isMatch=Fn(n.isMatch,t)}(this._ctx,t),this},and:function(n){return this.filter(n)},or:function(n){return new xn(this._ctx.table,n,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(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,e){n(e.key,e)}))},eachUniqueKey:function(n){return this._ctx.unique="unique",this.eachKey(n)},eachPrimaryKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,e){n(e.primaryKey,e)}))},keys:function(n){var t=this._ctx;t.keysOnly=!t.isMatch;var e=[];return this.each((function(n,t){e.push(t.key)})).then((function(){return e})).then(n)},primaryKeys:function(n){var t=this._ctx;if(s&&"next"===t.dir&&In(t,!0)&&t.limit>0)return this._read((function(n,r,i){var o=e(t,i),a=t.limit<1/0?o.getAllKeys(t.range,t.limit):o.getAllKeys(t.range);a.onerror=Kt(r),a.onsuccess=Bt(n)})).then(n);t.keysOnly=!t.isMatch;var r=[];return this.each((function(n,t){r.push(t.primaryKey)})).then((function(){return r})).then(n)},uniqueKeys:function(n){return this._ctx.unique="unique",this.keys(n)},firstKey:function(n){return this.limit(1).keys((function(n){return n[0]})).then(n)},lastKey:function(n){return this.reverse().firstKey(n)},distinct:function(){var t=this._ctx,e=t.index&&t.table.schema.idxByName[t.index];if(!e||!e.multi)return this;var r={};return n(this._ctx,(function(n){var t=n.primaryKey.toString(),e=l(r,t);return r[t]=!0,!e})),this},modify:function(n){var t=this,e=this._ctx.table.hook,r=e.updating.fire,o=e.deleting.fire;return this._write((function(e,a,s,c){var f;if("function"==typeof n)f=r===nn&&o===nn?n:function(t){var e=A(t);if(!1===n.call(this,t,this))return!1;if(l(this,"value")){var a=C(e,this.value),u=r.call(this,a,this.primKey,e,c);u&&(t=this.value,i(u).forEach((function(n){P(t,n,u[n])})))}else o.call(this,this.primKey,t,c)};else if(r===nn){var h=i(n),d=h.length;f=function(t){for(var e=!1,r=0;r<d;++r){var i=h[r],o=n[i];S(t,i)!==o&&(P(t,i,o),e=!0)}return e}}else{var v=n;n=j(v),f=function(t){var e=!1,o=r.call(this,n,this.primKey,A(t),c);return o&&u(n,o),i(n).forEach((function(r){var i=n[r];S(t,r)!==i&&(P(t,r,i),e=!0)})),o&&(n=j(v)),e}}var p=0,y=0,g=!1,m=[],b=[],w=null;function _(n){return n&&(m.push(n),b.push(w)),a(new J("Error modifying one or more objects",m,y,b))}function x(){g&&y+m.length===p&&(m.length>0?_():e(y))}t.clone().raw()._iterate((function(n,t){w=t.primaryKey;var e={primKey:t.primaryKey,value:n,onsuccess:null,onerror:null};function r(n){return m.push(n),b.push(e.primKey),x(),!0}if(!1!==f.call(e,n,e)){var i=!l(e,"value");++p,I((function(){var n=i?t.delete():t.update(e.value);n._hookCtx=e,n.onerror=Ft(r),n.onsuccess=Tt((function(){++y,x()}))}),r)}else e.onsuccess&&e.onsuccess(e.value)}),(function(){g=!0,x()}),_,s)}))},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==nn;if(!i&&In(t)&&(t.isPrimKey&&!Ot||!e))return this._write((function(n,t,r){var i=Kt(t),o=e?r.count(e):r.count();o.onerror=i,o.onsuccess=function(){var a=o.result;I((function(){var t=e?r.delete(e):r.clear();t.onerror=i,t.onsuccess=function(){return n(a)}}),(function(n){return t(n)}))}}));var o=i?2e3:1e4;return this._write((function(e,a,u,s){var c=0,l=n.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(o).raw(),f=[],h=function(){return l.each(i?function(n,t){f.push([t.primaryKey,t.value])}:function(n,t){f.push(t.primaryKey)}).then((function(){return i?f.sort((function(n,t){return Dn(n[0],t[0])})):f.sort(Dn),wn(u,s,f,i,r)})).then((function(){var n=f.length;return c+=n,f=[],n<o?c:h()}))};e(h())}))}}})),u(this,{Collection:kn,Table:yn,Transaction:_n,Version:ln,WhereClause:xn}),$.on("versionchange",(function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+$.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+$.name+"'. Closing db now to resume the delete request."),$.close()})),$.on("blocked",(function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+$.name+"') was blocked"):console.warn("Upgrade '"+$.name+"' blocked by other connection holding version "+n.oldVersion/10)})),y.forEach((function(n){n($)}))}function At(n){if("function"==typeof n)return new n;if(o(n))return[At(n[0])];if(n&&"object"==typeof n){var t={};return Ct(t,n),t}return n}function Ct(n,t){return i(t).forEach((function(e){var r=At(t[e]);n[e]=r})),n}function Tt(n){return $n((function(t){var e=t.target,r=e._hookCtx,i=r.value||e.result,o=r&&r.onsuccess;o&&o(i),n&&n(i)}),n)}function Kt(n){return $n((function(t){return Nt(t),n(t.target.error),!1}))}function Bt(n){return $n((function(t){n(t.target.result)}))}function Ft(n){return $n((function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),Nt(t),n(r),!1}))}function Nt(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function qt(n){var t=function(t){return n.next(t)},e=i(t),r=i((function(t){return n.throw(t)}));function i(n){return function(t){var i=n(t),a=i.value;return i.done?a:a&&"function"==typeof a.then?a.then(e,r):o(a)?Bn.all(a).then(e,r):e(a)}}return i(t)()}function Mt(n,t,e,r,i,o,a){this.name=n,this.keyPath=t,this.unique=e,this.multi=r,this.auto=i,this.compound=o,this.dotted=a;var u="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(e?"&":"")+(r?"*":"")+(i?"++":"")+u}function Rt(n,t,e,r){this.name=n,this.primKey=t||new Mt,this.indexes=e||[new Mt],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=x(e,(function(n){return[n.name,n]}))}function Lt(n){return 1===n.length?n[0]:n}function Ut(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}q(N,Et),f(Dt,Z),f(Dt,{delete:function(n){var t=new Dt(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new Dt(n).open().then((function(n){return n.close(),!0})).catch(Dt.NoSuchDatabaseError,(function(){return!1}))},getDatabaseNames:function(n){var t=Ut(Dt.dependencies.indexedDB);return t?new Bn((function(n,e){var r=t();r.onsuccess=function(t){n(m(t.target.result,0))},r.onerror=Kt(e)})).then(n):mt.dbnames.toCollection().primaryKeys(n)},defineClass:function(){return function(n){n&&u(this,n)}},applyStructure:Ct,ignoreTransaction:function(n){return An.trans?ft(An.transless,n):n()},vip:function(n){return rt((function(){return An.letThrough=!0,n()}))},async:function(n){return function(){try{var t=qt(n.apply(this,arguments));return t&&"function"==typeof t.then?t:Bn.resolve(t)}catch(n){return yt(n)}}},spawn:function(n,t,e){try{var r=qt(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:Bn.resolve(r)}catch(n){return yt(n)}},currentTransaction:{get:function(){return An.trans||null}},waitFor:function(n,t){var e=Bn.resolve("function"==typeof n?Dt.ignoreTransaction(n):n).timeout(t||6e4);return An.trans?An.trans.waitFor(e):e},Promise:Bn,debug:{get:function(){return N},set:function(n){q(n,"dexie"===n?function(){return!0}:Et)}},derive:v,extend:u,props:f,override:b,Events:gt,getByKeyPath:S,setByKeyPath:P,delByKeyPath:function(n,t){"string"==typeof t?P(n,t,void 0):"length"in t&&[].map.call(t,(function(t){P(n,t,void 0)}))},shallowClone:j,deepClone:A,getObjectDiff:C,asap:_,maxKey:_t,minKey:xt,addons:[],connections:St,MultiModifyError:Y.Modify,errnames:G,IndexSpec:Mt,TableSchema:Rt,dependencies:function(){try{return{indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch(n){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:bt,version:bt.split(".").map((function(n){return parseInt(n)})).reduce((function(n,t,e){return n+t/Math.pow(10,2*e)})),default:Dt,Dexie:Dt}),Bn.rejectionMapper=function(n,t){if(!n||n instanceof H||n instanceof TypeError||n instanceof SyntaxError||!n.name||!X[n.name])return n;var e=new X[n.name](t||n.message,n);return"stack"in n&&d(e,"stack",{get:function(){return this.inner.stack}}),e},(mt=new Dt("__dbnames")).version(1).stores({dbnames:"name"}),function(){var n="Dexie.DatabaseNames";try{localStorage,void 0!==a.document&&(JSON.parse(localStorage.getItem(n)||"[]").forEach((function(n){return mt.dbnames.put({name:n}).catch(nn)})),localStorage.removeItem(n))}catch(n){}}();var zt=Dt})),e.register("7DJp1",(function(t,r){n(t.exports,"Connector",(()=>a));var i=e("fYPnO"),o=e("6DLm7");class a{constructor(){}hasIndex(){return!1}storage(){return new i.LiaStorage}initSettings(n,t=!1){return o.Settings.init(n,t)}setSettings(n){try{localStorage.setItem(o.Settings.PORT,JSON.stringify(n))}catch(n){console.warn("cannot write to localStorage")}}getSettings(){let n="";try{n=localStorage.getItem(o.Settings.PORT)}catch(n){console.warn("cannot write to localStorage")}let t=null;if("string"==typeof n){try{t=JSON.parse(n)}catch(n){console.warn("getSettings =>",n)}t||(t=o.Settings.default),window.innerWidth<=768&&(t.table_of_contents=!1)}return t}open(n,t,e){}load(n){}store(n){}update(n,t){}slide(n){}getIndex(){}deleteFromIndex(n){}storeToIndex(n){}restoreFromIndex(n,t){}reset(n,t){this.initSettings(null,!0)}async getFromIndex(n){return null}}})),e.register("fYPnO",(function(t,e){n(t.exports,"LiaStorage",(()=>r));class r{constructor(){}getItems(n=[]){"string"==typeof n&&(n=[n]);let t={};for(let e=0;e<n.length;e++){let r=localStorage.getItem(n[e]);t[n[e]]=r?JSON.parse(r):r}return t}setItems(n){this._setLocal(n)}_setLocal(n){if("object"==typeof n)for(const[t,e]of Object.entries(n))localStorage.setItem(t,JSON.stringify(e))}}}));
1
+ function n(n,t,e,r){Object.defineProperty(n,t,{get:e,set:r,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},e=t.parcelRequire55a5;e.register("69Imb",(function(t,r){n(t.exports,"Connector",(()=>u));var i=e("c2mfX"),o=e("2LHsS"),a=e("7DJp1");class u extends a.Connector{constructor(){super(),this.database=new o.LiaDB}hasIndex(){return!0}async open(n,t,e){return await this.database.open(n,t,{table:"code",id:e})}load(n){return this.database.load(n)}store(n){return this.database.store(n)}update(n,t){this.database.transaction(n,t)}slide(n){this.database.slide(n)}async getIndex(){return await this.database.listIndex()}deleteFromIndex(n){this.database.deleteIndex(n)}storeToIndex(n){this.database.storeIndex(n)}restoreFromIndex(n,t){return this.database.restore(n,t)}async reset(n,t){n&&t&&(await this.database.reset(n,t),i.default.info("DB: reset => ",n,t))}getFromIndex(n){return this.database.getIndex(n)}}})),e.register("2LHsS",(function(t,r){n(t.exports,"LiaDB",(()=>a));var i=e("iNagF"),o=e("c2mfX");class a{constructor(){this.dbIndex=new(0,i.default)("Index"),this.dbIndex.version(1).stores({courses:"&id,updated,author,created,title"}),this.version=0}open_(n){let t=new(0,i.default)(n);return t.version(1).stores({code:"[id+version], version",quiz:"[id+version], version",survey:"[id+version], version",task:"[id+version], version",offline:"[id+version], version"}),t}async open(n,t,e){this.version=t,this.db=this.open_(n);try{await this.db.open()}catch(n){o.default.warn("DB: open -> ",n.message),this.db=null}if(e&&this.db){return await this.db[e.table].get({id:e.id,version:t})}}async store(n,t){this.db&&0!==this.version&&(o.default.warn(`liaDB: event(store), table(${n.table}), id(${n.id}), data(${n.data})`),await this.db[n.table].put({id:n.id,version:null!=t?t:this.version,data:n.data,created:(new Date).getTime()}))}async load(n,t){if(!this.db)return;o.default.info("loading => ",n.table,n.id);const e=await this.db[n.table].get({id:n.id,version:null!=t?t:this.version});return e?(o.default.info("restore table",n.table),e.data):null}async slide(n){try{let t=await this.db.offline.get({id:0,version:this.version});t.data.section_active=n,await this.db.offline.put(t)}catch(t){o.default.warn("DB: could not update slide => ",n)}}async transaction(n,t){if(!this.db||0===this.version)return;let e=this.db;await e.transaction("rw",e[n.table],(async()=>{const r=await e[n.table].get({id:n.id,version:this.version});r.data&&(r.data=t(r.data),await e[n.table].put(r))}))}async restore(n,t){if(await this.dbIndex.courses.get(n)){let e=this.open_(n);const r=await e.offline.get({id:0,version:null!=t?t:this.version});return void 0===r?null:r.data}}async getIndex(n){try{return await this.dbIndex.courses.get(n)}catch(n){o.default.warn("DB: getIndex -> ",n.message)}return null}async listIndex(n="updated",t=!1){const e=await this.dbIndex.courses.orderBy(n).toArray();return t||e.reverse(),e}async storeIndex(n){if(!this.dbIndex.isOpen())return void o.default.warn("DB: storeIndex ... db is closed");const t=new Date;let e=await this.dbIndex.courses.get(n.readme);if(e||(e={id:n.readme,title:n.definition.str_title,author:n.definition.author,created:t.getTime(),updated:null,updated_str:null,data:{}}),e.updated=t.getTime(),e.updated_str=t.toLocaleDateString(),e.data[n.version]){if(e.data[n.version].version!==n.definition.version){e.data[n.version]=n.definition,e.data[n.version].title=n.title,o.default.info("storing new version to index",e);let r=this.open_(n.readme);await r.open(),await r.offline.put({id:0,version:n.version,data:n,created:t.getTime()})}}else e.data[n.version]=n.definition,e.data[n.version].title=n.title,o.default.info("storing new version to index",e),await this.db.offline.put({id:0,version:n.version,data:n,created:t.getTime()});this.dbIndex.courses.put(e).then((function(n){o.default.info("DB: storeIndex",n)}))}async deleteIndex(n){await Promise.all([this.dbIndex.courses.delete(n),i.default.delete(n)])}async reset(n,t){const e=this.open_(n);await e.open(),await Promise.all([e.code.where("version").equals(t).delete(),e.quiz.where("version").equals(t).delete(),e.survey.where("version").equals(t).delete(),e.task.where("version").equals(t).delete()])}}})),e.register("iNagF",(function(e,r){n(e.exports,"default",(()=>zt));var i=Object.keys,o=Array.isArray,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:t;function u(n,t){return"object"!=typeof t||i(t).forEach((function(e){n[e]=t[e]})),n}var s=Object.getPrototypeOf,c={}.hasOwnProperty;function l(n,t){return c.call(n,t)}function f(n,t){"function"==typeof t&&(t=t(s(n))),i(t).forEach((function(e){d(n,e,t[e])}))}var h=Object.defineProperty;function d(n,t,e,r){h(n,t,u(e&&l(e,"get")&&"function"==typeof e.get?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function v(n){return{from:function(t){return n.prototype=Object.create(t.prototype),d(n.prototype,"constructor",n),{extend:f.bind(null,n.prototype)}}}}var p=Object.getOwnPropertyDescriptor;function y(n,t){var e;return p(n,t)||(e=s(n))&&y(e,t)}var g=[].slice;function m(n,t,e){return g.call(n,t,e)}function b(n,t){return t(n)}function w(n){if(!n)throw new Error("Assertion Failed")}function _(n){a.setImmediate?setImmediate(n):setTimeout(n,0)}function x(n,t){return n.reduce((function(n,e,r){var i=t(e,r);return i&&(n[i[0]]=i[1]),n}),{})}function k(n,t){return function(){try{n.apply(this,arguments)}catch(n){t(n)}}}function I(n,t,e){try{n.apply(null,e)}catch(n){t&&t(n)}}function S(n,t){if(l(n,t))return n[t];if(!t)return n;if("string"!=typeof t){for(var e=[],r=0,i=t.length;r<i;++r){var o=S(n,t[r]);e.push(o)}return e}var a=t.indexOf(".");if(-1!==a){var u=n[t.substr(0,a)];return void 0===u?void 0:S(u,t.substr(a+1))}}function P(n,t,e){if(n&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(n)))if("string"!=typeof t&&"length"in t){w("string"!=typeof e&&"length"in e);for(var r=0,i=t.length;r<i;++r)P(n,t[r],e[r])}else{var o=t.indexOf(".");if(-1!==o){var a=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===e?delete n[a]:n[a]=e;else{var s=n[a];s||(s=n[a]={}),P(s,u,e)}}else void 0===e?delete n[t]:n[t]=e}}function j(n){var t={};for(var e in n)l(n,e)&&(t[e]=n[e]);return t}var O=[].concat;function E(n){return O.apply([],n)}var D="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(E([8,16,32,64].map((function(n){return["Int","Uint","Float"].map((function(t){return t+n+"Array"}))})))).filter((function(n){return a[n]})).map((function(n){return a[n]}));function A(n){if(!n||"object"!=typeof n)return n;var t;if(o(n)){t=[];for(var e=0,r=n.length;e<r;++e)t.push(A(n[e]))}else if(D.indexOf(n.constructor)>=0)t=n;else for(var i in t=n.constructor?Object.create(n.constructor.prototype):{},n)l(n,i)&&(t[i]=A(n[i]));return t}function C(n,t,e,r){return e=e||{},r=r||"",i(n).forEach((function(i){if(l(t,i)){var o=n[i],a=t[i];"object"==typeof o&&"object"==typeof a&&o&&a&&""+o.constructor==""+a.constructor?C(o,a,e,r+i+"."):o!==a&&(e[r+i]=t[i])}else e[r+i]=void 0})),i(t).forEach((function(i){l(n,i)||(e[r+i]=t[i])})),e}var T="undefined"!=typeof Symbol&&Symbol.iterator,K=T?function(n){var t;return null!=n&&(t=n[T])&&t.apply(n)}:function(){return null},B={};function F(n){var t,e,r,i;if(1===arguments.length){if(o(n))return n.slice();if(this===B&&"string"==typeof n)return[n];if(i=K(n)){for(e=[];!(r=i.next()).done;)e.push(r.value);return e}if(null==n)return[n];if("number"==typeof(t=n.length)){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}var N="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function q(n,t){N=n,M=t}var M=function(){return!0},R=!new Error("").stack;function L(){if(R)try{throw L.arguments,new Error}catch(n){return n}return new Error}function U(n,t){var e=n.stack;return e?(t=t||0,0===e.indexOf(n.name)&&(t+=(n.name+n.message).split("\n").length),e.split("\n").slice(t).filter(M).map((function(n){return"\n"+n})).join("")):""}var z=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(z),W={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function H(n,t){this._e=L(),this.name=n,this.message=t}function J(n,t,e,r){this._e=L(),this.failures=t,this.failedKeys=r,this.successCount=e}function Q(n,t){this._e=L(),this.name="BulkError",this.failures=t,this.message=function(n,t){return n+". Errors: "+t.map((function(n){return n.toString()})).filter((function(n,t,e){return e.indexOf(n)===t})).join("\n")}(n,t)}v(H).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}}),v(J).from(H),v(Q).from(H);var G=V.reduce((function(n,t){return n[t]=t+"Error",n}),{}),$=H,Y=V.reduce((function(n,t){var e=t+"Error";function r(n,r){this._e=L(),this.name=e,n?"string"==typeof n?(this.message=n,this.inner=r||null):"object"==typeof n&&(this.message=n.name+" "+n.message,this.inner=n):(this.message=W[t]||e,this.inner=null)}return v(r).from($),n[t]=r,n}),{});Y.Syntax=SyntaxError,Y.Type=TypeError,Y.Range=RangeError;var X=z.reduce((function(n,t){return n[t+"Error"]=Y[t],n}),{});var Z=V.reduce((function(n,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(n[t+"Error"]=Y[t]),n}),{});function nn(){}function tn(n){return n}function en(n,t){return null==n||n===tn?t:function(e){return t(n(e))}}function rn(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function on(n,t){return n===nn?t:function(){var e=n.apply(this,arguments);void 0!==e&&(arguments[0]=e);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?rn(r,this.onsuccess):r),i&&(this.onerror=this.onerror?rn(i,this.onerror):i),void 0!==o?o:e}}function an(n,t){return n===nn?t:function(){n.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?rn(e,this.onsuccess):e),r&&(this.onerror=this.onerror?rn(r,this.onerror):r)}}function un(n,t){return n===nn?t:function(e){var r=n.apply(this,arguments);u(e,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?rn(i,this.onsuccess):i),o&&(this.onerror=this.onerror?rn(o,this.onerror):o),void 0===r?void 0===a?void 0:a:u(r,a)}}function sn(n,t){return n===nn?t:function(){return!1!==t.apply(this,arguments)&&n.apply(this,arguments)}}function cn(n,t){return n===nn?t:function(){var e=n.apply(this,arguments);if(e&&"function"==typeof e.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return e.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}Z.ModifyError=J,Z.DexieError=H,Z.BulkError=Q;var ln={},fn=100,hn=7,dn=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var n=a.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}(),vn=dn[0],pn=dn[1],yn=dn[2],gn=pn&&pn.then,mn=vn&&vn.constructor,bn=dn[3],wn=!!yn,_n=!1,xn=yn?function(){yn.then(Wn)}:a.setImmediate?setImmediate.bind(null,Wn):a.MutationObserver?function(){var n=document.createElement("div");new MutationObserver((function(){Wn(),n=null})).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(Wn,0)},kn=function(n,t){Cn.push([n,t]),Sn&&(xn(),Sn=!1)},In=!0,Sn=!0,Pn=[],jn=[],On=null,En=tn,Dn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:pt,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(n){try{pt(n[0],n[1])}catch(n){}}))}},An=Dn,Cn=[],Tn=0,Kn=[];function Bn(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=nn,this._lib=!1;var t=this._PSD=An;if(N&&(this._stackHolder=L(),this._prev=null,this._numPrev=0),"function"!=typeof n){if(n!==ln)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Mn(this,this._value))}this._state=null,this._value=null,++t.ref,qn(this,n)}var Fn={get:function(){var n=An,t=tt;function e(e,r){var i=this,o=!n.global&&(n!==An||t!==tt);o&&ot();var a=new Bn((function(t,a){Ln(i,new Nn(ht(e,n,o),ht(r,n,o),t,a,n))}));return N&&Vn(a,this),a}return e.prototype=ln,e},set:function(n){d(this,"then",n&&n.prototype===ln?Fn:{get:function(){return n},set:Fn.set})}};function Nn(n,t,e,r,i){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=i}function qn(n,t){try{t((function(t){if(null===n._state){if(t===n)throw new TypeError("A promise cannot be resolved with itself.");var e=n._lib&&Hn();t&&"function"==typeof t.then?qn(n,(function(n,e){t instanceof Bn?t._then(n,e):t.then(n,e)})):(n._state=!0,n._value=t,Rn(n)),e&&Jn()}}),Mn.bind(null,n))}catch(t){Mn(n,t)}}function Mn(n,t){if(jn.push(t),null===n._state){var e=n._lib&&Hn();t=En(t),n._state=!1,n._value=t,N&&null!==t&&"object"==typeof t&&!t._promise&&I((function(){var e=y(t,"stack");t._promise=n,d(t,"stack",{get:function(){return _n?e&&(e.get?e.get.apply(t):e.value):n.stack}})})),function(n){Pn.some((function(t){return t._value===n._value}))||Pn.push(n)}(n),Rn(n),e&&Jn()}}function Rn(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)Ln(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===Tn&&(++Tn,kn((function(){0==--Tn&&Qn()}),[]))}function Ln(n,t){if(null!==n._state){var e=n._state?t.onFulfilled:t.onRejected;if(null===e)return(n._state?t.resolve:t.reject)(n._value);++t.psd.ref,++Tn,kn(Un,[e,n,t])}else n._listeners.push(t)}function Un(n,t,e){try{On=t;var r,i=t._value;t._state?r=n(i):(jn.length&&(jn=[]),r=n(i),-1===jn.indexOf(i)&&function(n){var t=Pn.length;for(;t;)if(Pn[--t]._value===n._value)return void Pn.splice(t,1)}(t)),e.resolve(r)}catch(n){e.reject(n)}finally{On=null,0==--Tn&&Qn(),--e.psd.ref||e.psd.finalize()}}function zn(n,t,e){if(t.length===e)return t;var r="";if(!1===n._state){var i,o,a=n._value;null!=a?(i=a.name||"Error",o=a.message||a,r=U(a,0)):(i=a,o=""),t.push(i+(o?": "+o:"")+r)}return N&&((r=U(n._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),n._prev&&zn(n._prev,t,e)),t}function Vn(n,t){var e=t?t._numPrev+1:0;e<fn&&(n._prev=t,n._numPrev=e)}function Wn(){Hn()&&Jn()}function Hn(){var n=In;return In=!1,Sn=!1,n}function Jn(){var n,t,e;do{for(;Cn.length>0;)for(n=Cn,Cn=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}}while(Cn.length>0);In=!0,Sn=!0}function Qn(){var n=Pn;Pn=[],n.forEach((function(n){n._PSD.onunhandled.call(null,n._value,n)}));for(var t=Kn.slice(0),e=t.length;e;)t[--e]()}function Gn(n){return new Bn(ln,!1,n)}function $n(n,t){var e=An;return function(){var r=Hn(),i=An;try{return ct(e,!0),n.apply(this,arguments)}catch(n){t&&t(n)}finally{ct(i,!1),r&&Jn()}}}f(Bn.prototype,{then:Fn,_then:function(n,t){Ln(this,new Nn(null,null,n,t,An))},catch:function(n){if(1===arguments.length)return this.then(null,n);var t=arguments[0],e=arguments[1];return"function"==typeof t?this.then(null,(function(n){return n instanceof t?e(n):Gn(n)})):this.then(null,(function(n){return n&&n.name===t?e(n):Gn(n)}))},finally:function(n){return this.then((function(t){return n(),t}),(function(t){return n(),Gn(t)}))},stack:{get:function(){if(this._stack)return this._stack;try{_n=!0;var n=zn(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=n),n}finally{_n=!1}}},timeout:function(n,t){var e=this;return n<1/0?new Bn((function(r,i){var o=setTimeout((function(){return i(new Y.Timeout(t))}),n);e.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(Bn.prototype,Symbol.toStringTag,"Promise"),Dn.env=lt(),f(Bn,{all:function(){var n=F.apply(null,arguments).map(at);return new Bn((function(t,e){0===n.length&&t([]);var r=n.length;n.forEach((function(i,o){return Bn.resolve(i).then((function(e){n[o]=e,--r||t(n)}),e)}))}))},resolve:function(n){if(n instanceof Bn)return n;if(n&&"function"==typeof n.then)return new Bn((function(t,e){n.then(t,e)}));var t=new Bn(ln,!0,n);return Vn(t,On),t},reject:Gn,race:function(){var n=F.apply(null,arguments).map(at);return new Bn((function(t,e){n.map((function(n){return Bn.resolve(n).then(t,e)}))}))},PSD:{get:function(){return An},set:function(n){return An=n}},newPSD:rt,usePSD:ft,scheduler:{get:function(){return kn},set:function(n){kn=n}},rejectionMapper:{get:function(){return En},set:function(n){En=n}},follow:function(n,t){return new Bn((function(e,r){return rt((function(t,e){var r=An;r.unhandleds=[],r.onunhandled=e,r.finalize=rn((function(){var n=this;!function(n){function t(){n(),Kn.splice(Kn.indexOf(t),1)}Kn.push(t),++Tn,kn((function(){0==--Tn&&Qn()}),[])}((function(){0===n.unhandleds.length?t():e(n.unhandleds[0])}))}),r.finalize),n()}),t,e,r)}))}});var Yn={awaits:0,echoes:0,id:0},Xn=0,Zn=[],nt=0,tt=0,et=0;function rt(n,t,e,r){var i=An,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++et;var a=Dn.env;o.env=wn?{Promise:Bn,PromiseProp:{value:Bn,configurable:!0,writable:!0},all:Bn.all,race:Bn.race,resolve:Bn.resolve,reject:Bn.reject,nthen:dt(a.nthen,o),gthen:dt(a.gthen,o)}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=ft(o,n,e,r);return 0===o.ref&&o.finalize(),s}function it(){return Yn.id||(Yn.id=++Xn),++Yn.awaits,Yn.echoes+=hn,Yn.id}function ot(n){!Yn.awaits||n&&n!==Yn.id||(0==--Yn.awaits&&(Yn.id=0),Yn.echoes=Yn.awaits*hn)}function at(n){return Yn.echoes&&n&&n.constructor===mn?(it(),n.then((function(n){return ot(),n}),(function(n){return ot(),yt(n)}))):n}function ut(n){++tt,Yn.echoes&&0!=--Yn.echoes||(Yn.echoes=Yn.id=0),Zn.push(An),ct(n,!0)}function st(){var n=Zn[Zn.length-1];Zn.pop(),ct(n,!1)}function ct(n,t){var e,r=An;if((t?!Yn.echoes||nt++&&n===An:!nt||--nt&&n===An)||(e=t?ut.bind(null,n):st,gn.call(vn,e)),n!==An&&(An=n,r===Dn&&(Dn.env=lt()),wn)){var i=Dn.env.Promise,o=n.env;pn.then=o.nthen,i.prototype.then=o.gthen,(r.global||n.global)&&(Object.defineProperty(a,"Promise",o.PromiseProp),i.all=o.all,i.race=o.race,i.resolve=o.resolve,i.reject=o.reject)}}function lt(){var n=a.Promise;return wn?{Promise:n,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:n.all,race:n.race,resolve:n.resolve,reject:n.reject,nthen:pn.then,gthen:n.prototype.then}:{}}function ft(n,t,e,r,i){var o=An;try{return ct(n,!0),t(e,r,i)}finally{ct(o,!1)}}function ht(n,t,e){return"function"!=typeof n?n:function(){var r=An;e&&it(),ct(t,!0);try{return n.apply(this,arguments)}finally{ct(r,!1)}}}function dt(n,t){return function(e,r){return n.call(this,ht(e,t,!1),ht(r,t,!1))}}var vt="unhandledrejection";function pt(n,t){var e;try{e=t.onuncatched(n)}catch(n){}if(!1!==e)try{var r,i={promise:t,reason:n};if(a.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(vt,!0,!0),u(r,i)):a.CustomEvent&&u(r=new CustomEvent(vt,{detail:i}),i),r&&a.dispatchEvent&&(dispatchEvent(r),!a.PromiseRejectionEvent&&a.onunhandledrejection))try{a.onunhandledrejection(r)}catch(n){}r.defaultPrevented||console.warn("Unhandled rejection: "+(n.stack||n))}catch(n){}}var yt=Bn.reject;function gt(n){var t={},e=function(e,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[e].subscribe.apply(null,o),n}if("string"==typeof e)return t[e]};e.addEventType=u;for(var r=1,a=arguments.length;r<a;++r)u(arguments[r]);return e;function u(n,r,a){if("object"!=typeof n){var s;r||(r=sn),a||(a=nn);var c={subscribers:[],fire:a,subscribe:function(n){-1===c.subscribers.indexOf(n)&&(c.subscribers.push(n),c.fire=r(c.fire,n))},unsubscribe:function(n){c.subscribers=c.subscribers.filter((function(t){return t!==n})),c.fire=c.subscribers.reduce(r,a)}};return t[n]=e[n]=c,c}i(s=n).forEach((function(n){var t=s[n];if(o(t))u(n,s[n][0],s[n][1]);else{if("asap"!==t)throw new Y.InvalidArgument("Invalid event config");var e=u(n,tn,(function(){for(var n=arguments.length,t=new Array(n);n--;)t[n]=arguments[n];e.subscribers.forEach((function(n){_((function(){n.apply(null,t)}))}))}))}}))}}var mt,bt="{version}",wt=String.fromCharCode(65535),_t=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return wt}}(),xt=-1/0,kt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",It="String expected.",St=[],Pt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),jt=Pt,Ot=Pt,Et=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};function Dt(n,t){var e,r,s,c,h,v=Dt.dependencies,p=u({addons:Dt.addons,autoOpen:!0,indexedDB:v.indexedDB,IDBKeyRange:v.IDBKeyRange},t),y=p.addons,g=p.autoOpen,_=p.indexedDB,O=p.IDBKeyRange,D=this._dbSchema={},T=[],K=[],q={},M=null,R=null,z=!1,V=null,W=!1,H="readonly",G="readwrite",$=this,X=new Bn((function(n){e=n})),Z=new Bn((function(n,t){r=t})),rn=!0,sn=!!Ut(_);function ln(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function fn(n,t,e){var r=$._createTransaction(G,K,D);r.create(t),r._completion.catch(e);var o=r._reject.bind(r);rt((function(){An.trans=r,0===n?(i(D).forEach((function(n){hn(t,n,D[n].primKey,D[n].indexes)})),Bn.follow((function(){return $.on.populate.fire(r)})).catch(o)):function(n,t,e){var r=[],o=T.filter((function(t){return t._cfg.version===n}))[0];if(!o)throw new Y.Upgrade("Dexie specification of currently installed DB version is missing");D=$._dbSchema=o._cfg.dbschema;var a=!1,u=T.filter((function(t){return t._cfg.version>n}));function s(){return r.length?Bn.resolve(r.shift()(t.idbtrans)).then(s):Bn.resolve()}return u.forEach((function(n){r.push((function(){var r=D,i=n._cfg.dbschema;Nn(r,e),Nn(i,e),D=$._dbSchema=i;var o=function(n,t){var e={del:[],add:[],change:[]};for(var r in n)t[r]||e.del.push(r);for(r in t){var i=n[r],o=t[r];if(i){var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)a.recreate=!0,e.change.push(a);else{var u=i.idxByName,s=o.idxByName;for(var c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&e.change.push(a)}}else e.add.push([r,o])}return e}(r,i);if(o.add.forEach((function(n){hn(e,n[0],n[1].primKey,n[1].indexes)})),o.change.forEach((function(n){if(n.recreate)throw new Y.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach((function(n){dn(t,n)})),n.change.forEach((function(n){t.deleteIndex(n.name),dn(t,n)})),n.del.forEach((function(n){t.deleteIndex(n)}))})),n._cfg.contentUpgrade)return a=!0,Bn.follow((function(){n._cfg.contentUpgrade(t)}))})),r.push((function(t){a&&jt||function(n,t){for(var e=0;e<t.db.objectStoreNames.length;++e){var r=t.db.objectStoreNames[e];null==n[r]&&t.db.deleteObjectStore(r)}}(n._cfg.dbschema,t)}))})),s().then((function(){!function(n,t){i(n).forEach((function(e){t.db.objectStoreNames.contains(e)||hn(t,e,n[e].primKey,n[e].indexes)}))}(D,e)}))}(n,r,t).catch(o)}))}function hn(n,t,e,r){var i=n.db.createObjectStore(t,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach((function(n){dn(i,n)})),i}function dn(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function vn(n,t,e){if(W||An.letThrough){var r=$._createTransaction(n,t,D);try{r.create()}catch(n){return yt(n)}return r._promise(n,(function(n,t){return rt((function(){return An.trans=r,e(n,t,r)}))})).then((function(n){return r._completion.then((function(){return n}))}))}if(!z){if(!g)return yt(new Y.DatabaseClosed);$.open().catch(nn)}return X.then((function(){return vn(n,t,e)}))}function pn(n,t,e){var r=arguments.length;if(r<2)throw new Y.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[n,E(i),e]}function yn(n,t,e){this.name=n,this.schema=t,this._tx=e,this.hook=q[n]?q[n].hook:gt(null,{creating:[on,nn],reading:[en,tn],updating:[un,nn],deleting:[an,nn]})}function gn(n,t,e){return(e?Ft:Kt)((function(e){n.push(e),t&&t()}))}function wn(n,t,e,r,i){return new Bn((function(o,a){var u=e.length,s=u-1;if(0===u)return o();if(r){var c,l=Ft(a),f=Tt(null);I((function(){for(var r=0;r<u;++r){c={onsuccess:null,onerror:null};var a=e[r];i.call(c,a[0],a[1],t);var h=n.delete(a[0]);h._hookCtx=c,h.onerror=l,h.onsuccess=r===s?Tt(o):f}}),(function(n){throw c.onerror&&c.onerror(n),n}))}else for(var h=0;h<u;++h){var d=n.delete(e[h]);d.onerror=Kt(a),h===s&&(d.onsuccess=$n((function(){return o()})))}}))}function _n(n,t,e,r){var i=this;this.db=$,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=gt(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 Bn((function(n,t){i._resolve=n,i._reject=t})),this._completion.then((function(){i.active=!1,i.on.complete.fire()}),(function(n){var t=i.active;return i.active=!1,i.on.error.fire(n),i.parent?i.parent._reject(n):t&&i.idbtrans&&i.idbtrans.abort(),yt(n)}))}function xn(n,t,e){this._ctx={table:n,index:":id"===t?null:t,or:e}}function kn(n,t){var e=null,r=null;if(t)try{e=t()}catch(n){r=n}var i=n._ctx,o=i.table;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:o.hook.reading.fire}}function In(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Sn(n,t){return n._cfg.version-t._cfg.version}function Pn(n,t,e){t.forEach((function(t){var r=e[t];n.forEach((function(n){t in n||(n===_n.prototype||n instanceof _n?d(n,t,{get:function(){return this.table(t)}}):n[t]=new yn(t,r))}))}))}function jn(n,t,e,r,i,o){var a=$n(o?function(n,t,r){return e(o(n),t,r)}:e,i);n.onerror||(n.onerror=Kt(i)),n.onsuccess=k(t?function(){var e=n.result;if(e){var o=function(){e.continue()};t(e,(function(n){o=n}),r,i)&&a(e.value,e,(function(n){o=n})),o()}else r()}:function(){var t=n.result;if(t){var e=function(){t.continue()};a(t.value,t,(function(n){e=n})),e()}else r()},i)}function On(n,t){return _.cmp(n,t)}function En(n,t){return On(n,t)>0?n:t}function Dn(n,t){return _.cmp(n,t)}function Cn(n,t){return _.cmp(t,n)}function Tn(n,t){return n<t?-1:n===t?0:1}function Kn(n,t){return n>t?-1:n===t?0:1}function Fn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function Nn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);s="getAll"in o;for(var u=0;u<o.indexNames.length;++u){var c=o.indexNames[u],l=o.index(c).keyPath,f="string"==typeof l?l:"["+m(l).join("+")+"]";if(n[i]){var h=n[i].idxByName[f];h&&(h.name=c)}}}/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(s=!1)}function qn(n){$.on("blocked").fire(n),St.filter((function(n){return n.name===$.name&&n!==$&&!n._vcFired})).map((function(t){return t.on("versionchange").fire(n)}))}this.version=function(n){if(M||z)throw new Y.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=T.filter((function(t){return t._cfg.version===n}))[0];return t||(t=new ln(n),T.push(t),T.sort(Sn),rn=!1,t)},u(ln.prototype,{stores:function(n){this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,n):n;var t={};T.forEach((function(n){u(t,n._cfg.storesSource)}));var e=this._cfg.dbschema={};return this._parseStoresSpec(t,e),D=$._dbSchema=e,[q,$,_n.prototype].forEach((function(n){for(var t in n)n[t]instanceof yn&&delete n[t]})),Pn([q,$,_n.prototype,this._cfg.tables],i(e),e),K=i(e),this},upgrade:function(n){return this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){i(n).forEach((function(e){if(null!==n[e]){var r={},i=function(n){var t=[];return n.split(",").forEach((function(n){var e=(n=n.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;t.push(new Mt(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),o(r),/\./.test(n)))})),t}(n[e]),a=i.shift();if(a.multi)throw new Y.Schema("Primary key cannot be multi-valued");a.keyPath&&P(r,a.keyPath,a.auto?0:a.keyPath),i.forEach((function(n){if(n.auto)throw new Y.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new Y.Schema("Index must have a name and cannot be an empty string");P(r,n.keyPath,n.compound?n.keyPath.map((function(){return""})):"")})),t[e]=new Rt(e,a,i,r)}}))}}),this._allTables=q,this._createTransaction=function(n,t,e,r){return new _n(n,t,e,r)},this._whenReady=function(n){return W||An.letThrough?n():new Bn((function(n,t){if(!z){if(!g)return void t(new Y.DatabaseClosed);$.open().catch(nn)}X.then(n,t)})).then(n)},this.verno=0,this.open=function(){if(z||M)return X.then((function(){return R?yt(R):$}));N&&(Z._stackHolder=L()),z=!0,R=null,W=!1;var t=e,r=null;return Bn.race([Z,new Bn((function(t,e){if(!_)throw new Y.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 o=rn?_.open(n):_.open(n,Math.round(10*$.verno));if(!o)throw new Y.MissingAPI("IndexedDB API not available");o.onerror=Kt(e),o.onblocked=$n(qn),o.onupgradeneeded=$n((function(t){if(r=o.transaction,rn&&!$._allowEmptyDB){o.onerror=Nt,r.abort(),o.result.close();var i=_.deleteDatabase(n);i.onsuccess=i.onerror=$n((function(){e(new Y.NoSuchDatabase("Database "+n+" doesnt exist"))}))}else{r.onerror=Kt(e),fn((t.oldVersion>Math.pow(2,62)?0:t.oldVersion)/10,r,e)}}),e),o.onsuccess=$n((function(){if(r=null,M=o.result,St.push($),rn)!function(){if($.verno=M.version/10,$._dbSchema=D={},0===(K=m(M.objectStoreNames,0)).length)return;var n=M.transaction(Lt(K),"readonly");K.forEach((function(t){for(var e=n.objectStore(t),r=e.keyPath,i=r&&"string"==typeof r&&-1!==r.indexOf("."),o=new Mt(r,r||"",!1,!1,!!e.autoIncrement,r&&"string"!=typeof r,i),a=[],u=0;u<e.indexNames.length;++u){var s=e.index(e.indexNames[u]);i=(r=s.keyPath)&&"string"==typeof r&&-1!==r.indexOf(".");var c=new Mt(s.name,r,!!s.unique,!!s.multiEntry,!1,r&&"string"!=typeof r,i);a.push(c)}D[t]=new Rt(t,o,a,{})})),Pn([q],i(D),D)}();else if(M.objectStoreNames.length>0)try{Nn(D,M.transaction(Lt(M.objectStoreNames),H))}catch(n){}M.onversionchange=$n((function(n){$._vcFired=!0,$.on("versionchange").fire(n)})),sn||"__dbnames"===n||mt.dbnames.put({name:n}).catch(nn),t()}),e)}))]).then((function(){return V=[],Bn.resolve(Dt.vip($.on.ready.fire)).then((function n(){if(V.length>0){var t=V.reduce(cn,nn);return V=[],Bn.resolve(Dt.vip(t)).then(n)}}))})).finally((function(){V=null})).then((function(){return z=!1,$})).catch((function(n){try{r&&r.abort()}catch(n){}return z=!1,$.close(),yt(R=n)})).finally((function(){W=!0,t()}))},this.close=function(){var n=St.indexOf($);if(n>=0&&St.splice(n,1),M){try{M.close()}catch(n){}M=null}g=!1,R=new Y.DatabaseClosed,z&&r(R),X=new Bn((function(n){e=n})),Z=new Bn((function(n,t){r=t}))},this.delete=function(){var t=arguments.length>0;return new Bn((function(e,r){if(t)throw new Y.InvalidArgument("Arguments not allowed in db.delete()");function i(){$.close();var t=_.deleteDatabase(n);t.onsuccess=$n((function(){sn||mt.dbnames.delete(n).catch(nn),e()})),t.onerror=Kt(r),t.onblocked=qn}z?X.then(i):i()}))},this.backendDB=function(){return M},this.isOpen=function(){return null!==M},this.hasBeenClosed=function(){return R&&R instanceof Y.DatabaseClosed},this.hasFailed=function(){return null!==R},this.dynamicallyOpened=function(){return rn},this.name=n,f(this,{tables:{get:function(){return i(q).map((function(n){return q[n]}))}}}),this.on=gt(this,"populate","blocked","versionchange",{ready:[cn,nn]}),this.on.ready.subscribe=b(this.on.ready.subscribe,(function(n){return function(t,e){Dt.vip((function(){W?(R||Bn.resolve().then(t),e&&n(t)):V?(V.push(t),e&&n(t)):(n(t),e||n((function n(){$.on.ready.unsubscribe(t),$.on.ready.unsubscribe(n)})))}))}})),this.transaction=function(){var n=pn.apply(this,arguments);return this._transaction.apply(this,n)},this._transaction=function(n,t,e){var r=An.trans;r&&r.db===$&&-1===n.indexOf("!")||(r=null);var i=-1!==n.indexOf("?");n=n.replace("!","").replace("?","");try{var o=t.map((function(n){var t=n instanceof yn?n.name:n;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}));if("r"==n||n==H)n=H;else{if("rw"!=n&&n!=G)throw new Y.InvalidArgument("Invalid transaction mode: "+n);n=G}if(r){if(r.mode===H&&n===G){if(!i)throw new Y.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((function(n){if(r&&-1===r.storeNames.indexOf(n)){if(!i)throw new Y.SubTransaction("Table "+n+" not included in parent transaction.");r=null}})),i&&r&&!r.active&&(r=null)}}catch(n){return r?r._promise(null,(function(t,e){e(n)})):yt(n)}return r?r._promise(n,a,"lock"):An.trans?ft(An.transless,(function(){return $._whenReady(a)})):$._whenReady(a);function a(){return Bn.resolve().then((function(){var t,i=An.transless||An,a=$._createTransaction(n,o,D,r),u={trans:a,transless:i};r?a.idbtrans=r.idbtrans:a.create(),e.constructor===bn&&it();var s=Bn.follow((function(){if(t=e.call(a,a))if(t.constructor===mn){var n=ot.bind(null,null);t.then(n,n)}else"function"==typeof t.next&&"function"==typeof t.throw&&(t=qt(t))}),u);return(t&&"function"==typeof t.then?Bn.resolve(t).then((function(n){return a.active?n:yt(new Y.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):s.then((function(){return t}))).then((function(n){return r&&a._resolve(),a._completion.then((function(){return n}))})).catch((function(n){return a._reject(n),yt(n)}))}))}},this.table=function(n){if(!l(q,n))throw new Y.InvalidTable("Table "+n+" does not exist");return q[n]},f(yn.prototype,{_trans:function(n,t,e){var r=this._tx||An.trans;return r&&r.db===$?r===An.trans?r._promise(n,t,e):rt((function(){return r._promise(n,t,e)}),{trans:r,transless:An.transless||An}):vn(n,[this.name],t)},_idbstore:function(n,t,e){var r=this.name;return this._trans(n,(function(n,e,i){if(-1===i.storeNames.indexOf(r))throw new Y.NotFound("Table"+r+" not part of transaction");return t(n,e,i.idbtrans.objectStore(r),i)}),e)},get:function(n,t){if(n&&n.constructor===Object)return this.where(n).first(t);var e=this;return this._idbstore(H,(function(t,r,i){var o=i.get(n);o.onerror=Kt(r),o.onsuccess=$n((function(){t(e.hook.reading.fire(o.result))}),r)})).then(t)},where:function(n){if("string"==typeof n)return new xn(this,n);if(o(n))return new xn(this,"["+n.join("+")+"]");var t=i(n);if(1===t.length)return this.where(t[0]).equals(n[t[0]]);var e=this.schema.indexes.concat(this.schema.primKey).filter((function(n){return n.compound&&t.every((function(t){return n.keyPath.indexOf(t)>=0}))&&n.keyPath.every((function(n){return t.indexOf(n)>=0}))}))[0];if(e&&_t!==wt)return this.where(e.name).equals(e.keyPath.map((function(t){return n[t]})));e||console.warn("The query "+JSON.stringify(n)+" on "+this.name+" would benefit of a compound index ["+t.join("+")+"]");var r=this.schema.idxByName,a=t.reduce((function(t,e){return[t[0]||r[e],t[0]||!r[e]?Fn(t[1],(function(t){return""+S(t,e)==""+n[e]})):t[1]]}),[null,null]),u=a[0];return u?this.where(u.name).equals(n[u.keyPath]).filter(a[1]):e?this.filter(a[1]):this.where(t).equals("")},count:function(n){return this.toCollection().count(n)},offset:function(n){return this.toCollection().offset(n)},limit:function(n){return this.toCollection().limit(n)},reverse:function(){return this.toCollection().reverse()},filter:function(n){return this.toCollection().and(n)},each:function(n){return this.toCollection().each(n)},toArray:function(n){return this.toCollection().toArray(n)},orderBy:function(n){return new kn(new xn(this,o(n)?"["+n.join("+")+"]":n))},toCollection:function(){return new kn(new xn(this))},mapToClass:function(n,t){this.schema.mappedClass=n;var e=Object.create(n.prototype);t&&Ct(e,t),this.schema.instanceTemplate=e;var r=function(t){if(!t)return t;var e=Object.create(n.prototype);for(var r in t)if(l(t,r))try{e[r]=t[r]}catch(n){}return e};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),n},defineClass:function(n){return this.mapToClass(Dt.defineClass(n),n)},bulkDelete:function(n){return this.hook.deleting.fire===nn?this._idbstore(G,(function(t,e,r,i){t(wn(r,i,n,!1,nn))})):this.where(":id").anyOf(n).delete().then((function(){}))},bulkPut:function(n,t){var e=this;return this._idbstore(G,(function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new Y.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new Y.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return r();var a,u,s=function(n){0===c.length?r(n):i(new Q(e.name+".bulkPut(): "+c.length+" of "+l+" operations failed",c))},c=[],l=n.length,f=e;if(e.hook.creating.fire===nn&&e.hook.updating.fire===nn){u=gn(c);for(var h=0,d=n.length;h<d;++h)(a=t?o.put(n[h],t[h]):o.put(n[h])).onerror=u;a.onerror=gn(c,s),a.onsuccess=Bt(s)}else{var v=t||o.keyPath&&n.map((function(n){return S(n,o.keyPath)})),p=v&&x(v,(function(t,e){return null!=t&&[t,n[e]]})),y=v?f.where(":id").anyOf(v.filter((function(n){return null!=n}))).modify((function(){this.value=p[this.primKey],p[this.primKey]=null})).catch(J,(function(n){c=n.failures})).then((function(){for(var e=[],r=t&&[],i=v.length-1;i>=0;--i){var o=v[i];(null==o||p[o])&&(e.push(n[i]),t&&r.push(o),null!=o&&(p[o]=null))}return e.reverse(),t&&r.reverse(),f.bulkAdd(e,r)})).then((function(n){var t=v[v.length-1];return null!=t?t:n})):f.bulkAdd(n);y.then(s).catch(Q,(function(n){c=c.concat(n.failures),s()})).catch(i)}}),"locked")},bulkAdd:function(n,t){var e=this,r=this.hook.creating.fire;return this._idbstore(G,(function(i,o,a,u){if(!a.keyPath&&!e.schema.primKey.auto&&!t)throw new Y.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(a.keyPath&&t)throw new Y.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Y.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return i();function s(n){0===h.length?i(n):o(new Q(e.name+".bulkAdd(): "+h.length+" of "+d+" operations failed",h))}var c,l,f,h=[],d=n.length;if(r!==nn){var v,p=a.keyPath;l=gn(h,null,!0),f=Tt(null),I((function(){for(var e=0,i=n.length;e<i;++e){v={onerror:null,onsuccess:null};var o=t&&t[e],s=n[e],h=t?o:p?S(s,p):void 0,d=r.call(v,h,s,u);null==h&&null!=d&&(p?P(s=A(s),p,d):o=d),(c=null!=o?a.add(s,o):a.add(s))._hookCtx=v,e<i-1&&(c.onerror=l,v.onsuccess&&(c.onsuccess=f))}}),(function(n){throw v.onerror&&v.onerror(n),n})),c.onerror=gn(h,s,!0),c.onsuccess=Tt(s)}else{l=gn(h);for(var y=0,g=n.length;y<g;++y)(c=t?a.add(n[y],t[y]):a.add(n[y])).onerror=l;c.onerror=gn(h,s),c.onsuccess=Bt(s)}}))},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(G,(function(r,i,o,a){var u={onsuccess:null,onerror:null};if(e!==nn){var s=null!=t?t:o.keyPath?S(n,o.keyPath):void 0,c=e.call(u,s,n,a);null==s&&null!=c&&(o.keyPath?P(n,o.keyPath,c):t=c)}try{var l=null!=t?o.add(n,t):o.add(n);l._hookCtx=u,l.onerror=Ft(i),l.onsuccess=Tt((function(t){var e=o.keyPath;e&&P(n,e,t),r(t)}))}catch(n){throw u.onerror&&u.onerror(n),n}}))},put:function(n,t){var e=this,r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==nn||i!==nn){var o=this.schema.primKey.keyPath,a=void 0!==t?t:o&&S(n,o);return null==a?this.add(n):(n=A(n),this._trans(G,(function(){return e.where(":id").equals(a).modify((function(){this.value=n})).then((function(r){return 0===r?e.add(n,t):a}))}),"locked"))}return this._idbstore(G,(function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=Kt(r),o.onsuccess=$n((function(t){var r=i.keyPath;r&&P(n,r,t.target.result),e(o.result)}))}))},delete:function(n){return this.hook.deleting.subscribers.length?this.where(":id").equals(n).delete():this._idbstore(G,(function(t,e,r){var i=r.delete(n);i.onerror=Kt(e),i.onsuccess=$n((function(){t(i.result)}))}))},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(G,(function(n,t,e){var r=e.clear();r.onerror=Kt(t),r.onsuccess=$n((function(){n(r.result)}))}))},update:function(n,t){if("object"!=typeof t||o(t))throw new Y.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||o(n))return this.where(":id").equals(n).modify(t);i(t).forEach((function(e){P(n,e,t[e])}));var e=S(n,this.schema.primKey.keyPath);return void 0===e?yt(new Y.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),f(_n.prototype,{_lock:function(){return w(!An.global),++this._reculock,1!==this._reculock||An.global||(An.lockOwnerFor=this),this},_unlock:function(){if(w(!An.global),0==--this._reculock)for(An.global||(An.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{ft(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&An.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(w(!this.idbtrans),!n&&!M)switch(R&&R.name){case"DatabaseClosedError":throw new Y.DatabaseClosed(R);case"MissingAPIError":throw new Y.MissingAPI(R.message,R);default:throw new Y.OpenFailed(R)}if(!this.active)throw new Y.TransactionInactive;return w(null===this._completion._state),(n=this.idbtrans=n||M.transaction(Lt(this.storeNames),this.mode)).onerror=$n((function(e){Nt(e),t._reject(n.error)})),n.onabort=$n((function(e){Nt(e),t.active&&t._reject(new Y.Abort(n.error)),t.active=!1,t.on("abort").fire(e)})),n.oncomplete=$n((function(){t.active=!1,t._resolve()})),this},_promise:function(n,t,e){var r=this;if(n===G&&this.mode!==G)return yt(new Y.ReadOnly("Transaction is readonly"));if(!this.active)return yt(new Y.TransactionInactive);if(this._locked())return new Bn((function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},An])}));if(e)return rt((function(){var n=new Bn((function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)}));return n.finally((function(){return r._unlock()})),n._lib=!0,n}));var i=new Bn((function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)}));return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=Bn.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then((function(){return n}));else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-1/0).onsuccess=n)}()}var r=t._waitingFor;return new Bn((function(e,i){n.then((function(n){return t._waitingQueue.push($n(e.bind(null,n)))}),(function(n){return t._waitingQueue.push($n(i.bind(null,n)))})).finally((function(){t._waitingFor===r&&(t._waitingFor=null)}))}))},abort:function(){this.active&&this._reject(new Y.Abort),this.active=!1},tables:{get:(c="Transaction.tables",h=function(){return q},function(){return console.warn(c+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+U(L(),1)),h.apply(this,arguments)})},table:function(n){return new yn(n,$.table(n).schema,this)}}),f(xn.prototype,(function(){function n(n,t,e){var r=n instanceof xn?new kn(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new kn(n,(function(){return O.only("")})).limit(0)}function e(n,t,e,r,i,o){for(var a=Math.min(n.length,r.length),u=-1,s=0;s<a;++s){var c=t[s];if(c!==r[s])return i(n[s],e[s])<0?n.substr(0,s)+e[s]+e.substr(s+1):i(n[s],r[s])<0?n.substr(0,s)+r[s]+e.substr(s+1):u>=0?n.substr(0,u)+t[u]+e.substr(u+1):null;i(n[s],c)<0&&(u=s)}return a<r.length&&"next"===o?n+e.substr(n.length):a<n.length&&"prev"===o?n.substr(0,e.length):u<0?null:n.substr(0,u)+r[u]+e.substr(u+1)}function r(t,r,i,o){var a,u,s,c,l,f,h,d=i.length;if(!i.every((function(n){return"string"==typeof n})))return n(t,It);function v(n){a=function(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}(n),u=function(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}(n),s="next"===n?Tn:Kn;var t=i.map((function(n){return{lower:u(n),upper:a(n)}})).sort((function(n,t){return s(n.lower,t.lower)}));c=t.map((function(n){return n.upper})),l=t.map((function(n){return n.lower})),f=n,h="next"===n?"":o}v("next");var p=new kn(t,(function(){return O.bound(c[0],l[d-1]+o)}));p._ondirectionchange=function(n){v(n)};var y=0;return p._addAlgorithm((function(n,t,i){var o=n.key;if("string"!=typeof o)return!1;var a=u(o);if(r(a,l,y))return!0;for(var v=null,p=y;p<d;++p){var g=e(o,a,c[p],l[p],s,f);null===g&&null===v?y=p+1:(null===v||s(v,g)>0)&&(v=g)}return t(null!==v?function(){n.continue(v+h)}:i),!1})),p}return{between:function(e,r,i,o){i=!1!==i,o=!0===o;try{return On(e,r)>0||0===On(e,r)&&(i||o)&&(!i||!o)?t(this):new kn(this,(function(){return O.bound(e,r,!i,!o)}))}catch(t){return n(this,kt)}},equals:function(n){return new kn(this,(function(){return O.only(n)}))},above:function(n){return new kn(this,(function(){return O.lowerBound(n,!0)}))},aboveOrEqual:function(n){return new kn(this,(function(){return O.lowerBound(n)}))},below:function(n){return new kn(this,(function(){return O.upperBound(n,!0)}))},belowOrEqual:function(n){return new kn(this,(function(){return O.upperBound(n)}))},startsWith:function(t){return"string"!=typeof t?n(this,It):this.between(t,t+wt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):r(this,(function(n,t){return 0===n.indexOf(t[0])}),[n],wt)},equalsIgnoreCase:function(n){return r(this,(function(n,t){return n===t[0]}),[n],"")},anyOfIgnoreCase:function(){var n=F.apply(B,arguments);return 0===n.length?t(this):r(this,(function(n,t){return-1!==t.indexOf(n)}),n,"")},startsWithAnyOfIgnoreCase:function(){var n=F.apply(B,arguments);return 0===n.length?t(this):r(this,(function(n,t){return t.some((function(t){return 0===n.indexOf(t)}))}),n,wt)},anyOf:function(){var e=F.apply(B,arguments),r=Dn;try{e.sort(r)}catch(t){return n(this,kt)}if(0===e.length)return t(this);var i=new kn(this,(function(){return O.bound(e[0],e[e.length-1])}));i._ondirectionchange=function(n){r="next"===n?Dn:Cn,e.sort(r)};var o=0;return i._addAlgorithm((function(n,t,i){for(var a=n.key;r(a,e[o])>0;)if(++o===e.length)return t(i),!1;return 0===r(a,e[o])||(t((function(){n.continue(e[o])})),!1)})),i},notEqual:function(n){return this.inAnyRange([[xt,n],[n,_t]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=F.apply(B,arguments);if(0===t.length)return new kn(this);try{t.sort(Dn)}catch(t){return n(this,kt)}var e=t.reduce((function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[xt,t]]}),null);return e.push([t[t.length-1],_t]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(e,r){if(0===e.length)return t(this);if(!e.every((function(n){return void 0!==n[0]&&void 0!==n[1]&&Dn(n[0],n[1])<=0})))return n(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Y.InvalidArgument);var i=!r||!1!==r.includeLowers,o=r&&!0===r.includeUppers;var a,u=Dn;function s(n,t){return u(n[0],t[0])}try{a=e.reduce((function(n,t){for(var e=0,r=n.length;e<r;++e){var i=n[e];if(On(t[0],i[1])<0&&On(t[1],i[0])>0){i[0]=On(o=i[0],a=t[0])<0?o:a,i[1]=En(i[1],t[1]);break}}var o,a;return e===r&&n.push(t),n}),[]),a.sort(s)}catch(t){return n(this,kt)}var c=0,l=o?function(n){return Dn(n,a[c][1])>0}:function(n){return Dn(n,a[c][1])>=0},f=i?function(n){return Cn(n,a[c][0])>0}:function(n){return Cn(n,a[c][0])>=0};var h=l,d=new kn(this,(function(){return O.bound(a[0][0],a[a.length-1][1],!i,!o)}));return d._ondirectionchange=function(n){"next"===n?(h=l,u=Dn):(h=f,u=Cn),a.sort(s)},d._addAlgorithm((function(n,t,e){for(var r=n.key;h(r);)if(++c===a.length)return t(e),!1;return!!function(n){return!l(n)&&!f(n)}(r)||(0===On(r,a[c][1])||0===On(r,a[c][0])||t((function(){u===Dn?n.continue(a[c][0]):n.continue(a[c][1])})),!1)})),d},startsWithAnyOf:function(){var e=F.apply(B,arguments);return e.every((function(n){return"string"==typeof n}))?0===e.length?t(this):this.inAnyRange(e.map((function(n){return[n,n+wt]}))):n(this,"startsWithAnyOf() only works with strings")}}})),f(kn.prototype,(function(){function n(n,t){n.filter=Fn(n.filter,t)}function t(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return Fn(r(),t())}:t,n.justLimit=e&&!r}function e(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new Y.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return t.index(e.name)}function r(n,t){var r=e(n,t);return n.keysOnly&&"openKeyCursor"in r?r.openKeyCursor(n.range||null,n.dir+n.unique):r.openCursor(n.range||null,n.dir+n.unique)}function o(n,t,e,i,o){var a=n.replayFilter?Fn(n.filter,n.replayFilter()):n.filter;n.or?function(){var u={},s=0;function c(){2==++s&&e()}function f(n,e,r){if(!a||a(e,r,c,i)){var o=e.primaryKey,s=""+o;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(o)),l(u,s)||(u[s]=!0,t(n,e,r))}}n.or._iterate(f,c,i,o),jn(r(n,o),n.algorithm,f,c,i,!n.keysOnly&&n.valueMapper)}():jn(r(n,o),Fn(n.algorithm,a),t,e,i,!n.keysOnly&&n.valueMapper)}return{_read:function(n,t){var e=this._ctx;return e.error?e.table._trans(null,yt.bind(null,e.error)):e.table._idbstore(H,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,yt.bind(null,t.error)):t.table._idbstore(G,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=Fn(t.algorithm,n)},_iterate:function(n,t,e,r){return o(this._ctx,n,t,e,r)},clone:function(n){var t=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return n&&u(e,n),t._ctx=e,t},raw:function(){return this._ctx.valueMapper=null,this},each:function(n){var t=this._ctx;return this._read((function(e,r,i){o(t,n,e,r,i)}))},count:function(n){var t=this._ctx;if(In(t,!0))return this._read((function(n,r,i){var o=e(t,i),a=t.range?o.count(t.range):o.count();a.onerror=Kt(r),a.onsuccess=function(e){n(Math.min(e.target.result,t.limit))}}),n);var r=0;return this._read((function(n,e,i){o(t,(function(){return++r,!1}),(function(){n(r)}),e,i)}),n)},sortBy:function(n,t){var e=n.split(".").reverse(),r=e[0],i=e.length-1;function o(n,t){return t?o(n[e[t]],t-1):n[r]}var a="next"===this._ctx.dir?1:-1;function u(n,t){var e=o(n,i),r=o(t,i);return e<r?-a:e>r?a:0}return this.toArray((function(n){return n.sort(u)})).then(t)},toArray:function(n){var t=this._ctx;return this._read((function(n,r,i){if(s&&"next"===t.dir&&In(t,!0)&&t.limit>0){var a=t.table.hook.reading.fire,u=e(t,i),c=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);c.onerror=Kt(r),c.onsuccess=Bt(a===tn?n:function(t){try{n(t.map(a))}catch(n){r(n)}})}else{var l=[];o(t,(function(n){l.push(n)}),(function(){n(l)}),r,i)}}),n)},offset:function(n){var e=this._ctx;return n<=0||(e.offset+=n,In(e)?t(e,(function(){var t=n;return function(n,e){return 0===t||(1===t?(--t,!1):(e((function(){n.advance(t),t=0})),!1))}})):t(e,(function(){var t=n;return function(){return--t<0}}))),this},limit:function(n){return this._ctx.limit=Math.min(this._ctx.limit,n),t(this._ctx,(function(){var t=n;return function(n,e,r){return--t<=0&&e(r),t>=0}}),!0),this},until:function(t,e){return n(this._ctx,(function(n,r,i){return!t(n.value)||(r(i),e)})),this},first:function(n){return this.limit(1).toArray((function(n){return n[0]})).then(n)},last:function(n){return this.reverse().first(n)},filter:function(t){return n(this._ctx,(function(n){return t(n.value)})),function(n,t){n.isMatch=Fn(n.isMatch,t)}(this._ctx,t),this},and:function(n){return this.filter(n)},or:function(n){return new xn(this._ctx.table,n,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(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,e){n(e.key,e)}))},eachUniqueKey:function(n){return this._ctx.unique="unique",this.eachKey(n)},eachPrimaryKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,e){n(e.primaryKey,e)}))},keys:function(n){var t=this._ctx;t.keysOnly=!t.isMatch;var e=[];return this.each((function(n,t){e.push(t.key)})).then((function(){return e})).then(n)},primaryKeys:function(n){var t=this._ctx;if(s&&"next"===t.dir&&In(t,!0)&&t.limit>0)return this._read((function(n,r,i){var o=e(t,i),a=t.limit<1/0?o.getAllKeys(t.range,t.limit):o.getAllKeys(t.range);a.onerror=Kt(r),a.onsuccess=Bt(n)})).then(n);t.keysOnly=!t.isMatch;var r=[];return this.each((function(n,t){r.push(t.primaryKey)})).then((function(){return r})).then(n)},uniqueKeys:function(n){return this._ctx.unique="unique",this.keys(n)},firstKey:function(n){return this.limit(1).keys((function(n){return n[0]})).then(n)},lastKey:function(n){return this.reverse().firstKey(n)},distinct:function(){var t=this._ctx,e=t.index&&t.table.schema.idxByName[t.index];if(!e||!e.multi)return this;var r={};return n(this._ctx,(function(n){var t=n.primaryKey.toString(),e=l(r,t);return r[t]=!0,!e})),this},modify:function(n){var t=this,e=this._ctx.table.hook,r=e.updating.fire,o=e.deleting.fire;return this._write((function(e,a,s,c){var f;if("function"==typeof n)f=r===nn&&o===nn?n:function(t){var e=A(t);if(!1===n.call(this,t,this))return!1;if(l(this,"value")){var a=C(e,this.value),u=r.call(this,a,this.primKey,e,c);u&&(t=this.value,i(u).forEach((function(n){P(t,n,u[n])})))}else o.call(this,this.primKey,t,c)};else if(r===nn){var h=i(n),d=h.length;f=function(t){for(var e=!1,r=0;r<d;++r){var i=h[r],o=n[i];S(t,i)!==o&&(P(t,i,o),e=!0)}return e}}else{var v=n;n=j(v),f=function(t){var e=!1,o=r.call(this,n,this.primKey,A(t),c);return o&&u(n,o),i(n).forEach((function(r){var i=n[r];S(t,r)!==i&&(P(t,r,i),e=!0)})),o&&(n=j(v)),e}}var p=0,y=0,g=!1,m=[],b=[],w=null;function _(n){return n&&(m.push(n),b.push(w)),a(new J("Error modifying one or more objects",m,y,b))}function x(){g&&y+m.length===p&&(m.length>0?_():e(y))}t.clone().raw()._iterate((function(n,t){w=t.primaryKey;var e={primKey:t.primaryKey,value:n,onsuccess:null,onerror:null};function r(n){return m.push(n),b.push(e.primKey),x(),!0}if(!1!==f.call(e,n,e)){var i=!l(e,"value");++p,I((function(){var n=i?t.delete():t.update(e.value);n._hookCtx=e,n.onerror=Ft(r),n.onsuccess=Tt((function(){++y,x()}))}),r)}else e.onsuccess&&e.onsuccess(e.value)}),(function(){g=!0,x()}),_,s)}))},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==nn;if(!i&&In(t)&&(t.isPrimKey&&!Ot||!e))return this._write((function(n,t,r){var i=Kt(t),o=e?r.count(e):r.count();o.onerror=i,o.onsuccess=function(){var a=o.result;I((function(){var t=e?r.delete(e):r.clear();t.onerror=i,t.onsuccess=function(){return n(a)}}),(function(n){return t(n)}))}}));var o=i?2e3:1e4;return this._write((function(e,a,u,s){var c=0,l=n.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(o).raw(),f=[],h=function(){return l.each(i?function(n,t){f.push([t.primaryKey,t.value])}:function(n,t){f.push(t.primaryKey)}).then((function(){return i?f.sort((function(n,t){return Dn(n[0],t[0])})):f.sort(Dn),wn(u,s,f,i,r)})).then((function(){var n=f.length;return c+=n,f=[],n<o?c:h()}))};e(h())}))}}})),u(this,{Collection:kn,Table:yn,Transaction:_n,Version:ln,WhereClause:xn}),$.on("versionchange",(function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+$.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+$.name+"'. Closing db now to resume the delete request."),$.close()})),$.on("blocked",(function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+$.name+"') was blocked"):console.warn("Upgrade '"+$.name+"' blocked by other connection holding version "+n.oldVersion/10)})),y.forEach((function(n){n($)}))}function At(n){if("function"==typeof n)return new n;if(o(n))return[At(n[0])];if(n&&"object"==typeof n){var t={};return Ct(t,n),t}return n}function Ct(n,t){return i(t).forEach((function(e){var r=At(t[e]);n[e]=r})),n}function Tt(n){return $n((function(t){var e=t.target,r=e._hookCtx,i=r.value||e.result,o=r&&r.onsuccess;o&&o(i),n&&n(i)}),n)}function Kt(n){return $n((function(t){return Nt(t),n(t.target.error),!1}))}function Bt(n){return $n((function(t){n(t.target.result)}))}function Ft(n){return $n((function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),Nt(t),n(r),!1}))}function Nt(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function qt(n){var t=function(t){return n.next(t)},e=i(t),r=i((function(t){return n.throw(t)}));function i(n){return function(t){var i=n(t),a=i.value;return i.done?a:a&&"function"==typeof a.then?a.then(e,r):o(a)?Bn.all(a).then(e,r):e(a)}}return i(t)()}function Mt(n,t,e,r,i,o,a){this.name=n,this.keyPath=t,this.unique=e,this.multi=r,this.auto=i,this.compound=o,this.dotted=a;var u="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(e?"&":"")+(r?"*":"")+(i?"++":"")+u}function Rt(n,t,e,r){this.name=n,this.primKey=t||new Mt,this.indexes=e||[new Mt],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=x(e,(function(n){return[n.name,n]}))}function Lt(n){return 1===n.length?n[0]:n}function Ut(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}q(N,Et),f(Dt,Z),f(Dt,{delete:function(n){var t=new Dt(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new Dt(n).open().then((function(n){return n.close(),!0})).catch(Dt.NoSuchDatabaseError,(function(){return!1}))},getDatabaseNames:function(n){var t=Ut(Dt.dependencies.indexedDB);return t?new Bn((function(n,e){var r=t();r.onsuccess=function(t){n(m(t.target.result,0))},r.onerror=Kt(e)})).then(n):mt.dbnames.toCollection().primaryKeys(n)},defineClass:function(){return function(n){n&&u(this,n)}},applyStructure:Ct,ignoreTransaction:function(n){return An.trans?ft(An.transless,n):n()},vip:function(n){return rt((function(){return An.letThrough=!0,n()}))},async:function(n){return function(){try{var t=qt(n.apply(this,arguments));return t&&"function"==typeof t.then?t:Bn.resolve(t)}catch(n){return yt(n)}}},spawn:function(n,t,e){try{var r=qt(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:Bn.resolve(r)}catch(n){return yt(n)}},currentTransaction:{get:function(){return An.trans||null}},waitFor:function(n,t){var e=Bn.resolve("function"==typeof n?Dt.ignoreTransaction(n):n).timeout(t||6e4);return An.trans?An.trans.waitFor(e):e},Promise:Bn,debug:{get:function(){return N},set:function(n){q(n,"dexie"===n?function(){return!0}:Et)}},derive:v,extend:u,props:f,override:b,Events:gt,getByKeyPath:S,setByKeyPath:P,delByKeyPath:function(n,t){"string"==typeof t?P(n,t,void 0):"length"in t&&[].map.call(t,(function(t){P(n,t,void 0)}))},shallowClone:j,deepClone:A,getObjectDiff:C,asap:_,maxKey:_t,minKey:xt,addons:[],connections:St,MultiModifyError:Y.Modify,errnames:G,IndexSpec:Mt,TableSchema:Rt,dependencies:function(){try{return{indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch(n){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:bt,version:bt.split(".").map((function(n){return parseInt(n)})).reduce((function(n,t,e){return n+t/Math.pow(10,2*e)})),default:Dt,Dexie:Dt}),Bn.rejectionMapper=function(n,t){if(!n||n instanceof H||n instanceof TypeError||n instanceof SyntaxError||!n.name||!X[n.name])return n;var e=new X[n.name](t||n.message,n);return"stack"in n&&d(e,"stack",{get:function(){return this.inner.stack}}),e},(mt=new Dt("__dbnames")).version(1).stores({dbnames:"name"}),function(){var n="Dexie.DatabaseNames";try{localStorage,void 0!==a.document&&(JSON.parse(localStorage.getItem(n)||"[]").forEach((function(n){return mt.dbnames.put({name:n}).catch(nn)})),localStorage.removeItem(n))}catch(n){}}();var zt=Dt})),e.register("7DJp1",(function(t,r){n(t.exports,"Connector",(()=>a));var i=e("fYPnO"),o=e("6DLm7");class a{constructor(){}hasIndex(){return!1}storage(){return new i.LiaStorage}initSettings(n,t=!1){return o.Settings.init(n,t,this.setSettings)}setSettings(n){try{localStorage.setItem(o.Settings.PORT,JSON.stringify(n))}catch(n){console.warn("cannot write to localStorage")}}getSettings(){let n="";try{n=localStorage.getItem(o.Settings.PORT)}catch(n){console.warn("cannot write to localStorage")}let t=null;if("string"==typeof n){try{t=JSON.parse(n)}catch(n){console.warn("getSettings =>",n)}t||(t=o.Settings.data),window.innerWidth<=768&&(t.table_of_contents=!1)}return t}open(n,t,e){}load(n){}store(n){}update(n,t){}slide(n){}getIndex(){}deleteFromIndex(n){}storeToIndex(n){}restoreFromIndex(n,t){}reset(n,t){this.initSettings(null,!0)}async getFromIndex(n){return null}}})),e.register("fYPnO",(function(t,e){n(t.exports,"LiaStorage",(()=>r));class r{constructor(){}getItems(n=[]){"string"==typeof n&&(n=[n]);let t={};for(let e=0;e<n.length;e++){let r=localStorage.getItem(n[e]);t[n[e]]=r?JSON.parse(r):r}return t}setItems(n){this._setLocal(n)}_setLocal(n){if("object"==typeof n)for(const[t,e]of Object.entries(n))localStorage.setItem(t,JSON.stringify(e))}}}));