diff --git a/README.md b/README.md index df2f7806..0599f49a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# polymer-cdn v1.7.0 +# polymer-cdn v1.7.0.2 **A mirror of Polymer's components so that they can be used directly from CDN** ![Polymer CDN is powered by MaxCDN](http://i.imgur.com/9obTXpk.png) @@ -58,9 +58,9 @@ These dependencies are themselves also listed at the top-level, so you can work tree for a library by carefully examining this diagram. ```sh -polymer-cdn#1.7.0 +polymer-cdn#1.7.0.2 ├─┬ app-elements#0.10.0 -│ ├─┬ app-layout#0.10.4 +│ ├─┬ app-layout#0.10.5 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-media-query#1.0.8 @@ -82,7 +82,7 @@ polymer-cdn#1.7.0 │ │ │ └─┬ promise-polyfill#1.0.1 │ │ │ └── polymer#1.7.0 │ │ ├── polymer#1.7.0 -│ │ ├── pouchdb#6.0.6 +│ │ ├── pouchdb#6.0.7 │ │ ├── pouchdb-find#0.10.3 │ │ └─┬ promise-polyfill#1.0.1 │ │ └── polymer#1.7.0 @@ -97,7 +97,7 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-form-element-behavior#1.0.6 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -135,7 +135,7 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-form-element-behavior#1.0.6 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -155,7 +155,7 @@ polymer-cdn#1.7.0 │ ├─┬ gold-email-input#1.0.7 │ │ ├─┬ iron-form-element-behavior#1.0.6 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -191,7 +191,7 @@ polymer-cdn#1.7.0 │ └─┬ gold-zip-input#1.0.6 │ ├─┬ iron-form-element-behavior#1.0.6 │ │ └── polymer#1.7.0 -│ ├─┬ iron-icon#1.0.11 +│ ├─┬ iron-icon#1.0.12 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-meta#1.1.2 @@ -210,7 +210,7 @@ polymer-cdn#1.7.0 │ └── polymer#1.7.0 ├─┬ google-web-components#1.1.1 │ ├─┬ firebase-element#1.0.16 -│ │ ├── firebase#3.4.1 incompatible with ^2.3.1 (2.4.2 available, latest is 3.4.1) +│ │ ├── firebase#3.5.2 incompatible with ^2.3.1 (2.4.2 available, latest is 3.5.2) │ │ └── polymer#1.7.0 │ ├─┬ google-analytics#1.2.3 │ │ ├── ga-api-utils#0.2.0 (latest is 0.6.0) @@ -233,13 +233,13 @@ polymer-cdn#1.7.0 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 │ │ │ ├── iron-flex-layout#1.3.1 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 @@ -292,7 +292,7 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ ├─┬ google-map#1.1.13 +│ ├─┬ google-map#1.1.14 │ │ ├── google-apis#1.1.7 │ │ ├─┬ iron-resizable-behavior#1.0.5 │ │ │ └── polymer#1.7.0 @@ -313,13 +313,13 @@ polymer-cdn#1.7.0 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├── iron-flex-layout#1.3.1 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 @@ -361,13 +361,13 @@ polymer-cdn#1.7.0 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 │ │ │ ├── iron-flex-layout#1.3.1 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 @@ -383,9 +383,9 @@ polymer-cdn#1.7.0 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ └─┬ polymerfire#0.9.7 +│ └─┬ polymerfire#0.10.2 incompatible with ~0.9.0 (0.9.7 available, latest is 0.10.2) │ ├── app-storage#0.9.7 -│ ├── firebase#3.4.1 +│ ├── firebase#3.5.2 │ └── polymer#1.7.0 ├─┬ iron-elements#1.0.10 │ ├─┬ iron-a11y-announcer#1.0.5 @@ -431,7 +431,7 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ iron-component-page#1.1.7 -│ │ ├── hydrolysis#1.24.1 (latest is 2.0.0-alpha.10) +│ │ ├── hydrolysis#1.24.1 (latest is 2.0.0-alpha.17) │ │ ├─┬ iron-ajax#1.4.3 │ │ │ ├── polymer#1.7.0 │ │ │ └─┬ promise-polyfill#1.0.1 @@ -440,7 +440,7 @@ polymer-cdn#1.7.0 │ │ │ ├─┬ marked-element#1.2.0 │ │ │ │ ├── marked#0.3.6 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ paper-button#1.0.13 +│ │ │ ├─┬ paper-button#1.0.14 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ paper-behaviors#1.0.12 @@ -480,13 +480,13 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-icons#1.1.3 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 @@ -512,13 +512,13 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-icons#1.1.3 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 @@ -529,7 +529,7 @@ polymer-cdn#1.7.0 │ │ │ ├── marked#0.3.6 │ │ │ └── polymer#1.7.0 │ │ ├─┬ paper-icon-button#1.1.3 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 @@ -566,12 +566,12 @@ polymer-cdn#1.7.0 │ │ ├── polymer#1.7.0 │ │ └── prism-element#1.1.1 │ ├── iron-doc-viewer#1.0.15 -│ ├─┬ iron-dropdown#1.5.2 +│ ├─┬ iron-dropdown#1.5.3 │ │ ├─┬ iron-behaviors#1.0.17 │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 -│ │ ├── iron-overlay-behavior#1.9.0 +│ │ ├── iron-overlay-behavior#1.10.1 │ │ ├─┬ iron-resizable-behavior#1.0.5 │ │ │ └── polymer#1.7.0 │ │ ├─┬ neon-animation#1.2.4 @@ -596,20 +596,20 @@ polymer-cdn#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ iron-form-element-behavior#1.0.6 │ │ └── polymer#1.7.0 -│ ├─┬ iron-icon#1.0.11 +│ ├─┬ iron-icon#1.0.12 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-meta#1.1.2 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ iron-icons#1.1.3 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 @@ -618,7 +618,7 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-meta#1.1.2 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ ├─┬ iron-iconset-svg#1.0.11 +│ ├─┬ iron-iconset-svg#1.1.0 │ │ ├─┬ iron-meta#1.1.2 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 @@ -657,7 +657,7 @@ polymer-cdn#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ iron-meta#1.1.2 │ │ └── polymer#1.7.0 -│ ├─┬ iron-overlay-behavior#1.9.0 +│ ├─┬ iron-overlay-behavior#1.10.1 │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-fit-behavior#1.2.5 @@ -716,7 +716,7 @@ polymer-cdn#1.7.0 │ ├─┬ paper-badge#1.1.4 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -747,7 +747,7 @@ polymer-cdn#1.7.0 │ │ │ ├── iron-a11y-keys-behavior#1.1.9 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ ├─┬ paper-button#1.0.13 +│ ├─┬ paper-button#1.0.14 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ paper-behaviors#1.0.12 @@ -823,7 +823,7 @@ polymer-cdn#1.7.0 │ │ ├── paper-styles#1.1.5 │ │ └── polymer#1.7.0 │ ├─┬ paper-dialog#1.1.0 -│ │ ├── iron-overlay-behavior#1.9.0 +│ │ ├── iron-overlay-behavior#1.10.1 │ │ ├─┬ neon-animation#1.2.4 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 @@ -834,7 +834,7 @@ polymer-cdn#1.7.0 │ │ │ ├── polymer#1.7.0 │ │ │ └── web-animations-js#2.2.2 │ │ ├─┬ paper-dialog-behavior#1.2.7 -│ │ │ ├─┬ iron-overlay-behavior#1.9.0 +│ │ │ ├─┬ iron-overlay-behavior#1.10.1 │ │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-fit-behavior#1.2.5 @@ -851,7 +851,7 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ paper-dialog-behavior#1.2.7 -│ │ ├─┬ iron-overlay-behavior#1.9.0 +│ │ ├─┬ iron-overlay-behavior#1.10.1 │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-fit-behavior#1.2.5 @@ -865,7 +865,7 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ ├─┬ paper-dialog-behavior#1.2.7 -│ │ │ ├─┬ iron-overlay-behavior#1.9.0 +│ │ │ ├─┬ iron-overlay-behavior#1.10.1 │ │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-fit-behavior#1.2.5 @@ -894,13 +894,13 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-form-element-behavior#1.0.6 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 @@ -965,12 +965,12 @@ polymer-cdn#1.7.0 │ │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ └── polymer#1.7.0 -│ │ │ ├─┬ iron-dropdown#1.5.2 +│ │ │ ├─┬ iron-dropdown#1.5.3 │ │ │ │ ├─┬ iron-behaviors#1.0.17 │ │ │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ │ └── polymer#1.7.0 -│ │ │ │ ├── iron-overlay-behavior#1.9.0 +│ │ │ │ ├── iron-overlay-behavior#1.10.1 │ │ │ │ ├─┬ iron-resizable-behavior#1.0.5 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ neon-animation#1.2.4 @@ -1011,7 +1011,7 @@ polymer-cdn#1.7.0 │ ├─┬ paper-fab#1.2.1 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -1046,7 +1046,7 @@ polymer-cdn#1.7.0 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 │ ├─┬ paper-icon-button#1.1.3 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 @@ -1222,7 +1222,7 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-resizable-behavior#1.0.5 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ ├─┬ paper-slider#1.0.11 +│ ├─┬ paper-slider#1.0.12 │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-behaviors#1.0.17 @@ -1282,20 +1282,20 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 │ │ └── polymer#1.7.0 -│ ├─┬ paper-tabs#1.6.2 +│ ├─┬ paper-tabs#1.7.0 │ │ ├─┬ iron-behaviors#1.0.17 │ │ │ ├─┬ iron-a11y-keys-behavior#1.1.9 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-icon#1.0.11 +│ │ ├─┬ iron-icon#1.0.12 │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ └── polymer#1.7.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 -│ │ ├─┬ iron-iconset-svg#1.0.11 +│ │ ├─┬ iron-iconset-svg#1.1.0 │ │ │ ├─┬ iron-meta#1.1.2 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 @@ -1320,7 +1320,7 @@ polymer-cdn#1.7.0 │ │ │ │ └── polymer#1.7.0 │ │ │ └── polymer#1.7.0 │ │ ├─┬ paper-icon-button#1.1.3 -│ │ │ ├─┬ iron-icon#1.0.11 +│ │ │ ├─┬ iron-icon#1.0.12 │ │ │ │ ├─┬ iron-flex-layout#1.3.1 │ │ │ │ │ └── polymer#1.7.0 │ │ │ │ ├─┬ iron-meta#1.1.2 @@ -1359,7 +1359,7 @@ polymer-cdn#1.7.0 │ │ ├─┬ iron-a11y-announcer#1.0.5 │ │ │ └── polymer#1.7.0 │ │ ├── iron-fit-behavior#1.2.5 -│ │ ├── iron-overlay-behavior#1.9.0 +│ │ ├── iron-overlay-behavior#1.10.1 │ │ └── polymer#1.7.0 │ ├─┬ paper-toggle-button#1.2.1 │ │ ├─┬ iron-checked-element-behavior#1.0.5 @@ -1423,7 +1423,8 @@ polymer-cdn#1.7.0 │ │ └── polymer#1.7.0 │ └─┬ platinum-sw#1.3.0 │ ├── polymer#1.7.0 -│ └── sw-toolbox#3.3.0 -└─┬ polymer#1.7.0 - └── webcomponentsjs#0.7.22 -``` \ No newline at end of file +│ └── sw-toolbox#3.4.0 +├─┬ polymer#1.7.0 +│ └── webcomponentsjs#0.7.22 +└── polymerfire#0.10.2 +``` diff --git a/bower.json b/bower.json index 789de6a7..2a771339 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "polymer-cdn", - "version": "1.7.0", + "version": "1.7.0.2", "main": "polymer.js", "homepage": "https://github.com/Download/polymer-cdn", "authors": [ @@ -29,6 +29,11 @@ "platinum-elements": "polymerelements/platinum-elements#latest", "app-elements": "polymerelements/app-elements#latest", "google-web-components": "GoogleWebComponents/google-web-components#latest", - "molecules": "polymerelements/molecules#latest" + "molecules": "polymerelements/molecules#latest", + "polymerfire": "firebase/polymerfire#0.10.2" + }, + "resolutions": { + "polymerfire": "0.10.2", + "firebase": ">= 3.5.1 < 4.0" } } diff --git a/lib/app-layout/.bower.json b/lib/app-layout/.bower.json index c071851f..58bac023 100644 --- a/lib/app-layout/.bower.json +++ b/lib/app-layout/.bower.json @@ -1,6 +1,6 @@ { "name": "app-layout", - "version": "0.10.4", + "version": "0.10.5", "description": "A set of layout elements for your app", "authors": [ "The Polymer Authors" @@ -42,11 +42,11 @@ }, "ignore": [], "private": true, - "_release": "0.10.4", + "_release": "0.10.5", "_resolution": { "type": "version", - "tag": "v0.10.4", - "commit": "1e5a379af167b566c8333297bc729927d1466ca7" + "tag": "v0.10.5", + "commit": "df716eeaca72fb44608dc7032ec3c601af6e405b" }, "_source": "git://github.com/PolymerElements/app-layout.git", "_target": "^0.10.0", diff --git a/lib/app-layout/README.md b/lib/app-layout/README.md index 79df397b..49991f46 100644 --- a/lib/app-layout/README.md +++ b/lib/app-layout/README.md @@ -1,8 +1,72 @@ -# App Layout [![Build Status](https://travis-ci.org/PolymerElements/app-layout.svg?branch=master)](https://travis-ci.org/PolymerElements/app-layout) - +# App Layout [![Build Status](https://travis-ci.org/PolymerElements/app-layout.svg?branch=master)](https://travis-ci.org/PolymerElements/app-layout) [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://beta.webcomponents.org/element/PolymerElements/app-layout) [](https://polymerelements.github.io/app-layout/) + +```html + + + +
My app
+ + + + +
+
+ + +``` + https://polymerelements.github.io/app-layout/ For additional documentation, please check out [Responsive app layout](https://www.polymer-project.org/1.0/toolbox/app-layout). diff --git a/lib/app-layout/app-header/app-header.html b/lib/app-layout/app-header/app-header.html index f5243444..7c58a8a8 100644 --- a/lib/app-layout/app-header/app-header.html +++ b/lib/app-layout/app-header/app-header.html @@ -220,7 +220,8 @@

App name

@demo app-header/demo/music.html Reveals Demo @demo app-header/demo/no-effects.html Condenses and Reveals Demo @demo app-header/demo/notes.html Fixed with Dynamic Shadow Demo -@demo app-header/demo/custom-sticky-element.html Custom Sticky Element Demo +@demo app-header/demo/custom-sticky-element-1.html Custom Sticky Element Demo 1 +@demo app-header/demo/custom-sticky-element-2.html Custom Sticky Element Demo 2 --> @@ -645,9 +646,9 @@

App name

*/ _transformHeader: function(y) { this.translate3d(0, (-y) + 'px', 0); - if (this._stickyEl && this.condenses && y >= this._stickyElTop) { - this.translate3d(0, (Math.min(y, this._dHeight) - this._stickyElTop) + 'px', 0, - this._stickyEl); + if (this._stickyEl) { + this.translate3d(0, this.condenses && y >= this._stickyElTop ? + (Math.min(y, this._dHeight) - this._stickyElTop) + 'px' : 0, 0, this._stickyEl); } }, diff --git a/lib/app-layout/app-scroll-effects/app-scroll-effects-behavior.html b/lib/app-layout/app-scroll-effects/app-scroll-effects-behavior.html index 25a8984c..bc6a2b88 100644 --- a/lib/app-layout/app-scroll-effects/app-scroll-effects-behavior.html +++ b/lib/app-layout/app-scroll-effects/app-scroll-effects-behavior.html @@ -277,7 +277,7 @@ if ((effectDef = Polymer.AppLayout._scrollEffects[effectName])) { this._effects.push(this._boundEffect(effectDef, effectsConfig[effectName])); } else { - this._warn(this._logf('_effectsChanged', this._getUndefinedMsg(effectName))); + console.warn(this._getUndefinedMsg(effectName)); } } }, this); @@ -379,7 +379,7 @@ * @param {string} id The id for the node. */ _getDOMRef: function(id) { - this._warn(this._logf('_getDOMRef', '`'+ id +'` is undefined')); + console.warn('_getDOMRef', '`'+ id +'` is undefined'); }, _getUndefinedMsg: function(effectName) { diff --git a/lib/app-layout/app-scroll-effects/effects/resize-snapped-title.html b/lib/app-layout/app-scroll-effects/effects/resize-snapped-title.html index cbe0adc8..6a12e2ad 100644 --- a/lib/app-layout/app-scroll-effects/effects/resize-snapped-title.html +++ b/lib/app-layout/app-scroll-effects/effects/resize-snapped-title.html @@ -26,11 +26,11 @@ var fx = {}; if (!condensedTitle) { - this._warn(this._logf('effects[resize-snapped-title]', 'undefined `condensed-title`')); + console.warn('Scroll effect `resize-snapped-title`: undefined `condensed-title`'); return false; } if (!title) { - this._warn(this._logf('effects[resize-snapped-title]', 'undefined `main-title`')); + console.warn('Scroll effect `resize-snapped-title`: undefined `main-title`'); return false; } diff --git a/lib/app-layout/app-scroll-effects/effects/resize-title.html b/lib/app-layout/app-scroll-effects/effects/resize-title.html index f758801d..b25e93e2 100644 --- a/lib/app-layout/app-scroll-effects/effects/resize-title.html +++ b/lib/app-layout/app-scroll-effects/effects/resize-title.html @@ -29,11 +29,11 @@ var condensedTitle = this._getDOMRef('condensedTitle'); if (!condensedTitle) { - this._warn(this._logf('effects[resize-title]', 'undefined `condensed-title`')); + console.warn('Scroll effect `resize-title`: undefined `condensed-title`'); return false; } if (!title) { - this._warn(this._logf('effects[resize-title]', 'undefined `main-title`')); + console.warn('Scroll effect `resize-title`: undefined `main-title`'); return false; } diff --git a/lib/app-layout/bower.json b/lib/app-layout/bower.json index cda2346e..3fb8d4d7 100644 --- a/lib/app-layout/bower.json +++ b/lib/app-layout/bower.json @@ -1,6 +1,6 @@ { "name": "app-layout", - "version": "0.10.4", + "version": "0.10.5", "description": "A set of layout elements for your app", "authors": [ "The Polymer Authors" diff --git a/lib/firebase/.bower.json b/lib/firebase/.bower.json index 9cf31772..b95e6056 100644 --- a/lib/firebase/.bower.json +++ b/lib/firebase/.bower.json @@ -1,6 +1,6 @@ { "name": "firebase", - "version": "3.4.1", + "version": "3.5.2", "homepage": "https://firebase.google.com", "authors": [ "Firebase " @@ -23,13 +23,13 @@ "test", "tests" ], - "_release": "3.4.1", + "_release": "3.5.2", "_resolution": { "type": "version", - "tag": "v3.4.1", - "commit": "82b24fbe04b115ac21348302ed323fbb19644056" + "tag": "v3.5.2", + "commit": "cf5d9321b7a56e20314414f4967737f569c8ec63" }, "_source": "https://github.com/firebase/firebase-bower.git", - "_target": "^3.0", + "_target": ">= 3.5.1 < 4.0", "_originalSource": "firebase" } \ No newline at end of file diff --git a/lib/firebase/bower.json b/lib/firebase/bower.json index 00f37ade..ebe7a0d0 100644 --- a/lib/firebase/bower.json +++ b/lib/firebase/bower.json @@ -1,6 +1,6 @@ { "name": "firebase", - "version": "3.4.1", + "version": "3.5.2", "homepage": "https://firebase.google.com", "authors": [ "Firebase " diff --git a/lib/firebase/firebase-app-externs.js b/lib/firebase/firebase-app-externs.js new file mode 100644 index 00000000..f5272410 --- /dev/null +++ b/lib/firebase/firebase-app-externs.js @@ -0,0 +1,247 @@ +/** + * @fileoverview Firebase namespace and Firebase App API. + * Version: 3.5.2 + * + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @externs + */ + +/** + * firebase is a global namespace from which all the Firebase + * services are accessed. + * + * @namespace + */ +var firebase = {}; + +/** + * Create (and intialize) a FirebaseApp. + * + * @param {!Object} options Options to configure the services use in the App. + * @param {string=} name The optional name of the app to initialize ('[DEFAULT]' + * if none) + * @return {!firebase.app.App} + */ +firebase.initializeApp = function(options, name) {}; + +/** + * Retrieve an instance of a FirebaseApp. + * + * With no arguments, this returns the default App. With a single + * string argument, it returns the named App. + * + * This function throws an exception if the app you are trying to access + * does not exist. + * + * Usage: firebase.app() + * + * @namespace + * @param {string} name The optional name of the app to return ('[DEFAULT]' if + * none) + * @return {!firebase.app.App} + */ +firebase.app = function(name) {}; + +/** + * A (read-only) array of all the initialized Apps. + * @type {!Array} + */ +firebase.apps; + +/** + * The current SDK version ('3.5.2'). + * @type {string} + */ +firebase.SDK_VERSION; + +/** + * A Firebase App holds the initialization information for a collection of + * services. + * + * DO NOT call this constuctor directly (use + * firebase.initializeApp() to create an App). + * + * @interface + */ +firebase.app.App = function() {}; + +/** + * The (read-only) name (identifier) for this App. '[DEFAULT]' is the name of + * the default App. + * @type {string} + */ +firebase.app.App.prototype.name; + +/** + * The (read-only) configuration options (the original parameters given + * in firebase.initializeApp()). + * @type {!Object} + */ +firebase.app.App.prototype.options; + +/** + * Make the given App unusable and free the resources of all associated + * services. + * + * @return {!firebase.Promise} + */ +firebase.app.App.prototype.delete = function() {}; + +/** + * A Thenable is the standard interface returned by a Promise. + * + * @template T + * @interface + */ +firebase.Thenable = function() {}; + +/** + * Assign callback functions called when the Thenable value either + * resolves, or is rejected. + * + * @param {(function(T): *)=} onResolve Called when the Thenable resolves. + * @param {(function(!Error): *)=} onReject Called when the Thenable is rejected + * (with an error). + * @return {!firebase.Thenable<*>} + */ +firebase.Thenable.prototype.then = function(onResolve, onReject) {}; + +/** + * Assign a callback when the Thenable rejects. + * + * @param {(function(!Error): *)=} onReject Called when the Thenable is rejected + * (with an error). + * @return {!firebase.Thenable<*>} + */ +firebase.Thenable.prototype.catch = function(onReject) {}; + +/** + * A Promise represents an eventual (asynchronous) value. A Promise should + * (eventually) either resolve or reject. When it does, it will call all the + * callback functions that have been assigned via the .then() or + * .catch() methods. + * + * firebase.Promise is the same as the native Promise + * implementation when available in the current environment, otherwise it is a + * compatible implementation of the Promise/A+ spec. + * + * @template T + * @constructor + * @implements {firebase.Thenable} + * @param {function((function(T): void)=, + * (function(!Error): void)=)} resolver + */ +firebase.Promise = function(resolver) {}; + +/** + * Assign callback functions called when the Promise either resolves, or is + * rejected. + * + * @param {(function(T): *)=} onResolve Called when the Promise resolves. + * @param {(function(!Error): *)=} onReject Called when the Promise is rejected + * (with an error). + * @return {!firebase.Promise<*>} + */ +firebase.Promise.prototype.then = function(onResolve, onReject) {}; + +/** + * Assign a callback when the Promise rejects. + * + * @param {(function(!Error): *)=} onReject Called when the Promise is rejected + * (with an error). + */ +firebase.Promise.prototype.catch = function(onReject) {}; + +/** + * Return a resolved Promise. + * + * @template T + * @param {T=} value The value to be returned by the Promise. + * @return {!firebase.Promise} + */ +firebase.Promise.resolve = function(value) {}; + +/** + * Return (an immediately) rejected Promise. + * + * @param {!Error} error The reason for the Promise being rejected. + * @return {!firebase.Promise<*>} + */ +firebase.Promise.reject = function(error) {}; + +/** + * Convert an array of Promises, to a single array of values. + * Promise.all() resolves only after all the Promises in the array + * have resolved. + * + * Promise.all() rejects when any of the promises in the Array have + * rejected. + * + * @param {!Array>} values + * @return {!firebase.Promise>} + */ +firebase.Promise.all = function(values) {}; + + + +/** + * + * FirebaseError is a subclass of the standard JavaScript Error object. In + * addition to a message string, it contains a string-valued code. + * + * @interface + */ +firebase.FirebaseError; + +/** + * Error codes are strings using the following format: + * + * "service/string-code" + * + * While the message for a given error can change, the code will remain the same + * between backward-compatible versions of the Firebase SDK. + * + * @type {string} + */ +firebase.FirebaseError.prototype.code; + +/** + * An explanatory message for the error that just occurred. + * + * This message is designed to be helpful to you, the developer. It + * is not intended that you display it to the end user of your application + * (as it will generally not convey meaningful information to them). + * + * @type {string} + */ +firebase.FirebaseError.prototype.message; + +/** + * The name of the class of Errors. + * @type {string} + */ +firebase.FirebaseError.prototype.name; + +/** + * A string value containing the execution backtrace when the error originally + * occurred. + * + * This information can be useful to you and can be sent to Firebase support to + * help explain the cause of an error. + * + * @type {string} + */ +firebase.FirebaseError.prototype.stack; diff --git a/lib/firebase/firebase-app.js b/lib/firebase/firebase-app.js new file mode 100644 index 00000000..c1bf3dc0 --- /dev/null +++ b/lib/firebase/firebase-app.js @@ -0,0 +1,36 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +var firebase = null; (function() { for(var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},h="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ba=function(){ba=function(){};h.Symbol||(h.Symbol=ca)},da=0,ca=function(a){return"jscomp_symbol_"+(a||"")+da++},m=function(){ba();var a=h.Symbol.iterator;a||(a=h.Symbol.iterator= +h.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});m=function(){}},ea=function(a){var b=0;return fa(function(){return be?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;g=C.Reflect;if("object"===typeof g&&"function"===typeof g.decorate)f=g.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3"}),c=this.ka+": "+c+" ("+a+").",c=new V(a,c),d;for(d in b)b.hasOwnProperty(d)&&"_"!==d.slice(-1)&&(c[d]=b[d]);return c};var W=S,X=function(a,b,c){var d=this;this.P=c;this.S=!1;this.l={};this.I=b;this.fa=R(void 0,a);Object.keys(c.INTERNAL.factories).forEach(function(a){var b=c.INTERNAL.useAsService(d,a);null!==b&&(b=d.da.bind(d,b),d[a]=b)})};X.prototype.delete=function(){var a=this;return(new W(function(b){Y(a);b()})).then(function(){a.P.INTERNAL.removeApp(a.I);return W.all(Object.keys(a.l).map(function(b){return a.l[b].INTERNAL.delete()}))}).then(function(){a.S=!0;a.l={}})}; +X.prototype.da=function(a){Y(this);void 0===this.l[a]&&(this.l[a]=this.P.INTERNAL.factories[a](this,this.ca.bind(this)));return this.l[a]};X.prototype.ca=function(a){R(this,a)};var Y=function(a){a.S&&Z(Ra("deleted",{name:a.I}))};h.Object.defineProperties(X.prototype,{name:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.I}},options:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.fa}}});X.prototype.name&&X.prototype.options||X.prototype.delete||console.log("dc"); +function Sa(){function a(a){a=a||"[DEFAULT]";var b=d[a];void 0===b&&Z("noApp",{name:a});return b}function b(a,b){Object.keys(e).forEach(function(d){d=c(a,d);if(null!==d&&f[d])f[d](b,a)})}function c(a,b){if("serverAuth"===b)return null;var c=b;a=a.options;"auth"===b&&(a.serviceAccount||a.credential)&&(c="serverAuth","serverAuth"in e||Z("serverAuthMissing"));return c}var d={},e={},f={},g={__esModule:!0,initializeApp:function(a,c){void 0===c?c="[DEFAULT]":"string"===typeof c&&""!==c||Z("bad-app-name", +{name:c+""});void 0!==d[c]&&Z("dupApp",{name:c});a=new X(a,c,g);d[c]=a;b(a,"create");void 0!=a.INTERNAL&&void 0!=a.INTERNAL.getToken||R(a,{INTERNAL:{getToken:function(){return W.resolve(null)},addAuthTokenListener:function(){},removeAuthTokenListener:function(){}}});return a},app:a,apps:null,Promise:W,SDK_VERSION:"0.0.0",INTERNAL:{registerService:function(b,c,d,v){e[b]&&Z("dupService",{name:b});e[b]=c;v&&(f[b]=v);c=function(c){void 0===c&&(c=a());return c[b]()};void 0!==d&&R(c,d);return g[b]=c},createFirebaseNamespace:Sa, +extendNamespace:function(a){R(g,a)},createSubscribe:La,ErrorFactory:Qa,removeApp:function(a){b(d[a],"delete");delete d[a]},factories:e,useAsService:c,Promise:Q,deepExtend:R}};g["default"]=g;Object.defineProperty(g,"apps",{get:function(){return Object.keys(d).map(function(a){return d[a]})}});a.App=X;return g}function Z(a,b){throw Error(Ra(a,b));} +function Ra(a,b){b=b||{};b={noApp:"No Firebase App '"+b.name+"' has been created - call Firebase App.initializeApp().","bad-app-name":"Illegal App name: '"+b.name+"'.",dupApp:"Firebase App named '"+b.name+"' already exists.",deleted:"Firebase App named '"+b.name+"' already deleted.",dupService:"Firebase Service named '"+b.name+"' already registered.",serverAuthMissing:"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain."}[a]; +return void 0===b?"Application Error: ("+a+")":b};"undefined"!==typeof firebase&&(firebase=Sa()); })(); +firebase.SDK_VERSION = "3.5.2"; diff --git a/lib/firebase/firebase-auth-externs.js b/lib/firebase/firebase-auth-externs.js new file mode 100644 index 00000000..d6973d1c --- /dev/null +++ b/lib/firebase/firebase-auth-externs.js @@ -0,0 +1,1019 @@ +/** + * @fileoverview Firebase Auth API. + * Version: 3.5.2 + * + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @externs + */ + +/** + * Gets the Auth object for the default App or a given App. + * + * Usage: + * + * firebase.auth() + * firebase.auth(app) + * + * @namespace + * @param {!firebase.app.App=} app + * @return {!firebase.auth.Auth} + */ +firebase.auth = function(app) {}; + +/** + * Interface that represents the credentials returned by an auth provider. + * Implementations specify the details about each auth provider's credential + * requirements. + * + * @interface + */ +firebase.auth.AuthCredential = function() {}; + +/** + * The authentication provider ID for the credential. + * For example, 'facebook.com', or 'google.com'. + * + * @type {string} + */ +firebase.auth.AuthCredential.prototype.provider; + + +/** + * Gets the Firebase Auth Service object for an App. + * + * Usage: + * + * app.auth() + * + * @return {!firebase.auth.Auth} + */ +firebase.app.App.prototype.auth = function() {}; + + +/** + * User profile information, visible only to the Firebase project's + * apps. + * + * @interface + */ +firebase.UserInfo = function() {}; + +/** + * The user's unique ID. + * + * @type {string} + */ +firebase.UserInfo.prototype.uid; + +/** + * The authentication provider ID for the current user. + * For example, 'facebook.com', or 'google.com'. + * + * @type {string} + */ +firebase.UserInfo.prototype.providerId; + +/** + * The user's email address (if available). + * @type {?string} + */ +firebase.UserInfo.prototype.email; + +/** + * The user's display name (if available). + * + * @type {?string} + */ +firebase.UserInfo.prototype.displayName; + +/** + * The URL of the user's profile picture (if available). + * + * @type {?string} + */ +firebase.UserInfo.prototype.photoURL; + +/** + * A user account. + * + * @interface + * @extends {firebase.UserInfo} + */ +firebase.User; + +/** @type {boolean} */ +firebase.User.prototype.isAnonymous; + +/** + * True if the user's email address has been verified. + * @type {boolean} + */ +firebase.User.prototype.emailVerified; + +/** + * Additional provider-specific information about the user. + * @type {!Array} + */ +firebase.User.prototype.providerData; + +/** + * A refresh token for the user account. Use only for advanced scenarios that + * require explicitly refreshing tokens. + * @type {string} + */ +firebase.User.prototype.refreshToken; + +/** + * Returns a JWT token used to identify the user to a Firebase service. + * + * Returns the current token if it has not expired, otherwise this will + * refresh the token and return a new one. + * + * @param {boolean=} opt_forceRefresh Force refresh regardless of token + * expiration. + * @return {!firebase.Promise} + */ +firebase.User.prototype.getToken = function(opt_forceRefresh) {}; + +/** + * Refreshes the current user, if signed in. + * + * @return {!firebase.Promise} + */ +firebase.User.prototype.reload = function() {}; + +/** + * Sends a verification email to a user. + * + * The verification process is completed by calling + * {@link firebase.auth.Auth#applyActionCode} + * + * @return {!firebase.Promise} + */ +firebase.User.prototype.sendEmailVerification = function() {}; + + +/** + * Links the user account with the given credentials. + * + *

Error Codes

+ *
+ *
auth/provider-already-linked
+ *
Thrown if the provider has already been linked to the user. This error is + * thrown even if this is not the same provider's account that is currently + * linked to the user.
+ *
auth/invalid-credential
+ *
Thrown if the provider's credential is not valid. This can happen if it + * has already expired when calling link, or if it used invalid token(s). + * Please refer to the Guide, under the provider's section you tried to + * link, and make sure you pass in the correct parameter to the credential + * method.
+ *
auth/credential-already-in-use
+ *
Thrown if the account corresponding to the credential already exists + * among your users, or is already linked to a Firebase User. + * For example, this error could be thrown if you are upgrading an anonymous + * user to a Google user by linking a Google credential to it and the Google + * credential used is already associated with an existing Firebase Google + * user. + * An error.email and error.credential + * ({@link firebase.auth.AuthCredential}) fields are also provided. You can + * recover from this error by signing in with that credential directly via + * {@link firebase.auth.Auth#signInWithCredential}.
+ *
auth/email-already-in-use
+ *
Thrown if the email corresponding to the credential already exists + * among your users. When thrown while linking a credential to an existing + * user, an error.email and error.credential + * ({@link firebase.auth.AuthCredential}) fields are also provided. + * You have to link the credential to the existing user with that email if + * you wish to continue signing in with that credential. To do so, call + * {@link firebase.auth.Auth#fetchProvidersForEmail}, sign in to + * error.email via one of the providers returned and then + * {@link firebase.User#link} the original credential to that newly signed + * in user.
+ *
auth/operation-not-allowed
+ *
Thrown if you have not enabled the provider in the Firebase Console. Go + * to the Firebase Console for your project, in the Auth section and the + * Sign in Method tab and configure the provider.
+ *
auth/invalid-email
+ *
Thrown if the email used in a + * {@link firebase.auth.EmailAuthProvider#credential} is invalid.
+ *
auth/wrong-password
+ *
Thrown if the password used in a + * {@link firebase.auth.EmailAuthProvider#credential} is not correct or when + * the user associated with the email does not have a password.
+ *
+ * + * @param {!firebase.auth.AuthCredential} credential The auth credential. + * @return {!firebase.Promise} + */ +firebase.User.prototype.link = function(credential) {}; + + +/** + * Unlinks a provider from a user account. + * + *

Error Codes

+ *
+ *
auth/no-such-provider
+ *
Thrown if the user does not have this provider linked or when the + * provider ID given does not exist.
+ * + * + * @param {string} providerId + * @return {!firebase.Promise} + */ +firebase.User.prototype.unlink = function(providerId) {}; + + +/** + * Re-authenticates a user using a fresh credential. Use before operations + * such as {@link firebase.User#updatePassword} that require tokens from recent + * sign-in attempts. + * + *

Error Codes

+ *
+ *
auth/user-mismatch
+ *
Thrown if the credential given does not correspond to the user.
+ *
auth/user-not-found
+ *
Thrown if the credential given does not correspond to any existing user. + *
+ *
auth/invalid-credential
+ *
Thrown if the provider's credential is not valid. This can happen if it + * has already expired when calling link, or if it used invalid token(s). + * Please refer to the Guide, under the provider's section you tried to + * link, and make sure you pass in the correct parameter to the credential + * method.
+ *
auth/invalid-email
+ *
Thrown if the email used in a + * {@link firebase.auth.EmailAuthProvider#credential} is invalid.
+ *
auth/wrong-password
+ *
Thrown if the password used in a + * {@link firebase.auth.EmailAuthProvider#credential} is not correct or when + * the user associated with the email does not have a password.
+ *
+ * + * @param {!firebase.auth.AuthCredential} credential + * @return {!firebase.Promise} + */ +firebase.User.prototype.reauthenticate = function(credential) {}; + + +/** + * Updates the user's email address. + * + * An email will be sent to the original email address (if it was set) that + * allows to revoke the email address change, in order to protect them from + * account hijacking. + * + * Important: this is a security sensitive operation that requires the + * user to have recently signed in. If this requirement isn't met, ask the user + * to authenticate again and then call {@link firebase.User#reauthenticate}. + * + *

Error Codes

+ *
+ *
auth/invalid-email
+ *
Thrown if the email used is invalid.
+ *
auth/email-already-in-use
+ *
Thrown if the email is already used by another user.
+ *
auth/requires-recent-login
+ *
Thrown if the user's last sign-in time does not meet the security + * threshold. Use {@link firebase.User#reauthenticate} to resolve. This does + * not apply if the user is anonymous.
+ *
+ * + * @param {string} newEmail The new email address. + * @return {!firebase.Promise} + */ +firebase.User.prototype.updateEmail = function(newEmail) {}; + + +/** + * Updates the user's password. + * + * Important: this is a security sensitive operation that requires the + * user to have recently signed in. If this requirement isn't met, ask the user + * to authenticate again and then call {@link firebase.User#reauthenticate}. + * + *

Error Codes

+ *
+ *
auth/weak-password
+ *
Thrown if the password is not strong enough.
+ *
auth/requires-recent-login
+ *
Thrown if the user's last sign-in time does not meet the security + * threshold. Use {@link firebase.User#reauthenticate} to resolve. This does + * not apply if the user is anonymous.
+ *
+ * + * @param {string} newPassword + * @return {!firebase.Promise} + */ +firebase.User.prototype.updatePassword = function(newPassword) {}; + + +/** + * Updates a user's profile data. + * + * @example + * // Updates the user attributes: + * user.updateProfile({ + * displayName: "Jane Q. User", + * photoURL: "https://example.com/jane-q-user/profile.jpg" + * }).then(function() { + * // Profile updated successfully! + * // "Jane Q. User" + * var displayName = user.displayName; + * // "https://example.com/jane-q-user/profile.jpg" + * var photoURL = user.photoURL; + * }, function(error) { + * // An error happened. + * }); + * + * // Passing a null value will delete the current attribute's value, but not + * // passing a property won't change the current attribute's value: + * // Let's say we're using the same user than before, after the update. + * user.updateProfile({photoURL: null}).then(function() { + * // Profile updated successfully! + * // "Jane Q. User", hasn't changed. + * var displayName = user.displayName; + * // Now, this is null. + * var photoURL = user.photoURL; + * }, function(error) { + * // An error happened. + * }); + * + * @param {!{displayName: ?string, photoURL: ?string}} profile The profile's + * displayName and photoURL to update. + * @return {!firebase.Promise} + */ +firebase.User.prototype.updateProfile = function(profile) {}; + + +/** + * Deletes and signs out the user. + * + * Important: this is a security sensitive operation that requires the + * user to have recently signed in. If this requirement isn't met, ask the user + * to authenticate again and then call {@link firebase.User#reauthenticate}. + * + *

Error Codes

+ *
+ *
auth/requires-recent-login
+ *
Thrown if the user's last sign-in time does not meet the security + * threshold. Use {@link firebase.User#reauthenticate} to resolve. This does + * not apply if the user is anonymous.
+ *
+ * + * @return {!firebase.Promise} + */ +firebase.User.prototype.delete = function() {}; + + +/** + * Checks a password reset code sent to the user by email or other out-of-band + * mechanism. + * + * Returns the user's email address if valid. + * + *

Error Codes

+ *
+ *
auth/expired-action-code
+ *
Thrown if the password reset code has expired.
+ *
auth/invalid-action-code
+ *
Thrown if the password reset code is invalid. This can happen if the code + * is malformed or has already been used.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given password reset code has + * been disabled.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the password reset code. This + * may have happened if the user was deleted between when the code was + * issued and when this method was called.
+ *
+ * + * @param {string} code A verification code sent to the user. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.verifyPasswordResetCode = function(code) {}; + + +/** + * A response from {@link firebase.auth.Auth#checkActionCode}. + * + * @interface + */ +firebase.auth.ActionCodeInfo = function() {}; + + +/** + * The email address associated with the action code. + * + * @typedef {{ + * email: string + * }} + */ +firebase.auth.ActionCodeInfo.prototype.data; + + +/** + * Checks a verification code sent to the user by email or other out-of-band + * mechanism. + * + * Returns metadata about the code. + * + *

Error Codes

+ *
+ *
auth/expired-action-code
+ *
Thrown if the action code has expired.
+ *
auth/invalid-action-code
+ *
Thrown if the action code is invalid. This can happen if the code is + * malformed or has already been used.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given action code has been + * disabled.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the action code. This may + * have happened if the user was deleted between when the action code was + * issued and when this method was called.
+ *
+ * + * @param {string} code A verification code sent to the user. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.checkActionCode = function(code) {}; + + +/** + * Applies a verification code sent to the user by email or other out-of-band + * mechanism. + * + *

Error Codes

+ *
+ *
auth/expired-action-code
+ *
Thrown if the action code has expired.
+ *
auth/invalid-action-code
+ *
Thrown if the action code is invalid. This can happen if the code is + * malformed or has already been used.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given action code has been + * disabled.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the action code. This may + * have happened if the user was deleted between when the action code was + * issued and when this method was called.
+ *
+ * + * @param {string} code A verification code sent to the user. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.applyActionCode = function(code) {}; + + +/** + * The Firebase Auth service interface. + * + * @interface + */ +firebase.auth.Auth = function() {}; + +/** + * The App associated with the Auth service instance. + * + * @type {!firebase.app.App} + */ +firebase.auth.Auth.prototype.app; + +/** + * The currently signed-in user (or null). + * + * @type {firebase.User|null} + */ +firebase.auth.Auth.prototype.currentUser; + +/** + * Creates a new user account associated with the specified email address and + * password. + * + * On successful creation of the user account, this user will also be + * signed in to your application. + * + * User account creation can fail if the account already exists or the password + * is invalid. + * + * Note: The email address acts as a unique identifier for the user and + * enables an email-based password reset. This function will create + * a new user account and set the initial user password. + * + *

Error Codes

+ *
+ *
auth/email-already-in-use
+ *
Thrown if there already exists an account with the given email + * address.
+ *
auth/invalid-email
+ *
Thrown if the email address is not valid.
+ *
auth/operation-not-allowed
+ *
Thrown if email/password accounts are not enabled. Enable email/password + * accounts in the Firebase Console, under the Auth tab.
+ *
auth/weak-password
+ *
Thrown if the password is not strong enough.
+ *
+ * + * @param {string} email The user's email address. + * @param {string} password The user's chosen password. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.createUserWithEmailAndPassword = + function(email, password) {}; + + +/** + * Gets the list of provider IDs that can be used to sign in for the given email + * address. Useful for an "identifier-first" sign-in flow. + * + *

Error Codes

+ *
+ *
auth/invalid-email
+ *
Thrown if the email address is not valid.
+ *
+ * + * @param {string} email An email address. + * @return {!firebase.Promise>} + */ +firebase.auth.Auth.prototype.fetchProvidersForEmail = function(email) {}; + + +/** + * Adds an observer for auth state changes. + * + * @param {!Object|function(?firebase.User)} + * nextOrObserver An observer object or a function triggered on change. + * @param {function(!firebase.auth.Error)=} opt_error Optional A function + * triggered on auth error. + * @param {function()=} opt_completed Optional A function triggered when the + * observer is removed. + * @return {!function()} The unsubscribe function for the observer. + */ +firebase.auth.Auth.prototype.onAuthStateChanged = function( + nextOrObserver, opt_error, opt_completed) {}; + + +/** + * Sends a password reset email to the given email address. + * + * To complete the password reset, call + * {@link firebase.auth.Auth#confirmPasswordReset} with the code supplied in the + * email sent to the user, along with the new password specified by the user. + * + *

Error Codes

+ *
+ *
auth/invalid-email
+ *
Thrown if the email address is not valid.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the email address.
+ *
+ * + * @param {string} email The email address with the password to be reset. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.sendPasswordResetEmail = function(email) {}; + + +/** + * Completes the password reset process, given a confirmation code and new + * password. + * + *

Error Codes

+ *
+ *
auth/expired-action-code
+ *
Thrown if the password reset code has expired.
+ *
auth/invalid-action-code
+ *
Thrown if the password reset code is invalid. This can happen if the + * code is malformed or has already been used.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given password reset code has + * been disabled.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the password reset code. This + * may have happened if the user was deleted between when the code was + * issued and when this method was called.
+ *
auth/weak-password
+ *
Thrown if the new password is not strong enough.
+ *
+ * + * @param {string} code The confirmation code send via email to the user. + * @param {string} newPassword The new password. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.confirmPasswordReset = + function(code, newPassword) {}; + +/** + * Asynchronously signs in with the given credentials. + * + *

Error Codes

+ *
+ *
auth/account-exists-with-different-credential
+ *
Thrown if there already exists an account with the email address + * asserted by the credential. Resolve this by calling + * {@link firebase.auth.Auth#fetchProvidersForEmail} and then asking the + * user to sign in using one of the returned providers. Once the user is + * signed in, the original credential can be linked to the user with + * {@link firebase.User#link}.
+ *
auth/invalid-credential
+ *
Thrown if the credential is malformed or has expired.
+ *
auth/operation-not-allowed
+ *
Thrown if the type of account corresponding to the credential + * is not enabled. Enable the account type in the Firebase Console, under + * the Auth tab.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given credential has been + * disabled.
+ *
auth/user-not-found
+ *
Thrown if signing in with a credential from + * {@link firebase.auth.EmailAuthProvider#credential} and there is no user + * corresponding to the given email.
+ *
auth/wrong-password
+ *
Thrown if signing in with a credential from + * {@link firebase.auth.EmailAuthProvider#credential} and the password is + * invalid for the given email, or if the account corresponding to the email + * does not have a password set.
+ *
+ * + * @param {!firebase.auth.AuthCredential} credential The auth credential. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.signInWithCredential = function(credential) {}; + + +/** + * Asynchronously signs in using a custom token. + * + * Custom tokens are used to integrate Firebase Auth with existing auth systems, + * and must be generated by the auth backend. + * + * Fails with an error if the token is invalid, expired, or not accepted by the + * Firebase Auth service. + * + *

Error Codes

+ *
+ *
auth/custom-token-mismatch
+ *
Thrown if the custom token is for a different Firebase App.
+ *
auth/invalid-custom-token
+ *
Thrown if the custom token format is incorrect.
+ *
+ * + * @param {string} token The custom token to sign in with. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.signInWithCustomToken = function(token) {}; + + +/** + * Asynchronously signs in using an email and password. + * + * Fails with an error if the email address and password do not match. + * + * Note: The user's password is NOT the password used to access the user's email + * account. The email address serves as a unique identifier for the user, and + * the password is used to access the user's account in your Firebase project. + * + * See also: {@link firebase.auth.Auth#createUserWithEmailAndPassword}. + * + *

Error Codes

+ *
+ *
auth/invalid-email
+ *
Thrown if the email address is not valid.
+ *
auth/user-disabled
+ *
Thrown if the user corresponding to the given email has been + * disabled.
+ *
auth/user-not-found
+ *
Thrown if there is no user corresponding to the given email.
+ *
auth/wrong-password
+ *
Thrown if the password is invalid for the given email, or the account + * corresponding to the email does not have a password set.
+ *
+ * + * @param {string} email The users email address. + * @param {string} password The users password. + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.signInWithEmailAndPassword = + function(email, password) {}; + + +/** + * Asynchronously signs in as an anonymous user. + * + * If there is already an anonymous user signed in, that user will be returned; + * otherwise, a new anonymous user identity will be created and returned. + * + *

Error Codes

+ *
+ *
auth/operation-not-allowed
+ *
Thrown if anonymous accounts are not enabled. Enable anonymous accounts + * in the Firebase Console, under the Auth tab.
+ *
+ * + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.signInAnonymously = function() {}; + + +/** + * A structure containing a User and an AuthCredential. + * + * @typedef {{ + * user: ?firebase.User, + * credential: ?firebase.auth.AuthCredential + * }} + */ +firebase.auth.UserCredential; + +/** + * Signs out the current user. + * + * @return {!firebase.Promise} + */ +firebase.auth.Auth.prototype.signOut = function() {}; + + +/** + * An authentication error. + * For method-specific error codes, refer to the specific methods in the + * documentation. For common error codes, check the reference below. Use {@link + * firebase.auth.Error#code} to get the specific error code. For a detailed + * message, use {@link firebase.auth.Error#message}. + * Errors with the code auth/account-exists-with-different-credential + * will have the additional fields email and + * credential which are needed to provide a way to resolve these + * specific errors. Refer to {@link firebase.auth.Auth#signInWithPopup} for more + * information. + * + *

Common Error Codes

+ *
+ *
auth/app-deleted
+ *
Thrown if the instance of FirebaseApp has been deleted.
+ *
auth/app-not-authorized
+ *
Thrown if the app identified by the domain where it's hosted, is not + * authorized to use Firebase Authentication with the provided API key. + * Review your key configuration in the Google API console.
+ *
auth/argument-error
+ *
Thrown if a method is called with incorrect arguments.
+ *
auth/invalid-api-key
+ *
Thrown if the provided API key is invalid. Please check that you have + * copied it correctly from the Firebase Console.
+ *
auth/invalid-user-token
+ *
Thrown if the user's credential is no longer valid. The user must sign in + * again.
+ *
auth/network-request-failed
+ *
Thrown if a network error (such as timeout, interrupted connection or + * unreachable host) has occurred.
+ *
auth/operation-not-allowed
+ *
Thrown if you have not enabled the provider in the Firebase Console. Go + * to the Firebase Console for your project, in the Auth section and the + * Sign in Method tab and configure the provider.
+ *
auth/requires-recent-login
+ *
Thrown if the user's last sign-in time does not meet the security + * threshold. Use {@link firebase.User#reauthenticate} to resolve. This does + * not apply if the user is anonymous.
+ *
auth/too-many-requests
+ *
Thrown if requests are blocked from a device due to unusual activity. + * Trying again after some delay would unblock.
+ *
auth/unauthorized-domain
+ *
Thrown if the app domain is not authorized for OAuth operations for your + * Firebase project. Edit the list of authorized domains from the Firebase + * console.
+ *
auth/user-disabled
+ *
Thrown if the user account has been disabled by an administrator. + * Accounts can be enabled or disabled in the Firebase Console, the Auth + * section and Users subsection.
+ *
auth/user-token-expired
+ *
Thrown if the user's credential has expired. This could also be thrown if + * a user has been deleted. Prompting the user to sign in again should + * resolve this for either case.
+ *
auth/web-storage-unsupported
+ *
Thrown if the browser does not support web storage or if the user + * disables them.
+ *
+ * + * @interface + */ +firebase.auth.Error = function() {}; + +/** + * Unique error code. + * + * @type {string} + */ +firebase.auth.Error.prototype.code; + +/** + * Complete error message. + * + * @type {string} + */ +firebase.auth.Error.prototype.message; + + +// +// List of Auth Providers. +// + + +/** + * Interface that represents an auth provider. + * + * @interface + */ +firebase.auth.AuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.AuthProvider.prototype.providerId; + +/** + * Facebook auth provider. + * @constructor + * @implements {firebase.auth.AuthProvider} + */ +firebase.auth.FacebookAuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.FacebookAuthProvider.PROVIDER_ID; + +/** + * @param {string} token Facebook access token. + * @return {!firebase.auth.AuthCredential} The auth provider credential. + */ +firebase.auth.FacebookAuthProvider.credential = function(token) {}; + +/** @type {string} */ +firebase.auth.FacebookAuthProvider.prototype.providerId; + +/** + * @param {string} scope Facebook OAuth scope. + */ +firebase.auth.FacebookAuthProvider.prototype.addScope = function(scope) {}; + +/** + * Sets the OAuth custom parameters to pass in a Facebook OAuth request for + * popup and redirect sign-in operations. + * Valid parameters include 'auth_type', 'display' and 'locale'. + * For a detailed list, check the + * {@link https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ Facebook} + * documentation. + * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri', + * 'scope', 'response_type' and 'state' are not allowed and will be ignored. + * @param {!Object} customOAuthParameters The custom OAuth parameters to pass + * in the OAuth request. + */ +firebase.auth.FacebookAuthProvider.prototype.setCustomParameters = + function(customOAuthParameters) {}; + + +/** + * Github auth provider. + * @constructor + * @implements {firebase.auth.AuthProvider} + */ +firebase.auth.GithubAuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.GithubAuthProvider.PROVIDER_ID; + +/** + * @param {string} token Github access token. + * @return {!firebase.auth.AuthCredential} The auth provider credential. + */ +firebase.auth.GithubAuthProvider.credential = function(token) {}; + +/** @type {string} */ +firebase.auth.GithubAuthProvider.prototype.providerId; + +/** + * @param {string} scope Github OAuth scope. + */ +firebase.auth.GithubAuthProvider.prototype.addScope = function(scope) {}; + +/** + * Sets the OAuth custom parameters to pass in a GitHub OAuth request for popup + * and redirect sign-in operations. + * Valid parameters include 'allow_signup'. + * For a detailed list, check the + * {@link https://developer.github.com/v3/oauth/ GitHub} documentation. + * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri', + * 'scope', 'response_type' and 'state' are not allowed and will be ignored. + * @param {!Object} customOAuthParameters The custom OAuth parameters to pass + * in the OAuth request. + */ +firebase.auth.GithubAuthProvider.prototype.setCustomParameters = + function(customOAuthParameters) {}; + + +/** + * Google auth provider. + * @constructor + * @implements {firebase.auth.AuthProvider} + */ +firebase.auth.GoogleAuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.GoogleAuthProvider.PROVIDER_ID; + +/** + * Creates a credential for Google. At least one of ID token and access token + * is required. + * @param {?string=} idToken Google ID token. + * @param {?string=} accessToken Google access token. + * @return {!firebase.auth.AuthCredential} The auth provider credential. + */ +firebase.auth.GoogleAuthProvider.credential = function(idToken, accessToken) {}; + +/** @type {string} */ +firebase.auth.GoogleAuthProvider.prototype.providerId; + +/** + * @param {string} scope Google OAuth scope. + */ +firebase.auth.GoogleAuthProvider.prototype.addScope = function(scope) {}; + +/** + * Sets the OAuth custom parameters to pass in a Google OAuth request for popup + * and redirect sign-in operations. + * Valid parameters include 'hd', 'hl', 'include_granted_scopes', 'login_hint' + * and 'prompt'. + * For a detailed list, check the + * {@link https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters Google} + * documentation. + * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri', + * 'scope', 'response_type' and 'state' are not allowed and will be ignored. + * @param {!Object} customOAuthParameters The custom OAuth parameters to pass + * in the OAuth request. + */ +firebase.auth.GoogleAuthProvider.prototype.setCustomParameters = + function(customOAuthParameters) {}; + + +/** + * Twitter auth provider. + * @constructor + * @implements {firebase.auth.AuthProvider} + */ +firebase.auth.TwitterAuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.TwitterAuthProvider.PROVIDER_ID; + +/** + * @param {string} token Twitter access token. + * @param {string} secret Twitter secret. + * @return {!firebase.auth.AuthCredential} The auth provider credential. + */ +firebase.auth.TwitterAuthProvider.credential = function(token, secret) {}; + +/** @type {string} */ +firebase.auth.TwitterAuthProvider.prototype.providerId; + +/** + * Sets the OAuth custom parameters to pass in a Twitter OAuth request for popup + * and redirect sign-in operations. + * Valid parameters include 'lang'. + * Reserved required OAuth 1.0 parameters such as 'oauth_consumer_key', + * 'oauth_token', 'oauth_signature', etc are not allowed and will be ignored. + * @param {!Object} customOAuthParameters The custom OAuth parameters to pass + * in the OAuth request. + */ +firebase.auth.TwitterAuthProvider.prototype.setCustomParameters = + function(customOAuthParameters) {}; + + +/** + * Email and password auth provider implementation. + * @constructor + * @implements {firebase.auth.AuthProvider} + */ +firebase.auth.EmailAuthProvider = function() {}; + +/** @type {string} */ +firebase.auth.EmailAuthProvider.PROVIDER_ID; + +/** + * @param {string} email Email address. + * @param {string} password User account password. + * @return {!firebase.auth.AuthCredential} The auth provider credential. + */ +firebase.auth.EmailAuthProvider.credential = function(email, password) {}; + +/** @type {string} */ +firebase.auth.EmailAuthProvider.prototype.providerId; diff --git a/lib/firebase/firebase-auth.js b/lib/firebase/firebase-auth.js new file mode 100644 index 00000000..8febb29a --- /dev/null +++ b/lib/firebase/firebase-auth.js @@ -0,0 +1,226 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +(function(){var h,aa=aa||{},l=this,ba=function(){},ca=function(){throw Error("unimplemented abstract method");},m=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!= +typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},da=function(a){return null===a},ea=function(a){return"array"==m(a)},fa=function(a){var b=m(a);return"array"==b||"object"==b&&"number"==typeof a.length},n=function(a){return"string"==typeof a},ga=function(a){return"number"==typeof a},p=function(a){return"function"==m(a)},ha=function(a){var b=typeof a; +return"object"==b&&null!=a||"function"==b},ia=function(a,b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2/g,ra=/"/g,sa=/'/g,ta=/\x00/g,va=/[\x00&<>"']/,v=function(a,b){return-1!=a.indexOf(b)},wa=function(a,b){return ab?1:0};var xa=function(a,b){b.unshift(a);u.call(this,ma.apply(null,b));b.shift()};r(xa,u);xa.prototype.name="AssertionError"; +var ya=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new xa(""+e,f||[]);},w=function(a,b,c){a||ya("",null,b,Array.prototype.slice.call(arguments,2))},za=function(a,b){throw new xa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Aa=function(a,b,c){ga(a)||ya("Expected number but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments,2));return a},Ba=function(a,b,c){n(a)||ya("Expected string but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments, +2))},Ca=function(a,b,c){p(a)||ya("Expected function but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments,2))};var Da=Array.prototype.indexOf?function(a,b,c){w(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(n(a))return n(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:n(a)?a.charAt(b):a[b]},Ka=function(a,b){return 0<=Da(a,b)},Ma=function(a,b){b=Da(a,b);var c;(c=0<=b)&&La(a,b);return c},La=function(a,b){w(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length},Na=function(a,b){var c=0;Fa(a,function(d,e){b.call(void 0,d,e,a)&&La(a,e)&&c++})},Oa=function(a){return Array.prototype.concat.apply(Array.prototype, +arguments)},Pa=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Qa=function(a){var b=a.length;if(0parseFloat(mb)){lb=String(ob);break a}}lb=mb} +var pb=lb,db={},z=function(a){return eb(a,function(){for(var b=0,c=na(String(pb)).split("."),d=na(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f>4);64!=g&&(b(f<<4&240|g>>2),64!=k&&b(g<<6&192|k))}},wb=function(){if(!sb){sb={};tb={};for(var a=0;65>a;a++)sb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), +tb[sb[a]]=a,62<=a&&(tb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var xb=!y||9<=Number(qb),yb=y&&!z("9");!jb||z("528");ib&&z("1.9b")||y&&z("8")||fb&&z("9.5")||jb&&z("528");ib&&!z("8")||y&&z("9");var zb=function(){this.Ba=this.Ba;this.Wb=this.Wb};zb.prototype.Ba=!1;zb.prototype.isDisposed=function(){return this.Ba};zb.prototype.Ra=function(){if(this.Wb)for(;this.Wb.length;)this.Wb.shift()()};var Ab=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.Ya=!1;this.Bd=!0};Ab.prototype.preventDefault=function(){this.defaultPrevented=!0;this.Bd=!1};var Bb=function(a,b){Ab.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.ob=this.state=null;a&&this.init(a,b)};r(Bb,Ab); +Bb.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(ib){var e;a:{try{cb(b.nodeName);e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.offsetX=jb||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=jb||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX: +a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.ob=a;a.defaultPrevented&& +this.preventDefault()};Bb.prototype.preventDefault=function(){Bb.Vc.preventDefault.call(this);var a=this.ob;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,yb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Bb.prototype.le=function(){return this.ob};var Cb="closure_listenable_"+(1E6*Math.random()|0),Db=0;var Eb=function(a,b,c,d,e){this.listener=a;this.ac=null;this.src=b;this.type=c;this.Gb=!!d;this.Nb=e;this.key=++Db;this.cb=this.Fb=!1},Fb=function(a){a.cb=!0;a.listener=null;a.ac=null;a.src=null;a.Nb=null};var Gb=function(a){this.src=a;this.A={};this.Cb=0};Gb.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.A[f];a||(a=this.A[f]=[],this.Cb++);var g=Hb(a,b,d,e);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.currentTarget;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;!b.Ya&&0<=e;e--){b.currentTarget=d[e];var f=Yb(d[e],a,!0,b),c=c&&f}for(e=0;!b.Ya&&e>>0),Nb=function(a){w(a,"Listener can not be null.");if(p(a))return a;w(a.handleEvent,"An object listener must have handleEvent method.");a[Zb]||(a[Zb]=function(b){return a.handleEvent(b)});return a[Zb]};var $b=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;var bc=function(){this.kc="";this.Td=ac};bc.prototype.Qb=!0;bc.prototype.Lb=function(){return this.kc};bc.prototype.toString=function(){return"Const{"+this.kc+"}"};var cc=function(a){if(a instanceof bc&&a.constructor===bc&&a.Td===ac)return a.kc;za("expected object of type Const, got '"+a+"'");return"type_error:Const"},ac={},dc=function(a){var b=new bc;b.kc=a;return b};dc("");var fc=function(){this.la="";this.Sd=ec};fc.prototype.Qb=!0;fc.prototype.Lb=function(){return this.la};fc.prototype.toString=function(){return"SafeUrl{"+this.la+"}"}; +var gc=function(a){if(a instanceof fc&&a.constructor===fc&&a.Sd===ec)return a.la;za("expected object of type SafeUrl, got '"+a+"' of type "+m(a));return"type_error:SafeUrl"},hc=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i,jc=function(a){if(a instanceof fc)return a;a=a.Qb?a.Lb():String(a);hc.test(a)||(a="about:invalid#zClosurez");return ic(a)},ec={},ic=function(a){var b=new fc;b.la=a;return b};ic("about:blank");var kc=function(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))},lc=function(a){a=String(a);if(kc(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},oc=function(a){var b=[];mc(new nc,a,b);return b.join("")},nc=function(){this.ec=void 0}, +mc=function(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;fa){var b=Ac[a];if(b)return b}b=new A([a|0],0>a?-1:0);-128<=a&&128>a&&(Ac[a]=b);return b},D=function(a){if(isNaN(a)||!isFinite(a))return B;if(0>a)return C(D(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new A(b,0)},Cc=function(a,b){if(0==a.length)throw Error("number format error: empty string");b=b||10;if(2>b||36f?(f=D(Math.pow(b,f)),d=d.multiply(f).add(D(g))):(d=d.multiply(c),d=d.add(D(g)))}return d},B=Bc(0),Dc=Bc(1),Ec=Bc(16777216),Fc=function(a){if(-1==a.g)return-Fc(C(a));for(var b=0,c=1,d=0;da||36>>0).toString(a),c=e;if(Hc(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}}; +var E=function(a,b){return 0>b?0:b>>16)+(E(this,e)>>>16)+(E(a,e)>>>16),d=g>>>16,f=f&65535,g=g&65535;c[e]=g<<16|f}return new A(c,c[c.length-1]&-2147483648?-1:0)};var Jc=function(a,b){return a.add(C(b))}; +A.prototype.multiply=function(a){if(Hc(this)||Hc(a))return B;if(-1==this.g)return-1==a.g?C(this).multiply(C(a)):C(C(this).multiply(a));if(-1==a.g)return C(this.multiply(C(a)));if(0>this.compare(Ec)&&0>a.compare(Ec))return D(Fc(this)*Fc(a));for(var b=this.h.length+a.h.length,c=[],d=0;d<2*b;d++)c[d]=0;for(d=0;d>>16,g=E(this,d)&65535,k=E(a,e)>>>16,t=E(a,e)&65535;c[2*d+2*e]+=g*t;Kc(c,2*d+2*e);c[2*d+2*e+1]+=f*t;Kc(c,2*d+2*e+1);c[2*d+2*e+ +1]+=g*k;Kc(c,2*d+2*e+1);c[2*d+2*e+2]+=f*k;Kc(c,2*d+2*e+2)}for(d=0;d>>16,a[b]&=65535,b++},Ic=function(a,b){if(Hc(b))throw Error("division by zero");if(Hc(a))return B;if(-1==a.g)return-1==b.g?Ic(C(a),C(b)):C(Ic(C(a),b));if(-1==b.g)return C(Ic(a,C(b)));if(30=b.compare(a);)c=c.shiftLeft(1),b=b.shiftLeft(1);var d=Lc(c,1),e=Lc(b,1),f;b=Lc(b,2);for(c=Lc(c,2);!Hc(b);)f=e.add(b),0>=f.compare(a)&&(d=d.add(c), +e=f),b=Lc(b,1),c=Lc(c,1);return d}for(c=B;0<=a.compare(b);){d=Math.max(1,Math.floor(Fc(a)/Fc(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=D(d);for(var g=f.multiply(b);-1==g.g||0>5;a%=32;for(var c=this.h.length+b+(0>>32-a:E(this,e-b);return new A(d,this.g)};var Lc=function(a,b){var c=b>>5;b%=32;for(var d=a.h.length-c,e=[],f=0;f>>b|E(a,f+c+1)<<32-b:E(a,f+c);return new A(e,a.g)};var Nc=function(a,b){this.sb=a;this.pa=b};Nc.prototype.Ib=function(a){return this.pa==a.pa&&this.sb.Ib(Xa(a.sb))};Nc.prototype.toString=ca; +var Qc=function(a){try{var b;if(b=0==a.lastIndexOf("[",0)){var c=a.length-1;b=0<=c&&a.indexOf("]",c)==c}return b?new Oc(a.substring(1,a.length-1)):new Pc(a)}catch(d){return null}},Pc=function(a){var b=B;if(a instanceof A){if(0!=a.g||0>a.compare(B)||0e||255>>=8;return this.Ea=b.join(".")}; +var Oc=function(a){var b=B;if(a instanceof A){if(0!=a.g||0>a.compare(B)||0>>16&65535).toString(16));d.push((a&65535).toString(16));La(c,c.length-1);Ra(c,d);a=c.join(":")}d=a.split("::");if(2e)c=[];else{for(var f=[],g=0;ge.compare(B)||0>>16).toString(16));a.push(d.toString(16))}for(var c=b=-1,e=d=0,f=0;fd&&(d=e,b=c)):(c=-1,e=0);0=b.uc&&b.cancel())}this.ud?this.ud.call(this.fd,this):this.Tc=!0;this.Ta||Ld(this,new Md)}};Kd.prototype.dd=function(a,b){this.tc=!1;Nd(this,a,b)}; +var Nd=function(a,b,c){a.Ta=!0;a.ma=c;a.qb=!b;Od(a)},Qd=function(a){if(a.Ta){if(!a.Tc)throw new Pd;a.Tc=!1}};Kd.prototype.callback=function(a){Qd(this);Rd(a);Nd(this,!0,a)}; +var Ld=function(a,b){Qd(a);Rd(b);Nd(a,!1,b)},Rd=function(a){w(!(a instanceof Kd),"An execution sequence may not be initiated with a blocking Deferred.")},Vd=function(a){var b=Sd("https://apis.google.com/js/client.js?onload="+Td);Ud(b,null,a,void 0)},Ud=function(a,b,c,d){w(!a.Yc,"Blocking Deferreds can not be re-used");a.gc.push([b,c,d]);a.Ta&&Od(a)};Kd.prototype.then=function(a,b,c){var d,e,f=new F(function(a,b){d=a;e=b});Ud(this,d,function(a){a instanceof Md?f.cancel():e(a)});return f.then(a,b,c)}; +pd(Kd); +var Wd=function(a){return Ha(a.gc,function(a){return p(a[1])})},Od=function(a){if(a.nc&&a.Ta&&Wd(a)){var b=a.nc,c=Xd[b];c&&(l.clearTimeout(c.rb),delete Xd[b]);a.nc=0}a.s&&(a.s.uc--,delete a.s);for(var b=a.ma,d=c=!1;a.gc.length&&!a.tc;){var e=a.gc.shift(),f=e[0],g=e[1],e=e[2];if(f=a.qb?g:f)try{var k=f.call(e||a.fd,b);void 0!==k&&(a.qb=a.qb&&(k==b||k instanceof Error),a.ma=b=k);if(qd(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.tc=!0}catch(t){b=t,a.qb=!0,Wd(a)||(c=!0)}}a.ma=b;d&& +(k=q(a.dd,a,!0),d=q(a.dd,a,!1),b instanceof Kd?(Ud(b,k,d),b.Yc=!0):b.then(k,d));c&&(b=new Yd(b),Xd[b.rb]=b,a.nc=b.rb)},Pd=function(){u.call(this)};r(Pd,u);Pd.prototype.message="Deferred has already fired";Pd.prototype.name="AlreadyCalledError";var Md=function(){u.call(this)};r(Md,u);Md.prototype.message="Deferred was canceled";Md.prototype.name="CanceledError";var Yd=function(a){this.rb=l.setTimeout(q(this.We,this),0);this.N=a}; +Yd.prototype.We=function(){w(Xd[this.rb],"Cannot throw an error that is not scheduled.");delete Xd[this.rb];throw this.N;};var Xd={};var Sd=function(a){var b=new Xc;b.Zb=a;return Zd(b)},Zd=function(a){var b={},c=b.document||document,d;a instanceof Xc&&a.constructor===Xc&&a.Ud===Wc?d=a.Zb:(za("expected object of type TrustedResourceUrl, got '"+a+"' of type "+m(a)),d="type_error:TrustedResourceUrl");var e=document.createElement("SCRIPT");a={Cd:e,Bb:void 0};var f=new Kd($d,a),g=null,k=null!=b.timeout?b.timeout:5E3;0++d,"infinite loop")}c=this.Xd;d=a.type||a;if(n(a))a=new Ab(a,c);else if(a instanceof Ab)a.target=a.target||c;else{var e=a;a=new Ab(d,c);Za(a,e)}var e=!0,f;if(b)for(var g=b.length-1;!a.Ya&&0<=g;g--)f=a.currentTarget=b[g],e=fe(f,d,!0,a)&&e;a.Ya||(f=a.currentTarget=c,e=fe(f,d,!0,a)&&e,a.Ya||(e=fe(f,d,!1,a)&&e));if(b)for(g=0;!a.Ya&&g2*this.i&&je(this),!0):!1}; +var je=function(a){if(a.i!=a.v.length){for(var b=0,c=0;b=d.v.length)throw ge;var e=d.v[b++];return a?e:d.ca[e]};return e}; +var ke=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var me=function(a){if(a.X&&"function"==typeof a.X)return a.X();if(n(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d=we(this).value)for(p(b)&&(b=b()),a=new pe(a,String(b),this.He),c&&(a.hd=c),c="log:"+a.Ge,l.console&&(l.console.timeStamp?l.console.timeStamp(c):l.console.markTimeline&&l.console.markTimeline(c)),l.msWriteProfilerMark&&l.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.nd)for(var e=0,f;f=b.nd[e];e++)f(d);c=c.getParent()}}; +var xe={},ye=null,ze=function(a){ye||(ye=new re(""),xe[""]=ye,ye.Fd(ue));var b;if(!(b=xe[a])){b=new re(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=ze(a.substr(0,c));c.vc||(c.vc={});c.vc[d]=b;b.s=c;xe[a]=b}return b};var I=function(a,b){a&&a.log(ve,b,void 0)};var Ae=function(a,b,c){if(p(a))c&&(a=q(a,c));else if(a&&"function"==typeof a.handleEvent)a=q(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647b)throw Error("Bad port number "+b);a.Xa=b}else a.Xa=null},We=function(a,b,c){K(a);a.ta=c?Ye(b,!0):b},Xe=function(a,b,c){K(a);b instanceof L?(a.$=b,a.$.Sc(a.P)):(c||(b=Ze(b,df)),a.$=new L(b,0,a.P))},M=function(a,b,c){K(a);a.$.set(b,c)},ef=function(a,b){K(a);a.$.remove(b)},K=function(a){if(a.Ae)throw Error("Tried to modify a read-only Uri"); +};Se.prototype.Sc=function(a){this.P=a;this.$&&this.$.Sc(a);return this}; +var ff=function(a){return a instanceof Se?a.clone():new Se(a,void 0)},gf=function(a,b){var c=new Se(null,void 0);Te(c,"https");a&&Ue(c,a);b&&We(c,b);return c},Ye=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Ze=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,hf),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},hf=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},$e=/[#\/\?@]/g,bf=/[\#\?:]/g,af=/[\#\?]/g,df=/[\#\?@]/g, +cf=/#/g,L=function(a,b,c){this.i=this.j=null;this.M=a||null;this.P=!!c},jf=function(a){a.j||(a.j=new ie,a.i=0,a.M&&De(a.M,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},lf=function(a){var b=ne(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new L(null,0,void 0);a=me(a);for(var d=0;da?!1:!y||!qb||9")&&(d=d.replace(qa,">")),-1!=d.indexOf('"')&&(d=d.replace(ra,""")),-1!= +d.indexOf("'")&&(d=d.replace(sa,"'")),-1!=d.indexOf("\x00")&&(d=d.replace(ta,"�"))),d='',Ba(cc(a),"must provide justification"),w(!/^[\s\xa0]*$/.test(cc(a)),"must provide non-empty justification"),g.document.write($c((new Zc).ye(d))),g.document.close())):g=a.open(gc(b),c,g);if(g)try{g.focus()}catch(k){}return g},uf=function(a){return new F(function(b){var c=function(){Be(2E3).then(function(){if(!a||a.closed)b();else return c()})};return c()})}, +vf=function(){var a=null;return(new F(function(b){"complete"==l.document.readyState?b():(a=function(){b()},Tb(window,"load",a))})).l(function(b){Vb(window,"load",a);throw b;})},O=function(a){switch(a||l.navigator&&l.navigator.product||""){case "ReactNative":return"ReactNative";default:return"undefined"!==typeof l.process?"Node":"Browser"}},wf=function(){var a=O();return"ReactNative"===a||"Node"===a},pf=function(a){var b=a.toLowerCase();if(v(b,"opera/")||v(b,"opr/")||v(b,"opios/"))return"Opera";if(v(b, +"iemobile"))return"IEMobile";if(v(b,"msie")||v(b,"trident/"))return"IE";if(v(b,"edge/"))return"Edge";if(v(b,"firefox/"))return"Firefox";if(v(b,"silk/"))return"Silk";if(v(b,"blackberry"))return"Blackberry";if(v(b,"webos"))return"Webos";if(!v(b,"safari/")||v(b,"chrome/")||v(b,"crios/")||v(b,"android"))if(!v(b,"chrome/")&&!v(b,"crios/")||v(b,"edge/")){if(v(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==a.length)return a[1]}else return"Chrome";else return"Safari";return"Other"}, +xf=function(a){var b=O(void 0);return("Browser"===b?pf(N()):b)+"/JsCore/"+a},N=function(){return l.navigator&&l.navigator.userAgent||""},yf=function(a){a=a.split(".");for(var b=l,c=0;cb)throw Error("Short delay should be less than long delay!");this.Te=a;this.Fe=b;a=d||O();this.ze=rf(c||N())||"ReactNative"===a};Hf.prototype.get=function(){return this.ze?this.Fe:this.Te};var If;try{var Jf={};Object.defineProperty(Jf,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(Jf,"abcd",{configurable:!0,enumerable:!0,value:2});If=2==Jf.abcd}catch(a){If=!1} +var P=function(a,b,c){If?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c},Kf=function(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&P(a,c,b[c])},Lf=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},Mf=function(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c Auth section -> Sign in method tab.",a);Q.call(this,b,c)};r(Uf,Q);var Vf=function(a){this.Ee=a.sub;la();this.Hb=a.email||null};var Wf=function(a,b,c,d){var e={};ha(c)?e=c:b&&n(c)&&n(d)?e={oauthToken:c,oauthTokenSecret:d}:!b&&n(c)&&(e={accessToken:c});if(b||!e.idToken&&!e.accessToken)if(b&&e.oauthToken&&e.oauthTokenSecret)P(this,"accessToken",e.oauthToken),P(this,"secret",e.oauthTokenSecret);else{if(b)throw new Q("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");throw new Q("argument-error","credential failed: expected 1 argument (the OAuth access token).");}else e.idToken&&P(this, +"idToken",e.idToken),e.accessToken&&P(this,"accessToken",e.accessToken);P(this,"provider",a)};Wf.prototype.Kb=function(a){return Xf(a,Yf(this))};Wf.prototype.td=function(a,b){var c=Yf(this);c.idToken=b;return Zf(a,c)};var Yf=function(a){var b={};a.idToken&&(b.id_token=a.idToken);a.accessToken&&(b.access_token=a.accessToken);a.secret&&(b.oauth_token_secret=a.secret);b.providerId=a.provider;return{postBody:lf(b).toString(),requestUri:Af()?nf():"http://localhost"}}; +Wf.prototype.K=function(){var a={provider:this.provider};this.idToken&&(a.oauthIdToken=this.idToken);this.accessToken&&(a.oauthAccessToken=this.accessToken);this.secret&&(a.oauthTokenSecret=this.secret);return a}; +var $f=function(a,b,c){var d=!!b,e=c||[];b=function(){Kf(this,{providerId:a,isOAuthProvider:!0});this.Rc=[];this.ed={};"google.com"==a&&this.addScope("profile")};d||(b.prototype.addScope=function(a){Ka(this.Rc,a)||this.Rc.push(a)});b.prototype.setCustomParameters=function(a){this.ed=Xa(a)};b.prototype.me=function(){var a=Df(this.ed),b;for(b in a)a[b]=a[b].toString();a=Xa(a);for(b=0;bk||k>=Fh.length)throw new Q("internal-error","Argument validator received an unsupported number of arguments.");e=Fh[k]+" argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.fa+".";break a}e=null}}if(e)throw new Q("argument-error",d+" failed: "+e);return b.apply(this,a)};for(var e in b)a[e]=b[e];for(e in b.prototype)a.prototype[e]= +b.prototype[e];return a},Nh=function(a){a=a.split(".");return a[a.length-1]};var Oh=function(a,b,c,d){this.Ie=a;this.Ed=b;this.Oe=c;this.hb=d;this.R={};Dh||(Dh=new Ch);a=Dh;try{var e;mf()?(th||(th=new sh("firebaseLocalStorageDb","firebaseLocalStorage","fbase_key","value",1)),e=th):e=new a.gd.Z;this.Wa=e}catch(f){this.Wa=new mh,this.hb=!0}try{this.lc=new a.gd.Wc}catch(f){this.lc=new mh}this.Hd=q(this.Id,this);this.S={}},Ph,Qh=function(){Ph||(Ph=new Oh("firebase",":",!Ff(N())&&l.window&&l.window!=l.window.top?!0:!1,Bf()));return Ph};h=Oh.prototype; +h.O=function(a,b){return this.Ie+this.Ed+a.name+(b?this.Ed+b:"")};h.get=function(a,b){return(a.Z?this.Wa:this.lc).get(this.O(a,b))};h.remove=function(a,b){b=this.O(a,b);a.Z&&!this.hb&&(this.S[b]=null);return(a.Z?this.Wa:this.lc).remove(b)};h.set=function(a,b,c){var d=this.O(a,c),e=this,f=a.Z?this.Wa:this.lc;return f.set(d,b).then(function(){return f.get(d)}).then(function(b){a.Z&&!this.hb&&(e.S[d]=b)})}; +h.addListener=function(a,b,c){a=this.O(a,b);this.hb||(this.S[a]=l.localStorage.getItem(a));Va(this.R)&&this.Uc();this.R[a]||(this.R[a]=[]);this.R[a].push(c)};h.removeListener=function(a,b,c){a=this.O(a,b);this.R[a]&&(Na(this.R[a],function(a){return a==c}),0==this.R[a].length&&delete this.R[a]);Va(this.R)&&this.jc()};h.Uc=function(){this.Wa.Na(this.Hd);this.hb||Rh(this)}; +var Rh=function(a){Sh(a);a.Fc=setInterval(function(){for(var b in a.R){var c=l.localStorage.getItem(b);c!=a.S[b]&&(a.S[b]=c,c=new Bb({type:"storage",key:b,target:window,oldValue:a.S[b],newValue:c}),a.Id(c))}},1E3)},Sh=function(a){a.Fc&&(clearInterval(a.Fc),a.Fc=null)};Oh.prototype.jc=function(){this.Wa.bb(this.Hd);this.hb||Sh(this)}; +Oh.prototype.Id=function(a){if(a&&a.le){var b=a.ob.key;if(this.Oe){var c=l.localStorage.getItem(b);a=a.ob.newValue;a!=c&&(a?l.localStorage.setItem(b,a):a||l.localStorage.removeItem(b))}this.S[b]=l.localStorage.getItem(b);this.ad(b)}else Ea(a,q(this.ad,this))};Oh.prototype.ad=function(a){this.R[a]&&Ea(this.R[a],function(a){a()})};var Th=function(a){this.D=a;this.B=Qh()},Uh={name:"pendingRedirect",Z:!1},Vh=function(a){return a.B.set(Uh,"pending",a.D)},Wh=function(a){return a.B.remove(Uh,a.D)},Xh=function(a){return a.B.get(Uh,a.D).then(function(a){return"pending"==a})};var $h=function(a,b,c){var d=this,e=(this.Aa=firebase.SDK_VERSION||null)?xf(this.Aa):null;this.f=new S(b,null,e);this.sa=null;this.C=a;this.m=b;this.F=c;this.Ab=[];this.Sb=!1;this.Xc=q(this.oe,this);this.Za=new Yh(this);this.yd=new Zh(this);this.Kc=new Th(this.m+":"+this.F);this.jb={};this.jb.unknown=this.Za;this.jb.signInViaRedirect=this.Za;this.jb.linkViaRedirect=this.Za;this.jb.signInViaPopup=this.yd;this.jb.linkViaPopup=this.yd;this.dc=this.fb=null;this.Xb=new F(function(a,b){d.fb=a;d.dc=b})}; +$h.prototype.reset=function(){var a=this;this.sa=null;this.Xb.cancel();this.Sb=!1;this.dc=this.fb=null;this.Pb&&kh(this.Pb,this.Xc);this.Xb=new F(function(b,c){a.fb=b;a.dc=c})}; +var ai=function(a){var b=nf();return Cg(a).then(function(a){a:{for(var c=ff(b).ia,e=0;ethis.Sa-3E4?this.V?qi(this,{grant_type:"refresh_token",refresh_token:this.V}):G(null):G({accessToken:this.za,expirationTime:this.Sa,refreshToken:this.V})};var si=function(a,b,c,d,e){Kf(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,providerId:b})},ti=function(a,b){Ab.call(this,a);for(var c in b)this[c]=b[c]};r(ti,Ab); +var W=function(a,b,c){this.Y=[];this.m=a.apiKey;this.F=a.appName;this.C=a.authDomain||null;a=firebase.SDK_VERSION?xf(firebase.SDK_VERSION):null;this.f=new S(this.m,null,a);this.ea=new ni(this.f);ui(this,b.idToken);pi(this.ea,b);P(this,"refreshToken",this.ea.V);vi(this,c||{});de.call(this);this.Yb=!1;this.C&&Af()&&(this.o=ki(this.C,this.m,this.F));this.ic=[];this.sc=G()};r(W,de); +W.prototype.ua=function(a,b){var c=Array.prototype.slice.call(arguments,1),d=this;return this.sc=this.sc.then(function(){return a.apply(d,c)},function(){return a.apply(d,c)})}; +var ui=function(a,b){a.rd=b;P(a,"_lat",b)},wi=function(a,b){Na(a.ic,function(a){return a==b})},xi=function(a){for(var b=[],c=0;c} Resolves when write to server is complete. + */ +firebase.database.Reference.prototype.set = function(value, onComplete) {}; + + +/** + * Writes multiple values to the database at once. + * + * The `values` argument contains multiple property/value pairs that will be + * written to the database together. Each child property can either be a simple + * property (for example, "name"), or a relative path (for example, + * "name/first") from the current location to the data to update. + * + * As opposed to the `set()` method, `update()` can be use to selectively update + * only the referenced properties at the current location (instead of replacing + * all the child properties at the current location). + * + * The effect of the write will be visible immediately and the corresponding + * events ('value', 'child_added', etc.) will be triggered. Synchronization of + * the data to the Firebase servers will also be started, and the returned + * Promise will resolve when complete. If provided, the onComplete callback will + * be called asynchronously after synchronization has finished. + * + * A single `update()` will generate a single "value" event at the location where + * the `update()` was performed, regardless of how many children were modified. + * + * Note that modifying data with `update()` will cancel any pending transactions + * at that location, so extreme care should be taken if mixing `update()` and + * `transaction()` to modify the same data. + * + * Passing `null` to `update()` will remove the data at this location. + * + * See + * {@link + * https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html + * Introducing multi-location updates and more} + * + * @example + * var adaNameRef = firebase.database().ref('users/ada/name'); + * // Modify the 'first' and 'last' properties, but leave other data at + * // adaNameRef unchanged. + * adaNameRef.update({ first: 'Ada', last: 'Lovelace' }); + * + * @param {!Object} values Object containing multiple values. + * @param {function(?Error)=} onComplete Callback called when write to server is + * complete. + * @return {!firebase.Promise} Resolves when update on server is complete. + */ +firebase.database.Reference.prototype.update = + function(values, onComplete) {}; + + +/** + * Writes data the database location. Like `set()` but also specifies the + * priority for that data. + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @param {*} newVal + * @param {string|number|null} newPriority + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ +firebase.database.Reference.prototype.setWithPriority = + function(newVal, newPriority, onComplete) {}; + + +/** + * Remove the data at this database location. + * + * Any data at child locations will also be deleted. + * + * The effect of the remove will be visible immediately and the corresponding + * event 'value' will be triggered. Synchronization of the remove to the + * Firebase servers will also be started, and the returned Promise will resolve + * when complete. If provided, the onComplete callback will be called + * asynchronously after synchronization has finished. + * + * @example + * var adaRef = firebase.database().ref('users/ada'); + * adaRef.remove() + * .then(function() { + * console.log("Remove succeeded.") + * }) + * .catch(function(error) { + * console.log("Remove failed: " + error.message) + * }); + * + * @param {function(?Error)=} onComplete Callback called when write to server is + * complete. + * @return {!firebase.Promise} Resolves when remove on server is complete. + */ +firebase.database.Reference.prototype.remove = function(onComplete) {}; + + +/** + * Atomically modifies the data at this location. + * + * Atomically modify the data at this location. Unlike a normal `set()`, which + * just overwrites the data regardless of its previous value, `transaction()` is + * used to modify the existing value to a new value, ensuring there are no + * conflicts with other clients writing to the same location at the same time. + * + * To accomplish this, you pass `transaction()` an update function which is used + * to transform the current value into a new value. If another client writes to + * the location before your new value is successfully written, your update + * function will be called again with the new current value, and the write will + * be retried. This will happen repeatedly until your write succeeds without + * conflict or you abort the transaction by not returning a value from your + * update function. + * + * Note: Modifying data with `set()` will cancel any pending transactions at + * that location, so extreme care should be taken if mixing `set()` and + * `transaction()` to update the same data. + * + * Note: When using transactions with Security and Firebase Rules in place, be + * aware that a client needs `.read` access in addition to `.write` access in + * order to perform a transaction. This is because the client-side nature of + * transactions requires the client to read the data in order to transactionally + * update it. + * + * @example + * // Increment Ada's rank by 1. + * var adaRankRef = firebase.database().ref('users/ada/rank'); + * adaRankRef.transaction(function(currentRank) { + * // If users/ada/rank has never been set, currentRank will be `null`. + * return currentRank + 1; + * }); + * + * @example + * // Try to create a user for ada, but only if the user id 'ada' isn't + * // already taken + * var adaRef = firebase.database().ref('users/ada'); + * adaRef.transaction(function(currentData) { + * if (currentData === null) { + * return { name: { first: 'Ada', last: 'Lovelace' } }; + * } else { + * console.log('User ada already exists.'); + * return; // Abort the transaction. + * } + * }, function(error, committed, snapshot) { + * if (error) { + * console.log('Transaction failed abnormally!', error); + * } else if (!committed) { + * console.log('We aborted the transaction (because ada already exists).'); + * } else { + * console.log('User ada added!'); + * } + * console.log("Ada's data: ", snapshot.val()); + * }); + * + * + * @param {function(*): *} transactionUpdate A developer-supplied function which + * will be passed the current data stored at this location (as a JavaScript + * object). The function should return the new value it would like written (as + * a JavaScript object). If `undefined` is returned (i.e. you return with no + * arguments) the transaction will be aborted and the data at this location + * will not be modified. + * @param {(function(?Error, boolean, + * ?firebase.database.DataSnapshot))=} onComplete A callback + * function that will be called when the transaction completes. The callback + * is passed three arguments: a possibly-null `Error`, a `boolean` indicating + * whether the transaction was committed, and a `DataSnapshot` indicating the + * final result. If the transaction failed abnormally, the first argument will + * be an `Error` object indicating the failure cause. If the transaction + * finished normally, but no data was committed because no data was returned + * from `transactionUpdate`, then second argument will be false. If the + * transaction completed and committed data to Firebase, the second argument + * will be true. Regardless, the third argument will be a `DataSnapshot` + * containing the resulting data in this location. + * @param {boolean=} applyLocally By default, events are raised each time the + * transaction update function runs. So if it is run multiple times, you may + * see intermediate states. You can set this to false to suppress these + * intermediate states and instead wait until the transaction has completed + * before events are raised. + * @return {!firebase.Promise<{ + * committed: boolean, + * snapshot: ?firebase.database.DataSnapshot + * }>} Returns a Promise that can optionally be used instead of the onComplete + * callback to handle success and failure. + */ +firebase.database.Reference.prototype.transaction = + function(transactionUpdate, onComplete, applyLocally) {}; + + +/** + * Sets a priority for the data at this database location. + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @param {string|number|null} priority + * @param {function(?Error)} onComplete + * @return {!firebase.Promise} + */ +firebase.database.Reference.prototype.setPriority = + function(priority, onComplete) {}; + + +/** + * @interface + * @extends {firebase.database.Reference} + * @extends {firebase.Thenable} + */ +firebase.database.ThenableReference = function() {}; + + +/** + * Generates a new child location using a unique key and returns its reference. + * + * This is the most common pattern for adding data to a collection of items. + * + * If you provide a value to `push()`, the value will be written to the + * generated location. If you don't pass a value, nothing will be written to the + * database and the child will remain empty (but you can use the reference + * elsewhere). + * + * The unique key generated by `push()` are ordered by the current time, so the + * resulting list of items will be chronologically sorted. The keys are also + * designed to be unguessable (they contain 72 random bits of entropy). + * + * + * See + * {@link + * https://firebase.google.com/docs/database/web/save-data#append_to_a_list_of_data + * Append to a list of data} + *
See + * {@link + * https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html + * The 2^120 Ways to Ensure Unique Identifiers} + * + * @example + * var messageListRef = firebase.database().ref('message_list'); + * var newMessageRef = messageListRef.push(); + * newMessageRef.set({ + * 'user_id': 'ada', + * 'text': 'The Analytical Engine weaves algebraical patterns just as the Jacquard loom weaves flowers and leaves.' + * }); + * // We've appended a new message to the message_list location. + * var path = newMessageRef.toString(); + * // path will be something like + * // 'https://sample-app.firebaseio.com/message_list/-IKo28nwJLH0Nc5XeFmj' + * + * @param {*=} value Optional value to be written at the generated location. + * @param {function(?Error)=} onComplete Callback called when write to server is + * complete. + * @return {!firebase.database.ThenableReference} Combined Promise and + * reference; resolves when write is complete, but can be used immediately as + * the reference to the child location. + */ +firebase.database.Reference.prototype.push = function(value, onComplete) {}; + + +/** + * Returns an `OnDisconnect` object - see + * {@link https://firebase.google.com/docs/database/web/offline-capabilities + * Offline Capabilities} for information on how to use it. + * + * @return {!firebase.database.OnDisconnect} + */ +firebase.database.Reference.prototype.onDisconnect = function() {}; + + +/** + * A `Query` sorts and filters the data at a database location so only a subset of + * the child data is included. This can be used to order a collection of data by + * some attribute (e.g. height of dinosaurs) as well as to restrict a large list + * of items (e.g. chat messages) down to a number suitable for synchronizing to + * the client. Queries are created by chaining together one or more of the + * filter methods defined here. + * + * Just as with a `Reference`, you can receive data from a Query by using the + * `on()` method. You will only receive events and `DataSnapshots` for the subset of + * the data that matches your query. + * + * Read our documentation on + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data} for more information. + * + * @interface + */ +firebase.database.Query = function() {} + + +/** + * Returns a `Reference` to the Query's location. + * + * @type {!firebase.database.Reference} + */ +firebase.database.Query.prototype.ref; + + +/** + * Returns whether or not the current and provided queries represent the same + * location, have the same query parameters, and are from the same instance of + * `firebase.app.App`. + * + * Two `Reference` objects are equivalent if they represent the same location + * and are from the same instance of `firebase.app.App`. + * + * Two `Query` objects are equivalent if they represent the same location, have + * the same query parameters, and are from the same instance of `firebase.app.App`. + * Equivalent queries share the same sort order, limits, and starting and + * ending points. + * + * @example + * var rootRef = firebase.database.ref(); + * var usersRef = rootRef.child("users"); + * + * usersRef.isEqual(rootRef); // false + * usersRef.isEqual(rootRef.child("users")); // true + * usersRef.parent.isEqual(rootRef); // true + * + * @example + * var rootRef = firebase.database.ref(); + * var usersRef = rootRef.child("users"); + * var usersQuery = usersRef.limitToLast(10); + * + * usersQuery.isEqual(usersRef); // false + * usersQuery.isEqual(usersRef.limitToLast(10)); // true + * usersQuery.isEqual(rootRef.limitToLast(10)); // false + * usersQuery.isEqual(usersRef.orderByKey().limitToLast(10)); // false + * + * @param {firebase.database.Query} other The query to compare against. + * @return {boolean} Whether or not the current and provided queries are equivalent. + */ +firebase.database.Query.prototype.isEqual = function(other) {}; + + +/** + * Listens for data changes at a particular location. + * + * This is the primary way to read data from a database. Your callback + * will be triggered for the initial data and again whenever the data changes. + * Use `off( )` to stop receiving updates. See + * {@link https://firebase.google.com/docs/database/web/retrieve-data Retrieve Data on the Web} + * for more details. + * + *

value event

+ * + * This event will trigger once with the initial data stored at this location, + * and then trigger again each time the data changes. The `DataSnapshot` passed to + * the callback will be for the location at which `on()` was called. It won't + * trigger until the entire contents has been synchronized. If the location has + * no data, it will be triggered with an empty `DataSnapshot` (`val()` will return + * `null`). + * + *

child_added event

+ * + * This event will be triggered once for each initial child at this location, + * and it will be triggered again every time a new child is added. The + * `DataSnapshot` passed into the callback will reflect the data for the relevant + * child. For ordering purposes, it is passed a second argument which is a + * string containing the key of the previous sibling child by sort order (or + * `null` if it is the first child). + * + *

child_removed event

+ * + * This event will be triggered once every time a child is removed. The + * `DataSnapshot` passed into the callback will be the old data for the child that + * was removed. A child will get removed when either: + * + * - a client explicitly calls `remove()` on that child or one of its ancestors + * - a client calls `set(null)` on that child or one of its ancestors + * - that child has all of its children removed + * - there is a query in effect which now filters out the child (because it's + * sort order changed or the max limit was hit) + * + *

child_changed event

+ * + * This event will be triggered when the data stored in a child (or any of its + * descendants) changes. Note that a single `child_changed` event may represent + * multiple changes to the child. The `DataSnapshot` passed to the callback will + * contain the new child contents. For ordering purposes, the callback is also + * passed a second argument which is a string containing the key of the previous + * sibling child by sort order (or `null` if it is the first child). + * + *

child_moved event

+ * + * This event will be triggered when a child's sort order changes such that its + * position relative to its siblings changes. The `DataSnapshot` passed to the + * callback will be for the data of the child that has moved. It is also passed + * a second argument which is a string containing the key of the previous + * sibling child by sort order (or `null` if it is the first child). + * + * @example Handle a new value: + * ref.on('value', function(dataSnapshot) { + * ... + * }); + * + * @example Handle a new child: + * ref.on('child_added', function(childSnapshot, prevChildKey) { + * ... + * }); + * + * @example Handle child removal: + * ref.on('child_removed', function(oldChildSnapshot) { + * ... + * }); + * + * @example Handle child data changes: + * ref.on('child_changed', function(childSnapshot, prevChildKey) { + * ... + * }); + * + * @example Handle child ordering changes: + * ref.on('child_moved', function(childSnapshot, prevChildKey) { + * ... + * }); + * + * @param {!string} eventType One of the following strings: "value", + * "child_added", "child_changed", "child_removed", or "child_moved." + * @param {!function(firebase.database.DataSnapshot, string=)} callback A + * callback that fires when the specified event occurs. The callback will be + * passed a DataSnapshot. For ordering purposes, "child_added", + * "child_changed", and "child_moved" will also be passed a string containing + * the key of the previous child, by sort order (or `null` if it is the + * first child). + * @param {(function(Error)|Object)=} cancelCallbackOrContext An optional + * callback that will be notified if your event subscription is ever canceled + * because your client does not have permission to read this data (or it had + * permission but has now lost it). This callback will be passed an `Error` + * object indicating why the failure occurred. + * @param {Object=} context If provided, this object will be used as this when + * calling your callback(s). + * @return {!function(firebase.database.DataSnapshot, string=)} The provided + * callback function is returned unmodified. This is just for convenience if + * you want to pass an inline function to `on()` but store the callback function + * for later passing to `off()`. + */ +firebase.database.Query.prototype.on = + function(eventType, callback, cancelCallbackOrContext, context) {}; + + +/** + * Detaches a callback previously attached with `on()`. + * + * Detach a callback previously attached with `on()`. Note that if `on()` was called + * multiple times with the same eventType and callback, the callback will be + * called multiple times for each event, and `off()` must be called multiple times + * to remove the callback. Calling `off()` on a parent listener will not + * automatically remove listeners registered on child nodes, `off()` must also be + * called on any child listeners to remove the callback. + * + * If a callback is not specified, all callbacks for the specified eventType + * will be removed. Similarly, if no eventType or callback is specified, all + * callbacks for the reference will be removed. + * + * @example + * var onValueChange = function(dataSnapshot) { ... }; + * ref.on('value', onValueChange); + * ref.child('meta-data').on('child_added', onChildAdded); + * // Sometime later... + * ref.off('value', onValueChange); + * + * // You must also call off() for any child listeners on ref + * // to cancel those callbacks + * ref.child('meta-data').off('child_added', onValueAdded); + * + * @example + * // Or you can save a line of code by using an inline function + * // and on()'s return value. + * var onValueChange = ref.on('value', function(dataSnapshot) { ... }); + * // Sometime later... + * ref.off('value', onValueChange); + * + * @param {string=} eventType One of the following strings: "value", + * "child_added", "child_changed", "child_removed", or "child_moved." + * @param {function(!firebase.database.DataSnapshot, ?string=)=} callback The + * callback function that was passed to `on()`. + * @param {Object=} context The context that was passed to `on()`. + */ +firebase.database.Query.prototype.off = + function(eventType, callback, context) {}; + + +/** + * Listens for exactly one event of the specified event type, and then stops listening. + * + * This is equivalent to calling `on()`, and then calling `off()` inside the + * callback function. see `on()` for details on the event types. + * + * @example + * // Basic usage of .once() to read the data located at ref. + * ref.once('value') + * .then(function(dataSnapshot) { + * // handle read data. + * }); + * + * @param {!string} eventType One of the following strings: "value", + * "child_added", "child_changed", "child_removed", or "child_moved." + * @param {function(!firebase.database.DataSnapshot, string=)=} successCallback A + * callback that fires when the specified event occurs. The callback will be + * passed a DataSnapshot. For ordering purposes, "child_added", + * "child_changed", and "child_moved" will also be passed a string containing + * the key of the previous child, by sort order (or `null` if it is the + * first child). + * @param {(function(Error)|Object)=} failureCallbackOrContext An optional + * callback that will be notified if your client does not have permission to + * read the data. This callback will be passed an `Error` object indicating + * why the failure occurred. + * @param {Object=} context If provided, this object will be used as this when + * calling your callback(s). + * @return {!firebase.Promise<*>} + */ +firebase.database.Query.prototype.once = function(eventType, successCallback, failureCallbackOrContext, context) {}; + + +/** + * Generates a new Query limited to the first specific number of children. + * + * The `limitToFirst()` method is used to set a maximum number of children to be + * synced for a given callback. If we set a limit of 100, we will initially only + * receive up to 100 `child_added` events. If we have less than 100 messages + * stored in our database, a `child_added` event will fire for each message. + * However, if we have over 100 messages, we will only receive a `child_added` + * event for the first 100 ordered messages. As items change, we will receive + * `child_removed` events for each item that drops out of the active list, so that + * the total number stays at 100. + * + * You can read more about `limitToFirst()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * // Find the two shortest dinosaurs. + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByChild("height").limitToFirst(2).on("child_added", function(snapshot) { + * // This will be called exactly two times (unless there are less than two + * // dinosaurs in the database. + * + * // It will also get fired again if one of the first two dinosaurs is + * // removed from the data set, as a new dinosaur will now be the second + * // shortest. + * console.log(snapshot.key); + * }); + * + * @param {!number} limit The maximum number of nodes to include in this query. + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.limitToFirst = function(limit) {}; + + +/** + * Generates a new Query object limited to the last specific number of children. + * + * The `limitToLast()` method is used to set a maximum number of children to be + * synced for a given callback. If we set a limit of 100, we will initially only + * receive up to 100 `child_added` events. If we have less than 100 messages + * stored in our database, a `child_added` event will fire for each message. + * However, if we have over 100 messages, we will only receive a `child_added` + * event for the last 100 ordered messages. As items change, we will receive + * `child_removed` events for each item that drops out of the active list, so that + * the total number stays at 100. + * + * You can read more about `limitToLast()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * // Find the two heaviest dinosaurs. + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByChild("weight").limitToLast(2).on("child_added", function(snapshot) { + * // This callback will be triggered exactly two times, unless there are less + * // than two dinosaurs stored in the database. It will also get fired for + * // every new, heavier dinosaur that gets added to the data set. + * console.log(snapshot.key); + * }); + * + * @param {!number} limit The maximum number of nodes to include in this query. + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.limitToLast = function(limit) {}; + + +/** + * Generates a new Query object ordered by the specified child key. + * + * Queries can only order by one key at a time. Calling `orderByChild()` multiple + * times on the same query is an error. + * + * Firebase queries allow you to order your data by any child key, on the fly. + * However, if you know in advance what your indexes will be, you can define + * them via the .indexOn rule in your Security Rules for better performance. See + * the {@link https://firebase.google.com/docs/database/security/indexing-data + * .indexOn} rule for more information. + * + * You can read more about `orderByChild()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByChild("height").on("child_added", function(snapshot) { + * console.log(snapshot.key + " was " + snapshot.val().height + " meters tall"); + * }); + * + * @param {!string} path + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.orderByChild = function(path) {}; + + +/** + * Generates a new Query object ordered by key. + * + * Sorts the results of a query by their (ascending) key value. + * + * You can read more about `orderByKey()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByKey().on("child_added", function(snapshot) { + * console.log(snapshot.key); + * }); + * + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.orderByKey = function() {}; + + +/** + * Generates a new `Query` object order by priority. + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.orderByPriority = function() {}; + + +/** + * Generates a new Query object ordered by child values. + * + * If the children of a query are all scalar values (numbers or strings), you + * can order the results by their (ascending) values. + * + * You can read more about `orderByValue()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * var scoresRef = firebase.database().ref("scores"); + * scoresRef.orderByValue().limitToLast(3).on("value", function(snapshot) { + * snapshot.forEach(function(data) { + * console.log("The " + data.key + " score is " + data.val()); + * }); + * }); + * + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.orderByValue = function() {}; + + +/** + * Creates a Query with the specified starting point. + * + * Using `startAt()`, `endAt()`, and `equalTo()` allows you to choose arbitrary + * starting and ending points for your queries. + * + * The starting point is inclusive, so children with exactly the specified value + * will be included in the query. The optional key argument can be used to + * further limit the range of the query. If it is specified, then children that + * have exactly the specified value must also have a key name greater than or + * equal to the specified key. + * + * You can read more about `startAt()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * // Find all dinosaurs that are at least three meters tall. + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByChild("height").startAt(3).on("child_added", function(snapshot) { + * console.log(snapshot.key) + * }); + * + * @param {number|string|boolean|null} value The value to start at. The argument + * type depends on which `orderBy*()` function was used in this query. Specify a + * value that matches the `orderBy*()` type. When used in combination with + * `orderByKey()`, the value must be a string. + * @param {string=} key The child key to start at. This argument is allowed if + * ordering by child, value, or priority. + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.startAt = function(value, key) {}; + + +/** + * Creates a Query with the specified ending point. + * + * Using `startAt()`, `endAt()`, and `equalTo()` allows you to choose arbitrary + * starting and ending points for your queries. + * + * The ending point is inclusive, so children with exactly the specified value + * will be included in the query. The optional key argument can be used to + * further limit the range of the query. If it is specified, then children that + * have exactly the specified value must also have a key name less than or equal + * to the specified key. + * + * You can read more about `endAt()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * // Find all dinosaurs whose names come before Pterodactyl lexicographically. + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByKey().endAt("pterodactyl").on("child_added", function(snapshot) { + * console.log(snapshot.key); + * }); + * + * @param {number|string|boolean|null} value The value to end at. The argument + * type depends on which `orderBy*()` function was used in this query. Specify a + * value that matches the `orderBy*()` type. When used in combination with + * `orderByKey()`, the value must be a string. + * @param {string=} key The child key to end at, among the children with the + * previously specified priority. This argument is only allowed if ordering by + * priority. + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.endAt = function(value, key) {}; + + +/** + * Creates a Query which includes children which match the specified value. + * + * Using `startAt()`, `endAt()`, and `equalTo()` allows us to choose arbitrary + * starting and ending points for our queries. + * + * The optional key argument can be used to further limit the range of the + * query. If it is specified, then children that have exactly the specified + * value must also have exactly the specified key as their key name. This can be + * used to filter result sets with many matches for the same value. + * + * You can read more about `equalTo()` in + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}. + * + * @example + * // Find all dinosaurs whose height is exactly 25 meters. + * var ref = firebase.database().ref("dinosaurs"); + * ref.orderByChild("height").equalTo(25).on("child_added", function(snapshot) { + * console.log(snapshot.key); + * }); + * + * @param {number|string|boolean|null} value The value to match for. The + * argument type depends on which `orderBy*()` function was used in this query. + * Specify a value that matches the `orderBy*()` type. When used in combination + * with `orderByKey()`, the value must be a string. + * @param {string=} key The child key to start at, among the children with the + * previously specified priority. This argument is only allowed if ordering by + * priority. + * @return {!firebase.database.Query} + */ +firebase.database.Query.prototype.equalTo = function(value, key) {}; + + +/** + * Get the absolute URL for this location. + * + * The `toString()` method returns a URL that is ready to be put into a browser, + * curl command, or a `firebase.database().refFromURL()` call. Since all of those + * expect the URL to be url-encoded, `toString()` returns an encoded URL. + * + * Append '.json' to the URL when typed into a browser to download JSON + * formatted data. If the location is secured (not publicly readable) you will + * get a permission-denied error. + * + * @example + * // Calling toString() on a root Firebase reference returns the URL where its + * // data is stored within the database: + * var rootRef = firebase.database().ref(); + * var rootUrl = rootRef.toString(); + * // rootUrl === "https://sample-app.firebaseio.com/". + * + * // Calling toString() at a deeper Firebase reference returns the URL of that + * // deep path within the database: + * var adaRef = rootRef.child('users/ada'); + * var adaURL = adaRef.toString(); + * // adaURL === "https://sample-app.firebaseio.com/users/ada". + * + * @return {string} The absolute URL for this location. + * @override + */ +firebase.database.Query.prototype.toString = function() {}; + + +/** + * A `DataSnapshot` contains data from a database location. + * + * Any time you read data from the database, you receive the data as a + * `DataSnapshot`. A `DataSnapshot` is passed to the event callbacks you attach with + * `on()` or `once()`. You can extract the contents of the snapshot as a JavaScript + * object by calling the `val()` method. Alternatively, you can traverse into the + * snapshot by calling `child()` to return child snapshots (which you could then + * call `val()` on). + * + * A `DataSnapshot` is an efficiently-generated, immutable copy of the data at a + * database location. It cannot be modified and will never change (to modify + * data, you always call the `set()` method on a `Reference` directly). + * + * @interface + */ +firebase.database.DataSnapshot = function() {}; + + +/** + * Extract a JavaScript value from a `DataSnapshot`. + * + * Depending on the data in a `DataSnapshot`, the `val()` method may return a + * scalar type (string, number, or boolean), an array, or an object. It may also + * return null, indicating that the `DataSnapshot` is empty (contains no data). + * + * @example + * // Write and then read-back a string from the database. + * ref.set("hello") + * .then(function() { + * return ref.once("value"); + * }) + * .then(function(snapshot) { + * var data = snapshot.val(); // data === "hello" + * }); + * + * @example + * // Write and then read-back a JavaScript Object from the database. + * ref.set({ name: "Ada", age: 36 }) + * .then(function() { + * return ref.once("value"); + * }) + * .then(function(snapshot) { + * var data = snapshot.val(); + * // data is { "name": "Ada", "age": 36 } + * // data.name === "Ada" + * // data.age === 36 + * }); + * + * @return {*} The DataSnapshot's contents as a JavaScript value (Object, + * Array, string, number, boolean, or null). + */ +firebase.database.DataSnapshot.prototype.val = function() {}; + + +/** + * Exports the entire contents of the DataSnapshot as a JavaScript object. + * + * The `exportVal()` method is similar to `val()`, except priority information is + * included (if available), making it suitable for backing up your data. + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @return {*} + */ +firebase.database.DataSnapshot.prototype.exportVal = function() {}; + + +/** + * Returns true if this `DataSnapshot` contains any data. It is slightly more + * efficient than using `snapshot.val() !== null`. + * + * @example + * // Assume we have the following data in our database: + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * // Test for the existence of certain keys within a DataSnapshot + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var a = snapshot.exists(); // true + * var b = snapshot.child("name").exists(); // true + * var c = snapshot.child("name/first").exists(); // true + * var d = snapshot.child("name/middle").exists(); // false + * }); + * + * @return {boolean} + */ +firebase.database.DataSnapshot.prototype.exists = function() {}; + + +/** + * Gets another `DataSnapshot` for the location at the specified relative path. + * + * Passing a relative path to the `child()` method of a DataSnapshot returns + * another `DataSnapshot` for the location at the specified relative path. The + * relative path can either be a simple child name (e.g. "ada") or a deeper, + * slash-separated path (e.g. "ada/name/first"). If the child location has no + * data, an empty `DataSnapshot` (that is, a `DataSnapshot` whose value is null) is + * returned. + * + * @example + * // Assume we have the following data in our database: + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * // Test for the existence of certain keys within a DataSnapshot + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var name = snapshot.child("name").val(); // { first: "Ada", last: "Lovelace"} + * var firstName = snapshot.child("name/first").val(); // "Ada" + * var lastName = snapshot.child("name").child("last").val(); // "Lovelace" + * var age = snapshot.child("age").val(); // null + * }); + * + * @param {string} path A relative path to the location of child data. + * @return {!firebase.database.DataSnapshot} + */ +firebase.database.DataSnapshot.prototype.child = function(path) {}; + + +/** + * Returns true if the specified child path has (non-null) data. + * + * @example + * // Assume we have the following data in the database + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * // Determine which child keys in DataSnapshot have data. + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var hasName = snapshot.hasChild("name"); // true + * var hasAge = snapshot.hasChild("age"); // false + * }); + * + * @param {string} path A relative path to the location of a potential child. + * @return {boolean} true if data exists at the specified child path; else false. + */ +firebase.database.DataSnapshot.prototype.hasChild = function(path) {}; + + +/** + * Gets the priority value of the data in this `DataSnapshot`. + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @return {string|number|null} + */ +firebase.database.DataSnapshot.prototype.getPriority = function() {}; + + +/** + * Enumerates the top-level children in the `DataSnapshot`. + * + * Because of the way JavaScript Objects work, the ordering of data in the + * JavaScript Object returned by `val()` is not guaranteed to match the ordering + * on the server nor the ordering of `child_added` events. That is where + * `forEach()` comes in handy. It guarantees the children of a `DataSnapshot` + * will be iterated in their query-order. + * + * If no explicit `orderBy*()` method is used, results are returned + * ordered by key (unless priorities are used, in which case results are + * returned by priority). + * + * @example + * + * // Assume we have the following data in our database: + * { + * "users": { + * "ada": { + * "first": "Ada", + * "last": "Lovelace" + * }, + * "alan": { + * "first": "Alan", + * "last": "Turing" + * } + * } + * } + * + * // Loop through users in order with the forEach() method. The callback provided + * // to will be called synchronously with a DataSnapshot for each child: + * var query = firebase.database().ref("users").orderByKey(); + * query.once("value") + * .then(function(snapshot) { + * snapshot.forEach(function(childSnapshot) { + * // key will be "ada" the first time and "alan" the second time + * var key = childSnapshot.key; + * // childData will be the actual contents of the child + * var childData = childSnapshot.val(); + * }); + * }); + * + * @example + * // You can cancel the enumeration at any point by having your callback + * // function return true. For example, the following code sample will only fire + * // the callback function one time. + * var query = firebase.database().ref("users").orderByKey(); + * query.once("value") + * .then(function(snapshot) { + * snapshot.forEach(function(childSnapshot) { + * var key = childSnapshot.key; // "ada" + * + * // Cancel enumeration + * return true; + * }); + * }); + * + * @param {function(!firebase.database.DataSnapshot): boolean} action A function + * which will be called for each child DataSnapshot. The callback can return + * true to cancel further enumeration. + * @return {boolean} true if enumeration was canceled due to your callback + * returning true. + */ +firebase.database.DataSnapshot.prototype.forEach = function(action) {}; + + +/** + * Returns true if the DataSnapshot child properties. + * + * You can use `hasChildren()` to determine if a `DataSnapshot` has any children. If + * it does, you can enumerate them using `forEach()`. If it does not, then either + * this snapshot contains a primitive value (which can be retrieved with `val()`) + * or it is empty (in which case `val()` will return `null`). + * + * @example + * // Assume we have the following data in the database + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var a = snapshot.hasChildren(); // true + * var b = snapshot.child("name").hasChildren(); // true + * var c = snapshot.child("name/first").hasChildren(); // false + * }); + * + * @return {boolean} true if this snapshot has any children; else false. + */ +firebase.database.DataSnapshot.prototype.hasChildren = function() {}; + + +/** + * The key (last part of the path) of the location of this `DataSnapshot`. + * + * The last token in a database location is considered its key. For example, + * "ada" is the key for the /users/ada/ node. Accessing the key on any + * `DataSnapshot` will return the key for the location that generated it. + * However, accessing the key on the root URL of a database will return `null`. + * + * @example + * // Assume we have the following data in the database + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var key = snapshot.key; // "ada" + * var childKey = snapshot.child("name/last"); // "last" + * }); + * + * @example + * var rootRef = firebase.database().ref(); + * ref.once("value") + * .then(function(snapshot) { + * var key = snapshot.key; // null + * var childKey = snapshot.child("users/ada"); // "ada" + * }); + * + * @type {string|null} + */ +firebase.database.DataSnapshot.prototype.key; + + +/** + * Return the number of child properties of this `DataSnapshot`. + * + * @example + * // Assume we have the following data in the database + * { + * "name": { + * "first": "Ada", + * "last": "Lovelace" + * } + * } + * + * var ref = firebase.database().ref("users/ada"); + * ref.once("value") + * .then(function(snapshot) { + * var a = snapshot.numChildren(); // 1 ("name") + * var b = snapshot.child("name").numChildren(); // 2 ("first", "last") + * var c = snapshot.child("name/first").numChildren(); // 0 + * }); + * + * @return {number} + */ +firebase.database.DataSnapshot.prototype.numChildren = function() {}; + + +/** + * The `Reference` for the location that generated this `DataSnapshot`. + * + * @type {!firebase.database.Reference} + */ +firebase.database.DataSnapshot.prototype.ref; + + + +/** + * The `onDisconnect` class allows you to write or clear data when your client + * disconnects from the database server. These updates occur whether your + * client disconnects cleanly or not, so you can rely on them to clean up data + * even if a connection is dropped or a client crashes. + * + * The `onDisconnect` class is most commonly used to manage presence in + * applications where it is useful to detect how many clients are connected and + * when other clients disconnect. See + * {@link https://firebase.google.com/docs/database/web/offline-capabilities + * Offline Capabilities} for more information. + * + * Note that these functions should be called before any data is written to + * avoid problems if a connection is dropped before the requests can be + * transferred to the database server. + * + * Note that `onDisconnect` operations are only triggered once. If you want an + * operation to occur each time a disconnect occurs, you'll need to re-establish + * the `onDisconnect` operations each time you reconnect. + * + * @interface + */ +firebase.database.OnDisconnect = function() {}; + + +/** + * Cancels all previously queued `onDisconnect()` set or update events for this + * location and all children. + * + * If a write has been queued for this location via a `set()` or `update()` at a + * parent location, the write at this location will be canceled though all other + * siblings will still be written. + * + * @example + * var ref = firebase.database().ref("onlineState"); + * ref.onDisconnect().set(false); + * ... + * // nevermind + * ref.onDisconnect().cancel(); + * + * @param {function(?Error)=} onComplete An optional callback function that will + * be called when synchronization to the server has completed. The callback + * will be passed a single parameter: null for success, or an Error object + * indicating a failure. + * @return {!firebase.Promise} Resolves when synchronization to the server + * is complete. + */ +firebase.database.OnDisconnect.prototype.cancel = function(onComplete) {}; + + +/** + * Ensures the data at this location is deleted when the client is disconnected + * (due to closing the browser, navigating to a new page, or network issues). + * + * @param {function(?Error)=} onComplete An optional callback function that will + * be called when synchronization to the server has completed. The callback + * will be passed a single parameter: null for success, or an Error object + * indicating a failure. + * @return {!firebase.Promise} Resolves when synchronization to the server + * is complete. + */ +firebase.database.OnDisconnect.prototype.remove = function(onComplete) {}; + +/** + * Ensures the data at this location is set to the specified value when the + * client is disconnected (due to closing the browser, navigating to a new page, + * or network issues). + * + * Ensure the data at this location is set to the specified value when the + * client is disconnected (due to closing the browser, navigating to a new page, + * or network issues). + * + * `set()` is especially useful for implementing "presence" systems, where a value + * should be changed or cleared when a user disconnects so that he appears + * "offline" to other users. See + * {@link https://firebase.google.com/docs/database/web/offline-capabilities + * Offline Capabilities} for more information. + * + * Note that `onDisconnect` operations are only triggered once. If you want an + * operation to occur each time a disconnect occurs, you'll need to re-establish + * the `onDisconnect` operations each time. + * + * @example + * var ref = firebase.database().ref("users/ada/status"); + * ref.onDisconnect().set("I disconnected!"); + * + * @param {*} value The value to be written to this location on + * disconnect (can be an object, array, string, number, boolean, or null). + * @param {function(?Error)=} onComplete An optional callback function that will + * be called when synchronization to the database server has completed. The + * callback will be passed a single parameter: null for success, or an Error + * object indicating a failure. + * @return {!firebase.Promise} Resolves when synchronization to the + * database is complete. + */ +firebase.database.OnDisconnect.prototype.set = + function(value, onComplete) {}; + + +/** + * Ensures the data at this location is set to the specified value and priority + * when the client is disconnected (due to closing the browser, navigating to a + * new page, or network issues). + * + * Applications need not use priority, but can order collections by + * ordinary properties (see + * {@link + * https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data + * Sorting and filtering data}). + * + * @param {*} value + * @param {number|string|null} priority + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ +firebase.database.OnDisconnect.prototype.setWithPriority = + function(value, priority, onComplete) {}; + + +/** + * Writes multiple values this location when the client is disconnected (due to + * closing the browser, navigating to a new page, or network issues). + * + * The `values` argument contains multiple property/value pairs that will be + * written to the database together. Each child property can either be a simple + * property (for example, "name"), or a relative path (for example, + * "name/first") from the current location to the data to update. + * + * As opposed to the `set()` method, `update()` can be use to selectively update + * only the referenced properties at the current location (instead of replacing + * all the child properties at the current location). + * + * See {@link firebase.database.Reference#update} for examples of using + * the connected version of `update`. + * + * @example + * var ref = firebase.database().ref("users/ada"); + * ref.update({ + * onlineState: true, + * status: "I'm online." + * }); + * ref.onDisconnect.update({ + * onlineState: false, + * status: "I'm offline." + * }); + * + * @param {!Object} values Object containing multiple values. + * @param {function(?Error)=} onComplete An optional callback function that will + * be called when synchronization to the server has completed. The + * callback will be passed a single parameter: null for success, or an Error + * object indicating a failure. + * @return {!firebase.Promise} Resolves when synchronization to the + * database is complete. + */ +firebase.database.OnDisconnect.prototype.update = + function(values, onComplete) {}; diff --git a/lib/firebase/firebase-database.js b/lib/firebase/firebase-database.js new file mode 100644 index 00000000..438f9680 --- /dev/null +++ b/lib/firebase/firebase-database.js @@ -0,0 +1,244 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +(function() {var g,n=this;function p(a){return void 0!==a}function aa(){}function ba(a){a.Wb=function(){return a.bf?a.bf:a.bf=new a}} +function ca(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; +else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function da(a){return"array"==ca(a)}function ea(a){var b=ca(a);return"array"==b||"object"==b&&"number"==typeof a.length}function q(a){return"string"==typeof a}function fa(a){return"number"==typeof a}function ga(a){return"function"==ca(a)}function ha(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)} +function ja(a,b,c){if(!a)throw Error();if(2e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.N[0];c=a.N[1];for(var h=a.N[2],k=a.N[3],m=a.N[4],l,e=0;80>e;e++)40>e?20>e?(f=k^c&(h^k),l=1518500249):(f=c^h^k,l=1859775393):60>e?(f=c&h|k&(c|h),l=2400959708):(f=c^h^k,l=3395469782),f=(b<< +5|b>>>27)+f+m+l+d[e]&4294967295,m=k,k=h,h=(c<<30|c>>>2)&4294967295,c=b,b=f;a.N[0]=a.N[0]+b&4294967295;a.N[1]=a.N[1]+c&4294967295;a.N[2]=a.N[2]+h&4294967295;a.N[3]=a.N[3]+k&4294967295;a.N[4]=a.N[4]+m&4294967295} +ma.prototype.update=function(a,b){if(null!=a){p(b)||(b=a.length);for(var c=b-this.Ya,d=0,e=this.Wd,f=this.ac;db?e+="000":256>b?e+="00":4096>b&&(e+="0");return Da[a]=e+b.toString(16)}),'"')};var v;a:{var Fa=n.navigator;if(Fa){var Ga=Fa.userAgent;if(Ga){v=Ga;break a}}v=""};function Ha(a){if(Error.captureStackTrace)Error.captureStackTrace(this,Ha);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}ka(Ha,Error);Ha.prototype.name="CustomError";var w=Array.prototype,Ia=w.indexOf?function(a,b,c){return w.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;cc?null:q(a)?a.charAt(c):a[c]}function Pa(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f=arguments.length?w.slice.call(a,b):w.slice.call(a,b,c)} +function Sa(a,b){a.sort(b||Ta)}function Ta(a,b){return a>b?1:aparseFloat(a))?String(b):a})();var Ya=null,Za=null,$a=null;function ab(a,b){if(!ea(a))throw Error("encodeByteArray takes an array as a parameter");bb();for(var c=b?Za:Ya,d=[],e=0;e>2,f=(f&3)<<4|k>>4,k=(k&15)<<2|l>>6,l=l&63;m||(l=64,h||(k=64));d.push(c[u],c[f],c[k],c[l])}return d.join("")} +function bb(){if(!Ya){Ya={};Za={};$a={};for(var a=0;65>a;a++)Ya[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),Za[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a),$a[Za[a]]=a,62<=a&&($a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a)]=a)}};function cb(a){n.setTimeout(function(){throw a;},0)}var db; +function eb(){var a=n.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&-1==v.indexOf("Presto")&&(a=function(){var a=document.createElement("iframe");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=r(function(a){if(("*"==d||a.origin== +d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&-1==v.indexOf("Trident")&&-1==v.indexOf("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(p(c.next)){c=c.next;var a=c.Le;c.Le=null;a()}};return function(a){d.next={Le:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("script")?function(a){var b= +document.createElement("script");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){n.setTimeout(a,0)}};function fb(a,b){gb||hb();ib||(gb(),ib=!0);jb.push(new kb(a,b))}var gb;function hb(){if(n.Promise&&n.Promise.resolve){var a=n.Promise.resolve();gb=function(){a.then(lb)}}else gb=function(){var a=lb;!ga(n.setImmediate)||n.Window&&n.Window.prototype&&n.Window.prototype.setImmediate==n.setImmediate?(db||(db=eb()),db(a)):n.setImmediate(a)}}var ib=!1,jb=[];[].push(function(){ib=!1;jb=[]}); +function lb(){for(;jb.length;){var a=jb;jb=[];for(var b=0;bc&&(e=0===c?"none":"no more than "+c);if(e)throw Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+".");}function Db(a,b,c){var d="";switch(b){case 1:d=c?"first":"First";break;case 2:d=c?"second":"Second";break;case 3:d=c?"third":"Third";break;case 4:d=c?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}return a=a+" failed: "+(d+" argument ")} +function A(a,b,c,d){if((!d||p(c))&&!ga(c))throw Error(Db(a,b,d)+"must be a valid function.");}function Eb(a,b,c){if(p(c)&&(!ha(c)||null===c))throw Error(Db(a,b,!0)+"must be a valid context object.");};function Fb(a){var b=[];Cb(a,function(a,d){da(d)?Ja(d,function(d){b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.join("&"):""};var Gb=n.Promise||mb;mb.prototype["catch"]=mb.prototype.Ag;function Hb(){var a=this;this.reject=this.resolve=null;this.sa=new Gb(function(b,c){a.resolve=b;a.reject=c})}function Ib(a,b){return function(c,d){c?a.reject(c):a.resolve(d);ga(b)&&(Jb(a.sa),1===b.length?b(c):b(c,d))}}function Jb(a){a.then(void 0,aa)};function Kb(a,b){if(!a)throw Lb(b);}function Lb(a){return Error("Firebase Database ("+firebase.SDK_VERSION+") INTERNAL ASSERT FAILED: "+a)};function Mb(a){for(var b=[],c=0,d=0;d=e&&(e-=55296,d++,Kb(de?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b}function Nb(a){for(var b=0,c=0;cd?b++:2048>d?b+=2:55296<=d&&56319>=d?(b+=4,c++):b+=3}return b};function Ob(a){return"undefined"!==typeof JSON&&p(JSON.parse)?JSON.parse(a):za(a)}function B(a){if("undefined"!==typeof JSON&&p(JSON.stringify))a=JSON.stringify(a);else{var b=[];Ba(new Aa,a,b);a=b.join("")}return a};function Pb(a,b){this.committed=a;this.snapshot=b};function Qb(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:"")};function Rb(a){this.te=a;this.Bd=[];this.Rb=0;this.Yd=-1;this.Gb=null}function Sb(a,b,c){a.Yd=b;a.Gb=c;a.Yd");return a};function jc(){this.uc={}}function kc(a,b,c){p(c)||(c=1);Bb(a.uc,b)||(a.uc[b]=0);a.uc[b]+=c}jc.prototype.get=function(){return ya(this.uc)};function lc(a){this.Nf=a;this.rd=null}lc.prototype.get=function(){var a=this.Nf.get(),b=ya(a);if(this.rd)for(var c in this.rd)b[c]-=this.rd[c];this.rd=a;return b};function mc(){this.wb=[]}function nc(a,b){for(var c=null,d=0;d>4);64!=k&&(d.push(h<<4&240|k>>2),64!=m&&d.push(k<<6&192|m))}if(8192>d.length)b=String.fromCharCode.apply(null,d);else{a="";for(c=0;ca.ac?a.update(a.zd,56-a.ac):a.update(a.zd,a.Ya-(a.ac-56));for(var d=a.Ya-1;56<=d;d--)a.Wd[d]=c&255,c/=256;na(a,a.Wd);for(d=c=0;5>d;d++)for(var e=24;0<=e;e-=8)b[c]=a.N[d]>>e&255,++c;return ab(b)}function Vc(a){for(var b="",c=0;c.firebaseio.com instead"); +c&&"undefined"!=c||$c("Cannot parse Firebase url. Please use https://.firebaseio.com");d||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&O("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");return{kc:new gc(b,d,c,"ws"===e||"wss"===e),path:new L(f)}}function bd(a){return fa(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)} +function cd(a){if("complete"===document.readyState)a();else{var b=!1,c=function(){document.body?b||(b=!0,a()):setTimeout(c,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",c,!1),window.addEventListener("load",c,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&c()}),window.attachEvent("onload",c))}} +function Hc(a,b){if(a===b)return 0;if("[MIN_NAME]"===a||"[MAX_NAME]"===b)return-1;if("[MIN_NAME]"===b||"[MAX_NAME]"===a)return 1;var c=dd(a),d=dd(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:aa?c.push(a.substring(d,a.length)):c.push(a.substring(d,d+b));return c}function hd(a,b){if(da(a))for(var c=0;ca,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;--a)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;--a)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join("");c="";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&& +(d="0"+d),c+=d;return c.toLowerCase()}var jd=/^-?\d{1,10}$/;function dd(a){return jd.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Ub(a){try{a()}catch(b){setTimeout(function(){O("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function kd(a,b,c){Object.defineProperty(a,b,{get:c})}function ld(a,b){var c=setTimeout(a,b);"object"===typeof c&&c.unref&&c.unref();return c};function md(a){var b={},c={},d={},e="";try{var f=a.split("."),b=Ob(Tc(f[0])||""),c=Ob(Tc(f[1])||""),e=f[2],d=c.d||{};delete c.d}catch(h){}return{Fg:b,Me:c,data:d,xg:e}}function nd(a){a=md(a);var b=a.Me;return!!a.xg&&!!b&&"object"===typeof b&&b.hasOwnProperty("iat")}function od(a){a=md(a).Me;return"object"===typeof a&&!0===x(a,"admin")};function pd(a,b,c){this.f=Yc("p:rest:");this.M=a;this.Hb=b;this.Vd=c;this.aa={}}function qd(a,b){if(p(b))return"tag$"+b;H(rd(a.n),"should have a tag if it's not a default query.");return a.path.toString()}g=pd.prototype; +g.df=function(a,b,c,d){var e=a.path.toString();this.f("Listen called for "+e+" "+a.ka());var f=qd(a,c),h={};this.aa[f]=h;a=sd(a.n);var k=this;td(this,e+".json",a,function(a,b){var u=b;404===a&&(a=u=null);null===a&&k.Hb(e,u,!1,c);x(k.aa,f)===h&&d(a?401==a?"permission_denied":"rest_error:"+a:"ok",null)})};g.Ef=function(a,b){var c=qd(a,b);delete this.aa[c]};g.qf=function(){};g.re=function(){};g.gf=function(){};g.xd=function(){};g.put=function(){};g.ef=function(){};g.ye=function(){}; +function td(a,b,c,d){c=c||{};c.format="export";a.Vd.getToken(!1).then(function(e){(e=e&&e.accessToken)&&(c.auth=e);var f=(a.M.Sc?"https://":"http://")+a.M.host+b+"?"+Fb(c);a.f("Sending REST request for "+f);var h=new XMLHttpRequest;h.onreadystatechange=function(){if(d&&4===h.readyState){a.f("REST Response for "+f+" received. status:",h.status,"response:",h.responseText);var b=null;if(200<=h.status&&300>h.status){try{b=Ob(h.responseText)}catch(c){O("Failed to parse JSON response for "+f+": "+h.responseText)}d(null, +b)}else 401!==h.status&&404!==h.status&&O("Got unsuccessful REST response for "+f+" Status: "+h.status),d(h.status);d=null}};h.open("GET",f,!0);h.send()})};function vd(a,b,c){this.type=wd;this.source=a;this.path=b;this.children=c}vd.prototype.Nc=function(a){if(this.path.e())return a=this.children.subtree(new L(a)),a.e()?null:a.value?new $b(this.source,C,a.value):new vd(this.source,C,a);H(J(this.path)===a,"Can't get a merge for a child not on the path of the operation");return new vd(this.source,D(this.path),this.children)};vd.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"};function xd(a,b){this.zf={};this.Vc=new lc(a);this.wa=b;var c=1E4+2E4*Math.random();ld(r(this.rf,this),Math.floor(c))}xd.prototype.rf=function(){var a=this.Vc.get(),b={},c=!1,d;for(d in a)0=a.length){var b=Number(a);if(!isNaN(b)){e.Fe=b;e.frames=[];a=null;break a}}e.Fe=1;e.frames=[]}null!==a&&Gd(e,a)}};this.La.onerror=function(a){e.f("WebSocket error. Closing connection.");(a=a.message||a.data)&&e.f(a);e.fb()}};Dd.prototype.start=function(){}; +Dd.isAvailable=function(){var a=!1;if("undefined"!==typeof navigator&&navigator.userAgent){var b=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);b&&1parseFloat(b[1])&&(a=!0)}return!a&&null!==Cd&&!Ed};Dd.responsesRequiredToBeHealthy=2;Dd.healthyTimeout=3E4;g=Dd.prototype;g.sd=function(){Yb.remove("previous_websocket_failure")};function Gd(a,b){a.frames.push(b);if(a.frames.length==a.Fe){var c=a.frames.join("");a.frames=null;c=Ob(c);a.hg(c)}} +g.send=function(a){Fd(this);a=B(a);this.rb+=a.length;kc(this.Xa,"bytes_sent",a.length);a=gd(a,16384);1=this.g.compare(this.Uc,a)&&0>=this.g.compare(a,this.wc)};g.F=function(a,b,c,d,e,f){this.matches(new K(b,c))||(c=F);return this.he.F(a,b,c,d,e,f)}; +g.za=function(a,b,c){b.J()&&(b=F);var d=b.ob(this.g),d=d.ga(F),e=this;b.P(N,function(a,b){e.matches(new K(a,b))||(d=d.U(a,F))});return this.he.za(a,d,c)};g.ga=function(a){return a};g.Qa=function(){return!0};g.Vb=function(){return this.he};function le(a){this.ta=new ge(a);this.g=a.g;H(a.ya,"Only valid if limit has been set");this.pa=a.pa;this.Jb=!me(a)}g=le.prototype;g.F=function(a,b,c,d,e,f){this.ta.matches(new K(b,c))||(c=F);return a.R(b).$(c)?a:a.Fb()=this.g.compare(this.ta.Uc,f):0>=this.g.compare(f,this.ta.wc))d=d.U(f.name,f.S),e++;else break}}else{d=b.ob(this.g);d=d.ga(F);var k,m,l;if(this.Jb){b=d.$e(this.g);k=this.ta.wc;m=this.ta.Uc;var u=oe(this.g);l=function(a,b){return u(b,a)}}else b=d.Xb(this.g),k=this.ta.Uc, +m=this.ta.wc,l=oe(this.g);for(var e=0,z=!1;0=l(k,f)&&(z=!0),(h=z&&e=l(f,m))?e++:d=d.U(f.name,F)}return this.ta.Vb().za(a,d,c)};g.ga=function(a){return a};g.Qa=function(){return!0};g.Vb=function(){return this.ta.Vb()}; +function ne(a,b,c,d,e,f){var h;if(a.Jb){var k=oe(a.g);h=function(a,b){return k(b,a)}}else h=oe(a.g);H(b.Fb()==a.pa,"");var m=new K(c,d),l=a.Jb?pe(b,a.g):qe(b,a.g),u=a.ta.matches(m);if(b.Fa(c)){for(var z=b.R(c),l=e.fe(a.g,l,a.Jb);null!=l&&(l.name==c||b.Fa(l.name));)l=e.fe(a.g,l,a.Jb);e=null==l?1:h(l,m);if(u&&!d.e()&&0<=e)return null!=f&&Jd(f,new I("child_changed",d,c,z)),b.U(c,d);null!=f&&Jd(f,new I("child_removed",z,c));b=b.U(c,F);return null!=l&&a.ta.matches(l)?(null!=f&&Jd(f,new I("child_added", +l.S,l.name)),b.U(l.name,l.S)):b}return d.e()?b:u&&0<=h(l,m)?(null!=f&&(Jd(f,new I("child_removed",l.S,l.name)),Jd(f,new I("child_added",d,c))),b.U(c,d).U(l.name,F)):b};function Qc(a,b){this.B=a;H(p(this.B)&&null!==this.B,"LeafNode shouldn't be created with null/undefined value.");this.ba=b||F;re(this.ba);this.Eb=null}var se=["object","boolean","number","string"];g=Qc.prototype;g.J=function(){return!0};g.C=function(){return this.ba};g.ga=function(a){return new Qc(this.B,a)};g.R=function(a){return".priority"===a?this.ba:F};g.Q=function(a){return a.e()?this:".priority"===J(a)?this.ba:F};g.Fa=function(){return!1};g.Ze=function(){return null}; +g.U=function(a,b){return".priority"===a?this.ga(b):b.e()&&".priority"!==a?this:F.U(a,b).ga(this.ba)};g.F=function(a,b){var c=J(a);if(null===c)return b;if(b.e()&&".priority"!==c)return this;H(".priority"!==c||1===$d(a),".priority must be the last token in a path");return this.U(c,F.F(D(a),b))};g.e=function(){return!1};g.Fb=function(){return 0};g.P=function(){return!1};g.H=function(a){return a&&!this.C().e()?{".value":this.Ea(),".priority":this.C().H()}:this.Ea()}; +g.hash=function(){if(null===this.Eb){var a="";this.ba.e()||(a+="priority:"+te(this.ba.H())+":");var b=typeof this.B,a=a+(b+":"),a="number"===b?a+id(this.B):a+this.B;this.Eb=Uc(a)}return this.Eb};g.Ea=function(){return this.B};g.tc=function(a){if(a===F)return 1;if(a instanceof P)return-1;H(a.J(),"Unknown node type");var b=typeof a.B,c=typeof this.B,d=Ia(se,b),e=Ia(se,c);H(0<=d,"Unknown leaf type: "+b);H(0<=e,"Unknown leaf type: "+c);return d===e?"object"===c?0:this.Bdocument.domain="'+document.domain+'";\x3c/script>');a=""+a+"";try{this.Ga.ib.open(),this.Ga.ib.write(a),this.Ga.ib.close()}catch(f){E("frame writing exception"),f.stack&&E(f.stack),E(f)}} +Te.prototype.close=function(){this.Ud=!1;if(this.Ga){this.Ga.ib.body.innerHTML="";var a=this;setTimeout(function(){null!==a.Ga&&(document.body.removeChild(a.Ga),a.Ga=null)},Math.floor(0))}var b=this.kb;b&&(this.kb=null,b())}; +function We(a){if(a.Ud&&a.Kd&&a.ve.count()<(0=a.Qc[0].Se.length+30+c.length){var e=a.Qc.shift(),c=c+"&seg"+d+"="+e.ug+"&ts"+d+"="+e.Bg+"&d"+d+"="+e.Se;d++}else break;Xe(a,b+c,a.$d);return!0}return!1}function Xe(a,b,c){function d(){a.ve.remove(c);We(a)}a.ve.add(c,1);var e=setTimeout(d,Math.floor(25E3));Ve(a,b,function(){clearTimeout(e);d()})} +function Ve(a,b,c){setTimeout(function(){try{if(a.Kd){var d=a.Ga.ib.createElement("script");d.type="text/javascript";d.async=!0;d.src=b;d.onload=d.onreadystatechange=function(){var a=d.readyState;a&&"loaded"!==a&&"complete"!==a||(d.onload=d.onreadystatechange=null,d.parentNode&&d.parentNode.removeChild(d),c())};d.onerror=function(){E("Long-poll script failed to load: "+b);a.Kd=!1;a.close()};a.Ga.ib.body.appendChild(d)}}catch(e){}},Math.floor(1))};function Ye(a){Ze(this,a)}var $e=[Qe,Dd];function Ze(a,b){var c=Dd&&Dd.isAvailable(),d=c&&!(Yb.cf||!0===Yb.get("previous_websocket_failure"));b.Cg&&(c||O("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),d=!0);if(d)a.Wc=[Dd];else{var e=a.Wc=[];hd($e,function(a,b){b&&b.isAvailable()&&e.push(b)})}}function af(a){if(0=a.xf?(a.f("Secondary connection is healthy."),a.Cb=!0,a.D.sd(),a.D.start(),a.f("sending client ack on secondary"),a.D.send({t:"c",d:{t:"a",d:{}}}),a.f("Ending transmission on primary"),a.I.send({t:"c",d:{t:"n",d:{}}}),a.Xc=a.D,hf(a)):(a.f("sending ping on secondary."),a.D.send({t:"c",d:{t:"p",d:{}}}))}bf.prototype.wd=function(a){kf(this);this.te(a)};function kf(a){a.Cb||(a.xe--,0>=a.xe&&(a.f("Primary connection is healthy."),a.Cb=!0,a.I.sd()))} +function gf(a,b){a.D=new b("c:"+a.id+":"+a.Oe++,a.M,a.yf);a.xf=b.responsesRequiredToBeHealthy||0;a.D.open(df(a,a.D),ef(a,a.D));ld(function(){a.D&&(a.f("Timed out trying to upgrade."),a.D.close())},Math.floor(6E4))}function ff(a,b,c){a.f("Realtime connection established.");a.I=b;a.L=1;a.Mc&&(a.Mc(c,a.yf),a.Mc=null);0===a.xe?(a.f("Primary connection is healthy."),a.Cb=!0):ld(function(){lf(a)},Math.floor(5E3))} +function lf(a){a.Cb||1!==a.L||(a.f("sending ping on primary."),nf(a,{t:"c",d:{t:"p",d:{}}}))}function nf(a,b){if(1!==a.L)throw"Connection is not connected";a.Xc.send(b)}bf.prototype.close=function(){2!==this.L&&(this.f("Closing realtime connection."),this.L=2,jf(this),this.ja&&(this.ja(),this.ja=null))};function jf(a){a.f("Shutting down all connections");a.I&&(a.I.close(),a.I=null);a.D&&(a.D.close(),a.D=null);a.md&&(clearTimeout(a.md),a.md=null)};function L(a,b){if(1==arguments.length){this.o=a.split("/");for(var c=0,d=0;d=a.o.length?null:a.o[a.Z]}function $d(a){return a.o.length-a.Z}function D(a){var b=a.Z;b=this.o.length)return null;for(var a=[],b=this.Z;b=this.o.length};g.$=function(a){if($d(this)!==$d(a))return!1;for(var b=this.Z,c=a.Z;b<=this.o.length;b++,c++)if(this.o[b]!==a.o[c])return!1;return!0}; +g.contains=function(a){var b=this.Z,c=a.Z;if($d(this)>$d(a))return!1;for(;b10485760/3&&10485760f;f++)b[f]=Math.floor(64*Math.random());for(f=0;12>f;f++)c+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(b[f]);H(20===c.length,"nextPushId: Length should be 20."); +return c}}();function Vf(a,b){this.Oa=a;this.ca=b?b:Wf}g=Vf.prototype;g.Ra=function(a,b){return new Vf(this.Oa,this.ca.Ra(a,b,this.Oa).Y(null,null,!1,null,null))};g.remove=function(a){return new Vf(this.Oa,this.ca.remove(a,this.Oa).Y(null,null,!1,null,null))};g.get=function(a){for(var b,c=this.ca;!c.e();){b=this.Oa(a,c.key);if(0===b)return c.value;0>b?c=c.left:0c?d=d.left:0e)a=this.le?a.left:a.right;else if(0===e){this.Sa.push(a);break}else this.Sa.push(a),a=this.le?a.right:a.left} +function R(a){if(0===a.Sa.length)return null;var b=a.Sa.pop(),c;c=a.Hd?a.Hd(b.key,b.value):{key:b.key,value:b.value};if(a.le)for(b=b.left;!b.e();)a.Sa.push(b),b=b.right;else for(b=b.right;!b.e();)a.Sa.push(b),b=b.left;return c}function Zf(a){if(0===a.Sa.length)return null;var b;b=a.Sa;b=b[b.length-1];return a.Hd?a.Hd(b.key,b.value):{key:b.key,value:b.value}}function $f(a,b,c,d,e){this.key=a;this.value=b;this.color=null!=c?c:!0;this.left=null!=d?d:Wf;this.right=null!=e?e:Wf}g=$f.prototype; +g.Y=function(a,b,c,d,e){return new $f(null!=a?a:this.key,null!=b?b:this.value,null!=c?c:this.color,null!=d?d:this.left,null!=e?e:this.right)};g.count=function(){return this.left.count()+1+this.right.count()};g.e=function(){return!1};g.ia=function(a){return this.left.ia(a)||a(this.key,this.value)||this.right.ia(a)};function ag(a){return a.left.e()?a:ag(a.left)}g.Hc=function(){return ag(this).key};g.fc=function(){return this.right.e()?this.key:this.right.fc()}; +g.Ra=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.Y(null,null,null,e.left.Ra(a,b,c),null):0===d?e.Y(null,b,null,null,null):e.Y(null,null,null,null,e.right.Ra(a,b,c));return bg(e)};function cg(a){if(a.left.e())return Wf;a.left.fa()||a.left.left.fa()||(a=dg(a));a=a.Y(null,null,null,cg(a.left),null);return bg(a)} +g.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))c.left.e()||c.left.fa()||c.left.left.fa()||(c=dg(c)),c=c.Y(null,null,null,c.left.remove(a,b),null);else{c.left.fa()&&(c=eg(c));c.right.e()||c.right.fa()||c.right.left.fa()||(c=fg(c),c.left.left.fa()&&(c=eg(c),c=fg(c)));if(0===b(a,c.key)){if(c.right.e())return Wf;d=ag(c.right);c=c.Y(d.key,d.value,null,null,cg(c.right))}c=c.Y(null,null,null,null,c.right.remove(a,b))}return bg(c)};g.fa=function(){return this.color}; +function bg(a){a.right.fa()&&!a.left.fa()&&(a=gg(a));a.left.fa()&&a.left.left.fa()&&(a=eg(a));a.left.fa()&&a.right.fa()&&(a=fg(a));return a}function dg(a){a=fg(a);a.right.left.fa()&&(a=a.Y(null,null,null,null,eg(a.right)),a=gg(a),a=fg(a));return a}function gg(a){return a.right.Y(null,null,a.color,a.Y(null,null,!0,null,a.right.left),null)}function eg(a){return a.left.Y(null,null,a.color,null,a.Y(null,null,!0,a.left.right,null))} +function fg(a){return a.Y(null,null,!a.color,a.left.Y(null,null,!a.left.color,null,null),a.right.Y(null,null,!a.right.color,null,null))}function hg(){}g=hg.prototype;g.Y=function(){return this};g.Ra=function(a,b){return new $f(a,b,null)};g.remove=function(){return this};g.count=function(){return 0};g.e=function(){return!0};g.ia=function(){return!1};g.Hc=function(){return null};g.fc=function(){return null};g.fa=function(){return!1};var Wf=new hg;function P(a,b,c){this.m=a;(this.ba=b)&&re(this.ba);a.e()&&H(!this.ba||this.ba.e(),"An empty node cannot have a priority");this.zb=c;this.Eb=null}g=P.prototype;g.J=function(){return!1};g.C=function(){return this.ba||F};g.ga=function(a){return this.m.e()?this:new P(this.m,a,this.zb)};g.R=function(a){if(".priority"===a)return this.C();a=this.m.get(a);return null===a?F:a};g.Q=function(a){var b=J(a);return null===b?this:this.R(b).Q(D(a))};g.Fa=function(a){return null!==this.m.get(a)}; +g.U=function(a,b){H(b,"We should always be passing snapshot nodes");if(".priority"===a)return this.ga(b);var c=new K(a,b),d,e;b.e()?(d=this.m.remove(a),c=Me(this.zb,c,this.m)):(d=this.m.Ra(a,b),c=Ke(this.zb,c,this.m));e=d.e()?F:this.ba;return new P(d,e,c)};g.F=function(a,b){var c=J(a);if(null===c)return b;H(".priority"!==J(a)||1===$d(a),".priority must be the last token in a path");var d=this.R(c).F(D(a),b);return this.U(c,d)};g.e=function(){return this.m.e()};g.Fb=function(){return this.m.count()}; +var ig=/^(0|[1-9]\d*)$/;g=P.prototype;g.H=function(a){if(this.e())return null;var b={},c=0,d=0,e=!0;this.P(N,function(f,h){b[f]=h.H(a);c++;e&&ig.test(f)?d=Math.max(d,Number(f)):e=!1});if(!a&&e&&d<2*c){var f=[],h;for(h in b)f[h]=b[h];return f}a&&!this.C().e()&&(b[".priority"]=this.C().H());return b};g.hash=function(){if(null===this.Eb){var a="";this.C().e()||(a+="priority:"+te(this.C().H())+":");this.P(N,function(b,c){var d=c.hash();""!==d&&(a+=":"+b+":"+d)});this.Eb=""===a?"":Uc(a)}return this.Eb}; +g.Ze=function(a,b,c){return(c=jg(this,c))?(a=Xf(c,new K(a,b)))?a.name:null:Xf(this.m,a)};function pe(a,b){var c;c=(c=jg(a,b))?(c=c.Hc())&&c.name:a.m.Hc();return c?new K(c,a.m.get(c)):null}function qe(a,b){var c;c=(c=jg(a,b))?(c=c.fc())&&c.name:a.m.fc();return c?new K(c,a.m.get(c)):null}g.P=function(a,b){var c=jg(this,a);return c?c.ia(function(a){return b(a.name,a.S)}):this.m.ia(b)};g.Xb=function(a){return this.Yb(a.Ic(),a)}; +g.Yb=function(a,b){var c=jg(this,b);if(c)return c.Yb(a,function(a){return a});for(var c=this.m.Yb(a.name,Jc),d=Zf(c);null!=d&&0>b.compare(d,a);)R(c),d=Zf(c);return c};g.$e=function(a){return this.$b(a.Gc(),a)};g.$b=function(a,b){var c=jg(this,b);if(c)return c.$b(a,function(a){return a});for(var c=this.m.$b(a.name,Jc),d=Zf(c);null!=d&&0=a)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.n.ya)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.u,this.path,this.n.ne(a),this.Oc)}; +g.oe=function(a){y("Query.limitToLast",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.n.ya)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.u,this.path,this.n.oe(a),this.Oc)}; +g.lg=function(a){y("Query.orderByChild",1,1,arguments.length);if("$key"===a)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===a)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===a)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Lf("Query.orderByChild",a);wg(this,"Query.orderByChild");var b=new L(a);if(b.e())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead."); +b=new xe(b);b=He(this.n,b);ug(b);return new X(this.u,this.path,b,!0)};g.mg=function(){y("Query.orderByKey",0,0,arguments.length);wg(this,"Query.orderByKey");var a=He(this.n,ee);ug(a);return new X(this.u,this.path,a,!0)};g.ng=function(){y("Query.orderByPriority",0,0,arguments.length);wg(this,"Query.orderByPriority");var a=He(this.n,N);ug(a);return new X(this.u,this.path,a,!0)}; +g.og=function(){y("Query.orderByValue",0,0,arguments.length);wg(this,"Query.orderByValue");var a=He(this.n,De);ug(a);return new X(this.u,this.path,a,!0)};g.Nd=function(a,b){y("Query.startAt",0,2,arguments.length);Ef("Query.startAt",a,this.path,!0);Kf("Query.startAt",b);var c=this.n.Nd(a,b);vg(c);ug(c);if(this.n.la)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");p(a)||(b=a=null);return new X(this.u,this.path,c,this.Oc)}; +g.fd=function(a,b){y("Query.endAt",0,2,arguments.length);Ef("Query.endAt",a,this.path,!0);Kf("Query.endAt",b);var c=this.n.fd(a,b);vg(c);ug(c);if(this.n.oa)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new X(this.u,this.path,c,this.Oc)}; +g.Rf=function(a,b){y("Query.equalTo",1,2,arguments.length);Ef("Query.equalTo",a,this.path,!1);Kf("Query.equalTo",b);if(this.n.la)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.n.oa)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.Nd(a,b).fd(a,b)}; +g.toString=function(){y("Query.toString",0,0,arguments.length);for(var a=this.path,b="",c=a.Z;c=b&&dh(h,c.path)?d=!1:c.path.contains(h.path)&&(e=!0));f--}if(d){if(e)this.T=eh(this.ma,fh,C),this.Cc=0f.Cc,"Stacking an older write on top of newer ones");p(h)||(h=!0);f.ma.push({path:b,Ja:c,Zc:d,visible:h});h&&(f.T=Sg(f.T,b,c));f.Cc=d;return e?Fh(a,new $b(Ng,b,c)):[]}function Gh(a,b,c,d){var e=a.lb;H(d>e.Cc,"Stacking an older merge on top of newer ones");e.ma.push({path:b,children:c,Zc:d,visible:!0});e.T=Tg(e.T,b,c);e.Cc=d;c=Bg(c);return Fh(a,new vd(Ng,b,c))} +function Hh(a,b,c){c=c||!1;var d=ch(a.lb,b);if(a.lb.Ed(b)){var e=Q;null!=d.Ja?e=e.set(C,!0):Cb(d.children,function(a,b){e=e.set(new L(a),b)});return Fh(a,new Mg(d.path,e,c))}return[]}function Ih(a,b,c){c=Bg(c);return Fh(a,new vd(Pg,b,c))}function Jh(a,b,c,d){d=Kh(a,d);if(null!=d){var e=Lh(d);d=e.path;e=e.Ib;b=T(d,b);c=new $b(new Og(!1,!0,e,!0),b,c);return Mh(a,d,c)}return[]} +function Nh(a,b,c,d){if(d=Kh(a,d)){var e=Lh(d);d=e.path;e=e.Ib;b=T(d,b);c=Bg(c);c=new vd(new Og(!1,!0,e,!0),b,c);return Mh(a,d,c)}return[]} +Dh.prototype.Ob=function(a,b){var c=a.path,d=null,e=!1;Ig(this.xa,c,function(a,b){var f=T(a,c);d=d||b.jb(f);e=e||null!=Zg(b)});var f=this.xa.get(c);f?(e=e||null!=Zg(f),d=d||f.jb(C)):(f=new Yg,this.xa=this.xa.set(c,f));var h;null!=d?h=!0:(h=!1,d=F,Lg(this.xa.subtree(c),function(a,b){var c=b.jb(C);c&&(d=d.U(a,c))}));var k=null!=ah(f,a);if(!k&&!S(a.n)){var m=Oh(a);H(!(m in this.jc),"View does not exist, but we have a tag");var l=Ph++;this.jc[m]=l;this.De["_"+l]=m}h=f.Ob(a,b,new gh(c,this.lb),d,h);k|| +e||(f=ah(f,a),h=h.concat(Qh(this,a,f)));return h}; +Dh.prototype.mb=function(a,b,c){var d=a.path,e=this.xa.get(d),f=[];if(e&&("default"===a.ka()||null!=ah(e,a))){f=e.mb(a,b,c);e.e()&&(this.xa=this.xa.remove(d));e=f.sg;f=f.Tf;b=-1!==Pa(e,function(a){return S(a.n)});var h=Gg(this.xa,d,function(a,b){return null!=Zg(b)});if(b&&!h&&(d=this.xa.subtree(d),!d.e()))for(var d=Rh(d),k=0;k} The promise resolves if an FCM token can + * be retrieved. This method returns null if the current origin does not have + * permission to show notifications. + */ +firebase.messaging.Messaging.prototype.getToken = function() {}; + +/** + * You should listen for token refreshes so your web app knows when FCM + * has invalidated your existing token and you need to call `getToken()` + * to get a new token. + * + * @param {(!function(!Object)|!Object)} nextOrObserver This function, or + * observer object with `next` defined, is called when a token refresh + * has occured. + * @return {function()} To stop listening for token + * refresh events execute this returned function. + */ +firebase.messaging.Messaging.prototype.onTokenRefresh = + function(nextOrObserver) {}; + +/** + * When a push message is received and the user is currently on a page + * for your origin, the message is passed to the page and an `onMessage()` + * event is dispatched with the payload of the push message. + * + * NOTE: These events are dispatched when you have called + * `setBackgroundMessageHandler()` in your service worker. + * + * @param {(!function(!Object)|!Object)} nextOrObserver This function, or + * observer object with `next` defined, is called when a message is + * received and the user is currently viewing your page. + * @return {function()} To stop listening for messages + * execute this returned function. + */ +firebase.messaging.Messaging.prototype.onMessage = + function(nextOrObserver) {}; + +/** + * To forceably stop a registration token from being used, delete it + * by calling this method. + * + * @param {!string} token The token to delete. + * @return {firebase.Promise} The promise resolves when the token has been + * successfully deleted. + */ +firebase.messaging.Messaging.prototype.deleteToken = function(token) {}; + +/** + * To use your own service worker for receiving push messages, you + * can pass in your service worker registration in this method. + * + * @param {!ServiceWorkerRegistration} registration The service worker + * registration you wish to use for push messaging. + */ +firebase.messaging.Messaging.prototype.useServiceWorker = + function(registration) {}; + +/** + * FCM directs push messages to your web page's `onMessage()` callback + * if the user currently has it open. Otherwise, it calls + * your callback passed into `setBackgroundMessageHandler()`. + * + * Your callback should return a promise that, once resolved, has + * shown a notification. + * + * @param {!function(!Object)} callback The function to handle the push message. + */ +firebase.messaging.Messaging.prototype.setBackgroundMessageHandler = + function(callback) {}; diff --git a/lib/firebase/firebase-messaging.js b/lib/firebase/firebase-messaging.js new file mode 100644 index 00000000..837a8c1f --- /dev/null +++ b/lib/firebase/firebase-messaging.js @@ -0,0 +1,42 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +(function() {var f=function(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;for(var d in b)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,d);e&&Object.defineProperty(a,d,e)}else a[d]=b[d]},h="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},k="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&& +null!=global?global:this,l=function(a,b){if(b){var c=k;a=a.split(".");for(var d=0;db;b++)L[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b);for(var b=L,c=[],d=0;d>2,e=(e&3)<<4|m>>4,m=(m&15)<<2|r>>6,r=r&63;p||(r=64,g||(m=64));c.push(b[V],b[e],b[m],b[r])}return c.join("").replace(/\+/g,"-").replace(/\//g, +"_").replace(/=+$/,"")};var N=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D),O=function(){this.a=null},P=function(a){if(a.a)return a.a;a.a=new Promise(function(a,c){var b=y.indexedDB.open("fcm_token_details_db",1);b.onerror=function(a){c(a.target.error)};b.onsuccess=function(b){a(b.target.result)};b.onupgradeneeded=function(a){a=a.target.result.createObjectStore("fcm_token_object_Store",{keyPath:"swScope"});a.createIndex("fcmSenderId","fcmSenderId",{unique:!1});a.createIndex("fcmToken","fcmToken",{unique:!0})}}); +return a.a},ba=function(a){a.a?a.a.then(function(b){b.close();a.a=null}):Promise.resolve()},Q=function(a,b){return P(a).then(function(a){return new Promise(function(c,e){var d=a.transaction(["fcm_token_object_Store"]).objectStore("fcm_token_object_Store").index("fcmToken").get(b);d.onerror=function(a){e(a.target.error)};d.onsuccess=function(a){c(a.target.result)}})})},ca=function(a,b){return P(a).then(function(a){return new Promise(function(c,e){var d=[],m=a.transaction(["fcm_token_object_Store"]).objectStore("fcm_token_object_Store").openCursor(); +m.onerror=function(a){e(a.target.error)};m.onsuccess=function(a){(a=a.target.result)?(a.value.fcmSenderId===b&&d.push(a.value),a.continue()):c(d)}})})},R=function(a,b,c){var d=M(b.getKey("p256dh")),e=M(b.getKey("auth"));a="authorized_entity="+a+"&"+("endpoint="+b.endpoint+"&")+("encryption_key="+d+"&")+("encryption_auth="+e);c&&(a+="&pushSet="+c);c=new Headers;c.append("Content-Type","application/x-www-form-urlencoded");return fetch("https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST", +headers:c,body:a}).then(function(a){return a.json()}).then(function(a){if(a.error)throw N.create(B.V,{message:a.error.message});if(!a.token)throw N.create(B.X);if(!a.pushSet)throw N.create(B.W);return{token:a.token,pushSet:a.pushSet}})},da=function(a,b,c,d,e,g){var m={swScope:c.scope,endpoint:d.endpoint,auth:M(d.getKey("auth")),p256dh:M(d.getKey("p256dh")),fcmToken:e,fcmPushSet:g,fcmSenderId:b};return P(a).then(function(a){return new Promise(function(b,c){var d=a.transaction(["fcm_token_object_Store"], +"readwrite").objectStore("fcm_token_object_Store").put(m);d.onerror=function(a){c(a.target.error)};d.onsuccess=function(){b()}})})}; +O.prototype.ba=function(a,b){return b instanceof ServiceWorkerRegistration?"string"!==typeof a||0===a.length?Promise.reject(N.create(B.l)):ca(this,a).then(function(c){if(0!==c.length){var d=c.findIndex(function(c){return b.scope===c.swScope&&a===c.fcmSenderId});if(-1!==d)return c[d]}}).then(function(a){if(a)return b.pushManager.getSubscription().catch(function(){throw N.create(B.H);}).then(function(b){var c;if(c=b)c=b.endpoint===a.endpoint&&M(b.getKey("auth"))===a.auth&&M(b.getKey("p256dh"))===a.p256dh; +if(c)return a.fcmToken})}):Promise.reject(N.create(B.m))};O.prototype.getSavedToken=O.prototype.ba;O.prototype.aa=function(a,b){var c=this;return"string"!==typeof a||0===a.length?Promise.reject(N.create(B.l)):b instanceof ServiceWorkerRegistration?b.pushManager.getSubscription().then(function(a){return a?a:b.pushManager.subscribe(E)}).then(function(d){return R(a,d).then(function(e){return da(c,a,b,d,e.token,e.pushSet).then(function(){return e.token})})}):Promise.reject(N.create(B.m))}; +O.prototype.createToken=O.prototype.aa;O.prototype.deleteToken=function(a){var b=this;return"string"!==typeof a||0===a.length?Promise.reject(N.create(B.J)):Q(this,a).then(function(a){if(!a)throw N.create(B.D);return P(b).then(function(b){return new Promise(function(c,d){var e=b.transaction(["fcm_token_object_Store"],"readwrite").objectStore("fcm_token_object_Store").delete(a.swScope);e.onerror=function(a){d(a.target.error)};e.onsuccess=function(b){0===b.target.result?d(N.create(B.G)):c(a)}})})})};var S=function(a){var b=this;this.a=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D);if(!a.options.messagingSenderId||"string"!==typeof a.options.messagingSenderId)throw this.a.create(B.l);this.j=a.options.messagingSenderId;this.c=new O;this.app=a;this.INTERNAL={};this.INTERNAL.delete=function(){return b.delete}}; +S.prototype.getToken=function(){var a=this,b=Notification.permission;return"granted"!==b?"denied"===b?Promise.reject(this.a.create(B.L)):Promise.resolve(null):this.f().then(function(b){return a.c.ba(a.j,b).then(function(c){return c?c:a.c.aa(a.j,b)})})};S.prototype.getToken=S.prototype.getToken;S.prototype.deleteToken=function(a){var b=this;return this.c.deleteToken(a).then(function(){return b.f()}).then(function(a){return a?a.pushManager.getSubscription():null}).then(function(a){if(a)return a.unsubscribe()})}; +S.prototype.deleteToken=S.prototype.deleteToken;S.prototype.f=function(){throw this.a.create(B.U);};S.prototype.requestPermission=function(){throw this.a.create(B.i);};S.prototype.useServiceWorker=function(){throw this.a.create(B.i);};S.prototype.useServiceWorker=S.prototype.useServiceWorker;S.prototype.onMessage=function(){throw this.a.create(B.i);};S.prototype.onMessage=S.prototype.onMessage;S.prototype.onTokenRefresh=function(){throw this.a.create(B.i);};S.prototype.onTokenRefresh=S.prototype.onTokenRefresh; +S.prototype.setBackgroundMessageHandler=function(){throw this.a.create(B.A);};S.prototype.setBackgroundMessageHandler=S.prototype.setBackgroundMessageHandler;S.prototype.delete=function(){ba(this.c)};var T=self,U=function(a){var b=this;S.call(this,a);this.a=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D);T.addEventListener("push",function(a){return ea(b,a)},!1);T.addEventListener("pushsubscriptionchange",function(a){return fa(b,a)},!1);T.addEventListener("notificationclick",function(a){return ga(b,a)},!1);this.b=null};f(U,S); +var ea=function(a,b){var c;try{c=b.data.json()}catch(e){return}var d=ha().then(function(b){if(b){if(c.notification||a.b)return ia(a,c)}else{if((b=c)&&"object"===typeof b.notification){var d=Object.assign({},b.notification),e={};d.data=(e.FCM_MSG=b,e);b=d}else b=void 0;if(b)return T.registration.showNotification(b.title||"",b);if(a.b)return a.b(c)}});b.waitUntil(d)},fa=function(a,b){var c=a.getToken().then(function(b){if(!b)throw a.a.create(B.N);var c=a.c;return Q(c,b).then(function(b){if(!b)throw a.a.create(B.K); +return T.registration.pushManager.subscribe(E).then(function(a){return R(b.ha,a,b.ga)}).catch(function(d){return c.deleteToken(b.ia).then(function(){throw a.a.create(B.Y,{message:d});})})})});b.waitUntil(c)},ga=function(a,b){if(b.notification&&b.notification.data&&b.notification.data.FCM_MSG){b.stopImmediatePropagation();b.notification.close();var c=b.notification.data.FCM_MSG,d=c.notification.click_action;if(d){var e=ja(d).then(function(a){return a?a:T.clients.openWindow(d)}).then(function(b){if(b)return delete c.notification, +X(a,b,H(G.M,c))});b.waitUntil(e)}}};U.prototype.setBackgroundMessageHandler=function(a){if(a&&"function"!==typeof a)throw this.a.create(B.B);this.b=a};U.prototype.setBackgroundMessageHandler=U.prototype.setBackgroundMessageHandler; +var ja=function(a){var b=(new URL(a)).href;return T.clients.matchAll({type:"window",includeUncontrolled:!0}).then(function(a){for(var c=null,e=0;e + * 1) a gs:// URL, for example `gs://bucket/files/image.png`
+ * 2) a download URL taken from object metadata.
+ * @see {@link firebase.storage.FullMetadata.prototype.downloadURLs} + * @return {!firebase.storage.Reference} A reference for the given URL. + */ +firebase.storage.Storage.prototype.refFromURL = function(url) {}; + +/** + * The maximum time to retry operations other than uploads or downloads in + * milliseconds. + * @type {number} + */ +firebase.storage.Storage.prototype.maxOperationRetryTime; + +/** + * @param {number} time The new maximum operation retry time in milliseconds. + * @see {@link firebase.storage.Storage.prototype.maxOperationRetryTime} + */ +firebase.storage.Storage.prototype.setMaxOperationRetryTime = function(time) {}; + +/** + * The maximum time to retry uploads in milliseconds. + * @type {number} + */ +firebase.storage.Storage.prototype.maxUploadRetryTime; + +/** + * @param {number} time The new maximum upload retry time in milliseconds. + * @see {@link firebase.storage.Storage.prototype.maxUploadRetryTime} + */ +firebase.storage.Storage.prototype.setMaxUploadRetryTime = function(time) {}; + +/** + * Represents a reference to a Google Cloud Storage object. Developers can + * upload, download, and delete objects, as well as get/set object metadata. + * @interface + */ +firebase.storage.Reference = function() {}; + +/** + * Returns a gs:// URL for this object in the form + * `gs://///` + * @return {string} The gs:// URL. + */ +firebase.storage.Reference.prototype.toString = function() {}; + +/** + * Returns a reference to a relative path from this reference. + * @param {string} path The relative path from this reference. + * Leading, trailing, and consecutive slashes are removed. + * @return {!firebase.storage.Reference} The reference a the given path. + */ +firebase.storage.Reference.prototype.child = function(path) {}; + +/** + * Uploads data to this reference's location. + * @param {!Blob|!Uint8Array|!ArrayBuffer} data The data to upload. + * @param {!firebase.storage.UploadMetadata=} metadata Metadata for the newly + * uploaded object. + * @return {!firebase.storage.UploadTask} An object that can be used to monitor + * and manage the upload. + */ +firebase.storage.Reference.prototype.put = function(data, metadata) {}; + +/** + * @enum {string} + * An enumeration of the possible string formats for upload. + */ +firebase.storage.StringFormat = { + /** + * Indicates the string should be interpreted "raw", that is, as normal text. + * The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte + * sequence. + * Example: The string 'Hello! \ud83d\ude0a' becomes the byte sequence + * 48 65 6c 6c 6f 21 20 f0 9f 98 8a + */ + RAW: 'raw', + /** + * Indicates the string should be interpreted as base64-encoded data. + * Padding characters (trailing '='s) are optional. + * Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence + * ad 69 8e fb e1 3a b7 bf eb 97 + */ + BASE64: 'base64', + /** + * Indicates the string should be interpreted as base64url-encoded data. + * Padding characters (trailing '='s) are optional. + * Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence + * ad 69 8e fb e1 3a b7 bf eb 97 + */ + BASE64URL: 'base64url', + /** + * Indicates the string is a data URL, such as one obtained from + * canvas.toDataURL(). + * Example: the string 'data:application/octet-stream;base64,aaaa' + * becomes the byte sequence + * 69 a6 9a + * (the content-type "application/octet-stream" is also applied, but can + * be overridden in the metadata object). + */ + DATA_URL: 'data_url' +}; + +/** + * Uploads string data to this reference's location. + * @param {string} data The string to upload. + * @param {!firebase.storage.StringFormat=} format The format of the string to + * upload. + * @param {!firebase.storage.UploadMetadata=} metadata Metadata for the newly + * uploaded object. + * @return {!firebase.storage.UploadTask} + * @throws If the format is not an allowed format, or if the given string + * doesn't conform to the specified format. + */ +firebase.storage.Reference.prototype.putString = function( + data, format, metadata) {}; + + +/** + * Deletes the object at this reference's location. + * @return {!Promise} A promise that resolves if the deletion succeeded + * and rejects if it failed, including if the object didn't exist. + */ +firebase.storage.Reference.prototype.delete = function() {}; + +/** + * Fetches metadata for the object at this location, if one exists. + * @return {!Promise} A promise that resolves + * with the metadata, or rejects if the fetch failed, including if the + * object did not exist. + */ +firebase.storage.Reference.prototype.getMetadata = function() {}; + +/** + * Updates the metadata for the object at this location, if one exists. + * @param {!firebase.storage.SettableMetadata} metadata The new metadata. + * Setting a property to 'null' removes it on the server, while leaving + * a property as 'undefined' has no effect. + * @return {!Promise} A promise that resolves + * with the full updated metadata or rejects if the updated failed, + * including if the object did not exist. + */ +firebase.storage.Reference.prototype.updateMetadata = function(metadata) {}; + + +/** + * Fetches a long lived download URL for this object. + * @return {!Promise} A promise that resolves with the download URL or + * rejects if the fetch failed, including if the object did not exist. + */ +firebase.storage.Reference.prototype.getDownloadURL = function() {}; + + +/** + * A reference pointing to the parent location of this reference, or null if + * this reference is the root. + * @type {?firebase.storage.Reference} + */ +firebase.storage.Reference.prototype.parent; + + +/** + * A reference to the root of this reference's bucket. + * @type {!firebase.storage.Reference} + */ +firebase.storage.Reference.prototype.root; + +/** + * The name of the bucket containing this reference's object. + * @type {string} + */ +firebase.storage.Reference.prototype.bucket; + +/** + * The full path of this object. + * @type {string} + */ +firebase.storage.Reference.prototype.fullPath; + +/** + * The short name of this object, which is the last component of the full path. + * For example, if fullPath is 'full/path/image.png', name is 'image.png'. + * @type {string} + */ +firebase.storage.Reference.prototype.name; + +/** + * The storage service associated with this reference. + * @type {!firebase.storage.Storage} + */ +firebase.storage.Reference.prototype.storage; + + +/** + * Object metadata that can be set at any time. + * @interface + */ +firebase.storage.SettableMetadata = function() {}; + +/** + * Served as the 'Cache-Control' header on object download. + * @type {?string|undefined} + */ +firebase.storage.SettableMetadata.prototype.cacheControl; + +/** + * Served as the 'Content-Disposition' header on object download. + * @type {?string|undefined} + */ +firebase.storage.SettableMetadata.prototype.contentDisposition; + +/** + * Served as the 'Content-Encoding' header on object download. + * @type {?string|undefined} + */ +firebase.storage.SettableMetadata.prototype.contentEncoding; + +/** + * Served as the 'Content-Language' header on object download. + * @type {?string|undefined} + */ +firebase.storage.SettableMetadata.prototype.contentLanguage; + +/** + * Served as the 'Content-Type' header on object download. + * @type {?string|undefined} + */ +firebase.storage.SettableMetadata.prototype.contentType; + +/** + * Additional user-defined custom metadata. + * @type {?Object|undefined} + */ +firebase.storage.SettableMetadata.prototype.customMetadata; + +/** + * Object metadata that can be set at upload. + * @interface + * @extends {firebase.storage.SettableMetadata} + */ +firebase.storage.UploadMetadata = function() {}; + +/** + * A Base64-encoded MD5 hash of the object being uploaded. + * @type {?string|undefined} + */ +firebase.storage.UploadMetadata.prototype.md5Hash; + +/** + * The full set of object metadata, including read-only properties. + * @interface + * @extends {firebase.storage.UploadMetadata} + */ +firebase.storage.FullMetadata = function() {}; + +/** + * The bucket this object is contained in. + * @type {string} + */ +firebase.storage.FullMetadata.prototype.bucket; + +/** + * The object's generation. + * @type {string} + * @see {@link https://cloud.google.com/storage/docs/generations-preconditions} + */ +firebase.storage.FullMetadata.prototype.generation; + +/** + * The object's metageneration. + * @type {string} + * @see {@link https://cloud.google.com/storage/docs/generations-preconditions} + */ +firebase.storage.FullMetadata.prototype.metageneration; + +/** + * The full path of this object. + * @type {string} + */ +firebase.storage.FullMetadata.prototype.fullPath; + +/** + * The short name of this object, which is the last component of the full path. + * For example, if fullPath is 'full/path/image.png', name is 'image.png'. + * @type {string} + */ +firebase.storage.FullMetadata.prototype.name; + +/** + * The size of this object, in bytes. + * @type {number} + */ +firebase.storage.FullMetadata.prototype.size; + +/** + * A date string representing when this object was created. + * @type {string} + */ +firebase.storage.FullMetadata.prototype.timeCreated; + +/** + * A date string representing when this object was last updated. + * @type {string} + */ +firebase.storage.FullMetadata.prototype.updated; + +/** + * An array of long-lived download URLs. Always contains at least one URL. + * @type {!Array} + */ +firebase.storage.FullMetadata.prototype.downloadURLs; + +/** + * An event that is triggered on a task. + * @enum {string} + * @see {@link firebase.storage.UploadTask.prototype.on} + */ +firebase.storage.TaskEvent = { + /** + * For this event, + *
    + *
  • The `next` function is triggered on progress updates and when the + * task is paused/resumed with a + * {@link firebase.storage.UploadTaskSnapshot} as the first + * argument.
  • + *
  • The `error` function is triggered if the upload is canceled or fails + * for another reason.
  • + *
  • The `complete` function is triggered if the upload completes + * successfully.
  • + *
+ */ + STATE_CHANGED: 'state_changed' +}; + +/** + * Represents the current state of a running upload. + * @enum {string} + */ +firebase.storage.TaskState = { + /** Indicates that the task is still running and making progress. */ + RUNNING: 'running', + /** Indicates that the task is paused. */ + PAUSED: 'paused', + /** Indicates that the task completed successfully. */ + SUCCESS: 'success', + /** Indicates that the task was canceled. */ + CANCELED: 'canceled', + /** Indicates that the task failed for a reason other than being canceled. */ + ERROR: 'error' +}; + +/** + * Represents the process of uploading an object. Allows you to monitor and + * manage the upload. + * @interface + */ +firebase.storage.UploadTask = function() {}; + +/** + * This object behaves like a Promise, and resolves with its snapshot data when + * the upload completes. + * @param {(?function(!firebase.storage.UploadTaskSnapshot):*)=} onFulfilled + * The fulfillment callback. Promise chaining works as normal. + * @param {(?function(!Error):*)=} onRejected The rejection callback. + * @return {!Promise} + */ +firebase.storage.UploadTask.prototype.then = function(onFulfilled, onRejected) { +}; + +/** + * Equivalent to calling `then(null, onRejected)`. + * @param {!function(!Error):*} onRejected + * @return {!Promise} + */ +firebase.storage.UploadTask.prototype.catch = function(onRejected) {}; + +/** + * Listens for events on this task. + * + * Events have three callback functions (referred to as `next`, `error`, and + * `complete`). + * + * If only the event is passed, a function that can be used to register the + * callbacks is returned. Otherwise, the callbacks are passed after the event. + * + * Callbacks can be passed either as three separate arguments or as the + * `next`, `error`, and `complete` properties of an object. Any of the three + * callbacks is optional, as long as at least one is specified. In addition, + * when you add your callbacks, you get a function back. You can call this + * function to unregister the associated callbacks. + * + * @example Pass callbacks separately or in an object. + * var next = function(snapshot) {}; + * var error = function(error) {}; + * var complete = function() {}; + * + * // The first example. + * uploadTask.on( + * firebase.storage.TaskEvent.STATE_CHANGED, + * next, + * error, + * complete); + * + * // This is equivalent to the first example. + * uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, { + * 'next': next, + * 'error': error, + * 'complete': complete + * }); + * + * // This is equivalent to the first example. + * var subscribe = uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED); + * subscribe(next, error, complete); + * + * // This is equivalent to the first example. + * var subscribe = uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED); + * subscribe({ + * 'next': next, + * 'error': error, + * 'complete': complete + * }); + * + * @example Any callback is optional. + * // Just listening for completion, this is legal. + * uploadTask.on( + * firebase.storage.TaskEvent.STATE_CHANGED, + * null, + * null, + * function() { + * console.log('upload complete!'); + * }); + * + * // Just listening for progress/state changes, this is legal. + * uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, function(snapshot) { + * var percent = snapshot.bytesTransferred / snapshot.totalBytes * 100; + * console.log(percent + "% done"); + * }); + * + * // This is also legal. + * uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, { + * 'complete': function() { + * console.log('upload complete!'); + * } + * }); + * + * @example Use the returned function to remove callbacks. + * var unsubscribe = uploadTask.on( + * firebase.storage.TaskEvent.STATE_CHANGED, + * function(snapshot) { + * var percent = snapshot.bytesTransferred / snapshot.totalBytes * 100; + * console.log(percent + "% done"); + * // Stop after receiving one update. + * unsubscribe(); + * }); + * + * // This code is equivalent to the above. + * var handle = uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED); + * unsubscribe = handle(function(snapshot) { + * var percent = snapshot.bytesTransferred / snapshot.totalBytes * 100; + * console.log(percent + "% done"); + * // Stop after receiving one update. + * unsubscribe(); + * }); + * + * @param {!firebase.storage.TaskEvent} event The event to listen for. + * @param {(?function(!Object)|!Object)=} nextOrObserver The `next` function, + * which gets called for each item in the event stream, or an observer + * object with some or all of these three properties (`next`, `error`, + * `complete`). + * @param {?function(!Error)=} error A function that gets called with an Error + * if the event stream ends due to an error. + * @param {?function()=} complete A function that gets called if the + * event stream ends normally. + * @return { + * !function()| + * !function(?function(!Object),?function(!Error)=,?function()=) + * :!function()} + * If only the event argument is passed, returns a function you can use to + * add callbacks (see the examples above). If more than just the event + * argument is passed, returns a function you can call to unregister the + * callbacks. + */ +firebase.storage.UploadTask.prototype.on = function( + event, nextOrObserver, error, complete) {}; + +/** + * Resumes a paused task. Has no effect on a running or failed task. + * @return {boolean} True if the resume had an effect. + */ +firebase.storage.UploadTask.prototype.resume = function() {}; + +/** + * Pauses a running task. Has no effect on a paused or failed task. + * @return {boolean} True if the pause had an effect. + */ +firebase.storage.UploadTask.prototype.pause = function() {}; + +/** + * Cancels a running task. Has no effect on a complete or failed task. + * @return {boolean} True if the cancel had an effect. + */ +firebase.storage.UploadTask.prototype.cancel = function() {}; + +/** + * A snapshot of the current task state. + * @type {!firebase.storage.UploadTaskSnapshot} + */ +firebase.storage.UploadTask.prototype.snapshot; + +/** + * Holds data about the current state of the upload task. + * @interface + */ +firebase.storage.UploadTaskSnapshot = function() {}; + +/** + * The number of bytes that have been successfully uploaded so far. + * @type {number} + */ +firebase.storage.UploadTaskSnapshot.prototype.bytesTransferred; + +/** + * The total number of bytes to be uploaded. + * @type {number} + */ +firebase.storage.UploadTaskSnapshot.prototype.totalBytes; + +/** + * The current state of the task. + * @type {firebase.storage.TaskState} + */ +firebase.storage.UploadTaskSnapshot.prototype.state; + +/** + * Before the upload completes, contains the metadata sent to the server. + * After the upload completes, contains the metadata sent back from the server. + * @type {!firebase.storage.FullMetadata} + */ +firebase.storage.UploadTaskSnapshot.prototype.metadata; + +/** + * After the upload completes, contains a long-lived download URL for the + * object. Also accessible in metadata. + * @type {?string} + */ +firebase.storage.UploadTaskSnapshot.prototype.downloadURL; + +/** + * The task of which this is a snapshot. + * @type {!firebase.storage.UploadTask} + */ +firebase.storage.UploadTaskSnapshot.prototype.task; + +/** + * The reference that spawned this snapshot's upload task. + * @type {!firebase.storage.Reference} + */ +firebase.storage.UploadTaskSnapshot.prototype.ref; diff --git a/lib/firebase/firebase-storage.js b/lib/firebase/firebase-storage.js new file mode 100644 index 00000000..14940af4 --- /dev/null +++ b/lib/firebase/firebase-storage.js @@ -0,0 +1,104 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +(function() {var k,aa=aa||{},l=this,n=function(a){return void 0!==a},ba=function(){},ca=function(){throw Error("unimplemented abstract method");},p=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array"; +if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},da=function(a){var b=p(a);return"array"==b||"object"==b&&"number"==typeof a.length},r=function(a){return"string"==typeof a},t=function(a){return"function"==p(a)},ea=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},fa="closure_uid_"+(1E9*Math.random()>>> +0),ga=0,ha=function(a,b,c){return a.call.apply(a.bind,arguments)},ia=function(a,b,c){if(!a)throw Error();if(2h&&(h*=2);var c;1===Q?(Q=2,c=0):c=1E3*(h+Math.random());e(c)}}function g(a){jc||(jc=!0,P||(null!==m?(a||(Q=2),clearTimeout(m),e(0)):a||(Q=1)))}var h=1,m=null,q=!1,Q=0,P=!1,jc=!1;e(0);setTimeout(function(){q=!0;g(!0)},c);return g};var la="https://firebasestorage.googleapis.com";var w=function(a,b){this.code="storage/"+a;this.message="Firebase Storage: "+b;this.serverResponse=null;this.name="FirebaseError"};v(w,Error); +var ma=function(){return new w("unknown","An unknown error occurred, please check the error payload for server response.")},na=function(){return new w("canceled","User canceled the upload/download.")},oa=function(){return new w("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")},pa=function(a,b,c){return new w("invalid-argument","Invalid argument in `"+b+"` at index "+a+": "+c)},qa=function(){return new w("app-deleted","The Firebase app was deleted.")},ra=function(a,b){return new w("invalid-format", +"String does not match format '"+a+"': "+b)};var sa=function(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])},ta=function(a){var b={};sa(a,function(a,d){b[a]=d});return b};var x=function(a,b,c,d){this.i=a;this.b={};this.method=b;this.headers={};this.body="";this.M=c;this.c=this.a=null;this.f=[200];this.h=[];this.timeout=d;this.g=!0};var ua={STATE_CHANGED:"state_changed"},va={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},wa=function(a){switch(a){case "running":case "pausing":case "canceling":return"running";case "paused":return"paused";case "success":return"success";case "canceled":return"canceled";case "error":return"error";default:return"error"}};var y=function(a){return n(a)&&null!==a},xa=function(a){return"string"===typeof a||a instanceof String},ya=function(){return"undefined"!==typeof Blob};var za=function(a,b,c){this.f=c;this.c=a;this.g=b;this.b=0;this.a=null};za.prototype.get=function(){var a;0b?1:0};var Pa=function(a,b){this.a=a;this.b=b};var Qa=function(a,b){this.bucket=a;this.path=b},Ra=function(a){var b=encodeURIComponent;return"/b/"+b(a.bucket)+"/o/"+b(a.path)},Sa=function(a){for(var b=null,c=[{ia:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,ba:{bucket:1,path:3},ha:function(a){"/"===a.path.charAt(a.path.length-1)&&(a.path=a.path.slice(0,-1))}},{ia:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,ba:{bucket:1,path:3},ha:function(a){a.path=decodeURIComponent(a.path)}}],d=0;d=d)b.push(d);else if(2047>=d)b.push(192|d>>6,128|d&63);else if(55296==(d&64512))if(c>18,128|d>>12&63,128|d>>6&63,128|d&63)}else b.push(239,191,189);else 56320==(d&64512)?b.push(239,191,189):b.push(224|d>>12,128|d>>6&63,128|d&63)}return new Uint8Array(b)},Ya=function(a,b){switch(a){case "base64":var c=-1!==b.indexOf("-"), +d=-1!==b.indexOf("_");if(c||d)throw ra(a,"Invalid character '"+(c?"-":"_")+"' found: is it base64url encoded?");break;case "base64url":c=-1!==b.indexOf("+");d=-1!==b.indexOf("/");if(c||d)throw ra(a,"Invalid character '"+(c?"+":"/")+"' found: is it base64 encoded?");b=b.replace(/-/g,"+").replace(/_/g,"/")}var e;try{e=atob(b)}catch(f){throw ra(a,"Invalid character found");}a=new Uint8Array(e.length);for(b=0;b][;base64],");b=b[1]||null;this.a=!1;this.b=null;if(null!=b){var c=b.length-7;this.b=(this.a=0<=c&&b.indexOf(";base64",c)==c)?b.substring(0,b.length-7):b}this.c=a.substring(a.indexOf(",")+1)};var ab=function(a){var b=encodeURIComponent,c="?";sa(a,function(a,e){a=b(a)+"="+b(e);c=c+a+"&"});return c=c.slice(0,-1)};var A=function(a,b,c,d,e,f){this.b=a;this.h=b;this.f=c;this.a=d;this.g=e;this.c=f};k=A.prototype;k.na=function(){return this.b};k.Ja=function(){return this.h};k.Ga=function(){return this.f};k.Ba=function(){return this.a};k.pa=function(){if(y(this.a)){var a=this.a.downloadURLs;return y(a)&&y(a[0])?a[0]:null}return null};k.Ia=function(){return this.g};k.Ea=function(){return this.c};var bb=function(a,b){b.unshift(a);z.call(this,Ma.apply(null,b));b.shift()};v(bb,z);bb.prototype.name="AssertionError"; +var cb=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new bb(""+e,f||[]);},B=function(a,b,c){a||cb("",null,b,Array.prototype.slice.call(arguments,2))},db=function(a,b){throw new bb("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},eb=function(a,b,c){t(a)||cb("Expected function but got %s: %s.",[p(a),a],b,Array.prototype.slice.call(arguments,2))};var fb=function(){this.g=this.g;this.o=this.o};fb.prototype.g=!1;fb.prototype.ea=function(){this.g||(this.g=!0,this.D())};fb.prototype.D=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var gb="closure_listenable_"+(1E6*Math.random()|0),hb=0;var ib;a:{var jb=l.navigator;if(jb){var kb=jb.userAgent;if(kb){ib=kb;break a}}ib=""}var C=function(a){return-1!=ib.indexOf(a)};var lb=function(){};lb.prototype.b=null;lb.prototype.a=ca;var mb=function(a){return a.b||(a.b=a.f())};lb.prototype.f=ca;var nb=Array.prototype.indexOf?function(a,b,c){B(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(r(a))return r(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:r(a)?a.charAt(b):a[b]},ub=function(a,b){return 0<=nb(a,b)},vb=function(a){if("array"!=p(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},wb=function(a,b){b=nb(a,b);var c;if(c=0<=b)B(null!=a.length),Array.prototype.splice.call(a, +b,1);return c},xb=function(a){var b=a.length;if(0=this.b()){for(var c=this.a,d=0;d>1,a[d].a>c.a)a[b]=a[d],b=d;else break;a[b]=c};Pb.prototype.A=function(){for(var a=this.a,b=[],c=a.length,d=0;dparseFloat(gc)){fc=String(ic);break a}}fc=gc} +var kc=fc,Ka={},E=function(a){return La(a,function(){for(var b=0,c=Na(String(kc)).split("."),d=Na(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f2*a.f&&vc(a),!0):!1},vc=function(a){if(a.f!=a.a.length){for(var b=0,c=0;b=d.a.length)throw Yb;var e=d.a[b++];return a?e:d.c[e]};return e};var xc=function(a,b){Cb.call(this,a?a.type:"");this.c=this.a=this.target=null;if(a){this.type=a.type;this.target=a.target||a.srcElement;this.a=b;if((b=a.relatedTarget)&&cc)try{Ja(b.nodeName)}catch(c){}this.c=a;a.defaultPrevented&&this.b()}};v(xc,Cb);xc.prototype.b=function(){xc.I.b.call(this);var a=this.c;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,uc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var G=function(a,b){this.a=0;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=ba)try{var c=this;a.call(b,function(a){yc(c,2,a)},function(a){if(!(a instanceof zc))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(e){}yc(c,3,a)})}catch(d){yc(this,3,d)}},Ac=function(){this.next=this.f=this.c=this.b=this.a=null;this.g=!1};Ac.prototype.reset=function(){this.f=this.c=this.b=this.a=null;this.g=!1}; +var Bc=new za(function(){return new Ac},function(a){a.reset()},100),Cc=function(a,b,c){var d=Bc.get();d.b=a;d.c=b;d.f=c;return d},Dc=function(a){if(a instanceof G)return a;var b=new G(ba);yc(b,2,a);return b},Ec=function(a){return new G(function(b,c){c(a)})}; +G.prototype.then=function(a,b,c){null!=a&&eb(a,"opt_onFulfilled should be a function.");null!=b&&eb(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");return Fc(this,t(a)?a:null,t(b)?b:null,c)};Ha(G);G.prototype.l=function(a,b){return Fc(this,null,a,b)};G.prototype.cancel=function(a){0==this.a&&qc(function(){var b=new zc(a);Gc(this,b)},this)}; +var Gc=function(a,b){if(0==a.a)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.g||(d++,g.a==a&&(e=g),!(e&&1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode= +-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.a;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.a=d[e];var f=gd(d[e],a,!0,b),c=c&&f}for(e=0;e>>0),Wc=function(a){B(a,"Listener can not be null.");if(t(a))return a;B(a.handleEvent,"An object listener must have handleEvent method."); +a[hd]||(a[hd]=function(b){return a.handleEvent(b)});return a[hd]};var H=function(a,b){fb.call(this);this.m=a||0;this.f=b||10;if(this.m>this.f)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Rb;this.c=new Qc;this.j=null;this.S()};v(H,fb);H.prototype.W=function(){var a=ja();if(!(null!=this.j&&0>a-this.j)){for(var b;0this.f&&0=b.j&&b.cancel())}this.u?this.u.call(this.s,this):this.l=!0;if(!this.a){a=new md;if(this.a){if(!this.l)throw new nd;this.l=!1}B(!(a instanceof ld),"An execution sequence may not be initiated with a blocking Deferred.");this.a=!0;this.b=a;this.f=!0;od(this)}}};ld.prototype.m=function(a,b){this.i=!1;this.a=!0;this.b=b;this.f=!a;od(this)}; +var pd=function(a,b,c){B(!a.o,"Blocking Deferreds can not be re-used");a.g.push([b,c,void 0]);a.a&&od(a)};ld.prototype.then=function(a,b,c){var d,e,f=new G(function(a,b){d=a;e=b});pd(this,d,function(a){a instanceof md?f.cancel():e(a)});return f.then(a,b,c)};Ha(ld); +var qd=function(a){return rb(a.g,function(a){return t(a[1])})},od=function(a){if(a.h&&a.a&&qd(a)){var b=a.h,c=rd[b];c&&(l.clearTimeout(c.a),delete rd[b]);a.h=0}a.c&&(a.c.j--,delete a.c);for(var b=a.b,d=c=!1;a.g.length&&!a.i;){var e=a.g.shift(),f=e[0],g=e[1],e=e[2];if(f=a.f?g:f)try{var h=f.call(e||a.s,b);n(h)&&(a.f=a.f&&(h==b||h instanceof Error),a.b=b=h);if(Ia(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.i=!0}catch(m){b=m,a.f=!0,qd(a)||(c=!0)}}a.b=b;d&&(h=u(a.m,a,!0),d=u(a.m,a, +!1),b instanceof ld?(pd(b,h,d),b.o=!0):b.then(h,d));c&&(b=new sd(b),rd[b.a]=b,a.h=b.a)},nd=function(){z.call(this)};v(nd,z);nd.prototype.message="Deferred has already fired";nd.prototype.name="AlreadyCalledError";var md=function(){z.call(this)};v(md,z);md.prototype.message="Deferred was canceled";md.prototype.name="CanceledError";var sd=function(a){this.a=l.setTimeout(u(this.c,this),0);this.b=a}; +sd.prototype.c=function(){B(rd[this.a],"Cannot throw an error that is not scheduled.");delete rd[this.a];throw this.b;};var rd={};var td=function(a){this.f=a;this.b=this.c=this.a=null},ud=function(a,b){this.name=a;this.value=b};ud.prototype.toString=function(){return this.name};var vd=new ud("SEVERE",1E3),wd=new ud("CONFIG",700),xd=new ud("FINE",500),yd=function(a){if(a.c)return a.c;if(a.a)return yd(a.a);db("Root logger has no level set.");return null}; +td.prototype.log=function(a,b,c){if(a.value>=yd(this).value)for(t(b)&&(b=b()),a=new Ba(a,String(b),this.f),c&&(a.a=c),c="log:"+a.b,l.console&&(l.console.timeStamp?l.console.timeStamp(c):l.console.markTimeline&&l.console.markTimeline(c)),l.msWriteProfilerMark&&l.msWriteProfilerMark(c),c=this;c;)c=c.a}; +var zd={},Ad=null,Bd=function(a){Ad||(Ad=new td(""),zd[""]=Ad,Ad.c=wd);var b;if(!(b=zd[a])){b=new td(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Bd(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;zd[a]=b}return b};var Cd=function(){fb.call(this);this.b=new Ib(this);this.Y=this;this.G=null};v(Cd,fb);Cd.prototype[gb]=!0;Cd.prototype.removeEventListener=function(a,b,c,d){dd(this,a,b,c,d)}; +var I=function(a,b){Xc(a);var c,d=a.G;if(d){c=[];for(var e=1;d;d=d.G)c.push(d),B(1E3>++e,"infinite loop")}a=a.Y;d=b.type||b;r(b)?b=new Cb(b,a):b instanceof Cb?b.target=b.target||a:(e=b,b=new Cb(d,a),Ga(b,e));var e=!0,f;if(c)for(var g=c.length-1;0<=g;g--)f=b.a=c[g],e=Dd(f,d,!0,b)&&e;f=b.a=a;e=Dd(f,d,!0,b)&&e;e=Dd(f,d,!1,b)&&e;if(c)for(g=0;g=f)c=void 0;else{if(1==f)vb(e);else{e[0]=e.pop();for(var e=0,d=d.a,f=d.length,g=d[e];e>1;){var h=2*e+1,m=2*e+2,h=mg.a)break;d[e]=d[h];e=h}d[e]=g}c=c.b}c.apply(this,[b])}else break}}; +k.$=function(a){J.I.$.call(this,a);this.aa()};k.S=function(){J.I.S.call(this);this.aa()};k.D=function(){J.I.D.call(this);l.clearTimeout(void 0);vb(this.h.a);this.h=null};var K=function(a,b){a&&a.log(xd,b,void 0)};var Ed=function(a,b,c){if(t(a))c&&(a=u(a,c));else if(a&&"function"==typeof a.handleEvent)a=u(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647e,h=ub([408,429],e),g=ub(g.o,e),f=f||h||g;f?(e=7===b.K,jd(b),a(!1,new Xd(!1,null,e))):(e=ub(d.G,e),a(!0,new Xd(e,b)))})})}function c(a,b){var c=d.l;a=d.j;var e=b.c;if(b.b)try{var f=d.s(e,Sd(e));n(f)?c(f):c()}catch(q){a(q)}else null!==e?(b=ma(),f=Sd(e),b.serverResponse=f,d.i?a(d.i(e,b)):a(b)):(b=b.a?d.g?qa(): +na():new w("retry-limit-exceeded","Max retry time for operation exceeded, please try again."),a(b));jd(e)}var d=a;a.h?c(0,new Xd(!1,null,!0)):a.c=ka(b,c,a.F)};Wd.prototype.a=function(){return this.B};Wd.prototype.cancel=function(a){this.h=!0;this.g=a||!1;null!==this.c&&(0,this.c)(!1);null!==this.b&&this.b.abort()}; +var Yd=function(a,b,c){var d=ab(a.b),d=a.i+d,e=a.headers?ta(a.headers):{};null!==b&&0b&&(b+=a.size),0>b&&(b=0),0>c&&(c+=a.size),cb.length?b:Hb(b)};a.push(b);b=new S("size");b.a=function(a,b){return y(b)?+b:b};a.push(b);a.push(new S("timeCreated"));a.push(new S("updated"));a.push(new S("md5Hash",null,!0)); +a.push(new S("cacheControl",null,!0));a.push(new S("contentDisposition",null,!0));a.push(new S("contentEncoding",null,!0));a.push(new S("contentLanguage",null,!0));a.push(new S("contentType",null,!0));a.push(new S("metadata","customMetadata",!0));a.push(new S("downloadTokens","downloadURLs",!1,function(a,b){if(!(xa(b)&&0m;m++)h+=Math.random().toString().slice(2);g["Content-Type"]="multipart/related; boundary="+h;e=ze(b,d,e);m=le(e,c);d=ae("--"+h+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+ +m+"\r\n--"+h+"\r\nContent-Type: "+e.contentType+"\r\n\r\n",d,"\r\n--"+h+"--");if(null===d)throw oa();a=new x(la+"/v0"+f,"POST",ue(a,c),a.b);a.b={name:e.fullPath};a.headers=g;a.body=d.v;a.a=ve(b);return a},Be=function(a,b,c,d){this.a=a;this.total=b;this.b=!!c;this.c=d||null},Ce=function(a,b){var c;try{c=Td(a,"X-Goog-Upload-Status")}catch(d){te(!1)}te(ub(b||["active"],c));return c},De=function(a,b,c,d,e){var f="/b/"+encodeURIComponent(b.bucket)+"/o",g=ze(b,d,e);e={name:g.fullPath};f=la+"/v0"+f;d={"X-Goog-Upload-Protocol":"resumable", +"X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":d.a,"X-Goog-Upload-Header-Content-Type":g.contentType,"Content-Type":"application/json; charset=utf-8"};c=le(g,c);a=new x(f,"POST",function(a){Ce(a);var b;try{b=Td(a,"X-Goog-Upload-URL")}catch(q){te(!1)}te(xa(b));return b},a.b);a.b=e;a.headers=d;a.body=c;a.a=ve(b);return a},Ee=function(a,b,c,d){a=new x(c,"POST",function(a){var b=Ce(a,["active","final"]),c;try{c=Td(a,"X-Goog-Upload-Size-Received")}catch(h){te(!1)}a=c;isFinite(a)&& +(a=String(a));a=r(a)?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN;te(!isNaN(a));return new Be(a,d.a,"final"===b)},a.b);a.headers={"X-Goog-Upload-Command":"query"};a.a=ve(b);a.g=!1;return a},Fe=function(a,b,c,d,e,f,g){var h=new Be(0,0);g?(h.a=g.a,h.total=g.total):(h.a=0,h.total=d.a);if(d.a!==h.total)throw new w("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var m=g=h.total-h.a;0262144*a.i&&(a.i*=2);a.a=null;Oe(a,b.a);b.b?(a.h=b.c,V(a,"success")):Ge(a)},a.V)})},Ke=function(a){Ne(a,function(b){var c=xe(a.c,a.j,a.m);a.a=R(a.c,c,b);a.a.a().then(function(b){a.a=null;a.h=b;V(a,"success")},a.Y)})},Me=function(a){Ne(a,function(b){var c=Ae(a.c,a.j,a.m,a.f,a.h);a.a= +R(a.c,c,b);a.a.a().then(function(b){a.a=null;a.h=b;Oe(a,a.f.a);V(a,"success")},a.V)})},Oe=function(a,b){var c=a.l;a.l=b;a.l>c&&Pe(a)},V=function(a,b){if(a.b!==b)switch(b){case "canceling":a.b=b;null!==a.a&&a.a.cancel();break;case "pausing":a.b=b;null!==a.a&&a.a.cancel();break;case "running":var c="paused"===a.b;a.b=b;c&&(Pe(a),He(a));break;case "paused":a.b=b;Pe(a);break;case "canceled":a.g=na();a.b=b;Pe(a);break;case "error":a.b=b;Pe(a);break;case "success":a.b=b,Pe(a)}},Ge=function(a){switch(a.b){case "pausing":V(a, +"paused");break;case "canceling":V(a,"canceled");break;case "running":He(a)}};W.prototype.C=function(){return new A(this.l,this.f.a,wa(this.b),this.h,this,this.L)}; +W.prototype.O=function(a,b,c,d){function e(a){try{g(a);return}catch(P){}try{if(h(a),!(n(a.next)||n(a.error)||n(a.complete)))throw"";}catch(P){throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";}}function f(a){return function(b,c,d){null!==a&&T("on",a,arguments);var e=new Ta(b,c,d);Qe(m,e);return function(){wb(m.F,e)}}}var g=se().a,h=re(null,!0).a;T("on",[oe(function(){if("state_changed"!==a)throw"Expected one of the event types: [state_changed].";}),re(e,!0), +se(),se()],arguments);var m=this,q=[re(function(a){if(null===a)throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";e(a)}),se(),se()];return n(b)||n(c)||n(d)?f(null)(b,c,d):f(q)};W.prototype.then=function(a,b){return this.G.then(a,b)}; +var Qe=function(a,b){a.F.push(b);Re(a,b)},Pe=function(a){Se(a);var b=xb(a.F);ob(b,function(b){Re(a,b)})},Se=function(a){if(null!==a.o){var b=!0;switch(wa(a.b)){case "success":Rc(a.o.bind(null,a.C()))();break;case "canceled":case "error":Rc(a.B.bind(null,a.g))();break;default:b=!1}b&&(a.o=null,a.B=null)}},Re=function(a,b){switch(wa(a.b)){case "running":case "paused":null!==b.next&&Rc(b.next.bind(b,a.C()))();break;case "success":null!==b.b&&Rc(b.b.bind(b))();break;case "canceled":case "error":null!== +b.a&&Rc(b.a.bind(b,a.g))();break;default:null!==b.a&&Rc(b.a.bind(b,a.g))()}};W.prototype.R=function(){T("resume",[],arguments);var a="paused"===this.b||"pausing"===this.b;a&&V(this,"running");return a};W.prototype.P=function(){T("pause",[],arguments);var a="running"===this.b;a&&V(this,"pausing");return a};W.prototype.cancel=function(){T("cancel",[],arguments);var a="running"===this.b||"pausing"===this.b;a&&V(this,"canceling");return a};var X=function(a,b){this.b=a;if(b)this.a=b instanceof Qa?b:Sa(b);else if(a=a.bucket(),null!==a)this.a=new Qa(a,"");else throw new w("no-default-bucket","No default bucket found. Did you set the 'storageBucket' property when initializing the app?");};X.prototype.toString=function(){T("toString",[],arguments);return"gs://"+this.a.bucket+"/"+this.a.path};var Te=function(a,b){return new X(a,b)};k=X.prototype; +k.fa=function(a){T("child",[oe()],arguments);var b=Gb(this.a.path,a);return Te(this.b,new Qa(this.a.bucket,b))};k.Da=function(){var a;a=this.a.path;if(0==a.length)a=null;else{var b=a.lastIndexOf("/");a=-1===b?"":a.slice(0,b)}return null===a?null:Te(this.b,new Qa(this.a.bucket,a))};k.Fa=function(){return Te(this.b,new Qa(this.a.bucket,""))};k.ma=function(){return this.a.bucket};k.ya=function(){return this.a.path};k.Ca=function(){return Hb(this.a.path)};k.Ha=function(){return this.b.i}; +k.ra=function(a,b){T("put",[pe(),new U(me,!0)],arguments);Ue(this,"put");return new W(this,this.b,this.a,je(),new O(a),b)};k.sa=function(a,b,c){T("putString",[oe(),oe(Va,!0),new U(me,!0)],arguments);Ue(this,"putString");var d=$a(y(b)?b:"raw",a),e=c?ta(c):{};!y(e.contentType)&&y(d.a)&&(e.contentType=d.a);return new W(this,this.b,this.a,je(),new O(d.data,!0),e)}; +k.delete=function(){T("delete",[],arguments);Ue(this,"delete");var a=this;return ge(this.b).then(function(b){var c=ye(a.b,a.a);return R(a.b,c,b).a()})};k.ga=function(){T("getMetadata",[],arguments);Ue(this,"getMetadata");var a=this;return ge(this.b).then(function(b){var c=xe(a.b,a.a,je());return R(a.b,c,b).a()})}; +k.ta=function(a){T("updateMetadata",[new U(me,void 0)],arguments);Ue(this,"updateMetadata");var b=this;return ge(this.b).then(function(c){var d=b.b,e=b.a,f=a,g=je(),h=Ra(e),h=la+"/v0"+h,f=le(f,g),d=new x(h,"PATCH",ue(d,g),d.c);d.headers={"Content-Type":"application/json; charset=utf-8"};d.body=f;d.a=we(e);return R(b.b,d,c).a()})}; +k.qa=function(){T("getDownloadURL",[],arguments);Ue(this,"getDownloadURL");return this.ga().then(function(a){a=a.downloadURLs[0];if(y(a))return a;throw new w("no-download-url","The given file does not have any download URLs.");})};var Ue=function(a,b){if(""===a.a.path)throw new w("invalid-root-operation","The operation '"+b+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");};var Y=function(a){this.a=new fe(a,function(a,c){return new X(a,c)},Yd,this);this.b=a;this.c=new Ve(this)};k=Y.prototype;k.ua=function(a){T("ref",[oe(function(a){if(/^[A-Za-z]+:\/\//.test(a))throw"Expected child path but got a URL, use refFromURL instead.";},!0)],arguments);var b=new X(this.a);return n(a)?b.fa(a):b}; +k.va=function(a){T("refFromURL",[oe(function(a){if(!/^[A-Za-z]+:\/\//.test(a))throw"Expected full URL but got a child path, use ref instead.";try{Sa(a)}catch(c){throw"Expected valid full URL but got an invalid one.";}},!1)],arguments);return new X(this.a,a)};k.Aa=function(){return this.a.b};k.xa=function(a){T("setMaxUploadRetryTime",[qe()],arguments);this.a.b=a};k.za=function(){return this.a.c};k.wa=function(a){T("setMaxOperationRetryTime",[qe()],arguments);this.a.c=a};k.la=function(){return this.b}; +k.ka=function(){return this.c};var Ve=function(a){this.a=a};Ve.prototype.delete=function(){var a=this.a.a;a.f=!0;a.a=null;ee(a.h)};var Z=function(a,b,c){Object.defineProperty(a,b,{get:c})};X.prototype.toString=X.prototype.toString;X.prototype.child=X.prototype.fa;X.prototype.put=X.prototype.ra;X.prototype.putString=X.prototype.sa;X.prototype["delete"]=X.prototype.delete;X.prototype.getMetadata=X.prototype.ga;X.prototype.updateMetadata=X.prototype.ta;X.prototype.getDownloadURL=X.prototype.qa;Z(X.prototype,"parent",X.prototype.Da);Z(X.prototype,"root",X.prototype.Fa);Z(X.prototype,"bucket",X.prototype.ma); +Z(X.prototype,"fullPath",X.prototype.ya);Z(X.prototype,"name",X.prototype.Ca);Z(X.prototype,"storage",X.prototype.Ha);Y.prototype.ref=Y.prototype.ua;Y.prototype.refFromURL=Y.prototype.va;Z(Y.prototype,"maxOperationRetryTime",Y.prototype.za);Y.prototype.setMaxOperationRetryTime=Y.prototype.wa;Z(Y.prototype,"maxUploadRetryTime",Y.prototype.Aa);Y.prototype.setMaxUploadRetryTime=Y.prototype.xa;Z(Y.prototype,"app",Y.prototype.la);Z(Y.prototype,"INTERNAL",Y.prototype.ka);Ve.prototype["delete"]=Ve.prototype.delete; +Y.prototype.capi_=function(a){la=a};W.prototype.on=W.prototype.O;W.prototype.resume=W.prototype.R;W.prototype.pause=W.prototype.P;W.prototype.cancel=W.prototype.cancel;Z(W.prototype,"snapshot",W.prototype.C);Z(A.prototype,"bytesTransferred",A.prototype.na);Z(A.prototype,"totalBytes",A.prototype.Ja);Z(A.prototype,"state",A.prototype.Ga);Z(A.prototype,"metadata",A.prototype.Ba);Z(A.prototype,"downloadURL",A.prototype.pa);Z(A.prototype,"task",A.prototype.Ia);Z(A.prototype,"ref",A.prototype.Ea); +ua.STATE_CHANGED="state_changed";va.RUNNING="running";va.PAUSED="paused";va.SUCCESS="success";va.CANCELED="canceled";va.ERROR="error";Ua.RAW="raw";Ua.BASE64="base64";Ua.BASE64URL="base64url";Ua.DATA_URL="data_url";G.prototype["catch"]=G.prototype.l;G.prototype.then=G.prototype.then; +(function(){function a(a){return new Y(a)}var b={TaskState:va,TaskEvent:ua,StringFormat:Ua,Storage:Y,Reference:X};if("undefined"!==typeof firebase)firebase.INTERNAL.registerService("storage",a,b);else throw Error("Cannot install Firebase Storage - be sure to load firebase-app.js first.");})();})(); diff --git a/lib/firebase/firebase.d.ts b/lib/firebase/firebase.d.ts new file mode 100644 index 00000000..64bb35fa --- /dev/null +++ b/lib/firebase/firebase.d.ts @@ -0,0 +1,406 @@ +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 + Terms: https://developers.google.com/terms */ +declare namespace firebase { + interface FirebaseError { + code: string; + message: string; + name: string; + stack: string; + } + + class Promise extends Promise_Instance { + static all(values: firebase.Promise[]): firebase.Promise; + static reject(error: Error): firebase.Promise; + static resolve(value?: T): firebase.Promise; + } + class Promise_Instance implements firebase.Thenable { + constructor( + resolver: + (a?: (a: T) => undefined, b?: (a: Error) => undefined) => any); + catch (onReject?: (a: Error) => any): firebase.Thenable; + then(onResolve?: (a: T) => any, onReject?: (a: Error) => any): + firebase.Promise; + } + + var SDK_VERSION: string; + + interface Thenable { + catch (onReject?: (a: Error) => any): any; + then(onResolve?: (a: T) => any, onReject?: (a: Error) => any): + firebase.Thenable; + } + + interface User extends firebase.UserInfo { + delete (): firebase.Promise; + emailVerified: boolean; + getToken(opt_forceRefresh?: boolean): firebase.Promise; + isAnonymous: boolean; + link(credential: firebase.auth.AuthCredential): firebase.Promise; + linkWithPopup(provider: firebase.auth.AuthProvider): firebase.Promise; + linkWithRedirect(provider: firebase.auth.AuthProvider): + firebase.Promise; + providerData: (firebase.UserInfo|null)[]; + reauthenticate(credential: firebase.auth.AuthCredential): + firebase.Promise; + refreshToken: string; + reload(): firebase.Promise; + sendEmailVerification(): firebase.Promise; + unlink(providerId: string): firebase.Promise; + updateEmail(newEmail: string): firebase.Promise; + updatePassword(newPassword: string): firebase.Promise; + updateProfile(profile: {displayName: string | null, photoURL: string|null}): + firebase.Promise; + } + + interface UserInfo { + displayName: string|null; + email: string|null; + photoURL: string|null; + providerId: string; + uid: string; + } + + function app(name: string): firebase.app.App; + + var apps: (firebase.app.App|null)[]; + + function auth(app?: firebase.app.App): firebase.auth.Auth; + + function database(app?: firebase.app.App): firebase.database.Database; + + function initializeApp(options: Object, name?: string): firebase.app.App; + + function messaging(app?: firebase.app.App): firebase.messaging.Messaging; + + function storage(app?: firebase.app.App): firebase.storage.Storage; +} + +declare namespace firebase.app { + interface App { + auth(): firebase.auth.Auth; + database(): firebase.database.Database; + delete (): firebase.Promise; + name: string; + options: Object; + storage(): firebase.storage.Storage; + } +} + +declare namespace firebase.auth { + interface ActionCodeInfo {} + + interface Auth { + app: firebase.app.App; + applyActionCode(code: string): firebase.Promise; + checkActionCode(code: string): firebase.Promise; + confirmPasswordReset(code: string, newPassword: string): + firebase.Promise; + createCustomToken(uid: string, developerClaims?: Object|null): string; + createUserWithEmailAndPassword(email: string, password: string): + firebase.Promise; + currentUser: firebase.User|null; + fetchProvidersForEmail(email: string): firebase.Promise; + getRedirectResult(): firebase.Promise; + onAuthStateChanged( + nextOrObserver: Object, opt_error?: (a: firebase.auth.Error) => any, + opt_completed?: () => any): () => any; + sendPasswordResetEmail(email: string): firebase.Promise; + signInAnonymously(): firebase.Promise; + signInWithCredential(credential: firebase.auth.AuthCredential): + firebase.Promise; + signInWithCustomToken(token: string): firebase.Promise; + signInWithEmailAndPassword(email: string, password: string): + firebase.Promise; + signInWithPopup(provider: firebase.auth.AuthProvider): + firebase.Promise; + signInWithRedirect(provider: firebase.auth.AuthProvider): + firebase.Promise; + signOut(): firebase.Promise; + verifyIdToken(idToken: string): firebase.Promise; + verifyPasswordResetCode(code: string): firebase.Promise; + } + + interface AuthCredential { + provider: string; + } + + interface AuthProvider { + providerId: string; + } + + class EmailAuthProvider extends EmailAuthProvider_Instance { + static PROVIDER_ID: string; + static credential(email: string, password: string): + firebase.auth.AuthCredential; + } + class EmailAuthProvider_Instance implements firebase.auth.AuthProvider { + providerId: string; + } + + interface Error { + code: string; + message: string; + } + + class FacebookAuthProvider extends FacebookAuthProvider_Instance { + static PROVIDER_ID: string; + static credential(token: string): firebase.auth.AuthCredential; + } + class FacebookAuthProvider_Instance implements firebase.auth.AuthProvider { + addScope(scope: string): any; + providerId: string; + } + + class GithubAuthProvider extends GithubAuthProvider_Instance { + static PROVIDER_ID: string; + static credential(token: string): firebase.auth.AuthCredential; + } + class GithubAuthProvider_Instance implements firebase.auth.AuthProvider { + addScope(scope: string): any; + providerId: string; + } + + class GoogleAuthProvider extends GoogleAuthProvider_Instance { + static PROVIDER_ID: string; + static credential(idToken?: string|null, accessToken?: string|null): + firebase.auth.AuthCredential; + } + class GoogleAuthProvider_Instance implements firebase.auth.AuthProvider { + addScope(scope: string): any; + providerId: string; + } + + class TwitterAuthProvider extends TwitterAuthProvider_Instance { + static PROVIDER_ID: string; + static credential(token: string, secret: string): + firebase.auth.AuthCredential; + } + class TwitterAuthProvider_Instance implements firebase.auth.AuthProvider { + providerId: string; + } + + type UserCredential = { + credential: firebase.auth.AuthCredential | null, + user: firebase.User | null + }; +} + +declare namespace firebase.database { + interface DataSnapshot { + child(path: string): firebase.database.DataSnapshot; + exists(): boolean; + exportVal(): any; + forEach(action: (a: firebase.database.DataSnapshot) => boolean): boolean; + getPriority(): string|number|null; + hasChild(path: string): boolean; + hasChildren(): boolean; + key: string|null; + numChildren(): number; + ref: firebase.database.Reference; + val(): any; + } + + interface Database { + app: firebase.app.App; + goOffline(): any; + goOnline(): any; + ref(path?: string): firebase.database.Reference; + refFromURL(url: string): firebase.database.Reference; + } + + interface OnDisconnect { + cancel(onComplete?: (a: Error|null) => any): firebase.Promise; + remove(onComplete?: (a: Error|null) => any): firebase.Promise; + set(value: any, onComplete?: (a: Error|null) => any): firebase.Promise; + setWithPriority( + value: any, priority: number|string|null, + onComplete?: (a: Error|null) => any): firebase.Promise; + update(values: Object, onComplete?: (a: Error|null) => any): + firebase.Promise; + } + + interface Query { + endAt(value: number|string|boolean|null, key?: string): + firebase.database.Query; + equalTo(value: number|string|boolean|null, key?: string): + firebase.database.Query; + isEqual(other: firebase.database.Query|null): boolean; + limitToFirst(limit: number): firebase.database.Query; + limitToLast(limit: number): firebase.database.Query; + off(eventType?: string, + callback?: (a: firebase.database.DataSnapshot, b?: string|null) => any, + context?: Object|null): any; + on(eventType: string, + callback: (a: firebase.database.DataSnapshot|null, b?: string) => any, + cancelCallbackOrContext?: Object|null, context?: Object| + null): (a: firebase.database.DataSnapshot|null, b?: string) => any; + once( + eventType: string, + successCallback?: + (a: firebase.database.DataSnapshot, b?: string) => any, + failureCallbackOrContext?: Object|null, + context?: Object|null): firebase.Promise; + orderByChild(path: string): firebase.database.Query; + orderByKey(): firebase.database.Query; + orderByPriority(): firebase.database.Query; + orderByValue(): firebase.database.Query; + ref: firebase.database.Reference; + startAt(value: number|string|boolean|null, key?: string): + firebase.database.Query; + toString(): string; + } + + interface Reference extends firebase.database.Query { + child(path: string): firebase.database.Reference; + key: string|null; + onDisconnect(): firebase.database.OnDisconnect; + parent: firebase.database.Reference|null; + push(value?: any, onComplete?: (a: Error|null) => any): + firebase.database.ThenableReference; + remove(onComplete?: (a: Error|null) => any): firebase.Promise; + root: firebase.database.Reference; + set(value: any, onComplete?: (a: Error|null) => any): firebase.Promise; + setPriority( + priority: string|number|null, + onComplete: (a: Error|null) => any): firebase.Promise; + setWithPriority( + newVal: any, newPriority: string|number|null, + onComplete?: (a: Error|null) => any): firebase.Promise; + transaction( + transactionUpdate: (a: any) => any, + onComplete?: + (a: Error|null, b: boolean, + c: firebase.database.DataSnapshot|null) => any, + applyLocally?: boolean): firebase.Promise; + update(values: Object, onComplete?: (a: Error|null) => any): + firebase.Promise; + } + + interface ThenableReference extends firebase.database.Reference, + firebase.Thenable {} + + function enableLogging(logger?: any, persistent?: boolean): any; +} + +declare namespace firebase.database.ServerValue {} + +declare namespace firebase.messaging { + interface Messaging { + deleteToken(token: string): firebase.Promise|null; + getToken(): firebase.Promise|null; + onMessage(subscriber: any): any|null; + onTokenRefresh(subscriber: any): any|null; + requestPermission(): firebase.Promise|null; + setBackgroundMessageHandler(callback: (a: Object) => any): any; + useServiceWorker(registration: any): any; + } +} + +declare namespace firebase.storage { + interface FullMetadata extends firebase.storage.UploadMetadata { + bucket: string; + downloadURLs: string[]; + fullPath: string; + generation: string; + metageneration: string; + name: string; + size: number; + timeCreated: string; + updated: string; + } + + interface Reference { + bucket: string; + child(path: string): firebase.storage.Reference; + delete (): Promise; + fullPath: string; + getDownloadURL(): Promise; + getMetadata(): Promise; + name: string; + parent: firebase.storage.Reference|null; + put(data: any|Uint8Array|ArrayBuffer, + metadata?: firebase.storage.UploadMetadata): + firebase.storage.UploadTask; + putString( + data: string, format?: firebase.storage.StringFormat, + metadata?: firebase.storage.UploadMetadata): + firebase.storage.UploadTask; + root: firebase.storage.Reference; + storage: firebase.storage.Storage; + toString(): string; + updateMetadata(metadata: firebase.storage.SettableMetadata): Promise; + } + + interface SettableMetadata { + cacheControl?: string|null; + contentDisposition?: string|null; + contentEncoding?: string|null; + contentLanguage?: string|null; + contentType?: string|null; + customMetadata?: {[/* warning: coerced from ? */ key: string]: string}|null; + } + + interface Storage { + app: firebase.app.App; + maxOperationRetryTime: number; + maxUploadRetryTime: number; + ref(path?: string): firebase.storage.Reference; + refFromURL(url: string): firebase.storage.Reference; + setMaxOperationRetryTime(time: number): any; + setMaxUploadRetryTime(time: number): any; + } + + type StringFormat = string; + var StringFormat: { + BASE64: StringFormat, + BASE64URL: StringFormat, + DATA_URL: StringFormat, + RAW: StringFormat, + }; + + type TaskEvent = string; + var TaskEvent: { + STATE_CHANGED: TaskEvent, + }; + + type TaskState = string; + var TaskState: { + CANCELED: TaskState, + ERROR: TaskState, + PAUSED: TaskState, + RUNNING: TaskState, + SUCCESS: TaskState, + }; + + interface UploadMetadata extends firebase.storage.SettableMetadata { + md5Hash?: string|null; + } + + interface UploadTask { + cancel(): boolean; + catch (onRejected: (a: Error) => any): Promise; + on(event: firebase.storage.TaskEvent, nextOrObserver?: null|Object, + error?: ((a: Error) => any)|null, complete?: (() => any)|null): Function; + pause(): boolean; + resume(): boolean; + snapshot: firebase.storage.UploadTaskSnapshot; + then( + onFulfilled?: ((a: firebase.storage.UploadTaskSnapshot) => any)|null, + onRejected?: ((a: Error) => any)|null): Promise; + } + + interface UploadTaskSnapshot { + bytesTransferred: number; + downloadURL: string|null; + metadata: firebase.storage.FullMetadata; + ref: firebase.storage.Reference; + state: firebase.storage.TaskState; + task: firebase.storage.UploadTask; + totalBytes: number; + } +} + +declare module 'firebase' { + export = firebase; +} diff --git a/lib/firebase/firebase.js b/lib/firebase/firebase.js index 4a50e5cb..f82a3069 100644 --- a/lib/firebase/firebase.js +++ b/lib/firebase/firebase.js @@ -1,248 +1,261 @@ -/*! @license Firebase v3.4.1 - Build: 3.4.1-rc.2 +/*! @license Firebase v3.5.2 + Build: 3.5.2-rc.1 Terms: https://developers.google.com/terms */ -var firebase = null; (function() { var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},h="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,l=function(){l=function(){};h.Symbol||(h.Symbol=ba)},ca=0,ba=function(a){return"jscomp_symbol_"+(a||"")+ca++},n=function(){l();var a=h.Symbol.iterator;a||(a=h.Symbol.iterator= -h.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return m(this)}});n=function(){}},m=function(a){var b=0;return da(function(){return be?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;g=z.Reflect;if("object"===typeof g&&"function"===typeof g.decorate)f=g.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3"}),c=this.W+": "+c+" ("+a+").",c=new V(a,c),d;for(d in b)b.hasOwnProperty(d)&&"_"!==d.slice(-1)&&(c[d]=b[d]);return c};var W=Q,X=function(a,b,c){var d=this;this.H=c;this.I=!1;this.i={};this.C=b;this.T=P(void 0,a);Object.keys(c.INTERNAL.factories).forEach(function(a){var b=c.INTERNAL.useAsService(d,a);null!==b&&(b=d.R.bind(d,b),d[a]=b)})};X.prototype.delete=function(){var a=this;return(new W(function(b){Y(a);b()})).then(function(){a.H.INTERNAL.removeApp(a.C);return W.all(Object.keys(a.i).map(function(b){return a.i[b].INTERNAL.delete()}))}).then(function(){a.I=!0;a.i={}})}; -X.prototype.R=function(a){Y(this);void 0===this.i[a]&&(this.i[a]=this.H.INTERNAL.factories[a](this,this.P.bind(this)));return this.i[a]};X.prototype.P=function(a){P(this,a)};var Y=function(a){a.I&&Z(Ia("deleted",{name:a.C}))};h.Object.defineProperties(X.prototype,{name:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.C}},options:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.T}}});X.prototype.name&&X.prototype.options||X.prototype.delete||console.log("dc"); -function Ja(){function a(a){a=a||"[DEFAULT]";var b=d[a];void 0===b&&Z("noApp",{name:a});return b}function b(a,b){Object.keys(e).forEach(function(d){d=c(a,d);if(null!==d&&f[d])f[d](b,a)})}function c(a,b){if("serverAuth"===b)return null;var c=b;a=a.options;"auth"===b&&(a.serviceAccount||a.credential)&&(c="serverAuth","serverAuth"in e||Z("serverAuthMissing"));return c}var d={},e={},f={},g={__esModule:!0,initializeApp:function(a,c){void 0===c?c="[DEFAULT]":"string"===typeof c&&""!==c||Z("bad-app-name", -{name:c+""});void 0!==d[c]&&Z("dupApp",{name:c});a=new X(a,c,g);d[c]=a;b(a,"create");void 0!=a.INTERNAL&&void 0!=a.INTERNAL.getToken||P(a,{INTERNAL:{getToken:function(){return W.resolve(null)},addAuthTokenListener:function(){},removeAuthTokenListener:function(){}}});return a},app:a,apps:null,Promise:W,SDK_VERSION:"0.0.0",INTERNAL:{registerService:function(b,c,d,u){e[b]&&Z("dupService",{name:b});e[b]=c;u&&(f[b]=u);c=function(c){void 0===c&&(c=a());return c[b]()};void 0!==d&&P(c,d);return g[b]=c},createFirebaseNamespace:Ja, -extendNamespace:function(a){P(g,a)},createSubscribe:Ea,ErrorFactory:U,removeApp:function(a){b(d[a],"delete");delete d[a]},factories:e,useAsService:c,Promise:O,deepExtend:P}};g["default"]=g;Object.defineProperty(g,"apps",{get:function(){return Object.keys(d).map(function(a){return d[a]})}});a.App=X;return g}function Z(a,b){throw Error(Ia(a,b));} -function Ia(a,b){b=b||{};b={noApp:"No Firebase App '"+b.name+"' has been created - call Firebase App.initializeApp().","bad-app-name":"Illegal App name: '"+b.name+"'.",dupApp:"Firebase App named '"+b.name+"' already exists.",deleted:"Firebase App named '"+b.name+"' already deleted.",dupService:"Firebase Service named '"+b.name+"' already registered.",serverAuthMissing:"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain."}[a]; -return void 0===b?"Application Error: ("+a+")":b};"undefined"!==typeof firebase&&(firebase=Ja()); })(); -firebase.SDK_VERSION = "3.4.1"; +var firebase = null; (function() { for(var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},h="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ba=function(){ba=function(){};h.Symbol||(h.Symbol=ca)},da=0,ca=function(a){return"jscomp_symbol_"+(a||"")+da++},m=function(){ba();var a=h.Symbol.iterator;a||(a=h.Symbol.iterator= +h.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});m=function(){}},ea=function(a){var b=0;return fa(function(){return be?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;g=C.Reflect;if("object"===typeof g&&"function"===typeof g.decorate)f=g.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3"}),c=this.ka+": "+c+" ("+a+").",c=new V(a,c),d;for(d in b)b.hasOwnProperty(d)&&"_"!==d.slice(-1)&&(c[d]=b[d]);return c};var W=S,X=function(a,b,c){var d=this;this.P=c;this.S=!1;this.l={};this.I=b;this.fa=R(void 0,a);Object.keys(c.INTERNAL.factories).forEach(function(a){var b=c.INTERNAL.useAsService(d,a);null!==b&&(b=d.da.bind(d,b),d[a]=b)})};X.prototype.delete=function(){var a=this;return(new W(function(b){Y(a);b()})).then(function(){a.P.INTERNAL.removeApp(a.I);return W.all(Object.keys(a.l).map(function(b){return a.l[b].INTERNAL.delete()}))}).then(function(){a.S=!0;a.l={}})}; +X.prototype.da=function(a){Y(this);void 0===this.l[a]&&(this.l[a]=this.P.INTERNAL.factories[a](this,this.ca.bind(this)));return this.l[a]};X.prototype.ca=function(a){R(this,a)};var Y=function(a){a.S&&Z(Ra("deleted",{name:a.I}))};h.Object.defineProperties(X.prototype,{name:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.I}},options:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.fa}}});X.prototype.name&&X.prototype.options||X.prototype.delete||console.log("dc"); +function Sa(){function a(a){a=a||"[DEFAULT]";var b=d[a];void 0===b&&Z("noApp",{name:a});return b}function b(a,b){Object.keys(e).forEach(function(d){d=c(a,d);if(null!==d&&f[d])f[d](b,a)})}function c(a,b){if("serverAuth"===b)return null;var c=b;a=a.options;"auth"===b&&(a.serviceAccount||a.credential)&&(c="serverAuth","serverAuth"in e||Z("serverAuthMissing"));return c}var d={},e={},f={},g={__esModule:!0,initializeApp:function(a,c){void 0===c?c="[DEFAULT]":"string"===typeof c&&""!==c||Z("bad-app-name", +{name:c+""});void 0!==d[c]&&Z("dupApp",{name:c});a=new X(a,c,g);d[c]=a;b(a,"create");void 0!=a.INTERNAL&&void 0!=a.INTERNAL.getToken||R(a,{INTERNAL:{getToken:function(){return W.resolve(null)},addAuthTokenListener:function(){},removeAuthTokenListener:function(){}}});return a},app:a,apps:null,Promise:W,SDK_VERSION:"0.0.0",INTERNAL:{registerService:function(b,c,d,v){e[b]&&Z("dupService",{name:b});e[b]=c;v&&(f[b]=v);c=function(c){void 0===c&&(c=a());return c[b]()};void 0!==d&&R(c,d);return g[b]=c},createFirebaseNamespace:Sa, +extendNamespace:function(a){R(g,a)},createSubscribe:La,ErrorFactory:Qa,removeApp:function(a){b(d[a],"delete");delete d[a]},factories:e,useAsService:c,Promise:Q,deepExtend:R}};g["default"]=g;Object.defineProperty(g,"apps",{get:function(){return Object.keys(d).map(function(a){return d[a]})}});a.App=X;return g}function Z(a,b){throw Error(Ra(a,b));} +function Ra(a,b){b=b||{};b={noApp:"No Firebase App '"+b.name+"' has been created - call Firebase App.initializeApp().","bad-app-name":"Illegal App name: '"+b.name+"'.",dupApp:"Firebase App named '"+b.name+"' already exists.",deleted:"Firebase App named '"+b.name+"' already deleted.",dupService:"Firebase Service named '"+b.name+"' already registered.",serverAuthMissing:"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain."}[a]; +return void 0===b?"Application Error: ("+a+")":b};"undefined"!==typeof firebase&&(firebase=Sa()); })(); +firebase.SDK_VERSION = "3.5.2"; (function(){var h,aa=aa||{},l=this,ba=function(){},ca=function(){throw Error("unimplemented abstract method");},m=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!= typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},da=function(a){return null===a},ea=function(a){return"array"==m(a)},fa=function(a){var b=m(a);return"array"==b||"object"==b&&"number"==typeof a.length},n=function(a){return"string"==typeof a},ga=function(a){return"number"==typeof a},p=function(a){return"function"==m(a)},ha=function(a){var b=typeof a; return"object"==b&&null!=a||"function"==b},ia=function(a,b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2/g,ra=/"/g,ta=/'/g,ua=/\x00/g,va=/[\x00&<>"']/,v=function(a,b){return-1!=a.indexOf(b)},wa=function(a,b){return ab?1:0};var xa=function(a,b){b.unshift(a);u.call(this,ma.apply(null,b));b.shift()};t(xa,u);xa.prototype.name="AssertionError"; +arguments)},ka=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},la=Date.now||function(){return+new Date},r=function(a,b){function c(){}c.prototype=b.prototype;a.Vc=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.gf=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e/g,ra=/"/g,sa=/'/g,ta=/\x00/g,va=/[\x00&<>"']/,v=function(a,b){return-1!=a.indexOf(b)},wa=function(a,b){return ab?1:0};var xa=function(a,b){b.unshift(a);u.call(this,ma.apply(null,b));b.shift()};r(xa,u);xa.prototype.name="AssertionError"; var ya=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new xa(""+e,f||[]);},w=function(a,b,c){a||ya("",null,b,Array.prototype.slice.call(arguments,2))},za=function(a,b){throw new xa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Aa=function(a,b,c){ga(a)||ya("Expected number but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments,2));return a},Ba=function(a,b,c){n(a)||ya("Expected string but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments, -2))},Ca=function(a,b,c){p(a)||ya("Expected function but got %s: %s.",[m(a),a],b,Array.prototype.slice.call(arguments,2))};var Da=Array.prototype.indexOf?function(a,b,c){w(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(n(a))return n(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:n(a)?a.charAt(b):a[b]},Ja=function(a,b){return 0<=Da(a,b)},La=function(a,b){b=Da(a,b);var c;(c=0<=b)&&Ka(a,b);return c},Ka=function(a,b){w(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length},Ma=function(a,b){var c=0;Ea(a,function(d,e){b.call(void 0,d,e,a)&&Ka(a,e)&&c++})},Na=function(a){return Array.prototype.concat.apply(Array.prototype, -arguments)},Oa=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Pa=function(a){var b=a.length;if(0parseFloat(lb)){kb=String(nb);break a}}kb=lb} -var ob=kb,cb={},A=function(a){return db(a,function(){for(var b=0,c=na(String(ob)).split("."),d=na(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f>4);64!=g&&(b(f<<4&240|g>>2),64!=k&&b(g<<6&192|k))}},vb=function(){if(!rb){rb={};sb={};for(var a=0;65>a;a++)rb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), -sb[rb[a]]=a,62<=a&&(sb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var wb=!z||9<=Number(pb),xb=z&&!A("9");!ib||A("528");hb&&A("1.9b")||z&&A("8")||eb&&A("9.5")||ib&&A("528");hb&&!A("8")||z&&A("9");var yb=function(){this.za=this.za;this.Vb=this.Vb};yb.prototype.za=!1;yb.prototype.isDisposed=function(){return this.za};yb.prototype.Pa=function(){if(this.Vb)for(;this.Vb.length;)this.Vb.shift()()};var zb=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.Wa=!1;this.wd=!0};zb.prototype.preventDefault=function(){this.defaultPrevented=!0;this.wd=!1};var Ab=function(a,b){zb.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.mb=this.state=null;a&&this.init(a,b)};t(Ab,zb); -Ab.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(hb){var e;a:{try{bb(b.nodeName);e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.offsetX=ib||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=ib||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX: -a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.mb=a;a.defaultPrevented&& -this.preventDefault()};Ab.prototype.preventDefault=function(){Ab.Rc.preventDefault.call(this);var a=this.mb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,xb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Ab.prototype.fe=function(){return this.mb};var Bb="closure_listenable_"+(1E6*Math.random()|0),Cb=0;var Db=function(a,b,c,d,e){this.listener=a;this.Zb=null;this.src=b;this.type=c;this.Eb=!!d;this.Mb=e;this.key=++Cb;this.ab=this.Db=!1},Eb=function(a){a.ab=!0;a.listener=null;a.Zb=null;a.src=null;a.Mb=null};var Fb=function(a){this.src=a;this.w={};this.Ab=0};Fb.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.w[f];a||(a=this.w[f]=[],this.Ab++);var g=Gb(a,b,d,e);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.currentTarget;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;!b.Wa&&0<=e;e--){b.currentTarget=d[e];var f=Xb(d[e],a,!0,b),c=c&&f}for(e=0;!b.Wa&&e>>0),Mb=function(a){w(a,"Listener can not be null.");if(p(a))return a;w(a.handleEvent,"An object listener must have handleEvent method.");a[Yb]||(a[Yb]=function(b){return a.handleEvent(b)});return a[Yb]};var Zb=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;var ac=function(){this.hc="";this.Od=$b};ac.prototype.Pb=!0;ac.prototype.Kb=function(){return this.hc};ac.prototype.toString=function(){return"Const{"+this.hc+"}"};var bc=function(a){if(a instanceof ac&&a.constructor===ac&&a.Od===$b)return a.hc;za("expected object of type Const, got '"+a+"'");return"type_error:Const"},$b={};var B=function(){this.ja="";this.Nd=cc};B.prototype.Pb=!0;B.prototype.Kb=function(){return this.ja};B.prototype.toString=function(){return"SafeUrl{"+this.ja+"}"}; -var dc=function(a){if(a instanceof B&&a.constructor===B&&a.Nd===cc)return a.ja;za("expected object of type SafeUrl, got '"+a+"' of type "+m(a));return"type_error:SafeUrl"},ec=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i,gc=function(a){if(a instanceof B)return a;a=a.Pb?a.Kb():String(a);ec.test(a)||(a="about:invalid#zClosurez");return fc(a)},cc={},fc=function(a){var b=new B;b.ja=a;return b};fc("about:blank");var hc=function(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))},ic=function(a){a=String(a);if(hc(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},lc=function(a){var b=[];jc(new kc,a,b);return b.join("")},kc=function(){this.cc=void 0}, -jc=function(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;fa){var b=xc[a];if(b)return b}b=new C([a|0],0>a?-1:0);-128<=a&&128>a&&(xc[a]=b);return b},F=function(a){if(isNaN(a)||!isFinite(a))return D;if(0>a)return E(F(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new C(b,0)},zc=function(a,b){if(0==a.length)throw Error("number format error: empty string");b=b||10;if(2>b||36f?(f=F(Math.pow(b,f)),d=d.multiply(f).add(F(g))):(d=d.multiply(c),d=d.add(F(g)))}return d},D=yc(0),Ac=yc(1),Bc=yc(16777216),Cc=function(a){if(-1==a.g)return-Cc(E(a));for(var b=0,c=1,d=0;da||36>>0).toString(a),c=e;if(G(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}}; -var H=function(a,b){return 0>b?0:b>>16)+(H(this,e)>>>16)+(H(a,e)>>>16),d=g>>>16,f=f&65535,g=g&65535;c[e]=g<<16|f}return new C(c,c[c.length-1]&-2147483648?-1:0)};var Fc=function(a,b){return a.add(E(b))}; -C.prototype.multiply=function(a){if(G(this)||G(a))return D;if(-1==this.g)return-1==a.g?E(this).multiply(E(a)):E(E(this).multiply(a));if(-1==a.g)return E(this.multiply(E(a)));if(0>this.compare(Bc)&&0>a.compare(Bc))return F(Cc(this)*Cc(a));for(var b=this.h.length+a.h.length,c=[],d=0;d<2*b;d++)c[d]=0;for(d=0;d>>16,g=H(this,d)&65535,k=H(a,e)>>>16,r=H(a,e)&65535;c[2*d+2*e]+=g*r;Gc(c,2*d+2*e);c[2*d+2*e+1]+=f*r;Gc(c,2*d+2*e+1);c[2*d+2*e+1]+= -g*k;Gc(c,2*d+2*e+1);c[2*d+2*e+2]+=f*k;Gc(c,2*d+2*e+2)}for(d=0;d>>16,a[b]&=65535,b++},Ec=function(a,b){if(G(b))throw Error("division by zero");if(G(a))return D;if(-1==a.g)return-1==b.g?Ec(E(a),E(b)):E(Ec(E(a),b));if(-1==b.g)return E(Ec(a,E(b)));if(30=b.compare(a);)c=c.shiftLeft(1),b=b.shiftLeft(1);var d=Hc(c,1),e=Hc(b,1),f;b=Hc(b,2);for(c=Hc(c,2);!G(b);)f=e.add(b),0>=f.compare(a)&&(d=d.add(c), -e=f),b=Hc(b,1),c=Hc(c,1);return d}for(c=D;0<=a.compare(b);){d=Math.max(1,Math.floor(Cc(a)/Cc(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=F(d);for(var g=f.multiply(b);-1==g.g||0>5;a%=32;for(var c=this.h.length+b+(0>>32-a:H(this,e-b);return new C(d,this.g)};var Hc=function(a,b){var c=b>>5;b%=32;for(var d=a.h.length-c,e=[],f=0;f>>b|H(a,f+c+1)<<32-b:H(a,f+c);return new C(e,a.g)};var Jc=function(a,b){this.qb=a;this.na=b};Jc.prototype.Gb=function(a){return this.na==a.na&&this.qb.Gb(Wa(a.qb))};Jc.prototype.toString=ca; -var Mc=function(a){try{var b;if(b=0==a.lastIndexOf("[",0)){var c=a.length-1;b=0<=c&&a.indexOf("]",c)==c}return b?new Kc(a.substring(1,a.length-1)):new Lc(a)}catch(d){return null}},Lc=function(a){var b=D;if(a instanceof C){if(0!=a.g||0>a.compare(D)||0e||255>>=8;return this.Da=b.join(".")}; -var Kc=function(a){var b=D;if(a instanceof C){if(0!=a.g||0>a.compare(D)||0>>16&65535).toString(16));d.push((a&65535).toString(16));Ka(c,c.length-1);Qa(c,d);a=c.join(":")}d=a.split("::");if(2e)c=[];else{for(var f=[],g=0;ge.compare(D)||0>>16).toString(16));a.push(d.toString(16))}for(var c=b=-1,e=d=0,f=0;fd&&(d=e,b=c)):(c=-1,e=0);0c?Math.max(0,a.length+c):c;if(n(a))return n(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:n(a)?a.charAt(b):a[b]},Ka=function(a,b){return 0<=Da(a,b)},Ma=function(a,b){b=Da(a,b);var c;(c=0<=b)&&La(a,b);return c},La=function(a,b){w(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length},Na=function(a,b){var c=0;Fa(a,function(d,e){b.call(void 0,d,e,a)&&La(a,e)&&c++})},Oa=function(a){return Array.prototype.concat.apply(Array.prototype, +arguments)},Pa=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Qa=function(a){var b=a.length;if(0parseFloat(mb)){lb=String(ob);break a}}lb=mb} +var pb=lb,db={},z=function(a){return eb(a,function(){for(var b=0,c=na(String(pb)).split("."),d=na(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f>4);64!=g&&(b(f<<4&240|g>>2),64!=k&&b(g<<6&192|k))}},wb=function(){if(!sb){sb={};tb={};for(var a=0;65>a;a++)sb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), +tb[sb[a]]=a,62<=a&&(tb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var xb=!y||9<=Number(qb),yb=y&&!z("9");!jb||z("528");ib&&z("1.9b")||y&&z("8")||fb&&z("9.5")||jb&&z("528");ib&&!z("8")||y&&z("9");var zb=function(){this.Ba=this.Ba;this.Wb=this.Wb};zb.prototype.Ba=!1;zb.prototype.isDisposed=function(){return this.Ba};zb.prototype.Ra=function(){if(this.Wb)for(;this.Wb.length;)this.Wb.shift()()};var Ab=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.Ya=!1;this.Bd=!0};Ab.prototype.preventDefault=function(){this.defaultPrevented=!0;this.Bd=!1};var Bb=function(a,b){Ab.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.ob=this.state=null;a&&this.init(a,b)};r(Bb,Ab); +Bb.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(ib){var e;a:{try{cb(b.nodeName);e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.offsetX=jb||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=jb||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX: +a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.ob=a;a.defaultPrevented&& +this.preventDefault()};Bb.prototype.preventDefault=function(){Bb.Vc.preventDefault.call(this);var a=this.ob;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,yb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Bb.prototype.le=function(){return this.ob};var Cb="closure_listenable_"+(1E6*Math.random()|0),Db=0;var Eb=function(a,b,c,d,e){this.listener=a;this.ac=null;this.src=b;this.type=c;this.Gb=!!d;this.Nb=e;this.key=++Db;this.cb=this.Fb=!1},Fb=function(a){a.cb=!0;a.listener=null;a.ac=null;a.src=null;a.Nb=null};var Gb=function(a){this.src=a;this.A={};this.Cb=0};Gb.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.A[f];a||(a=this.A[f]=[],this.Cb++);var g=Hb(a,b,d,e);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.currentTarget;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;!b.Ya&&0<=e;e--){b.currentTarget=d[e];var f=Yb(d[e],a,!0,b),c=c&&f}for(e=0;!b.Ya&&e>>0),Nb=function(a){w(a,"Listener can not be null.");if(p(a))return a;w(a.handleEvent,"An object listener must have handleEvent method.");a[Zb]||(a[Zb]=function(b){return a.handleEvent(b)});return a[Zb]};var $b=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;var bc=function(){this.kc="";this.Td=ac};bc.prototype.Qb=!0;bc.prototype.Lb=function(){return this.kc};bc.prototype.toString=function(){return"Const{"+this.kc+"}"};var cc=function(a){if(a instanceof bc&&a.constructor===bc&&a.Td===ac)return a.kc;za("expected object of type Const, got '"+a+"'");return"type_error:Const"},ac={},dc=function(a){var b=new bc;b.kc=a;return b};dc("");var fc=function(){this.la="";this.Sd=ec};fc.prototype.Qb=!0;fc.prototype.Lb=function(){return this.la};fc.prototype.toString=function(){return"SafeUrl{"+this.la+"}"}; +var gc=function(a){if(a instanceof fc&&a.constructor===fc&&a.Sd===ec)return a.la;za("expected object of type SafeUrl, got '"+a+"' of type "+m(a));return"type_error:SafeUrl"},hc=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i,jc=function(a){if(a instanceof fc)return a;a=a.Qb?a.Lb():String(a);hc.test(a)||(a="about:invalid#zClosurez");return ic(a)},ec={},ic=function(a){var b=new fc;b.la=a;return b};ic("about:blank");var kc=function(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))},lc=function(a){a=String(a);if(kc(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},oc=function(a){var b=[];mc(new nc,a,b);return b.join("")},nc=function(){this.ec=void 0}, +mc=function(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;fa){var b=Ac[a];if(b)return b}b=new A([a|0],0>a?-1:0);-128<=a&&128>a&&(Ac[a]=b);return b},D=function(a){if(isNaN(a)||!isFinite(a))return B;if(0>a)return C(D(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new A(b,0)},Cc=function(a,b){if(0==a.length)throw Error("number format error: empty string");b=b||10;if(2>b||36f?(f=D(Math.pow(b,f)),d=d.multiply(f).add(D(g))):(d=d.multiply(c),d=d.add(D(g)))}return d},B=Bc(0),Dc=Bc(1),Ec=Bc(16777216),Fc=function(a){if(-1==a.g)return-Fc(C(a));for(var b=0,c=1,d=0;da||36>>0).toString(a),c=e;if(Hc(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}}; +var E=function(a,b){return 0>b?0:b>>16)+(E(this,e)>>>16)+(E(a,e)>>>16),d=g>>>16,f=f&65535,g=g&65535;c[e]=g<<16|f}return new A(c,c[c.length-1]&-2147483648?-1:0)};var Jc=function(a,b){return a.add(C(b))}; +A.prototype.multiply=function(a){if(Hc(this)||Hc(a))return B;if(-1==this.g)return-1==a.g?C(this).multiply(C(a)):C(C(this).multiply(a));if(-1==a.g)return C(this.multiply(C(a)));if(0>this.compare(Ec)&&0>a.compare(Ec))return D(Fc(this)*Fc(a));for(var b=this.h.length+a.h.length,c=[],d=0;d<2*b;d++)c[d]=0;for(d=0;d>>16,g=E(this,d)&65535,k=E(a,e)>>>16,t=E(a,e)&65535;c[2*d+2*e]+=g*t;Kc(c,2*d+2*e);c[2*d+2*e+1]+=f*t;Kc(c,2*d+2*e+1);c[2*d+2*e+ +1]+=g*k;Kc(c,2*d+2*e+1);c[2*d+2*e+2]+=f*k;Kc(c,2*d+2*e+2)}for(d=0;d>>16,a[b]&=65535,b++},Ic=function(a,b){if(Hc(b))throw Error("division by zero");if(Hc(a))return B;if(-1==a.g)return-1==b.g?Ic(C(a),C(b)):C(Ic(C(a),b));if(-1==b.g)return C(Ic(a,C(b)));if(30=b.compare(a);)c=c.shiftLeft(1),b=b.shiftLeft(1);var d=Lc(c,1),e=Lc(b,1),f;b=Lc(b,2);for(c=Lc(c,2);!Hc(b);)f=e.add(b),0>=f.compare(a)&&(d=d.add(c), +e=f),b=Lc(b,1),c=Lc(c,1);return d}for(c=B;0<=a.compare(b);){d=Math.max(1,Math.floor(Fc(a)/Fc(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=D(d);for(var g=f.multiply(b);-1==g.g||0>5;a%=32;for(var c=this.h.length+b+(0>>32-a:E(this,e-b);return new A(d,this.g)};var Lc=function(a,b){var c=b>>5;b%=32;for(var d=a.h.length-c,e=[],f=0;f>>b|E(a,f+c+1)<<32-b:E(a,f+c);return new A(e,a.g)};var Nc=function(a,b){this.sb=a;this.pa=b};Nc.prototype.Ib=function(a){return this.pa==a.pa&&this.sb.Ib(Xa(a.sb))};Nc.prototype.toString=ca; +var Qc=function(a){try{var b;if(b=0==a.lastIndexOf("[",0)){var c=a.length-1;b=0<=c&&a.indexOf("]",c)==c}return b?new Oc(a.substring(1,a.length-1)):new Pc(a)}catch(d){return null}},Pc=function(a){var b=B;if(a instanceof A){if(0!=a.g||0>a.compare(B)||0e||255>>=8;return this.Ea=b.join(".")}; +var Oc=function(a){var b=B;if(a instanceof A){if(0!=a.g||0>a.compare(B)||0>>16&65535).toString(16));d.push((a&65535).toString(16));La(c,c.length-1);Ra(c,d);a=c.join(":")}d=a.split("::");if(2e)c=[];else{for(var f=[],g=0;ge.compare(B)||0>>16).toString(16));a.push(d.toString(16))}for(var c=b=-1,e=d=0,f=0;fd&&(d=e,b=c)):(c=-1,e=0);0=b.rc&&b.cancel())}this.pd?this.pd.call(this.ad,this):this.Pc=!0;this.Ra||Hd(this,new Id)}};Gd.prototype.$c=function(a,b){this.qc=!1;Jd(this,a,b)}; -var Jd=function(a,b,c){a.Ra=!0;a.ka=c;a.ob=!b;Kd(a)},Md=function(a){if(a.Ra){if(!a.Pc)throw new Ld;a.Pc=!1}};Gd.prototype.callback=function(a){Md(this);Nd(a);Jd(this,!0,a)}; -var Hd=function(a,b){Md(a);Nd(b);Jd(a,!1,b)},Nd=function(a){w(!(a instanceof Gd),"An execution sequence may not be initiated with a blocking Deferred.")},Rd=function(a){var b=Od("https://apis.google.com/js/client.js?onload="+Pd);Qd(b,null,a,void 0)},Qd=function(a,b,c,d){w(!a.Uc,"Blocking Deferreds can not be re-used");a.dc.push([b,c,d]);a.Ra&&Kd(a)};Gd.prototype.then=function(a,b,c){var d,e,f=new I(function(a,b){d=a;e=b});Qd(this,d,function(a){a instanceof Id?f.cancel():e(a)});return f.then(a,b,c)}; -ld(Gd); -var Sd=function(a){return Ga(a.dc,function(a){return p(a[1])})},Kd=function(a){if(a.kc&&a.Ra&&Sd(a)){var b=a.kc,c=Td[b];c&&(l.clearTimeout(c.pb),delete Td[b]);a.kc=0}a.o&&(a.o.rc--,delete a.o);for(var b=a.ka,d=c=!1;a.dc.length&&!a.qc;){var e=a.dc.shift(),f=e[0],g=e[1],e=e[2];if(f=a.ob?g:f)try{var k=f.call(e||a.ad,b);void 0!==k&&(a.ob=a.ob&&(k==b||k instanceof Error),a.ka=b=k);if(md(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.qc=!0}catch(r){b=r,a.ob=!0,Sd(a)||(c=!0)}}a.ka=b;d&& -(k=q(a.$c,a,!0),d=q(a.$c,a,!1),b instanceof Gd?(Qd(b,k,d),b.Uc=!0):b.then(k,d));c&&(b=new Ud(b),Td[b.pb]=b,a.kc=b.pb)},Ld=function(){u.call(this)};t(Ld,u);Ld.prototype.message="Deferred has already fired";Ld.prototype.name="AlreadyCalledError";var Id=function(){u.call(this)};t(Id,u);Id.prototype.message="Deferred was canceled";Id.prototype.name="CanceledError";var Ud=function(a){this.pb=l.setTimeout(q(this.Le,this),0);this.J=a}; -Ud.prototype.Le=function(){w(Td[this.pb],"Cannot throw an error that is not scheduled.");delete Td[this.pb];throw this.J;};var Td={};var Od=function(a){var b=new Tc;b.Yb=a;return Vd(b)},Vd=function(a){var b={},c=b.document||document,d;a instanceof Tc&&a.constructor===Tc&&a.Pd===Sc?d=a.Yb:(za("expected object of type TrustedResourceUrl, got '"+a+"' of type "+m(a)),d="type_error:TrustedResourceUrl");var e=document.createElement("SCRIPT");a={xd:e,zb:void 0};var f=new Gd(Wd,a),g=null,k=null!=b.timeout?b.timeout:5E3;0++d,"infinite loop")}c=this.Sd;d=a.type||a;if(n(a))a=new zb(a,c);else if(a instanceof zb)a.target=a.target||c;else{var e=a;a=new zb(d,c);Ya(a,e)}var e=!0,f;if(b)for(var g=b.length-1;!a.Wa&&0<=g;g--)f=a.currentTarget=b[g],e=be(f,d,!0,a)&&e;a.Wa||(f=a.currentTarget=c,e=be(f,d,!0,a)&&e,a.Wa||(e=be(f,d,!1,a)&&e));if(b)for(g=0;!a.Wa&&g2*this.i&&fe(this),!0):!1}; -var fe=function(a){if(a.i!=a.s.length){for(var b=0,c=0;b=d.s.length)throw ce;var e=d.s[b++];return a?e:d.Z[e]};return e}; -var ge=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var ie=function(a){if(a.T&&"function"==typeof a.T)return a.T();if(n(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d=se(this).value)for(p(b)&&(b=b()),a=new le(a,String(b),this.xe),c&&(a.cd=c),c="log:"+a.we,l.console&&(l.console.timeStamp?l.console.timeStamp(c):l.console.markTimeline&&l.console.markTimeline(c)),l.msWriteProfilerMark&&l.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.hd)for(var e=0,f;f=b.hd[e];e++)f(d);c=c.getParent()}}; -var te={},ue=null,ve=function(a){ue||(ue=new ne(""),te[""]=ue,ue.Ad(qe));var b;if(!(b=te[a])){b=new ne(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=ve(a.substr(0,c));c.sc||(c.sc={});c.sc[d]=b;b.o=c;te[a]=b}return b};var L=function(a,b){a&&a.log(re,b,void 0)};var we=function(a,b,c){if(p(a))c&&(a=q(a,c));else if(a&&"function"==typeof a.handleEvent)a=q(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647b)throw Error("Bad port number "+b);a.Va=b}else a.Va=null},Se=function(a,b,c){N(a);a.ra=c?Ue(b,!0):b},Te=function(a,b,c){N(a);b instanceof O?(a.aa=b,a.aa.Oc(a.M)):(c||(b=Ve(b,$e)),a.aa=new O(b,0,a.M))},P=function(a,b,c){N(a);a.aa.set(b,c)},N=function(a){if(a.re)throw Error("Tried to modify a read-only Uri");}; -Oe.prototype.Oc=function(a){this.M=a;this.aa&&this.aa.Oc(a);return this}; -var af=function(a){return a instanceof Oe?a.clone():new Oe(a,void 0)},bf=function(a,b){var c=new Oe(null,void 0);Pe(c,"https");a&&Qe(c,a);b&&Se(c,b);return c},Ue=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Ve=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,cf),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},cf=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},We=/[#\/\?@]/g,Ye=/[\#\?:]/g,Xe=/[\#\?]/g,$e=/[\#\?@]/g, -Ze=/#/g,O=function(a,b,c){this.i=this.j=null;this.I=a||null;this.M=!!c},df=function(a){a.j||(a.j=new ee,a.i=0,a.I&&ze(a.I,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},ff=function(a){var b=je(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new O(null,0,void 0);a=ie(a);for(var d=0;da?!1:!z||!pb||9")&&(d=d.replace(qa,">")),-1!=d.indexOf('"')&&(d=d.replace(ra,""")),-1!=d.indexOf("'")&&(d=d.replace(ta,"'")),-1!=d.indexOf("\x00")&&(d=d.replace(ua,"�"))),d='',Ba(bc(a), -"must provide justification"),w(!/^[\s\xa0]*$/.test(bc(a)),"must provide non-empty justification"),g.document.write(Wc((new Vc).qe(d))),g.document.close())):g=a.open(dc(b),c,g);if(g)try{g.focus()}catch(k){}return g},pf=function(a){return new I(function(b){var c=function(){xe(2E3).then(function(){if(!a||a.closed)b();else return c()})};return c()})},qf=function(){var a=null;return(new I(function(b){"complete"==l.document.readyState?b():(a=function(){b()},Sb(window,"load",a))})).l(function(b){Ub(window, -"load",a);throw b;})},rf=function(a){switch(a||l.navigator&&l.navigator.product||""){case "ReactNative":return"ReactNative";default:return"undefined"!==typeof l.process?"Node":"Browser"}},sf=function(){var a=rf();return"ReactNative"===a||"Node"===a},lf=function(a){var b=a.toLowerCase();if(v(b,"opera/")||v(b,"opr/")||v(b,"opios/"))return"Opera";if(v(b,"iemobile"))return"IEMobile";if(v(b,"msie")||v(b,"trident/"))return"IE";if(v(b,"edge/"))return"Edge";if(v(b,"firefox/"))return"Firefox";if(v(b,"silk/"))return"Silk"; -if(v(b,"blackberry"))return"Blackberry";if(v(b,"webos"))return"Webos";if(!v(b,"safari/")||v(b,"chrome/")||v(b,"crios/")||v(b,"android"))if(!v(b,"chrome/")&&!v(b,"crios/")||v(b,"edge/")){if(v(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==a.length)return a[1]}else return"Chrome";else return"Safari";return"Other"},tf=function(a){var b=rf(void 0);return("Browser"===b?lf(gf()):b)+"/JsCore/"+a},gf=function(){return l.navigator&&l.navigator.userAgent||""},uf=function(a){a= -a.split(".");for(var b=l,c=0;c=b.uc&&b.cancel())}this.ud?this.ud.call(this.fd,this):this.Tc=!0;this.Ta||Ld(this,new Md)}};Kd.prototype.dd=function(a,b){this.tc=!1;Nd(this,a,b)}; +var Nd=function(a,b,c){a.Ta=!0;a.ma=c;a.qb=!b;Od(a)},Qd=function(a){if(a.Ta){if(!a.Tc)throw new Pd;a.Tc=!1}};Kd.prototype.callback=function(a){Qd(this);Rd(a);Nd(this,!0,a)}; +var Ld=function(a,b){Qd(a);Rd(b);Nd(a,!1,b)},Rd=function(a){w(!(a instanceof Kd),"An execution sequence may not be initiated with a blocking Deferred.")},Vd=function(a){var b=Sd("https://apis.google.com/js/client.js?onload="+Td);Ud(b,null,a,void 0)},Ud=function(a,b,c,d){w(!a.Yc,"Blocking Deferreds can not be re-used");a.gc.push([b,c,d]);a.Ta&&Od(a)};Kd.prototype.then=function(a,b,c){var d,e,f=new F(function(a,b){d=a;e=b});Ud(this,d,function(a){a instanceof Md?f.cancel():e(a)});return f.then(a,b,c)}; +pd(Kd); +var Wd=function(a){return Ha(a.gc,function(a){return p(a[1])})},Od=function(a){if(a.nc&&a.Ta&&Wd(a)){var b=a.nc,c=Xd[b];c&&(l.clearTimeout(c.rb),delete Xd[b]);a.nc=0}a.s&&(a.s.uc--,delete a.s);for(var b=a.ma,d=c=!1;a.gc.length&&!a.tc;){var e=a.gc.shift(),f=e[0],g=e[1],e=e[2];if(f=a.qb?g:f)try{var k=f.call(e||a.fd,b);void 0!==k&&(a.qb=a.qb&&(k==b||k instanceof Error),a.ma=b=k);if(qd(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.tc=!0}catch(t){b=t,a.qb=!0,Wd(a)||(c=!0)}}a.ma=b;d&& +(k=q(a.dd,a,!0),d=q(a.dd,a,!1),b instanceof Kd?(Ud(b,k,d),b.Yc=!0):b.then(k,d));c&&(b=new Yd(b),Xd[b.rb]=b,a.nc=b.rb)},Pd=function(){u.call(this)};r(Pd,u);Pd.prototype.message="Deferred has already fired";Pd.prototype.name="AlreadyCalledError";var Md=function(){u.call(this)};r(Md,u);Md.prototype.message="Deferred was canceled";Md.prototype.name="CanceledError";var Yd=function(a){this.rb=l.setTimeout(q(this.We,this),0);this.N=a}; +Yd.prototype.We=function(){w(Xd[this.rb],"Cannot throw an error that is not scheduled.");delete Xd[this.rb];throw this.N;};var Xd={};var Sd=function(a){var b=new Xc;b.Zb=a;return Zd(b)},Zd=function(a){var b={},c=b.document||document,d;a instanceof Xc&&a.constructor===Xc&&a.Ud===Wc?d=a.Zb:(za("expected object of type TrustedResourceUrl, got '"+a+"' of type "+m(a)),d="type_error:TrustedResourceUrl");var e=document.createElement("SCRIPT");a={Cd:e,Bb:void 0};var f=new Kd($d,a),g=null,k=null!=b.timeout?b.timeout:5E3;0++d,"infinite loop")}c=this.Xd;d=a.type||a;if(n(a))a=new Ab(a,c);else if(a instanceof Ab)a.target=a.target||c;else{var e=a;a=new Ab(d,c);Za(a,e)}var e=!0,f;if(b)for(var g=b.length-1;!a.Ya&&0<=g;g--)f=a.currentTarget=b[g],e=fe(f,d,!0,a)&&e;a.Ya||(f=a.currentTarget=c,e=fe(f,d,!0,a)&&e,a.Ya||(e=fe(f,d,!1,a)&&e));if(b)for(g=0;!a.Ya&&g2*this.i&&je(this),!0):!1}; +var je=function(a){if(a.i!=a.v.length){for(var b=0,c=0;b=d.v.length)throw ge;var e=d.v[b++];return a?e:d.ca[e]};return e}; +var ke=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var me=function(a){if(a.X&&"function"==typeof a.X)return a.X();if(n(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d=we(this).value)for(p(b)&&(b=b()),a=new pe(a,String(b),this.He),c&&(a.hd=c),c="log:"+a.Ge,l.console&&(l.console.timeStamp?l.console.timeStamp(c):l.console.markTimeline&&l.console.markTimeline(c)),l.msWriteProfilerMark&&l.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.nd)for(var e=0,f;f=b.nd[e];e++)f(d);c=c.getParent()}}; +var xe={},ye=null,ze=function(a){ye||(ye=new re(""),xe[""]=ye,ye.Fd(ue));var b;if(!(b=xe[a])){b=new re(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=ze(a.substr(0,c));c.vc||(c.vc={});c.vc[d]=b;b.s=c;xe[a]=b}return b};var I=function(a,b){a&&a.log(ve,b,void 0)};var Ae=function(a,b,c){if(p(a))c&&(a=q(a,c));else if(a&&"function"==typeof a.handleEvent)a=q(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647b)throw Error("Bad port number "+b);a.Xa=b}else a.Xa=null},We=function(a,b,c){K(a);a.ta=c?Ye(b,!0):b},Xe=function(a,b,c){K(a);b instanceof L?(a.$=b,a.$.Sc(a.P)):(c||(b=Ze(b,df)),a.$=new L(b,0,a.P))},M=function(a,b,c){K(a);a.$.set(b,c)},ef=function(a,b){K(a);a.$.remove(b)},K=function(a){if(a.Ae)throw Error("Tried to modify a read-only Uri"); +};Se.prototype.Sc=function(a){this.P=a;this.$&&this.$.Sc(a);return this}; +var ff=function(a){return a instanceof Se?a.clone():new Se(a,void 0)},gf=function(a,b){var c=new Se(null,void 0);Te(c,"https");a&&Ue(c,a);b&&We(c,b);return c},Ye=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Ze=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,hf),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},hf=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},$e=/[#\/\?@]/g,bf=/[\#\?:]/g,af=/[\#\?]/g,df=/[\#\?@]/g, +cf=/#/g,L=function(a,b,c){this.i=this.j=null;this.M=a||null;this.P=!!c},jf=function(a){a.j||(a.j=new ie,a.i=0,a.M&&De(a.M,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},lf=function(a){var b=ne(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new L(null,0,void 0);a=me(a);for(var d=0;da?!1:!y||!qb||9")&&(d=d.replace(qa,">")),-1!=d.indexOf('"')&&(d=d.replace(ra,""")),-1!= +d.indexOf("'")&&(d=d.replace(sa,"'")),-1!=d.indexOf("\x00")&&(d=d.replace(ta,"�"))),d='',Ba(cc(a),"must provide justification"),w(!/^[\s\xa0]*$/.test(cc(a)),"must provide non-empty justification"),g.document.write($c((new Zc).ye(d))),g.document.close())):g=a.open(gc(b),c,g);if(g)try{g.focus()}catch(k){}return g},uf=function(a){return new F(function(b){var c=function(){Be(2E3).then(function(){if(!a||a.closed)b();else return c()})};return c()})}, +vf=function(){var a=null;return(new F(function(b){"complete"==l.document.readyState?b():(a=function(){b()},Tb(window,"load",a))})).l(function(b){Vb(window,"load",a);throw b;})},O=function(a){switch(a||l.navigator&&l.navigator.product||""){case "ReactNative":return"ReactNative";default:return"undefined"!==typeof l.process?"Node":"Browser"}},wf=function(){var a=O();return"ReactNative"===a||"Node"===a},pf=function(a){var b=a.toLowerCase();if(v(b,"opera/")||v(b,"opr/")||v(b,"opios/"))return"Opera";if(v(b, +"iemobile"))return"IEMobile";if(v(b,"msie")||v(b,"trident/"))return"IE";if(v(b,"edge/"))return"Edge";if(v(b,"firefox/"))return"Firefox";if(v(b,"silk/"))return"Silk";if(v(b,"blackberry"))return"Blackberry";if(v(b,"webos"))return"Webos";if(!v(b,"safari/")||v(b,"chrome/")||v(b,"crios/")||v(b,"android"))if(!v(b,"chrome/")&&!v(b,"crios/")||v(b,"edge/")){if(v(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==a.length)return a[1]}else return"Chrome";else return"Safari";return"Other"}, +xf=function(a){var b=O(void 0);return("Browser"===b?pf(N()):b)+"/JsCore/"+a},N=function(){return l.navigator&&l.navigator.userAgent||""},yf=function(a){a=a.split(".");for(var b=l,c=0;cb)throw Error("Short delay should be less than long delay!");this.Te=a;this.Fe=b;a=d||O();this.ze=rf(c||N())||"ReactNative"===a};Hf.prototype.get=function(){return this.ze?this.Fe:this.Te};var If;try{var Jf={};Object.defineProperty(Jf,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(Jf,"abcd",{configurable:!0,enumerable:!0,value:2});If=2==Jf.abcd}catch(a){If=!1} +var P=function(a,b,c){If?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c},Kf=function(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&P(a,c,b[c])},Lf=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},Mf=function(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c Auth section -> Sign in method tab.",a);R.call(this,b,c)};t(Lf,R);var Mf=function(a){this.ve=a.sub;la();this.Fb=a.email||null};var Nf=function(a,b,c,d){var e={};ha(c)?e=c:b&&n(c)&&n(d)?e={oauthToken:c,oauthTokenSecret:d}:!b&&n(c)&&(e={accessToken:c});if(b||!e.idToken&&!e.accessToken)if(b&&e.oauthToken&&e.oauthTokenSecret)Q(this,"accessToken",e.oauthToken),Q(this,"secret",e.oauthTokenSecret);else{if(b)throw new R("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");throw new R("argument-error","credential failed: expected 1 argument (the OAuth access token).");}else e.idToken&&Q(this, -"idToken",e.idToken),e.accessToken&&Q(this,"accessToken",e.accessToken);Q(this,"provider",a)};Nf.prototype.Ib=function(a){return Of(a,Pf(this))};Nf.prototype.od=function(a,b){var c=Pf(this);c.idToken=b;return Qf(a,c)};var Pf=function(a){var b={};a.idToken&&(b.id_token=a.idToken);a.accessToken&&(b.access_token=a.accessToken);a.secret&&(b.oauth_token_secret=a.secret);b.providerId=a.provider;return{postBody:ff(b).toString(),requestUri:wf()?jf():"http://localhost"}}; -Nf.prototype.G=function(){var a={provider:this.provider};this.idToken&&(a.oauthIdToken=this.idToken);this.accessToken&&(a.oauthAccessToken=this.accessToken);this.secret&&(a.oauthTokenSecret=this.secret);return a}; -var Rf=function(a,b){var c=!!b;b=function(){Ef(this,{providerId:a,isOAuthProvider:!0});this.Nc=[];"google.com"==a&&this.addScope("profile")};c||(b.prototype.addScope=function(a){Ja(this.Nc,a)||this.Nc.push(a)});b.prototype.Jb=function(){return Pa(this.Nc)};b.credential=function(b,e){return new Nf(a,c,b,e)};Ef(b,{PROVIDER_ID:a});return b},Sf=Rf("facebook.com");Sf.prototype.addScope=Sf.prototype.addScope||void 0;var Tf=Rf("github.com");Tf.prototype.addScope=Tf.prototype.addScope||void 0;var Uf=Rf("google.com"); -Uf.prototype.addScope=Uf.prototype.addScope||void 0;Uf.credential=function(a,b){if(!a&&!b)throw new R("argument-error","credential failed: must provide the ID token and/or the access token.");return new Nf("google.com",!1,ha(a)?a:{idToken:a||null,accessToken:b||null})};var Vf=Rf("twitter.com",!0),Wf=function(a,b){this.Fb=a;this.Gc=b;Q(this,"provider","password")};Wf.prototype.Ib=function(a){return S(a,Xf,{email:this.Fb,password:this.Gc})}; -Wf.prototype.od=function(a,b){return S(a,Yf,{idToken:b,email:this.Fb,password:this.Gc})};Wf.prototype.G=function(){return{email:this.Fb,password:this.Gc}};var Zf=function(){Ef(this,{providerId:"password",isOAuthProvider:!1})};Ef(Zf,{PROVIDER_ID:"password"}); -var $f={Ve:Zf,Jd:Sf,Ld:Uf,Kd:Tf,Qd:Vf},ag=function(a){var b=a&&a.providerId;if(!b)return null;var c=a&&a.oauthAccessToken,d=a&&a.oauthTokenSecret;a=a&&a.oauthIdToken;for(var e in $f)if($f[e].PROVIDER_ID==b)try{return $f[e].credential({accessToken:c,idToken:a,oauthToken:c,oauthTokenSecret:d})}catch(f){break}return null};var bg=function(a,b,c,d){R.call(this,a,d);Q(this,"email",b);Q(this,"credential",c)};t(bg,R);bg.prototype.G=function(){var a={code:this.code,message:this.message,email:this.email},b=this.credential&&this.credential.G();b&&(Ya(a,b),a.providerId=b.provider,delete a.provider);return a};var cg=function(a){if(a.code){var b=a.code||"";0==b.indexOf("auth/")&&(b=b.substring(5));return a.email?new bg(b,a.email,ag(a),a.message):new R(b,a.message||void 0)}return null};var dg=function(a){this.Ue=a};t(dg,pc);dg.prototype.lb=function(){return new this.Ue};dg.prototype.Sb=function(){return{}}; -var T=function(a,b,c){var d;d="Node"==rf();d=l.XMLHttpRequest||d&&firebase.INTERNAL.node&&firebase.INTERNAL.node.XMLHttpRequest;if(!d)throw new R("internal-error","The XMLHttpRequest compatibility library was not found.");this.v=a;a=b||{};this.Fe=a.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token";this.Ge=a.secureTokenTimeout||1E4;this.yd=Wa(a.secureTokenHeaders||eg);this.ce=a.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/";this.de=a.firebaseTimeout|| -1E4;this.ed=Wa(a.firebaseHeaders||fg);c&&(this.ed["X-Client-Version"]=c,this.yd["X-Client-Version"]=c);this.Ud=new uc;this.Te=new dg(d)},gg,eg={"Content-Type":"application/x-www-form-urlencoded"},fg={"Content-Type":"application/json"},ig=function(a,b,c,d,e,f,g){mf()?a=q(a.Ie,a):(gg||(gg=new I(function(a,b){hg(a,b)})),a=q(a.He,a));a(b,c,d,e,f,g)}; -T.prototype.Ie=function(a,b,c,d,e,f){var g="Node"==rf(),k=sf()?g?new M(this.Te):new M:new M(this.Ud),r;f&&(k.gb=Math.max(0,f),r=setTimeout(function(){k.dispatchEvent("timeout")},f));k.listen("complete",function(){r&&clearTimeout(r);var a=null;try{var c;c=this.a?ic(this.a.responseText):void 0;a=c||null}catch(Ri){try{a=JSON.parse(Ne(this))||null}catch(Si){a=null}}b&&b(a)});Tb(k,"ready",function(){r&&clearTimeout(r);this.za||(this.za=!0,this.Pa())});Tb(k,"timeout",function(){r&&clearTimeout(r);this.za|| -(this.za=!0,this.Pa());b&&b(null)});k.send(a,c,d,e)};var Pd="__fcb"+Math.floor(1E6*Math.random()).toString(),hg=function(a,b){((window.gapi||{}).client||{}).request?a():(l[Pd]=function(){((window.gapi||{}).client||{}).request?a():b(Error("CORS_UNSUPPORTED"))},Rd(function(){b(Error("CORS_UNSUPPORTED"))}))}; -T.prototype.He=function(a,b,c,d,e){var f=this;gg.then(function(){window.gapi.client.setApiKey(f.v);var g=window.gapi.auth.getToken();window.gapi.auth.setToken(null);window.gapi.client.request({path:a,method:c,body:d,headers:e,authType:"none",callback:function(a){window.gapi.auth.setToken(g);b&&b(a)}})}).l(function(a){b&&b({error:{message:a&&a.message||"CORS_UNSUPPORTED"}})})}; -var kg=function(a,b){return new I(function(c,d){"refresh_token"==b.grant_type&&b.refresh_token||"authorization_code"==b.grant_type&&b.code?ig(a,a.Fe+"?key="+encodeURIComponent(a.v),function(a){a?a.error?d(jg(a)):a.access_token&&a.refresh_token?c(a):d(new R("internal-error")):d(new R("network-request-failed"))},"POST",ff(b).toString(),a.yd,a.Ge):d(new R("internal-error"))})},lg=function(a){var b={},c;for(c in a)null!==a[c]&&void 0!==a[c]&&(b[c]=a[c]);return lc(b)},mg=function(a,b,c,d,e){var f=a.ce+ -b+"?key="+encodeURIComponent(a.v);e&&(f+="&cb="+la().toString());return new I(function(b,e){ig(a,f,function(a){a?a.error?e(jg(a)):b(a):e(new R("network-request-failed"))},c,lg(d),a.ed,a.de)})},ng=function(a){if(!Zb.test(a.email))throw new R("invalid-email");},og=function(a){"email"in a&&ng(a)},qg=function(a,b){var c=wf()?jf():"http://localhost";return S(a,pg,{identifier:b,continueUri:c}).then(function(a){return a.allProviders||[]})},sg=function(a){return S(a,rg,{}).then(function(a){return a.authorizedDomains|| -[]})},tg=function(a){if(!a.idToken)throw new R("internal-error");};T.prototype.signInAnonymously=function(){return S(this,ug,{})};T.prototype.updateEmail=function(a,b){return S(this,vg,{idToken:a,email:b})};T.prototype.updatePassword=function(a,b){return S(this,Yf,{idToken:a,password:b})};var wg={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"}; -T.prototype.updateProfile=function(a,b){var c={idToken:a},d=[];Ra(wg,function(a,f){var e=b[f];null===e?d.push(a):f in b&&(c[f]=e)});d.length&&(c.deleteAttribute=d);return S(this,vg,c)};T.prototype.sendPasswordResetEmail=function(a){return S(this,xg,{requestType:"PASSWORD_RESET",email:a})};T.prototype.sendEmailVerification=function(a){return S(this,yg,{requestType:"VERIFY_EMAIL",idToken:a})}; -var Ag=function(a,b,c){return S(a,zg,{idToken:b,deleteProvider:c})},Bg=function(a){if(!a.requestUri||!a.sessionId&&!a.postBody)throw new R("internal-error");},Cg=function(a){var b=null;a.needConfirmation?(a.code="account-exists-with-different-credential",b=cg(a)):"FEDERATED_USER_ID_ALREADY_LINKED"==a.errorMessage?(a.code="credential-already-in-use",b=cg(a)):"EMAIL_EXISTS"==a.errorMessage&&(a.code="email-already-in-use",b=cg(a));if(b)throw b;if(!a.idToken)throw new R("internal-error");},Of=function(a, -b){b.returnIdpCredential=!0;return S(a,Dg,b)},Qf=function(a,b){b.returnIdpCredential=!0;return S(a,Eg,b)},Fg=function(a){if(!a.oobCode)throw new R("invalid-action-code");};T.prototype.confirmPasswordReset=function(a,b){return S(this,Gg,{oobCode:a,newPassword:b})};T.prototype.checkActionCode=function(a){return S(this,Hg,{oobCode:a})};T.prototype.applyActionCode=function(a){return S(this,Ig,{oobCode:a})}; -var Ig={endpoint:"setAccountInfo",D:Fg,eb:"email"},Hg={endpoint:"resetPassword",D:Fg,ua:function(a){if(!Zb.test(a.email))throw new R("internal-error");}},Jg={endpoint:"signupNewUser",D:function(a){ng(a);if(!a.password)throw new R("weak-password");},ua:tg,va:!0},pg={endpoint:"createAuthUri"},Kg={endpoint:"deleteAccount",bb:["idToken"]},zg={endpoint:"setAccountInfo",bb:["idToken","deleteProvider"],D:function(a){if(!ea(a.deleteProvider))throw new R("internal-error");}},Lg={endpoint:"getAccountInfo"}, -yg={endpoint:"getOobConfirmationCode",bb:["idToken","requestType"],D:function(a){if("VERIFY_EMAIL"!=a.requestType)throw new R("internal-error");},eb:"email"},xg={endpoint:"getOobConfirmationCode",bb:["requestType"],D:function(a){if("PASSWORD_RESET"!=a.requestType)throw new R("internal-error");ng(a)},eb:"email"},rg={Td:!0,endpoint:"getProjectConfig",me:"GET"},Gg={endpoint:"resetPassword",D:Fg,eb:"email"},vg={endpoint:"setAccountInfo",bb:["idToken"],D:og,va:!0},Yf={endpoint:"setAccountInfo",bb:["idToken"], -D:function(a){og(a);if(!a.password)throw new R("weak-password");},ua:tg,va:!0},ug={endpoint:"signupNewUser",ua:tg,va:!0},Dg={endpoint:"verifyAssertion",D:Bg,ua:Cg,va:!0},Eg={endpoint:"verifyAssertion",D:function(a){Bg(a);if(!a.idToken)throw new R("internal-error");},ua:Cg,va:!0},Mg={endpoint:"verifyCustomToken",D:function(a){if(!a.token)throw new R("invalid-custom-token");},ua:tg,va:!0},Xf={endpoint:"verifyPassword",D:function(a){ng(a);if(!a.password)throw new R("wrong-password");},ua:tg,va:!0},S= -function(a,b,c){if(!Gf(c,b.bb))return K(new R("internal-error"));var d=b.me||"POST",e;return J(c).then(b.D).then(function(){b.va&&(c.returnSecureToken=!0);return mg(a,b.endpoint,d,c,b.Td||!1)}).then(function(a){return e=a}).then(b.ua).then(function(){if(!b.eb)return e;if(!(b.eb in e))throw new R("internal-error");return e[b.eb]})},jg=function(a){var b,c;c=(a.error&&a.error.errors&&a.error.errors[0]||{}).reason||"";var d={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(c=d[c]? -new R(d[c]):null)return c;c=a.error&&a.error.message||"";d={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential", +"user-cancelled":"User did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported."};var Tf=function(a,b,c,d,e){this.ya=a;this.W=b||null;this.kb=c||null;this.hc=d||null;this.N=e||null;if(this.kb||this.N){if(this.kb&&this.N)throw new Q("invalid-auth-event");if(this.kb&&!this.hc)throw new Q("invalid-auth-event");}else throw new Q("invalid-auth-event");};Tf.prototype.getError=function(){return this.N};Tf.prototype.K=function(){return{type:this.ya,eventId:this.W,urlResponse:this.kb,sessionId:this.hc,error:this.N&&this.N.K()}};var Uf=function(a){var b="unauthorized-domain",c=void 0,d=ff(a);a=d.ia;d=d.na;"http"!=d&&"https"!=d?b="operation-not-supported-in-this-environment":c=ma("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a);Q.call(this,b,c)};r(Uf,Q);var Vf=function(a){this.Ee=a.sub;la();this.Hb=a.email||null};var Wf=function(a,b,c,d){var e={};ha(c)?e=c:b&&n(c)&&n(d)?e={oauthToken:c,oauthTokenSecret:d}:!b&&n(c)&&(e={accessToken:c});if(b||!e.idToken&&!e.accessToken)if(b&&e.oauthToken&&e.oauthTokenSecret)P(this,"accessToken",e.oauthToken),P(this,"secret",e.oauthTokenSecret);else{if(b)throw new Q("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");throw new Q("argument-error","credential failed: expected 1 argument (the OAuth access token).");}else e.idToken&&P(this, +"idToken",e.idToken),e.accessToken&&P(this,"accessToken",e.accessToken);P(this,"provider",a)};Wf.prototype.Kb=function(a){return Xf(a,Yf(this))};Wf.prototype.td=function(a,b){var c=Yf(this);c.idToken=b;return Zf(a,c)};var Yf=function(a){var b={};a.idToken&&(b.id_token=a.idToken);a.accessToken&&(b.access_token=a.accessToken);a.secret&&(b.oauth_token_secret=a.secret);b.providerId=a.provider;return{postBody:lf(b).toString(),requestUri:Af()?nf():"http://localhost"}}; +Wf.prototype.K=function(){var a={provider:this.provider};this.idToken&&(a.oauthIdToken=this.idToken);this.accessToken&&(a.oauthAccessToken=this.accessToken);this.secret&&(a.oauthTokenSecret=this.secret);return a}; +var $f=function(a,b,c){var d=!!b,e=c||[];b=function(){Kf(this,{providerId:a,isOAuthProvider:!0});this.Rc=[];this.ed={};"google.com"==a&&this.addScope("profile")};d||(b.prototype.addScope=function(a){Ka(this.Rc,a)||this.Rc.push(a)});b.prototype.setCustomParameters=function(a){this.ed=Xa(a)};b.prototype.me=function(){var a=Df(this.ed),b;for(b in a)a[b]=a[b].toString();a=Xa(a);for(b=0;bk||k>=rh.length)throw new R("internal-error","Argument validator received an unsupported number of arguments.");e=rh[k]+" argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.ca+".";break a}e=null}}if(e)throw new R("argument-error",d+" failed: "+e);return b.apply(this,a)};for(var e in b)a[e]=b[e];for(e in b.prototype)a.prototype[e]= -b.prototype[e];return a},Ah=function(a){a=a.split(".");return a[a.length-1]};var Bh=function(a,b,c,d){this.ye=a;this.zd=b;this.Ee=c;this.fb=d;this.N={};qh||(qh=new ph);a=qh;try{var e;hf()?(gh||(gh=new fh("firebaseLocalStorageDb","firebaseLocalStorage","fbase_key","value",1)),e=gh):e=new a.bd.V;this.Ua=e}catch(f){this.Ua=new $g,this.fb=!0}try{this.ic=new a.bd.Sc}catch(f){this.ic=new $g}this.Cd=q(this.Dd,this);this.O={}},Ch,Dh=function(){Ch||(Ch=new Bh("firebase",":",!Af(gf())&&l.window&&l.window!=l.window.top?!0:!1,xf()));return Ch};h=Bh.prototype; -h.K=function(a,b){return this.ye+this.zd+a.name+(b?this.zd+b:"")};h.get=function(a,b){return(a.V?this.Ua:this.ic).get(this.K(a,b))};h.remove=function(a,b){b=this.K(a,b);a.V&&!this.fb&&(this.O[b]=null);return(a.V?this.Ua:this.ic).remove(b)};h.set=function(a,b,c){var d=this.K(a,c),e=this,f=a.V?this.Ua:this.ic;return f.set(d,b).then(function(){return f.get(d)}).then(function(b){a.V&&!this.fb&&(e.O[d]=b)})}; -h.addListener=function(a,b,c){a=this.K(a,b);this.fb||(this.O[a]=l.localStorage.getItem(a));Ua(this.N)&&this.Qc();this.N[a]||(this.N[a]=[]);this.N[a].push(c)};h.removeListener=function(a,b,c){a=this.K(a,b);this.N[a]&&(Ma(this.N[a],function(a){return a==c}),0==this.N[a].length&&delete this.N[a]);Ua(this.N)&&this.gc()};h.Qc=function(){this.Ua.La(this.Cd);this.fb||Eh(this)}; -var Eh=function(a){Fh(a);a.Cc=setInterval(function(){for(var b in a.N){var c=l.localStorage.getItem(b);c!=a.O[b]&&(a.O[b]=c,c=new Ab({type:"storage",key:b,target:window,oldValue:a.O[b],newValue:c}),a.Dd(c))}},1E3)},Fh=function(a){a.Cc&&(clearInterval(a.Cc),a.Cc=null)};Bh.prototype.gc=function(){this.Ua.$a(this.Cd);this.fb||Fh(this)}; -Bh.prototype.Dd=function(a){if(a&&a.fe){var b=a.mb.key;if(this.Ee){var c=l.localStorage.getItem(b);a=a.mb.newValue;a!=c&&(a?l.localStorage.setItem(b,a):a||l.localStorage.removeItem(b))}this.O[b]=l.localStorage.getItem(b);this.Xc(b)}else x(a,q(this.Xc,this))};Bh.prototype.Xc=function(a){this.N[a]&&x(this.N[a],function(a){a()})};var Gh=function(a){this.B=a;this.A=Dh()},Hh={name:"pendingRedirect",V:!1},Ih=function(a){return a.A.set(Hh,"pending",a.B)},Jh=function(a){return a.A.remove(Hh,a.B)},Kh=function(a){return a.A.get(Hh,a.B).then(function(a){return"pending"==a})};var Nh=function(a,b,c){var d=this,e=(this.ya=firebase.SDK_VERSION||null)?tf(this.ya):null;this.f=new T(b,null,e);this.qa=null;this.X=a;this.v=b;this.ea=c;this.yb=[];this.Rb=!1;this.Tc=q(this.ge,this);this.Xa=new Lh(this);this.td=new Mh(this);this.Hc=new Gh(this.v+":"+this.ea);this.hb={};this.hb.unknown=this.Xa;this.hb.signInViaRedirect=this.Xa;this.hb.linkViaRedirect=this.Xa;this.hb.signInViaPopup=this.td;this.hb.linkViaPopup=this.td;this.bc=this.cb=null;this.Wb=new I(function(a,b){d.cb=a;d.bc=b})}; -Nh.prototype.reset=function(){var a=this;this.qa=null;this.Wb.cancel();this.Rb=!1;this.bc=this.cb=null;this.Ob&&Yg(this.Ob,this.Tc);this.Wb=new I(function(b,c){a.cb=b;a.bc=c})}; -var Oh=function(a){var b=jf();return sg(a).then(function(a){a:{for(var c=af(b).ga,e=0;ethis.Qa-3E4?this.S?bi(this,{grant_type:"refresh_token",refresh_token:this.S}):J(null):J({accessToken:this.xa,expirationTime:this.Qa,refreshToken:this.S})};var di=function(a,b,c,d,e){Ef(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,providerId:b})},ei=function(a,b){zb.call(this,a);for(var c in b)this[c]=b[c]};t(ei,zb); -var W=function(a,b,c){this.U=[];this.v=a.apiKey;this.ea=a.appName;this.X=a.authDomain||null;a=firebase.SDK_VERSION?tf(firebase.SDK_VERSION):null;this.f=new T(this.v,null,a);this.ba=new Zh(this.f);fi(this,b.idToken);ai(this.ba,b);Q(this,"refreshToken",this.ba.S);gi(this,c||{});$d.call(this);this.Xb=!1;this.X&&wf()&&(this.m=Wh(this.X,this.v,this.ea));this.fc=[];this.pc=J()};t(W,$d); -W.prototype.sa=function(a,b){var c=Array.prototype.slice.call(arguments,1),d=this;return this.pc=this.pc.then(function(){return a.apply(d,c)},function(){return a.apply(d,c)})}; -var fi=function(a,b){a.md=b;Q(a,"_lat",b)},hi=function(a,b){Ma(a.fc,function(a){return a==b})},ii=function(a){for(var b=[],c=0;ck||k>=Fh.length)throw new Q("internal-error","Argument validator received an unsupported number of arguments.");e=Fh[k]+" argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.fa+".";break a}e=null}}if(e)throw new Q("argument-error",d+" failed: "+e);return b.apply(this,a)};for(var e in b)a[e]=b[e];for(e in b.prototype)a.prototype[e]= +b.prototype[e];return a},Nh=function(a){a=a.split(".");return a[a.length-1]};var Oh=function(a,b,c,d){this.Ie=a;this.Ed=b;this.Oe=c;this.hb=d;this.R={};Dh||(Dh=new Ch);a=Dh;try{var e;mf()?(th||(th=new sh("firebaseLocalStorageDb","firebaseLocalStorage","fbase_key","value",1)),e=th):e=new a.gd.Z;this.Wa=e}catch(f){this.Wa=new mh,this.hb=!0}try{this.lc=new a.gd.Wc}catch(f){this.lc=new mh}this.Hd=q(this.Id,this);this.S={}},Ph,Qh=function(){Ph||(Ph=new Oh("firebase",":",!Ff(N())&&l.window&&l.window!=l.window.top?!0:!1,Bf()));return Ph};h=Oh.prototype; +h.O=function(a,b){return this.Ie+this.Ed+a.name+(b?this.Ed+b:"")};h.get=function(a,b){return(a.Z?this.Wa:this.lc).get(this.O(a,b))};h.remove=function(a,b){b=this.O(a,b);a.Z&&!this.hb&&(this.S[b]=null);return(a.Z?this.Wa:this.lc).remove(b)};h.set=function(a,b,c){var d=this.O(a,c),e=this,f=a.Z?this.Wa:this.lc;return f.set(d,b).then(function(){return f.get(d)}).then(function(b){a.Z&&!this.hb&&(e.S[d]=b)})}; +h.addListener=function(a,b,c){a=this.O(a,b);this.hb||(this.S[a]=l.localStorage.getItem(a));Va(this.R)&&this.Uc();this.R[a]||(this.R[a]=[]);this.R[a].push(c)};h.removeListener=function(a,b,c){a=this.O(a,b);this.R[a]&&(Na(this.R[a],function(a){return a==c}),0==this.R[a].length&&delete this.R[a]);Va(this.R)&&this.jc()};h.Uc=function(){this.Wa.Na(this.Hd);this.hb||Rh(this)}; +var Rh=function(a){Sh(a);a.Fc=setInterval(function(){for(var b in a.R){var c=l.localStorage.getItem(b);c!=a.S[b]&&(a.S[b]=c,c=new Bb({type:"storage",key:b,target:window,oldValue:a.S[b],newValue:c}),a.Id(c))}},1E3)},Sh=function(a){a.Fc&&(clearInterval(a.Fc),a.Fc=null)};Oh.prototype.jc=function(){this.Wa.bb(this.Hd);this.hb||Sh(this)}; +Oh.prototype.Id=function(a){if(a&&a.le){var b=a.ob.key;if(this.Oe){var c=l.localStorage.getItem(b);a=a.ob.newValue;a!=c&&(a?l.localStorage.setItem(b,a):a||l.localStorage.removeItem(b))}this.S[b]=l.localStorage.getItem(b);this.ad(b)}else Ea(a,q(this.ad,this))};Oh.prototype.ad=function(a){this.R[a]&&Ea(this.R[a],function(a){a()})};var Th=function(a){this.D=a;this.B=Qh()},Uh={name:"pendingRedirect",Z:!1},Vh=function(a){return a.B.set(Uh,"pending",a.D)},Wh=function(a){return a.B.remove(Uh,a.D)},Xh=function(a){return a.B.get(Uh,a.D).then(function(a){return"pending"==a})};var $h=function(a,b,c){var d=this,e=(this.Aa=firebase.SDK_VERSION||null)?xf(this.Aa):null;this.f=new S(b,null,e);this.sa=null;this.C=a;this.m=b;this.F=c;this.Ab=[];this.Sb=!1;this.Xc=q(this.oe,this);this.Za=new Yh(this);this.yd=new Zh(this);this.Kc=new Th(this.m+":"+this.F);this.jb={};this.jb.unknown=this.Za;this.jb.signInViaRedirect=this.Za;this.jb.linkViaRedirect=this.Za;this.jb.signInViaPopup=this.yd;this.jb.linkViaPopup=this.yd;this.dc=this.fb=null;this.Xb=new F(function(a,b){d.fb=a;d.dc=b})}; +$h.prototype.reset=function(){var a=this;this.sa=null;this.Xb.cancel();this.Sb=!1;this.dc=this.fb=null;this.Pb&&kh(this.Pb,this.Xc);this.Xb=new F(function(b,c){a.fb=b;a.dc=c})}; +var ai=function(a){var b=nf();return Cg(a).then(function(a){a:{for(var c=ff(b).ia,e=0;ethis.Sa-3E4?this.V?qi(this,{grant_type:"refresh_token",refresh_token:this.V}):G(null):G({accessToken:this.za,expirationTime:this.Sa,refreshToken:this.V})};var si=function(a,b,c,d,e){Kf(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,providerId:b})},ti=function(a,b){Ab.call(this,a);for(var c in b)this[c]=b[c]};r(ti,Ab); +var W=function(a,b,c){this.Y=[];this.m=a.apiKey;this.F=a.appName;this.C=a.authDomain||null;a=firebase.SDK_VERSION?xf(firebase.SDK_VERSION):null;this.f=new S(this.m,null,a);this.ea=new ni(this.f);ui(this,b.idToken);pi(this.ea,b);P(this,"refreshToken",this.ea.V);vi(this,c||{});de.call(this);this.Yb=!1;this.C&&Af()&&(this.o=ki(this.C,this.m,this.F));this.ic=[];this.sc=G()};r(W,de); +W.prototype.ua=function(a,b){var c=Array.prototype.slice.call(arguments,1),d=this;return this.sc=this.sc.then(function(){return a.apply(d,c)},function(){return a.apply(d,c)})}; +var ui=function(a,b){a.rd=b;P(a,"_lat",b)},wi=function(a,b){Na(a.ic,function(a){return a==b})},xi=function(a){for(var b=[],c=0;cb;b++)L[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b);for(var b=L,c=[],d=0;d>2,e=(e&3)<<4|m>>4,m=(m&15)<<2|r>>6,r=r&63;p||(r=64,g||(m=64));c.push(b[V],b[e],b[m],b[r])}return c.join("").replace(/\+/g,"-").replace(/\//g, +"_").replace(/=+$/,"")};var N=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D),O=function(){this.a=null},P=function(a){if(a.a)return a.a;a.a=new Promise(function(a,c){var b=y.indexedDB.open("fcm_token_details_db",1);b.onerror=function(a){c(a.target.error)};b.onsuccess=function(b){a(b.target.result)};b.onupgradeneeded=function(a){a=a.target.result.createObjectStore("fcm_token_object_Store",{keyPath:"swScope"});a.createIndex("fcmSenderId","fcmSenderId",{unique:!1});a.createIndex("fcmToken","fcmToken",{unique:!0})}}); +return a.a},ba=function(a){a.a?a.a.then(function(b){b.close();a.a=null}):Promise.resolve()},Q=function(a,b){return P(a).then(function(a){return new Promise(function(c,e){var d=a.transaction(["fcm_token_object_Store"]).objectStore("fcm_token_object_Store").index("fcmToken").get(b);d.onerror=function(a){e(a.target.error)};d.onsuccess=function(a){c(a.target.result)}})})},ca=function(a,b){return P(a).then(function(a){return new Promise(function(c,e){var d=[],m=a.transaction(["fcm_token_object_Store"]).objectStore("fcm_token_object_Store").openCursor(); +m.onerror=function(a){e(a.target.error)};m.onsuccess=function(a){(a=a.target.result)?(a.value.fcmSenderId===b&&d.push(a.value),a.continue()):c(d)}})})},R=function(a,b,c){var d=M(b.getKey("p256dh")),e=M(b.getKey("auth"));a="authorized_entity="+a+"&"+("endpoint="+b.endpoint+"&")+("encryption_key="+d+"&")+("encryption_auth="+e);c&&(a+="&pushSet="+c);c=new Headers;c.append("Content-Type","application/x-www-form-urlencoded");return fetch("https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST", +headers:c,body:a}).then(function(a){return a.json()}).then(function(a){if(a.error)throw N.create(B.V,{message:a.error.message});if(!a.token)throw N.create(B.X);if(!a.pushSet)throw N.create(B.W);return{token:a.token,pushSet:a.pushSet}})},da=function(a,b,c,d,e,g){var m={swScope:c.scope,endpoint:d.endpoint,auth:M(d.getKey("auth")),p256dh:M(d.getKey("p256dh")),fcmToken:e,fcmPushSet:g,fcmSenderId:b};return P(a).then(function(a){return new Promise(function(b,c){var d=a.transaction(["fcm_token_object_Store"], +"readwrite").objectStore("fcm_token_object_Store").put(m);d.onerror=function(a){c(a.target.error)};d.onsuccess=function(){b()}})})}; +O.prototype.ba=function(a,b){return b instanceof ServiceWorkerRegistration?"string"!==typeof a||0===a.length?Promise.reject(N.create(B.l)):ca(this,a).then(function(c){if(0!==c.length){var d=c.findIndex(function(c){return b.scope===c.swScope&&a===c.fcmSenderId});if(-1!==d)return c[d]}}).then(function(a){if(a)return b.pushManager.getSubscription().catch(function(){throw N.create(B.H);}).then(function(b){var c;if(c=b)c=b.endpoint===a.endpoint&&M(b.getKey("auth"))===a.auth&&M(b.getKey("p256dh"))===a.p256dh; +if(c)return a.fcmToken})}):Promise.reject(N.create(B.m))};O.prototype.getSavedToken=O.prototype.ba;O.prototype.aa=function(a,b){var c=this;return"string"!==typeof a||0===a.length?Promise.reject(N.create(B.l)):b instanceof ServiceWorkerRegistration?b.pushManager.getSubscription().then(function(a){return a?a:b.pushManager.subscribe(E)}).then(function(d){return R(a,d).then(function(e){return da(c,a,b,d,e.token,e.pushSet).then(function(){return e.token})})}):Promise.reject(N.create(B.m))}; +O.prototype.createToken=O.prototype.aa;O.prototype.deleteToken=function(a){var b=this;return"string"!==typeof a||0===a.length?Promise.reject(N.create(B.J)):Q(this,a).then(function(a){if(!a)throw N.create(B.D);return P(b).then(function(b){return new Promise(function(c,d){var e=b.transaction(["fcm_token_object_Store"],"readwrite").objectStore("fcm_token_object_Store").delete(a.swScope);e.onerror=function(a){d(a.target.error)};e.onsuccess=function(b){0===b.target.result?d(N.create(B.G)):c(a)}})})})};var S=function(a){var b=this;this.a=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D);if(!a.options.messagingSenderId||"string"!==typeof a.options.messagingSenderId)throw this.a.create(B.l);this.j=a.options.messagingSenderId;this.c=new O;this.app=a;this.INTERNAL={};this.INTERNAL.delete=function(){return b.delete}}; +S.prototype.getToken=function(){var a=this,b=Notification.permission;return"granted"!==b?"denied"===b?Promise.reject(this.a.create(B.L)):Promise.resolve(null):this.f().then(function(b){return a.c.ba(a.j,b).then(function(c){return c?c:a.c.aa(a.j,b)})})};S.prototype.getToken=S.prototype.getToken;S.prototype.deleteToken=function(a){var b=this;return this.c.deleteToken(a).then(function(){return b.f()}).then(function(a){return a?a.pushManager.getSubscription():null}).then(function(a){if(a)return a.unsubscribe()})}; +S.prototype.deleteToken=S.prototype.deleteToken;S.prototype.f=function(){throw this.a.create(B.U);};S.prototype.requestPermission=function(){throw this.a.create(B.i);};S.prototype.useServiceWorker=function(){throw this.a.create(B.i);};S.prototype.useServiceWorker=S.prototype.useServiceWorker;S.prototype.onMessage=function(){throw this.a.create(B.i);};S.prototype.onMessage=S.prototype.onMessage;S.prototype.onTokenRefresh=function(){throw this.a.create(B.i);};S.prototype.onTokenRefresh=S.prototype.onTokenRefresh; +S.prototype.setBackgroundMessageHandler=function(){throw this.a.create(B.A);};S.prototype.setBackgroundMessageHandler=S.prototype.setBackgroundMessageHandler;S.prototype.delete=function(){ba(this.c)};var T=self,U=function(a){var b=this;S.call(this,a);this.a=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",D);T.addEventListener("push",function(a){return ea(b,a)},!1);T.addEventListener("pushsubscriptionchange",function(a){return fa(b,a)},!1);T.addEventListener("notificationclick",function(a){return ga(b,a)},!1);this.b=null};f(U,S); +var ea=function(a,b){var c;try{c=b.data.json()}catch(e){return}var d=ha().then(function(b){if(b){if(c.notification||a.b)return ia(a,c)}else{if((b=c)&&"object"===typeof b.notification){var d=Object.assign({},b.notification),e={};d.data=(e.FCM_MSG=b,e);b=d}else b=void 0;if(b)return T.registration.showNotification(b.title||"",b);if(a.b)return a.b(c)}});b.waitUntil(d)},fa=function(a,b){var c=a.getToken().then(function(b){if(!b)throw a.a.create(B.N);var c=a.c;return Q(c,b).then(function(b){if(!b)throw a.a.create(B.K); +return T.registration.pushManager.subscribe(E).then(function(a){return R(b.ha,a,b.ga)}).catch(function(d){return c.deleteToken(b.ia).then(function(){throw a.a.create(B.Y,{message:d});})})})});b.waitUntil(c)},ga=function(a,b){if(b.notification&&b.notification.data&&b.notification.data.FCM_MSG){b.stopImmediatePropagation();b.notification.close();var c=b.notification.data.FCM_MSG,d=c.notification.click_action;if(d){var e=ja(d).then(function(a){return a?a:T.clients.openWindow(d)}).then(function(b){if(b)return delete c.notification, +X(a,b,H(G.M,c))});b.waitUntil(e)}}};U.prototype.setBackgroundMessageHandler=function(a){if(a&&"function"!==typeof a)throw this.a.create(B.B);this.b=a};U.prototype.setBackgroundMessageHandler=U.prototype.setBackgroundMessageHandler; +var ja=function(a){var b=(new URL(a)).href;return T.clients.matchAll({type:"window",includeUncontrolled:!0}).then(function(a){for(var c=null,e=0;e>> 0),ga=0,ha=function(a,b,c){return a.call.apply(a.bind,arguments)},ia=function(a,b,c){if(!a)throw Error();if(2h&&(h*=2);var c;1===Q?(Q=2,c=0):c=1E3*(h+Math.random());e(c)}}function g(a){jc||(jc=!0,P||(null!==m?(a||(Q=2),clearTimeout(m),e(0)):a||(Q=1)))}var h=1,m=null,q=!1,Q=0,P=!1,jc=!1;e(0);setTimeout(function(){q=!0;g(!0)},c);return g};var la="https://firebasestorage.googleapis.com";var w=function(a,b){this.code="storage/"+a;this.message="Firebase Storage: "+b;this.serverResponse=null;this.name="FirebaseError"};v(w,Error); var ma=function(){return new w("unknown","An unknown error occurred, please check the error payload for server response.")},na=function(){return new w("canceled","User canceled the upload/download.")},oa=function(){return new w("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")},pa=function(a,b,c){return new w("invalid-argument","Invalid argument in `"+b+"` at index "+a+": "+c)},qa=function(){return new w("app-deleted","The Firebase app was deleted.")},ra=function(a,b){return new w("invalid-format", -"String does not match format '"+a+"': "+b)};var sa=function(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])},ta=function(a){var b={};sa(a,function(a,d){b[a]=d});return b};var x=function(a,b,c,d){this.j=a;this.b={};this.method=b;this.headers={};this.body="";this.M=c;this.c=this.a=null;this.f=[200];this.h=[];this.i=d;this.g=!0};var ua={STATE_CHANGED:"state_changed"},va={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},wa=function(a){switch(a){case "running":case "pausing":case "canceling":return"running";case "paused":return"paused";case "success":return"success";case "canceled":return"canceled";case "error":return"error";default:return"error"}};var y=function(a){return n(a)&&null!==a},xa=function(a){return"string"===typeof a||a instanceof String},ya=function(){return"undefined"!==typeof Blob};var za=function(a,b,c){this.f=c;this.c=a;this.g=b;this.b=0;this.a=null};za.prototype.get=function(){var a;0b?1:0};var Pa=function(a,b){this.a=a;this.b=b};var Qa=function(a,b){this.bucket=a;this.path=b},Ra=function(a){var b=encodeURIComponent;return"/b/"+b(a.bucket)+"/o/"+b(a.path)},Sa=function(a){for(var b=null,c=[{ia:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,ba:{bucket:1,path:3},ha:function(a){"/"===a.path.charAt(a.path.length-1)&&(a.path=a.path.slice(0,-1))}},{ia:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,ba:{bucket:1,path:3},ha:function(a){a.path=decodeURIComponent(a.path)}}],d=0;db?1:0};var Pa=function(a,b){this.a=a;this.b=b};var Qa=function(a,b){this.bucket=a;this.path=b},Ra=function(a){var b=encodeURIComponent;return"/b/"+b(a.bucket)+"/o/"+b(a.path)},Sa=function(a){for(var b=null,c=[{ia:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,ba:{bucket:1,path:3},ha:function(a){"/"===a.path.charAt(a.path.length-1)&&(a.path=a.path.slice(0,-1))}},{ia:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,ba:{bucket:1,path:3},ha:function(a){a.path=decodeURIComponent(a.path)}}],d=0;d=d)b.push(d);else if(2047>=d)b.push(192|d>>6,128|d&63);else if(55296==(d&64512))if(c>18,128|d>>12&63,128|d>>6&63,128|d&63)}else b.push(239,191,189);else 56320==(d&64512)?b.push(239,191,189):b.push(224|d>>12,128|d>>6&63,128|d&63)}return new Uint8Array(b)},Ya=function(a,b){switch(a){case "base64":var c=-1!==b.indexOf("-"), d=-1!==b.indexOf("_");if(c||d)throw ra(a,"Invalid character '"+(c?"-":"_")+"' found: is it base64url encoded?");break;case "base64url":c=-1!==b.indexOf("+");d=-1!==b.indexOf("/");if(c||d)throw ra(a,"Invalid character '"+(c?"+":"/")+"' found: is it base64 encoded?");b=b.replace(/-/g,"+").replace(/_/g,"/")}var e;try{e=atob(b)}catch(f){throw ra(a,"Invalid character found");}a=new Uint8Array(e.length);for(b=0;be,h=ub([408,429],e),g=ub(g.o,e),f=f||h||g;f?(e=7===b.K,jd(b),a(!1,new Xd(!1,null,e))):(e=ub(d.G,e),a(!0,new Xd(e,b)))})})}function c(a,b){var c=d.l;a=d.j;var e=b.c;if(b.b)try{var f=d.s(e,Sd(e));n(f)?c(f):c()}catch(q){a(q)}else null!==e?(b=ma(),f=Sd(e),b.serverResponse=f,d.i?a(d.i(e,b)):a(b)):(b=b.a?d.g?qa(): na():new w("retry-limit-exceeded","Max retry time for operation exceeded, please try again."),a(b));jd(e)}var d=a;a.h?c(0,new Xd(!1,null,!0)):a.c=ka(b,c,a.F)};Wd.prototype.a=function(){return this.B};Wd.prototype.cancel=function(a){this.h=!0;this.g=a||!1;null!==this.c&&(0,this.c)(!1);null!==this.b&&this.b.abort()}; -var Yd=function(a,b,c){var d=ab(a.b),d=a.j+d,e=a.headers?ta(a.headers):{};null!==b&&0b&&(b+=a.size),0>b&&(b=0),0>c&&(c+=a.size),c + + +``` +--> +```html + + + +``` diff --git a/lib/google-map/bower.json b/lib/google-map/bower.json index 9ef21f05..418af096 100644 --- a/lib/google-map/bower.json +++ b/lib/google-map/bower.json @@ -1,6 +1,6 @@ { "name": "google-map", - "version": "1.1.13", + "version": "1.1.14", "description": "Google Maps web components", "homepage": "https://elements.polymer-project.org/elements/google-map", "main": [ diff --git a/lib/google-map/demo/index.html b/lib/google-map/demo/index.html index 6142f760..40fc2904 100644 --- a/lib/google-map/demo/index.html +++ b/lib/google-map/demo/index.html @@ -45,8 +45,8 @@ diff --git a/lib/google-map/demo/polys.html b/lib/google-map/demo/polys.html index 50bf9f36..fd58ce2e 100644 --- a/lib/google-map/demo/polys.html +++ b/lib/google-map/demo/polys.html @@ -43,9 +43,9 @@ button.innerText = poly.editable ? 'Disable editing' : 'Enable editing'; } - if (location.origin === 'https://custom-elements.appspot.com') { + if (location.origin === 'https://user-content-dot-custom-elements.appspot.com') { var t = document.querySelector('template'); - t.apiKey = 'AIzaSyD_bfL1kCUIsD0dZ4XxWAO_0W6NstEQ5Pg'; // TODO: update to your own API Key! + t.apiKey = 'AIzaSyD3E1D9b-Z7ekrT3tbhl_dy8DCXuIuDDRc'; // TODO: update to your own API Key! } diff --git a/lib/iron-dropdown/.bower.json b/lib/iron-dropdown/.bower.json index 031d9779..2a854a9b 100644 --- a/lib/iron-dropdown/.bower.json +++ b/lib/iron-dropdown/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-dropdown", - "version": "1.5.2", + "version": "1.5.3", "description": "An unstyled element that works similarly to a native browser select", "authors": [ "The Polymer Authors" @@ -35,11 +35,11 @@ "iron-image": "polymerelements/iron-image#^1.0.0" }, "ignore": [], - "_release": "1.5.2", + "_release": "1.5.3", "_resolution": { "type": "version", - "tag": "v1.5.2", - "commit": "c5dbb9404ee56e00a0e893b95b1253be5181ae2b" + "tag": "v1.5.3", + "commit": "5b61da6b920db532f14b214905a23a2d1d7e02c4" }, "_source": "git://github.com/PolymerElements/iron-dropdown.git", "_target": "^1.0.0", diff --git a/lib/iron-dropdown/bower.json b/lib/iron-dropdown/bower.json index 6e162141..d4bd0df7 100644 --- a/lib/iron-dropdown/bower.json +++ b/lib/iron-dropdown/bower.json @@ -1,6 +1,6 @@ { "name": "iron-dropdown", - "version": "1.5.2", + "version": "1.5.3", "description": "An unstyled element that works similarly to a native browser select", "authors": [ "The Polymer Authors" diff --git a/lib/iron-dropdown/iron-dropdown-scroll-manager.html b/lib/iron-dropdown/iron-dropdown-scroll-manager.html index 69818643..99402fca 100644 --- a/lib/iron-dropdown/iron-dropdown-scroll-manager.html +++ b/lib/iron-dropdown/iron-dropdown-scroll-manager.html @@ -310,12 +310,10 @@ /** * Returns scroll `deltaX` and `deltaY`. * @param {!Event} event The scroll event - * @return {{ - * deltaX: number The x-axis scroll delta (positive: scroll right, - * negative: scroll left, 0: no scroll), - * deltaY: number The y-axis scroll delta (positive: scroll down, - * negative: scroll up, 0: no scroll) - * }} info + * @return {{deltaX: number, deltaY: number}} Object containing the + * x-axis scroll delta (positive: scroll right, negative: scroll left, + * 0: no scroll), and the y-axis scroll delta (positive: scroll down, + * negative: scroll up, 0: no scroll). * @private */ _getScrollInfo: function(event) { diff --git a/lib/iron-icon/.bower.json b/lib/iron-icon/.bower.json index 3d36a0bd..ec934abb 100644 --- a/lib/iron-icon/.bower.json +++ b/lib/iron-icon/.bower.json @@ -1,7 +1,7 @@ { "name": "iron-icon", "private": true, - "version": "1.0.11", + "version": "1.0.12", "license": "http://polymer.github.io/LICENSE.txt", "description": "An element that supports displaying an icon", "main": "iron-icon.html", @@ -33,11 +33,11 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "homepage": "https://github.com/PolymerElements/iron-icon", - "_release": "1.0.11", + "_release": "1.0.12", "_resolution": { "type": "version", - "tag": "v1.0.11", - "commit": "54882797cb368facf05f72d7d43d22974a82c49c" + "tag": "v1.0.12", + "commit": "e6bce09a074f9f8433f168081405b7e44d525c62" }, "_source": "git://github.com/PolymerElements/iron-icon.git", "_target": "^1.0.0", diff --git a/lib/iron-icon/README.md b/lib/iron-icon/README.md index a08298f6..0649f738 100644 --- a/lib/iron-icon/README.md +++ b/lib/iron-icon/README.md @@ -1,92 +1,22 @@ - - - [![Build status](https://travis-ci.org/PolymerElements/iron-icon.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-icon) -_[Demo and API docs](https://elements.polymer-project.org/elements/iron-icon)_ - - ##<iron-icon> The `iron-icon` element displays an icon. By default an icon renders as a 24px square. -Example using src: - -```html - + ```html - - + ``` - -To use a different built-in set of icons, import the specific `iron-icons/-icons.html`, and -specify the icon as `:`. For example, to use a communication icon, you would -use: - -```html - - - -``` - -You can also create custom icon sets of bitmap or SVG icons. - -Example of using an icon named `cherry` from a custom iconset with the ID `fruit`: - -```html - -``` - -See [iron-iconset](iron-iconset) and [iron-iconset-svg](iron-iconset-svg) for more information about -how to create a custom iconset. - -See the [iron-icons demo](iron-icons?view=demo:demo/index.html) to see the icons available -in the various iconsets. - -To load a subset of icons from one of the default `iron-icons` sets, you can -use the [poly-icon](https://poly-icon.appspot.com/) tool. It allows you -to select individual icons, and creates an iconset from them that you can -use directly in your elements. - -### Styling - -The following custom properties are available for styling: - -| Custom property | Description | Default | -| --- | --- | --- | -| `--iron-icon-width` | Width of the icon | `24px` | -| `--iron-icon-height` | Height of the icon | `24px` | -| `--iron-icon-fill-color` | Fill color of the svg icon | `currentcolor` | -| `--iron-icon-stroke-color` | Stroke color of the svg icon | none | - - diff --git a/lib/iron-icon/bower.json b/lib/iron-icon/bower.json index 2646071b..46239e00 100644 --- a/lib/iron-icon/bower.json +++ b/lib/iron-icon/bower.json @@ -1,7 +1,7 @@ { "name": "iron-icon", "private": true, - "version": "1.0.11", + "version": "1.0.12", "license": "http://polymer.github.io/LICENSE.txt", "description": "An element that supports displaying an icon", "main": "iron-icon.html", diff --git a/lib/iron-iconset-svg/.bower.json b/lib/iron-iconset-svg/.bower.json index 64eddcf1..5c12995b 100644 --- a/lib/iron-iconset-svg/.bower.json +++ b/lib/iron-iconset-svg/.bower.json @@ -1,7 +1,7 @@ { "name": "iron-iconset-svg", "description": "Manages a set of svg icons", - "version": "1.0.11", + "version": "1.1.0", "keywords": [ "web-components", "polymer", @@ -32,11 +32,11 @@ "main": "iron-iconset-svg.html", "ignore": [], "homepage": "https://github.com/PolymerElements/iron-iconset-svg", - "_release": "1.0.11", + "_release": "1.1.0", "_resolution": { "type": "version", - "tag": "v1.0.11", - "commit": "9ecdf97d854d36b7715c7b250bdab9b3d5cfaa26" + "tag": "v1.1.0", + "commit": "9d3135d76b32a1ca60ce36c32e157fc9d4cfdd0e" }, "_source": "git://github.com/PolymerElements/iron-iconset-svg.git", "_target": "^1.0.0", diff --git a/lib/iron-iconset-svg/bower.json b/lib/iron-iconset-svg/bower.json index 664484a2..fba891cd 100644 --- a/lib/iron-iconset-svg/bower.json +++ b/lib/iron-iconset-svg/bower.json @@ -1,7 +1,7 @@ { "name": "iron-iconset-svg", "description": "Manages a set of svg icons", - "version": "1.0.11", + "version": "1.1.0", "keywords": [ "web-components", "polymer", diff --git a/lib/iron-iconset-svg/iron-iconset-svg.html b/lib/iron-iconset-svg/iron-iconset-svg.html index f7fd0d86..f2a79454 100644 --- a/lib/iron-iconset-svg/iron-iconset-svg.html +++ b/lib/iron-iconset-svg/iron-iconset-svg.html @@ -72,6 +72,10 @@ * Set to true to enable mirroring of icons where specified when they are * stamped. Icons that should be mirrored should be decorated with a * `mirror-in-rtl` attribute. + * + * NOTE: For performance reasons, direction will be resolved once per + * document per iconset, so moving icons in and out of RTL subtrees will + * not cause their mirrored state to change. */ rtlMirroring: { type: Boolean, @@ -79,14 +83,6 @@ } }, - _targetIsRTL: function(target) { - if (target && target.nodeType !== Node.ELEMENT_NODE) { - target = target.host; - } - - return target && window.getComputedStyle(target)['direction'] === 'rtl'; - }, - attached: function() { this.style.display = 'none'; }, @@ -109,6 +105,12 @@ * An svg icon is prepended to the element's shadowRoot if it exists, * otherwise to the element itself. * + * If RTL mirroring is enabled, and the icon is marked to be mirrored in + * RTL, the element will be tested (once and only once ever for each + * iconset) to determine the direction of the subtree the element is in. + * This direction will apply to all future icon applications, although only + * icons marked to be mirrored will be affected. + * * @method applyIcon * @param {Element} element Element to which the icon is applied. * @param {string} iconName Name of the icon to apply. @@ -145,6 +147,24 @@ } }, + /** + * Measures and memoizes the direction of the element. Note that this + * measurement is only done once and the result is memoized for future + * invocations. + */ + _targetIsRTL: function(target) { + if (this.__targetIsRTL == null) { + if (target && target.nodeType !== Node.ELEMENT_NODE) { + target = target.host; + } + + this.__targetIsRTL = target && + window.getComputedStyle(target)['direction'] === 'rtl'; + } + + return this.__targetIsRTL; + }, + /** * * When name is changed, register iconset metadata diff --git a/lib/iron-iconset-svg/test/iron-iconset-svg.html b/lib/iron-iconset-svg/test/iron-iconset-svg.html index d9bc0768..c982abcf 100644 --- a/lib/iron-iconset-svg/test/iron-iconset-svg.html +++ b/lib/iron-iconset-svg/test/iron-iconset-svg.html @@ -132,6 +132,17 @@ var transform = computedStyle.transform || computedStyle.webkitTransform; expect(transform).to.be.eql('none'); }); + + test('many mirrored icons only call getComputedStyle once', function() { + sinon.spy(window, 'getComputedStyle'); + + for (var i = 0; i < 3; ++i) { + iconset.applyIcon(rtlContainer, 'rect'); + } + + expect(window.getComputedStyle.callCount).to.be.eql(1); + window.getComputedStyle.restore(); + }); }); suite('when paired with a size and SVG definition', function () { diff --git a/lib/iron-overlay-behavior/.bower.json b/lib/iron-overlay-behavior/.bower.json index 1b270d73..88d0d7e6 100644 --- a/lib/iron-overlay-behavior/.bower.json +++ b/lib/iron-overlay-behavior/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-overlay-behavior", - "version": "1.9.0", + "version": "1.10.1", "license": "http://polymer.github.io/LICENSE.txt", "description": "Provides a behavior for making an element an overlay", "private": true, @@ -35,11 +35,11 @@ }, "ignore": [], "homepage": "https://github.com/PolymerElements/iron-overlay-behavior", - "_release": "1.9.0", + "_release": "1.10.1", "_resolution": { "type": "version", - "tag": "v1.9.0", - "commit": "54c54967b006ccdb341f40e8ca6f05cb7bdfe134" + "tag": "v1.10.1", + "commit": "4daacfc095bdaaaa0ca002b5a56f87f9eac4dcb0" }, "_source": "git://github.com/PolymerElements/iron-overlay-behavior.git", "_target": "^1.0.0", diff --git a/lib/iron-overlay-behavior/bower.json b/lib/iron-overlay-behavior/bower.json index 4bd3e2dc..31e99082 100644 --- a/lib/iron-overlay-behavior/bower.json +++ b/lib/iron-overlay-behavior/bower.json @@ -1,6 +1,6 @@ { "name": "iron-overlay-behavior", - "version": "1.9.0", + "version": "1.10.1", "license": "http://polymer.github.io/LICENSE.txt", "description": "Provides a behavior for making an element an overlay", "private": true, diff --git a/lib/iron-overlay-behavior/iron-focusables-helper.html b/lib/iron-overlay-behavior/iron-focusables-helper.html new file mode 100644 index 00000000..084ad7d2 --- /dev/null +++ b/lib/iron-overlay-behavior/iron-focusables-helper.html @@ -0,0 +1,220 @@ + + + + + diff --git a/lib/iron-overlay-behavior/iron-overlay-behavior.html b/lib/iron-overlay-behavior/iron-overlay-behavior.html index 7c92333b..af3be8e8 100644 --- a/lib/iron-overlay-behavior/iron-overlay-behavior.html +++ b/lib/iron-overlay-behavior/iron-overlay-behavior.html @@ -12,6 +12,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/iron-overlay-behavior/test/iron-overlay-behavior.html b/lib/iron-overlay-behavior/test/iron-overlay-behavior.html index 1274f7c9..b080482a 100644 --- a/lib/iron-overlay-behavior/test/iron-overlay-behavior.html +++ b/lib/iron-overlay-behavior/test/iron-overlay-behavior.html @@ -561,44 +561,56 @@

Focusables (with tabindex)

overlayFocusableNodes = f[2]; }); - test('_focusableNodes returns nodes that are focusable', function() { - var focusableNodes = overlay._focusableNodes; - assert.equal(focusableNodes.length, 3, '3 nodes are focusable'); - assert.equal(focusableNodes[0], Polymer.dom(overlay).querySelector('.focusable1')); - assert.equal(focusableNodes[1], Polymer.dom(overlay).querySelector('.focusable2')); - assert.equal(focusableNodes[2], Polymer.dom(overlay).querySelector('.focusable3')); + test('_focusableNodes returns nodes that are focusable', function(done) { + runAfterOpen(overlay, function() { + var focusableNodes = overlay._focusableNodes; + assert.equal(focusableNodes.length, 3, '3 nodes are focusable'); + assert.equal(focusableNodes[0], Polymer.dom(overlay).querySelector('.focusable1')); + assert.equal(focusableNodes[1], Polymer.dom(overlay).querySelector('.focusable2')); + assert.equal(focusableNodes[2], Polymer.dom(overlay).querySelector('.focusable3')); + done(); + }); }); - test('_focusableNodes includes overlay if it has a valid tabindex', function() { - overlay.setAttribute('tabindex', '0'); - var focusableNodes = overlay._focusableNodes; - assert.equal(focusableNodes.length, 4, '4 focusable nodes'); - assert.notEqual(focusableNodes.indexOf(overlay), -1, 'overlay is included'); + test('_focusableNodes includes overlay if it has a valid tabindex', function(done) { + runAfterOpen(overlay, function() { + overlay.setAttribute('tabindex', '0'); + var focusableNodes = overlay._focusableNodes; + assert.equal(focusableNodes.length, 4, '4 focusable nodes'); + assert.notEqual(focusableNodes.indexOf(overlay), -1, 'overlay is included'); + done(); + }); }); - test('_focusableNodes respects the tabindex order', function() { - var focusableNodes = overlayWithTabIndex._focusableNodes; - assert.equal(focusableNodes.length, 6, '6 nodes are focusable'); - assert.equal(focusableNodes[0], Polymer.dom(overlayWithTabIndex).querySelector('.focusable1')); - assert.equal(focusableNodes[1], Polymer.dom(overlayWithTabIndex).querySelector('.focusable2')); - assert.equal(focusableNodes[2], Polymer.dom(overlayWithTabIndex).querySelector('.focusable3')); - assert.equal(focusableNodes[3], Polymer.dom(overlayWithTabIndex).querySelector('.focusable4')); - assert.equal(focusableNodes[4], Polymer.dom(overlayWithTabIndex).querySelector('.focusable5')); - assert.equal(focusableNodes[5], Polymer.dom(overlayWithTabIndex).querySelector('.focusable6')); + test('_focusableNodes respects the tabindex order', function(done) { + runAfterOpen(overlayWithTabIndex, function() { + var focusableNodes = overlayWithTabIndex._focusableNodes; + assert.equal(focusableNodes.length, 6, '6 nodes are focusable'); + assert.equal(focusableNodes[0], Polymer.dom(overlayWithTabIndex).querySelector('.focusable1')); + assert.equal(focusableNodes[1], Polymer.dom(overlayWithTabIndex).querySelector('.focusable2')); + assert.equal(focusableNodes[2], Polymer.dom(overlayWithTabIndex).querySelector('.focusable3')); + assert.equal(focusableNodes[3], Polymer.dom(overlayWithTabIndex).querySelector('.focusable4')); + assert.equal(focusableNodes[4], Polymer.dom(overlayWithTabIndex).querySelector('.focusable5')); + assert.equal(focusableNodes[5], Polymer.dom(overlayWithTabIndex).querySelector('.focusable6')); + done(); + }); }); - test('_focusableNodes can be overridden', function() { - // It has 1 focusable in the light dom, and 2 in the shadow dom. - var focusableNodes = overlayFocusableNodes._focusableNodes; - assert.equal(focusableNodes.length, 2, 'length ok'); - assert.equal(focusableNodes[0], overlayFocusableNodes.$.first, 'first ok'); - assert.equal(focusableNodes[1], overlayFocusableNodes.$.last, 'last ok'); + test('_focusableNodes can be overridden', function(done) { + runAfterOpen(overlayFocusableNodes, function() { + // It has 1 focusable in the light dom, and 2 in the shadow dom. + var focusableNodes = overlayFocusableNodes._focusableNodes; + assert.equal(focusableNodes.length, 2, 'length ok'); + assert.equal(focusableNodes[0], overlayFocusableNodes.$.first, 'first ok'); + assert.equal(focusableNodes[1], overlayFocusableNodes.$.last, 'last ok'); + done(); + }); }); test('with-backdrop: TAB & Shift+TAB wrap focus', function(done) { overlay.withBackdrop = true; - var focusableNodes = overlay._focusableNodes; runAfterOpen(overlay, function() { + var focusableNodes = overlay._focusableNodes; // 1ms timeout needed by IE10 to have proper focus switching. Polymer.Base.async(function() { // Go to last element. @@ -625,8 +637,8 @@

Focusables (with tabindex)

test('with-backdrop: TAB & Shift+TAB wrap focus respecting tabindex', function(done) { overlayWithTabIndex.withBackdrop = true; - var focusableNodes = overlayWithTabIndex._focusableNodes; runAfterOpen(overlayWithTabIndex, function() { + var focusableNodes = overlayWithTabIndex._focusableNodes; // 1ms timeout needed by IE10 to have proper focus switching. Polymer.Base.async(function() { // Go to last element. @@ -644,8 +656,8 @@

Focusables (with tabindex)

test('with-backdrop: Shift+TAB after open wrap focus', function(done) { overlay.withBackdrop = true; - var focusableNodes = overlay._focusableNodes; runAfterOpen(overlay, function() { + var focusableNodes = overlay._focusableNodes; // 1ms timeout needed by IE10 to have proper focus switching. Polymer.Base.async(function() { // Spy keydown. @@ -665,8 +677,8 @@

Focusables (with tabindex)

test('with-backdrop: after open, update last focusable node and then Shift+TAB', function(done) { overlay.withBackdrop = true; - var focusableNodes = overlay._focusableNodes; runAfterOpen(overlay, function() { + var focusableNodes = overlay._focusableNodes; // 1ms timeout needed by IE10 to have proper focus switching. Polymer.Base.async(function() { // Before tabbing, make lastFocusable non-tabbable. This will make diff --git a/lib/iron-overlay-behavior/test/test-buttons-wrapper.html b/lib/iron-overlay-behavior/test/test-buttons-wrapper.html new file mode 100644 index 00000000..4e669ab8 --- /dev/null +++ b/lib/iron-overlay-behavior/test/test-buttons-wrapper.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/lib/iron-overlay-behavior/test/test-buttons.html b/lib/iron-overlay-behavior/test/test-buttons.html index 9ed1fbed..05434a01 100644 --- a/lib/iron-overlay-behavior/test/test-buttons.html +++ b/lib/iron-overlay-behavior/test/test-buttons.html @@ -14,6 +14,7 @@ + ``` - -To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` will already -receive focus, you may want to prevent the anchor tag from receiving focus as well by setting -its tabindex to -1. - +--> ```html - - Polymer Project - -``` - -### Styling - -Style the button with CSS as you would a normal DOM element. - -```css -paper-button.fancy { - background: green; - color: yellow; -} - -paper-button.fancy:hover { - background: lime; -} - -paper-button[disabled], -paper-button[toggles][active] { - background: red; -} +link +raised +toggles +disabled ``` - -By default, the ripple is the same color as the foreground at 25% opacity. You may -customize the color using the `--paper-button-ink-color` custom property. - -The following custom properties and mixins are also available for styling: - -| Custom property | Description | Default | -| --- | --- | --- | -| `--paper-button-ink-color` | Background color of the ripple | `Based on the button's color` | -| `--paper-button` | Mixin applied to the button | `{}` | -| `--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` | -| `--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` | -| `--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` | - - diff --git a/lib/paper-button/bower.json b/lib/paper-button/bower.json index 59e0b2b0..2046471c 100644 --- a/lib/paper-button/bower.json +++ b/lib/paper-button/bower.json @@ -1,6 +1,6 @@ { "name": "paper-button", - "version": "1.0.13", + "version": "1.0.14", "description": "Material design button", "authors": [ "The Polymer Authors" diff --git a/lib/paper-slider/.bower.json b/lib/paper-slider/.bower.json index b384dd44..03c90c98 100644 --- a/lib/paper-slider/.bower.json +++ b/lib/paper-slider/.bower.json @@ -1,6 +1,6 @@ { "name": "paper-slider", - "version": "1.0.11", + "version": "1.0.12", "description": "A material design-style slider", "license": "http://polymer.github.io/LICENSE.txt", "authors": "The Polymer Authors", @@ -36,11 +36,11 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "homepage": "https://github.com/PolymerElements/paper-slider", - "_release": "1.0.11", + "_release": "1.0.12", "_resolution": { "type": "version", - "tag": "v1.0.11", - "commit": "855e3ed20d12b4545175317536adca7897928537" + "tag": "v1.0.12", + "commit": "e552b68c3e9d43b5e3153c47c4f865cf37a67b5d" }, "_source": "git://github.com/PolymerElements/paper-slider.git", "_target": "^1.0.0", diff --git a/lib/paper-slider/.travis.yml b/lib/paper-slider/.travis.yml index bbd292e1..4542e75b 100644 --- a/lib/paper-slider/.travis.yml +++ b/lib/paper-slider/.travis.yml @@ -1,23 +1,23 @@ language: node_js sudo: required before_script: - - npm install -g bower polylint web-component-tester - - bower install - - polylint +- npm install -g bower polylint web-component-tester +- bower install +- polylint env: global: - - secure: W9pv3wK5AyI038GpPZpFo5yii72up1pTHM9yu8TI4th6Q/TiUQCa8GbjAMhUcbMDl3Y4i50WjckykSox+c506Zs5Pe5vDCaKpHT/iOHYqjIaQEDGGvvKWxSTJr82HY2taNhkH7seksg7oKq8dL7DCBLyKJUl03hGmRqZABjIw9fWjSNUb9PVdlZass5nJaqw954t76GYBWcQ71fntm8uCnSrQoviHEprvfwZMNnK0mhd79VmBohl83jpFU8FaYEWLc5IFY29u7McLxgynZBggwhGSrvdDrOYG4jtn26RNx4mNCcJGxejzadvf4K6H2S45SGnsCIjJRJbl8MV+ni18VqC/BuCF2J4k8QqSRtWi2mSq/l9DOgIiwViPRjPRxoK+a+/6qA7pQ1aMXBWWF4FjngvgoZHcY2J5FptbRltDtalrUSbUVmmKNoWwaJa4Sb5OopJdr0herGds946qzQKW1FLqkcDTtF6c4fZqK12WVEIXZLXiP9sV9+dBJDXT4oWzgjo2GHAiMEzV6Xk3oZ/RHmWJ34Bemy7M5zYKDHErLhD6/UXiA/tYlTqqgu/4Jdxs07ilWmaVd3kTYywRYuTzR4yO3xq8ElpEnpby2WobGiVCsuzQwOe4fWSvV4wS8TpSdigoGxYQ+FPrrbc7jhgRodyZP1xF/mTHlIvNmaTYYc= - - secure: xLLhaBejrIuYAxwQoFPsrvnBpeDVY8IYdThJ36fJnD4V0jpqS7m8b2rw5fYrtwWvmEAQlqJ20/hnjfp9kKXr6Qpkj2im9d0KWdw4xAyD2KxiG/u5pBn1Y+zE9iGjq+NGa58EJDNaxQSnaXmVnk55tyT9W3ailkiO/lEtaofXXXGqiW9Nxa9D0GtbbNWBypcoc7X/HXCcg5hVpdVjEFh3Y+nFWIdqJEO0V7oKujfb5yFhu5PRU7siTzdN+nLoPXPMlkBa3aWwPLdM1D9HKXN1jBX6dM9dH3oz20K/TCPpbO5u675vfuTT9iP9XuLy4LB/cl7S6bcopvhU5ipkQvLEieeq73EP1hz5vwdSWgleXkNhWBInhzeHLTI04M49ZxIc0NEay2Tvx9tQl5e8BT1/WglpjnHvqx/VoF7zkHRfWyWeObL6YyFVFiJ0Gz3ExJTUCruQRBen+g2Cqr1qwBN4bFPhgxzHW58ECdsDFvfpZT3I7h/wnCzNVOZx+A74nVwDpl6zg+/+GWpqZF2ILGbRDTcjp1A/eH+FMwnQccRLiBcXm4v4y8pFfaNzjRwswUQjnMV5KyIV+dSyQQAh9sBedFJjeWm1HSy3UXFZvyc6gQIG5GR5uGWkyxYHdCxBFMYFj2xmEzoLwF7omu5CXF0TUdYxb5hvUBMEqEEKIwte2VE= + - secure: n4PzATQdbmNr0NAPZGYLQOWwu1UQXAtAxDTlM6b1eSwrBXBw7VNU8M+7Zs9Ho6LDBV7Wd8Ktjw6PCUkeIQUmiKrycz1p7Tthu7JsnUuEUKKCqzo0Vh41z7W63Cs7T1NryyMUXnnlen/VxMOyiQ6JA/yXl0TDavF5UoU/uXU+WsA62Fsv4+izv5hx37+2IK4bJZe4MKTr4euh0gcOqRWRwP+A7Tx8UAZYouvn7H0ho6ORRbP6OQfPxMHtbJPznDUNIvrkjtqCzOkFgQxncVBjzRcS2iKGb+8T2ax5zMUJpBX6Q1SwpY4Y0pAA1ZdFLI7tyiM+BwhoDLZqpePe5tAU024qEcohRUkY5/I3z9whyBF81/HOI9b5xZQnlwsPNBdwUdjgSUz8OGVflmBxBovuhlN7lCea/2HkHVmLA3k8r6Lpqax8JquNdjRY9IQdvJpLueWOeVYMi6TJfgIIpjXim6jVzTfICX3qH9mNjDoncQ96EhxM9Hq2O5bBBkKCJVvyXyrkeqvJPG6fnqAdDC9ybKL86VAgHBuYTKqHnjsRq+Cqy+kSu56pXzH3rTNmC3ixt2dScxluK3Z6ItmR4kfALltpYzKvElsWAx/r4hKqIkO+sBpLKXLafRiwx0J3zS/CpV2AWJNihaK/iVMRWD+8TDi9eZ/43Abc9d9Sw6AgnmU= + - secure: YHkImXE3+PaTw/nL9boZcJA0TJZesmYZ0wsa1C6xGz0NEEVmn6R687N7SOklP13wjues5FwPlY2HehhLJDjn8c+vT/p02UWUr8CJmhyVkWrgufVDHSg6hopiKHroLvNxUOtbwVLQ2wYtQpgM8ru3DbvJKWgCtKbXo+7owz3TSAwD2ksaGUCjNnLQ8qXeSytLn8ck3WfPPIqJ+hA7ge63QNnglMRvPGQWKSt1rM0XyW+hZ0fbd5o/ng+4f1hwS2nIZGlM4WOQ2fTDoCRyVtZ1XfnL1uK6FoHMSunQ32T0j7n7qPGWof6W9Tl08TRk5ltPRBSzjfZt5BWD1bkfTm5Pme9X7rCHQ7Ddim54nmgvAXnWc/VflSgkn1FEdtAKcOh4zWzGX34PrYfzFgBIt8sVtvVO5Kletv+1cPxxHM804pxNtFqUjEKtBIBpFI2vS6yH+FyRX/oSQETAtFl6aCsxDW3MoeK5s9AMq7xnZ10mEC6SkCHRfkGh/rgDEsNsPYVXlpwxYiUEPWET7K2PxWyyNJYz6Qq2C5TcY7gvHIyvxbk7jnWgPZV0NzyFcCvch55mWA5/mM886w3+YDt06v1wWyKq41s4bWCWiql5UK5V9IgurZs65mBWTy7leztIe0lmipr9xn8rb5lPTQIrGdRGljBnEGthT4I7LLc/1Cj/iZI= node_js: stable addons: - firefox: latest + firefox: '46.0' apt: sources: - - google-chrome + - google-chrome packages: - - google-chrome-stable + - google-chrome-stable sauce_connect: true script: - - xvfb-run wct - - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" +- xvfb-run wct +- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct -s 'default'; fi dist: trusty diff --git a/lib/paper-slider/README.md b/lib/paper-slider/README.md index 9a413de7..6c485847 100644 --- a/lib/paper-slider/README.md +++ b/lib/paper-slider/README.md @@ -1,22 +1,5 @@ - - - [![Build status](https://travis-ci.org/PolymerElements/paper-slider.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-slider) -_[Demo and API docs](https://elements.polymer-project.org/elements/paper-slider)_ - - ##<paper-slider> Material design: [Sliders](https://www.google.com/design/spec/components/sliders.html) @@ -26,40 +9,17 @@ moving the slider thumb. The interactive nature of the slider makes it a great choice for settings that reflect intensity levels, such as volume, brightness, or color saturation. -Example: - -```html - + ```html - + ``` - -### Styling - -The following custom properties and mixins are available for styling: - -| Custom property | Description | Default | -| --- | --- | --- | -| `--paper-slider-container-color` | The background color of the bar | `--paper-grey-400` | -| `--paper-slider-bar-color` | The background color of the slider | `transparent` | -| `--paper-slider-active-color` | The progress bar color | `--google-blue-700` | -| `--paper-slider-secondary-color` | The secondary progress bar color | `--google-blue-300` | -| `--paper-slider-knob-color` | The knob color | `--google-blue-700` | -| `--paper-slider-disabled-knob-color` | The disabled knob color | `--paper-grey-400` | -| `--paper-slider-pin-color` | The pin color | `--google-blue-700` | -| `--paper-slider-font-color` | The pin's text color | `#fff` | -| `--paper-slider-disabled-active-color` | The disabled progress bar color | `--paper-grey-400` | -| `--paper-slider-disabled-secondary-color` | The disabled secondary progress bar color | `--paper-grey-400` | -| `--paper-slider-knob-start-color` | The fill color of the knob at the far left | `transparent` | -| `--paper-slider-knob-start-border-color` | The border color of the knob at the far left | `--paper-grey-400` | -| `--paper-slider-pin-start-color` | The color of the pin at the far left | `--paper-grey-400` | -| `--paper-slider-height` | Height of the progress bar | `2px` | -| `--paper-slider-input` | Mixin applied to the input in editable mode | `{}` | - - diff --git a/lib/paper-slider/bower.json b/lib/paper-slider/bower.json index 9504c0e5..0c427f99 100644 --- a/lib/paper-slider/bower.json +++ b/lib/paper-slider/bower.json @@ -1,6 +1,6 @@ { "name": "paper-slider", - "version": "1.0.11", + "version": "1.0.12", "description": "A material design-style slider", "license": "http://polymer.github.io/LICENSE.txt", "authors": "The Polymer Authors", diff --git a/lib/paper-slider/paper-slider.html b/lib/paper-slider/paper-slider.html index aa42264a..457a4d55 100644 --- a/lib/paper-slider/paper-slider.html +++ b/lib/paper-slider/paper-slider.html @@ -50,6 +50,7 @@ `--paper-slider-disabled-knob-color` | The disabled knob color | `--paper-grey-400` `--paper-slider-pin-color` | The pin color | `--google-blue-700` `--paper-slider-font-color` | The pin's text color | `#fff` +`--paper-slider-markers-color` | The snaps markers color | `#000` `--paper-slider-disabled-active-color` | The disabled progress bar color | `--paper-grey-400` `--paper-slider-disabled-secondary-color` | The disabled secondary progress bar color | `--paper-grey-400` `--paper-slider-knob-start-color` | The fill color of the knob at the far left | `transparent` @@ -82,6 +83,7 @@ --paper-progress-secondary-color: var(--paper-slider-secondary-color, --google-blue-300); --paper-progress-disabled-active-color: var(--paper-slider-disabled-active-color, --paper-grey-400); --paper-progress-disabled-secondary-color: var(--paper-slider-disabled-secondary-color, --paper-grey-400); + --calculated-paper-slider-height: var(--paper-slider-height, 2px); } /* focus shows the ripple */ @@ -92,9 +94,9 @@ #sliderContainer { position: relative; width: 100%; - height: calc(30px + var(--paper-slider-height, 2px)); - margin-left: calc(15px + var(--paper-slider-height, 2px)/2); - margin-right: calc(15px + var(--paper-slider-height, 2px)/2); + height: calc(30px + var(--calculated-paper-slider-height)); + margin-left: calc(15px + var(--calculated-paper-slider-height)/2); + margin-right: calc(15px + var(--calculated-paper-slider-height)/2); } #sliderContainer:focus { @@ -116,7 +118,7 @@ } .ring > .bar-container { - left: calc(5px + var(--paper-slider-height, 2px)/2); + left: calc(5px + var(--calculated-paper-slider-height)/2); transition: left 0.18s ease; } @@ -125,7 +127,7 @@ } .ring.expand:not(.pin) > .bar-container { - left: calc(8px + var(--paper-slider-height, 2px)/2); + left: calc(8px + var(--calculated-paper-slider-height)/2); } #sliderBar { @@ -133,13 +135,13 @@ width: 100%; background-color: var(--paper-slider-bar-color, transparent); --paper-progress-container-color: var(--paper-slider-container-color, --paper-grey-400); - --paper-progress-height: var(--paper-slider-height, 2px); + --paper-progress-height: var(--calculated-paper-slider-height); } .slider-markers { position: absolute; top: calc(14px + var(--paper-slider-height,2px)/2); - height: var(--paper-slider-height, 2px); + height: var(--calculated-paper-slider-height); left: 0; right: -1px; box-sizing: border-box; @@ -156,38 +158,38 @@ display: block; margin-left: -1px; width: 2px; - height: 2px; + height: var(--calculated-paper-slider-height); border-radius: 50%; - background-color: black; + background-color: var(--paper-slider-markers-color, #000); } - #sliderKnob { + .slider-knob { position: absolute; left: 0; top: 0; - margin-left: calc(-15px - var(--paper-slider-height, 2px)/2); - width: calc(30px + var(--paper-slider-height, 2px)); - height: calc(30px + var(--paper-slider-height, 2px)); + margin-left: calc(-15px - var(--calculated-paper-slider-height)/2); + width: calc(30px + var(--calculated-paper-slider-height)); + height: calc(30px + var(--calculated-paper-slider-height)); } - .transiting > #sliderKnob { + .transiting > .slider-knob { transition: left 0.08s ease; } - #sliderKnob:focus { + .slider-knob:focus { outline: none; } - #sliderKnob.dragging { + .slider-knob.dragging { transition: none; } - .snaps > #sliderKnob.dragging { + .snaps > .slider-knob.dragging { transition: -webkit-transform 0.08s ease; transition: transform 0.08s ease; } - #sliderKnobInner { + .slider-knob-inner { margin: 10px; width: calc(100% - 20px); height: calc(100% - 20px); @@ -204,21 +206,21 @@ transition-timing-function: ease; } - .expand:not(.pin) > #sliderKnob > #sliderKnobInner { + .expand:not(.pin) > .slider-knob > .slider-knob-inner { -webkit-transform: scale(1.5); transform: scale(1.5); } - .ring > #sliderKnob > #sliderKnobInner { + .ring > .slider-knob > .slider-knob-inner { background-color: var(--paper-slider-knob-start-color, transparent); border: 2px solid var(--paper-slider-knob-start-border-color, --paper-grey-400); } - #sliderKnobInner::before { + .slider-knob-inner::before { background-color: var(--paper-slider-pin-color, --google-blue-700); } - .pin > #sliderKnob > #sliderKnobInner::before { + .pin > .slider-knob > .slider-knob-inner::before { content: ""; position: absolute; top: 0; @@ -232,22 +234,22 @@ transform: rotate(-45deg) scale(0) translate(0); } - #sliderKnobInner::before, - #sliderKnobInner::after { + .slider-knob-inner::before, + .slider-knob-inner::after { transition: -webkit-transform .18s ease, background-color .18s ease; transition: transform .18s ease, background-color .18s ease; } - .pin.ring > #sliderKnob > #sliderKnobInner::before { + .pin.ring > .slider-knob > .slider-knob-inner::before { background-color: var(--paper-slider-pin-start-color, --paper-grey-400); } - .pin.expand > #sliderKnob > #sliderKnobInner::before { + .pin.expand > .slider-knob > .slider-knob-inner::before { -webkit-transform: rotate(-45deg) scale(1) translate(17px, -17px); transform: rotate(-45deg) scale(1) translate(17px, -17px); } - .pin > #sliderKnob > #sliderKnobInner::after { + .pin > .slider-knob > .slider-knob-inner::after { content: attr(value); position: absolute; top: 0; @@ -263,7 +265,7 @@ transform: scale(0) translate(0); } - .pin.expand > #sliderKnob > #sliderKnobInner::after { + .pin.expand > .slider-knob > .slider-knob-inner::after { -webkit-transform: scale(1) translate(0, -17px); transform: scale(1) translate(0, -17px); } @@ -283,14 +285,14 @@ pointer-events: none; } - .disabled > #sliderKnob > #sliderKnobInner { + .disabled > .slider-knob > .slider-knob-inner { background-color: var(--paper-slider-disabled-knob-color, --paper-grey-400); border: 2px solid var(--paper-slider-disabled-knob-color, --paper-grey-400); -webkit-transform: scale3d(0.75, 0.75, 1); transform: scale3d(0.75, 0.75, 1); } - .disabled.ring > #sliderKnob > #sliderKnobInner { + .disabled.ring > .slider-knob > .slider-knob-inner { background-color: var(--paper-slider-knob-start-color, transparent); border: 2px solid var(--paper-slider-knob-start-border-color, --paper-grey-400); } @@ -327,11 +329,12 @@
-
+
@@ -450,7 +453,9 @@ markers: { type: Array, readOnly: true, - value: [] + value: function() { + return []; + } }, }, @@ -561,12 +566,12 @@ this._setDragging(true); }, - _trackX: function(e) { + _trackX: function(event) { if (!this.dragging) { - this._trackStart(e); + this._trackStart(event); } - var dx = Math.min(this._maxx, Math.max(this._minx, e.detail.dx)); + var dx = Math.min(this._maxx, Math.max(this._minx, event.detail.dx)); this._x = this._startx + dx; var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w)); @@ -734,7 +739,7 @@ * Fired when the slider's immediateValue changes. Only occurs while the * user is dragging. * - * To detect changes to immediateValue that happen for any input (i.e. + * To detect changes to immediateValue that happen for any input (i.e. * dragging, tapping, clicking, etc.) listen for immediate-value-changed * instead. * diff --git a/lib/paper-tabs/.bower.json b/lib/paper-tabs/.bower.json index 636d8b8b..f885df39 100644 --- a/lib/paper-tabs/.bower.json +++ b/lib/paper-tabs/.bower.json @@ -1,6 +1,6 @@ { "name": "paper-tabs", - "version": "1.6.2", + "version": "1.7.0", "license": "http://polymer.github.io/LICENSE.txt", "description": "Material design tabs", "private": true, @@ -42,11 +42,11 @@ }, "ignore": [], "homepage": "https://github.com/PolymerElements/paper-tabs", - "_release": "1.6.2", + "_release": "1.7.0", "_resolution": { "type": "version", - "tag": "v1.6.2", - "commit": "fc3df3875f97cbcee8cfa8f4895d86a4fd2925c7" + "tag": "v1.7.0", + "commit": "0df85153df9924dd398e0de769ef47847383afa8" }, "_source": "git://github.com/PolymerElements/paper-tabs.git", "_target": "^1.0.0", diff --git a/lib/paper-tabs/README.md b/lib/paper-tabs/README.md index 96683cab..050979f8 100644 --- a/lib/paper-tabs/README.md +++ b/lib/paper-tabs/README.md @@ -1,21 +1,5 @@ - - - [![Build status](https://travis-ci.org/PolymerElements/paper-tabs.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-tabs) - -_[Demo and API docs](https://elements.polymer-project.org/elements/paper-tabs)_ - +[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://beta.webcomponents.org/element/PolymerElements/paper-tabs) ##<paper-tabs> @@ -24,103 +8,39 @@ Material design: [Tabs](https://www.google.com/design/spec/components/tabs.html) `paper-tabs` makes it easy to explore and switch between different views or functional aspects of an app, or to browse categorized data sets. -Use `selected` property to get or set the selected tab. - -Example: - -```html - - TAB 1 - TAB 2 - TAB 3 - + ```html - - TAB 1 - TAB 2 - TAB 3 + + The first tab + Tab two + The third tab + Fourth tab ``` - -### Styling - -The following custom properties and mixins are available for styling: - -| Custom property | Description | Default | -| --- | --- | --- | -| `--paper-tab-ink` | Ink color | `--paper-yellow-a100` | -| `--paper-tab` | Mixin applied to the tab | `{}` | -| `--paper-tab-content` | Mixin applied to the tab content | `{}` | -| `--paper-tab-content-unselected` | Mixin applied to the tab content when the tab is not selected | `{}` | - -This element applies the mixin `--paper-font-common-base` but does not import `paper-styles/typography.html`. -In order to apply the `Roboto` font to this element, make sure you've imported `paper-styles/typography.html`. - - diff --git a/lib/paper-tabs/bower.json b/lib/paper-tabs/bower.json index f61942d3..15f765e0 100644 --- a/lib/paper-tabs/bower.json +++ b/lib/paper-tabs/bower.json @@ -1,6 +1,6 @@ { "name": "paper-tabs", - "version": "1.6.2", + "version": "1.7.0", "license": "http://polymer.github.io/LICENSE.txt", "description": "Material design tabs", "private": true, diff --git a/lib/paper-tabs/paper-tabs.html b/lib/paper-tabs/paper-tabs.html index 8b84cf6c..71ea7236 100644 --- a/lib/paper-tabs/paper-tabs.html +++ b/lib/paper-tabs/paper-tabs.html @@ -88,6 +88,8 @@ `--paper-tabs-selection-bar-color` | Color for the selection bar | `--paper-yellow-a100` `--paper-tabs-selection-bar` | Mixin applied to the selection bar | `{}` `--paper-tabs` | Mixin applied to the tabs | `{}` +`--paper-tabs-content` | Mixin applied to the content container of tabs | `{}` +`--paper-tabs-container` | Mixin applied to the layout container of tabs | `{}` @hero hero.svg @demo demo/index.html @@ -126,6 +128,7 @@ white-space: nowrap; overflow: hidden; @apply(--layout-flex-auto); + @apply(--paper-tabs-container); } #tabsContent { @@ -133,6 +136,7 @@ -moz-flex-basis: auto; -ms-flex-basis: auto; flex-basis: auto; + @apply(--paper-tabs-content); } #tabsContent.scrollable { diff --git a/lib/polymer/.bower.json b/lib/polymer/.bower.json index fb5c5ace..9a8ffcf1 100644 --- a/lib/polymer/.bower.json +++ b/lib/polymer/.bower.json @@ -40,6 +40,6 @@ "commit": "43f094996410368cc29b429d0bea689933486934" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.6.0", + "_target": "^1.5.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/lib/polymerfire/.bower.json b/lib/polymerfire/.bower.json index dab2efcc..e65eafe2 100644 --- a/lib/polymerfire/.bower.json +++ b/lib/polymerfire/.bower.json @@ -1,6 +1,6 @@ { "name": "polymerfire", - "version": "0.9.7", + "version": "0.10.2", "authors": [ "Firebase" ], @@ -19,7 +19,7 @@ ], "dependencies": { "polymer": "Polymer/polymer#^1.2", - "firebase": "^3.0", + "firebase": ">= 3.5.1 < 4.0", "app-storage": "polymerelements/app-storage#^0.9.0" }, "devDependencies": { @@ -27,13 +27,13 @@ "web-component-tester": "^4.0.0", "note-app-elements": "polymerlabs/note-app-elements" }, - "_release": "0.9.7", + "_release": "0.10.2", "_resolution": { "type": "version", - "tag": "v0.9.7", - "commit": "ffe600839bcca47558cef3ac3f1b0bdc8dda33a8" + "tag": "v0.10.2", + "commit": "18ef3d839974e4e5f2dbcd2a1eecf4428537ad65" }, "_source": "git://github.com/firebase/polymerfire.git", - "_target": "~0.9.0", + "_target": "0.10.2", "_originalSource": "firebase/polymerfire" } \ No newline at end of file diff --git a/lib/polymerfire/bower.json b/lib/polymerfire/bower.json index 774c281d..05f16a44 100644 --- a/lib/polymerfire/bower.json +++ b/lib/polymerfire/bower.json @@ -1,6 +1,6 @@ { "name": "polymerfire", - "version": "0.9.7", + "version": "0.10.2", "authors": [ "Firebase" ], @@ -19,7 +19,7 @@ ], "dependencies": { "polymer": "Polymer/polymer#^1.2", - "firebase": "^3.0", + "firebase": ">= 3.5.1 < 4.0", "app-storage": "polymerelements/app-storage#^0.9.0" }, "devDependencies": { diff --git a/lib/polymerfire/demo/firebase-messaging-sw.js b/lib/polymerfire/demo/firebase-messaging-sw.js new file mode 100644 index 00000000..5b376a68 --- /dev/null +++ b/lib/polymerfire/demo/firebase-messaging-sw.js @@ -0,0 +1,13 @@ +// temporary measure, will not be necessary with release version. +var window = self; + +importScripts( + '../../firebase/firebase-app.js', + '../../firebase/firebase-messaging.js' +); + +firebase.initializeApp({ + messagingSenderId: '153517668099' +}); + +var messaging = firebase.messaging(); diff --git a/lib/polymerfire/demo/firebase-messaging.html b/lib/polymerfire/demo/firebase-messaging.html new file mode 100644 index 00000000..4788bc00 --- /dev/null +++ b/lib/polymerfire/demo/firebase-messaging.html @@ -0,0 +1,110 @@ + + + + + + firebase-messaging demo + + + + + + + +

firebase-messaging demo

+

This demo will allow you to request notification permissions and obtain an instance token. + To actually test receipt of push messages, you will need to clone the demo and modify the + messagingSenderId in this file and in firebase-messaging-sw.js + in this directory.

+ + + + diff --git a/lib/polymerfire/demo/manifest.json b/lib/polymerfire/demo/manifest.json new file mode 100644 index 00000000..4f8fb74e --- /dev/null +++ b/lib/polymerfire/demo/manifest.json @@ -0,0 +1,4 @@ +{ + "//": "Note: this is NOT the Sender ID for your project. Use as is.", + "gcm_sender_id": "103953800507" +} diff --git a/lib/polymerfire/firebase-app-script.html b/lib/polymerfire/firebase-app-script.html new file mode 100644 index 00000000..21f4f5c2 --- /dev/null +++ b/lib/polymerfire/firebase-app-script.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/polymerfire/firebase-app.html b/lib/polymerfire/firebase-app.html index 23648439..5eef5ad3 100644 --- a/lib/polymerfire/firebase-app.html +++ b/lib/polymerfire/firebase-app.html @@ -7,7 +7,7 @@ --> - + \ No newline at end of file diff --git a/lib/polymerfire/firebase-auth.html b/lib/polymerfire/firebase-auth.html index 9d2fabcf..ba95664e 100644 --- a/lib/polymerfire/firebase-auth.html +++ b/lib/polymerfire/firebase-auth.html @@ -7,8 +7,8 @@ --> - + \ No newline at end of file diff --git a/lib/polymerfire/firebase-document.html b/lib/polymerfire/firebase-document.html index e8eb6ba7..f498df69 100644 --- a/lib/polymerfire/firebase-document.html +++ b/lib/polymerfire/firebase-document.html @@ -8,7 +8,6 @@ - \ No newline at end of file diff --git a/lib/polymerfire/firebase-messaging.html b/lib/polymerfire/firebase-messaging.html new file mode 100644 index 00000000..00d3a649 --- /dev/null +++ b/lib/polymerfire/firebase-messaging.html @@ -0,0 +1,248 @@ + + + + + + + + + + diff --git a/lib/polymerfire/firebase-query.html b/lib/polymerfire/firebase-query.html index 7224a966..e982a5e8 100644 --- a/lib/polymerfire/firebase-query.html +++ b/lib/polymerfire/firebase-query.html @@ -8,7 +8,6 @@ - - + + + + + diff --git a/lib/polymerfire/polymerfire.html b/lib/polymerfire/polymerfire.html index ba6004fa..e8e20171 100644 --- a/lib/polymerfire/polymerfire.html +++ b/lib/polymerfire/polymerfire.html @@ -5,7 +5,9 @@ license that can be found in the LICENSE file or at https://github.com/firebase/polymerfire/blob/master/LICENSE --> - + + + diff --git a/lib/pouchdb/.bower.json b/lib/pouchdb/.bower.json index 3e1b78f7..99b259d3 100644 --- a/lib/pouchdb/.bower.json +++ b/lib/pouchdb/.bower.json @@ -1,6 +1,6 @@ { "name": "pouchdb", - "version": "6.0.6", + "version": "6.0.7", "description": "PouchDB is a pocket-sized database.", "repo": "daleharvey/pouchdb", "keywords": [ @@ -26,11 +26,11 @@ "phantomjsdriver.log" ], "homepage": "https://github.com/pouchdb/pouchdb", - "_release": "6.0.6", + "_release": "6.0.7", "_resolution": { "type": "version", - "tag": "6.0.6", - "commit": "53917b983aaaa2f6877801a807b27eecccd82438" + "tag": "6.0.7", + "commit": "3dd3a2c3ed4f9a1303f3d5cedd6148fc74b14be1" }, "_source": "https://github.com/pouchdb/pouchdb.git", "_target": "^6.0.4", diff --git a/lib/pouchdb/bower.json b/lib/pouchdb/bower.json index 1fb098c7..2bc7ecad 100644 --- a/lib/pouchdb/bower.json +++ b/lib/pouchdb/bower.json @@ -1,6 +1,6 @@ { "name": "pouchdb", - "version": "6.0.6", + "version": "6.0.7", "description": "PouchDB is a pocket-sized database.", "repo": "daleharvey/pouchdb", "keywords": [ diff --git a/lib/pouchdb/component.json b/lib/pouchdb/component.json index bb1842f2..65f3840b 100644 --- a/lib/pouchdb/component.json +++ b/lib/pouchdb/component.json @@ -1,6 +1,6 @@ { "name": "pouchdb", - "version": "6.0.6", + "version": "6.0.7", "description": "PouchDB is a pocket-sized database.", "repo": "daleharvey/pouchdb", "keywords": [ diff --git a/lib/pouchdb/dist/pouchdb-next.js b/lib/pouchdb/dist/pouchdb-next.js index 1e7cc5cd..a4daee60 100644 --- a/lib/pouchdb/dist/pouchdb-next.js +++ b/lib/pouchdb/dist/pouchdb-next.js @@ -202,7 +202,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = _dereq_(10); +exports.humanize = _dereq_(9); /** * The currently active debug mode names, and names to skip. @@ -387,7 +387,7 @@ function coerce(val) { return val; } -},{"10":10}],4:[function(_dereq_,module,exports){ +},{"9":9}],4:[function(_dereq_,module,exports){ (function (root, factory) { /* istanbul ignore next */ if (typeof define === 'function' && define.amd) { @@ -1008,41 +1008,6 @@ if (typeof Object.create === 'function') { } },{}],8:[function(_dereq_,module,exports){ -(function(factory) { - if(typeof exports === 'object') { - factory(exports); - } else { - factory(this); - } -}).call(this, function(root) { - - var slice = Array.prototype.slice, - each = Array.prototype.forEach; - - var extend = function(obj) { - if(typeof obj !== 'object') throw obj + ' is not an object' ; - - var sources = slice.call(arguments, 1); - - each.call(sources, function(source) { - if(source) { - for(var prop in source) { - if(typeof source[prop] === 'object' && obj[prop]) { - extend.call(obj, obj[prop], source[prop]); - } else { - obj[prop] = source[prop]; - } - } - } - }); - - return obj; - } - - root.extend = extend; -}); - -},{}],9:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(6); @@ -1297,7 +1262,7 @@ function race(iterable) { } } -},{"6":6}],10:[function(_dereq_,module,exports){ +},{"6":6}],9:[function(_dereq_,module,exports){ /** * Helpers. */ @@ -1424,7 +1389,7 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],11:[function(_dereq_,module,exports){ +},{}],10:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -1606,7 +1571,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],12:[function(_dereq_,module,exports){ +},{}],11:[function(_dereq_,module,exports){ // Generated by CoffeeScript 1.9.2 (function() { var hasProp = {}.hasOwnProperty, @@ -1630,7 +1595,7 @@ process.umask = function() { return 0; }; }).call(this); -},{}],13:[function(_dereq_,module,exports){ +},{}],12:[function(_dereq_,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -2335,19 +2300,18 @@ process.umask = function() { return 0; }; return SparkMD5; })); -},{}],14:[function(_dereq_,module,exports){ +},{}],13:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var jsExtend = _dereq_(8); -var Promise = _interopDefault(_dereq_(27)); -var ajaxCore = _interopDefault(_dereq_(17)); +var pouchdbUtils = _dereq_(28); +var Promise = _interopDefault(_dereq_(26)); +var ajaxCore = _interopDefault(_dereq_(16)); var getArguments = _interopDefault(_dereq_(1)); -var pouchdbUtils = _dereq_(29); -var pouchdbBinaryUtils = _dereq_(18); +var pouchdbBinaryUtils = _dereq_(17); var PromisePool = _interopDefault(_dereq_(4)); -var pouchdbErrors = _dereq_(23); +var pouchdbErrors = _dereq_(22); var debug = _interopDefault(_dereq_(2)); var CHANGES_BATCH_SIZE = 25; @@ -2492,7 +2456,7 @@ function HttpPouch(opts, callback) { function ajax(userOpts, options, callback) { var reqAjax = userOpts.ajax || {}; - var reqOpts = jsExtend.extend(pouchdbUtils.clone(ajaxOpts), reqAjax, options); + var reqOpts = pouchdbUtils.jsExtend(pouchdbUtils.clone(ajaxOpts), reqAjax, options); log(reqOpts.method + ' ' + reqOpts.url); return api._ajax(reqOpts, callback); } @@ -3322,15 +3286,15 @@ function index (PouchDB) { } module.exports = index; -},{"1":1,"17":17,"18":18,"2":2,"23":23,"27":27,"29":29,"4":4,"8":8}],15:[function(_dereq_,module,exports){ +},{"1":1,"16":16,"17":17,"2":2,"22":22,"26":26,"28":28,"4":4}],14:[function(_dereq_,module,exports){ 'use strict'; -var pouchdbUtils = _dereq_(29); -var pouchdbErrors = _dereq_(23); -var pouchdbBinaryUtils = _dereq_(18); -var pouchdbAdapterUtils = _dereq_(16); -var pouchdbMd5 = _dereq_(25); -var pouchdbMerge = _dereq_(26); +var pouchdbUtils = _dereq_(28); +var pouchdbErrors = _dereq_(22); +var pouchdbBinaryUtils = _dereq_(17); +var pouchdbAdapterUtils = _dereq_(15); +var pouchdbMd5 = _dereq_(24); +var pouchdbMerge = _dereq_(25); var DOC_STORE = 'docs'; var META_STORE = 'meta'; @@ -4300,17 +4264,17 @@ function index (PouchDB) { } module.exports = index; -},{"16":16,"18":18,"23":23,"25":25,"26":26,"29":29}],16:[function(_dereq_,module,exports){ +},{"15":15,"17":17,"22":22,"24":24,"25":25,"28":28}],15:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -var pouchdbUtils = _dereq_(29); -var pouchdbErrors = _dereq_(23); -var pouchdbMerge = _dereq_(26); -var pouchdbBinaryUtils = _dereq_(18); -var pouchdbMd5 = _dereq_(25); -var pouchdbCollections = _dereq_(21); +var pouchdbUtils = _dereq_(28); +var pouchdbErrors = _dereq_(22); +var pouchdbMerge = _dereq_(25); +var pouchdbBinaryUtils = _dereq_(17); +var pouchdbMd5 = _dereq_(24); +var pouchdbCollections = _dereq_(20); function toObject(array) { return array.reduce(function (obj, item) { @@ -4737,16 +4701,15 @@ exports.parseDoc = parseDoc; exports.preprocessAttachments = preprocessAttachments; exports.processDocs = processDocs; exports.updateDoc = updateDoc; -},{"18":18,"21":21,"23":23,"25":25,"26":26,"29":29}],17:[function(_dereq_,module,exports){ +},{"17":17,"20":20,"22":22,"24":24,"25":25,"28":28}],16:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var pouchdbBinaryUtils = _dereq_(18); -var Promise = _interopDefault(_dereq_(27)); -var jsExtend = _dereq_(8); -var pouchdbErrors = _dereq_(23); -var pouchdbUtils = _dereq_(29); +var pouchdbBinaryUtils = _dereq_(17); +var Promise = _interopDefault(_dereq_(26)); +var pouchdbUtils = _dereq_(28); +var pouchdbErrors = _dereq_(22); /* global fetch */ /* global Headers */ @@ -5021,7 +4984,7 @@ function ajaxCore(options, callback) { cache: false }; - options = jsExtend.extend(defaultOptions, options); + options = pouchdbUtils.jsExtend(defaultOptions, options); function onSuccess(obj, resp, cb) { if (!options.binary && options.json && typeof obj === 'string') { @@ -5126,7 +5089,7 @@ function ajax(opts, callback) { } module.exports = ajax; -},{"18":18,"23":23,"27":27,"29":29,"8":8}],18:[function(_dereq_,module,exports){ +},{"17":17,"22":22,"26":26,"28":28}],17:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -5265,14 +5228,14 @@ exports.blobOrBufferToBinaryString = blobToBinaryString; exports.readAsArrayBuffer = readAsArrayBuffer; exports.readAsBinaryString = readAsBinaryString; exports.typedBuffer = typedBuffer; -},{}],19:[function(_dereq_,module,exports){ +},{}],18:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Promise = _interopDefault(_dereq_(27)); -var pouchdbUtils = _dereq_(29); -var pouchdbCollate = _dereq_(20); +var Promise = _interopDefault(_dereq_(26)); +var pouchdbUtils = _dereq_(28); +var pouchdbCollate = _dereq_(19); var CHECKPOINT_VERSION = 1; var REPLICATOR = "pouchdb"; @@ -5517,7 +5480,7 @@ function isForbiddenError(err) { } module.exports = Checkpointer; -},{"20":20,"27":27,"29":29}],20:[function(_dereq_,module,exports){ +},{"19":19,"26":26,"28":28}],19:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -5902,7 +5865,7 @@ exports.collate = collate; exports.normalizeKey = normalizeKey; exports.toIndexableString = toIndexableString; exports.parseIndexableString = parseIndexableString; -},{}],21:[function(_dereq_,module,exports){ +},{}],20:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -5965,23 +5928,22 @@ LazySet.prototype.has = function (key) { exports.Set = LazySet; exports.Map = LazyMap; -},{}],22:[function(_dereq_,module,exports){ +},{}],21:[function(_dereq_,module,exports){ (function (process){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var jsExtend = _dereq_(8); +var pouchdbUtils = _dereq_(28); var debug = _interopDefault(_dereq_(2)); var inherits = _interopDefault(_dereq_(7)); -var Promise = _interopDefault(_dereq_(27)); -var pouchdbCollections = _dereq_(21); +var Promise = _interopDefault(_dereq_(26)); +var pouchdbCollections = _dereq_(20); var events = _dereq_(5); var getArguments = _interopDefault(_dereq_(1)); -var pouchdbUtils = _dereq_(29); -var pouchdbMerge = _dereq_(26); -var scopedEval = _interopDefault(_dereq_(12)); -var pouchdbErrors = _dereq_(23); +var pouchdbMerge = _dereq_(25); +var scopedEval = _interopDefault(_dereq_(11)); +var pouchdbErrors = _dereq_(22); function evalFilter(input) { return scopedEval('"use strict";\nreturn ' + input + ';', {}); @@ -6337,7 +6299,7 @@ function allDocsKeysQuery(api, opts, callback) { offset: opts.skip }; return Promise.all(keys.map(function (key) { - var subOpts = jsExtend.extend({key: key, deleted: 'ok'}, opts); + var subOpts = pouchdbUtils.jsExtend({key: key, deleted: 'ok'}, opts); ['limit', 'skip', 'keys'].forEach(function (optKey) { delete subOpts[optKey]; }); @@ -7336,7 +7298,7 @@ PouchDB.defaults = function (defaultOpts) { delete opts.name; } - opts = jsExtend.extend({}, defaultOpts, opts); + opts = pouchdbUtils.jsExtend({}, defaultOpts, opts); PouchDB.call(this, name, opts); } @@ -7353,13 +7315,13 @@ PouchDB.defaults = function (defaultOpts) { }; // managed automatically by set-version.js -var version = "6.0.6"; +var version = "6.0.7"; PouchDB.version = version; module.exports = PouchDB; -}).call(this,_dereq_(11)) -},{"1":1,"11":11,"12":12,"2":2,"21":21,"23":23,"26":26,"27":27,"29":29,"5":5,"7":7,"8":8}],23:[function(_dereq_,module,exports){ +}).call(this,_dereq_(10)) +},{"1":1,"10":10,"11":11,"2":2,"20":20,"22":22,"25":25,"26":26,"28":28,"5":5,"7":7}],22:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -7603,14 +7565,14 @@ exports.IDB_ERROR = IDB_ERROR; exports.INVALID_URL = INVALID_URL; exports.createError = createError; exports.generateErrorFromResponse = generateErrorFromResponse; -},{"7":7}],24:[function(_dereq_,module,exports){ +},{"7":7}],23:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Promise = _interopDefault(_dereq_(27)); -var pouchdbMd5 = _dereq_(25); -var pouchdbCollate = _dereq_(20); +var Promise = _interopDefault(_dereq_(26)); +var pouchdbMd5 = _dereq_(24); +var pouchdbCollate = _dereq_(19); function sortObjectPropertiesByKey(queryParams) { return Object.keys(queryParams).sort(pouchdbCollate.collate).reduce(function (result, key) { @@ -7651,7 +7613,7 @@ function generateReplicationId(src, target, opts) { } module.exports = generateReplicationId; -},{"20":20,"25":25,"27":27}],25:[function(_dereq_,module,exports){ +},{"19":19,"24":24,"26":26}],24:[function(_dereq_,module,exports){ (function (global){ 'use strict'; @@ -7659,8 +7621,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var pouchdbBinaryUtils = _dereq_(18); -var Md5 = _interopDefault(_dereq_(13)); +var pouchdbBinaryUtils = _dereq_(17); +var Md5 = _interopDefault(_dereq_(12)); var setImmediateShim = global.setImmediate || global.setTimeout; var MD5_CHUNK_SIZE = 32768; @@ -7737,7 +7699,7 @@ function stringMd5(string) { exports.binaryMd5 = binaryMd5; exports.stringMd5 = stringMd5; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"13":13,"18":18}],26:[function(_dereq_,module,exports){ +},{"12":12,"17":17}],25:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -8161,30 +8123,29 @@ exports.revExists = revExists; exports.rootToLeaf = rootToLeaf; exports.traverseRevTree = traverseRevTree; exports.winningRev = winningRev; -},{}],27:[function(_dereq_,module,exports){ +},{}],26:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var lie = _interopDefault(_dereq_(9)); +var lie = _interopDefault(_dereq_(8)); /* istanbul ignore next */ var PouchPromise = typeof Promise === 'function' ? Promise : lie; module.exports = PouchPromise; -},{"9":9}],28:[function(_dereq_,module,exports){ +},{"8":8}],27:[function(_dereq_,module,exports){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var pouchdbUtils = _dereq_(29); -var Promise = _interopDefault(_dereq_(27)); -var Checkpointer = _interopDefault(_dereq_(19)); -var generateReplicationId = _interopDefault(_dereq_(24)); +var pouchdbUtils = _dereq_(28); +var Promise = _interopDefault(_dereq_(26)); +var Checkpointer = _interopDefault(_dereq_(18)); +var generateReplicationId = _interopDefault(_dereq_(23)); var events = _dereq_(5); var inherits = _interopDefault(_dereq_(7)); -var pouchdbErrors = _dereq_(23); -var jsExtend = _dereq_(8); +var pouchdbErrors = _dereq_(22); function isGenOne(rev) { return /^1-/.test(rev); @@ -8310,19 +8271,24 @@ function getDocs(src, target, diffs, state) { return doc._attachments && Object.keys(doc._attachments).length > 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -8942,8 +8908,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? jsExtend.extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? jsExtend.extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? pouchdbUtils.jsExtend({}, opts, opts.push) : opts; + var optsPull = opts.pull ? pouchdbUtils.jsExtend({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); @@ -9148,7 +9114,7 @@ function replication(PouchDB) { } module.exports = replication; -},{"19":19,"23":23,"24":24,"27":27,"29":29,"5":5,"7":7,"8":8}],29:[function(_dereq_,module,exports){ +},{"18":18,"22":22,"23":23,"26":26,"28":28,"5":5,"7":7}],28:[function(_dereq_,module,exports){ (function (process){ 'use strict'; @@ -9156,12 +9122,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Promise = _interopDefault(_dereq_(27)); +var Promise = _interopDefault(_dereq_(26)); var getArguments = _interopDefault(_dereq_(1)); var debug = _interopDefault(_dereq_(2)); var events = _dereq_(5); var inherits = _interopDefault(_dereq_(7)); -var pouchdbErrors = _dereq_(23); +var pouchdbErrors = _dereq_(22); function isBinaryObject(object) { return (typeof ArrayBuffer !== 'undefined' && object instanceof ArrayBuffer) || @@ -9696,6 +9662,35 @@ function extend(obj, obj2, obj3) { return obj; } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + function tryFilter(filter, doc, req) { try { return !filter(doc, req); @@ -9987,6 +9982,7 @@ exports.clone = clone; exports.defaultBackOff = defaultBackOff; exports.explainError = explainError; exports.extend = extend; +exports.jsExtend = extend$1; exports.filterChange = filterChange; exports.flatten = flatten; exports.functionName = functionName; @@ -10004,11 +10000,11 @@ exports.pick = pick; exports.toPromise = toPromise; exports.upsert = upsert; exports.uuid = uuid; -}).call(this,_dereq_(11)) -},{"1":1,"11":11,"2":2,"23":23,"27":27,"5":5,"7":7}],30:[function(_dereq_,module,exports){ -module.exports = _dereq_(22) - .plugin(_dereq_(15)) +}).call(this,_dereq_(10)) +},{"1":1,"10":10,"2":2,"22":22,"26":26,"5":5,"7":7}],29:[function(_dereq_,module,exports){ +module.exports = _dereq_(21) .plugin(_dereq_(14)) - .plugin(_dereq_(28)); -},{"14":14,"15":15,"22":22,"28":28}]},{},[30])(30) + .plugin(_dereq_(13)) + .plugin(_dereq_(27)); +},{"13":13,"14":14,"21":21,"27":27}]},{},[29])(29) }); \ No newline at end of file diff --git a/lib/pouchdb/dist/pouchdb.fruitdown.js b/lib/pouchdb/dist/pouchdb.fruitdown.js index 53e77c50..f2599eba 100644 --- a/lib/pouchdb/dist/pouchdb.fruitdown.js +++ b/lib/pouchdb/dist/pouchdb.fruitdown.js @@ -1,4 +1,4 @@ -// PouchDB fruitdown plugin 6.0.6 +// PouchDB fruitdown plugin 6.0.7 // Based on FruitDOWN: https://github.com/nolanlawson/fruitdown // // (c) 2012-2016 Dale Harvey and the PouchDB team @@ -88,8 +88,8 @@ AbstractChainedBatch.prototype.write = function (options, callback) { } module.exports = AbstractChainedBatch -}).call(this,_dereq_(53)) -},{"53":53}],2:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],2:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -141,12 +141,12 @@ AbstractIterator.prototype.end = function (callback) { module.exports = AbstractIterator -}).call(this,_dereq_(53)) -},{"53":53}],3:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],3:[function(_dereq_,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ -var xtend = _dereq_(89) +var xtend = _dereq_(88) , AbstractIterator = _dereq_(2) , AbstractChainedBatch = _dereq_(1) @@ -403,8 +403,8 @@ module.exports.AbstractLevelDOWN = AbstractLevelDOWN module.exports.AbstractIterator = AbstractIterator module.exports.AbstractChainedBatch = AbstractChainedBatch -}).call(this,{"isBuffer":_dereq_(34)},_dereq_(53)) -},{"1":1,"2":2,"34":34,"53":53,"89":89}],4:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(34)},_dereq_(52)) +},{"1":1,"2":2,"34":34,"52":52,"88":88}],4:[function(_dereq_,module,exports){ 'use strict'; module.exports = argsArray; @@ -2819,7 +2819,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = _dereq_(51); +exports.humanize = _dereq_(50); /** * The currently active debug mode names, and names to skip. @@ -3004,8 +3004,8 @@ function coerce(val) { return val; } -},{"51":51}],13:[function(_dereq_,module,exports){ -var util = _dereq_(87) +},{"50":50}],13:[function(_dereq_,module,exports){ +var util = _dereq_(86) , AbstractIterator = _dereq_(18).AbstractIterator @@ -3040,9 +3040,9 @@ DeferredIterator.prototype._operation = function (method, args) { module.exports = DeferredIterator; -},{"18":18,"87":87}],14:[function(_dereq_,module,exports){ +},{"18":18,"86":86}],14:[function(_dereq_,module,exports){ (function (Buffer,process){ -var util = _dereq_(87) +var util = _dereq_(86) , AbstractLevelDOWN = _dereq_(18).AbstractLevelDOWN , DeferredIterator = _dereq_(13) @@ -3099,8 +3099,8 @@ DeferredLevelDOWN.prototype._iterator = function (options) { module.exports = DeferredLevelDOWN module.exports.DeferredIterator = DeferredIterator -}).call(this,{"isBuffer":_dereq_(34)},_dereq_(53)) -},{"13":13,"18":18,"34":34,"53":53,"87":87}],15:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(34)},_dereq_(52)) +},{"13":13,"18":18,"34":34,"52":52,"86":86}],15:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -3182,10 +3182,10 @@ AbstractChainedBatch.prototype.write = function (options, callback) { } module.exports = AbstractChainedBatch -}).call(this,_dereq_(53)) -},{"53":53}],16:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],16:[function(_dereq_,module,exports){ arguments[4][2][0].apply(exports,arguments) -},{"2":2,"53":53}],17:[function(_dereq_,module,exports){ +},{"2":2,"52":52}],17:[function(_dereq_,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -3460,8 +3460,8 @@ AbstractLevelDOWN.prototype._checkKey = function (obj, type) { module.exports = AbstractLevelDOWN -}).call(this,{"isBuffer":_dereq_(34)},_dereq_(53)) -},{"15":15,"16":16,"20":20,"34":34,"53":53}],18:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(34)},_dereq_(52)) +},{"15":15,"16":16,"20":20,"34":34,"52":52}],18:[function(_dereq_,module,exports){ exports.AbstractLevelDOWN = _dereq_(17) exports.AbstractIterator = _dereq_(16) exports.AbstractChainedBatch = _dereq_(15) @@ -4729,8 +4729,8 @@ StorageCore.destroy = function (dbName, callback) { module.exports = StorageCore; -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"53":53}],27:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"52":52}],27:[function(_dereq_,module,exports){ (function (Buffer){ 'use strict'; @@ -5161,13 +5161,13 @@ function checkKeyValue(obj, type) { module.exports = FruitDown; -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) -},{"26":26,"27":27,"3":3,"30":30,"33":33,"53":53,"8":8}],29:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) +},{"26":26,"27":27,"3":3,"30":30,"33":33,"52":52,"8":8}],29:[function(_dereq_,module,exports){ (function (process,global){ 'use strict'; var argsarray = _dereq_(4); -var Queue = _dereq_(83); +var Queue = _dereq_(82); // see http://stackoverflow.com/a/15349865/680742 var nextTick = global.setImmediate || process.nextTick; @@ -5201,8 +5201,8 @@ TaskQueue.prototype.processNext = function () { module.exports = TaskQueue; -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"4":4,"53":53,"83":83}],30:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"4":4,"52":52,"82":82}],30:[function(_dereq_,module,exports){ 'use strict'; // taken from rvagg/memdown commit 2078b40 exports.sortedIndexOf = function(arr, item) { @@ -5435,42 +5435,7 @@ module.exports = Array.isArray || function (arr) { }; },{}],36:[function(_dereq_,module,exports){ -(function(factory) { - if(typeof exports === 'object') { - factory(exports); - } else { - factory(this); - } -}).call(this, function(root) { - - var slice = Array.prototype.slice, - each = Array.prototype.forEach; - - var extend = function(obj) { - if(typeof obj !== 'object') throw obj + ' is not an object' ; - - var sources = slice.call(arguments, 1); - - each.call(sources, function(source) { - if(source) { - for(var prop in source) { - if(typeof source[prop] === 'object' && obj[prop]) { - extend.call(obj, obj[prop], source[prop]); - } else { - obj[prop] = source[prop]; - } - } - } - }); - - return obj; - } - - root.extend = extend; -}); - -},{}],37:[function(_dereq_,module,exports){ -var encodings = _dereq_(38); +var encodings = _dereq_(37); module.exports = Codec; @@ -5577,7 +5542,7 @@ Codec.prototype.valueAsBuffer = function(opts){ }; -},{"38":38}],38:[function(_dereq_,module,exports){ +},{"37":37}],37:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -5659,7 +5624,7 @@ function isBinary(data){ }).call(this,_dereq_(8).Buffer) -},{"8":8}],39:[function(_dereq_,module,exports){ +},{"8":8}],38:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2015 LevelUP contributors * See list at * MIT License @@ -5683,11 +5648,11 @@ module.exports = { , EncodingError : createError('EncodingError', LevelUPError) } -},{"23":23}],40:[function(_dereq_,module,exports){ +},{"23":23}],39:[function(_dereq_,module,exports){ var inherits = _dereq_(33); -var Readable = _dereq_(61).Readable; -var extend = _dereq_(41); -var EncodingError = _dereq_(39).EncodingError; +var Readable = _dereq_(60).Readable; +var extend = _dereq_(40); +var EncodingError = _dereq_(38).EncodingError; module.exports = ReadStream; inherits(ReadStream, Readable); @@ -5741,17 +5706,17 @@ ReadStream.prototype._cleanup = function(){ }; -},{"33":33,"39":39,"41":41,"61":61}],41:[function(_dereq_,module,exports){ +},{"33":33,"38":38,"40":40,"60":60}],40:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],42:[function(_dereq_,module,exports){ +},{"20":20}],41:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var util = _dereq_(44) - , WriteError = _dereq_(39).WriteError +var util = _dereq_(43) + , WriteError = _dereq_(38).WriteError , getOptions = util.getOptions , dispatchError = util.dispatchError @@ -5828,7 +5793,7 @@ Batch.prototype.write = function (callback) { module.exports = Batch -},{"39":39,"44":44}],43:[function(_dereq_,module,exports){ +},{"38":38,"43":43}],42:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at @@ -5837,14 +5802,14 @@ module.exports = Batch */ var EventEmitter = _dereq_(25).EventEmitter - , inherits = _dereq_(87).inherits - , deprecate = _dereq_(87).deprecate - , extend = _dereq_(47) - , prr = _dereq_(54) + , inherits = _dereq_(86).inherits + , deprecate = _dereq_(86).deprecate + , extend = _dereq_(46) + , prr = _dereq_(53) , DeferredLevelDOWN = _dereq_(14) - , IteratorStream = _dereq_(40) + , IteratorStream = _dereq_(39) - , errors = _dereq_(39) + , errors = _dereq_(38) , WriteError = errors.WriteError , ReadError = errors.ReadError , NotFoundError = errors.NotFoundError @@ -5852,9 +5817,9 @@ var EventEmitter = _dereq_(25).EventEmitter , EncodingError = errors.EncodingError , InitializationError = errors.InitializationError - , util = _dereq_(44) - , Batch = _dereq_(42) - , Codec = _dereq_(45) + , util = _dereq_(43) + , Batch = _dereq_(41) + , Codec = _dereq_(44) , getOptions = util.getOptions , defaultOptions = util.defaultOptions @@ -6219,7 +6184,7 @@ function utilStatic (name) { } module.exports = LevelUP -module.exports.errors = _dereq_(39) +module.exports.errors = _dereq_(38) module.exports.destroy = deprecate( utilStatic('destroy') , 'levelup.destroy() is deprecated. Use leveldown.destroy() instead' @@ -6230,17 +6195,17 @@ module.exports.repair = deprecate( ) -}).call(this,_dereq_(53)) -},{"14":14,"25":25,"39":39,"40":40,"42":42,"44":44,"45":45,"47":47,"53":53,"54":54,"87":87}],44:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"14":14,"25":25,"38":38,"39":39,"41":41,"43":43,"44":44,"46":46,"52":52,"53":53,"86":86}],43:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var extend = _dereq_(47) - , LevelUPError = _dereq_(39).LevelUPError - , format = _dereq_(87).format +var extend = _dereq_(46) + , LevelUPError = _dereq_(38).LevelUPError + , format = _dereq_(86).format , defaultOptions = { createIfMissing : true , errorIfExists : false @@ -6263,7 +6228,7 @@ function getLevelDOWN () { if (leveldown) return leveldown - var requiredVersion = _dereq_(48).devDependencies.leveldown + var requiredVersion = _dereq_(47).devDependencies.leveldown , leveldownVersion try { @@ -6310,9 +6275,9 @@ module.exports = { , isDefined : isDefined } -},{"39":39,"47":47,"48":48,"6":6,"87":87}],45:[function(_dereq_,module,exports){ -arguments[4][37][0].apply(exports,arguments) -},{"37":37,"46":46}],46:[function(_dereq_,module,exports){ +},{"38":38,"46":46,"47":47,"6":6,"86":86}],44:[function(_dereq_,module,exports){ +arguments[4][36][0].apply(exports,arguments) +},{"36":36,"45":45}],45:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -6392,58 +6357,56 @@ function isBinary(data){ }).call(this,_dereq_(8).Buffer) -},{"8":8}],47:[function(_dereq_,module,exports){ +},{"8":8}],46:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],48:[function(_dereq_,module,exports){ +},{"20":20}],47:[function(_dereq_,module,exports){ module.exports={ "_args": [ [ { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "/Users/nolan/workspace/pouchdb" ] ], - "_from": "levelup@1.3.2", - "_id": "levelup@1.3.2", + "_from": "levelup@1.3.3", + "_id": "levelup@1.3.3", "_inCache": true, "_installable": true, "_location": "/levelup", - "_nodeVersion": "6.1.0", + "_nodeVersion": "4.4.7", "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446" }, "_npmUser": { - "name": "ralphtheninja", - "email": "ralphtheninja@riseup.net" + "name": "juliangruber", + "email": "julian@juliangruber.com" }, - "_npmVersion": "3.8.6", + "_npmVersion": "2.15.8", "_phantomChildren": {}, "_requested": { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "_requiredBy": [ - "/", - "/pouchdb", - "/pouchdb-adapter-leveldb-core" + "/" ], - "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz", - "_shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", + "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz", + "_shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", "_shrinkwrap": null, - "_spec": "levelup@1.3.2", + "_spec": "levelup@1.3.3", "_where": "/Users/nolan/workspace/pouchdb", "browser": { "leveldown": false, @@ -6551,10 +6514,10 @@ module.exports={ }, "directories": {}, "dist": { - "shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", - "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz" + "shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", + "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz" }, - "gitHead": "bcc242cfc4ec035f9228a5cd54903cb126659a00", + "gitHead": "cced27dc9f0095823be5ed388ec601ec2bfe7366", "homepage": "https://github.com/level/levelup", "keywords": [ "leveldb", @@ -6591,10 +6554,10 @@ module.exports={ "scripts": { "test": "tape test/*-test.js | faucet" }, - "version": "1.3.2" + "version": "1.3.3" } -},{}],49:[function(_dereq_,module,exports){ +},{}],48:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(32); @@ -6849,7 +6812,7 @@ function race(iterable) { } } -},{"32":32}],50:[function(_dereq_,module,exports){ +},{"32":32}],49:[function(_dereq_,module,exports){ (function (Buffer){ exports.compare = function (a, b) { @@ -6999,7 +6962,7 @@ exports.filter = function (range, compare) { } }).call(this,{"isBuffer":_dereq_(34)}) -},{"34":34}],51:[function(_dereq_,module,exports){ +},{"34":34}],50:[function(_dereq_,module,exports){ /** * Helpers. */ @@ -7126,7 +7089,7 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],52:[function(_dereq_,module,exports){ +},{}],51:[function(_dereq_,module,exports){ (function (process){ 'use strict'; @@ -7172,8 +7135,8 @@ function nextTick(fn, arg1, arg2, arg3) { } } -}).call(this,_dereq_(53)) -},{"53":53}],53:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],52:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -7355,9 +7318,9 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],54:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ arguments[4][24][0].apply(exports,arguments) -},{"24":24}],55:[function(_dereq_,module,exports){ +},{"24":24}],54:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7401,8 +7364,8 @@ var util = _dereq_(9); util.inherits = _dereq_(33); /**/ -var Readable = _dereq_(57); -var Writable = _dereq_(59); +var Readable = _dereq_(56); +var Writable = _dereq_(58); util.inherits(Duplex, Readable); @@ -7449,8 +7412,8 @@ function forEach (xs, f) { } } -}).call(this,_dereq_(53)) -},{"33":33,"53":53,"57":57,"59":59,"9":9}],56:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"33":33,"52":52,"56":56,"58":58,"9":9}],55:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -7478,7 +7441,7 @@ function forEach (xs, f) { module.exports = PassThrough; -var Transform = _dereq_(58); +var Transform = _dereq_(57); /**/ var util = _dereq_(9); @@ -7498,7 +7461,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"33":33,"58":58,"9":9}],57:[function(_dereq_,module,exports){ +},{"33":33,"57":57,"9":9}],56:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7524,7 +7487,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { module.exports = Readable; /**/ -var isArray = _dereq_(60); +var isArray = _dereq_(59); /**/ @@ -7542,7 +7505,7 @@ if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { }; /**/ -var Stream = _dereq_(63); +var Stream = _dereq_(62); /**/ var util = _dereq_(9); @@ -7615,7 +7578,7 @@ function ReadableState(options, stream) { this.encoding = null; if (options.encoding) { if (!StringDecoder) - StringDecoder = _dereq_(75).StringDecoder; + StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -7716,7 +7679,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function(enc) { if (!StringDecoder) - StringDecoder = _dereq_(75).StringDecoder; + StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; }; @@ -8483,8 +8446,8 @@ function indexOf (xs, x) { return -1; } -}).call(this,_dereq_(53)) -},{"25":25,"33":33,"53":53,"60":60,"63":63,"75":75,"8":8,"9":9}],58:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"33":33,"52":52,"59":59,"62":62,"74":74,"8":8,"9":9}],57:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8551,7 +8514,7 @@ function indexOf (xs, x) { module.exports = Transform; -var Duplex = _dereq_(55); +var Duplex = _dereq_(54); /**/ var util = _dereq_(9); @@ -8696,7 +8659,7 @@ function done(stream, er) { return stream.push(null); } -},{"33":33,"55":55,"9":9}],59:[function(_dereq_,module,exports){ +},{"33":33,"54":54,"9":9}],58:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -8737,7 +8700,7 @@ var util = _dereq_(9); util.inherits = _dereq_(33); /**/ -var Stream = _dereq_(63); +var Stream = _dereq_(62); util.inherits(Writable, Stream); @@ -8819,7 +8782,7 @@ function WritableState(options, stream) { } function Writable(options) { - var Duplex = _dereq_(55); + var Duplex = _dereq_(54); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -9085,23 +9048,23 @@ function endWritable(stream, state, cb) { state.ended = true; } -}).call(this,_dereq_(53)) -},{"33":33,"53":53,"55":55,"63":63,"8":8,"9":9}],60:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"33":33,"52":52,"54":54,"62":62,"8":8,"9":9}],59:[function(_dereq_,module,exports){ module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; -},{}],61:[function(_dereq_,module,exports){ -var Stream = _dereq_(63); // hack to fix a circular dependency issue when used with browserify -exports = module.exports = _dereq_(57); +},{}],60:[function(_dereq_,module,exports){ +var Stream = _dereq_(62); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = _dereq_(56); exports.Stream = Stream; exports.Readable = exports; -exports.Writable = _dereq_(59); -exports.Duplex = _dereq_(55); -exports.Transform = _dereq_(58); -exports.PassThrough = _dereq_(56); +exports.Writable = _dereq_(58); +exports.Duplex = _dereq_(54); +exports.Transform = _dereq_(57); +exports.PassThrough = _dereq_(55); -},{"55":55,"56":56,"57":57,"58":58,"59":59,"63":63}],62:[function(_dereq_,module,exports){ +},{"54":54,"55":55,"56":56,"57":57,"58":58,"62":62}],61:[function(_dereq_,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -9806,7 +9769,7 @@ exports.PassThrough = _dereq_(56); return SparkMD5; })); -},{}],63:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -9834,11 +9797,11 @@ var EE = _dereq_(25).EventEmitter; var inherits = _dereq_(33); inherits(Stream, EE); -Stream.Readable = _dereq_(72); -Stream.Writable = _dereq_(74); -Stream.Duplex = _dereq_(64); -Stream.Transform = _dereq_(73); -Stream.PassThrough = _dereq_(71); +Stream.Readable = _dereq_(71); +Stream.Writable = _dereq_(73); +Stream.Duplex = _dereq_(63); +Stream.Transform = _dereq_(72); +Stream.PassThrough = _dereq_(70); // Backwards-compat with node 0.4.x Stream.Stream = Stream; @@ -9935,10 +9898,10 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"25":25,"33":33,"64":64,"71":71,"72":72,"73":73,"74":74}],64:[function(_dereq_,module,exports){ -module.exports = _dereq_(65) +},{"25":25,"33":33,"63":63,"70":70,"71":71,"72":72,"73":73}],63:[function(_dereq_,module,exports){ +module.exports = _dereq_(64) -},{"65":65}],65:[function(_dereq_,module,exports){ +},{"64":64}],64:[function(_dereq_,module,exports){ // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from @@ -9959,7 +9922,7 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -9967,8 +9930,8 @@ var util = _dereq_(9); util.inherits = _dereq_(33); /**/ -var Readable = _dereq_(67); -var Writable = _dereq_(69); +var Readable = _dereq_(66); +var Writable = _dereq_(68); util.inherits(Duplex, Readable); @@ -10014,7 +9977,7 @@ function forEach(xs, f) { f(xs[i], i); } } -},{"33":33,"52":52,"67":67,"69":69,"9":9}],66:[function(_dereq_,module,exports){ +},{"33":33,"51":51,"66":66,"68":68,"9":9}],65:[function(_dereq_,module,exports){ // a passthrough stream. // basically just the most minimal sort of Transform stream. // Every written chunk gets output as-is. @@ -10023,7 +9986,7 @@ function forEach(xs, f) { module.exports = PassThrough; -var Transform = _dereq_(68); +var Transform = _dereq_(67); /**/ var util = _dereq_(9); @@ -10041,14 +10004,14 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"33":33,"68":68,"9":9}],67:[function(_dereq_,module,exports){ +},{"33":33,"67":67,"9":9}],66:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -10096,7 +10059,7 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = _dereq_(70); +var BufferList = _dereq_(69); var StringDecoder; util.inherits(Readable, Stream); @@ -10115,7 +10078,7 @@ function prependListener(emitter, event, fn) { var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); options = options || {}; @@ -10177,7 +10140,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -10185,7 +10148,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); if (!(this instanceof Readable)) return new Readable(options); @@ -10288,7 +10251,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -10980,8 +10943,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(53)) -},{"25":25,"33":33,"35":35,"52":52,"53":53,"6":6,"65":65,"7":7,"70":70,"75":75,"8":8,"9":9}],68:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"33":33,"35":35,"51":51,"52":52,"6":6,"64":64,"69":69,"7":7,"74":74,"8":8,"9":9}],67:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -11028,7 +10991,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(65); +var Duplex = _dereq_(64); /**/ var util = _dereq_(9); @@ -11162,7 +11125,7 @@ function done(stream, er) { return stream.push(null); } -},{"33":33,"65":65,"9":9}],69:[function(_dereq_,module,exports){ +},{"33":33,"64":64,"9":9}],68:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -11173,7 +11136,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -11189,7 +11152,7 @@ util.inherits = _dereq_(33); /**/ var internalUtil = { - deprecate: _dereq_(84) + deprecate: _dereq_(83) }; /**/ @@ -11222,7 +11185,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); options = options || {}; @@ -11338,7 +11301,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -11690,8 +11653,8 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(53)) -},{"25":25,"33":33,"52":52,"53":53,"65":65,"7":7,"8":8,"84":84,"9":9}],70:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"33":33,"51":51,"52":52,"64":64,"7":7,"8":8,"83":83,"9":9}],69:[function(_dereq_,module,exports){ 'use strict'; var Buffer = _dereq_(8).Buffer; @@ -11756,36 +11719,36 @@ BufferList.prototype.concat = function (n) { } return ret; }; -},{"7":7,"8":8}],71:[function(_dereq_,module,exports){ -module.exports = _dereq_(66) +},{"7":7,"8":8}],70:[function(_dereq_,module,exports){ +module.exports = _dereq_(65) -},{"66":66}],72:[function(_dereq_,module,exports){ +},{"65":65}],71:[function(_dereq_,module,exports){ (function (process){ var Stream = (function (){ try { return _dereq_('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify } catch(_){} }()); -exports = module.exports = _dereq_(67); +exports = module.exports = _dereq_(66); exports.Stream = Stream || exports; exports.Readable = exports; -exports.Writable = _dereq_(69); -exports.Duplex = _dereq_(65); -exports.Transform = _dereq_(68); -exports.PassThrough = _dereq_(66); +exports.Writable = _dereq_(68); +exports.Duplex = _dereq_(64); +exports.Transform = _dereq_(67); +exports.PassThrough = _dereq_(65); if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { module.exports = Stream; } -}).call(this,_dereq_(53)) -},{"53":53,"65":65,"66":66,"67":67,"68":68,"69":69}],73:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52,"64":64,"65":65,"66":66,"67":67,"68":68}],72:[function(_dereq_,module,exports){ +module.exports = _dereq_(67) + +},{"67":67}],73:[function(_dereq_,module,exports){ module.exports = _dereq_(68) },{"68":68}],74:[function(_dereq_,module,exports){ -module.exports = _dereq_(69) - -},{"69":69}],75:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -12008,16 +11971,16 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"8":8}],76:[function(_dereq_,module,exports){ -arguments[4][65][0].apply(exports,arguments) -},{"33":33,"52":52,"65":65,"77":77,"79":79,"9":9}],77:[function(_dereq_,module,exports){ +},{"8":8}],75:[function(_dereq_,module,exports){ +arguments[4][64][0].apply(exports,arguments) +},{"33":33,"51":51,"64":64,"76":76,"78":78,"9":9}],76:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -12072,7 +12035,7 @@ util.inherits(Readable, Stream); var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); options = options || {}; @@ -12131,7 +12094,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -12139,7 +12102,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); if (!(this instanceof Readable)) return new Readable(options); @@ -12242,7 +12205,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -12892,8 +12855,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(53)) -},{"25":25,"33":33,"35":35,"52":52,"53":53,"6":6,"75":75,"76":76,"8":8,"9":9}],78:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"33":33,"35":35,"51":51,"52":52,"6":6,"74":74,"75":75,"8":8,"9":9}],77:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -12940,7 +12903,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(76); +var Duplex = _dereq_(75); /**/ var util = _dereq_(9); @@ -13074,7 +13037,7 @@ function done(stream, er) { return stream.push(null); } -},{"33":33,"76":76,"9":9}],79:[function(_dereq_,module,exports){ +},{"33":33,"75":75,"9":9}],78:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -13085,7 +13048,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -13105,7 +13068,7 @@ util.inherits = _dereq_(33); /**/ var internalUtil = { - deprecate: _dereq_(84) + deprecate: _dereq_(83) }; /**/ @@ -13135,7 +13098,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); options = options || {}; @@ -13252,7 +13215,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -13592,16 +13555,16 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(53)) -},{"25":25,"33":33,"52":52,"53":53,"76":76,"8":8,"84":84,"9":9}],80:[function(_dereq_,module,exports){ -arguments[4][73][0].apply(exports,arguments) -},{"73":73,"78":78}],81:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"33":33,"51":51,"52":52,"75":75,"8":8,"83":83,"9":9}],79:[function(_dereq_,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"72":72,"77":77}],80:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],82:[function(_dereq_,module,exports){ +},{"20":20}],81:[function(_dereq_,module,exports){ (function (process){ -var Transform = _dereq_(80) - , inherits = _dereq_(87).inherits - , xtend = _dereq_(81) +var Transform = _dereq_(79) + , inherits = _dereq_(86).inherits + , xtend = _dereq_(80) function DestroyableTransform(opts) { Transform.call(this, opts) @@ -13696,8 +13659,8 @@ module.exports.obj = through2(function (options, transform, flush) { return t2 }) -}).call(this,_dereq_(53)) -},{"53":53,"80":80,"81":81,"87":87}],83:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52,"79":79,"80":80,"86":86}],82:[function(_dereq_,module,exports){ 'use strict'; // Simple FIFO queue implementation to avoid having to do shift() @@ -13747,7 +13710,7 @@ Queue.prototype.slice = function (start, end) { module.exports = Queue; -},{}],84:[function(_dereq_,module,exports){ +},{}],83:[function(_dereq_,module,exports){ (function (global){ /** @@ -13818,16 +13781,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],85:[function(_dereq_,module,exports){ +},{}],84:[function(_dereq_,module,exports){ arguments[4][33][0].apply(exports,arguments) -},{"33":33}],86:[function(_dereq_,module,exports){ +},{"33":33}],85:[function(_dereq_,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],87:[function(_dereq_,module,exports){ +},{}],86:[function(_dereq_,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14354,7 +14317,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = _dereq_(86); +exports.isBuffer = _dereq_(85); function objectToString(o) { return Object.prototype.toString.call(o); @@ -14398,7 +14361,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = _dereq_(85); +exports.inherits = _dereq_(84); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -14416,8 +14379,8 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"53":53,"85":85,"86":86}],88:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"52":52,"84":84,"85":85}],87:[function(_dereq_,module,exports){ 'use strict'; /** @@ -14592,7 +14555,7 @@ exports.parse = function (str) { } }; -},{}],89:[function(_dereq_,module,exports){ +},{}],88:[function(_dereq_,module,exports){ module.exports = extend function extend() { @@ -14611,27 +14574,26 @@ function extend() { return target } -},{}],90:[function(_dereq_,module,exports){ +},{}],89:[function(_dereq_,module,exports){ (function (process,global,Buffer){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var levelup = _interopDefault(_dereq_(43)); -var ltgt = _interopDefault(_dereq_(50)); +var levelup = _interopDefault(_dereq_(42)); +var ltgt = _interopDefault(_dereq_(49)); var events = _dereq_(25); var events__default = _interopDefault(events); var inherits = _interopDefault(_dereq_(33)); -var Codec = _interopDefault(_dereq_(37)); -var ReadableStreamCore = _interopDefault(_dereq_(61)); -var through2 = _dereq_(82); +var Codec = _interopDefault(_dereq_(36)); +var ReadableStreamCore = _interopDefault(_dereq_(60)); +var through2 = _dereq_(81); var getArguments = _interopDefault(_dereq_(4)); var Deque = _interopDefault(_dereq_(21)); -var lie = _interopDefault(_dereq_(49)); +var lie = _interopDefault(_dereq_(48)); var debug = _interopDefault(_dereq_(11)); -var Md5 = _interopDefault(_dereq_(62)); -var vuvuzela = _interopDefault(_dereq_(88)); -var jsExtend = _dereq_(36); +var Md5 = _interopDefault(_dereq_(61)); +var vuvuzela = _interopDefault(_dereq_(87)); var fruitdown = _interopDefault(_dereq_(28)); function isFunction(f) { @@ -15313,6 +15275,35 @@ function guardedConsole(method) { } } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -18104,7 +18095,7 @@ function LevelPouch(opts, callback) { } function FruitDownPouch(opts, callback) { - var _opts = jsExtend.extend({ + var _opts = extend$1({ db: fruitdown }, opts); @@ -18131,5 +18122,5 @@ if (!PDB) { } else { FruitdownPouchPlugin(PDB); } -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) -},{"11":11,"21":21,"25":25,"28":28,"33":33,"36":36,"37":37,"4":4,"43":43,"49":49,"50":50,"53":53,"61":61,"62":62,"8":8,"82":82,"88":88,"pouchdb":"pouchdb"}]},{},[90]); +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) +},{"11":11,"21":21,"25":25,"28":28,"33":33,"36":36,"4":4,"42":42,"48":48,"49":49,"52":52,"60":60,"61":61,"8":8,"81":81,"87":87,"pouchdb":"pouchdb"}]},{},[89]); diff --git a/lib/pouchdb/dist/pouchdb.fruitdown.min.js b/lib/pouchdb/dist/pouchdb.fruitdown.min.js index fdec7e69..873b5075 100644 --- a/lib/pouchdb/dist/pouchdb.fruitdown.min.js +++ b/lib/pouchdb/dist/pouchdb.fruitdown.min.js @@ -1,14 +1,14 @@ -// PouchDB fruitdown plugin 6.0.6 +// PouchDB fruitdown plugin 6.0.7 // Based on FruitDOWN: https://github.com/nolanlawson/fruitdown // // (c) 2012-2016 Dale Harvey and the PouchDB team // PouchDB may be freely distributed under the Apache license, version 2.0. // For all details and documentation: // http://pouchdb.com -!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var f=0;for(t=0,n=0;t>16&255,s[f++]=o>>8&255,s[f++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[f++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[f++]=o>>8&255,s[f++]=255&o),s}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,n){for(var r,i=[],o=t;oc?c:u+a));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var f=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),f=u.length,c=-1;++ca)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{8:8}],8:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return Y(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var f;if(i){var c=-1;for(f=n;fs&&(n=s-u),f=n;f>=0;f--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,f,c,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],f=e[i+2],128===(192&u)&&128===(192&f)&&(l=(15&o)<<12|(63&u)<<6|63&f,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],f=e[i+2],c=e[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(l=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function q(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function I(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function P(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||P(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||P(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function K(e){return e<16?"0"+e.toString(16):e.toString(16)}function Y(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(5),Z=e(31),Q=e(35);n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return f(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),f=this.slice(r,i),c=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;q(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);q(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);q(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>2],i=(3&a)<<4;break;case 1:n+=e[i|a>>4], -i=(15&a)<<2;break;case 2:n+=e[i|a>>6],n+=e[63&a],i=0}}return r%3&&(n+=e[i]),n},t.decode=function(e){for(var t=e.length,i=0,o=new r(~~(t/4*3)),a=0,s=0;s>4,a=u<<4&255;break;case 2:o[i++]=a|u>>2,a=u<<6&255;break;case 3:o[i++]=a|u}}return o},t},t.exports(i,t.exports)},{8:8}],11:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(12),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{12:12}],12:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(f||t);e.diff=o,e.prev=f,e.curr=t,f=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],22:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(24);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{24:24}],23:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(22)(t.exports),t.exports.create=t.exports.custom.createError},{22:22}],24:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],25:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),f=n.slice(),r=f.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],26:[function(e,t,n){(function(e,n){"use strict";function r(e){this._dbName=e}function i(e,t){if(u[e])return s(function(){t(null,u[e])});var n=indexedDB.open(e,1);f[e]=n,n.onupgradeneeded=function(e){var t=e.target.result;1!==e.oldVersion&&t.createObjectStore(a).createIndex("fakeKey","fakeKey")},n.onsuccess=function(n){var r=u[e]=n.target.result;t(null,r)},n.onerror=function(e){var n="Failed to open indexedDB, are you in private browsing mode?";console.error(n),t(e)}}function o(e,t){try{return{txn:e.transaction(a,t)}}catch(e){return{error:e}}}var a="fruitdown",s=n.setImmediate||e.nextTick,u={},f={};r.prototype.getKeys=function(e){i(this._dbName,function(t,n){if(t)return e(t);var r=o(n,"readonly");if(r.error)return e(r.error);var i=r.txn,s=i.objectStore(a);i.onerror=e;var u=[];i.oncomplete=function(){e(null,u.sort())};var f=s.index("fakeKey").openKeyCursor();f.onsuccess=function(e){var t=e.target.result;t&&(u.push(t.primaryKey),t.continue())}})},r.prototype.put=function(e,t,n){i(this._dbName,function(r,i){if(r)return n(r);var s=o(i,"readwrite");if(s.error)return n(s.error);var u=s.txn,f=u.objectStore(a),c="string"==typeof t?t:t.toString();u.onerror=n,u.oncomplete=function(){n()},f.put({value:c,fakeKey:0},e)})},r.prototype.get=function(e,t){i(this._dbName,function(n,r){if(n)return t(n);var i=o(r,"readonly");if(i.error)return t(i.error);var s,u=i.txn,f=u.objectStore(a),c=f.get(e);c.onsuccess=function(e){e.target.result&&(s=e.target.result.value)},u.onerror=t,u.oncomplete=function(){t(null,s)}})},r.prototype.remove=function(e,t){i(this._dbName,function(n,r){if(n)return t(n);var i=o(r,"readwrite");if(i.error)return t(i.error);var s=i.txn,u=s.objectStore(a);u.delete(e),s.onerror=t,s.oncomplete=function(){t()}})},r.destroy=function(e,t){s(function(){f[e]&&f[e].result&&(f[e].result.close(),delete u[e]);var n=indexedDB.deleteDatabase(e);n.onsuccess=function(){f[e]&&(f[e]=null),t(null)},n.onerror=t})},t.exports=r}).call(this,e(53),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{53:53}],27:[function(e,t,n){(function(n){"use strict";function r(e){this._store=new l(e),this._queue=new h}var i="ArrayBuffer:",o=new RegExp("^"+i),a="Uint8Array:",s=new RegExp("^"+a),u="Buff:",f=new RegExp("^"+u),c=e(30),l=e(26),h=e(29),d=e(10);r.prototype.sequentialize=function(e,t){this._queue.add(t,e)},r.prototype.init=function(e){var t=this;t.sequentialize(e,function(e){t._store.getKeys(function(n,r){return n?e(n):(t._keys=r,e())})})},r.prototype.keys=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.slice())})},r.prototype.setItem=function(e,t,r){var i=this;i.sequentialize(r,function(r){n.isBuffer(t)&&(t=u+d.encode(t));var o=c.sortedIndexOf(i._keys,e);i._keys[o]!==e&&i._keys.splice(o,0,e),i._store.put(e,t,r)})},r.prototype.getItem=function(e,t){var n=this;n.sequentialize(t,function(t){n._store.get(e,function(e,n){return e?t(e):"undefined"==typeof n||null===n?t(new Error("NotFound")):("undefined"!=typeof n&&(f.test(n)?n=d.decode(n.substring(u.length)):o.test(n)?(n=n.substring(i.length),n=new ArrayBuffer(atob(n).split("").map(function(e){return e.charCodeAt(0)}))):s.test(n)&&(n=n.substring(a.length),n=new Uint8Array(atob(n).split("").map(function(e){return e.charCodeAt(0)})))),void t(null,n))})})},r.prototype.removeItem=function(e,t){var n=this;n.sequentialize(t,function(t){var r=c.sortedIndexOf(n._keys,e);n._keys[r]===e?(n._keys.splice(r,1),n._store.remove(e,function(e){return e?t(e):void t()})):t()})},r.prototype.length=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.length)})},t.exports=r}).call(this,{isBuffer:e(34)})},{10:10,26:26,29:29,30:30,34:34}],28:[function(e,t,n){(function(n,r,i){"use strict";function o(e,t){c.call(this,e),this._reverse=!!t.reverse,this._endkey=t.end,this._startkey=t.start,this._gt=t.gt,this._gte=t.gte,this._lt=t.lt,this._lte=t.lte,this._exclusiveStart=t.exclusiveStart,this._limit=t.limit,this._count=0,this.onInitCompleteListeners=[]}function a(e){return this instanceof a?(f.call(this,e),void(this.container=new l(e))):new a(e)}function s(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if("key"===t){if(e instanceof Boolean)return new Error(t+" cannot be `null` or `undefined`");if(""===e)return new Error(t+" cannot be empty")}if(0===e.toString().indexOf("[object ArrayBuffer]")&&(0===e.byteLength||void 0===e.byteLength))return new Error(t+" cannot be an empty Buffer");if(i.isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")}var u=e(33),f=e(3).AbstractLevelDOWN,c=e(3).AbstractIterator,l=e(27),h=e(26),d=e(30),p=r.setImmediate||n.nextTick;u(o,c),o.prototype._init=function(e){p(function(){e()})},o.prototype._next=function(e){function t(){if(n._pos===n._keys.length||n._pos<0)return e();var t=n._keys[n._pos];return n._endkey&&(n._reverse?tn._endkey)?e():n._limit&&n._limit>0&&n._count++>=n._limit?e():n._lt&&t>=n._lt||n._lte&&t>n._lte||n._gt&&t<=n._gt||n._gte&&t=n._keys.length||o<0?void 0:n._keys[o];n._pos=o,n._reverse?(n._exclusiveStart||a!==n._startkey)&&n._pos--:n._exclusiveStart&&a===n._startkey&&n._pos++}else n._pos=n._reverse?n._keys.length-1:0;t(),n.initCompleted=!0;for(var s=-1;++s-1){var o=JSON.parse(r);r=o.data}n(null,r)}))},a.prototype._del=function(e,t,n){var r=s(e,"key");return r?p(function(){n(r)}):(i.isBuffer(e)||(e=String(e)),void this.container.removeItem(e,n))},a.prototype._batch=function(e,t,n){var r=this;p(function(){function o(){++l===e.length&&n(c)}var a,u,f,c,l=0;if(Array.isArray(e)&&e.length)for(var h=0;h>>1,e[n]>1,c=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=f}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,f-=8);e[n+d-p]|=128*g; -}},{}],32:[function(e,t,n){(function(e){"use strict";function n(){c=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{38:38}],38:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],39:[function(e,t,n){var r=e(23).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{23:23}],40:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(33),o=e(61).Readable,a=e(41),s=e(39).EncodingError;t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)),void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{33:33,39:39,41:41,61:61}],41:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],42:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(44),o=e(39).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{39:39,44:44}],43:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(f.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=B(t),this.options=h(R,t),this._codec=new x(this.options),this._status="new",d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new b("Database is not open"),n),!0}function a(e,t,n){j(e,new v(t),n)}function s(e,t,n){j(e,new b(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var f=e(25).EventEmitter,c=e(87).inherits,l=e(87).deprecate,h=e(47),d=e(54),p=e(14),g=e(40),y=e(39),v=y.WriteError,b=y.ReadError,m=y.NotFoundError,_=y.OpenError,w=y.EncodingError,E=y.InitializationError,k=e(44),S=e(42),x=e(45),B=k.getOptions,R=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;c(i,f),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new _(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new b(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,f=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=B(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(f,new v(n),i):(f.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=B(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new v(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=B(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new v(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=B(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new _(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(39),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(53))},{14:14,25:25,39:39,40:40,42:42,44:44,45:45,47:47,53:53,54:54,87:87}],44:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(48).devDependencies.leveldown;try{t=e(6).version}catch(e){throw o(e)}if(!e(6).satisfies(t,n))throw new f("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(6)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new f(c(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,f=(e(47),e(39).LevelUPError),c=e(87).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{39:39,47:47,48:48,6:6,87:87}],45:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{37:37,46:46}],46:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],47:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],48:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.2",_id:"levelup@1.3.2",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"6.1.0",_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237"},_npmUser:{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},_npmVersion:"3.8.6",_phantomChildren:{},_requested:{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},_requiredBy:["/","/pouchdb","/pouchdb-adapter-leveldb-core"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz",_shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",_shrinkwrap:null,_spec:"levelup@1.3.2",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz"},gitHead:"bcc242cfc4ec035f9228a5cd54903cb126659a00",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.2"}},{}],49:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=f(i);"error"===a.status&&n(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function c(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(f,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,f=new this(r);++un?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},f=n.upperBoundExclusive=function(e){return!!t(e,"lt")},c=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=c(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,f=n.lowerBoundKey(e),c=n.upperBoundKey(e);return f?"gt"===f?r.gt=i(e.gt,!1):r.gte=i(e[f],!1):u&&(r.gte=i(a,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var c=l(e);if(r(c)){var a=i(t,c);if(a>0||0===a&&f(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(34)})},{34:34}],51:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*f;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=c?Math.round(e/c)+"d":e>=f?Math.round(e/f)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,c,"day")||a(e,f,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):_(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function b(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=B.prototype.pipe,e.on=e.addListener=B.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&_(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&_(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===c&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),c.removeListener("end",i),c.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){f(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),f()}function u(){e.removeListener("close",s),f()}function f(){c.unpipe(e)}var c=this,l=this._readableState; -switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):c.once("end",d),e.on("unpipe",r);var p=g(c);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s),e.once("finish",u),e.emit("pipe",c),l.flowing||(this.on("readable",v),l.flowing=!0,n.nextTick(function(){y(c)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],f=e[3];a=n(a,s,u,f,t[0],7,-680876936),f=n(f,a,s,u,t[1],12,-389564586),u=n(u,f,a,s,t[2],17,606105819),s=n(s,u,f,a,t[3],22,-1044525330),a=n(a,s,u,f,t[4],7,-176418897),f=n(f,a,s,u,t[5],12,1200080426),u=n(u,f,a,s,t[6],17,-1473231341),s=n(s,u,f,a,t[7],22,-45705983),a=n(a,s,u,f,t[8],7,1770035416),f=n(f,a,s,u,t[9],12,-1958414417),u=n(u,f,a,s,t[10],17,-42063),s=n(s,u,f,a,t[11],22,-1990404162),a=n(a,s,u,f,t[12],7,1804603682),f=n(f,a,s,u,t[13],12,-40341101),u=n(u,f,a,s,t[14],17,-1502002290),s=n(s,u,f,a,t[15],22,1236535329),a=r(a,s,u,f,t[1],5,-165796510),f=r(f,a,s,u,t[6],9,-1069501632),u=r(u,f,a,s,t[11],14,643717713),s=r(s,u,f,a,t[0],20,-373897302),a=r(a,s,u,f,t[5],5,-701558691),f=r(f,a,s,u,t[10],9,38016083),u=r(u,f,a,s,t[15],14,-660478335),s=r(s,u,f,a,t[4],20,-405537848),a=r(a,s,u,f,t[9],5,568446438),f=r(f,a,s,u,t[14],9,-1019803690),u=r(u,f,a,s,t[3],14,-187363961),s=r(s,u,f,a,t[8],20,1163531501),a=r(a,s,u,f,t[13],5,-1444681467),f=r(f,a,s,u,t[2],9,-51403784),u=r(u,f,a,s,t[7],14,1735328473),s=r(s,u,f,a,t[12],20,-1926607734),a=i(a,s,u,f,t[5],4,-378558),f=i(f,a,s,u,t[8],11,-2022574463),u=i(u,f,a,s,t[11],16,1839030562),s=i(s,u,f,a,t[14],23,-35309556),a=i(a,s,u,f,t[1],4,-1530992060),f=i(f,a,s,u,t[4],11,1272893353),u=i(u,f,a,s,t[7],16,-155497632),s=i(s,u,f,a,t[10],23,-1094730640),a=i(a,s,u,f,t[13],4,681279174),f=i(f,a,s,u,t[0],11,-358537222),u=i(u,f,a,s,t[3],16,-722521979),s=i(s,u,f,a,t[6],23,76029189),a=i(a,s,u,f,t[9],4,-640364487),f=i(f,a,s,u,t[12],11,-421815835),u=i(u,f,a,s,t[15],16,530742520),s=i(s,u,f,a,t[2],23,-995338651),a=o(a,s,u,f,t[0],6,-198630844),f=o(f,a,s,u,t[7],10,1126891415),u=o(u,f,a,s,t[14],15,-1416354905),s=o(s,u,f,a,t[5],21,-57434055),a=o(a,s,u,f,t[12],6,1700485571),f=o(f,a,s,u,t[3],10,-1894986606),u=o(u,f,a,s,t[10],15,-1051523),s=o(s,u,f,a,t[1],21,-2054922799),a=o(a,s,u,f,t[8],6,1873313359),f=o(f,a,s,u,t[15],10,-30611744),u=o(u,f,a,s,t[6],15,-1560198380),s=o(s,u,f,a,t[13],21,1309151649),a=o(a,s,u,f,t[4],6,-145523070),f=o(f,a,s,u,t[11],10,-1120210379),u=o(u,f,a,s,t[2],15,718787259),s=o(s,u,f,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(f,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function f(e){var t,n,r,i,o,u,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(c,r),c}function c(e){var t,n,r,i,o,s,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(c,r),c}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=_[e>>8*t+4&15]+_[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,f=t(n,u),c=u;return r!==e&&(c=t(r,u)),f>c?new ArrayBuffer(0):(i=c-f,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,f,i),a.set(s),o)}}(),b.prototype.append=function(e){return this.appendBinary(d(e)),this},b.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},b.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},b.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},b.hash=function(e,t){return b.hashBinary(d(e),t)},b.hashBinary=function(e,t){var n=f(e),r=h(n);return t?v(r):r},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){var e=b.prototype.getState.call(this);return e.buff=g(e.buff),e},b.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),b.prototype.setState.call(this,e)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(e,t){var n=c(new Uint8Array(e)),r=h(n);return t?v(r):r},b})},{}],63:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(25).EventEmitter,o=e(33);o(r,i),r.Readable=e(72),r.Writable=e(74),r.Duplex=e(64),r.Transform=e(73),r.PassThrough=e(71),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",a),f.removeListener("error",s),e.removeListener("error",s),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(f.on("end",o),f.on("close",a));var c=!1;return f.on("error",s),e.on("error",s),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{25:25,33:33,64:64,71:71,72:72,73:73,74:74}],64:[function(e,t,n){t.exports=e(65)},{65:65}],65:[function(e,t,n){"use strict";function r(e){return this instanceof r?(f.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(52),u=e(9);u.inherits=e(33);var f=e(67),c=e(69);u.inherits(r,f);for(var l=a(c.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var f;!t.decoder||i||r||(n=t.decoder.write(n),f=!t.objectMode&&0===n.length),i||(t.reading=!1),f||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return L.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){N("emit readable"),e.emit("readable"),_(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){N("onunpipe"),e===h&&a()}function o(){N("onend"),e.end()}function a(){N("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),b=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!b&&(N("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){N("onerror",t),l(),e.removeListener("error",u),0===T(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",c),l()}function c(){N("onfinish"),e.removeListener("close",f),l()}function l(){N("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,N("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var v=y(h);e.on("drain",v);var b=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",f),e.once("finish",c),e.emit("pipe",h),d.flowing||(N("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k;a.WritableState=o;var x=e(9);x.inherits=e(33);var B,R={deprecate:e(84)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(25).EventEmitter)}}();var A=e(8).Buffer,j=e(7);x.inherits(a,B);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(53))},{25:25,33:33,52:52,53:53,65:65,7:7,8:8,84:84,9:9}],70:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(8).Buffer,e(7));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{7:7,8:8}],71:[function(e,t,n){t.exports=e(66)},{66:66}],72:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(67),n.Stream=i||n,n.Readable=n,n.Writable=e(69),n.Duplex=e(65),n.Transform=e(68),n.PassThrough=e(66),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(53))},{53:53,65:65,66:66,67:67,68:68,69:69}],73:[function(e,t,n){t.exports=e(68)},{68:68}],74:[function(e,t,n){t.exports=e(69)},{69:69}],75:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(8).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{8:8}],76:[function(e,t,n){arguments[4][65][0].apply(n,arguments)},{33:33,52:52,65:65,77:77,79:79,9:9}],77:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(76),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(L||(L=e(75).StringDecoder),this.decoder=new L(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(76),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=f(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,c(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=D?e=D:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(T("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){T("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:R.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return T("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;T("need readable",r),(0===t.length||t.length-e0?_(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){T("onunpipe"),e===l&&o()}function i(){T("onend"),e.end()}function o(){T("cleanup"),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",y),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),v=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){T("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||v||(T("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){T("onerror",t),c(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",f),c()}function f(){T("onfinish"),e.removeListener("close",u),c()}function c(){T("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,T("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var y=g(l);e.on("drain",y);var v=!1;return l.on("data",a),e._events&&e._events.error?B(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",f),e.emit("pipe",l),h.flowing||(T("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(8).Buffer;a.WritableState=o;var B=e(9);B.inherits=e(33);var R,A={deprecate:e(84)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(25).EventEmitter)}}();var x=e(8).Buffer;B.inherits(a,R);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(53))},{25:25,33:33,52:52,53:53,76:76,8:8,84:84,9:9}],80:[function(e,t,n){arguments[4][73][0].apply(n,arguments)},{73:73,78:78}],81:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],82:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(80),s=e(87).inherits,u=e(81);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(53))},{53:53,80:80,81:81,87:87}],83:[function(e,t,n){"use strict";function r(){this.length=0}r.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},r.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},r.prototype.slice=function(e,t){e="undefined"==typeof e?0:e,t="undefined"==typeof t?1/0:t;for(var n=[],r=0,i=this.first;i&&!(--t<0);i=i.next)++r>e&&n.push(i.item);return n},t.exports=r},{}],84:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],85:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{33:33}],86:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],87:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&B(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=f(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(t);if(0===a.length){if(B(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return c(t)}var v="",b=!1,_=["{","}"];if(p(t)&&(b=!0,_=["[","]"]),B(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),S(t)&&(v=" "+Date.prototype.toUTCString.call(t)),x(t)&&(v=" "+c(t)),0===a.length&&(!b||0==t.length))return _[0]+v+_[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=b?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,b)}),e.seen.pop(),d(k,v,_)}function f(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function B(e){return"function"==typeof e}function R(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var T=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(f in r)r.hasOwnProperty(f)&&u.push(f);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)c=u[a],l=r[c],h=a>0?",":"",h+=JSON.stringify(c)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,f,c,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":f={element:[],index:l.length},l.push(f.element),h.push(f);break;case"{":c={element:{},index:l.length},l.push(c.element),h.push(c);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],89:[function(e,t,n){function r(){for(var e={},t=0;t>>1,n(e[r],t)<0?i=r+1:o=r;return i}function H(e,t,n){var r=J(e,t,n);e.splice(r,0,t)}function $(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var y=g.ids[2],v=0,b=y.length;v0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],f=k.docStore.readStream(i),c=We.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:c}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=z(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,c=Re(a),l=Ae(a,c);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return f.unpipe(),f.destroy(),void r()}if(e.include_docs){var h=a.rev_map[c];k.bySeqStore.get(y(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Oe(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){c.end()});f.on("error",t),f.pipe(c)})}),E._changes=function(e){function t(){e.done=!0,f&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=y(e.since||0));var f,c=e.doc_ids&&new g(e.doc_ids),l=O(e),h=new p;f="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),b=We.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Oe([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),f&&o.push(r)),void d())}var r=Re(t);if(t.seq!==g)return d();if(a=g,r===b._rev)return n(b);var i=t.rev_map[r];k.bySeqStore.get(y(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=v(n.key),b=n.value;if(g===e.since&&!i)return d();if(c&&!c.has(b._id))return d();var m;return(m=h.get(b._id))?p(m):void k.docStore.get(b._id,function(t,n){return e.cancelled||e.done||w.isClosed()||ie(n.id)?d():(h.set(b._id,n),void p(n))})},function(t){return e.cancelled?t():(f&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(qe.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},Ie(R,Error),R.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var st,ut=(new R({status:401,error:"unauthorized",reason:"Name or password is incorrect." -}),new R({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new R({status:404,error:"not_found",reason:"missing"})),ft=new R({status:409,error:"conflict",reason:"Document update conflict"}),ct=new R({status:400,error:"bad_request",reason:"_id field must contain a string"}),lt=new R({status:412,error:"missing_id",reason:"_id is required for puts"}),ht=new R({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),dt=new R({status:412,error:"precondition_failed",reason:"Database not open"}),pt=(new R({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new R({status:500,error:"badarg",reason:"Some query argument is invalid"})),gt=(new R({status:400,error:"invalid_request",reason:"Request was invalid"}),new R({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new R({status:500,error:"doc_validation",reason:"Bad special document member"})),yt=new R({status:400,error:"bad_request",reason:"Something wrong with the request"}),vt=(new R({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new R({status:404,error:"not_found",reason:"Database not found"}),new R({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new R({status:500,error:"web_sql_went_bad",reason:"unknown"}),new R({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new R({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new R({status:400,error:"bad_request",reason:"Invalid rev format"})),bt=(new R({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new R({status:412,error:"missing_stub"})),mt=(new R({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),M.name);st=mt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var _t=st,wt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Et=D(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),kt=D(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),St=function(e){return atob(e)},xt=function(e){return btoa(e)},Bt=n.setImmediate||n.setTimeout,Rt=32768;Be.prototype.get=function(e,n,r){var i=xe(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Be.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var At="document-store",jt="by-sequence",Ot="attach-store",Mt="attach-binary-store",Tt="local-store",Lt="meta-store",Ct=new p,Dt="_local_last_update_seq",qt="_local_doc_count",Nt="_local_uuid",It="md5-",Pt={encode:we,decode:_e,buffer:!1,type:"cheap-json"},Ut=new x;Te.valid=function(){return!!n.indexedDB},Te.use_prefix=!0;var Wt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");Wt?Le(Wt):B("error",'fruitdown adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(53),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(8).Buffer)},{11:11,21:21,25:25,28:28,33:33,36:36,37:37,4:4,43:43,49:49,50:50,53:53,61:61,62:62,8:8,82:82,88:88,pouchdb:"pouchdb"}]},{},[90]); +!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var f=0;for(t=0,n=0;t>16&255,s[f++]=o>>8&255,s[f++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[f++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[f++]=o>>8&255,s[f++]=255&o),s}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,n){for(var r,i=[],o=t;oc?c:u+a));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var f=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),f=u.length,c=-1;++ca)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{8:8}],8:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return Y(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var f;if(i){var c=-1;for(f=n;fs&&(n=s-u),f=n;f>=0;f--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,f,c,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],f=e[i+2],128===(192&u)&&128===(192&f)&&(l=(15&o)<<12|(63&u)<<6|63&f,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],f=e[i+2],c=e[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(l=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function q(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function I(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function P(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||P(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||P(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function K(e){return e<16?"0"+e.toString(16):e.toString(16)}function Y(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(5),Z=e(31),Q=e(35);n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return f(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),f=this.slice(r,i),c=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;q(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);q(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);q(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>2],i=(3&a)<<4;break;case 1:n+=e[i|a>>4], +i=(15&a)<<2;break;case 2:n+=e[i|a>>6],n+=e[63&a],i=0}}return r%3&&(n+=e[i]),n},t.decode=function(e){for(var t=e.length,i=0,o=new r(~~(t/4*3)),a=0,s=0;s>4,a=u<<4&255;break;case 2:o[i++]=a|u>>2,a=u<<6&255;break;case 3:o[i++]=a|u}}return o},t},t.exports(i,t.exports)},{8:8}],11:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(12),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{12:12}],12:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(f||t);e.diff=o,e.prev=f,e.curr=t,f=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],22:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(24);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{24:24}],23:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(22)(t.exports),t.exports.create=t.exports.custom.createError},{22:22}],24:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],25:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),f=n.slice(),r=f.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],26:[function(e,t,n){(function(e,n){"use strict";function r(e){this._dbName=e}function i(e,t){if(u[e])return s(function(){t(null,u[e])});var n=indexedDB.open(e,1);f[e]=n,n.onupgradeneeded=function(e){var t=e.target.result;1!==e.oldVersion&&t.createObjectStore(a).createIndex("fakeKey","fakeKey")},n.onsuccess=function(n){var r=u[e]=n.target.result;t(null,r)},n.onerror=function(e){var n="Failed to open indexedDB, are you in private browsing mode?";console.error(n),t(e)}}function o(e,t){try{return{txn:e.transaction(a,t)}}catch(e){return{error:e}}}var a="fruitdown",s=n.setImmediate||e.nextTick,u={},f={};r.prototype.getKeys=function(e){i(this._dbName,function(t,n){if(t)return e(t);var r=o(n,"readonly");if(r.error)return e(r.error);var i=r.txn,s=i.objectStore(a);i.onerror=e;var u=[];i.oncomplete=function(){e(null,u.sort())};var f=s.index("fakeKey").openKeyCursor();f.onsuccess=function(e){var t=e.target.result;t&&(u.push(t.primaryKey),t.continue())}})},r.prototype.put=function(e,t,n){i(this._dbName,function(r,i){if(r)return n(r);var s=o(i,"readwrite");if(s.error)return n(s.error);var u=s.txn,f=u.objectStore(a),c="string"==typeof t?t:t.toString();u.onerror=n,u.oncomplete=function(){n()},f.put({value:c,fakeKey:0},e)})},r.prototype.get=function(e,t){i(this._dbName,function(n,r){if(n)return t(n);var i=o(r,"readonly");if(i.error)return t(i.error);var s,u=i.txn,f=u.objectStore(a),c=f.get(e);c.onsuccess=function(e){e.target.result&&(s=e.target.result.value)},u.onerror=t,u.oncomplete=function(){t(null,s)}})},r.prototype.remove=function(e,t){i(this._dbName,function(n,r){if(n)return t(n);var i=o(r,"readwrite");if(i.error)return t(i.error);var s=i.txn,u=s.objectStore(a);u.delete(e),s.onerror=t,s.oncomplete=function(){t()}})},r.destroy=function(e,t){s(function(){f[e]&&f[e].result&&(f[e].result.close(),delete u[e]);var n=indexedDB.deleteDatabase(e);n.onsuccess=function(){f[e]&&(f[e]=null),t(null)},n.onerror=t})},t.exports=r}).call(this,e(52),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{52:52}],27:[function(e,t,n){(function(n){"use strict";function r(e){this._store=new l(e),this._queue=new h}var i="ArrayBuffer:",o=new RegExp("^"+i),a="Uint8Array:",s=new RegExp("^"+a),u="Buff:",f=new RegExp("^"+u),c=e(30),l=e(26),h=e(29),d=e(10);r.prototype.sequentialize=function(e,t){this._queue.add(t,e)},r.prototype.init=function(e){var t=this;t.sequentialize(e,function(e){t._store.getKeys(function(n,r){return n?e(n):(t._keys=r,e())})})},r.prototype.keys=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.slice())})},r.prototype.setItem=function(e,t,r){var i=this;i.sequentialize(r,function(r){n.isBuffer(t)&&(t=u+d.encode(t));var o=c.sortedIndexOf(i._keys,e);i._keys[o]!==e&&i._keys.splice(o,0,e),i._store.put(e,t,r)})},r.prototype.getItem=function(e,t){var n=this;n.sequentialize(t,function(t){n._store.get(e,function(e,n){return e?t(e):"undefined"==typeof n||null===n?t(new Error("NotFound")):("undefined"!=typeof n&&(f.test(n)?n=d.decode(n.substring(u.length)):o.test(n)?(n=n.substring(i.length),n=new ArrayBuffer(atob(n).split("").map(function(e){return e.charCodeAt(0)}))):s.test(n)&&(n=n.substring(a.length),n=new Uint8Array(atob(n).split("").map(function(e){return e.charCodeAt(0)})))),void t(null,n))})})},r.prototype.removeItem=function(e,t){var n=this;n.sequentialize(t,function(t){var r=c.sortedIndexOf(n._keys,e);n._keys[r]===e?(n._keys.splice(r,1),n._store.remove(e,function(e){return e?t(e):void t()})):t()})},r.prototype.length=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.length)})},t.exports=r}).call(this,{isBuffer:e(34)})},{10:10,26:26,29:29,30:30,34:34}],28:[function(e,t,n){(function(n,r,i){"use strict";function o(e,t){c.call(this,e),this._reverse=!!t.reverse,this._endkey=t.end,this._startkey=t.start,this._gt=t.gt,this._gte=t.gte,this._lt=t.lt,this._lte=t.lte,this._exclusiveStart=t.exclusiveStart,this._limit=t.limit,this._count=0,this.onInitCompleteListeners=[]}function a(e){return this instanceof a?(f.call(this,e),void(this.container=new l(e))):new a(e)}function s(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if("key"===t){if(e instanceof Boolean)return new Error(t+" cannot be `null` or `undefined`");if(""===e)return new Error(t+" cannot be empty")}if(0===e.toString().indexOf("[object ArrayBuffer]")&&(0===e.byteLength||void 0===e.byteLength))return new Error(t+" cannot be an empty Buffer");if(i.isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")}var u=e(33),f=e(3).AbstractLevelDOWN,c=e(3).AbstractIterator,l=e(27),h=e(26),d=e(30),p=r.setImmediate||n.nextTick;u(o,c),o.prototype._init=function(e){p(function(){e()})},o.prototype._next=function(e){function t(){if(n._pos===n._keys.length||n._pos<0)return e();var t=n._keys[n._pos];return n._endkey&&(n._reverse?tn._endkey)?e():n._limit&&n._limit>0&&n._count++>=n._limit?e():n._lt&&t>=n._lt||n._lte&&t>n._lte||n._gt&&t<=n._gt||n._gte&&t=n._keys.length||o<0?void 0:n._keys[o];n._pos=o,n._reverse?(n._exclusiveStart||a!==n._startkey)&&n._pos--:n._exclusiveStart&&a===n._startkey&&n._pos++}else n._pos=n._reverse?n._keys.length-1:0;t(),n.initCompleted=!0;for(var s=-1;++s-1){var o=JSON.parse(r);r=o.data}n(null,r)}))},a.prototype._del=function(e,t,n){var r=s(e,"key");return r?p(function(){n(r)}):(i.isBuffer(e)||(e=String(e)),void this.container.removeItem(e,n))},a.prototype._batch=function(e,t,n){var r=this;p(function(){function o(){++l===e.length&&n(c)}var a,u,f,c,l=0;if(Array.isArray(e)&&e.length)for(var h=0;h>>1,e[n]>1,c=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=f}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,f-=8);e[n+d-p]|=128*g; +}},{}],32:[function(e,t,n){(function(e){"use strict";function n(){c=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{37:37}],37:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],38:[function(e,t,n){var r=e(23).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{23:23}],39:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(33),o=e(60).Readable,a=e(40),s=e(38).EncodingError;t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)),void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{33:33,38:38,40:40,60:60}],40:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],41:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(43),o=e(38).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{38:38,43:43}],42:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(f.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=B(t),this.options=h(R,t),this._codec=new x(this.options),this._status="new",d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new b("Database is not open"),n),!0}function a(e,t,n){j(e,new v(t),n)}function s(e,t,n){j(e,new b(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var f=e(25).EventEmitter,c=e(86).inherits,l=e(86).deprecate,h=e(46),d=e(53),p=e(14),g=e(39),y=e(38),v=y.WriteError,b=y.ReadError,m=y.NotFoundError,_=y.OpenError,w=y.EncodingError,E=y.InitializationError,k=e(43),S=e(41),x=e(44),B=k.getOptions,R=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;c(i,f),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new _(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new b(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,f=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=B(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(f,new v(n),i):(f.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=B(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new v(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=B(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new v(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=B(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new _(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(38),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(52))},{14:14,25:25,38:38,39:39,41:41,43:43,44:44,46:46,52:52,53:53,86:86}],43:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(47).devDependencies.leveldown;try{t=e(6).version}catch(e){throw o(e)}if(!e(6).satisfies(t,n))throw new f("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(6)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new f(c(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,f=(e(46),e(38).LevelUPError),c=e(86).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{38:38,46:46,47:47,6:6,86:86}],44:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{36:36,45:45}],45:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],46:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],47:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.3",_id:"levelup@1.3.3",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"4.4.7",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446"},_npmUser:{name:"juliangruber",email:"julian@juliangruber.com"},_npmVersion:"2.15.8",_phantomChildren:{},_requested:{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz",_shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",_shrinkwrap:null,_spec:"levelup@1.3.3",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz"},gitHead:"cced27dc9f0095823be5ed388ec601ec2bfe7366",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.3"}},{}],48:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=f(i);"error"===a.status&&n(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function c(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(f,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,f=new this(r);++un?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},f=n.upperBoundExclusive=function(e){return!!t(e,"lt")},c=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=c(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,f=n.lowerBoundKey(e),c=n.upperBoundKey(e);return f?"gt"===f?r.gt=i(e.gt,!1):r.gte=i(e[f],!1):u&&(r.gte=i(a,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var c=l(e);if(r(c)){var a=i(t,c);if(a>0||0===a&&f(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(34)})},{34:34}],50:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*f;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=c?Math.round(e/c)+"d":e>=f?Math.round(e/f)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,c,"day")||a(e,f,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):_(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function b(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=B.prototype.pipe,e.on=e.addListener=B.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&_(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&_(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===c&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),c.removeListener("end",i),c.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){f(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),f()}function u(){e.removeListener("close",s),f()}function f(){c.unpipe(e)}var c=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):c.once("end",d),e.on("unpipe",r);var p=g(c);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a), +e.once("close",s),e.once("finish",u),e.emit("pipe",c),l.flowing||(this.on("readable",v),l.flowing=!0,n.nextTick(function(){y(c)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],f=e[3];a=n(a,s,u,f,t[0],7,-680876936),f=n(f,a,s,u,t[1],12,-389564586),u=n(u,f,a,s,t[2],17,606105819),s=n(s,u,f,a,t[3],22,-1044525330),a=n(a,s,u,f,t[4],7,-176418897),f=n(f,a,s,u,t[5],12,1200080426),u=n(u,f,a,s,t[6],17,-1473231341),s=n(s,u,f,a,t[7],22,-45705983),a=n(a,s,u,f,t[8],7,1770035416),f=n(f,a,s,u,t[9],12,-1958414417),u=n(u,f,a,s,t[10],17,-42063),s=n(s,u,f,a,t[11],22,-1990404162),a=n(a,s,u,f,t[12],7,1804603682),f=n(f,a,s,u,t[13],12,-40341101),u=n(u,f,a,s,t[14],17,-1502002290),s=n(s,u,f,a,t[15],22,1236535329),a=r(a,s,u,f,t[1],5,-165796510),f=r(f,a,s,u,t[6],9,-1069501632),u=r(u,f,a,s,t[11],14,643717713),s=r(s,u,f,a,t[0],20,-373897302),a=r(a,s,u,f,t[5],5,-701558691),f=r(f,a,s,u,t[10],9,38016083),u=r(u,f,a,s,t[15],14,-660478335),s=r(s,u,f,a,t[4],20,-405537848),a=r(a,s,u,f,t[9],5,568446438),f=r(f,a,s,u,t[14],9,-1019803690),u=r(u,f,a,s,t[3],14,-187363961),s=r(s,u,f,a,t[8],20,1163531501),a=r(a,s,u,f,t[13],5,-1444681467),f=r(f,a,s,u,t[2],9,-51403784),u=r(u,f,a,s,t[7],14,1735328473),s=r(s,u,f,a,t[12],20,-1926607734),a=i(a,s,u,f,t[5],4,-378558),f=i(f,a,s,u,t[8],11,-2022574463),u=i(u,f,a,s,t[11],16,1839030562),s=i(s,u,f,a,t[14],23,-35309556),a=i(a,s,u,f,t[1],4,-1530992060),f=i(f,a,s,u,t[4],11,1272893353),u=i(u,f,a,s,t[7],16,-155497632),s=i(s,u,f,a,t[10],23,-1094730640),a=i(a,s,u,f,t[13],4,681279174),f=i(f,a,s,u,t[0],11,-358537222),u=i(u,f,a,s,t[3],16,-722521979),s=i(s,u,f,a,t[6],23,76029189),a=i(a,s,u,f,t[9],4,-640364487),f=i(f,a,s,u,t[12],11,-421815835),u=i(u,f,a,s,t[15],16,530742520),s=i(s,u,f,a,t[2],23,-995338651),a=o(a,s,u,f,t[0],6,-198630844),f=o(f,a,s,u,t[7],10,1126891415),u=o(u,f,a,s,t[14],15,-1416354905),s=o(s,u,f,a,t[5],21,-57434055),a=o(a,s,u,f,t[12],6,1700485571),f=o(f,a,s,u,t[3],10,-1894986606),u=o(u,f,a,s,t[10],15,-1051523),s=o(s,u,f,a,t[1],21,-2054922799),a=o(a,s,u,f,t[8],6,1873313359),f=o(f,a,s,u,t[15],10,-30611744),u=o(u,f,a,s,t[6],15,-1560198380),s=o(s,u,f,a,t[13],21,1309151649),a=o(a,s,u,f,t[4],6,-145523070),f=o(f,a,s,u,t[11],10,-1120210379),u=o(u,f,a,s,t[2],15,718787259),s=o(s,u,f,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(f,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function f(e){var t,n,r,i,o,u,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(c,r),c}function c(e){var t,n,r,i,o,s,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(c,r),c}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=_[e>>8*t+4&15]+_[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,f=t(n,u),c=u;return r!==e&&(c=t(r,u)),f>c?new ArrayBuffer(0):(i=c-f,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,f,i),a.set(s),o)}}(),b.prototype.append=function(e){return this.appendBinary(d(e)),this},b.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},b.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},b.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},b.hash=function(e,t){return b.hashBinary(d(e),t)},b.hashBinary=function(e,t){var n=f(e),r=h(n);return t?v(r):r},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){var e=b.prototype.getState.call(this);return e.buff=g(e.buff),e},b.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),b.prototype.setState.call(this,e)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(e,t){var n=c(new Uint8Array(e)),r=h(n);return t?v(r):r},b})},{}],62:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(25).EventEmitter,o=e(33);o(r,i),r.Readable=e(71),r.Writable=e(73),r.Duplex=e(63),r.Transform=e(72),r.PassThrough=e(70),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",a),f.removeListener("error",s),e.removeListener("error",s),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(f.on("end",o),f.on("close",a));var c=!1;return f.on("error",s),e.on("error",s),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{25:25,33:33,63:63,70:70,71:71,72:72,73:73}],63:[function(e,t,n){t.exports=e(64)},{64:64}],64:[function(e,t,n){"use strict";function r(e){return this instanceof r?(f.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(51),u=e(9);u.inherits=e(33);var f=e(66),c=e(68);u.inherits(r,f);for(var l=a(c.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var f;!t.decoder||i||r||(n=t.decoder.write(n),f=!t.objectMode&&0===n.length),i||(t.reading=!1),f||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return L.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){N("emit readable"),e.emit("readable"),_(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){N("onunpipe"),e===h&&a()}function o(){N("onend"),e.end()}function a(){N("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),b=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!b&&(N("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){N("onerror",t),l(),e.removeListener("error",u),0===T(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",c),l()}function c(){N("onfinish"),e.removeListener("close",f),l()}function l(){N("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,N("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var v=y(h);e.on("drain",v);var b=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",f),e.once("finish",c),e.emit("pipe",h),d.flowing||(N("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k;a.WritableState=o;var x=e(9);x.inherits=e(33);var B,R={deprecate:e(83)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(25).EventEmitter)}}();var A=e(8).Buffer,j=e(7);x.inherits(a,B);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(52))},{25:25,33:33,51:51,52:52,64:64,7:7,8:8,83:83,9:9}],69:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(8).Buffer,e(7));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{7:7,8:8}],70:[function(e,t,n){t.exports=e(65)},{65:65}],71:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(66),n.Stream=i||n,n.Readable=n,n.Writable=e(68),n.Duplex=e(64),n.Transform=e(67),n.PassThrough=e(65),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(52))},{52:52,64:64,65:65,66:66,67:67,68:68}],72:[function(e,t,n){t.exports=e(67)},{67:67}],73:[function(e,t,n){t.exports=e(68)},{68:68}],74:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(8).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{8:8}],75:[function(e,t,n){arguments[4][64][0].apply(n,arguments)},{33:33,51:51,64:64,76:76,78:78,9:9}],76:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(75),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(L||(L=e(74).StringDecoder),this.decoder=new L(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(75),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=f(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,c(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=D?e=D:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(T("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){T("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:R.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return T("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;T("need readable",r),(0===t.length||t.length-e0?_(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){T("onunpipe"),e===l&&o()}function i(){T("onend"),e.end()}function o(){T("cleanup"),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",y),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),v=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){T("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||v||(T("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){T("onerror",t),c(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",f),c()}function f(){T("onfinish"),e.removeListener("close",u),c()}function c(){T("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,T("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var y=g(l);e.on("drain",y);var v=!1;return l.on("data",a),e._events&&e._events.error?B(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",f),e.emit("pipe",l),h.flowing||(T("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(8).Buffer;a.WritableState=o;var B=e(9);B.inherits=e(33);var R,A={deprecate:e(83)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(25).EventEmitter)}}();var x=e(8).Buffer;B.inherits(a,R);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(52))},{25:25,33:33,51:51,52:52,75:75,8:8,83:83,9:9}],79:[function(e,t,n){arguments[4][72][0].apply(n,arguments)},{72:72,77:77}],80:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],81:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(79),s=e(86).inherits,u=e(80);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(52))},{52:52,79:79,80:80,86:86}],82:[function(e,t,n){"use strict";function r(){this.length=0}r.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},r.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},r.prototype.slice=function(e,t){e="undefined"==typeof e?0:e,t="undefined"==typeof t?1/0:t;for(var n=[],r=0,i=this.first;i&&!(--t<0);i=i.next)++r>e&&n.push(i.item);return n},t.exports=r},{}],83:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],84:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{33:33}],85:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],86:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&B(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=f(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(t);if(0===a.length){if(B(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return c(t)}var v="",b=!1,_=["{","}"];if(p(t)&&(b=!0,_=["[","]"]),B(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),S(t)&&(v=" "+Date.prototype.toUTCString.call(t)),x(t)&&(v=" "+c(t)),0===a.length&&(!b||0==t.length))return _[0]+v+_[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=b?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,b)}),e.seen.pop(),d(k,v,_)}function f(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function B(e){return"function"==typeof e}function R(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var T=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(f in r)r.hasOwnProperty(f)&&u.push(f); +for(t.push({val:"}"}),a=u.length-1;a>=0;a--)c=u[a],l=r[c],h=a>0?",":"",h+=JSON.stringify(c)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,f,c,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":f={element:[],index:l.length},l.push(f.element),h.push(f);break;case"{":c={element:{},index:l.length},l.push(c.element),h.push(c);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],88:[function(e,t,n){function r(){for(var e={},t=0;t>>1,n(e[r],t)<0?i=r+1:o=r;return i}function $(e,t,n){var r=H(e,t,n);e.splice(r,0,t)}function G(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var y=g.ids[2],v=0,b=y.length;v0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],f=k.docStore.readStream(i),c=Fe.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:c}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=K(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,c=Ae(a),l=je(a,c);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return f.unpipe(),f.destroy(),void r()}if(e.include_docs){var h=a.rev_map[c];k.bySeqStore.get(y(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Me(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){c.end()});f.on("error",t),f.pipe(c)})}),E._changes=function(e){function t(){e.done=!0,f&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=y(e.since||0));var f,c=e.doc_ids&&new g(e.doc_ids),l=M(e),h=new p;f="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),b=Fe.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Me([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),f&&o.push(r)),void d())}var r=Ae(t);if(t.seq!==g)return d();if(a=g,r===b._rev)return n(b);var i=t.rev_map[r];k.bySeqStore.get(y(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=v(n.key),b=n.value;if(g===e.since&&!i)return d();if(c&&!c.has(b._id))return d();var m;return(m=h.get(b._id))?p(m):void k.docStore.get(b._id,function(t,n){return e.cancelled||e.done||w.isClosed()||oe(n.id)?d():(h.set(b._id,n),void p(n))})},function(t){return e.cancelled?t():(f&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(Ne.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var st=Array.prototype.slice,ut=Array.prototype.forEach;Pe(A,Error),A.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var ft,ct=(new A({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new A({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new A({status:404,error:"not_found", +reason:"missing"})),lt=new A({status:409,error:"conflict",reason:"Document update conflict"}),ht=new A({status:400,error:"bad_request",reason:"_id field must contain a string"}),dt=new A({status:412,error:"missing_id",reason:"_id is required for puts"}),pt=new A({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),gt=new A({status:412,error:"precondition_failed",reason:"Database not open"}),yt=(new A({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new A({status:500,error:"badarg",reason:"Some query argument is invalid"})),vt=(new A({status:400,error:"invalid_request",reason:"Request was invalid"}),new A({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new A({status:500,error:"doc_validation",reason:"Bad special document member"})),bt=new A({status:400,error:"bad_request",reason:"Something wrong with the request"}),mt=(new A({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new A({status:404,error:"not_found",reason:"Database not found"}),new A({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new A({status:500,error:"web_sql_went_bad",reason:"unknown"}),new A({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new A({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new A({status:400,error:"bad_request",reason:"Invalid rev format"})),_t=(new A({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new A({status:412,error:"missing_stub"})),wt=(new A({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),T.name);ft=wt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var Et=ft,kt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),St=q(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),xt=q(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),Bt=function(e){return atob(e)},Rt=function(e){return btoa(e)},At=n.setImmediate||n.setTimeout,jt=32768;Re.prototype.get=function(e,n,r){var i=Be(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Re.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var Ot="document-store",Mt="by-sequence",Tt="attach-store",Lt="attach-binary-store",Ct="local-store",Dt="meta-store",qt=new p,Nt="_local_last_update_seq",It="_local_doc_count",Pt="_local_uuid",Ut="md5-",Wt={encode:Ee,decode:we,buffer:!1,type:"cheap-json"},Ft=new x;Le.valid=function(){return!!n.indexedDB},Le.use_prefix=!0;var zt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");zt?Ce(zt):B("error",'fruitdown adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(52),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(8).Buffer)},{11:11,21:21,25:25,28:28,33:33,36:36,4:4,42:42,48:48,49:49,52:52,60:60,61:61,8:8,81:81,87:87,pouchdb:"pouchdb"}]},{},[89]); diff --git a/lib/pouchdb/dist/pouchdb.js b/lib/pouchdb/dist/pouchdb.js index 9c7bac06..2cc72b66 100644 --- a/lib/pouchdb/dist/pouchdb.js +++ b/lib/pouchdb/dist/pouchdb.js @@ -1,4 +1,4 @@ -// PouchDB 6.0.6 +// PouchDB 6.0.7 // // (c) 2012-2016 Dale Harvey and the PouchDB team // PouchDB may be freely distributed under the Apache license, version 2.0. @@ -208,7 +208,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = _dereq_(10); +exports.humanize = _dereq_(9); /** * The currently active debug mode names, and names to skip. @@ -393,7 +393,7 @@ function coerce(val) { return val; } -},{"10":10}],4:[function(_dereq_,module,exports){ +},{"9":9}],4:[function(_dereq_,module,exports){ (function (root, factory) { /* istanbul ignore next */ if (typeof define === 'function' && define.amd) { @@ -1014,41 +1014,6 @@ if (typeof Object.create === 'function') { } },{}],8:[function(_dereq_,module,exports){ -(function(factory) { - if(typeof exports === 'object') { - factory(exports); - } else { - factory(this); - } -}).call(this, function(root) { - - var slice = Array.prototype.slice, - each = Array.prototype.forEach; - - var extend = function(obj) { - if(typeof obj !== 'object') throw obj + ' is not an object' ; - - var sources = slice.call(arguments, 1); - - each.call(sources, function(source) { - if(source) { - for(var prop in source) { - if(typeof source[prop] === 'object' && obj[prop]) { - extend.call(obj, obj[prop], source[prop]); - } else { - obj[prop] = source[prop]; - } - } - } - }); - - return obj; - } - - root.extend = extend; -}); - -},{}],9:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(6); @@ -1303,7 +1268,7 @@ function race(iterable) { } } -},{"6":6}],10:[function(_dereq_,module,exports){ +},{"6":6}],9:[function(_dereq_,module,exports){ /** * Helpers. */ @@ -1430,7 +1395,7 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],11:[function(_dereq_,module,exports){ +},{}],10:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -1612,7 +1577,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],12:[function(_dereq_,module,exports){ +},{}],11:[function(_dereq_,module,exports){ // Generated by CoffeeScript 1.9.2 (function() { var hasProp = {}.hasOwnProperty, @@ -1636,7 +1601,7 @@ process.umask = function() { return 0; }; }).call(this); -},{}],13:[function(_dereq_,module,exports){ +},{}],12:[function(_dereq_,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -2341,7 +2306,7 @@ process.umask = function() { return 0; }; return SparkMD5; })); -},{}],14:[function(_dereq_,module,exports){ +},{}],13:[function(_dereq_,module,exports){ 'use strict'; /** @@ -2516,82 +2481,25 @@ exports.parse = function (str) { } }; -},{}],15:[function(_dereq_,module,exports){ +},{}],14:[function(_dereq_,module,exports){ (function (process,global){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var jsExtend = _dereq_(8); +var lie = _interopDefault(_dereq_(8)); +var getArguments = _interopDefault(_dereq_(1)); var debug = _interopDefault(_dereq_(2)); -var inherits = _interopDefault(_dereq_(7)); -var lie = _interopDefault(_dereq_(9)); var events = _dereq_(5); -var getArguments = _interopDefault(_dereq_(1)); -var scopedEval = _interopDefault(_dereq_(12)); -var Md5 = _interopDefault(_dereq_(13)); -var vuvuzela = _interopDefault(_dereq_(14)); +var inherits = _interopDefault(_dereq_(7)); +var scopedEval = _interopDefault(_dereq_(11)); +var Md5 = _interopDefault(_dereq_(12)); +var vuvuzela = _interopDefault(_dereq_(13)); var PromisePool = _interopDefault(_dereq_(4)); /* istanbul ignore next */ var PouchPromise = typeof Promise === 'function' ? Promise : lie; -// based on https://github.com/montagejs/collections -function mangle(key) { - return '$' + key; -} -function unmangle(key) { - return key.substring(1); -} -function _Map() { - this.store = {}; -} -_Map.prototype.get = function (key) { - var mangled = mangle(key); - return this.store[mangled]; -}; -_Map.prototype.set = function (key, value) { - var mangled = mangle(key); - this.store[mangled] = value; - return true; -}; -_Map.prototype.has = function (key) { - var mangled = mangle(key); - return mangled in this.store; -}; -_Map.prototype["delete"] = function (key) { - var mangled = mangle(key); - var res = mangled in this.store; - delete this.store[mangled]; - return res; -}; -_Map.prototype.forEach = function (cb) { - var keys = Object.keys(this.store); - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i]; - var value = this.store[key]; - key = unmangle(key); - cb(value, key); - } -}; - -function _Set(array) { - this.store = new _Map(); - - // init with an array - if (array && Array.isArray(array)) { - for (var i = 0, len = array.length; i < len; i++) { - this.add(array[i]); - } - } -} -_Set.prototype.add = function (key) { - return this.store.set(key, true); -}; -_Set.prototype.has = function (key) { - return this.store.has(key); -}; - function isBinaryObject(object) { return (typeof ArrayBuffer !== 'undefined' && object instanceof ArrayBuffer) || (typeof Blob !== 'undefined' && object instanceof Blob); @@ -2961,7 +2869,7 @@ function hasLocalStorage() { return hasLocal; } -inherits(Changes$1, events.EventEmitter); +inherits(Changes, events.EventEmitter); /* istanbul ignore next */ function attachBrowserEvents(self) { @@ -2986,13 +2894,13 @@ function attachBrowserEvents(self) { } } -function Changes$1() { +function Changes() { events.EventEmitter.call(this); this._listeners = {}; attachBrowserEvents(this); } -Changes$1.prototype.addListener = function (dbName, id, db, opts) { +Changes.prototype.addListener = function (dbName, id, db, opts) { /* istanbul ignore if */ if (this._listeners[id]) { return; @@ -3037,7 +2945,7 @@ Changes$1.prototype.addListener = function (dbName, id, db, opts) { this.on(dbName, eventFunction); }; -Changes$1.prototype.removeListener = function (dbName, id) { +Changes.prototype.removeListener = function (dbName, id) { /* istanbul ignore if */ if (!(id in this._listeners)) { return; @@ -3049,7 +2957,7 @@ Changes$1.prototype.removeListener = function (dbName, id) { /* istanbul ignore next */ -Changes$1.prototype.notifyLocalWindows = function (dbName) { +Changes.prototype.notifyLocalWindows = function (dbName) { //do a useless change on a storage thing //in order to get other windows's listeners to activate if (isChromeApp()) { @@ -3059,7 +2967,7 @@ Changes$1.prototype.notifyLocalWindows = function (dbName) { } }; -Changes$1.prototype.notify = function (dbName) { +Changes.prototype.notify = function (dbName) { this.emit(dbName); this.notifyLocalWindows(dbName); }; @@ -3106,6 +3014,35 @@ function explainError(status, str) { guardedConsole('info', 'The above ' + status + ' is totally normal. ' + str); } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -3570,6 +3507,62 @@ function uuid(len, radix) { return out; } +// based on https://github.com/montagejs/collections +function mangle(key) { + return '$' + key; +} +function unmangle(key) { + return key.substring(1); +} +function _Map() { + this.store = {}; +} +_Map.prototype.get = function (key) { + var mangled = mangle(key); + return this.store[mangled]; +}; +_Map.prototype.set = function (key, value) { + var mangled = mangle(key); + this.store[mangled] = value; + return true; +}; +_Map.prototype.has = function (key) { + var mangled = mangle(key); + return mangled in this.store; +}; +_Map.prototype["delete"] = function (key) { + var mangled = mangle(key); + var res = mangled in this.store; + delete this.store[mangled]; + return res; +}; +_Map.prototype.forEach = function (cb) { + var keys = Object.keys(this.store); + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var value = this.store[key]; + key = unmangle(key); + cb(value, key); + } +}; + +function _Set(array) { + this.store = new _Map(); + + // init with an array + if (array && Array.isArray(array)) { + for (var i = 0, len = array.length; i < len; i++) { + this.add(array[i]); + } + } +} +_Set.prototype.add = function (key) { + return this.store.set(key, true); +}; +_Set.prototype.has = function (key) { + return this.store.has(key); +}; + // We fetch all leafs of the revision tree, and sort them based on tree length // and whether they were deleted, undeleted documents with the longest revision // tree (most edits) win @@ -4002,7 +3995,7 @@ function evalView(input) { return scopedEval(code, {}); } -inherits(Changes, events.EventEmitter); +inherits(Changes$1, events.EventEmitter); function tryCatchInChangeListener(self, change) { // isolate try/catches to avoid V8 deoptimizations @@ -4013,7 +4006,7 @@ function tryCatchInChangeListener(self, change) { } } -function Changes(db, opts, callback) { +function Changes$1(db, opts, callback) { events.EventEmitter.call(this); var self = this; this.db = db; @@ -4083,7 +4076,7 @@ function Changes(db, opts, callback) { self.doChanges(opts); } } -Changes.prototype.cancel = function () { +Changes$1.prototype.cancel = function () { this.isCancelled = true; if (this.db.taskqueue.isReady) { this.emit('cancel'); @@ -4113,7 +4106,7 @@ function processChange(doc, metadata, opts) { return change; } -Changes.prototype.doChanges = function (opts) { +Changes$1.prototype.doChanges = function (opts) { var self = this; var callback = opts.complete; @@ -4177,7 +4170,7 @@ Changes.prototype.doChanges = function (opts) { } }; -Changes.prototype.filterChanges = function (opts) { +Changes$1.prototype.filterChanges = function (opts) { var self = this; var callback = opts.complete; if (opts.filter === '_view') { @@ -4333,7 +4326,7 @@ function allDocsKeysQuery(api, opts, callback) { offset: opts.skip }; return PouchPromise.all(keys.map(function (key) { - var subOpts = jsExtend.extend({key: key, deleted: 'ok'}, opts); + var subOpts = extend$1({key: key, deleted: 'ok'}, opts); ['limit', 'skip', 'keys'].forEach(function (optKey) { delete subOpts[optKey]; }); @@ -4925,7 +4918,7 @@ AbstractPouchDB.prototype.changes = function (opts, callback) { callback = opts; opts = {}; } - return new Changes(this, opts, callback); + return new Changes$1(this, opts, callback); }; AbstractPouchDB.prototype.close = adapterFun('close', function (callback) { @@ -5332,7 +5325,7 @@ PouchDB.defaults = function (defaultOpts) { delete opts.name; } - opts = jsExtend.extend({}, defaultOpts, opts); + opts = extend$1({}, defaultOpts, opts); PouchDB.call(this, name, opts); } @@ -5349,7 +5342,7 @@ PouchDB.defaults = function (defaultOpts) { }; // managed automatically by set-version.js -var version = "6.0.6"; +var version = "6.0.7"; PouchDB.version = version; @@ -6176,7 +6169,7 @@ function postProcessAttachments(results, asBlob) { var type = attObj.content_type; return new PouchPromise(function (resolve) { readBlobData(body, type, asBlob, function (data) { - row.doc._attachments[att] = jsExtend.extend( + row.doc._attachments[att] = extend$1( pick(attObj, ['digest', 'content_type']), {data: data} ); @@ -6812,7 +6805,7 @@ function checkBlobSupport(txn) { var cachedDBs = new _Map(); var blobSupportPromise; -var idbChanges = new Changes$1(); +var idbChanges = new Changes(); var openReqList = new _Map(); function IdbPouch(opts, callback) { @@ -8345,7 +8338,7 @@ function openDB$1(opts) { return cachedResult; } -var websqlChanges = new Changes$1(); +var websqlChanges = new Changes(); function fetchAttachmentsIfNecessary$1(doc, opts, api, txn, cb) { var attachments = Object.keys(doc._attachments || {}); @@ -8364,7 +8357,7 @@ function fetchAttachmentsIfNecessary$1(doc, opts, api, txn, cb) { var attObj = doc._attachments[att]; var attOpts = {binary: opts.binary, ctx: txn}; api._getAttachment(doc._id, att, attObj, attOpts, function (_, data) { - doc._attachments[att] = jsExtend.extend( + doc._attachments[att] = extend$1( pick(attObj, ['digest', 'content_type']), { data: data } ); @@ -8422,7 +8415,7 @@ function WebSqlPouch$1(opts, callback) { // extend the options here, because sqlite plugin has a ton of options // and they are constantly changing, so it's more prudent to allow anything - var websqlOpts = jsExtend.extend({}, opts, { + var websqlOpts = extend$1({}, opts, { version: POUCH_VERSION, description: opts.name, size: size @@ -8854,7 +8847,7 @@ function WebSqlPouch$1(opts, callback) { var tx = opts.ctx; if (!tx) { return db.readTransaction(function (txn) { - api._get(id, jsExtend.extend({ctx: txn}, opts), callback); + api._get(id, extend$1({ctx: txn}, opts), callback); }); } @@ -9392,7 +9385,7 @@ function openDB(name, version, description, size) { } function WebSQLPouch(opts, callback) { - var _opts = jsExtend.extend({ + var _opts = extend$1({ websql: openDB }, opts); @@ -9680,7 +9673,7 @@ function ajaxCore(options, callback) { cache: false }; - options = jsExtend.extend(defaultOptions, options); + options = extend$1(defaultOptions, options); function onSuccess(obj, resp, cb) { if (!options.binary && options.json && typeof obj === 'string') { @@ -9926,7 +9919,7 @@ function HttpPouch(opts, callback) { function ajax$$(userOpts, options, callback) { var reqAjax = userOpts.ajax || {}; - var reqOpts = jsExtend.extend(clone(ajaxOpts), reqAjax, options); + var reqOpts = extend$1(clone(ajaxOpts), reqAjax, options); log$1(reqOpts.method + ' ' + reqOpts.url); return api._ajax(reqOpts, callback); } @@ -12396,19 +12389,24 @@ function getDocs(src, target, diffs, state) { return doc._attachments && Object.keys(doc._attachments).length > 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne$1(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -13308,8 +13306,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? jsExtend.extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? jsExtend.extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? extend$1({}, opts, opts.push) : opts; + var optsPull = opts.pull ? extend$1({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); @@ -13524,6 +13522,6 @@ PouchDB.plugin(IDBPouch) // aggressive bundle. module.exports = PouchDB; -}).call(this,_dereq_(11),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"1":1,"11":11,"12":12,"13":13,"14":14,"2":2,"4":4,"5":5,"7":7,"8":8,"9":9}]},{},[15])(15) +}).call(this,_dereq_(10),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"1":1,"10":10,"11":11,"12":12,"13":13,"2":2,"4":4,"5":5,"7":7,"8":8}]},{},[14])(14) }); \ No newline at end of file diff --git a/lib/pouchdb/dist/pouchdb.localstorage.js b/lib/pouchdb/dist/pouchdb.localstorage.js index b092ac73..fbe5064d 100644 --- a/lib/pouchdb/dist/pouchdb.localstorage.js +++ b/lib/pouchdb/dist/pouchdb.localstorage.js @@ -1,4 +1,4 @@ -// PouchDB localStorage plugin 6.0.6 +// PouchDB localStorage plugin 6.0.7 // Based on localstorage-down: https://github.com/No9/localstorage-down // // (c) 2012-2016 Dale Harvey and the PouchDB team @@ -88,8 +88,8 @@ AbstractChainedBatch.prototype.write = function (options, callback) { } module.exports = AbstractChainedBatch -}).call(this,_dereq_(57)) -},{"57":57}],2:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56}],2:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -141,12 +141,12 @@ AbstractIterator.prototype.end = function (callback) { module.exports = AbstractIterator -}).call(this,_dereq_(57)) -},{"57":57}],3:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56}],3:[function(_dereq_,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ -var xtend = _dereq_(93) +var xtend = _dereq_(92) , AbstractIterator = _dereq_(2) , AbstractChainedBatch = _dereq_(1) @@ -403,8 +403,8 @@ module.exports.AbstractLevelDOWN = AbstractLevelDOWN module.exports.AbstractIterator = AbstractIterator module.exports.AbstractChainedBatch = AbstractChainedBatch -}).call(this,{"isBuffer":_dereq_(32)},_dereq_(57)) -},{"1":1,"2":2,"32":32,"57":57,"93":93}],4:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(32)},_dereq_(56)) +},{"1":1,"2":2,"32":32,"56":56,"92":92}],4:[function(_dereq_,module,exports){ 'use strict'; module.exports = argsArray; @@ -2819,7 +2819,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = _dereq_(55); +exports.humanize = _dereq_(54); /** * The currently active debug mode names, and names to skip. @@ -3004,8 +3004,8 @@ function coerce(val) { return val; } -},{"55":55}],13:[function(_dereq_,module,exports){ -var util = _dereq_(91) +},{"54":54}],13:[function(_dereq_,module,exports){ +var util = _dereq_(90) , AbstractIterator = _dereq_(18).AbstractIterator @@ -3040,9 +3040,9 @@ DeferredIterator.prototype._operation = function (method, args) { module.exports = DeferredIterator; -},{"18":18,"91":91}],14:[function(_dereq_,module,exports){ +},{"18":18,"90":90}],14:[function(_dereq_,module,exports){ (function (Buffer,process){ -var util = _dereq_(91) +var util = _dereq_(90) , AbstractLevelDOWN = _dereq_(18).AbstractLevelDOWN , DeferredIterator = _dereq_(13) @@ -3099,8 +3099,8 @@ DeferredLevelDOWN.prototype._iterator = function (options) { module.exports = DeferredLevelDOWN module.exports.DeferredIterator = DeferredIterator -}).call(this,{"isBuffer":_dereq_(32)},_dereq_(57)) -},{"13":13,"18":18,"32":32,"57":57,"91":91}],15:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(32)},_dereq_(56)) +},{"13":13,"18":18,"32":32,"56":56,"90":90}],15:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -3182,10 +3182,10 @@ AbstractChainedBatch.prototype.write = function (options, callback) { } module.exports = AbstractChainedBatch -}).call(this,_dereq_(57)) -},{"57":57}],16:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56}],16:[function(_dereq_,module,exports){ arguments[4][2][0].apply(exports,arguments) -},{"2":2,"57":57}],17:[function(_dereq_,module,exports){ +},{"2":2,"56":56}],17:[function(_dereq_,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -3460,8 +3460,8 @@ AbstractLevelDOWN.prototype._checkKey = function (obj, type) { module.exports = AbstractLevelDOWN -}).call(this,{"isBuffer":_dereq_(32)},_dereq_(57)) -},{"15":15,"16":16,"20":20,"32":32,"57":57}],18:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(32)},_dereq_(56)) +},{"15":15,"16":16,"20":20,"32":32,"56":56}],18:[function(_dereq_,module,exports){ exports.AbstractLevelDOWN = _dereq_(17) exports.AbstractIterator = _dereq_(16) exports.AbstractChainedBatch = _dereq_(15) @@ -4571,7 +4571,7 @@ if (typeof exports === 'object') { },{}],27:[function(_dereq_,module,exports){ (function (global){ var exports = module.exports = {}; -var localStorageMemory = _dereq_(53); +var localStorageMemory = _dereq_(52); exports.hasLocalStorage = _dereq_(26); /** @@ -4642,7 +4642,7 @@ exports.getObject = function (store, key) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"26":26,"53":53}],28:[function(_dereq_,module,exports){ +},{"26":26,"52":52}],28:[function(_dereq_,module,exports){ var api = _dereq_(27); module.exports = api.create(); @@ -4861,42 +4861,7 @@ module.exports = Array.isArray || function (arr) { }; },{}],34:[function(_dereq_,module,exports){ -(function(factory) { - if(typeof exports === 'object') { - factory(exports); - } else { - factory(this); - } -}).call(this, function(root) { - - var slice = Array.prototype.slice, - each = Array.prototype.forEach; - - var extend = function(obj) { - if(typeof obj !== 'object') throw obj + ' is not an object' ; - - var sources = slice.call(arguments, 1); - - each.call(sources, function(source) { - if(source) { - for(var prop in source) { - if(typeof source[prop] === 'object' && obj[prop]) { - extend.call(obj, obj[prop], source[prop]); - } else { - obj[prop] = source[prop]; - } - } - } - }); - - return obj; - } - - root.extend = extend; -}); - -},{}],35:[function(_dereq_,module,exports){ -var encodings = _dereq_(36); +var encodings = _dereq_(35); module.exports = Codec; @@ -5003,7 +4968,7 @@ Codec.prototype.valueAsBuffer = function(opts){ }; -},{"36":36}],36:[function(_dereq_,module,exports){ +},{"35":35}],35:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -5085,7 +5050,7 @@ function isBinary(data){ }).call(this,_dereq_(8).Buffer) -},{"8":8}],37:[function(_dereq_,module,exports){ +},{"8":8}],36:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2015 LevelUP contributors * See list at * MIT License @@ -5109,11 +5074,11 @@ module.exports = { , EncodingError : createError('EncodingError', LevelUPError) } -},{"23":23}],38:[function(_dereq_,module,exports){ +},{"23":23}],37:[function(_dereq_,module,exports){ var inherits = _dereq_(31); -var Readable = _dereq_(65).Readable; -var extend = _dereq_(39); -var EncodingError = _dereq_(37).EncodingError; +var Readable = _dereq_(64).Readable; +var extend = _dereq_(38); +var EncodingError = _dereq_(36).EncodingError; module.exports = ReadStream; inherits(ReadStream, Readable); @@ -5167,17 +5132,17 @@ ReadStream.prototype._cleanup = function(){ }; -},{"31":31,"37":37,"39":39,"65":65}],39:[function(_dereq_,module,exports){ +},{"31":31,"36":36,"38":38,"64":64}],38:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],40:[function(_dereq_,module,exports){ +},{"20":20}],39:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var util = _dereq_(42) - , WriteError = _dereq_(37).WriteError +var util = _dereq_(41) + , WriteError = _dereq_(36).WriteError , getOptions = util.getOptions , dispatchError = util.dispatchError @@ -5254,7 +5219,7 @@ Batch.prototype.write = function (callback) { module.exports = Batch -},{"37":37,"42":42}],41:[function(_dereq_,module,exports){ +},{"36":36,"41":41}],40:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at @@ -5263,14 +5228,14 @@ module.exports = Batch */ var EventEmitter = _dereq_(25).EventEmitter - , inherits = _dereq_(91).inherits - , deprecate = _dereq_(91).deprecate - , extend = _dereq_(45) - , prr = _dereq_(58) + , inherits = _dereq_(90).inherits + , deprecate = _dereq_(90).deprecate + , extend = _dereq_(44) + , prr = _dereq_(57) , DeferredLevelDOWN = _dereq_(14) - , IteratorStream = _dereq_(38) + , IteratorStream = _dereq_(37) - , errors = _dereq_(37) + , errors = _dereq_(36) , WriteError = errors.WriteError , ReadError = errors.ReadError , NotFoundError = errors.NotFoundError @@ -5278,9 +5243,9 @@ var EventEmitter = _dereq_(25).EventEmitter , EncodingError = errors.EncodingError , InitializationError = errors.InitializationError - , util = _dereq_(42) - , Batch = _dereq_(40) - , Codec = _dereq_(43) + , util = _dereq_(41) + , Batch = _dereq_(39) + , Codec = _dereq_(42) , getOptions = util.getOptions , defaultOptions = util.defaultOptions @@ -5645,7 +5610,7 @@ function utilStatic (name) { } module.exports = LevelUP -module.exports.errors = _dereq_(37) +module.exports.errors = _dereq_(36) module.exports.destroy = deprecate( utilStatic('destroy') , 'levelup.destroy() is deprecated. Use leveldown.destroy() instead' @@ -5656,17 +5621,17 @@ module.exports.repair = deprecate( ) -}).call(this,_dereq_(57)) -},{"14":14,"25":25,"37":37,"38":38,"40":40,"42":42,"43":43,"45":45,"57":57,"58":58,"91":91}],42:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"14":14,"25":25,"36":36,"37":37,"39":39,"41":41,"42":42,"44":44,"56":56,"57":57,"90":90}],41:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var extend = _dereq_(45) - , LevelUPError = _dereq_(37).LevelUPError - , format = _dereq_(91).format +var extend = _dereq_(44) + , LevelUPError = _dereq_(36).LevelUPError + , format = _dereq_(90).format , defaultOptions = { createIfMissing : true , errorIfExists : false @@ -5689,7 +5654,7 @@ function getLevelDOWN () { if (leveldown) return leveldown - var requiredVersion = _dereq_(46).devDependencies.leveldown + var requiredVersion = _dereq_(45).devDependencies.leveldown , leveldownVersion try { @@ -5736,9 +5701,9 @@ module.exports = { , isDefined : isDefined } -},{"37":37,"45":45,"46":46,"6":6,"91":91}],43:[function(_dereq_,module,exports){ -arguments[4][35][0].apply(exports,arguments) -},{"35":35,"44":44}],44:[function(_dereq_,module,exports){ +},{"36":36,"44":44,"45":45,"6":6,"90":90}],42:[function(_dereq_,module,exports){ +arguments[4][34][0].apply(exports,arguments) +},{"34":34,"43":43}],43:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -5818,58 +5783,56 @@ function isBinary(data){ }).call(this,_dereq_(8).Buffer) -},{"8":8}],45:[function(_dereq_,module,exports){ +},{"8":8}],44:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],46:[function(_dereq_,module,exports){ +},{"20":20}],45:[function(_dereq_,module,exports){ module.exports={ "_args": [ [ { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "/Users/nolan/workspace/pouchdb" ] ], - "_from": "levelup@1.3.2", - "_id": "levelup@1.3.2", + "_from": "levelup@1.3.3", + "_id": "levelup@1.3.3", "_inCache": true, "_installable": true, "_location": "/levelup", - "_nodeVersion": "6.1.0", + "_nodeVersion": "4.4.7", "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446" }, "_npmUser": { - "name": "ralphtheninja", - "email": "ralphtheninja@riseup.net" + "name": "juliangruber", + "email": "julian@juliangruber.com" }, - "_npmVersion": "3.8.6", + "_npmVersion": "2.15.8", "_phantomChildren": {}, "_requested": { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "_requiredBy": [ - "/", - "/pouchdb", - "/pouchdb-adapter-leveldb-core" + "/" ], - "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz", - "_shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", + "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz", + "_shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", "_shrinkwrap": null, - "_spec": "levelup@1.3.2", + "_spec": "levelup@1.3.3", "_where": "/Users/nolan/workspace/pouchdb", "browser": { "leveldown": false, @@ -5977,10 +5940,10 @@ module.exports={ }, "directories": {}, "dist": { - "shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", - "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz" + "shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", + "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz" }, - "gitHead": "bcc242cfc4ec035f9228a5cd54903cb126659a00", + "gitHead": "cced27dc9f0095823be5ed388ec601ec2bfe7366", "homepage": "https://github.com/level/levelup", "keywords": [ "leveldb", @@ -6017,10 +5980,10 @@ module.exports={ "scripts": { "test": "tape test/*-test.js | faucet" }, - "version": "1.3.2" + "version": "1.3.3" } -},{}],47:[function(_dereq_,module,exports){ +},{}],46:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(30); @@ -6275,7 +6238,7 @@ function race(iterable) { } } -},{"30":30}],48:[function(_dereq_,module,exports){ +},{"30":30}],47:[function(_dereq_,module,exports){ (function (process,global,Buffer){ 'use strict'; @@ -6283,9 +6246,9 @@ var inherits = _dereq_(31); var AbstractLevelDOWN = _dereq_(3).AbstractLevelDOWN; var AbstractIterator = _dereq_(3).AbstractIterator; -var LocalStorage = _dereq_(50).LocalStorage; -var LocalStorageCore = _dereq_(49); -var utils = _dereq_(52); +var LocalStorage = _dereq_(49).LocalStorage; +var LocalStorageCore = _dereq_(48); +var utils = _dereq_(51); // see http://stackoverflow.com/a/15349865/680742 var nextTick = global.setImmediate || process.nextTick; @@ -6578,8 +6541,8 @@ function checkKeyValue(obj, type) { module.exports = LD; -}).call(this,_dereq_(57),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) -},{"3":3,"31":31,"49":49,"50":50,"52":52,"57":57,"8":8}],49:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) +},{"3":3,"31":31,"48":48,"49":49,"51":51,"56":56,"8":8}],48:[function(_dereq_,module,exports){ (function (process,global){ 'use strict'; @@ -6678,8 +6641,8 @@ LocalStorageCore.destroy = function (dbname, callback) { }; module.exports = LocalStorageCore; -}).call(this,_dereq_(57),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"28":28,"57":57}],50:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"28":28,"56":56}],49:[function(_dereq_,module,exports){ (function (Buffer){ 'use strict'; @@ -6694,9 +6657,9 @@ var uintRegex = new RegExp('^' + uintPrefix); var bufferPrefix = 'Buff:'; var bufferRegex = new RegExp('^' + bufferPrefix); -var utils = _dereq_(52); -var LocalStorageCore = _dereq_(49); -var TaskQueue = _dereq_(51); +var utils = _dereq_(51); +var LocalStorageCore = _dereq_(48); +var TaskQueue = _dereq_(50); var d64 = _dereq_(10); function LocalStorage(dbname) { @@ -6809,12 +6772,12 @@ LocalStorage.prototype.length = function (callback) { exports.LocalStorage = LocalStorage; }).call(this,{"isBuffer":_dereq_(32)}) -},{"10":10,"32":32,"49":49,"51":51,"52":52}],51:[function(_dereq_,module,exports){ +},{"10":10,"32":32,"48":48,"50":50,"51":51}],50:[function(_dereq_,module,exports){ (function (process,global){ 'use strict'; var argsarray = _dereq_(4); -var Queue = _dereq_(87); +var Queue = _dereq_(86); // see http://stackoverflow.com/a/15349865/680742 var nextTick = global.setImmediate || process.nextTick; @@ -6848,8 +6811,8 @@ TaskQueue.prototype.processNext = function () { module.exports = TaskQueue; -}).call(this,_dereq_(57),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"4":4,"57":57,"87":87}],52:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"4":4,"56":56,"86":86}],51:[function(_dereq_,module,exports){ 'use strict'; // taken from rvagg/memdown commit 2078b40 exports.sortedIndexOf = function(arr, item) { @@ -6867,7 +6830,7 @@ exports.sortedIndexOf = function(arr, item) { return low; }; -},{}],53:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ (function(root) { var localStorageMemory = {}; var cache = {}; @@ -6951,7 +6914,7 @@ exports.sortedIndexOf = function(arr, item) { } })(this); -},{}],54:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ (function (Buffer){ exports.compare = function (a, b) { @@ -7101,7 +7064,7 @@ exports.filter = function (range, compare) { } }).call(this,{"isBuffer":_dereq_(32)}) -},{"32":32}],55:[function(_dereq_,module,exports){ +},{"32":32}],54:[function(_dereq_,module,exports){ /** * Helpers. */ @@ -7228,7 +7191,7 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],56:[function(_dereq_,module,exports){ +},{}],55:[function(_dereq_,module,exports){ (function (process){ 'use strict'; @@ -7274,8 +7237,8 @@ function nextTick(fn, arg1, arg2, arg3) { } } -}).call(this,_dereq_(57)) -},{"57":57}],57:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56}],56:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -7457,9 +7420,9 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],58:[function(_dereq_,module,exports){ +},{}],57:[function(_dereq_,module,exports){ arguments[4][24][0].apply(exports,arguments) -},{"24":24}],59:[function(_dereq_,module,exports){ +},{"24":24}],58:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7503,8 +7466,8 @@ var util = _dereq_(9); util.inherits = _dereq_(31); /**/ -var Readable = _dereq_(61); -var Writable = _dereq_(63); +var Readable = _dereq_(60); +var Writable = _dereq_(62); util.inherits(Duplex, Readable); @@ -7551,8 +7514,8 @@ function forEach (xs, f) { } } -}).call(this,_dereq_(57)) -},{"31":31,"57":57,"61":61,"63":63,"9":9}],60:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"31":31,"56":56,"60":60,"62":62,"9":9}],59:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -7580,7 +7543,7 @@ function forEach (xs, f) { module.exports = PassThrough; -var Transform = _dereq_(62); +var Transform = _dereq_(61); /**/ var util = _dereq_(9); @@ -7600,7 +7563,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"31":31,"62":62,"9":9}],61:[function(_dereq_,module,exports){ +},{"31":31,"61":61,"9":9}],60:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7626,7 +7589,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { module.exports = Readable; /**/ -var isArray = _dereq_(64); +var isArray = _dereq_(63); /**/ @@ -7644,7 +7607,7 @@ if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { }; /**/ -var Stream = _dereq_(67); +var Stream = _dereq_(66); /**/ var util = _dereq_(9); @@ -7717,7 +7680,7 @@ function ReadableState(options, stream) { this.encoding = null; if (options.encoding) { if (!StringDecoder) - StringDecoder = _dereq_(79).StringDecoder; + StringDecoder = _dereq_(78).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -7818,7 +7781,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function(enc) { if (!StringDecoder) - StringDecoder = _dereq_(79).StringDecoder; + StringDecoder = _dereq_(78).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; }; @@ -8585,8 +8548,8 @@ function indexOf (xs, x) { return -1; } -}).call(this,_dereq_(57)) -},{"25":25,"31":31,"57":57,"64":64,"67":67,"79":79,"8":8,"9":9}],62:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"25":25,"31":31,"56":56,"63":63,"66":66,"78":78,"8":8,"9":9}],61:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8653,7 +8616,7 @@ function indexOf (xs, x) { module.exports = Transform; -var Duplex = _dereq_(59); +var Duplex = _dereq_(58); /**/ var util = _dereq_(9); @@ -8798,7 +8761,7 @@ function done(stream, er) { return stream.push(null); } -},{"31":31,"59":59,"9":9}],63:[function(_dereq_,module,exports){ +},{"31":31,"58":58,"9":9}],62:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -8839,7 +8802,7 @@ var util = _dereq_(9); util.inherits = _dereq_(31); /**/ -var Stream = _dereq_(67); +var Stream = _dereq_(66); util.inherits(Writable, Stream); @@ -8921,7 +8884,7 @@ function WritableState(options, stream) { } function Writable(options) { - var Duplex = _dereq_(59); + var Duplex = _dereq_(58); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -9187,23 +9150,23 @@ function endWritable(stream, state, cb) { state.ended = true; } -}).call(this,_dereq_(57)) -},{"31":31,"57":57,"59":59,"67":67,"8":8,"9":9}],64:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"31":31,"56":56,"58":58,"66":66,"8":8,"9":9}],63:[function(_dereq_,module,exports){ module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; -},{}],65:[function(_dereq_,module,exports){ -var Stream = _dereq_(67); // hack to fix a circular dependency issue when used with browserify -exports = module.exports = _dereq_(61); +},{}],64:[function(_dereq_,module,exports){ +var Stream = _dereq_(66); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = _dereq_(60); exports.Stream = Stream; exports.Readable = exports; -exports.Writable = _dereq_(63); -exports.Duplex = _dereq_(59); -exports.Transform = _dereq_(62); -exports.PassThrough = _dereq_(60); +exports.Writable = _dereq_(62); +exports.Duplex = _dereq_(58); +exports.Transform = _dereq_(61); +exports.PassThrough = _dereq_(59); -},{"59":59,"60":60,"61":61,"62":62,"63":63,"67":67}],66:[function(_dereq_,module,exports){ +},{"58":58,"59":59,"60":60,"61":61,"62":62,"66":66}],65:[function(_dereq_,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -9908,7 +9871,7 @@ exports.PassThrough = _dereq_(60); return SparkMD5; })); -},{}],67:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -9936,11 +9899,11 @@ var EE = _dereq_(25).EventEmitter; var inherits = _dereq_(31); inherits(Stream, EE); -Stream.Readable = _dereq_(76); -Stream.Writable = _dereq_(78); -Stream.Duplex = _dereq_(68); -Stream.Transform = _dereq_(77); -Stream.PassThrough = _dereq_(75); +Stream.Readable = _dereq_(75); +Stream.Writable = _dereq_(77); +Stream.Duplex = _dereq_(67); +Stream.Transform = _dereq_(76); +Stream.PassThrough = _dereq_(74); // Backwards-compat with node 0.4.x Stream.Stream = Stream; @@ -10037,10 +10000,10 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"25":25,"31":31,"68":68,"75":75,"76":76,"77":77,"78":78}],68:[function(_dereq_,module,exports){ -module.exports = _dereq_(69) +},{"25":25,"31":31,"67":67,"74":74,"75":75,"76":76,"77":77}],67:[function(_dereq_,module,exports){ +module.exports = _dereq_(68) -},{"69":69}],69:[function(_dereq_,module,exports){ +},{"68":68}],68:[function(_dereq_,module,exports){ // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from @@ -10061,7 +10024,7 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var processNextTick = _dereq_(56); +var processNextTick = _dereq_(55); /**/ /**/ @@ -10069,8 +10032,8 @@ var util = _dereq_(9); util.inherits = _dereq_(31); /**/ -var Readable = _dereq_(71); -var Writable = _dereq_(73); +var Readable = _dereq_(70); +var Writable = _dereq_(72); util.inherits(Duplex, Readable); @@ -10116,7 +10079,7 @@ function forEach(xs, f) { f(xs[i], i); } } -},{"31":31,"56":56,"71":71,"73":73,"9":9}],70:[function(_dereq_,module,exports){ +},{"31":31,"55":55,"70":70,"72":72,"9":9}],69:[function(_dereq_,module,exports){ // a passthrough stream. // basically just the most minimal sort of Transform stream. // Every written chunk gets output as-is. @@ -10125,7 +10088,7 @@ function forEach(xs, f) { module.exports = PassThrough; -var Transform = _dereq_(72); +var Transform = _dereq_(71); /**/ var util = _dereq_(9); @@ -10143,14 +10106,14 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"31":31,"72":72,"9":9}],71:[function(_dereq_,module,exports){ +},{"31":31,"71":71,"9":9}],70:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(56); +var processNextTick = _dereq_(55); /**/ /**/ @@ -10198,7 +10161,7 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = _dereq_(74); +var BufferList = _dereq_(73); var StringDecoder; util.inherits(Readable, Stream); @@ -10217,7 +10180,7 @@ function prependListener(emitter, event, fn) { var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(69); + Duplex = Duplex || _dereq_(68); options = options || {}; @@ -10279,7 +10242,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(79).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(78).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -10287,7 +10250,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(69); + Duplex = Duplex || _dereq_(68); if (!(this instanceof Readable)) return new Readable(options); @@ -10390,7 +10353,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(79).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(78).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -11082,8 +11045,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(57)) -},{"25":25,"31":31,"33":33,"56":56,"57":57,"6":6,"69":69,"7":7,"74":74,"79":79,"8":8,"9":9}],72:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"25":25,"31":31,"33":33,"55":55,"56":56,"6":6,"68":68,"7":7,"73":73,"78":78,"8":8,"9":9}],71:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -11130,7 +11093,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(69); +var Duplex = _dereq_(68); /**/ var util = _dereq_(9); @@ -11264,7 +11227,7 @@ function done(stream, er) { return stream.push(null); } -},{"31":31,"69":69,"9":9}],73:[function(_dereq_,module,exports){ +},{"31":31,"68":68,"9":9}],72:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -11275,7 +11238,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(56); +var processNextTick = _dereq_(55); /**/ /**/ @@ -11291,7 +11254,7 @@ util.inherits = _dereq_(31); /**/ var internalUtil = { - deprecate: _dereq_(88) + deprecate: _dereq_(87) }; /**/ @@ -11324,7 +11287,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(69); + Duplex = Duplex || _dereq_(68); options = options || {}; @@ -11440,7 +11403,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(69); + Duplex = Duplex || _dereq_(68); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -11792,8 +11755,8 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(57)) -},{"25":25,"31":31,"56":56,"57":57,"69":69,"7":7,"8":8,"88":88,"9":9}],74:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"25":25,"31":31,"55":55,"56":56,"68":68,"7":7,"8":8,"87":87,"9":9}],73:[function(_dereq_,module,exports){ 'use strict'; var Buffer = _dereq_(8).Buffer; @@ -11858,36 +11821,36 @@ BufferList.prototype.concat = function (n) { } return ret; }; -},{"7":7,"8":8}],75:[function(_dereq_,module,exports){ -module.exports = _dereq_(70) +},{"7":7,"8":8}],74:[function(_dereq_,module,exports){ +module.exports = _dereq_(69) -},{"70":70}],76:[function(_dereq_,module,exports){ +},{"69":69}],75:[function(_dereq_,module,exports){ (function (process){ var Stream = (function (){ try { return _dereq_('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify } catch(_){} }()); -exports = module.exports = _dereq_(71); +exports = module.exports = _dereq_(70); exports.Stream = Stream || exports; exports.Readable = exports; -exports.Writable = _dereq_(73); -exports.Duplex = _dereq_(69); -exports.Transform = _dereq_(72); -exports.PassThrough = _dereq_(70); +exports.Writable = _dereq_(72); +exports.Duplex = _dereq_(68); +exports.Transform = _dereq_(71); +exports.PassThrough = _dereq_(69); if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { module.exports = Stream; } -}).call(this,_dereq_(57)) -},{"57":57,"69":69,"70":70,"71":71,"72":72,"73":73}],77:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56,"68":68,"69":69,"70":70,"71":71,"72":72}],76:[function(_dereq_,module,exports){ +module.exports = _dereq_(71) + +},{"71":71}],77:[function(_dereq_,module,exports){ module.exports = _dereq_(72) },{"72":72}],78:[function(_dereq_,module,exports){ -module.exports = _dereq_(73) - -},{"73":73}],79:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -12110,16 +12073,16 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"8":8}],80:[function(_dereq_,module,exports){ -arguments[4][69][0].apply(exports,arguments) -},{"31":31,"56":56,"69":69,"81":81,"83":83,"9":9}],81:[function(_dereq_,module,exports){ +},{"8":8}],79:[function(_dereq_,module,exports){ +arguments[4][68][0].apply(exports,arguments) +},{"31":31,"55":55,"68":68,"80":80,"82":82,"9":9}],80:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(56); +var processNextTick = _dereq_(55); /**/ /**/ @@ -12174,7 +12137,7 @@ util.inherits(Readable, Stream); var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(80); + Duplex = Duplex || _dereq_(79); options = options || {}; @@ -12233,7 +12196,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(79).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(78).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -12241,7 +12204,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(80); + Duplex = Duplex || _dereq_(79); if (!(this instanceof Readable)) return new Readable(options); @@ -12344,7 +12307,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(79).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(78).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -12994,8 +12957,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(57)) -},{"25":25,"31":31,"33":33,"56":56,"57":57,"6":6,"79":79,"8":8,"80":80,"9":9}],82:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"25":25,"31":31,"33":33,"55":55,"56":56,"6":6,"78":78,"79":79,"8":8,"9":9}],81:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -13042,7 +13005,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(80); +var Duplex = _dereq_(79); /**/ var util = _dereq_(9); @@ -13176,7 +13139,7 @@ function done(stream, er) { return stream.push(null); } -},{"31":31,"80":80,"9":9}],83:[function(_dereq_,module,exports){ +},{"31":31,"79":79,"9":9}],82:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -13187,7 +13150,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(56); +var processNextTick = _dereq_(55); /**/ /**/ @@ -13207,7 +13170,7 @@ util.inherits = _dereq_(31); /**/ var internalUtil = { - deprecate: _dereq_(88) + deprecate: _dereq_(87) }; /**/ @@ -13237,7 +13200,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(80); + Duplex = Duplex || _dereq_(79); options = options || {}; @@ -13354,7 +13317,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(80); + Duplex = Duplex || _dereq_(79); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -13694,16 +13657,16 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(57)) -},{"25":25,"31":31,"56":56,"57":57,"8":8,"80":80,"88":88,"9":9}],84:[function(_dereq_,module,exports){ -arguments[4][77][0].apply(exports,arguments) -},{"77":77,"82":82}],85:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"25":25,"31":31,"55":55,"56":56,"79":79,"8":8,"87":87,"9":9}],83:[function(_dereq_,module,exports){ +arguments[4][76][0].apply(exports,arguments) +},{"76":76,"81":81}],84:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],86:[function(_dereq_,module,exports){ +},{"20":20}],85:[function(_dereq_,module,exports){ (function (process){ -var Transform = _dereq_(84) - , inherits = _dereq_(91).inherits - , xtend = _dereq_(85) +var Transform = _dereq_(83) + , inherits = _dereq_(90).inherits + , xtend = _dereq_(84) function DestroyableTransform(opts) { Transform.call(this, opts) @@ -13798,8 +13761,8 @@ module.exports.obj = through2(function (options, transform, flush) { return t2 }) -}).call(this,_dereq_(57)) -},{"57":57,"84":84,"85":85,"91":91}],87:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56)) +},{"56":56,"83":83,"84":84,"90":90}],86:[function(_dereq_,module,exports){ 'use strict'; // Simple FIFO queue implementation to avoid having to do shift() @@ -13849,7 +13812,7 @@ Queue.prototype.slice = function (start, end) { module.exports = Queue; -},{}],88:[function(_dereq_,module,exports){ +},{}],87:[function(_dereq_,module,exports){ (function (global){ /** @@ -13920,16 +13883,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],89:[function(_dereq_,module,exports){ +},{}],88:[function(_dereq_,module,exports){ arguments[4][31][0].apply(exports,arguments) -},{"31":31}],90:[function(_dereq_,module,exports){ +},{"31":31}],89:[function(_dereq_,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],91:[function(_dereq_,module,exports){ +},{}],90:[function(_dereq_,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14456,7 +14419,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = _dereq_(90); +exports.isBuffer = _dereq_(89); function objectToString(o) { return Object.prototype.toString.call(o); @@ -14500,7 +14463,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = _dereq_(89); +exports.inherits = _dereq_(88); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -14518,8 +14481,8 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,_dereq_(57),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"57":57,"89":89,"90":90}],92:[function(_dereq_,module,exports){ +}).call(this,_dereq_(56),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"56":56,"88":88,"89":89}],91:[function(_dereq_,module,exports){ 'use strict'; /** @@ -14694,7 +14657,7 @@ exports.parse = function (str) { } }; -},{}],93:[function(_dereq_,module,exports){ +},{}],92:[function(_dereq_,module,exports){ module.exports = extend function extend() { @@ -14713,28 +14676,27 @@ function extend() { return target } -},{}],94:[function(_dereq_,module,exports){ +},{}],93:[function(_dereq_,module,exports){ (function (process,global,Buffer){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var levelup = _interopDefault(_dereq_(41)); -var ltgt = _interopDefault(_dereq_(54)); +var levelup = _interopDefault(_dereq_(40)); +var ltgt = _interopDefault(_dereq_(53)); var events = _dereq_(25); var events__default = _interopDefault(events); var inherits = _interopDefault(_dereq_(31)); -var Codec = _interopDefault(_dereq_(35)); -var ReadableStreamCore = _interopDefault(_dereq_(65)); -var through2 = _dereq_(86); +var Codec = _interopDefault(_dereq_(34)); +var ReadableStreamCore = _interopDefault(_dereq_(64)); +var through2 = _dereq_(85); var getArguments = _interopDefault(_dereq_(4)); var Deque = _interopDefault(_dereq_(21)); -var lie = _interopDefault(_dereq_(47)); +var lie = _interopDefault(_dereq_(46)); var debug = _interopDefault(_dereq_(11)); -var Md5 = _interopDefault(_dereq_(66)); -var vuvuzela = _interopDefault(_dereq_(92)); -var jsExtend = _dereq_(34); -var localstoragedown = _interopDefault(_dereq_(48)); +var Md5 = _interopDefault(_dereq_(65)); +var vuvuzela = _interopDefault(_dereq_(91)); +var localstoragedown = _interopDefault(_dereq_(47)); function isFunction(f) { return 'function' === typeof f; @@ -15415,6 +15377,35 @@ function guardedConsole(method) { } } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -18206,7 +18197,7 @@ function LevelPouch(opts, callback) { } function LocalStoragePouch(opts, callback) { - var _opts = jsExtend.extend({ + var _opts = extend$1({ db: localstoragedown }, opts); @@ -18233,5 +18224,5 @@ if (!PDB) { } else { LocalStoragePouchPlugin(PDB); } -}).call(this,_dereq_(57),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) -},{"11":11,"21":21,"25":25,"31":31,"34":34,"35":35,"4":4,"41":41,"47":47,"48":48,"54":54,"57":57,"65":65,"66":66,"8":8,"86":86,"92":92,"pouchdb":"pouchdb"}]},{},[94]); +}).call(this,_dereq_(56),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(8).Buffer) +},{"11":11,"21":21,"25":25,"31":31,"34":34,"4":4,"40":40,"46":46,"47":47,"53":53,"56":56,"64":64,"65":65,"8":8,"85":85,"91":91,"pouchdb":"pouchdb"}]},{},[93]); diff --git a/lib/pouchdb/dist/pouchdb.localstorage.min.js b/lib/pouchdb/dist/pouchdb.localstorage.min.js index d09df624..83b85413 100644 --- a/lib/pouchdb/dist/pouchdb.localstorage.min.js +++ b/lib/pouchdb/dist/pouchdb.localstorage.min.js @@ -1,14 +1,14 @@ -// PouchDB localStorage plugin 6.0.6 +// PouchDB localStorage plugin 6.0.7 // Based on localstorage-down: https://github.com/No9/localstorage-down // // (c) 2012-2016 Dale Harvey and the PouchDB team // PouchDB may be freely distributed under the Apache license, version 2.0. // For all details and documentation: // http://pouchdb.com -!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var c=0;for(t=0,n=0;t>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===a?(o=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===a&&(o=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,i=[],o=t;of?f:u+a));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var c=[],f=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),c=u.length,f=-1;++fa)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{8:8}],8:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(i){var f=-1;for(c=n;cs&&(n=s-u),c=n;c>=0;c--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,c,f,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function P(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||P(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||P(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(5),Z=e(29),Q=e(33);n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return c(null,e,t,n)},a.allocUnsafe=function(e){return f(null,e)},a.allocUnsafeSlow=function(e){return f(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),c=this.slice(r,i),f=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||I(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;D(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>2],i=(3&a)<<4;break;case 1:n+=e[i|a>>4], -i=(15&a)<<2;break;case 2:n+=e[i|a>>6],n+=e[63&a],i=0}}return r%3&&(n+=e[i]),n},t.decode=function(e){for(var t=e.length,i=0,o=new r(~~(t/4*3)),a=0,s=0;s>4,a=u<<4&255;break;case 2:o[i++]=a|u>>2,a=u<<6&255;break;case 3:o[i++]=a|u}}return o},t},t.exports(i,t.exports)},{8:8}],11:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(12),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{12:12}],12:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(c||t);e.diff=o,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],22:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(24);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{24:24}],23:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(22)(t.exports),t.exports.create=t.exports.custom.createError},{22:22}],24:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],25:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],26:[function(e,t,n){function r(){try{if("undefined"==typeof localStorage)return!1;if(localStorage.setItem("Storage-Test","1"),"1"!==localStorage.getItem("Storage-Test"))return!1;localStorage.removeItem("Storage-Test")}catch(e){return!1}return!0}"object"==typeof n&&(t.exports=r)},{}],27:[function(e,t,n){(function(n){var r=t.exports={},i=e(53);r.hasLocalStorage=e(26),r.create=function(){var e;return r.hasLocalStorage()?(e=n.localStorage,e={get length(){return n.localStorage.length},getItem:n.localStorage.getItem.bind(n.localStorage),setItem:n.localStorage.setItem.bind(n.localStorage),removeItem:n.localStorage.removeItem.bind(n.localStorage),key:n.localStorage.key.bind(n.localStorage),clear:n.localStorage.clear.bind(n.localStorage)},e.isPersistent=!0):(e=i,e.isPersistent=!1),e.getObject=r.getObject.bind(null,e),e.setObject=r.setObject.bind(null,e),e},r.setObject=function(e,t,n){return"object"!=typeof n?e.setItem(t,n):e.setItem(t,JSON.stringify(n))},r.getObject=function(e,t){var n=e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return n}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{26:26,53:53}],28:[function(e,t,n){var r=e(27);t.exports=r.create()},{27:27}],29:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,f=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+e[t+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,c-=8);e[n+d-p]|=128*g}},{}],30:[function(e,t,n){(function(e){"use strict";function n(){f=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{36:36}],36:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],37:[function(e,t,n){var r=e(23).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{23:23}],38:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(31),o=e(65).Readable,a=e(39),s=e(37).EncodingError;t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)),void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{31:31,37:37,39:39,65:65}],39:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],40:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(42),o=e(37).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{37:37,42:42}],41:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(c.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{}, -t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=B(t),this.options=h(R,t),this._codec=new x(this.options),this._status="new",d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new b("Database is not open"),n),!0}function a(e,t,n){j(e,new v(t),n)}function s(e,t,n){j(e,new b(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var c=e(25).EventEmitter,f=e(91).inherits,l=e(91).deprecate,h=e(45),d=e(58),p=e(14),g=e(38),y=e(37),v=y.WriteError,b=y.ReadError,m=y.NotFoundError,_=y.OpenError,w=y.EncodingError,E=y.InitializationError,k=e(42),S=e(40),x=e(43),B=k.getOptions,R=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;f(i,c),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new _(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new b(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,c=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=B(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(c,new v(n),i):(c.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=B(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new v(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=B(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new v(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=B(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new _(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(37),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(57))},{14:14,25:25,37:37,38:38,40:40,42:42,43:43,45:45,57:57,58:58,91:91}],42:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(46).devDependencies.leveldown;try{t=e(6).version}catch(e){throw o(e)}if(!e(6).satisfies(t,n))throw new c("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(6)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new c(f(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,c=(e(45),e(37).LevelUPError),f=e(91).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{37:37,45:45,46:46,6:6,91:91}],43:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{35:35,44:44}],44:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],45:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],46:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.2",_id:"levelup@1.3.2",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"6.1.0",_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237"},_npmUser:{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},_npmVersion:"3.8.6",_phantomChildren:{},_requested:{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},_requiredBy:["/","/pouchdb","/pouchdb-adapter-leveldb-core"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz",_shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",_shrinkwrap:null,_spec:"levelup@1.3.2",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz"},gitHead:"bcc242cfc4ec035f9228a5cd54903cb126659a00",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.2"}},{}],47:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=c(i);"error"===a.status&&n(a.value)}function c(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function f(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(c,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(c,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,c=new this(r);++ur._endkey)?e():r._limit&&r._limit>0&&r._count++>=r._limit?e():r._lt&&t>=r._lt||r._lte&&t>r._lte||r._gt&&t<=r._gt||r._gte&&t=r._keys.length||o<0?void 0:r._keys[o];r._pos=o,r._reverse?(r._exclusiveStart||a!==r._startkey)&&r._pos--:r._exclusiveStart&&a===r._startkey&&r._pos++}else r._pos=r._reverse?r._keys.length-1:0;t(),r.initCompleted=!0;for(var s=-1;++s-1){var o=JSON.parse(r);r=o.data}n(null,r)}))},a.prototype._del=function(e,t,n){var r=s(e,"key");return r?p(function(){n(r)}):(i.isBuffer(e)||(e=String(e)),void this.container.removeItem(e,n))},a.prototype._batch=function(e,t,n){var r=this;p(function(){function o(){++l===e.length&&n(f)}var a,u,c,f,l=0;if(Array.isArray(e)&&e.length)for(var h=0;h>>1,e[n]n?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},c=n.upperBoundExclusive=function(e){return!!t(e,"lt")},f=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=f(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,c=n.lowerBoundKey(e),f=n.upperBoundKey(e);return c?"gt"===c?r.gt=i(e.gt,!1):r.gte=i(e[c],!1):u&&(r.gte=i(a,!1)),f?"lt"===f?r.lt=i(e.lt,!0):r.lte=i(e[f],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var f=l(e);if(r(f)){var a=i(t,f);if(a>0||0===a&&c(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(32)})},{32:32}],55:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,f,"day")||a(e,c,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):_(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function b(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=B.prototype.pipe,e.on=e.addListener=B.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&_(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0), -t.ended&&!t.endEmitted&&0===t.length&&_(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===f&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){c(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),c()}function u(){e.removeListener("close",s),c()}function c(){f.unpipe(e)}var f=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):f.once("end",d),e.on("unpipe",r);var p=g(f);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s),e.once("finish",u),e.emit("pipe",f),l.flowing||(this.on("readable",v),l.flowing=!0,n.nextTick(function(){y(f)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],c=e[3];a=n(a,s,u,c,t[0],7,-680876936),c=n(c,a,s,u,t[1],12,-389564586),u=n(u,c,a,s,t[2],17,606105819),s=n(s,u,c,a,t[3],22,-1044525330),a=n(a,s,u,c,t[4],7,-176418897),c=n(c,a,s,u,t[5],12,1200080426),u=n(u,c,a,s,t[6],17,-1473231341),s=n(s,u,c,a,t[7],22,-45705983),a=n(a,s,u,c,t[8],7,1770035416),c=n(c,a,s,u,t[9],12,-1958414417),u=n(u,c,a,s,t[10],17,-42063),s=n(s,u,c,a,t[11],22,-1990404162),a=n(a,s,u,c,t[12],7,1804603682),c=n(c,a,s,u,t[13],12,-40341101),u=n(u,c,a,s,t[14],17,-1502002290),s=n(s,u,c,a,t[15],22,1236535329),a=r(a,s,u,c,t[1],5,-165796510),c=r(c,a,s,u,t[6],9,-1069501632),u=r(u,c,a,s,t[11],14,643717713),s=r(s,u,c,a,t[0],20,-373897302),a=r(a,s,u,c,t[5],5,-701558691),c=r(c,a,s,u,t[10],9,38016083),u=r(u,c,a,s,t[15],14,-660478335),s=r(s,u,c,a,t[4],20,-405537848),a=r(a,s,u,c,t[9],5,568446438),c=r(c,a,s,u,t[14],9,-1019803690),u=r(u,c,a,s,t[3],14,-187363961),s=r(s,u,c,a,t[8],20,1163531501),a=r(a,s,u,c,t[13],5,-1444681467),c=r(c,a,s,u,t[2],9,-51403784),u=r(u,c,a,s,t[7],14,1735328473),s=r(s,u,c,a,t[12],20,-1926607734),a=i(a,s,u,c,t[5],4,-378558),c=i(c,a,s,u,t[8],11,-2022574463),u=i(u,c,a,s,t[11],16,1839030562),s=i(s,u,c,a,t[14],23,-35309556),a=i(a,s,u,c,t[1],4,-1530992060),c=i(c,a,s,u,t[4],11,1272893353),u=i(u,c,a,s,t[7],16,-155497632),s=i(s,u,c,a,t[10],23,-1094730640),a=i(a,s,u,c,t[13],4,681279174),c=i(c,a,s,u,t[0],11,-358537222),u=i(u,c,a,s,t[3],16,-722521979),s=i(s,u,c,a,t[6],23,76029189),a=i(a,s,u,c,t[9],4,-640364487),c=i(c,a,s,u,t[12],11,-421815835),u=i(u,c,a,s,t[15],16,530742520),s=i(s,u,c,a,t[2],23,-995338651),a=o(a,s,u,c,t[0],6,-198630844),c=o(c,a,s,u,t[7],10,1126891415),u=o(u,c,a,s,t[14],15,-1416354905),s=o(s,u,c,a,t[5],21,-57434055),a=o(a,s,u,c,t[12],6,1700485571),c=o(c,a,s,u,t[3],10,-1894986606),u=o(u,c,a,s,t[10],15,-1051523),s=o(s,u,c,a,t[1],21,-2054922799),a=o(a,s,u,c,t[8],6,1873313359),c=o(c,a,s,u,t[15],10,-30611744),u=o(u,c,a,s,t[6],15,-1560198380),s=o(s,u,c,a,t[13],21,1309151649),a=o(a,s,u,c,t[4],6,-145523070),c=o(c,a,s,u,t[11],10,-1120210379),u=o(u,c,a,s,t[2],15,718787259),s=o(s,u,c,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(c,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function c(e){var t,n,r,i,o,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)a(f,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(f,r),t=0;t<16;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(f,r),f}function f(e){var t,n,r,i,o,s,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)a(f,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(f,r),t=0;t<16;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(f,r),f}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=_[e>>8*t+4&15]+_[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,c=t(n,u),f=u;return r!==e&&(f=t(r,u)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),b.prototype.append=function(e){return this.appendBinary(d(e)),this},b.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},b.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},b.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},b.hash=function(e,t){return b.hashBinary(d(e),t)},b.hashBinary=function(e,t){var n=c(e),r=h(n);return t?v(r):r},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){var e=b.prototype.getState.call(this);return e.buff=g(e.buff),e},b.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),b.prototype.setState.call(this,e)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(e,t){var n=f(new Uint8Array(e)),r=h(n);return t?v(r):r},b})},{}],67:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(25).EventEmitter,o=e(31);o(r,i),r.Readable=e(76),r.Writable=e(78),r.Duplex=e(68),r.Transform=e(77),r.PassThrough=e(75),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function r(){c.readable&&c.resume&&c.resume()}function o(){f||(f=!0,e.end())}function a(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){c.removeListener("data",n),e.removeListener("drain",r),c.removeListener("end",o),c.removeListener("close",a),c.removeListener("error",s),e.removeListener("error",s),c.removeListener("end",u),c.removeListener("close",u),e.removeListener("close",u)}var c=this;c.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(c.on("end",o),c.on("close",a));var f=!1;return c.on("error",s),e.on("error",s),c.on("end",u),c.on("close",u),e.on("close",u),e.emit("pipe",c),e}},{25:25,31:31,68:68,75:75,76:76,77:77,78:78}],68:[function(e,t,n){t.exports=e(69)},{69:69}],69:[function(e,t,n){"use strict";function r(e){return this instanceof r?(c.call(this,e),f.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(56),u=e(9);u.inherits=e(31);var c=e(71),f=e(73);u.inherits(r,c);for(var l=a(f.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var c;!t.decoder||i||r||(n=t.decoder.write(n),c=!t.objectMode&&0===n.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function c(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){var n=null;return M.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(q("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){q("emit readable"),e.emit("readable"),_(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return q("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=c(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;q("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){q("onunpipe"),e===h&&a()}function o(){q("onend"),e.end()}function a(){q("cleanup"),e.removeListener("close",c),e.removeListener("finish",f),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),b=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){q("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!b&&(q("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){q("onerror",t),l(),e.removeListener("error",u),0===L(e,"error")&&e.emit("error",t)}function c(){e.removeListener("finish",f),l()}function f(){q("onfinish"),e.removeListener("close",c),l()}function l(){q("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,q("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var v=y(h);e.on("drain",v);var b=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",c),e.once("finish",f),e.emit("pipe",h),d.flowing||(q("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k;a.WritableState=o;var x=e(9);x.inherits=e(31);var B,R={deprecate:e(88)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(25).EventEmitter)}}();var A=e(8).Buffer,j=e(7);x.inherits(a,B);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=f(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(57))},{25:25,31:31,56:56,57:57,69:69,7:7,8:8,88:88,9:9}],74:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(8).Buffer,e(7));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{7:7,8:8}],75:[function(e,t,n){t.exports=e(70)},{70:70}],76:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(71),n.Stream=i||n,n.Readable=n,n.Writable=e(73),n.Duplex=e(69),n.Transform=e(72),n.PassThrough=e(70),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(57))},{57:57,69:69,70:70,71:71,72:72,73:73}],77:[function(e,t,n){t.exports=e(72)},{72:72}],78:[function(e,t,n){t.exports=e(73)},{73:73}],79:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(8).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{8:8}],80:[function(e,t,n){arguments[4][69][0].apply(n,arguments)},{31:31,56:56,69:69,81:81,83:83,9:9}],81:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(80),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(M||(M=e(79).StringDecoder),this.decoder=new M(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(80),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=c(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,f(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(L("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){L("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:R.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return L("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;L("need readable",r),(0===t.length||t.length-e0?_(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){L("onunpipe"),e===l&&o()}function i(){L("onend"),e.end()}function o(){L("cleanup"),e.removeListener("close",u),e.removeListener("finish",c),e.removeListener("drain",y),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),v=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){L("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||v||(L("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){L("onerror",t),f(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",c),f()}function c(){L("onfinish"),e.removeListener("close",u),f()}function f(){L("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,L("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var y=g(l);e.on("drain",y);var v=!1;return l.on("data",a),e._events&&e._events.error?B(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",c),e.emit("pipe",l),h.flowing||(L("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(8).Buffer;a.WritableState=o;var B=e(9);B.inherits=e(31);var R,A={deprecate:e(88)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(25).EventEmitter)}}();var x=e(8).Buffer;B.inherits(a,R);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=f(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(57))},{25:25,31:31,56:56,57:57,8:8,80:80,88:88,9:9}],84:[function(e,t,n){arguments[4][77][0].apply(n,arguments)},{77:77,82:82}],85:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],86:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(84),s=e(91).inherits,u=e(85);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(57))},{57:57,84:84,85:85,91:91}],87:[function(e,t,n){"use strict";function r(){this.length=0}r.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},r.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},r.prototype.slice=function(e,t){e="undefined"==typeof e?0:e,t="undefined"==typeof t?1/0:t;for(var n=[],r=0,i=this.first;i&&!(--t<0);i=i.next)++r>e&&n.push(i.item);return n},t.exports=r},{}],88:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],89:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{31:31}],90:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],91:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&B(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=c(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(t);if(0===a.length){if(B(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var v="",b=!1,_=["{","}"];if(p(t)&&(b=!0,_=["[","]"]),B(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),S(t)&&(v=" "+Date.prototype.toUTCString.call(t)),x(t)&&(v=" "+f(t)),0===a.length&&(!b||0==t.length))return _[0]+v+_[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=b?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,b)}),e.seen.pop(),d(k,v,_)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function B(e){return"function"==typeof e}function R(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)f=u[a],l=r[f],h=a>0?",":"",h+=JSON.stringify(f)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,c,f,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":c={element:[],index:l.length},l.push(c.element),h.push(c);break;case"{":f={element:{},index:l.length},l.push(f.element),h.push(f);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],93:[function(e,t,n){function r(){for(var e={},t=0;t>>1,n(e[r],t)<0?i=r+1:o=r;return i}function H(e,t,n){var r=J(e,t,n);e.splice(r,0,t)}function $(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var y=g.ids[2],v=0,b=y.length;v0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],c=k.docStore.readStream(i),f=We.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:f}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=z(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,f=Re(a),l=Ae(a,f);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return c.unpipe(),c.destroy(),void r()}if(e.include_docs){var h=a.rev_map[f];k.bySeqStore.get(y(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Oe(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){f.end()});c.on("error",t),c.pipe(f)})}),E._changes=function(e){function t(){e.done=!0,c&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=y(e.since||0));var c,f=e.doc_ids&&new g(e.doc_ids),l=O(e),h=new p;c="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),b=We.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Oe([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),c&&o.push(r)),void d())}var r=Re(t);if(t.seq!==g)return d();if(a=g,r===b._rev)return n(b);var i=t.rev_map[r];k.bySeqStore.get(y(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=v(n.key),b=n.value;if(g===e.since&&!i)return d();if(f&&!f.has(b._id))return d();var m;return(m=h.get(b._id))?p(m):void k.docStore.get(b._id,function(t,n){return e.cancelled||e.done||w.isClosed()||ie(n.id)?d():(h.set(b._id,n),void p(n))})},function(t){return e.cancelled?t():(c&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){ -var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(De.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},Ne(R,Error),R.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var st,ut=(new R({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new R({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new R({status:404,error:"not_found",reason:"missing"})),ct=new R({status:409,error:"conflict",reason:"Document update conflict"}),ft=new R({status:400,error:"bad_request",reason:"_id field must contain a string"}),lt=new R({status:412,error:"missing_id",reason:"_id is required for puts"}),ht=new R({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),dt=new R({status:412,error:"precondition_failed",reason:"Database not open"}),pt=(new R({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new R({status:500,error:"badarg",reason:"Some query argument is invalid"})),gt=(new R({status:400,error:"invalid_request",reason:"Request was invalid"}),new R({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new R({status:500,error:"doc_validation",reason:"Bad special document member"})),yt=new R({status:400,error:"bad_request",reason:"Something wrong with the request"}),vt=(new R({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new R({status:404,error:"not_found",reason:"Database not found"}),new R({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new R({status:500,error:"web_sql_went_bad",reason:"unknown"}),new R({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new R({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new R({status:400,error:"bad_request",reason:"Invalid rev format"})),bt=(new R({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new R({status:412,error:"missing_stub"})),mt=(new R({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),T.name);st=mt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var _t=st,wt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Et=I(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),kt=I(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),St=function(e){return atob(e)},xt=function(e){return btoa(e)},Bt=n.setImmediate||n.setTimeout,Rt=32768;Be.prototype.get=function(e,n,r){var i=xe(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Be.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var At="document-store",jt="by-sequence",Ot="attach-store",Tt="attach-binary-store",Lt="local-store",Mt="meta-store",Ct=new p,It="_local_last_update_seq",Dt="_local_doc_count",qt="_local_uuid",Nt="md5-",Pt={encode:we,decode:_e,buffer:!1,type:"cheap-json"},Ut=new x;Le.valid=function(){return"undefined"!=typeof localStorage},Le.use_prefix=!0;var Wt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");Wt?Me(Wt):B("error",'localstorage adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(57),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(8).Buffer)},{11:11,21:21,25:25,31:31,34:34,35:35,4:4,41:41,47:47,48:48,54:54,57:57,65:65,66:66,8:8,86:86,92:92,pouchdb:"pouchdb"}]},{},[94]); +!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var c=0;for(t=0,n=0;t>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===a?(o=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===a&&(o=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,i=[],o=t;of?f:u+a));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var c=[],f=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),c=u.length,f=-1;++fa)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{8:8}],8:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(i){var f=-1;for(c=n;cs&&(n=s-u),c=n;c>=0;c--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,c,f,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function P(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||P(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||P(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(5),Z=e(29),Q=e(33);n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return c(null,e,t,n)},a.allocUnsafe=function(e){return f(null,e)},a.allocUnsafeSlow=function(e){return f(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),c=this.slice(r,i),f=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||I(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;D(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>2],i=(3&a)<<4;break;case 1:n+=e[i|a>>4], +i=(15&a)<<2;break;case 2:n+=e[i|a>>6],n+=e[63&a],i=0}}return r%3&&(n+=e[i]),n},t.decode=function(e){for(var t=e.length,i=0,o=new r(~~(t/4*3)),a=0,s=0;s>4,a=u<<4&255;break;case 2:o[i++]=a|u>>2,a=u<<6&255;break;case 3:o[i++]=a|u}}return o},t},t.exports(i,t.exports)},{8:8}],11:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(12),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{12:12}],12:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(c||t);e.diff=o,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],22:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(24);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{24:24}],23:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(22)(t.exports),t.exports.create=t.exports.custom.createError},{22:22}],24:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],25:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],26:[function(e,t,n){function r(){try{if("undefined"==typeof localStorage)return!1;if(localStorage.setItem("Storage-Test","1"),"1"!==localStorage.getItem("Storage-Test"))return!1;localStorage.removeItem("Storage-Test")}catch(e){return!1}return!0}"object"==typeof n&&(t.exports=r)},{}],27:[function(e,t,n){(function(n){var r=t.exports={},i=e(52);r.hasLocalStorage=e(26),r.create=function(){var e;return r.hasLocalStorage()?(e=n.localStorage,e={get length(){return n.localStorage.length},getItem:n.localStorage.getItem.bind(n.localStorage),setItem:n.localStorage.setItem.bind(n.localStorage),removeItem:n.localStorage.removeItem.bind(n.localStorage),key:n.localStorage.key.bind(n.localStorage),clear:n.localStorage.clear.bind(n.localStorage)},e.isPersistent=!0):(e=i,e.isPersistent=!1),e.getObject=r.getObject.bind(null,e),e.setObject=r.setObject.bind(null,e),e},r.setObject=function(e,t,n){return"object"!=typeof n?e.setItem(t,n):e.setItem(t,JSON.stringify(n))},r.getObject=function(e,t){var n=e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return n}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{26:26,52:52}],28:[function(e,t,n){var r=e(27);t.exports=r.create()},{27:27}],29:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,f=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+e[t+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,c-=8);e[n+d-p]|=128*g}},{}],30:[function(e,t,n){(function(e){"use strict";function n(){f=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{35:35}],35:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],36:[function(e,t,n){var r=e(23).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{23:23}],37:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(31),o=e(64).Readable,a=e(38),s=e(36).EncodingError;t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)),void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{31:31,36:36,38:38,64:64}],38:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],39:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(41),o=e(36).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{36:36,41:41}],40:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(c.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=B(t),this.options=h(R,t),this._codec=new x(this.options),this._status="new", +d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new b("Database is not open"),n),!0}function a(e,t,n){j(e,new v(t),n)}function s(e,t,n){j(e,new b(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var c=e(25).EventEmitter,f=e(90).inherits,l=e(90).deprecate,h=e(44),d=e(57),p=e(14),g=e(37),y=e(36),v=y.WriteError,b=y.ReadError,m=y.NotFoundError,_=y.OpenError,w=y.EncodingError,E=y.InitializationError,k=e(41),S=e(39),x=e(42),B=k.getOptions,R=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;f(i,c),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new _(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new b(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,c=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=B(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(c,new v(n),i):(c.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=B(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new v(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=B(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new v(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=B(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new _(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(36),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(56))},{14:14,25:25,36:36,37:37,39:39,41:41,42:42,44:44,56:56,57:57,90:90}],41:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(45).devDependencies.leveldown;try{t=e(6).version}catch(e){throw o(e)}if(!e(6).satisfies(t,n))throw new c("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(6)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new c(f(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,c=(e(44),e(36).LevelUPError),f=e(90).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{36:36,44:44,45:45,6:6,90:90}],42:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{34:34,43:43}],43:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(8).Buffer)},{8:8}],44:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],45:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.3",_id:"levelup@1.3.3",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"4.4.7",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446"},_npmUser:{name:"juliangruber",email:"julian@juliangruber.com"},_npmVersion:"2.15.8",_phantomChildren:{},_requested:{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz",_shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",_shrinkwrap:null,_spec:"levelup@1.3.3",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz"},gitHead:"cced27dc9f0095823be5ed388ec601ec2bfe7366",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.3"}},{}],46:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=c(i);"error"===a.status&&n(a.value)}function c(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function f(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(c,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(c,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,c=new this(r);++ur._endkey)?e():r._limit&&r._limit>0&&r._count++>=r._limit?e():r._lt&&t>=r._lt||r._lte&&t>r._lte||r._gt&&t<=r._gt||r._gte&&t=r._keys.length||o<0?void 0:r._keys[o];r._pos=o,r._reverse?(r._exclusiveStart||a!==r._startkey)&&r._pos--:r._exclusiveStart&&a===r._startkey&&r._pos++}else r._pos=r._reverse?r._keys.length-1:0;t(),r.initCompleted=!0;for(var s=-1;++s-1){var o=JSON.parse(r);r=o.data}n(null,r)}))},a.prototype._del=function(e,t,n){var r=s(e,"key");return r?p(function(){n(r)}):(i.isBuffer(e)||(e=String(e)),void this.container.removeItem(e,n))},a.prototype._batch=function(e,t,n){var r=this;p(function(){function o(){++l===e.length&&n(f)}var a,u,c,f,l=0;if(Array.isArray(e)&&e.length)for(var h=0;h>>1,e[n]n?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},c=n.upperBoundExclusive=function(e){return!!t(e,"lt")},f=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=f(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,c=n.lowerBoundKey(e),f=n.upperBoundKey(e);return c?"gt"===c?r.gt=i(e.gt,!1):r.gte=i(e[c],!1):u&&(r.gte=i(a,!1)),f?"lt"===f?r.lt=i(e.lt,!0):r.lte=i(e[f],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var f=l(e);if(r(f)){var a=i(t,f);if(a>0||0===a&&c(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(32)})},{32:32}],54:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,f,"day")||a(e,c,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):_(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function b(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=B.prototype.pipe,e.on=e.addListener=B.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&_(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&_(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===f&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),f.removeListener("end",i), +f.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){c(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),c()}function u(){e.removeListener("close",s),c()}function c(){f.unpipe(e)}var f=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):f.once("end",d),e.on("unpipe",r);var p=g(f);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s),e.once("finish",u),e.emit("pipe",f),l.flowing||(this.on("readable",v),l.flowing=!0,n.nextTick(function(){y(f)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",v),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],c=e[3];a=n(a,s,u,c,t[0],7,-680876936),c=n(c,a,s,u,t[1],12,-389564586),u=n(u,c,a,s,t[2],17,606105819),s=n(s,u,c,a,t[3],22,-1044525330),a=n(a,s,u,c,t[4],7,-176418897),c=n(c,a,s,u,t[5],12,1200080426),u=n(u,c,a,s,t[6],17,-1473231341),s=n(s,u,c,a,t[7],22,-45705983),a=n(a,s,u,c,t[8],7,1770035416),c=n(c,a,s,u,t[9],12,-1958414417),u=n(u,c,a,s,t[10],17,-42063),s=n(s,u,c,a,t[11],22,-1990404162),a=n(a,s,u,c,t[12],7,1804603682),c=n(c,a,s,u,t[13],12,-40341101),u=n(u,c,a,s,t[14],17,-1502002290),s=n(s,u,c,a,t[15],22,1236535329),a=r(a,s,u,c,t[1],5,-165796510),c=r(c,a,s,u,t[6],9,-1069501632),u=r(u,c,a,s,t[11],14,643717713),s=r(s,u,c,a,t[0],20,-373897302),a=r(a,s,u,c,t[5],5,-701558691),c=r(c,a,s,u,t[10],9,38016083),u=r(u,c,a,s,t[15],14,-660478335),s=r(s,u,c,a,t[4],20,-405537848),a=r(a,s,u,c,t[9],5,568446438),c=r(c,a,s,u,t[14],9,-1019803690),u=r(u,c,a,s,t[3],14,-187363961),s=r(s,u,c,a,t[8],20,1163531501),a=r(a,s,u,c,t[13],5,-1444681467),c=r(c,a,s,u,t[2],9,-51403784),u=r(u,c,a,s,t[7],14,1735328473),s=r(s,u,c,a,t[12],20,-1926607734),a=i(a,s,u,c,t[5],4,-378558),c=i(c,a,s,u,t[8],11,-2022574463),u=i(u,c,a,s,t[11],16,1839030562),s=i(s,u,c,a,t[14],23,-35309556),a=i(a,s,u,c,t[1],4,-1530992060),c=i(c,a,s,u,t[4],11,1272893353),u=i(u,c,a,s,t[7],16,-155497632),s=i(s,u,c,a,t[10],23,-1094730640),a=i(a,s,u,c,t[13],4,681279174),c=i(c,a,s,u,t[0],11,-358537222),u=i(u,c,a,s,t[3],16,-722521979),s=i(s,u,c,a,t[6],23,76029189),a=i(a,s,u,c,t[9],4,-640364487),c=i(c,a,s,u,t[12],11,-421815835),u=i(u,c,a,s,t[15],16,530742520),s=i(s,u,c,a,t[2],23,-995338651),a=o(a,s,u,c,t[0],6,-198630844),c=o(c,a,s,u,t[7],10,1126891415),u=o(u,c,a,s,t[14],15,-1416354905),s=o(s,u,c,a,t[5],21,-57434055),a=o(a,s,u,c,t[12],6,1700485571),c=o(c,a,s,u,t[3],10,-1894986606),u=o(u,c,a,s,t[10],15,-1051523),s=o(s,u,c,a,t[1],21,-2054922799),a=o(a,s,u,c,t[8],6,1873313359),c=o(c,a,s,u,t[15],10,-30611744),u=o(u,c,a,s,t[6],15,-1560198380),s=o(s,u,c,a,t[13],21,1309151649),a=o(a,s,u,c,t[4],6,-145523070),c=o(c,a,s,u,t[11],10,-1120210379),u=o(u,c,a,s,t[2],15,718787259),s=o(s,u,c,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(c,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function c(e){var t,n,r,i,o,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)a(f,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(f,r),t=0;t<16;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(f,r),f}function f(e){var t,n,r,i,o,s,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)a(f,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(f,r),t=0;t<16;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(f,r),f}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=_[e>>8*t+4&15]+_[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,c=t(n,u),f=u;return r!==e&&(f=t(r,u)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),b.prototype.append=function(e){return this.appendBinary(d(e)),this},b.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},b.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},b.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},b.hash=function(e,t){return b.hashBinary(d(e),t)},b.hashBinary=function(e,t){var n=c(e),r=h(n);return t?v(r):r},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=v(n)),this.reset(),n},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){var e=b.prototype.getState.call(this);return e.buff=g(e.buff),e},b.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),b.prototype.setState.call(this,e)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(e,t){var n=f(new Uint8Array(e)),r=h(n);return t?v(r):r},b})},{}],66:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(25).EventEmitter,o=e(31);o(r,i),r.Readable=e(75),r.Writable=e(77),r.Duplex=e(67),r.Transform=e(76),r.PassThrough=e(74),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function r(){c.readable&&c.resume&&c.resume()}function o(){f||(f=!0,e.end())}function a(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){c.removeListener("data",n),e.removeListener("drain",r),c.removeListener("end",o),c.removeListener("close",a),c.removeListener("error",s),e.removeListener("error",s),c.removeListener("end",u),c.removeListener("close",u),e.removeListener("close",u)}var c=this;c.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(c.on("end",o),c.on("close",a));var f=!1;return c.on("error",s),e.on("error",s),c.on("end",u),c.on("close",u),e.on("close",u),e.emit("pipe",c),e}},{25:25,31:31,67:67,74:74,75:75,76:76,77:77}],67:[function(e,t,n){t.exports=e(68)},{68:68}],68:[function(e,t,n){"use strict";function r(e){return this instanceof r?(c.call(this,e),f.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(55),u=e(9);u.inherits=e(31);var c=e(70),f=e(72);u.inherits(r,c);for(var l=a(f.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var c;!t.decoder||i||r||(n=t.decoder.write(n),c=!t.objectMode&&0===n.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function c(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){var n=null;return M.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(q("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){q("emit readable"),e.emit("readable"),_(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return q("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=c(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;q("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){q("onunpipe"),e===h&&a()}function o(){q("onend"),e.end()}function a(){q("cleanup"),e.removeListener("close",c),e.removeListener("finish",f),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),b=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){q("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!b&&(q("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){q("onerror",t),l(),e.removeListener("error",u),0===L(e,"error")&&e.emit("error",t)}function c(){e.removeListener("finish",f),l()}function f(){q("onfinish"),e.removeListener("close",c),l()}function l(){q("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,q("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var v=y(h);e.on("drain",v);var b=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",c),e.once("finish",f),e.emit("pipe",h),d.flowing||(q("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k;a.WritableState=o;var x=e(9);x.inherits=e(31);var B,R={deprecate:e(87)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(25).EventEmitter)}}();var A=e(8).Buffer,j=e(7);x.inherits(a,B);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=f(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(56))},{25:25,31:31,55:55,56:56,68:68,7:7,8:8,87:87,9:9}],73:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(8).Buffer,e(7));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{7:7,8:8}],74:[function(e,t,n){t.exports=e(69)},{69:69}],75:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(70),n.Stream=i||n,n.Readable=n,n.Writable=e(72),n.Duplex=e(68),n.Transform=e(71),n.PassThrough=e(69),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(56))},{56:56,68:68,69:69,70:70,71:71,72:72}],76:[function(e,t,n){t.exports=e(71)},{71:71}],77:[function(e,t,n){t.exports=e(72)},{72:72}],78:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(8).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{8:8}],79:[function(e,t,n){arguments[4][68][0].apply(n,arguments)},{31:31,55:55,68:68,80:80,82:82,9:9}],80:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(79),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(M||(M=e(78).StringDecoder),this.decoder=new M(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(79),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=c(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,f(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(L("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){L("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:R.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return L("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;L("need readable",r),(0===t.length||t.length-e0?_(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){L("onunpipe"),e===l&&o()}function i(){L("onend"),e.end()}function o(){L("cleanup"),e.removeListener("close",u),e.removeListener("finish",c),e.removeListener("drain",y),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),v=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){L("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||v||(L("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){L("onerror",t),f(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",c),f()}function c(){L("onfinish"),e.removeListener("close",u),f()}function f(){L("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,L("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var y=g(l);e.on("drain",y);var v=!1;return l.on("data",a),e._events&&e._events.error?B(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",c),e.emit("pipe",l),h.flowing||(L("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(8).Buffer;a.WritableState=o;var B=e(9);B.inherits=e(31);var R,A={deprecate:e(87)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(25).EventEmitter)}}();var x=e(8).Buffer;B.inherits(a,R);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=f(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(56))},{25:25,31:31,55:55,56:56,79:79,8:8,87:87,9:9}],83:[function(e,t,n){arguments[4][76][0].apply(n,arguments)},{76:76,81:81}],84:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{20:20}],85:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(83),s=e(90).inherits,u=e(84);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(56))},{56:56,83:83,84:84,90:90}],86:[function(e,t,n){"use strict";function r(){this.length=0}r.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},r.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},r.prototype.slice=function(e,t){e="undefined"==typeof e?0:e,t="undefined"==typeof t?1/0:t;for(var n=[],r=0,i=this.first;i&&!(--t<0);i=i.next)++r>e&&n.push(i.item);return n},t.exports=r},{}],87:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],88:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{31:31}],89:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],90:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&B(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=c(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(t);if(0===a.length){if(B(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var v="",b=!1,_=["{","}"];if(p(t)&&(b=!0,_=["[","]"]),B(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),S(t)&&(v=" "+Date.prototype.toUTCString.call(t)),x(t)&&(v=" "+f(t)),0===a.length&&(!b||0==t.length))return _[0]+v+_[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=b?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,b)}),e.seen.pop(),d(k,v,_)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function B(e){return"function"==typeof e}function R(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)f=u[a],l=r[f],h=a>0?",":"",h+=JSON.stringify(f)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,c,f,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":c={element:[],index:l.length},l.push(c.element),h.push(c);break;case"{":f={element:{},index:l.length},l.push(f.element),h.push(f);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],92:[function(e,t,n){function r(){for(var e={},t=0;t>>1,n(e[r],t)<0?i=r+1:o=r;return i}function $(e,t,n){var r=H(e,t,n);e.splice(r,0,t)}function G(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var y=g.ids[2],v=0,b=y.length;v0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],c=k.docStore.readStream(i),f=Fe.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:f}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=Y(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,f=Ae(a),l=je(a,f);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return c.unpipe(),c.destroy(),void r()}if(e.include_docs){var h=a.rev_map[f];k.bySeqStore.get(y(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Te(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){f.end()});c.on("error",t),c.pipe(f)})}),E._changes=function(e){function t(){e.done=!0,c&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=y(e.since||0));var c,f=e.doc_ids&&new g(e.doc_ids),l=T(e),h=new p;c="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),b=Fe.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Te([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),c&&o.push(r)),void d())}var r=Ae(t);if(t.seq!==g)return d();if(a=g,r===b._rev)return n(b);var i=t.rev_map[r];k.bySeqStore.get(y(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=v(n.key),b=n.value;if(g===e.since&&!i)return d();if(f&&!f.has(b._id))return d();var m;return(m=h.get(b._id))?p(m):void k.docStore.get(b._id,function(t,n){return e.cancelled||e.done||w.isClosed()||oe(n.id)?d():(h.set(b._id,n),void p(n))})},function(t){return e.cancelled?t():(c&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(qe.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]), +delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var st=Array.prototype.slice,ut=Array.prototype.forEach;Pe(A,Error),A.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var ct,ft=(new A({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new A({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new A({status:404,error:"not_found",reason:"missing"})),lt=new A({status:409,error:"conflict",reason:"Document update conflict"}),ht=new A({status:400,error:"bad_request",reason:"_id field must contain a string"}),dt=new A({status:412,error:"missing_id",reason:"_id is required for puts"}),pt=new A({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),gt=new A({status:412,error:"precondition_failed",reason:"Database not open"}),yt=(new A({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new A({status:500,error:"badarg",reason:"Some query argument is invalid"})),vt=(new A({status:400,error:"invalid_request",reason:"Request was invalid"}),new A({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new A({status:500,error:"doc_validation",reason:"Bad special document member"})),bt=new A({status:400,error:"bad_request",reason:"Something wrong with the request"}),mt=(new A({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new A({status:404,error:"not_found",reason:"Database not found"}),new A({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new A({status:500,error:"web_sql_went_bad",reason:"unknown"}),new A({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new A({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new A({status:400,error:"bad_request",reason:"Invalid rev format"})),_t=(new A({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new A({status:412,error:"missing_stub"})),wt=(new A({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),L.name);ct=wt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var Et=ct,kt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),St=D(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),xt=D(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),Bt=function(e){return atob(e)},Rt=function(e){return btoa(e)},At=n.setImmediate||n.setTimeout,jt=32768;Re.prototype.get=function(e,n,r){var i=Be(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Re.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var Ot="document-store",Tt="by-sequence",Lt="attach-store",Mt="attach-binary-store",Ct="local-store",It="meta-store",Dt=new p,qt="_local_last_update_seq",Nt="_local_doc_count",Pt="_local_uuid",Ut="md5-",Wt={encode:Ee,decode:we,buffer:!1,type:"cheap-json"},Ft=new x;Me.valid=function(){return"undefined"!=typeof localStorage},Me.use_prefix=!0;var zt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");zt?Ce(zt):B("error",'localstorage adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(56),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(8).Buffer)},{11:11,21:21,25:25,31:31,34:34,4:4,40:40,46:46,47:47,53:53,56:56,64:64,65:65,8:8,85:85,91:91,pouchdb:"pouchdb"}]},{},[93]); diff --git a/lib/pouchdb/dist/pouchdb.memory.js b/lib/pouchdb/dist/pouchdb.memory.js index d1ef46ac..4d1d11ba 100644 --- a/lib/pouchdb/dist/pouchdb.memory.js +++ b/lib/pouchdb/dist/pouchdb.memory.js @@ -1,4 +1,4 @@ -// PouchDB in-memory plugin 6.0.6 +// PouchDB in-memory plugin 6.0.7 // Based on MemDOWN: https://github.com/rvagg/memdown // // (c) 2012-2016 Dale Harvey and the PouchDB team @@ -2343,7 +2343,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = _dereq_(51); +exports.humanize = _dereq_(50); /** * The currently active debug mode names, and names to skip. @@ -2528,8 +2528,8 @@ function coerce(val) { return val; } -},{"51":51}],9:[function(_dereq_,module,exports){ -var util = _dereq_(86) +},{"50":50}],9:[function(_dereq_,module,exports){ +var util = _dereq_(85) , AbstractIterator = _dereq_(14).AbstractIterator @@ -2564,9 +2564,9 @@ DeferredIterator.prototype._operation = function (method, args) { module.exports = DeferredIterator; -},{"14":14,"86":86}],10:[function(_dereq_,module,exports){ +},{"14":14,"85":85}],10:[function(_dereq_,module,exports){ (function (Buffer,process){ -var util = _dereq_(86) +var util = _dereq_(85) , AbstractLevelDOWN = _dereq_(14).AbstractLevelDOWN , DeferredIterator = _dereq_(9) @@ -2623,8 +2623,8 @@ DeferredLevelDOWN.prototype._iterator = function (options) { module.exports = DeferredLevelDOWN module.exports.DeferredIterator = DeferredIterator -}).call(this,{"isBuffer":_dereq_(26)},_dereq_(53)) -},{"14":14,"26":26,"53":53,"86":86,"9":9}],11:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(26)},_dereq_(52)) +},{"14":14,"26":26,"52":52,"85":85,"9":9}],11:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -2706,8 +2706,8 @@ AbstractChainedBatch.prototype.write = function (options, callback) { } module.exports = AbstractChainedBatch -}).call(this,_dereq_(53)) -},{"53":53}],12:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],12:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -2759,8 +2759,8 @@ AbstractIterator.prototype.end = function (callback) { module.exports = AbstractIterator -}).call(this,_dereq_(53)) -},{"53":53}],13:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],13:[function(_dereq_,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -3035,8 +3035,8 @@ AbstractLevelDOWN.prototype._checkKey = function (obj, type) { module.exports = AbstractLevelDOWN -}).call(this,{"isBuffer":_dereq_(26)},_dereq_(53)) -},{"11":11,"12":12,"16":16,"26":26,"53":53}],14:[function(_dereq_,module,exports){ +}).call(this,{"isBuffer":_dereq_(26)},_dereq_(52)) +},{"11":11,"12":12,"16":16,"26":26,"52":52}],14:[function(_dereq_,module,exports){ exports.AbstractLevelDOWN = _dereq_(13) exports.AbstractIterator = _dereq_(12) exports.AbstractChainedBatch = _dereq_(11) @@ -5308,42 +5308,7 @@ module.exports = Array.isArray || function (arr) { }; },{}],28:[function(_dereq_,module,exports){ -(function(factory) { - if(typeof exports === 'object') { - factory(exports); - } else { - factory(this); - } -}).call(this, function(root) { - - var slice = Array.prototype.slice, - each = Array.prototype.forEach; - - var extend = function(obj) { - if(typeof obj !== 'object') throw obj + ' is not an object' ; - - var sources = slice.call(arguments, 1); - - each.call(sources, function(source) { - if(source) { - for(var prop in source) { - if(typeof source[prop] === 'object' && obj[prop]) { - extend.call(obj, obj[prop], source[prop]); - } else { - obj[prop] = source[prop]; - } - } - } - }); - - return obj; - } - - root.extend = extend; -}); - -},{}],29:[function(_dereq_,module,exports){ -var encodings = _dereq_(30); +var encodings = _dereq_(29); module.exports = Codec; @@ -5450,7 +5415,7 @@ Codec.prototype.valueAsBuffer = function(opts){ }; -},{"30":30}],30:[function(_dereq_,module,exports){ +},{"29":29}],29:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -5532,7 +5497,7 @@ function isBinary(data){ }).call(this,_dereq_(5).Buffer) -},{"5":5}],31:[function(_dereq_,module,exports){ +},{"5":5}],30:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2015 LevelUP contributors * See list at * MIT License @@ -5556,11 +5521,11 @@ module.exports = { , EncodingError : createError('EncodingError', LevelUPError) } -},{"19":19}],32:[function(_dereq_,module,exports){ +},{"19":19}],31:[function(_dereq_,module,exports){ var inherits = _dereq_(25); -var Readable = _dereq_(61).Readable; -var extend = _dereq_(33); -var EncodingError = _dereq_(31).EncodingError; +var Readable = _dereq_(60).Readable; +var extend = _dereq_(32); +var EncodingError = _dereq_(30).EncodingError; module.exports = ReadStream; inherits(ReadStream, Readable); @@ -5614,17 +5579,17 @@ ReadStream.prototype._cleanup = function(){ }; -},{"25":25,"31":31,"33":33,"61":61}],33:[function(_dereq_,module,exports){ +},{"25":25,"30":30,"32":32,"60":60}],32:[function(_dereq_,module,exports){ arguments[4][16][0].apply(exports,arguments) -},{"16":16}],34:[function(_dereq_,module,exports){ +},{"16":16}],33:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var util = _dereq_(36) - , WriteError = _dereq_(31).WriteError +var util = _dereq_(35) + , WriteError = _dereq_(30).WriteError , getOptions = util.getOptions , dispatchError = util.dispatchError @@ -5701,7 +5666,7 @@ Batch.prototype.write = function (callback) { module.exports = Batch -},{"31":31,"36":36}],35:[function(_dereq_,module,exports){ +},{"30":30,"35":35}],34:[function(_dereq_,module,exports){ (function (process){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at @@ -5710,14 +5675,14 @@ module.exports = Batch */ var EventEmitter = _dereq_(21).EventEmitter - , inherits = _dereq_(86).inherits - , deprecate = _dereq_(86).deprecate - , extend = _dereq_(39) - , prr = _dereq_(54) + , inherits = _dereq_(85).inherits + , deprecate = _dereq_(85).deprecate + , extend = _dereq_(38) + , prr = _dereq_(53) , DeferredLevelDOWN = _dereq_(10) - , IteratorStream = _dereq_(32) + , IteratorStream = _dereq_(31) - , errors = _dereq_(31) + , errors = _dereq_(30) , WriteError = errors.WriteError , ReadError = errors.ReadError , NotFoundError = errors.NotFoundError @@ -5725,9 +5690,9 @@ var EventEmitter = _dereq_(21).EventEmitter , EncodingError = errors.EncodingError , InitializationError = errors.InitializationError - , util = _dereq_(36) - , Batch = _dereq_(34) - , Codec = _dereq_(37) + , util = _dereq_(35) + , Batch = _dereq_(33) + , Codec = _dereq_(36) , getOptions = util.getOptions , defaultOptions = util.defaultOptions @@ -6092,7 +6057,7 @@ function utilStatic (name) { } module.exports = LevelUP -module.exports.errors = _dereq_(31) +module.exports.errors = _dereq_(30) module.exports.destroy = deprecate( utilStatic('destroy') , 'levelup.destroy() is deprecated. Use leveldown.destroy() instead' @@ -6103,17 +6068,17 @@ module.exports.repair = deprecate( ) -}).call(this,_dereq_(53)) -},{"10":10,"21":21,"31":31,"32":32,"34":34,"36":36,"37":37,"39":39,"53":53,"54":54,"86":86}],36:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"10":10,"21":21,"30":30,"31":31,"33":33,"35":35,"36":36,"38":38,"52":52,"53":53,"85":85}],35:[function(_dereq_,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License * */ -var extend = _dereq_(39) - , LevelUPError = _dereq_(31).LevelUPError - , format = _dereq_(86).format +var extend = _dereq_(38) + , LevelUPError = _dereq_(30).LevelUPError + , format = _dereq_(85).format , defaultOptions = { createIfMissing : true , errorIfExists : false @@ -6136,7 +6101,7 @@ function getLevelDOWN () { if (leveldown) return leveldown - var requiredVersion = _dereq_(40).devDependencies.leveldown + var requiredVersion = _dereq_(39).devDependencies.leveldown , leveldownVersion try { @@ -6183,9 +6148,9 @@ module.exports = { , isDefined : isDefined } -},{"3":3,"31":31,"39":39,"40":40,"86":86}],37:[function(_dereq_,module,exports){ -arguments[4][29][0].apply(exports,arguments) -},{"29":29,"38":38}],38:[function(_dereq_,module,exports){ +},{"3":3,"30":30,"38":38,"39":39,"85":85}],36:[function(_dereq_,module,exports){ +arguments[4][28][0].apply(exports,arguments) +},{"28":28,"37":37}],37:[function(_dereq_,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { @@ -6265,58 +6230,56 @@ function isBinary(data){ }).call(this,_dereq_(5).Buffer) -},{"5":5}],39:[function(_dereq_,module,exports){ +},{"5":5}],38:[function(_dereq_,module,exports){ arguments[4][16][0].apply(exports,arguments) -},{"16":16}],40:[function(_dereq_,module,exports){ +},{"16":16}],39:[function(_dereq_,module,exports){ module.exports={ "_args": [ [ { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "/Users/nolan/workspace/pouchdb" ] ], - "_from": "levelup@1.3.2", - "_id": "levelup@1.3.2", + "_from": "levelup@1.3.3", + "_id": "levelup@1.3.3", "_inCache": true, "_installable": true, "_location": "/levelup", - "_nodeVersion": "6.1.0", + "_nodeVersion": "4.4.7", "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446" }, "_npmUser": { - "name": "ralphtheninja", - "email": "ralphtheninja@riseup.net" + "name": "juliangruber", + "email": "julian@juliangruber.com" }, - "_npmVersion": "3.8.6", + "_npmVersion": "2.15.8", "_phantomChildren": {}, "_requested": { - "raw": "levelup@1.3.2", + "raw": "levelup@1.3.3", "scope": null, "escapedName": "levelup", "name": "levelup", - "rawSpec": "1.3.2", - "spec": "1.3.2", + "rawSpec": "1.3.3", + "spec": "1.3.3", "type": "version" }, "_requiredBy": [ - "/", - "/pouchdb", - "/pouchdb-adapter-leveldb-core" + "/" ], - "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz", - "_shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", + "_resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz", + "_shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", "_shrinkwrap": null, - "_spec": "levelup@1.3.2", + "_spec": "levelup@1.3.3", "_where": "/Users/nolan/workspace/pouchdb", "browser": { "leveldown": false, @@ -6424,10 +6387,10 @@ module.exports={ }, "directories": {}, "dist": { - "shasum": "b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9", - "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz" + "shasum": "bf9db62bdb6188d08eaaa2efcf6cc311916f41fd", + "tarball": "https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz" }, - "gitHead": "bcc242cfc4ec035f9228a5cd54903cb126659a00", + "gitHead": "cced27dc9f0095823be5ed388ec601ec2bfe7366", "homepage": "https://github.com/level/levelup", "keywords": [ "leveldb", @@ -6464,10 +6427,10 @@ module.exports={ "scripts": { "test": "tape test/*-test.js | faucet" }, - "version": "1.3.2" + "version": "1.3.3" } -},{}],41:[function(_dereq_,module,exports){ +},{}],40:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(24); @@ -6722,7 +6685,7 @@ function race(iterable) { } } -},{"24":24}],42:[function(_dereq_,module,exports){ +},{"24":24}],41:[function(_dereq_,module,exports){ (function (Buffer){ exports.compare = function (a, b) { @@ -6872,12 +6835,12 @@ exports.filter = function (range, compare) { } }).call(this,{"isBuffer":_dereq_(26)}) -},{"26":26}],43:[function(_dereq_,module,exports){ +},{"26":26}],42:[function(_dereq_,module,exports){ (function (process,global,Buffer){ var inherits = _dereq_(25) - , AbstractLevelDOWN = _dereq_(47).AbstractLevelDOWN - , AbstractIterator = _dereq_(47).AbstractIterator - , ltgt = _dereq_(49) + , AbstractLevelDOWN = _dereq_(46).AbstractLevelDOWN + , AbstractIterator = _dereq_(46).AbstractIterator + , ltgt = _dereq_(48) , createRBT = _dereq_(22) , globalStore = {} /* istanbul ignore next */ @@ -7101,18 +7064,18 @@ MemDOWN.destroy = function (name, callback) { module.exports = MemDOWN -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(5).Buffer) -},{"22":22,"25":25,"47":47,"49":49,"5":5,"53":53}],44:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(5).Buffer) +},{"22":22,"25":25,"46":46,"48":48,"5":5,"52":52}],43:[function(_dereq_,module,exports){ arguments[4][11][0].apply(exports,arguments) -},{"11":11,"53":53}],45:[function(_dereq_,module,exports){ +},{"11":11,"52":52}],44:[function(_dereq_,module,exports){ arguments[4][12][0].apply(exports,arguments) -},{"12":12,"53":53}],46:[function(_dereq_,module,exports){ +},{"12":12,"52":52}],45:[function(_dereq_,module,exports){ arguments[4][13][0].apply(exports,arguments) -},{"13":13,"26":26,"44":44,"45":45,"50":50,"53":53}],47:[function(_dereq_,module,exports){ +},{"13":13,"26":26,"43":43,"44":44,"49":49,"52":52}],46:[function(_dereq_,module,exports){ arguments[4][14][0].apply(exports,arguments) -},{"14":14,"44":44,"45":45,"46":46,"48":48}],48:[function(_dereq_,module,exports){ +},{"14":14,"43":43,"44":44,"45":45,"47":47}],47:[function(_dereq_,module,exports){ arguments[4][15][0].apply(exports,arguments) -},{"15":15,"46":46}],49:[function(_dereq_,module,exports){ +},{"15":15,"45":45}],48:[function(_dereq_,module,exports){ (function (Buffer){ exports.compare = function (a, b) { @@ -7211,9 +7174,9 @@ exports.filter = function (range, compare) { } }).call(this,{"isBuffer":_dereq_(26)}) -},{"26":26}],50:[function(_dereq_,module,exports){ +},{"26":26}],49:[function(_dereq_,module,exports){ arguments[4][16][0].apply(exports,arguments) -},{"16":16}],51:[function(_dereq_,module,exports){ +},{"16":16}],50:[function(_dereq_,module,exports){ /** * Helpers. */ @@ -7340,7 +7303,7 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],52:[function(_dereq_,module,exports){ +},{}],51:[function(_dereq_,module,exports){ (function (process){ 'use strict'; @@ -7386,8 +7349,8 @@ function nextTick(fn, arg1, arg2, arg3) { } } -}).call(this,_dereq_(53)) -},{"53":53}],53:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52}],52:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -7569,9 +7532,9 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],54:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ arguments[4][20][0].apply(exports,arguments) -},{"20":20}],55:[function(_dereq_,module,exports){ +},{"20":20}],54:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7615,8 +7578,8 @@ var util = _dereq_(6); util.inherits = _dereq_(25); /**/ -var Readable = _dereq_(57); -var Writable = _dereq_(59); +var Readable = _dereq_(56); +var Writable = _dereq_(58); util.inherits(Duplex, Readable); @@ -7663,8 +7626,8 @@ function forEach (xs, f) { } } -}).call(this,_dereq_(53)) -},{"25":25,"53":53,"57":57,"59":59,"6":6}],56:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"52":52,"56":56,"58":58,"6":6}],55:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -7692,7 +7655,7 @@ function forEach (xs, f) { module.exports = PassThrough; -var Transform = _dereq_(58); +var Transform = _dereq_(57); /**/ var util = _dereq_(6); @@ -7712,7 +7675,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"25":25,"58":58,"6":6}],57:[function(_dereq_,module,exports){ +},{"25":25,"57":57,"6":6}],56:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -7738,7 +7701,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { module.exports = Readable; /**/ -var isArray = _dereq_(60); +var isArray = _dereq_(59); /**/ @@ -7756,7 +7719,7 @@ if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { }; /**/ -var Stream = _dereq_(63); +var Stream = _dereq_(62); /**/ var util = _dereq_(6); @@ -7829,7 +7792,7 @@ function ReadableState(options, stream) { this.encoding = null; if (options.encoding) { if (!StringDecoder) - StringDecoder = _dereq_(75).StringDecoder; + StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -7930,7 +7893,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function(enc) { if (!StringDecoder) - StringDecoder = _dereq_(75).StringDecoder; + StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; }; @@ -8697,8 +8660,8 @@ function indexOf (xs, x) { return -1; } -}).call(this,_dereq_(53)) -},{"21":21,"25":25,"5":5,"53":53,"6":6,"60":60,"63":63,"75":75}],58:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"21":21,"25":25,"5":5,"52":52,"59":59,"6":6,"62":62,"74":74}],57:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8765,7 +8728,7 @@ function indexOf (xs, x) { module.exports = Transform; -var Duplex = _dereq_(55); +var Duplex = _dereq_(54); /**/ var util = _dereq_(6); @@ -8910,7 +8873,7 @@ function done(stream, er) { return stream.push(null); } -},{"25":25,"55":55,"6":6}],59:[function(_dereq_,module,exports){ +},{"25":25,"54":54,"6":6}],58:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -8951,7 +8914,7 @@ var util = _dereq_(6); util.inherits = _dereq_(25); /**/ -var Stream = _dereq_(63); +var Stream = _dereq_(62); util.inherits(Writable, Stream); @@ -9033,7 +8996,7 @@ function WritableState(options, stream) { } function Writable(options) { - var Duplex = _dereq_(55); + var Duplex = _dereq_(54); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -9299,23 +9262,23 @@ function endWritable(stream, state, cb) { state.ended = true; } -}).call(this,_dereq_(53)) -},{"25":25,"5":5,"53":53,"55":55,"6":6,"63":63}],60:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"25":25,"5":5,"52":52,"54":54,"6":6,"62":62}],59:[function(_dereq_,module,exports){ module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; -},{}],61:[function(_dereq_,module,exports){ -var Stream = _dereq_(63); // hack to fix a circular dependency issue when used with browserify -exports = module.exports = _dereq_(57); +},{}],60:[function(_dereq_,module,exports){ +var Stream = _dereq_(62); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = _dereq_(56); exports.Stream = Stream; exports.Readable = exports; -exports.Writable = _dereq_(59); -exports.Duplex = _dereq_(55); -exports.Transform = _dereq_(58); -exports.PassThrough = _dereq_(56); +exports.Writable = _dereq_(58); +exports.Duplex = _dereq_(54); +exports.Transform = _dereq_(57); +exports.PassThrough = _dereq_(55); -},{"55":55,"56":56,"57":57,"58":58,"59":59,"63":63}],62:[function(_dereq_,module,exports){ +},{"54":54,"55":55,"56":56,"57":57,"58":58,"62":62}],61:[function(_dereq_,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -10020,7 +9983,7 @@ exports.PassThrough = _dereq_(56); return SparkMD5; })); -},{}],63:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -10048,11 +10011,11 @@ var EE = _dereq_(21).EventEmitter; var inherits = _dereq_(25); inherits(Stream, EE); -Stream.Readable = _dereq_(72); -Stream.Writable = _dereq_(74); -Stream.Duplex = _dereq_(64); -Stream.Transform = _dereq_(73); -Stream.PassThrough = _dereq_(71); +Stream.Readable = _dereq_(71); +Stream.Writable = _dereq_(73); +Stream.Duplex = _dereq_(63); +Stream.Transform = _dereq_(72); +Stream.PassThrough = _dereq_(70); // Backwards-compat with node 0.4.x Stream.Stream = Stream; @@ -10149,10 +10112,10 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"21":21,"25":25,"64":64,"71":71,"72":72,"73":73,"74":74}],64:[function(_dereq_,module,exports){ -module.exports = _dereq_(65) +},{"21":21,"25":25,"63":63,"70":70,"71":71,"72":72,"73":73}],63:[function(_dereq_,module,exports){ +module.exports = _dereq_(64) -},{"65":65}],65:[function(_dereq_,module,exports){ +},{"64":64}],64:[function(_dereq_,module,exports){ // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from @@ -10173,7 +10136,7 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -10181,8 +10144,8 @@ var util = _dereq_(6); util.inherits = _dereq_(25); /**/ -var Readable = _dereq_(67); -var Writable = _dereq_(69); +var Readable = _dereq_(66); +var Writable = _dereq_(68); util.inherits(Duplex, Readable); @@ -10228,7 +10191,7 @@ function forEach(xs, f) { f(xs[i], i); } } -},{"25":25,"52":52,"6":6,"67":67,"69":69}],66:[function(_dereq_,module,exports){ +},{"25":25,"51":51,"6":6,"66":66,"68":68}],65:[function(_dereq_,module,exports){ // a passthrough stream. // basically just the most minimal sort of Transform stream. // Every written chunk gets output as-is. @@ -10237,7 +10200,7 @@ function forEach(xs, f) { module.exports = PassThrough; -var Transform = _dereq_(68); +var Transform = _dereq_(67); /**/ var util = _dereq_(6); @@ -10255,14 +10218,14 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"25":25,"6":6,"68":68}],67:[function(_dereq_,module,exports){ +},{"25":25,"6":6,"67":67}],66:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -10310,7 +10273,7 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = _dereq_(70); +var BufferList = _dereq_(69); var StringDecoder; util.inherits(Readable, Stream); @@ -10329,7 +10292,7 @@ function prependListener(emitter, event, fn) { var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); options = options || {}; @@ -10391,7 +10354,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -10399,7 +10362,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); if (!(this instanceof Readable)) return new Readable(options); @@ -10502,7 +10465,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -11194,8 +11157,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(53)) -},{"21":21,"25":25,"27":27,"3":3,"4":4,"5":5,"52":52,"53":53,"6":6,"65":65,"70":70,"75":75}],68:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"21":21,"25":25,"27":27,"3":3,"4":4,"5":5,"51":51,"52":52,"6":6,"64":64,"69":69,"74":74}],67:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -11242,7 +11205,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(65); +var Duplex = _dereq_(64); /**/ var util = _dereq_(6); @@ -11376,7 +11339,7 @@ function done(stream, er) { return stream.push(null); } -},{"25":25,"6":6,"65":65}],69:[function(_dereq_,module,exports){ +},{"25":25,"6":6,"64":64}],68:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -11387,7 +11350,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -11403,7 +11366,7 @@ util.inherits = _dereq_(25); /**/ var internalUtil = { - deprecate: _dereq_(83) + deprecate: _dereq_(82) }; /**/ @@ -11436,7 +11399,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); options = options || {}; @@ -11552,7 +11515,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(65); + Duplex = Duplex || _dereq_(64); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -11904,8 +11867,8 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(53)) -},{"21":21,"25":25,"4":4,"5":5,"52":52,"53":53,"6":6,"65":65,"83":83}],70:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"21":21,"25":25,"4":4,"5":5,"51":51,"52":52,"6":6,"64":64,"82":82}],69:[function(_dereq_,module,exports){ 'use strict'; var Buffer = _dereq_(5).Buffer; @@ -11970,36 +11933,36 @@ BufferList.prototype.concat = function (n) { } return ret; }; -},{"4":4,"5":5}],71:[function(_dereq_,module,exports){ -module.exports = _dereq_(66) +},{"4":4,"5":5}],70:[function(_dereq_,module,exports){ +module.exports = _dereq_(65) -},{"66":66}],72:[function(_dereq_,module,exports){ +},{"65":65}],71:[function(_dereq_,module,exports){ (function (process){ var Stream = (function (){ try { return _dereq_('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify } catch(_){} }()); -exports = module.exports = _dereq_(67); +exports = module.exports = _dereq_(66); exports.Stream = Stream || exports; exports.Readable = exports; -exports.Writable = _dereq_(69); -exports.Duplex = _dereq_(65); -exports.Transform = _dereq_(68); -exports.PassThrough = _dereq_(66); +exports.Writable = _dereq_(68); +exports.Duplex = _dereq_(64); +exports.Transform = _dereq_(67); +exports.PassThrough = _dereq_(65); if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { module.exports = Stream; } -}).call(this,_dereq_(53)) -},{"53":53,"65":65,"66":66,"67":67,"68":68,"69":69}],73:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52,"64":64,"65":65,"66":66,"67":67,"68":68}],72:[function(_dereq_,module,exports){ +module.exports = _dereq_(67) + +},{"67":67}],73:[function(_dereq_,module,exports){ module.exports = _dereq_(68) },{"68":68}],74:[function(_dereq_,module,exports){ -module.exports = _dereq_(69) - -},{"69":69}],75:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -12222,16 +12185,16 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"5":5}],76:[function(_dereq_,module,exports){ -arguments[4][65][0].apply(exports,arguments) -},{"25":25,"52":52,"6":6,"65":65,"77":77,"79":79}],77:[function(_dereq_,module,exports){ +},{"5":5}],75:[function(_dereq_,module,exports){ +arguments[4][64][0].apply(exports,arguments) +},{"25":25,"51":51,"6":6,"64":64,"76":76,"78":78}],76:[function(_dereq_,module,exports){ (function (process){ 'use strict'; module.exports = Readable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -12286,7 +12249,7 @@ util.inherits(Readable, Stream); var Duplex; function ReadableState(options, stream) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); options = options || {}; @@ -12345,7 +12308,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -12353,7 +12316,7 @@ function ReadableState(options, stream) { var Duplex; function Readable(options) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); if (!(this instanceof Readable)) return new Readable(options); @@ -12456,7 +12419,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = _dereq_(75).StringDecoder; + if (!StringDecoder) StringDecoder = _dereq_(74).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -13106,8 +13069,8 @@ function indexOf(xs, x) { } return -1; } -}).call(this,_dereq_(53)) -},{"21":21,"25":25,"27":27,"3":3,"5":5,"52":52,"53":53,"6":6,"75":75,"76":76}],78:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"21":21,"25":25,"27":27,"3":3,"5":5,"51":51,"52":52,"6":6,"74":74,"75":75}],77:[function(_dereq_,module,exports){ // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -13154,7 +13117,7 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = _dereq_(76); +var Duplex = _dereq_(75); /**/ var util = _dereq_(6); @@ -13288,7 +13251,7 @@ function done(stream, er) { return stream.push(null); } -},{"25":25,"6":6,"76":76}],79:[function(_dereq_,module,exports){ +},{"25":25,"6":6,"75":75}],78:[function(_dereq_,module,exports){ (function (process){ // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all @@ -13299,7 +13262,7 @@ function done(stream, er) { module.exports = Writable; /**/ -var processNextTick = _dereq_(52); +var processNextTick = _dereq_(51); /**/ /**/ @@ -13319,7 +13282,7 @@ util.inherits = _dereq_(25); /**/ var internalUtil = { - deprecate: _dereq_(83) + deprecate: _dereq_(82) }; /**/ @@ -13349,7 +13312,7 @@ function WriteReq(chunk, encoding, cb) { var Duplex; function WritableState(options, stream) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); options = options || {}; @@ -13466,7 +13429,7 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { var Duplex; function Writable(options) { - Duplex = Duplex || _dereq_(76); + Duplex = Duplex || _dereq_(75); // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. @@ -13806,16 +13769,16 @@ function CorkedRequest(state) { } }; } -}).call(this,_dereq_(53)) -},{"21":21,"25":25,"5":5,"52":52,"53":53,"6":6,"76":76,"83":83}],80:[function(_dereq_,module,exports){ -arguments[4][73][0].apply(exports,arguments) -},{"73":73,"78":78}],81:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"21":21,"25":25,"5":5,"51":51,"52":52,"6":6,"75":75,"82":82}],79:[function(_dereq_,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"72":72,"77":77}],80:[function(_dereq_,module,exports){ arguments[4][16][0].apply(exports,arguments) -},{"16":16}],82:[function(_dereq_,module,exports){ +},{"16":16}],81:[function(_dereq_,module,exports){ (function (process){ -var Transform = _dereq_(80) - , inherits = _dereq_(86).inherits - , xtend = _dereq_(81) +var Transform = _dereq_(79) + , inherits = _dereq_(85).inherits + , xtend = _dereq_(80) function DestroyableTransform(opts) { Transform.call(this, opts) @@ -13910,8 +13873,8 @@ module.exports.obj = through2(function (options, transform, flush) { return t2 }) -}).call(this,_dereq_(53)) -},{"53":53,"80":80,"81":81,"86":86}],83:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52)) +},{"52":52,"79":79,"80":80,"85":85}],82:[function(_dereq_,module,exports){ (function (global){ /** @@ -13982,16 +13945,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],84:[function(_dereq_,module,exports){ +},{}],83:[function(_dereq_,module,exports){ arguments[4][25][0].apply(exports,arguments) -},{"25":25}],85:[function(_dereq_,module,exports){ +},{"25":25}],84:[function(_dereq_,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],86:[function(_dereq_,module,exports){ +},{}],85:[function(_dereq_,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14518,7 +14481,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = _dereq_(85); +exports.isBuffer = _dereq_(84); function objectToString(o) { return Object.prototype.toString.call(o); @@ -14562,7 +14525,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = _dereq_(84); +exports.inherits = _dereq_(83); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -14580,8 +14543,8 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"53":53,"84":84,"85":85}],87:[function(_dereq_,module,exports){ +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"52":52,"83":83,"84":84}],86:[function(_dereq_,module,exports){ 'use strict'; /** @@ -14756,28 +14719,27 @@ exports.parse = function (str) { } }; -},{}],88:[function(_dereq_,module,exports){ +},{}],87:[function(_dereq_,module,exports){ (function (process,global,Buffer){ 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var levelup = _interopDefault(_dereq_(35)); -var ltgt = _interopDefault(_dereq_(42)); +var levelup = _interopDefault(_dereq_(34)); +var ltgt = _interopDefault(_dereq_(41)); var events = _dereq_(21); var events__default = _interopDefault(events); var inherits = _interopDefault(_dereq_(25)); -var Codec = _interopDefault(_dereq_(29)); -var ReadableStreamCore = _interopDefault(_dereq_(61)); -var through2 = _dereq_(82); +var Codec = _interopDefault(_dereq_(28)); +var ReadableStreamCore = _interopDefault(_dereq_(60)); +var through2 = _dereq_(81); var getArguments = _interopDefault(_dereq_(1)); var Deque = _interopDefault(_dereq_(17)); -var lie = _interopDefault(_dereq_(41)); +var lie = _interopDefault(_dereq_(40)); var debug = _interopDefault(_dereq_(7)); -var Md5 = _interopDefault(_dereq_(62)); -var vuvuzela = _interopDefault(_dereq_(87)); -var jsExtend = _dereq_(28); -var memdown = _interopDefault(_dereq_(43)); +var Md5 = _interopDefault(_dereq_(61)); +var vuvuzela = _interopDefault(_dereq_(86)); +var memdown = _interopDefault(_dereq_(42)); function isFunction(f) { return 'function' === typeof f; @@ -15458,6 +15420,35 @@ function guardedConsole(method) { } } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -18249,7 +18240,7 @@ function LevelPouch(opts, callback) { } function MemDownPouch(opts, callback) { - var _opts = jsExtend.extend({ + var _opts = extend$1({ db: memdown }, opts); @@ -18276,5 +18267,5 @@ if (!PDB) { } else { MemoryPouchPlugin(PDB); } -}).call(this,_dereq_(53),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(5).Buffer) -},{"1":1,"17":17,"21":21,"25":25,"28":28,"29":29,"35":35,"41":41,"42":42,"43":43,"5":5,"53":53,"61":61,"62":62,"7":7,"82":82,"87":87,"pouchdb":"pouchdb"}]},{},[88]); +}).call(this,_dereq_(52),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_(5).Buffer) +},{"1":1,"17":17,"21":21,"25":25,"28":28,"34":34,"40":40,"41":41,"42":42,"5":5,"52":52,"60":60,"61":61,"7":7,"81":81,"86":86,"pouchdb":"pouchdb"}]},{},[87]); diff --git a/lib/pouchdb/dist/pouchdb.memory.min.js b/lib/pouchdb/dist/pouchdb.memory.min.js index 168fa8d3..27341d6e 100644 --- a/lib/pouchdb/dist/pouchdb.memory.min.js +++ b/lib/pouchdb/dist/pouchdb.memory.min.js @@ -1,14 +1,14 @@ -// PouchDB in-memory plugin 6.0.6 +// PouchDB in-memory plugin 6.0.7 // Based on MemDOWN: https://github.com/rvagg/memdown // // (c) 2012-2016 Dale Harvey and the PouchDB team // PouchDB may be freely distributed under the Apache license, version 2.0. // For all details and documentation: // http://pouchdb.com -!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var f=0;for(t=0,n=0;t>16&255,s[f++]=o>>8&255,s[f++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[f++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[f++]=o>>8&255,s[f++]=255&o),s}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,n){for(var r,i=[],o=t;oc?c:u+a));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var f=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),f=u.length,c=-1;++ca)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{5:5}],5:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),a.alloc(+e)}function y(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function _(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var f;if(i){var c=-1;for(f=n;fs&&(n=s-u),f=n;f>=0;f--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,f,c,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],f=e[i+2],128===(192&u)&&128===(192&f)&&(l=(15&o)<<12|(63&u)<<6|63&f,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],f=e[i+2],c=e[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(l=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function I(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||I(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||I(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(2),Z=e(23),Q=e(27);n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return f(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),f=this.slice(r,i),c=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;P(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(8),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{8:8}],8:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(f||t);e.diff=o,e.prev=f,e.curr=t,f=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],18:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(20);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{20:20}],19:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(18)(t.exports),t.exports.create=t.exports.custom.createError},{18:18}],20:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],21:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),f=n.slice(),r=f.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],22:[function(e,t,n){"use strict";function r(e,t,n,r,i,o){this._color=e,this.key=t,this.value=n,this.left=r,this.right=i,this._count=o}function i(e){return new r(e._color,e.key,e.value,e.left,e.right,e._count)}function o(e,t){return new r(e,t.key,t.value,t.left,t.right,t._count)}function a(e){e._count=1+(e.left?e.left._count:0)+(e.right?e.right._count:0)}function s(e,t){this._compare=e,this.root=t}function u(e,t){if(t.left){var n=u(e,t.left);if(n)return n}var n=e(t.key,t.value);return n?n:t.right?u(e,t.right):void 0}function f(e,t,n,r){var i=t(e,r.key);if(i<=0){if(r.left){var o=f(e,t,n,r.left);if(o)return o}var o=n(r.key,r.value);if(o)return o}if(r.right)return f(e,t,n,r.right)}function c(e,t,n,r,i){var o,a=n(e,i.key),s=n(t,i.key);if(a<=0){if(i.left&&(o=c(e,t,n,r,i.left)))return o;if(s>0&&(o=r(i.key,i.value)))return o}if(s>0&&i.right)return c(e,t,n,r,i.right)}function l(e,t){this.tree=e,this._stack=t}function h(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e._color=t._color,e._count=t._count}function d(e){for(var t,n,r,s,u=e.length-1;u>=0;--u){if(t=e[u],0===u)return void(t._color=y);if(n=e[u-1],n.left===t){if(r=n.right,r.right&&r.right._color===v){if(r=n.right=i(r),s=r.right=i(r.right),n.right=r.left,r.left=n,r.right=s,r._color=n._color,t._color=y,n._color=y,s._color=y,a(n),a(r),u>1){var f=e[u-2];f.left===n?f.left=r:f.right=r}return void(e[u-1]=r)}if(r.left&&r.left._color===v){if(r=n.right=i(r),s=r.left=i(r.left),n.right=s.left,r.left=s.right,s.left=n,s.right=r,s._color=n._color,n._color=y,r._color=y,t._color=y,a(n),a(r),a(s),u>1){var f=e[u-2];f.left===n?f.left=s:f.right=s}return void(e[u-1]=s)}if(r._color===y){if(n._color===v)return n._color=y,void(n.right=o(v,r));n.right=o(v,r);continue}if(r=i(r),n.right=r.left,r.left=n,r._color=n._color,n._color=v,a(n),a(r),u>1){var f=e[u-2];f.left===n?f.left=r:f.right=r}e[u-1]=r,e[u]=n,u+11){var f=e[u-2];f.right===n?f.right=r:f.left=r}return void(e[u-1]=r)}if(r.right&&r.right._color===v){if(r=n.left=i(r),s=r.right=i(r.right),n.left=s.right,r.right=s.left,s.right=n,s.left=r,s._color=n._color,n._color=y,r._color=y,t._color=y,a(n),a(r),a(s),u>1){var f=e[u-2];f.right===n?f.right=s:f.left=s}return void(e[u-1]=s)}if(r._color===y){if(n._color===v)return n._color=y,void(n.left=o(v,r));n.left=o(v,r);continue}if(r=i(r),n.left=r.right,r.right=n,r._color=n._color,n._color=v,a(n),a(r),u>1){var f=e[u-2];f.right===n?f.right=r:f.left=r}e[u-1]=r,e[u]=n,u+1t?1:0}function g(e){return new s(e||p,null)}t.exports=g;var v=0,y=1,_=s.prototype;Object.defineProperty(_,"keys",{get:function(){var e=[];return this.forEach(function(t,n){e.push(t)}),e}}),Object.defineProperty(_,"values",{get:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e}}),Object.defineProperty(_,"length",{get:function(){return this.root?this.root._count:0}}),_.insert=function(e,t){for(var n=this._compare,i=this.root,u=[],f=[];i;){var c=n(e,i.key);u.push(i),f.push(c),i=c<=0?i.left:i.right}u.push(new r(v,e,t,null,null,1));for(var l=u.length-2;l>=0;--l){var i=u[l];f[l]<=0?u[l]=new r(i._color,i.key,i.value,u[l+1],i.right,i._count+1):u[l]=new r(i._color,i.key,i.value,i.left,u[l+1],i._count+1)}for(var l=u.length-1;l>1;--l){var h=u[l-1],i=u[l];if(h._color===y||i._color===y)break;var d=u[l-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=y,h.right=d,u[l-2]=h,u[l-1]=i,a(d),a(h),l>=3){var g=u[l-3];g.left===d?g.left=h:g.right=h}break}h._color=y,d.right=o(y,p),d._color=v,l-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=y,i.left=h,i.right=d,u[l-2]=i,u[l-1]=h,a(d),a(h),a(i),l>=3){var g=u[l-3];g.left===d?g.left=i:g.right=i}break}h._color=y,d.right=o(y,p),d._color=v,l-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=y,h.left=d,u[l-2]=h,u[l-1]=i,a(d),a(h),l>=3){var g=u[l-3];g.right===d?g.right=h:g.left=h}break}h._color=y,d.left=o(y,p),d._color=v,l-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=y,i.right=h,i.left=d,u[l-2]=i,u[l-1]=h,a(d),a(h),a(i),l>=3){var g=u[l-3];g.right===d?g.right=i:g.left=i}break}h._color=y,d.left=o(y,p),d._color=v,l-=1}}return u[0]._color=y,new s(n,u[0])},_.forEach=function(e,t,n){if(this.root)switch(arguments.length){case 1:return u(e,this.root);case 2:return f(t,this._compare,e,this.root);case 3:if(this._compare(t,n)>=0)return;return c(t,n,this._compare,e,this.root)}},Object.defineProperty(_,"begin",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.left;return new l(this,e)}}),Object.defineProperty(_,"end",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.right;return new l(this,e)}}),_.at=function(e){if(e<0)return new l(this,[]);for(var t=this.root,n=[];;){if(n.push(t),t.left){if(e=t.right._count)break;t=t.right}return new l(this,[])},_.ge=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o<=0&&(i=r.length),n=o<=0?n.left:n.right}return r.length=i,new l(this,r)},_.gt=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o<0&&(i=r.length),n=o<0?n.left:n.right}return r.length=i,new l(this,r)},_.lt=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o>0&&(i=r.length),n=o<=0?n.left:n.right}return r.length=i,new l(this,r)},_.le=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o>=0&&(i=r.length),n=o<0?n.left:n.right}return r.length=i,new l(this,r)},_.find=function(e){for(var t=this._compare,n=this.root,r=[];n;){var i=t(e,n.key);if(r.push(n),0===i)return new l(this,r);n=i<=0?n.left:n.right}return new l(this,[])},_.remove=function(e){var t=this.find(e);return t?t.remove():this},_.get=function(e){for(var t=this._compare,n=this.root;n;){var r=t(e,n.key);if(0===r)return n.value;n=r<=0?n.left:n.right}};var m=l.prototype;Object.defineProperty(m,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(m,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),m.clone=function(){return new l(this.tree,this._stack.slice())},m.remove=function(){var e=this._stack;if(0===e.length)return this.tree;var t=new Array(e.length),n=e[e.length-1];t[t.length-1]=new r(n._color,n.key,n.value,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i){var n=e[i];n.left===e[i+1]?t[i]=new r(n._color,n.key,n.value,t[i+1],n.right,n._count):t[i]=new r(n._color,n.key,n.value,n.left,t[i+1],n._count)}if(n=t[t.length-1],n.left&&n.right){var o=t.length;for(n=n.left;n.right;)t.push(n),n=n.right;var a=t[o-1];t.push(new r(n._color,a.key,a.value,n.left,n.right,n._count)),t[o-1].key=n.key,t[o-1].value=n.value;for(var i=t.length-2;i>=o;--i)n=t[i],t[i]=new r(n._color,n.key,n.value,n.left,t[i+1],n._count);t[o-1].left=t[o]}if(n=t[t.length-1],n._color===v){var u=t[t.length-2];u.left===n?u.left=null:u.right===n&&(u.right=null),t.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(m,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(m,"index",{get:function(){var e=0,t=this._stack;if(0===t.length){var n=this.tree.root;return n?n._count:0}t[t.length-1].left&&(e=t[t.length-1].left._count);for(var r=t.length-2;r>=0;--r)t[r+1]===t[r].right&&(++e,t[r].left&&(e+=t[r].left._count));return e},enumerable:!0}),m.next=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.right)for(t=t.right;t;)e.push(t),t=t.left;else for(e.pop();e.length>0&&e[e.length-1].right===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(m,"hasNext",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].right)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}}),m.update=function(e){var t=this._stack;if(0===t.length)throw new Error("Can't update empty node!");var n=new Array(t.length),i=t[t.length-1];n[n.length-1]=new r(i._color,i.key,e,i.left,i.right,i._count);for(var o=t.length-2;o>=0;--o)i=t[o],i.left===t[o+1]?n[o]=new r(i._color,i.key,i.value,n[o+1],i.right,i._count):n[o]=new r(i._color,i.key,i.value,i.left,n[o+1],i._count);return new s(this.tree._compare,n[0])},m.prev=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.left)for(t=t.left;t;)e.push(t),t=t.right;else for(e.pop();e.length>0&&e[e.length-1].left===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(m,"hasPrev",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].left)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}})},{}],23:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=f}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,f-=8);e[n+d-p]|=128*g}},{}],24:[function(e,t,n){(function(e){"use strict";function n(){c=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{30:30}],30:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(5).Buffer)},{5:5}],31:[function(e,t,n){var r=e(19).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{19:19}],32:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(25),o=e(61).Readable,a=e(33),s=e(31).EncodingError; -t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)),void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{25:25,31:31,33:33,61:61}],33:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],34:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(36),o=e(31).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{31:31,36:36}],35:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(f.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=R(t),this.options=h(B,t),this._codec=new x(this.options),this._status="new",d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new _("Database is not open"),n),!0}function a(e,t,n){j(e,new y(t),n)}function s(e,t,n){j(e,new _(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var f=e(21).EventEmitter,c=e(86).inherits,l=e(86).deprecate,h=e(39),d=e(54),p=e(10),g=e(32),v=e(31),y=v.WriteError,_=v.ReadError,m=v.NotFoundError,b=v.OpenError,w=v.EncodingError,E=v.InitializationError,k=e(36),S=e(34),x=e(37),R=k.getOptions,B=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;c(i,f),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new b(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new _(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,f=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=R(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(f,new y(n),i):(f.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=R(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new y(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=R(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new y(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=R(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new b(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(31),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(53))},{10:10,21:21,31:31,32:32,34:34,36:36,37:37,39:39,53:53,54:54,86:86}],36:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(40).devDependencies.leveldown;try{t=e(3).version}catch(e){throw o(e)}if(!e(3).satisfies(t,n))throw new f("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(3)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new f(c(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,f=(e(39),e(31).LevelUPError),c=e(86).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{3:3,31:31,39:39,40:40,86:86}],37:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{29:29,38:38}],38:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(5).Buffer)},{5:5}],39:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],40:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.2",_id:"levelup@1.3.2",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"6.1.0",_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/levelup-1.3.2.tgz_1463496525467_0.4644940535072237"},_npmUser:{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},_npmVersion:"3.8.6",_phantomChildren:{},_requested:{raw:"levelup@1.3.2",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.2",spec:"1.3.2",type:"version"},_requiredBy:["/","/pouchdb","/pouchdb-adapter-leveldb-core"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz",_shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",_shrinkwrap:null,_spec:"levelup@1.3.2",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"b321d3071f0e75c2dfaf2f0fe8864e5b9a387bc9",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.2.tgz"},gitHead:"bcc242cfc4ec035f9228a5cd54903cb126659a00",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.2"}},{}],41:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=f(i);"error"===a.status&&n(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function c(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(f,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,f=new this(r);++un?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},f=n.upperBoundExclusive=function(e){return!!t(e,"lt")},c=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=c(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,f=n.lowerBoundKey(e),c=n.upperBoundKey(e);return f?"gt"===f?r.gt=i(e.gt,!1):r.gte=i(e[f],!1):u&&(r.gte=i(a,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var c=l(e);if(r(c)){var a=i(t,c);if(a>0||0===a&&f(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(26)})},{26:26}],43:[function(e,t,n){(function(n,r,i){function o(e){return p.compare(e,this._end)>0}function a(e){return p.compare(e,this._end)>=0}function s(e){return p.compare(e,this._end)<0}function u(e){return p.compare(e,this._end)<=0}function f(e,t){d.call(this,e),this._limit=t.limit,this._limit===-1&&(this._limit=1/0);var n=e._store[e._location];this.keyAsBuffer=t.keyAsBuffer!==!1,this.valueAsBuffer=t.valueAsBuffer!==!1,this._reverse=t.reverse,this._options=t,this._done=0,this._reverse?(this._incr="prev",this._start=p.upperBound(t),this._end=p.lowerBound(t),"undefined"==typeof this._start?this._tree=n.end:p.upperBoundInclusive(t)?this._tree=n.le(this._start):this._tree=n.lt(this._start),this._end&&(p.lowerBoundInclusive(t)?this._test=a:this._test=o)):(this._incr="next",this._start=p.lowerBound(t),this._end=p.upperBound(t),"undefined"==typeof this._start?this._tree=n.begin:p.lowerBoundInclusive(t)?this._tree=n.ge(this._start):this._tree=n.gt(this._start),this._end&&(p.upperBoundInclusive(t)?this._test=u:this._test=s))}function c(e){return this instanceof c?(h.call(this,"string"==typeof e?e:""),this._location=this.location?"$"+this.location:"_tree",this._store=this.location?v:this,void(this._store[this._location]=this._store[this._location]||g(p.compare))):new c(e)}var l=e(25),h=e(47).AbstractLevelDOWN,d=e(47).AbstractIterator,p=e(49),g=e(22),v={},y=r.setImmediate||n.nextTick;l(f,d),f.prototype._next=function(e){var t,n;return this._done++>=this._limit?y(e):this._tree.valid?(t=this._tree.key,n=this._tree.value,this._test(t)?(this.keyAsBuffer&&(t=new i(t)),this.valueAsBuffer&&(n=new i(n)),this._tree[this._incr](),void y(function(){e(null,t,n)})):y(e)):y(e)},f.prototype._test=function(){return!0},c.clearGlobalStore=function(e){e?Object.keys(v).forEach(function(e){delete v[e]}):v={}},l(c,h),c.prototype._open=function(e,t){var n=this;y(function(){t(null,n)})},c.prototype._put=function(e,t,n,r){"undefined"!=typeof t&&null!==t||(t="");var i=this._store[this._location].find(e);i.valid?this._store[this._location]=i.update(t):this._store[this._location]=this._store[this._location].insert(e,t),y(r)},c.prototype._get=function(e,t,n){var r=this._store[this._location].get(e);return"undefined"==typeof r?y(function(){n(new Error("NotFound"))}):(t.asBuffer===!1||this._isBuffer(r)||(r=new i(String(r))),void y(function(){n(null,r)}))},c.prototype._del=function(e,t,n){this._store[this._location]=this._store[this._location].remove(e),y(n)},c.prototype._batch=function(e,t,n){for(var r,i,o,a=-1,s=e.length,u=this._store[this._location];++an?1:0};var r=n.lowerBound=function(e){return t(e.gt)?e.gt:t(e.gte)?e.gte:t(e.min)?e.min:t(e.start)&&!e.reverse?e.start:t(e.end)&&e.reverse?e.end:void 0};n.lowerBoundInclusive=function(e){return!t(e.gt)},n.upperBoundInclusive=function(e){return!t(e.lt)};var i=n.lowerBoundExclusive=function(e){return!!t(e.gt)},o=n.upperBoundExclusive=function(e){return!!t(e.lt)},a=n.upperBound=function(e){return t(e.lt)?e.lt:t(e.lte)?e.lte:t(e.max)?e.max:t(e.start)&&e.reverse?e.start:t(e.end)&&!e.reverse?e.end:void 0};n.contains=function(e,s,u){u=u||n.compare;var f=r(e);if(t(f)){var c=u(s,f);if(c<0||0===c&&i(e))return!1}var l=a(e);if(t(l)){var c=u(s,l);if(c>0||0===c&&o(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(26)})},{26:26}],50:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],51:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*f;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=c?Math.round(e/c)+"d":e>=f?Math.round(e/f)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,c,"day")||a(e,f,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):b(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&_(e))):void(r.ranOut=!0)}function y(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=R.prototype.pipe,e.on=e.addListener=R.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===c&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),c.removeListener("end",i),c.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){f(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),f()}function u(){e.removeListener("close",s),f()}function f(){c.unpipe(e)}var c=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):c.once("end",d),e.on("unpipe",r);var p=g(c);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s), -e.once("finish",u),e.emit("pipe",c),l.flowing||(this.on("readable",y),l.flowing=!0,n.nextTick(function(){v(c)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],f=e[3];a=n(a,s,u,f,t[0],7,-680876936),f=n(f,a,s,u,t[1],12,-389564586),u=n(u,f,a,s,t[2],17,606105819),s=n(s,u,f,a,t[3],22,-1044525330),a=n(a,s,u,f,t[4],7,-176418897),f=n(f,a,s,u,t[5],12,1200080426),u=n(u,f,a,s,t[6],17,-1473231341),s=n(s,u,f,a,t[7],22,-45705983),a=n(a,s,u,f,t[8],7,1770035416),f=n(f,a,s,u,t[9],12,-1958414417),u=n(u,f,a,s,t[10],17,-42063),s=n(s,u,f,a,t[11],22,-1990404162),a=n(a,s,u,f,t[12],7,1804603682),f=n(f,a,s,u,t[13],12,-40341101),u=n(u,f,a,s,t[14],17,-1502002290),s=n(s,u,f,a,t[15],22,1236535329),a=r(a,s,u,f,t[1],5,-165796510),f=r(f,a,s,u,t[6],9,-1069501632),u=r(u,f,a,s,t[11],14,643717713),s=r(s,u,f,a,t[0],20,-373897302),a=r(a,s,u,f,t[5],5,-701558691),f=r(f,a,s,u,t[10],9,38016083),u=r(u,f,a,s,t[15],14,-660478335),s=r(s,u,f,a,t[4],20,-405537848),a=r(a,s,u,f,t[9],5,568446438),f=r(f,a,s,u,t[14],9,-1019803690),u=r(u,f,a,s,t[3],14,-187363961),s=r(s,u,f,a,t[8],20,1163531501),a=r(a,s,u,f,t[13],5,-1444681467),f=r(f,a,s,u,t[2],9,-51403784),u=r(u,f,a,s,t[7],14,1735328473),s=r(s,u,f,a,t[12],20,-1926607734),a=i(a,s,u,f,t[5],4,-378558),f=i(f,a,s,u,t[8],11,-2022574463),u=i(u,f,a,s,t[11],16,1839030562),s=i(s,u,f,a,t[14],23,-35309556),a=i(a,s,u,f,t[1],4,-1530992060),f=i(f,a,s,u,t[4],11,1272893353),u=i(u,f,a,s,t[7],16,-155497632),s=i(s,u,f,a,t[10],23,-1094730640),a=i(a,s,u,f,t[13],4,681279174),f=i(f,a,s,u,t[0],11,-358537222),u=i(u,f,a,s,t[3],16,-722521979),s=i(s,u,f,a,t[6],23,76029189),a=i(a,s,u,f,t[9],4,-640364487),f=i(f,a,s,u,t[12],11,-421815835),u=i(u,f,a,s,t[15],16,530742520),s=i(s,u,f,a,t[2],23,-995338651),a=o(a,s,u,f,t[0],6,-198630844),f=o(f,a,s,u,t[7],10,1126891415),u=o(u,f,a,s,t[14],15,-1416354905),s=o(s,u,f,a,t[5],21,-57434055),a=o(a,s,u,f,t[12],6,1700485571),f=o(f,a,s,u,t[3],10,-1894986606),u=o(u,f,a,s,t[10],15,-1051523),s=o(s,u,f,a,t[1],21,-2054922799),a=o(a,s,u,f,t[8],6,1873313359),f=o(f,a,s,u,t[15],10,-30611744),u=o(u,f,a,s,t[6],15,-1560198380),s=o(s,u,f,a,t[13],21,1309151649),a=o(a,s,u,f,t[4],6,-145523070),f=o(f,a,s,u,t[11],10,-1120210379),u=o(u,f,a,s,t[2],15,718787259),s=o(s,u,f,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(f,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function f(e){var t,n,r,i,o,u,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(c,r),c}function c(e){var t,n,r,i,o,s,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(c,r),c}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=b[e>>8*t+4&15]+b[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,f=t(n,u),c=u;return r!==e&&(c=t(r,u)),f>c?new ArrayBuffer(0):(i=c-f,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,f,i),a.set(s),o)}}(),_.prototype.append=function(e){return this.appendBinary(d(e)),this},_.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},_.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=y(n)),this.reset(),n},_.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},_.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},_.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},_.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},_.hash=function(e,t){return _.hashBinary(d(e),t)},_.hashBinary=function(e,t){var n=f(e),r=h(n);return t?y(r):r},_.ArrayBuffer=function(){this.reset()},_.ArrayBuffer.prototype.append=function(e){var t,n=v(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=y(n)),this.reset(),n},_.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.ArrayBuffer.prototype.getState=function(){var e=_.prototype.getState.call(this);return e.buff=g(e.buff),e},_.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),_.prototype.setState.call(this,e)},_.ArrayBuffer.prototype.destroy=_.prototype.destroy,_.ArrayBuffer.prototype._finish=_.prototype._finish,_.ArrayBuffer.hash=function(e,t){var n=c(new Uint8Array(e)),r=h(n);return t?y(r):r},_})},{}],63:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(21).EventEmitter,o=e(25);o(r,i),r.Readable=e(72),r.Writable=e(74),r.Duplex=e(64),r.Transform=e(73),r.PassThrough=e(71),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",a),f.removeListener("error",s),e.removeListener("error",s),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(f.on("end",o),f.on("close",a));var c=!1;return f.on("error",s),e.on("error",s),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{21:21,25:25,64:64,71:71,72:72,73:73,74:74}],64:[function(e,t,n){t.exports=e(65)},{65:65}],65:[function(e,t,n){"use strict";function r(e){return this instanceof r?(f.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(52),u=e(6);u.inherits=e(25);var f=e(67),c=e(69);u.inherits(r,f);for(var l=a(c.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var f;!t.decoder||i||r||(n=t.decoder.write(n),f=!t.objectMode&&0===n.length),i||(t.reading=!1),f||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return T.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){N("emit readable"),e.emit("readable"),b(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){N("onunpipe"),e===h&&a()}function o(){N("onend"),e.end()}function a(){N("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",y),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),_=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function s(t){N("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!_&&(N("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){N("onerror",t),l(),e.removeListener("error",u),0===L(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",c),l()}function c(){N("onfinish"),e.removeListener("close",f),l()}function l(){N("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,N("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var y=v(h);e.on("drain",y);var _=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",f),e.once("finish",c),e.emit("pipe",h),d.flowing||(N("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k;a.WritableState=o;var x=e(6);x.inherits=e(25);var R,B={deprecate:e(83)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(21).EventEmitter)}}();var A=e(5).Buffer,j=e(4);x.inherits(a,R);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:B.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(53))},{21:21,25:25,4:4,5:5,52:52,53:53,6:6,65:65,83:83}],70:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(5).Buffer,e(4));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{4:4,5:5}],71:[function(e,t,n){t.exports=e(66)},{66:66}],72:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(67),n.Stream=i||n,n.Readable=n,n.Writable=e(69),n.Duplex=e(65),n.Transform=e(68),n.PassThrough=e(66),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(53))},{53:53,65:65,66:66,67:67,68:68,69:69}],73:[function(e,t,n){t.exports=e(68)},{68:68}],74:[function(e,t,n){t.exports=e(69)},{69:69}],75:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(5).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{5:5}],76:[function(e,t,n){arguments[4][65][0].apply(n,arguments)},{25:25,52:52,6:6,65:65,77:77,79:79}],77:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(76),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(T||(T=e(75).StringDecoder),this.decoder=new T(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(76),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=f(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,c(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=D?e=D:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return B.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(L("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){L("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:B.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return L("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;L("need readable",r),(0===t.length||t.length-e0?b(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){L("onunpipe"),e===l&&o()}function i(){L("onend"),e.end()}function o(){L("cleanup"),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",v),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),y=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function a(t){L("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||y||(L("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){L("onerror",t),c(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",f),c()}function f(){L("onfinish"),e.removeListener("close",u),c()}function c(){L("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,L("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var v=g(l);e.on("drain",v);var y=!1;return l.on("data",a),e._events&&e._events.error?R(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",f),e.emit("pipe",l),h.flowing||(L("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(5).Buffer;a.WritableState=o;var R=e(6);R.inherits=e(25);var B,A={deprecate:e(83)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(21).EventEmitter)}}();var x=e(5).Buffer;R.inherits(a,B);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(53))},{21:21,25:25,5:5,52:52,53:53,6:6,76:76,83:83}],80:[function(e,t,n){arguments[4][73][0].apply(n,arguments)},{73:73,78:78}],81:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],82:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(80),s=e(86).inherits,u=e(81);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(53))},{53:53,80:80,81:81,86:86}],83:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],84:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{25:25}],85:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],86:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&R(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=f(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(t);if(0===a.length){if(R(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return c(t)}var y="",_=!1,b=["{","}"];if(p(t)&&(_=!0,b=["[","]"]),R(t)){var w=t.name?": "+t.name:"";y=" [Function"+w+"]"}if(E(t)&&(y=" "+RegExp.prototype.toString.call(t)),S(t)&&(y=" "+Date.prototype.toUTCString.call(t)),x(t)&&(y=" "+c(t)),0===a.length&&(!_||0==t.length))return b[0]+y+b[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=_?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,_)}),e.seen.pop(),d(k,y,b)}function f(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function _(e){return"number"==typeof e}function m(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function R(e){return"function"==typeof e}function B(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(f in r)r.hasOwnProperty(f)&&u.push(f);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)c=u[a],l=r[c],h=a>0?",":"",h+=JSON.stringify(c)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,f,c,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){ -if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":f={element:[],index:l.length},l.push(f.element),h.push(f);break;case"{":c={element:{},index:l.length},l.push(c.element),h.push(c);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],88:[function(e,t,n){(function(t,n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function o(e){return"function"==typeof e}function a(e){return o(e.prefix)?e.prefix():e}function s(e){var t={};for(var n in e)t[n]=e[n];return t}function u(e,t,n){function r(e,r,i,o){return t.encode([e,n.encodeKey(r,i,o)])}function i(e,t){return t&&t.options&&(e.keyEncoding=e.keyEncoding||t.options.keyEncoding,e.valueEncoding=e.valueEncoding||t.options.valueEncoding),e}return e.open(function(){}),{apply:function(t,o,s){o=o||{};for(var u=[],f=-1,c=t.length;++f>>1,n(e[r],t)<0?i=r+1:o=r;return i}function H(e,t,n){var r=V(e,t,n);e.splice(r,0,t)}function $(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var v=g.ids[2],y=0,_=v.length;y<_;y++)p.push({ids:v[y],diff:g.diff-1,parent:g.ids,parentIdx:y});else g.ids[0]===l.ids[0]&&d.push(g)}var m=d[0];m?(r=X(m.ids,l.ids),m.parent[2][m.parentIdx]=r.tree,i.push({pos:c.pos,ids:c.ids}),o=o||r.conflicts,a=!0):i.push(f)}else i.push(f)}return a||i.push(t),i.sort(J),{tree:i,conflicts:o||"internal_node"}}function Q(e,t){for(var n,r=K(e),i={},o=0,a=r.length;o0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],f=k.docStore.readStream(i),c=We.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:c}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=z(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,c=Be(a),l=Ae(a,c);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return f.unpipe(),f.destroy(),void r()}if(e.include_docs){var h=a.rev_map[c];k.bySeqStore.get(v(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Oe(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){c.end()});f.on("error",t),f.pipe(c)})}),E._changes=function(e){function t(){e.done=!0,f&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=v(e.since||0));var f,c=e.doc_ids&&new g(e.doc_ids),l=O(e),h=new p;f="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),_=We.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Oe([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),f&&o.push(r)),void d())}var r=Be(t);if(t.seq!==g)return d();if(a=g,r===_._rev)return n(_);var i=t.rev_map[r];k.bySeqStore.get(v(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=y(n.key),_=n.value;if(g===e.since&&!i)return d();if(c&&!c.has(_._id))return d();var m;return(m=h.get(_._id))?p(m):void k.docStore.get(_._id,function(t,n){return e.cancelled||e.done||w.isClosed()||ie(n.id)?d():(h.set(_._id,n),void p(n))})},function(t){return e.cancelled?t():(f&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(Pe.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},qe(B,Error),B.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var st,ut=(new B({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new B({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new B({status:404,error:"not_found",reason:"missing"})),ft=new B({status:409,error:"conflict",reason:"Document update conflict"}),ct=new B({status:400,error:"bad_request",reason:"_id field must contain a string"}),lt=new B({status:412,error:"missing_id",reason:"_id is required for puts"}),ht=new B({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),dt=new B({status:412,error:"precondition_failed",reason:"Database not open"}),pt=(new B({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new B({status:500,error:"badarg",reason:"Some query argument is invalid"})),gt=(new B({status:400,error:"invalid_request",reason:"Request was invalid"}),new B({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new B({status:500,error:"doc_validation",reason:"Bad special document member"})),vt=new B({status:400,error:"bad_request",reason:"Something wrong with the request" -}),yt=(new B({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new B({status:404,error:"not_found",reason:"Database not found"}),new B({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new B({status:500,error:"web_sql_went_bad",reason:"unknown"}),new B({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new B({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new B({status:400,error:"bad_request",reason:"Invalid rev format"})),_t=(new B({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new B({status:412,error:"missing_stub"})),mt=(new B({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),M.name);st=mt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var bt=st,wt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Et=D(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),kt=D(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),St=function(e){return atob(e)},xt=function(e){return btoa(e)},Rt=n.setImmediate||n.setTimeout,Bt=32768;Re.prototype.get=function(e,n,r){var i=xe(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Re.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var At="document-store",jt="by-sequence",Ot="attach-store",Mt="attach-binary-store",Lt="local-store",Tt="meta-store",Ct=new p,Dt="_local_last_update_seq",Pt="_local_doc_count",Nt="_local_uuid",qt="md5-",It={encode:we,decode:be,buffer:!1,type:"cheap-json"},Ut=new x;Le.valid=function(){return!0},Le.use_prefix=!1;var Wt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");Wt?Te(Wt):R("error",'memory adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(53),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(5).Buffer)},{1:1,17:17,21:21,25:25,28:28,29:29,35:35,41:41,42:42,43:43,5:5,53:53,61:61,62:62,7:7,82:82,87:87,pouchdb:"pouchdb"}]},{},[88]); +!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,s,u=e.length;a=r(e),s=new l(3*u/4-a),i=a>0?u-4:u;var f=0;for(t=0,n=0;t>16&255,s[f++]=o>>8&255,s[f++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[f++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[f++]=o>>8&255,s[f++]=255&o),s}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,n){for(var r,i=[],o=t;oc?c:u+a));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var f=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;da)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var s=new i(e);if("string"==typeof o)for(var u=new i(o,r),f=u.length,c=-1;++ca)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var a=r;if("undefined"==typeof a&&(a=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+a))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new o(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{5:5}],5:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),a.alloc(+e)}function y(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function _(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var f;if(i){var c=-1;for(f=n;fs&&(n=s-u),f=n;f>=0;f--){for(var l=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,f,c,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(a=l));break;case 3:u=e[i+1],f=e[i+2],128===(192&u)&&128===(192&f)&&(l=(15&o)<<12|(63&u)<<6|63&f,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:u=e[i+1],f=e[i+2],c=e[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(l=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function I(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return i||I(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||I(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function H(e){return X.toByteArray(F(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var X=e(2),Z=e(23),Q=e(27);n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return f(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=Math.min(o,s),f=this.slice(r,i),c=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;P(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(8),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{8:8}],8:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(f||t);e.diff=o,e.prev=f,e.curr=t,f=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function a(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}r.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,i=0;i1){var r=this._capacity;if(n+t>r){for(var i=0;i1){var r=this._capacity;if(t+n>r){for(var i=n-1;i>=0;i--){this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;this[o]=arguments[i],t++,this._length=t,this._front=o}return t}for(var a=this._front,i=n-1;i>=0;i--){var o=(a-1&r-1^r)-r;this[o]=arguments[i],a=o}return this._front=a,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;return this[i]=e,this._length=t+1,this._front=i,t+1},r.prototype.peekBack=function(){var e=this._length;if(0!==e){var t=this._front+e-1&this._capacity-1;return this[t]}},r.prototype.peekFront=function(){if(0!==this._length)return this[this._front]},r.prototype.get=function(e){var t=e;if(t===(0|t)){var n=this._length;if(t<0&&(t+=n),!(t<0||t>=n))return this[this._front+t&this._capacity-1]}},r.prototype.isEmpty=function(){return 0===this._length},r.prototype.clear=function(){for(var e=this._length,t=this._front,n=this._capacity,r=0;rt){var o=n+r&t-1;i(this,0,this,t,o)}};var s=Array.isArray;t.exports=r},{}],18:[function(e,t,n){function r(e,t,n){a(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),r.call(this,"CustomError",e,t)}function o(e,t,n){var o=function(n,i){r.call(this,t,n,i),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return o.prototype=n?new n:new i,o}var a=e(20);i.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},{20:20}],19:[function(e,t,n){var r=t.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={},t.exports.code={},r.forEach(function(e){t.exports.errno[e.errno]=e,t.exports.code[e.code]=e}),t.exports.custom=e(18)(t.exports),t.exports.create=t.exports.custom.createError},{18:18}],20:[function(e,t,n){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var a;if(o=t(i,o),"object"==typeof r){for(a in r)Object.hasOwnProperty.call(r,a)&&(o.value=r[a],e(n,a,o));return n}return e(n,r,o)};return n})},{}],21:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),f=n.slice(),r=f.length,u=0;u0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],22:[function(e,t,n){"use strict";function r(e,t,n,r,i,o){this._color=e,this.key=t,this.value=n,this.left=r,this.right=i,this._count=o}function i(e){return new r(e._color,e.key,e.value,e.left,e.right,e._count)}function o(e,t){return new r(e,t.key,t.value,t.left,t.right,t._count)}function a(e){e._count=1+(e.left?e.left._count:0)+(e.right?e.right._count:0)}function s(e,t){this._compare=e,this.root=t}function u(e,t){if(t.left){var n=u(e,t.left);if(n)return n}var n=e(t.key,t.value);return n?n:t.right?u(e,t.right):void 0}function f(e,t,n,r){var i=t(e,r.key);if(i<=0){if(r.left){var o=f(e,t,n,r.left);if(o)return o}var o=n(r.key,r.value);if(o)return o}if(r.right)return f(e,t,n,r.right)}function c(e,t,n,r,i){var o,a=n(e,i.key),s=n(t,i.key);if(a<=0){if(i.left&&(o=c(e,t,n,r,i.left)))return o;if(s>0&&(o=r(i.key,i.value)))return o}if(s>0&&i.right)return c(e,t,n,r,i.right)}function l(e,t){this.tree=e,this._stack=t}function h(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e._color=t._color,e._count=t._count}function d(e){for(var t,n,r,s,u=e.length-1;u>=0;--u){if(t=e[u],0===u)return void(t._color=y);if(n=e[u-1],n.left===t){if(r=n.right,r.right&&r.right._color===v){if(r=n.right=i(r),s=r.right=i(r.right),n.right=r.left,r.left=n,r.right=s,r._color=n._color,t._color=y,n._color=y,s._color=y,a(n),a(r),u>1){var f=e[u-2];f.left===n?f.left=r:f.right=r}return void(e[u-1]=r)}if(r.left&&r.left._color===v){if(r=n.right=i(r),s=r.left=i(r.left),n.right=s.left,r.left=s.right,s.left=n,s.right=r,s._color=n._color,n._color=y,r._color=y,t._color=y,a(n),a(r),a(s),u>1){var f=e[u-2];f.left===n?f.left=s:f.right=s}return void(e[u-1]=s)}if(r._color===y){if(n._color===v)return n._color=y,void(n.right=o(v,r));n.right=o(v,r);continue}if(r=i(r),n.right=r.left,r.left=n,r._color=n._color,n._color=v,a(n),a(r),u>1){var f=e[u-2];f.left===n?f.left=r:f.right=r}e[u-1]=r,e[u]=n,u+11){var f=e[u-2];f.right===n?f.right=r:f.left=r}return void(e[u-1]=r)}if(r.right&&r.right._color===v){if(r=n.left=i(r),s=r.right=i(r.right),n.left=s.right,r.right=s.left,s.right=n,s.left=r,s._color=n._color,n._color=y,r._color=y,t._color=y,a(n),a(r),a(s),u>1){var f=e[u-2];f.right===n?f.right=s:f.left=s}return void(e[u-1]=s)}if(r._color===y){if(n._color===v)return n._color=y,void(n.left=o(v,r));n.left=o(v,r);continue}if(r=i(r),n.left=r.right,r.right=n,r._color=n._color,n._color=v,a(n),a(r),u>1){var f=e[u-2];f.right===n?f.right=r:f.left=r}e[u-1]=r,e[u]=n,u+1t?1:0}function g(e){return new s(e||p,null)}t.exports=g;var v=0,y=1,_=s.prototype;Object.defineProperty(_,"keys",{get:function(){var e=[];return this.forEach(function(t,n){e.push(t)}),e}}),Object.defineProperty(_,"values",{get:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e}}),Object.defineProperty(_,"length",{get:function(){return this.root?this.root._count:0}}),_.insert=function(e,t){for(var n=this._compare,i=this.root,u=[],f=[];i;){var c=n(e,i.key);u.push(i),f.push(c),i=c<=0?i.left:i.right}u.push(new r(v,e,t,null,null,1));for(var l=u.length-2;l>=0;--l){var i=u[l];f[l]<=0?u[l]=new r(i._color,i.key,i.value,u[l+1],i.right,i._count+1):u[l]=new r(i._color,i.key,i.value,i.left,u[l+1],i._count+1)}for(var l=u.length-1;l>1;--l){var h=u[l-1],i=u[l];if(h._color===y||i._color===y)break;var d=u[l-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=y,h.right=d,u[l-2]=h,u[l-1]=i,a(d),a(h),l>=3){var g=u[l-3];g.left===d?g.left=h:g.right=h}break}h._color=y,d.right=o(y,p),d._color=v,l-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=y,i.left=h,i.right=d,u[l-2]=i,u[l-1]=h,a(d),a(h),a(i),l>=3){var g=u[l-3];g.left===d?g.left=i:g.right=i}break}h._color=y,d.right=o(y,p),d._color=v,l-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=y,h.left=d,u[l-2]=h,u[l-1]=i,a(d),a(h),l>=3){var g=u[l-3];g.right===d?g.right=h:g.left=h}break}h._color=y,d.left=o(y,p),d._color=v,l-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=y,i.right=h,i.left=d,u[l-2]=i,u[l-1]=h,a(d),a(h),a(i),l>=3){var g=u[l-3];g.right===d?g.right=i:g.left=i}break}h._color=y,d.left=o(y,p),d._color=v,l-=1}}return u[0]._color=y,new s(n,u[0])},_.forEach=function(e,t,n){if(this.root)switch(arguments.length){case 1:return u(e,this.root);case 2:return f(t,this._compare,e,this.root);case 3:if(this._compare(t,n)>=0)return;return c(t,n,this._compare,e,this.root)}},Object.defineProperty(_,"begin",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.left;return new l(this,e)}}),Object.defineProperty(_,"end",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.right;return new l(this,e)}}),_.at=function(e){if(e<0)return new l(this,[]);for(var t=this.root,n=[];;){if(n.push(t),t.left){if(e=t.right._count)break;t=t.right}return new l(this,[])},_.ge=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o<=0&&(i=r.length),n=o<=0?n.left:n.right}return r.length=i,new l(this,r)},_.gt=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o<0&&(i=r.length),n=o<0?n.left:n.right}return r.length=i,new l(this,r)},_.lt=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o>0&&(i=r.length),n=o<=0?n.left:n.right}return r.length=i,new l(this,r)},_.le=function(e){for(var t=this._compare,n=this.root,r=[],i=0;n;){var o=t(e,n.key);r.push(n),o>=0&&(i=r.length),n=o<0?n.left:n.right}return r.length=i,new l(this,r)},_.find=function(e){for(var t=this._compare,n=this.root,r=[];n;){var i=t(e,n.key);if(r.push(n),0===i)return new l(this,r);n=i<=0?n.left:n.right}return new l(this,[])},_.remove=function(e){var t=this.find(e);return t?t.remove():this},_.get=function(e){for(var t=this._compare,n=this.root;n;){var r=t(e,n.key);if(0===r)return n.value;n=r<=0?n.left:n.right}};var m=l.prototype;Object.defineProperty(m,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(m,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),m.clone=function(){return new l(this.tree,this._stack.slice())},m.remove=function(){var e=this._stack;if(0===e.length)return this.tree;var t=new Array(e.length),n=e[e.length-1];t[t.length-1]=new r(n._color,n.key,n.value,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i){var n=e[i];n.left===e[i+1]?t[i]=new r(n._color,n.key,n.value,t[i+1],n.right,n._count):t[i]=new r(n._color,n.key,n.value,n.left,t[i+1],n._count)}if(n=t[t.length-1],n.left&&n.right){var o=t.length;for(n=n.left;n.right;)t.push(n),n=n.right;var a=t[o-1];t.push(new r(n._color,a.key,a.value,n.left,n.right,n._count)),t[o-1].key=n.key,t[o-1].value=n.value;for(var i=t.length-2;i>=o;--i)n=t[i],t[i]=new r(n._color,n.key,n.value,n.left,t[i+1],n._count);t[o-1].left=t[o]}if(n=t[t.length-1],n._color===v){var u=t[t.length-2];u.left===n?u.left=null:u.right===n&&(u.right=null),t.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(m,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(m,"index",{get:function(){var e=0,t=this._stack;if(0===t.length){var n=this.tree.root;return n?n._count:0}t[t.length-1].left&&(e=t[t.length-1].left._count);for(var r=t.length-2;r>=0;--r)t[r+1]===t[r].right&&(++e,t[r].left&&(e+=t[r].left._count));return e},enumerable:!0}),m.next=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.right)for(t=t.right;t;)e.push(t),t=t.left;else for(e.pop();e.length>0&&e[e.length-1].right===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(m,"hasNext",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].right)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}}),m.update=function(e){var t=this._stack;if(0===t.length)throw new Error("Can't update empty node!");var n=new Array(t.length),i=t[t.length-1];n[n.length-1]=new r(i._color,i.key,e,i.left,i.right,i._count);for(var o=t.length-2;o>=0;--o)i=t[o],i.left===t[o+1]?n[o]=new r(i._color,i.key,i.value,n[o+1],i.right,i._count):n[o]=new r(i._color,i.key,i.value,i.left,n[o+1],i._count);return new s(this.tree._compare,n[0])},m.prev=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.left)for(t=t.left;t;)e.push(t),t=t.right;else for(e.pop();e.length>0&&e[e.length-1].left===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(m,"hasPrev",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].left)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}})},{}],23:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=f}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,f-=8);e[n+d-p]|=128*g}},{}],24:[function(e,t,n){(function(e){"use strict";function n(){c=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e-1?t.encodeKey(e[r],e):e[r]}),n},r.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},r.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},r.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{29:29}],29:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.none={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"},n.id=n.none;var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(5).Buffer)},{5:5}],30:[function(e,t,n){var r=e(19).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},{19:19}],31:[function(e,t,n){function r(e,t){return this instanceof r?(o.call(this,a(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._decoder=null,t&&t.decoder&&(this._decoder=t.decoder),void this.on("end",this._cleanup.bind(this))):new r(e,t)}var i=e(25),o=e(60).Readable,a=e(32),s=e(30).EncodingError;t.exports=r,i(r,o),r.prototype._read=function(){var e=this;this._destroyed||this._iterator.next(function(t,n,r){if(!e._destroyed){if(t)return e.emit("error",t);if(void 0===n&&void 0===r)e.push(null);else{if(!e._decoder)return e.push({key:n,value:r});try{var r=e._decoder(n,r)}catch(t){return e.emit("error",new s(t)), +void e.push(null)}e.push(r)}}})},r.prototype.destroy=r.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){return t?e.emit("error",t):void e.emit("close")}))}},{25:25,30:30,32:32,60:60}],32:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],33:[function(e,t,n){function r(e,t){this._levelup=e,this._codec=t,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=e(35),o=e(30).WriteError,a=i.getOptions,s=i.dispatchError;r.prototype.put=function(e,t,n){n=a(n);var r=this._codec.encodeKey(e,n),i=this._codec.encodeValue(t,n);try{this.batch.put(r,i)}catch(e){throw new o(e)}return this.ops.push({type:"put",key:r,value:i}),this.length++,this},r.prototype.del=function(e,t){t=a(t);var n=this._codec.encodeKey(e,t);try{this.batch.del(n)}catch(e){throw new o(e)}return this.ops.push({type:"del",key:n}),this.length++,this},r.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this.length=0,this},r.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(e){throw new o(e)}},t.exports=r},{30:30,35:35}],34:[function(e,t,n){(function(n){function r(e,t){return"function"==typeof e?e:t}function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var o;if(f.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(o=new E("Must provide a location for the database"),r)return n.nextTick(function(){r(o)});throw o}t=R(t),this.options=h(B,t),this._codec=new x(this.options),this._status="new",d(this,"location",e,"e"),this.open(r)}function o(e,t,n){if(!e._isOpening()&&!e.isOpen())return j(e,new _("Database is not open"),n),!0}function a(e,t,n){j(e,new y(t),n)}function s(e,t,n){j(e,new _(t),n)}function u(e){return function(t,n){A()[e](t,n||function(){})}}var f=e(21).EventEmitter,c=e(85).inherits,l=e(85).deprecate,h=e(38),d=e(53),p=e(10),g=e(31),v=e(30),y=v.WriteError,_=v.ReadError,m=v.NotFoundError,b=v.OpenError,w=v.EncodingError,E=v.InitializationError,k=e(35),S=e(33),x=e(36),R=k.getOptions,B=k.defaultOptions,A=k.getLevelDOWN,j=k.dispatchError;k.isDefined;c(i,f),i.prototype.open=function(e){var t,r,i=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,i)}),this):this._isOpening()?e&&this.once("open",function(){e(null,i)}):(this.emit("opening"),this._status="opening",this.db=new p(this.location),t=this.options.db||A(),r=t(this.location),void r.open(this.options,function(t){return t?j(i,new b(t),e):(i.db.setDb(r),i.db=r,i._status="open",e&&e(null,i),i.emit("open"),i.emit("ready"),void 0)}))},i.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=new p(this.location);else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},i.prototype.isOpen=function(){return"open"==this._status},i.prototype._isOpening=function(){return"opening"==this._status},i.prototype.isClosed=function(){return/^clos/.test(this._status)},i.prototype.get=function(e,t,n){var i,a=this;if(n=r(t,n),!o(this,t,n)){if(null===e||void 0===e||"function"!=typeof n)return s(this,"get() requires key and callback arguments",n);t=k.getOptions(t),i=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(i,t,function(r,i){if(r)return r=/notfound/i.test(r)||r.notFound?new m("Key not found in database ["+e+"]",r):new _(r),j(a,r,n);if(n){try{i=a._codec.decodeValue(i,t)}catch(e){return n(new w(e))}n(null,i)}})}},i.prototype.put=function(e,t,n,i){var s,u,f=this;return i=r(n,i),null===e||void 0===e?a(this,"put() requires a key argument",i):void(o(this,n,i)||(n=R(n),s=this._codec.encodeKey(e,n),u=this._codec.encodeValue(t,n),this.db.put(s,u,n,function(n){return n?j(f,new y(n),i):(f.emit("put",e,t),void(i&&i()))})))},i.prototype.del=function(e,t,n){var i,s=this;return n=r(t,n),null===e||void 0===e?a(this,"del() requires a key argument",n):void(o(this,t,n)||(t=R(t),i=this._codec.encodeKey(e,t),this.db.del(i,t,function(t){return t?j(s,new y(t),n):(s.emit("del",e),void(n&&n()))})))},i.prototype.batch=function(e,t,n){var i,s=this;return arguments.length?(n=r(t,n),Array.isArray(e)?void(o(this,t,n)||(t=R(t),i=s._codec.encodeBatch(e,t),i=i.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(i,t,function(t){return t?j(s,new y(t),n):(s.emit("batch",e),void(n&&n()))}))):a(this,"batch() requires an array argument",n)):new S(this,this._codec)},i.prototype.approximateSize=l(function(e,t,n,i){var o,a,u=this;return i=r(n,i),n=R(n),null===e||void 0===e||null===t||void 0===t||"function"!=typeof i?s(this,"approximateSize() requires start, end and callback arguments",i):(o=this._codec.encodeKey(e,n),a=this._codec.encodeKey(t,n),void this.db.approximateSize(o,a,function(e,t){return e?j(u,new b(e),i):void(i&&i(null,t))}))},"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),i.prototype.readStream=i.prototype.createReadStream=function(e){return e=h({keys:!0,values:!0},this.options,e),e.keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,e=this._codec.encodeLtgt(e),e.keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new g(this.db.iterator(e),h(e,{decoder:this._codec.createStreamDecoder(e)}))},i.prototype.keyStream=i.prototype.createKeyStream=function(e){return this.createReadStream(h(e,{keys:!0,values:!1}))},i.prototype.valueStream=i.prototype.createValueStream=function(e){return this.createReadStream(h(e,{keys:!1,values:!0}))},i.prototype.toString=function(){return"LevelUP"},t.exports=i,t.exports.errors=e(30),t.exports.destroy=l(u("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),t.exports.repair=l(u("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")}).call(this,e(52))},{10:10,21:21,30:30,31:31,33:33,35:35,36:36,38:38,52:52,53:53,85:85}],35:[function(e,t,n){function r(e){return"string"==typeof e&&(e={valueEncoding:e}),"object"!=typeof e&&(e={}),e}function i(){if(u)return u;var t,n=e(39).devDependencies.leveldown;try{t=e(3).version}catch(e){throw o(e)}if(!e(3).satisfies(t,n))throw new f("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return u=e(3)}catch(e){throw o(e)}}function o(e){var t="Failed to require LevelDOWN (%s). Try `npm install leveldown` if it's missing";return new f(c(t,e.message))}function a(e,t,n){"function"==typeof n?n(t):e.emit("error",t)}function s(e){return"undefined"!=typeof e}var u,f=(e(38),e(30).LevelUPError),c=e(85).format,l={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0};t.exports={defaultOptions:l,getOptions:r,getLevelDOWN:i,dispatchError:a,isDefined:s}},{3:3,30:30,38:38,39:39,85:85}],36:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{28:28,37:37}],37:[function(e,t,n){(function(e){function t(e){return e}function r(t){return void 0===t||null===t||e.isBuffer(t)}n.utf8=n["utf-8"]={encode:function(e){return r(e)?e:String(e)},decode:t,buffer:!1,type:"utf8"},n.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},n.binary={encode:function(t){return r(t)?t:new e(t)},decode:t,buffer:!0,type:"binary"},n.id={encode:function(e){return e},decode:function(e){return e},buffer:!1,type:"id"};var i=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];i.forEach(function(t){n[t]={encode:function(n){return r(n)?n:new e(n,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t}})}).call(this,e(5).Buffer)},{5:5}],38:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],39:[function(e,t,n){t.exports={_args:[[{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},"/Users/nolan/workspace/pouchdb"]],_from:"levelup@1.3.3",_id:"levelup@1.3.3",_inCache:!0,_installable:!0,_location:"/levelup",_nodeVersion:"4.4.7",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/levelup-1.3.3.tgz_1476029541340_0.44339725002646446"},_npmUser:{name:"juliangruber",email:"julian@juliangruber.com"},_npmVersion:"2.15.8",_phantomChildren:{},_requested:{raw:"levelup@1.3.3",scope:null,escapedName:"levelup",name:"levelup",rawSpec:"1.3.3",spec:"1.3.3",type:"version"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz",_shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",_shrinkwrap:null,_spec:"levelup@1.3.3",_where:"/Users/nolan/workspace/pouchdb",browser:{leveldown:!1,"leveldown/package":!1,semver:!1},bugs:{url:"https://github.com/level/levelup/issues"},contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"ralphtheninja@riseup.net",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/0x00a"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"},{name:"Jarrett Cruger",email:"jcrugzz@gmail.com",url:"https://github.com/jcrugzz"}],dependencies:{"deferred-leveldown":"~1.2.1","level-codec":"~6.1.0","level-errors":"~1.0.3","level-iterator-stream":"~1.3.0",prr:"~1.0.1",semver:"~5.1.0",xtend:"~4.0.0"},description:"Fast & simple storage - a Node.js-style LevelDB wrapper",devDependencies:{async:"~1.5.0",bustermove:"~1.0.0",delayed:"~1.0.1",faucet:"~0.0.1",leveldown:"^1.1.0",memdown:"~1.1.0","msgpack-js":"~0.3.0",referee:"~1.2.0",rimraf:"~2.4.3","slow-stream":"0.0.4",tap:"~2.3.1",tape:"~4.2.1"},directories:{},dist:{shasum:"bf9db62bdb6188d08eaaa2efcf6cc311916f41fd",tarball:"https://registry.npmjs.org/levelup/-/levelup-1.3.3.tgz"},gitHead:"cced27dc9f0095823be5ed388ec601ec2bfe7366",homepage:"https://github.com/level/levelup",keywords:["leveldb","stream","database","db","store","storage","json"],license:"MIT",main:"lib/levelup.js",maintainers:[{name:"rvagg",email:"rod@vagg.org"},{name:"ralphtheninja",email:"ralphtheninja@riseup.net"},{name:"juliangruber",email:"julian@juliangruber.com"}],name:"levelup",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/level/levelup.git"},scripts:{test:"tape test/*-test.js | faucet"},version:"1.3.3"}},{}],40:[function(e,t,n){"use strict";function r(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,e!==r&&u(this,e)}function o(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function a(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return g.reject(e,t)}r===e?g.reject(e,new TypeError("Cannot resolve promise with itself")):g.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function u(e,t){function n(t){o||(o=!0,g.reject(e,t))}function r(t){o||(o=!0,g.resolve(e,t))}function i(){t(r,n)}var o=!1,a=f(i);"error"===a.status&&n(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function c(e){return e instanceof this?e:g.resolve(new this(r),e)}function l(e){var t=new this(r);return g.reject(t,e)}function h(e){function t(e,t){function r(e){a[t]=e,++s!==i||o||(o=!0,g.resolve(f,a))}n.resolve(e).then(r,function(e){o||(o=!0,g.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,u=-1,f=new this(r);++un?1:0};var a=n.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=n.lowerBound=function(e){var t=a(e);return t&&e[t]};n.lowerBoundInclusive=function(e){return!t(e,"gt")},n.upperBoundInclusive=function(e){return!(t(e,"lt")||!e.minEx)};var u=n.lowerBoundExclusive=function(e){return!(!t(e,"gt")&&!e.minEx)},f=n.upperBoundExclusive=function(e){return!!t(e,"lt")},c=n.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=n.upperBound=function(e){var t=c(e);return t&&e[t]};n.toLtgt=function(e,r,i,a,s){r=r||{},i=i||o;var u=arguments.length>3,f=n.lowerBoundKey(e),c=n.upperBoundKey(e);return f?"gt"===f?r.gt=i(e.gt,!1):r.gte=i(e[f],!1):u&&(r.gte=i(a,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):u&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),t(r,"max")&&delete r.max,t(r,"min")&&delete r.min,t(r,"start")&&delete r.start,t(r,"end")&&delete r.end,r},n.contains=function(e,t,i){i=i||n.compare;var o=s(e);if(r(o)){var a=i(t,o);if(a<0||0===a&&u(e))return!1}var c=l(e);if(r(c)){var a=i(t,c);if(a>0||0===a&&f(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(26)})},{26:26}],42:[function(e,t,n){(function(n,r,i){function o(e){return p.compare(e,this._end)>0}function a(e){return p.compare(e,this._end)>=0}function s(e){return p.compare(e,this._end)<0}function u(e){return p.compare(e,this._end)<=0}function f(e,t){d.call(this,e),this._limit=t.limit,this._limit===-1&&(this._limit=1/0);var n=e._store[e._location];this.keyAsBuffer=t.keyAsBuffer!==!1,this.valueAsBuffer=t.valueAsBuffer!==!1,this._reverse=t.reverse,this._options=t,this._done=0,this._reverse?(this._incr="prev",this._start=p.upperBound(t),this._end=p.lowerBound(t),"undefined"==typeof this._start?this._tree=n.end:p.upperBoundInclusive(t)?this._tree=n.le(this._start):this._tree=n.lt(this._start),this._end&&(p.lowerBoundInclusive(t)?this._test=a:this._test=o)):(this._incr="next",this._start=p.lowerBound(t),this._end=p.upperBound(t),"undefined"==typeof this._start?this._tree=n.begin:p.lowerBoundInclusive(t)?this._tree=n.ge(this._start):this._tree=n.gt(this._start),this._end&&(p.upperBoundInclusive(t)?this._test=u:this._test=s))}function c(e){return this instanceof c?(h.call(this,"string"==typeof e?e:""),this._location=this.location?"$"+this.location:"_tree",this._store=this.location?v:this,void(this._store[this._location]=this._store[this._location]||g(p.compare))):new c(e)}var l=e(25),h=e(46).AbstractLevelDOWN,d=e(46).AbstractIterator,p=e(48),g=e(22),v={},y=r.setImmediate||n.nextTick;l(f,d),f.prototype._next=function(e){var t,n;return this._done++>=this._limit?y(e):this._tree.valid?(t=this._tree.key,n=this._tree.value,this._test(t)?(this.keyAsBuffer&&(t=new i(t)),this.valueAsBuffer&&(n=new i(n)),this._tree[this._incr](),void y(function(){e(null,t,n)})):y(e)):y(e)},f.prototype._test=function(){return!0},c.clearGlobalStore=function(e){e?Object.keys(v).forEach(function(e){delete v[e]}):v={}},l(c,h),c.prototype._open=function(e,t){var n=this;y(function(){t(null,n)})},c.prototype._put=function(e,t,n,r){"undefined"!=typeof t&&null!==t||(t="");var i=this._store[this._location].find(e);i.valid?this._store[this._location]=i.update(t):this._store[this._location]=this._store[this._location].insert(e,t),y(r)},c.prototype._get=function(e,t,n){var r=this._store[this._location].get(e);return"undefined"==typeof r?y(function(){n(new Error("NotFound"))}):(t.asBuffer===!1||this._isBuffer(r)||(r=new i(String(r))),void y(function(){n(null,r)}))},c.prototype._del=function(e,t,n){this._store[this._location]=this._store[this._location].remove(e),y(n)},c.prototype._batch=function(e,t,n){for(var r,i,o,a=-1,s=e.length,u=this._store[this._location];++an?1:0};var r=n.lowerBound=function(e){return t(e.gt)?e.gt:t(e.gte)?e.gte:t(e.min)?e.min:t(e.start)&&!e.reverse?e.start:t(e.end)&&e.reverse?e.end:void 0};n.lowerBoundInclusive=function(e){return!t(e.gt)},n.upperBoundInclusive=function(e){return!t(e.lt)};var i=n.lowerBoundExclusive=function(e){return!!t(e.gt)},o=n.upperBoundExclusive=function(e){return!!t(e.lt)},a=n.upperBound=function(e){return t(e.lt)?e.lt:t(e.lte)?e.lte:t(e.max)?e.max:t(e.start)&&e.reverse?e.start:t(e.end)&&!e.reverse?e.end:void 0};n.contains=function(e,s,u){u=u||n.compare;var f=r(e);if(t(f)){var c=u(s,f);if(c<0||0===c&&i(e))return!1}var l=a(e);if(t(l)){var c=u(s,l);if(c>0||0===c&&o(e))return!1}return!0},n.filter=function(e,t){return function(r){return n.contains(e,r,t)}}}).call(this,{isBuffer:e(26)})},{26:26}],49:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],50:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*f;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=c?Math.round(e/c)+"d":e>=f?Math.round(e/f)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,c,"day")||a(e,f,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e1)for(var n=1;n0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=j)e=j;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):b(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&_(e))):void(r.ranOut=!0)}function y(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var i=t||!1,o=!1;e.readable=!0,e.pipe=R.prototype.pipe,e.on=e.addListener=R.prototype.on,e.on("readable",function(){o=!0;for(var t;!i&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){i=!0,this.emit("pause")},e.resume=function(){i=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===c&&o()}function i(){e.end()}function o(){e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),c.removeListener("end",i),c.removeListener("end",o),e._writableState&&!e._writableState.needDrain||p()}function a(t){f(),e.removeListener("error",a),0===x.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",u),f()}function u(){e.removeListener("close",s),f()}function f(){c.unpipe(e)}var c=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,d=h?i:o;l.endEmitted?n.nextTick(d):c.once("end",d),e.on("unpipe",r);var p=g(c);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",s),e.once("finish",u),e.emit("pipe",c),l.flowing||(this.on("readable",y),l.flowing=!0,n.nextTick(function(){v(c)})),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1,e&&e.emit("unpipe",this), +this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1;for(var i=0;i>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],f=e[3];a=n(a,s,u,f,t[0],7,-680876936),f=n(f,a,s,u,t[1],12,-389564586),u=n(u,f,a,s,t[2],17,606105819),s=n(s,u,f,a,t[3],22,-1044525330),a=n(a,s,u,f,t[4],7,-176418897),f=n(f,a,s,u,t[5],12,1200080426),u=n(u,f,a,s,t[6],17,-1473231341),s=n(s,u,f,a,t[7],22,-45705983),a=n(a,s,u,f,t[8],7,1770035416),f=n(f,a,s,u,t[9],12,-1958414417),u=n(u,f,a,s,t[10],17,-42063),s=n(s,u,f,a,t[11],22,-1990404162),a=n(a,s,u,f,t[12],7,1804603682),f=n(f,a,s,u,t[13],12,-40341101),u=n(u,f,a,s,t[14],17,-1502002290),s=n(s,u,f,a,t[15],22,1236535329),a=r(a,s,u,f,t[1],5,-165796510),f=r(f,a,s,u,t[6],9,-1069501632),u=r(u,f,a,s,t[11],14,643717713),s=r(s,u,f,a,t[0],20,-373897302),a=r(a,s,u,f,t[5],5,-701558691),f=r(f,a,s,u,t[10],9,38016083),u=r(u,f,a,s,t[15],14,-660478335),s=r(s,u,f,a,t[4],20,-405537848),a=r(a,s,u,f,t[9],5,568446438),f=r(f,a,s,u,t[14],9,-1019803690),u=r(u,f,a,s,t[3],14,-187363961),s=r(s,u,f,a,t[8],20,1163531501),a=r(a,s,u,f,t[13],5,-1444681467),f=r(f,a,s,u,t[2],9,-51403784),u=r(u,f,a,s,t[7],14,1735328473),s=r(s,u,f,a,t[12],20,-1926607734),a=i(a,s,u,f,t[5],4,-378558),f=i(f,a,s,u,t[8],11,-2022574463),u=i(u,f,a,s,t[11],16,1839030562),s=i(s,u,f,a,t[14],23,-35309556),a=i(a,s,u,f,t[1],4,-1530992060),f=i(f,a,s,u,t[4],11,1272893353),u=i(u,f,a,s,t[7],16,-155497632),s=i(s,u,f,a,t[10],23,-1094730640),a=i(a,s,u,f,t[13],4,681279174),f=i(f,a,s,u,t[0],11,-358537222),u=i(u,f,a,s,t[3],16,-722521979),s=i(s,u,f,a,t[6],23,76029189),a=i(a,s,u,f,t[9],4,-640364487),f=i(f,a,s,u,t[12],11,-421815835),u=i(u,f,a,s,t[15],16,530742520),s=i(s,u,f,a,t[2],23,-995338651),a=o(a,s,u,f,t[0],6,-198630844),f=o(f,a,s,u,t[7],10,1126891415),u=o(u,f,a,s,t[14],15,-1416354905),s=o(s,u,f,a,t[5],21,-57434055),a=o(a,s,u,f,t[12],6,1700485571),f=o(f,a,s,u,t[3],10,-1894986606),u=o(u,f,a,s,t[10],15,-1051523),s=o(s,u,f,a,t[1],21,-2054922799),a=o(a,s,u,f,t[8],6,1873313359),f=o(f,a,s,u,t[15],10,-30611744),u=o(u,f,a,s,t[6],15,-1560198380),s=o(s,u,f,a,t[13],21,1309151649),a=o(a,s,u,f,t[4],6,-145523070),f=o(f,a,s,u,t[11],10,-1120210379),u=o(u,f,a,s,t[2],15,718787259),s=o(s,u,f,a,t[9],21,-343485551),e[0]=m(a,e[0]),e[1]=m(s,e[1]),e[2]=m(u,e[2]),e[3]=m(f,e[3])}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function f(e){var t,n,r,i,o,u,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(c,r),c}function c(e){var t,n,r,i,o,s,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)a(c,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(c,r),t=0;t<16;t+=1)r[t]=0;return i=8*f,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(c,r),c}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=b[e>>8*t+4&15]+b[e>>8*t&15];return n}function h(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,f=t(n,u),c=u;return r!==e&&(c=t(r,u)),f>c?new ArrayBuffer(0):(i=c-f,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,f,i),a.set(s),o)}}(),_.prototype.append=function(e){return this.appendBinary(d(e)),this},_.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},_.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=y(n)),this.reset(),n},_.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},_.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},_.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},_.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},_.hash=function(e,t){return _.hashBinary(d(e),t)},_.hashBinary=function(e,t){var n=f(e),r=h(n);return t?y(r):r},_.ArrayBuffer=function(){this.reset()},_.ArrayBuffer.prototype.append=function(e){var t,n=v(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=y(n)),this.reset(),n},_.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.ArrayBuffer.prototype.getState=function(){var e=_.prototype.getState.call(this);return e.buff=g(e.buff),e},_.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),_.prototype.setState.call(this,e)},_.ArrayBuffer.prototype.destroy=_.prototype.destroy,_.ArrayBuffer.prototype._finish=_.prototype._finish,_.ArrayBuffer.hash=function(e,t){var n=c(new Uint8Array(e)),r=h(n);return t?y(r):r},_})},{}],62:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e(21).EventEmitter,o=e(25);o(r,i),r.Readable=e(71),r.Writable=e(73),r.Duplex=e(63),r.Transform=e(72),r.PassThrough=e(70),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",a),f.removeListener("error",s),e.removeListener("error",s),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(f.on("end",o),f.on("close",a));var c=!1;return f.on("error",s),e.on("error",s),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{21:21,25:25,63:63,70:70,71:71,72:72,73:73}],63:[function(e,t,n){t.exports=e(64)},{64:64}],64:[function(e,t,n){"use strict";function r(e){return this instanceof r?(f.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e(51),u=e(6);u.inherits=e(25);var f=e(66),c=e(68);u.inherits(r,f);for(var l=a(c.prototype),h=0;h0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var f;!t.decoder||i||r||(n=t.decoder.write(n),f=!t.objectMode&&0===n.length),i||(t.reading=!1),f||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return T.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?j(d,e):d(e))}function d(e){N("emit readable"),e.emit("readable"),b(e)}function p(e,t){t.readingMore||(t.readingMore=!0,j(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return eo.length?o.length:e;if(i+=a===o.length?o:o.slice(0,e),e-=a,0===e){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}function S(e,t){var n=C.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),e-=a,0===e){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,j(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):h(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?w(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function i(e){N("onunpipe"),e===h&&a()}function o(){N("onend"),e.end()}function a(){N("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",y),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",o),h.removeListener("end",a),h.removeListener("data",s),_=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function s(t){N("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&A(d.pipes,e)!==-1)&&!_&&(N("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,m=!0),h.pause())}function u(t){N("onerror",t),l(),e.removeListener("error",u),0===L(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",c),l()}function c(){N("onfinish"),e.removeListener("close",f),l()}function l(){N("unpipe"),h.unpipe(e)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,N("pipe count=%d opts=%j",d.pipesCount,t);var p=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,g=p?o:a;d.endEmitted?j(g):h.once("end",g),e.on("unpipe",i);var y=v(h);e.on("drain",y);var _=!1,m=!1;return h.on("data",s),r(e,"error",u),e.once("close",f),e.once("finish",c),e.emit("pipe",h),d.flowing||(N("pipe resume"),h.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k; +a.WritableState=o;var x=e(6);x.inherits=e(25);var R,B={deprecate:e(82)};!function(){try{R=e("stream")}catch(e){}finally{R||(R=e(21).EventEmitter)}}();var A=e(5).Buffer,j=e(4);x.inherits(a,R);var O;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:B.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var O;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(52))},{21:21,25:25,4:4,5:5,51:51,52:52,6:6,64:64,82:82}],69:[function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(e(5).Buffer,e(4));t.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},{4:4,5:5}],70:[function(e,t,n){t.exports=e(65)},{65:65}],71:[function(e,t,n){(function(r){var i=function(){try{return e("stream")}catch(e){}}();n=t.exports=e(66),n.Stream=i||n,n.Readable=n,n.Writable=e(68),n.Duplex=e(64),n.Transform=e(67),n.PassThrough=e(65),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e(52))},{52:52,64:64,65:65,66:66,67:67,68:68}],72:[function(e,t,n){t.exports=e(67)},{67:67}],73:[function(e,t,n){t.exports=e(68)},{68:68}],74:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e(5).Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{5:5}],75:[function(e,t,n){arguments[4][64][0].apply(n,arguments)},{25:25,51:51,6:6,64:64,76:76,78:78}],76:[function(e,t,n){(function(n){"use strict";function r(t,n){C=C||e(75),t=t||{},this.objectMode=!!t.objectMode,n instanceof C&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(T||(T=e(74).StringDecoder),this.decoder=new T(t.encoding),this.encoding=t.encoding)}function i(t){return C=C||e(75),this instanceof i?(this._readableState=new r(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void A.call(this)):new i(t)}function o(e,t,n,r,i){var o=f(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,c(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length=D?e=D:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var n=null;return B.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function c(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(L("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){L("emit readable"),e.emit("readable"),m(e)}function d(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)n=o?r.join(""):1===r.length?r[0]:B.concat(r,i),r.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return L("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):l(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;L("need readable",r),(0===t.length||t.length-e0?b(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){L("onunpipe"),e===l&&o()}function i(){L("onend"),e.end()}function o(){L("cleanup"),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",v),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),l.removeListener("data",a),y=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function a(t){L("ondata");var n=e.write(t);!1===n&&(1!==h.pipesCount||h.pipes[0]!==e||1!==l.listenerCount("data")||y||(L("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++),l.pause())}function s(t){L("onerror",t),c(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",f),c()}function f(){L("onfinish"),e.removeListener("close",u),c()}function c(){L("unpipe"),l.unpipe(e)}var l=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,L("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;h.endEmitted?x(p):l.once("end",p),e.on("unpipe",r);var v=g(l);e.on("drain",v);var y=!1;return l.on("data",a),e._events&&e._events.error?R(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",f),e.emit("pipe",l),h.flowing||(L("pipe resume"),l.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:k,x=e(5).Buffer;a.WritableState=o;var R=e(6);R.inherits=e(25);var B,A={deprecate:e(82)};!function(){try{B=e("stream")}catch(e){}finally{B||(B=e(21).EventEmitter)}}();var x=e(5).Buffer;R.inherits(a,B);var j;o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,t,n){var i=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?s(this,n):u(this,i,e,n)&&(i.pendingcb++,o=c(this,i,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},a.prototype._write=function(e,t,n){n(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||w(this,r,n)}}).call(this,e(52))},{21:21,25:25,5:5,51:51,52:52,6:6,75:75,82:82}],79:[function(e,t,n){arguments[4][72][0].apply(n,arguments)},{72:72,77:77}],80:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{16:16}],81:[function(e,t,n){(function(n){function r(e){a.call(this,e),this._destroyed=!1}function i(e,t,n){n(null,e)}function o(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=i),"function"!=typeof r&&(r=null),e(t,n,r)}}var a=e(79),s=e(85).inherits,u=e(80);s(r,a),r.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}},t.exports=o(function(e,t,n){var i=new r(e);return i._transform=t,n&&(i._flush=n),i}),t.exports.ctor=o(function(e,t,n){function i(t){return this instanceof i?(this.options=u(e,t),void r.call(this,this.options)):new i(t)}return s(i,r),i.prototype._transform=t,n&&(i.prototype._flush=n),i}),t.exports.obj=o(function(e,t,n){var i=new r(u({objectMode:!0,highWaterMark:16},e));return i._transform=t,n&&(i._flush=n),i})}).call(this,e(52))},{52:52,79:79,80:80,85:85}],82:[function(e,t,n){(function(e){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],83:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{25:25}],84:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],85:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&R(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=f(e,t);if(o)return o;var a=Object.keys(t),g=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),x(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(t);if(0===a.length){if(R(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return c(t)}var y="",_=!1,b=["{","}"];if(p(t)&&(_=!0,b=["[","]"]),R(t)){var w=t.name?": "+t.name:"";y=" [Function"+w+"]"}if(E(t)&&(y=" "+RegExp.prototype.toString.call(t)),S(t)&&(y=" "+Date.prototype.toUTCString.call(t)),x(t)&&(y=" "+c(t)),0===a.length&&(!_||0==t.length))return b[0]+y+b[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=_?l(e,t,r,g,a):a.map(function(n){return h(e,t,r,g,n,_)}),e.seen.pop(),d(k,y,b)}function f(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function _(e){return"number"==typeof e}function m(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function w(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===A(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===A(e)}function x(e){return k(e)&&("[object Error]"===A(e)||e instanceof Error)}function R(e){return"function"==typeof e}function B(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(f in r)r.hasOwnProperty(f)&&u.push(f);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)c=u[a],l=r[c],h=a>0?",":"",h+=JSON.stringify(c)+":",t.push({obj:l,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,f,c,l=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,r(null,l,h);break;case"t":d+=3,r(!0,l,h);break;case"f":d+=4,r(!1,l,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),l,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),l,h);break;case"[":f={element:[],index:l.length},l.push(f.element),h.push(f);break;case"{":c={element:{},index:l.length},l.push(c.element),h.push(c);break; +default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,h)}}},{}],87:[function(e,t,n){(function(t,n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function o(e){return"function"==typeof e}function a(e){return o(e.prefix)?e.prefix():e}function s(e){var t={};for(var n in e)t[n]=e[n];return t}function u(e,t,n){function r(e,r,i,o){return t.encode([e,n.encodeKey(r,i,o)])}function i(e,t){return t&&t.options&&(e.keyEncoding=e.keyEncoding||t.options.keyEncoding,e.valueEncoding=e.valueEncoding||t.options.valueEncoding),e}return e.open(function(){}),{apply:function(t,o,s){o=o||{};for(var u=[],f=-1,c=t.length;++f>>1,n(e[r],t)<0?i=r+1:o=r;return i}function $(e,t,n){var r=H(e,t,n);e.splice(r,0,t)}function G(e,t){for(var n,r,i=t,o=e.length;i0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;s0;){var g=p.pop();if(0!==g.diff)for(var v=g.ids[2],y=0,_=v.length;y<_;y++)p.push({ids:v[y],diff:g.diff-1,parent:g.ids,parentIdx:y});else g.ids[0]===l.ids[0]&&d.push(g)}var m=d[0];m?(r=Z(m.ids,l.ids),m.parent[2][m.parentIdx]=r.tree,i.push({pos:c.pos,ids:c.ids}),o=o||r.conflicts,a=!0):i.push(f)}else i.push(f)}return a||i.push(t),i.sort(V),{tree:i,conflicts:o||"internal_node"}}function ee(e,t){for(var n,r=J(e),i={},o=0,a=r.length;o0||r0||ri.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var u=[],f=k.docStore.readStream(i),c=Fe.obj(function(t,n,r){function i(t){var n={id:a.id,key:a.id,value:{rev:c}};if(e.include_docs){n.doc=t,n.doc._rev=n.value.rev,e.conflicts&&(n.doc._conflicts=Y(a));for(var i in n.doc._attachments)n.doc._attachments.hasOwnProperty(i)&&(n.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&a.id===e.endkey)return r();if(l){if("ok"!==e.deleted)return r();n.value.deleted=!0,n.doc=null}u.push(n),r()}var a=t.value,c=Ae(a),l=je(a,c);if(l){if("ok"!==e.deleted)return void r()}else{if(o-- >0)return void r();if("number"==typeof s&&s--<=0)return f.unpipe(),f.destroy(),void r()}if(e.include_docs){var h=a.rev_map[c];k.bySeqStore.get(v(h),function(e,t){i(t)})}else i()},function(n){it.resolve().then(function(){if(e.include_docs&&e.attachments)return Me(u,k,e)}).then(function(){t(null,{total_rows:r,offset:e.skip,rows:u})},t),n()}).on("unpipe",function(){c.end()});f.on("error",t),f.pipe(c)})}),E._changes=function(e){function t(){e.done=!0,f&&e.limit&&e.limit0&&(r=e.limit),u.reverse||(u.start=v(e.since||0));var f,c=e.doc_ids&&new g(e.doc_ids),l=M(e),h=new p;f="return_docs"in e?e.return_docs:!("returnDocs"in e)||e.returnDocs;var d=k.bySeqStore.readStream(u),_=Fe.obj(function(n,u,d){function p(t){function n(n){var r=e.processChange(n,t,e);r.seq=t.seq;var i=l(r);return"object"==typeof i?e.complete(i):(i&&(s++,e.attachments&&e.include_docs?Me([r],k,e).then(function(){e.onChange(r)}):e.onChange(r),f&&o.push(r)),void d())}var r=Ae(t);if(t.seq!==g)return d();if(a=g,r===_._rev)return n(_);var i=t.rev_map[r];k.bySeqStore.get(v(i),function(e,t){n(t)})}if(r&&s>=r)return t(),d();if(e.cancelled||e.done)return d();var g=y(n.key),_=n.value;if(g===e.since&&!i)return d();if(c&&!c.has(_._id))return d();var m;return(m=h.get(_._id))?p(m):void k.docStore.get(_._id,function(t,n){return e.cancelled||e.done||w.isClosed()||oe(n.id)?d():(h.set(_._id,n),void p(n))})},function(t){return e.cancelled?t():(f&&e.limit&&e.limitr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){i()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,a=!1;this._listeners[t]=i,this.on(e,i)}},x.prototype.removeListener=function(e,t){t in this._listeners&&(Ne.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},x.prototype.notifyLocalWindows=function(e){E()?chrome.storage.local.set({dbName:e}):k()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},x.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var st=Array.prototype.slice,ut=Array.prototype.forEach;Ie(A,Error),A.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var ft,ct=(new A({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new A({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),new A({status:404,error:"not_found",reason:"missing"})),lt=new A({status:409,error:"conflict",reason:"Document update conflict"}),ht=new A({status:400,error:"bad_request",reason:"_id field must contain a string"}),dt=new A({status:412,error:"missing_id",reason:"_id is required for puts"}),pt=new A({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),gt=new A({status:412,error:"precondition_failed",reason:"Database not open"}),vt=(new A({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),new A({status:500,error:"badarg",reason:"Some query argument is invalid"})),yt=(new A({status:400,error:"invalid_request",reason:"Request was invalid"}),new A({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),new A({status:500,error:"doc_validation",reason:"Bad special document member"})),_t=new A({status:400,error:"bad_request",reason:"Something wrong with the request"}),mt=(new A({status:400,error:"bad_request",reason:"Document must be a JSON object"}),new A({status:404, +error:"not_found",reason:"Database not found"}),new A({status:500,error:"indexed_db_went_bad",reason:"unknown"}),new A({status:500,error:"web_sql_went_bad",reason:"unknown"}),new A({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new A({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new A({status:400,error:"bad_request",reason:"Invalid rev format"})),bt=(new A({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new A({status:412,error:"missing_stub"})),wt=(new A({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),L.name);ft=wt?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var Et=ft,kt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),St=P(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),xt=P(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),Rt=function(e){return atob(e)},Bt=function(e){return btoa(e)},At=n.setImmediate||n.setTimeout,jt=32768;Be.prototype.get=function(e,n,r){var i=Re(this,e),o=i.get(n);return o?t.nextTick(function(){r(null,o)}):null===o?t.nextTick(function(){r({name:"NotFoundError"})}):void e.get(n,function(e,t){return e?("NotFoundError"===e.name&&i.set(n,null),r(e)):(i.set(n,t),void r(null,t))})},Be.prototype.batch=function(e){for(var t=0,n=e.length;t=0;i--){var o=this._batch[i],a=o.prefix.prefix()[0]+"ÿ"+o.key;n.has(a)||(n.add(a),r.push(o))}e.batch(r,t)};var Ot="document-store",Mt="by-sequence",Lt="attach-store",Tt="attach-binary-store",Ct="local-store",Dt="meta-store",Pt=new p,Nt="_local_last_update_seq",qt="_local_doc_count",It="_local_uuid",Ut="md5-",Wt={encode:Ee,decode:we,buffer:!1,type:"cheap-json"},Ft=new x;Te.valid=function(){return!0},Te.use_prefix=!1;var zt="undefined"!=typeof PouchDB?PouchDB:e("pouchdb");zt?Ce(zt):R("error",'memory adapter plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?')}).call(this,e(52),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e(5).Buffer)},{1:1,17:17,21:21,25:25,28:28,34:34,40:40,41:41,42:42,5:5,52:52,60:60,61:61,7:7,81:81,86:86,pouchdb:"pouchdb"}]},{},[87]); diff --git a/lib/pouchdb/dist/pouchdb.min.js b/lib/pouchdb/dist/pouchdb.min.js index 856a3dcf..a3d3810f 100644 --- a/lib/pouchdb/dist/pouchdb.min.js +++ b/lib/pouchdb/dist/pouchdb.min.js @@ -1,11 +1,11 @@ -// PouchDB 6.0.6 +// PouchDB 6.0.7 // // (c) 2012-2016 Dale Harvey and the PouchDB team // PouchDB may be freely distributed under the Apache license, version 2.0. // For all details and documentation: // http://pouchdb.com -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.PouchDB=e()}}(function(){var e;return function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=31}function o(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,i=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r),e}function i(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function a(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(3),n.log=i,n.formatArgs=o,n.save=s,n.load=a,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(a())},{3:3}],3:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function o(e){function t(){}function o(){var e=o,t=+new Date,i=t-(c||t);e.diff=i,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=n.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;a++;var o=n.formatters[r];if("function"==typeof o){var i=s[a];t=o.call(e,i),s.splice(a,1),a--}return t}),"function"==typeof n.formatArgs&&(s=n.formatArgs.apply(e,s));var u=o.log||n.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,o.enabled=!0;var i=n.enabled(e)?o:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;o=0&&this._listeners[e].splice(n,1)}},e.prototype.dispatchEvent=function(e){if(this._listeners[e.type]&&this._listeners[e.type].length)for(var t=this._listeners[e.type].slice(),n=0,r=t.length;n0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,a;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=i;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],6:[function(e,t,n){(function(e){"use strict";function n(){f=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function o(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return s(e,f,"day")||s(e,c,"hour")||s(e,u,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,n){if(!(e1)for(var n=1;n>>32-o,n)}function n(e,n,r,o,i,s,a){return t(n&r|~n&o,e,n,i,s,a)}function r(e,n,r,o,i,s,a){return t(n&o|r&~o,e,n,i,s,a)}function o(e,n,r,o,i,s,a){return t(n^r^o,e,n,i,s,a)}function i(e,n,r,o,i,s,a){return t(r^(n|~o),e,n,i,s,a)}function s(e,t){var s=e[0],a=e[1],u=e[2],c=e[3];s=n(s,a,u,c,t[0],7,-680876936),c=n(c,s,a,u,t[1],12,-389564586),u=n(u,c,s,a,t[2],17,606105819),a=n(a,u,c,s,t[3],22,-1044525330),s=n(s,a,u,c,t[4],7,-176418897),c=n(c,s,a,u,t[5],12,1200080426),u=n(u,c,s,a,t[6],17,-1473231341),a=n(a,u,c,s,t[7],22,-45705983),s=n(s,a,u,c,t[8],7,1770035416),c=n(c,s,a,u,t[9],12,-1958414417),u=n(u,c,s,a,t[10],17,-42063),a=n(a,u,c,s,t[11],22,-1990404162),s=n(s,a,u,c,t[12],7,1804603682),c=n(c,s,a,u,t[13],12,-40341101),u=n(u,c,s,a,t[14],17,-1502002290),a=n(a,u,c,s,t[15],22,1236535329),s=r(s,a,u,c,t[1],5,-165796510),c=r(c,s,a,u,t[6],9,-1069501632),u=r(u,c,s,a,t[11],14,643717713),a=r(a,u,c,s,t[0],20,-373897302),s=r(s,a,u,c,t[5],5,-701558691),c=r(c,s,a,u,t[10],9,38016083),u=r(u,c,s,a,t[15],14,-660478335),a=r(a,u,c,s,t[4],20,-405537848),s=r(s,a,u,c,t[9],5,568446438),c=r(c,s,a,u,t[14],9,-1019803690),u=r(u,c,s,a,t[3],14,-187363961),a=r(a,u,c,s,t[8],20,1163531501),s=r(s,a,u,c,t[13],5,-1444681467),c=r(c,s,a,u,t[2],9,-51403784),u=r(u,c,s,a,t[7],14,1735328473),a=r(a,u,c,s,t[12],20,-1926607734),s=o(s,a,u,c,t[5],4,-378558),c=o(c,s,a,u,t[8],11,-2022574463),u=o(u,c,s,a,t[11],16,1839030562),a=o(a,u,c,s,t[14],23,-35309556),s=o(s,a,u,c,t[1],4,-1530992060),c=o(c,s,a,u,t[4],11,1272893353),u=o(u,c,s,a,t[7],16,-155497632),a=o(a,u,c,s,t[10],23,-1094730640),s=o(s,a,u,c,t[13],4,681279174),c=o(c,s,a,u,t[0],11,-358537222),u=o(u,c,s,a,t[3],16,-722521979),a=o(a,u,c,s,t[6],23,76029189),s=o(s,a,u,c,t[9],4,-640364487),c=o(c,s,a,u,t[12],11,-421815835),u=o(u,c,s,a,t[15],16,530742520),a=o(a,u,c,s,t[2],23,-995338651),s=i(s,a,u,c,t[0],6,-198630844),c=i(c,s,a,u,t[7],10,1126891415),u=i(u,c,s,a,t[14],15,-1416354905),a=i(a,u,c,s,t[5],21,-57434055),s=i(s,a,u,c,t[12],6,1700485571),c=i(c,s,a,u,t[3],10,-1894986606),u=i(u,c,s,a,t[10],15,-1051523),a=i(a,u,c,s,t[1],21,-2054922799),s=i(s,a,u,c,t[8],6,1873313359),c=i(c,s,a,u,t[15],10,-30611744),u=i(u,c,s,a,t[6],15,-1560198380),a=i(a,u,c,s,t[13],21,1309151649),s=i(s,a,u,c,t[4],6,-145523070),c=i(c,s,a,u,t[11],10,-1120210379),u=i(u,c,s,a,t[2],15,718787259),a=i(a,u,c,s,t[9],21,-343485551),e[0]=g(s,e[0]),e[1]=g(a,e[1]),e[2]=g(u,e[2]),e[3]=g(c,e[3])}function a(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function c(e){var t,n,r,o,i,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)s(f,a(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(f,r),t=0;t<16;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),u=parseInt(o[1],16)||0,r[14]=i,r[15]=u,s(f,r),f}function f(e){var t,n,r,o,i,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)s(f,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(f,r),t=0;t<16;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),a=parseInt(o[1],16)||0,r[14]=i,r[15]=a,s(f,r),f}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=b[e>>8*t+4&15]+b[e>>8*t&15];return n}function d(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var o,i,s,a,u=this.byteLength,c=t(n,u),f=u;return r!==e&&(f=t(r,u)),c>f?new ArrayBuffer(0):(o=f-c,i=new ArrayBuffer(o),s=new Uint8Array(i),a=new Uint8Array(this,c,o),s.set(a),i)}}(),m.prototype.append=function(e){return this.appendBinary(h(e)),this},m.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)s(this._hash,a(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},m.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=d(this._hash),e&&(n=_(n)),this.reset(),n},m.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},m.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},m.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},m.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},m.prototype._finish=function(e,t){var n,r,o,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(s(this._hash,e),i=0;i<16;i+=1)e[i]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]=r,e[15]=o,s(this._hash,e)},m.hash=function(e,t){return m.hashBinary(h(e),t)},m.hashBinary=function(e,t){var n=c(e),r=d(n);return t?_(r):r},m.ArrayBuffer=function(){this.reset()},m.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)s(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=d(this._hash),e&&(n=_(n)),this.reset(),n},m.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},m.ArrayBuffer.prototype.getState=function(){var e=m.prototype.getState.call(this);return e.buff=v(e.buff),e},m.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),m.prototype.setState.call(this,e)},m.ArrayBuffer.prototype.destroy=m.prototype.destroy,m.ArrayBuffer.prototype._finish=m.prototype._finish,m.ArrayBuffer.hash=function(e,t){var n=f(new Uint8Array(e)),r=d(n);return t?_(r):r},m})},{}],14:[function(e,t,n){"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[n.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(e);else if(i===t.length-2){var s=t.pop();o[s]=e}else t.push(e)}n.stringify=function(e){var t=[];t.push({obj:e});for(var n,r,o,i,s,a,u,c,f,l,d,h="";n=t.pop();)if(r=n.obj,o=n.prefix||"",i=n.val||"",h+=o,i)h+=i;else if("object"!=typeof r)h+="undefined"==typeof r?null:JSON.stringify(r);else if(null===r)h+="null";else if(Array.isArray(r)){for(t.push({val:"]"}),s=r.length-1;s>=0;s--)a=0===s?"":",",t.push({obj:r[s],prefix:a});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),s=u.length-1;s>=0;s--)f=u[s],l=r[f],d=s>0?",":"",d+=JSON.stringify(f)+":",t.push({obj:l,prefix:d});t.push({val:"{"})}return h},n.parse=function(e){for(var t,n,o,i,s,a,u,c,f,l=[],d=[],h=0;;)if(t=e[h++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":h+=3,r(null,l,d);break;case"t":h+=3,r(!0,l,d);break;case"f":h+=4,r(!1,l,d);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",h--;;){if(o=e[h++],!/[\d\.\-e\+]/.test(o)){h--;break}n+=o}r(parseFloat(n),l,d);break;case'"':for(i="",s=void 0,a=0;;){if(u=e[h++],'"'===u&&("\\"!==s||a%2!==1))break;i+=u,s=u,"\\"===s?a++:a=0}r(JSON.parse('"'+i+'"'),l,d);break;case"[":c={element:[],index:l.length},l.push(c.element),d.push(c);break;case"{":f={element:{},index:l.length},l.push(f.element),d.push(f);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,d)}}},{}],15:[function(e,t,n){(function(n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function i(e){return"$"+e}function s(e){return e.substring(1)}function a(){this.store={}}function u(e){if(this.store=new a,e&&Array.isArray(e))for(var t=0,n=e.length;t=h.length)){var e=Math.min(p+Yr,h.length),t=h.slice(p,e);a(t,p),p+=t.length}}function a(n,r){n.forEach(function(n,o){var a=r+o,u=c[n],f=_(u[0],["atts_since","attachments"]);f.open_revs=u.map(function(e){return e.rev}),f.open_revs=f.open_revs.filter(m);var l=m;0===f.open_revs.length&&(delete f.open_revs,l=g),["revs","attachments","binary","ajax"].forEach(function(e){e in t&&(f[e]=t[e])}),e.get(n,f,function(e,t){var r;r=e?[{error:e}]:l(t),i(a,n,r),s()})})}var u=t.docs,c={};u.forEach(function(e){e.id in c?c[e.id].push(e):c[e.id]=[e]});var f=Object.keys(c).length,l=0,d=new Array(f),h=Object.keys(c),p=0;s()}function w(){return"undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage&&"undefined"!=typeof chrome.storage.local}function E(){return Gr}function k(e){w()?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):E()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(t){e.emit(t.key)}):window.attachEvent("storage",function(t){e.emit(t.key)}))}function S(){Mr.EventEmitter.call(this),this._listeners={},k(this)}function q(e){if("undefined"!==console&&e in console){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}function x(e,t){var n=6e5;e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||t<=e?t=(e||1)<<1:t+=1,t>n&&(e=n>>1,t=n);var r=Math.random(),o=t-e;return~~(o*r+e)}function A(e){var t=0;return e||(t=2e3),x(e,t)}function T(e,t){q("info","The above "+e+" is totally normal. "+t)}function O(e){Error.call(this,e.reason),this.status=e.status,this.name=e.error,this.message=e.reason,this.error=!0}function j(e,t){function n(t){for(var n in e)"function"!=typeof e[n]&&(this[n]=e[n]);void 0!==t&&(this.reason=t)}return n.prototype=O.prototype,new n(t)}function C(e){if("object"!=typeof e){var t=e;e=so,e.data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),e}function L(e,t,n){try{return!e(t,n)}catch(e){var r="Filter function threw: "+e.toString();return j(fo,r)}}function I(e){var t={},n=e.filter&&"function"==typeof e.filter;return t.query=e.query_params,function(r){r.doc||(r.doc={});var o=n&&L(e.filter,r.doc,t);if("object"==typeof o)return o;if(o)return!1;if(e.include_docs){if(!e.attachments)for(var i in r.doc._attachments)r.doc._attachments.hasOwnProperty(i)&&(r.doc._attachments[i].stub=!0)}else delete r.doc;return!0}}function R(e){for(var t=[],n=0,r=e.length;n>>1,n(e[r],t)<0?o=r+1:i=r;return o}function Z(e,t,n){var r=Y(e,t,n);e.splice(r,0,t)}function ee(e,t){for(var n,r,o=t,i=e.length;o0;){var o=n.pop(),i=o.tree1,s=o.tree2;(i[1].status||s[1].status)&&(i[1].status="available"===i[1].status||"available"===s[1].status?"available":"missing");for(var a=0;a0;){var v=p.pop();if(0!==v.diff)for(var y=v.ids[2],_=0,m=y.length;_0&&o.emit("error",t):o.emit("complete",n),o.removeAllListeners(),e.removeListener("destroyed",r)});n&&(o.on("complete",function(e){n(null,e)}),o.on("error",n)),e.once("destroyed",r),t.onChange=function(e){t.isCancelled||de(o,e)};var s=new Xr(function(e,n){t.complete=function(t,r){t?n(t):e(r)}});o.once("cancel",function(){e.removeListener("destroyed",r),t.complete(null,{status:"cancelled"})}),this.then=s.then.bind(s),this.catch=s.catch.bind(s),this.then(function(e){i(null,e)},i),e.taskqueue.isReady?o.doChanges(t):e.taskqueue.addTask(function(e){e?t.complete(e):o.isCancelled?o.emit("cancel"):o.doChanges(t)})}function pe(e,t,n){var r=[{rev:e._rev}];"all_docs"===n.style&&(r=X(t.rev_tree).map(function(e){return{rev:e.rev}}));var o={id:t.id,changes:r,doc:e};return ue(t,e._rev)&&(o.deleted=!0),n.conflicts&&(o.doc._conflicts=G(t),o.doc._conflicts.length||delete o.doc._conflicts),o}function ve(e,t){return et?1:0}function ye(e,t){for(var n=0;n0?t.keys.slice(t.skip):t.keys;if(t.descending&&r.reverse(),!r.length)return e._allDocs({limit:0},n);var o={offset:t.skip};return Xr.all(r.map(function(n){var r=Br.extend({key:n,deleted:"ok"},t);return["limit","skip","keys"].forEach(function(e){delete r[e]}),new Xr(function(t,i){e._allDocs(r,function(e,r){return e?i(e):(o.total_rows=r.total_rows,void t(r.rows[0]||{key:n,error:"not_found"}))})})})).then(function(e){return o.rows=e,o})}function Ee(e){var t=e._compactionQueue[0],r=t.opts,o=t.callback;e.get("_local/compaction").catch(function(){return!1}).then(function(t){t&&t.last_seq&&(r.last_seq=t.last_seq),e._compact(r,function(t,r){t?o(t):o(null,r),n.nextTick(function(){e._compactionQueue.shift(),e._compactionQueue.length&&Ee(e)})})})}function ke(e){return"_"===e.charAt(0)&&e+"is not a valid attachment name, attachment names cannot start with '_'"}function Se(){Mr.EventEmitter.call(this)}function qe(){this.isReady=!1,this.failed=!1,this.queue=[]}function xe(e,t){var n=e.match(/([a-z\-]*):\/\/(.*)/);if(n)return e=/http(s?)/.test(n[1])?n[1]+"://"+n[2]:n[2],{name:e,adapter:n[1]};var r,o="idb"in Te.adapters&&"websql"in Te.adapters&&E()&&localStorage["_pouch__websqldb_"+Te.prefix+e];if(t.adapter)r=t.adapter;else if("undefined"!=typeof t&&t.db)r="leveldb";else for(var i=0;i0||r0||r=43)}}).catch(function(){return!1})}function Et(e,t){var n=this;Po.queue.push({action:function(t){kt(n,e,t)},callback:t}),at(n.constructor)}function kt(e,t,r){function o(e){var t=e.createObjectStore(Lo,{keyPath:"id"});e.createObjectStore(Io,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore(Ro,{keyPath:"digest"}),e.createObjectStore(No,{keyPath:"id",autoIncrement:!1}),e.createObjectStore(Fo),t.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.createObjectStore(Bo,{keyPath:"_id"});var n=e.createObjectStore(Do,{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}function i(e,t){var n=e.objectStore(Lo);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var o=r.value,i=ue(o);o.deletedOrLocal=i?"1":"0",n.put(o),r.continue()}else t()}}function s(e){e.createObjectStore(Bo,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function c(e,t){var n=e.objectStore(Bo),r=e.objectStore(Lo),o=e.objectStore(Io),i=r.openCursor();i.onsuccess=function(e){var i=e.target.result;if(i){var s=i.value,a=s.id,u=ce(a),c=J(s);if(u){var f=a+"::"+c,l=a+"::",d=a+"::~",h=o.index("_doc_id_rev"),p=IDBKeyRange.bound(l,d,!1,!1),v=h.openCursor(p);v.onsuccess=function(e){if(v=e.target.result){var t=v.value;t._doc_id_rev===f&&n.put(t),o.delete(v.primaryKey),v.continue()}else r.delete(i.primaryKey),i.continue()}}else i.continue()}else t&&t()}}function f(e){var t=e.createObjectStore(Do,{autoIncrement:!0});t.createIndex("seq","seq"),t.createIndex("digestSeq","digestSeq",{unique:!0})}function l(e,t){var n=e.objectStore(Io),r=e.objectStore(Ro),o=e.objectStore(Do),i=r.count();i.onsuccess=function(e){var r=e.target.result;return r?void(n.openCursor().onsuccess=function(e){var n=e.target.result;if(!n)return t();for(var r=n.value,i=n.primaryKey,s=Object.keys(r._attachments||{}),a={},u=0;uo&&(o=n),t.continue()}}function i(){var e=ct(a,a.winningRev,a.deleted),t=r.put(e);t.onsuccess=function(){s.continue()}}var s=e.target.result;if(s){var a=t(s.value);return a.winningRev=a.winningRev||J(a),a.seq?i():void o()}}}var p=t.name,y=null;e._meta=null,e.type=function(){return"idb"},e._id=v(function(t){t(null,e._meta.instanceId)}),e._bulkDocs=function(n,r,o){_t(t,n,r,e,y,Mo,o)},e._get=function(e,t,n){function r(){n(s,{doc:o,metadata:i,ctx:a})}var o,i,s,a=t.ctx;if(!a){var u=yt(y,[Lo,Io,Ro],"readonly");if(u.error)return n(u.error);a=u.txn}a.objectStore(Lo).get(e).onsuccess=function(e){if(i=ft(e.target.result),!i)return s=j(eo,"missing"),r();if(ue(i)&&!t.rev)return s=j(eo,"deleted"),r();var n=a.objectStore(Io),u=t.rev||i.winningRev,c=i.id+"::"+u;n.index("_doc_id_rev").get(c).onsuccess=function(e){return o=e.target.result,o&&(o=lt(o)),o?void r():(s=j(eo,"missing"),r())}}},e._getAttachment=function(e,t,n,r,o){var i;if(r.ctx)i=r.ctx;else{var s=yt(y,[Lo,Io,Ro],"readonly");if(s.error)return o(s.error);i=s.txn}var a=n.digest,u=n.content_type;i.objectStore(Ro).get(a).onsuccess=function(e){var t=e.target.result.body;dt(t,u,r.binary,function(e){o(null,e)})}},e._info=function(t){if(null===y||!Uo.has(p)){var n=new Error("db isn't open");return n.id="idbNull",t(n)}var r,o,i=yt(y,[Io],"readonly");if(i.error)return t(i.error);var s=i.txn,a=s.objectStore(Io).openCursor(null,"prev");a.onsuccess=function(t){var n=t.target.result;r=n?n.key:0,o=e._meta.docCount},s.oncomplete=function(){t(null,{doc_count:o,update_seq:r,idb_attachment_format:e._meta.blobSupport?"binary":"base64"})}},e._allDocs=function(t,n){bt(t,e,y,n)},e._changes=function(t){function n(e){function n(){return a.seq!==s?e.continue():(f=s,a.winningRev===i._rev?o(i):void r())}function r(){var e=i._id+"::"+a.winningRev,t=g.get(e);t.onsuccess=function(e){o(lt(e.target.result))}}function o(n){var r=t.processChange(n,a,t);r.seq=a.seq;var o=E(r);return"object"==typeof o?t.complete(o):(o&&(w++,d&&b.push(r),t.attachments&&t.include_docs?ht(n,t,v,function(){pt([r],t.binary).then(function(){t.onChange(r)})}):t.onChange(r)),void(w!==l&&e.continue()))}var i=lt(e.value),s=e.key;if(c&&!c.has(i._id))return e.continue();var a;return(a=k.get(i._id))?n():void(m.get(i._id).onsuccess=function(e){a=ft(e.target.result),k.set(i._id,a),n()})}function r(e){var t=e.target.result;t&&n(t)}function o(){var e=[Lo,Io];t.attachments&&e.push(Ro);var n=yt(y,e,"readonly");if(n.error)return t.complete(n.error);v=n.txn,v.onabort=ut(t.complete),v.oncomplete=i,_=v.objectStore(Io),m=v.objectStore(Lo),g=_.index("_doc_id_rev");var o;o=t.descending?_.openCursor(null,"prev"):_.openCursor(IDBKeyRange.lowerBound(t.since,!0)),o.onsuccess=r}function i(){function e(){t.complete(null,{results:b,last_seq:f})}!t.continuous&&t.attachments?pt(b).then(e):e()}if(t=h(t),t.continuous){var s=p+":"+W();return Mo.addListener(p,s,e,t),Mo.notify(p),{cancel:function(){Mo.removeListener(p,s)}}}var c=t.doc_ids&&new u(t.doc_ids);t.since=t.since||0;var f=t.since,l="limit"in t?t.limit:-1;0===l&&(l=1);var d;d="return_docs"in t?t.return_docs:!("returnDocs"in t)||t.returnDocs;var v,_,m,g,b=[],w=0,E=I(t),k=new a;o()},e._close=function(e){return null===y?e(j(io)):(y.close(),Uo.delete(p),y=null,void e())},e._getRevisionTree=function(e,t){var n=yt(y,[Lo],"readonly");if(n.error)return t(n.error);var r=n.txn,o=r.objectStore(Lo).get(e);o.onsuccess=function(e){var n=ft(e.target.result);n?t(null,n.rev_tree):t(j(eo))}},e._doCompaction=function(e,t,n){var r=[Lo,Io,Ro,Do],o=yt(y,r,"readwrite");if(o.error)return n(o.error);var i=o.txn,s=i.objectStore(Lo);s.get(e).onsuccess=function(n){var r=ft(n.target.result);K(r.rev_tree,function(e,n,r,o,i){var s=n+"-"+r;t.indexOf(s)!==-1&&(i.status="missing")}),vt(t,e,i);var o=r.winningRev,s=r.deleted;i.objectStore(Lo).put(ct(r,o,s))},i.onabort=ut(n),i.oncomplete=function(){n()}},e._getLocal=function(e,t){var n=yt(y,[Bo],"readonly");if(n.error)return t(n.error);var r=n.txn,o=r.objectStore(Bo).get(e);o.onerror=ut(t),o.onsuccess=function(e){var n=e.target.result;n?(delete n._doc_id_rev,t(null,n)):t(j(eo))}},e._putLocal=function(e,t,n){"function"==typeof t&&(n=t,t={}),delete e._revisions;var r=e._rev,o=e._id;r?e._rev="0-"+(parseInt(r.split("-")[1],10)+1):e._rev="0-1";var i,s=t.ctx;if(!s){var a=yt(y,[Bo],"readwrite");if(a.error)return n(a.error);s=a.txn,s.onerror=ut(n),s.oncomplete=function(){i&&n(null,i)}}var u,c=s.objectStore(Bo);r?(u=c.get(o),u.onsuccess=function(o){var s=o.target.result;if(s&&s._rev===r){var a=c.put(e);a.onsuccess=function(){i={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,i)}}else n(j(to))}):(u=c.add(e),u.onerror=function(e){n(j(to)),e.preventDefault(),e.stopPropagation()},u.onsuccess=function(){i={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,i)})},e._removeLocal=function(e,t,n){"function"==typeof t&&(n=t,t={});var r=t.ctx;if(!r){var o=yt(y,[Bo],"readwrite");if(o.error)return n(o.error);r=o.txn,r.oncomplete=function(){i&&n(null,i)}}var i,s=e._id,a=r.objectStore(Bo),u=a.get(s);u.onerror=ut(n),u.onsuccess=function(r){var o=r.target.result;o&&o._rev===e._rev?(a.delete(s),i={ok:!0,id:s,rev:"0-0"},t.ctx&&n(null,i)):n(j(eo))}},e._destroy=function(e,t){Mo.removeAllListeners(p);var n=Ho.get(p);n&&n.result&&(n.result.close(),Uo.delete(p));var r=indexedDB.deleteDatabase(p);r.onsuccess=function(){Ho.delete(p),E()&&p in localStorage&&delete localStorage[p],t(null,{ok:!0})},r.onerror=ut(t)};var _=Uo.get(p);if(_)return y=_.idb,e._meta=_.global,void n.nextTick(function(){r(null,e)});var m;m=t.storage?St(p,t.storage):indexedDB.open(p,Co),Ho.set(p,m),m.onupgradeneeded=function(e){function t(){var e=a[u-1];u++,e&&e(r,t)}var n=e.target.result;if(e.oldVersion<1)return o(n);var r=e.currentTarget.transaction;e.oldVersion<3&&s(n),e.oldVersion<4&&f(n);var a=[i,c,l,d],u=e.oldVersion;t()},m.onsuccess=function(t){y=t.target.result,y.onversionchange=function(){y.close(),Uo.delete(p)},y.onabort=function(e){q("error","Database has a global failure",e.target.error),y.close(),Uo.delete(p)};var n=y.transaction([No,Fo,Lo],"readwrite"),o=n.objectStore(No).get(No),i=null,s=null,a=null;o.onsuccess=function(t){var o=function(){null!==i&&null!==s&&null!==a&&(e._meta={name:p,instanceId:a,blobSupport:i,docCount:s},Uo.set(p,{idb:y,global:e._meta}),r(null,e))},u=t.target.result||{id:No};p+"_id"in u?(a=u[p+"_id"],o()):(a=W(),u[p+"_id"]=a,n.objectStore(No).put(u).onsuccess=function(){o()}),So||(So=wt(n)),So.then(function(e){i=e,o()});var c=n.objectStore(Lo).index("deletedOrLocal");c.count(IDBKeyRange.only("0")).onsuccess=function(e){s=e.target.result,o()}}},m.onerror=function(){ -var e="Failed to open indexedDB, are you in private browsing mode?";q("error",e),r(j(ho,e))}}function St(e,t){try{return indexedDB.open(e,{version:Co,storage:t})}catch(t){return indexedDB.open(e,Co)}}function qt(e){e.adapter("idb",Et,!0)}function xt(e){return decodeURIComponent(escape(e))}function At(e){return e<65?e-48:e-55}function Tt(e,t,n){for(var r="";t0;){var e=w.pop();e(null,g)}}function l(e,t){if(0===t){var n="CREATE TABLE IF NOT EXISTS "+Go+" (dbid, db_version INTEGER)",c="CREATE TABLE IF NOT EXISTS "+zo+" (digest UNIQUE, escaped TINYINT(1), body BLOB)",l="CREATE TABLE IF NOT EXISTS "+Vo+" (digest, seq INTEGER)",d="CREATE TABLE IF NOT EXISTS "+Jo+" (id unique, json, winningseq, max_seq INTEGER UNIQUE)",h="CREATE TABLE IF NOT EXISTS "+Ko+" (seq INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, json, deleted TINYINT(1), doc_id, rev)",p="CREATE TABLE IF NOT EXISTS "+Xo+" (id UNIQUE, rev, json)";e.executeSql(c),e.executeSql(p),e.executeSql(l,[],function(){e.executeSql(ni),e.executeSql(ri)}),e.executeSql(d,[],function(){e.executeSql(ti),e.executeSql(h,[],function(){e.executeSql(Zo),e.executeSql(ei),e.executeSql(n,[],function(){var t="INSERT INTO "+Go+" (db_version, dbid) VALUES (?,?)";g=W();var n=[Wo,g];e.executeSql(t,n,function(){f()})})})})}else{var v=function(){var n=t=")+" ?"),l.push(o)),i!==!1){var h=a?">":"<";f&&(h+="="),d.push(Jo+".id "+h+" ?"),l.push(i)}s!==!1&&(d.push(Jo+".id = ?"),l.push(s))}"ok"!==e.deleted&&d.push(Ko+".deleted = 0"),q.readTransaction(function(t){y(t,function(o){if(n=o,0!==u){var i=Bt(ii,[Jo,Ko],oi,d,Jo+".id "+(a?"DESC":"ASC"));i+=" LIMIT "+u+" OFFSET "+c,t.executeSql(i,l,function(t,n){for(var o=0,i=n.rows.length;o ?"],f=[e.since];e.doc_ids&&(c.push(Jo+".id IN "+Nt(e.doc_ids.length)),f=f.concat(e.doc_ids));var l="maxSeq "+(r?"DESC":"ASC"),d=Bt(t,n,u,c,l),h=I(e);e.view||e.filter||(d+=" LIMIT "+o);var p=e.since||0;q.readTransaction(function(t){t.executeSql(d,f,function(t,n){function r(t){return function(){e.onChange(t)}}for(var u=0,c=n.rows.length;u0&&(r=setTimeout(function(){n.reject(new Error("Load timeout for resource: "+e.url))},e.timeout)),n.promise.then(function(t){return o={statusCode:t.status},e.timeout>0&&clearTimeout(r),o.statusCode>=200&&o.statusCode<300?e.binary?t.blob():t.text():t.json()}).then(function(e){o.statusCode>=200&&o.statusCode<300?t(null,o,e):t(e,o)}).catch(function(e){t(e,o)}),{abort:n.reject}}function tn(e,t){var n,r,o=!1,i=function(){n.abort(),u()},s=function(){o=!0,n.abort(),u()},a={abort:i},u=function(){clearTimeout(r),a.abort=function(){},n&&(n.onprogress=void 0,n.upload&&(n.upload.onprogress=void 0),n.onreadystatechange=void 0,n=void 0)};n=e.xhr?new e.xhr:new XMLHttpRequest;try{n.open(e.method,e.url)}catch(e){return t(new Error(e.name||"Url is invalid"))}n.withCredentials=!("withCredentials"in e)||e.withCredentials,"GET"===e.method?delete e.headers["Content-Type"]:e.json&&(e.headers.Accept="application/json",e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.body&&e.processData&&"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.binary&&(n.responseType="arraybuffer"),"body"in e||(e.body=null);for(var c in e.headers)e.headers.hasOwnProperty(c)&&n.setRequestHeader(c,e.headers[c]);return e.timeout>0&&(r=setTimeout(s,e.timeout),n.onprogress=function(){clearTimeout(r),4!==n.readyState&&(r=setTimeout(s,e.timeout))},"undefined"!=typeof n.upload&&(n.upload.onprogress=n.onprogress)),n.onreadystatechange=function(){if(4===n.readyState){var r={statusCode:n.status};if(n.status>=200&&n.status<300){var i;i=e.binary?Re([n.response||""],{type:n.getResponseHeader("Content-Type")}):n.responseText,t(null,r,i)}else{var s={};if(o)s=new Error("ETIMEDOUT"),s.code="ETIMEDOUT";else if("string"==typeof n.response)try{s=JSON.parse(n.response)}catch(e){}s.status=n.status,t(s)}u()}},e.body&&e.body instanceof Blob?He(e.body,function(e){n.send(e)}):n.send(e.body),a}function nn(){try{return new XMLHttpRequest,!0}catch(e){return!1}}function rn(e,t){return si||e.xhr?tn(e,t):en(e,t)}function on(){return""}function sn(e,t){function n(t,n,r){if(!e.binary&&e.json&&"string"==typeof t)try{t=JSON.parse(t)}catch(e){return r(e)}Array.isArray(t)&&(t=t.map(function(e){return e.error||e.missing?C(e):e})),e.binary&&ai(t,n),r(null,t,n)}e=h(e);var r={method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1};return e=Br.extend(r,e),e.json&&(e.binary||(e.headers.Accept="application/json"),e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json"),e.binary&&(e.encoding=null,e.json=!1),e.processData||(e.json=!1),rn(e,function(r,o,i){if(r)return t(C(r));var s,a=o.headers&&o.headers["content-type"],u=i||on();if(!e.binary&&(e.json||!e.processData)&&"object"!=typeof u&&(/json/.test(a)||/^[\s]*\{/.test(u)&&/\}[\s]*$/.test(u)))try{u=JSON.parse(u.toString())}catch(e){}o.statusCode>=200&&o.statusCode<300?n(u,o,t):(s=C(u),s.status=o.statusCode,t(s))})}function an(e,t){var n=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=n.indexOf("safari")!==-1&&n.indexOf("chrome")===-1,o=n.indexOf("msie")!==-1,i=n.indexOf("edge")!==-1,s=r||(o||i)&&"GET"===e.method,a=!("cache"in e)||e.cache,u=/^blob:/.test(e.url);if(!u&&(s||!a)){var c=e.url.indexOf("?")!==-1;e.url+=(c?"&":"?")+"_nonce="+Date.now()}return sn(e,t)}function un(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];n.data=Be(n.data,n.content_type)})}function cn(e){return/^_design/.test(e)?"_design/"+encodeURIComponent(e.slice(8)):/^_local/.test(e)?"_local/"+encodeURIComponent(e.slice(7)):encodeURIComponent(e)}function fn(e){return e._attachments&&Object.keys(e._attachments)?Xr.all(Object.keys(e._attachments).map(function(t){var n=e._attachments[t];if(n.data&&"string"!=typeof n.data)return new Xr(function(e){Me(n.data,e)}).then(function(e){n.data=e})})):Xr.resolve()}function ln(e){if(!e.prefix)return!1;var t=P(e.prefix).protocol;return"http"===t||"https"===t}function dn(e,t){if(ln(t)){var n=t.name.substr(t.prefix.length);e=t.prefix+encodeURIComponent(n)}var r=P(e);(r.user||r.password)&&(r.auth={username:r.user,password:r.password});var o=r.path.replace(/(^\/|\/$)/g,"").split("/");return r.db=o.pop(),r.db.indexOf("%")===-1&&(r.db=encodeURIComponent(r.db)),r.path=o.join("/"),r}function hn(e,t){return pn(e,e.db+"/"+t)}function pn(e,t){var n=e.path?"/":"";return e.protocol+"://"+e.host+(e.port?":"+e.port:"")+"/"+e.path+n+t}function vn(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function yn(e,t){function n(e,t,n){var r=e.ajax||{},o=Br.extend(h(f),r,t);return li(o.method+" "+o.url),a._ajax(o,n)}function r(e,t){return new Xr(function(r,o){n(e,t,function(e,t){return e?o(e):void r(t)})})}function o(e,t){return y(e,Hr(function(e){i().then(function(){return t.apply(this,e)}).catch(function(t){var n=e.pop();n(t)})}))}function i(){if(e.skipSetup||e.skip_setup)return Xr.resolve();if(v)return v;var t={method:"GET",url:c};return v=r({},t).catch(function(e){return e&&e.status&&404===e.status?(T(404,"PouchDB is just detecting if the remote exists."),r({},{method:"PUT",url:c})):Xr.reject(e)}).catch(function(e){return!(!e||!e.status||412!==e.status)||Xr.reject(e)}),v.catch(function(){v=null}),v}function s(e){return e.split("/").map(encodeURIComponent).join("/")}var a=this,u=dn(e.name,e),c=hn(u,"");e=h(e);var f=e.ajax||{};if(e.auth||u.auth){var l=e.auth||u.auth,d=l.username+":"+l.password,p=To(unescape(encodeURIComponent(d)));f.headers=f.headers||{},f.headers.Authorization="Basic "+p}a._ajax=an;var v;setTimeout(function(){t(null,a)}),a.type=function(){return"http"},a.id=o("id",function(e){n({},{method:"GET",url:pn(u,"")},function(t,n){var r=n&&n.uuid?n.uuid+u.db:hn(u,"");e(null,r)})}),a.request=o("request",function(e,t){e.url=hn(u,e.url),n({},e,t)}),a.compact=o("compact",function(e,t){"function"==typeof e&&(t=e,e={}),e=h(e),n(e,{url:hn(u,"_compact"),method:"POST"},function(){function n(){a.info(function(r,o){o&&!o.compact_running?t(null,{ok:!0}):setTimeout(n,e.interval||200)})}n()})}),a.bulkGet=y("bulkGet",function(e,t){function r(t){var r={};e.revs&&(r.revs=!0),e.attachments&&(r.attachments=!0),n({},{url:hn(u,"_bulk_get"+vn(r)),method:"POST",body:{docs:e.docs}},t)}function o(){function n(e){return function(n,r){a[e]=r.results,++s===o&&t(null,{results:R(a)})}}for(var r=ci,o=Math.ceil(e.docs.length/r),s=0,a=new Array(o),u=0;ut?t:a;var f={method:d,url:hn(u,"_changes"+vn(o)),timeout:e.timeout,body:l};v=r,e.aborted||i().then(function(){p=n(e,f,c)}).catch(c)}},_={results:[]},m=function(n,o){if(!e.aborted){var i=0;if(o&&o.results){i=o.results.length,_.last_seq=o.last_seq;var u={};u.query=e.query_params,o.results=o.results.filter(function(t){a--;var n=I(e)(t);return n&&(e.include_docs&&e.attachments&&e.binary&&un(t),r&&_.results.push(t),e.onChange(t)),n})}else if(n)return e.aborted=!0,void e.complete(n);o&&o.last_seq&&(v=o.last_seq);var c=s&&a<=0||o&&it.length?1:-1}function Tn(e,t){return e===t?0:e>t?1:-1}function On(e,t){for(var n=Object.keys(e),r=Object.keys(t),o=Math.min(n.length,r.length),i=0;ir.length?1:-1}function jn(e){var t=["boolean","number","string","object"],n=t.indexOf(typeof e);return~n?null===e?1:Array.isArray(e)?5:n<3?n+2:n+3:Array.isArray(e)?5:void 0}function Cn(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,o=r?"0":"2",i=(r?-n:n)-di,s=gn(i.toString(),"0",hi);o+=pi+s;var a=Math.abs(parseFloat(t[0]));r&&(a=10-a);var u=a.toFixed(20);return u=u.replace(/\.?0+$/,""),o+=pi+u}function Ln(){this.promise=new Xr(function(e){e()})}function In(e){var t,n=e.db,r=e.viewName,o=e.map,i=e.reduce,s=e.temporary,a=o.toString()+(i&&i.toString())+"undefined";if(!s&&(t=n._cachedViews=n._cachedViews||{},t[a]))return t[a];var u=n.info().then(function(e){function u(e){e.views=e.views||{};var t=r;t.indexOf("/")===-1&&(t=r+"/"+r);var n=e.views[t]=e.views[t]||{};if(!n[c])return n[c]=!0,e}var c=e.db_name+"-mrview-"+(s?"temp":Ge(a));return U(n,"_local/mrviews",u).then(function(){return n.registerDependentDatabase(c).then(function(e){var r=e.db;r.auto_compaction=!0;var s={name:c,db:r,sourceDB:n,adapter:n.adapter,mapFun:o,reduceFun:i};return s.db.get("_local/lastSeq").catch(function(e){if(404!==e.status)throw e}).then(function(e){return s.seq=e?e.seq:0,t&&s.db.once("destroyed",function(){delete t[a]}),s})})})});return t&&(t[a]=u),u}function Rn(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Rn)}catch(e){}}function Dn(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Dn)}catch(e){}}function Nn(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Nn)}catch(e){}}function Bn(e){var t="builtin "+e+" function requires map values to be numbers or number arrays";return new Nn(t)}function Fn(e){for(var t=0,n=0,r=e.length;n0?e.slice(n):e}function zn(e){var t=e.value,n=t&&"object"==typeof t&&t._id||e.id;return n}function Xn(e){e.rows.forEach(function(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];t[e].data=Be(n.data,n.content_type)})})}function Gn(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&Xn(t),t}}function Vn(e,t,n,r){var o=t[e];"undefined"!=typeof o&&(r&&(o=encodeURIComponent(JSON.stringify(o))),n.push(e+"="+o))}function Qn(e){if("undefined"!=typeof e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function $n(e){return e.group_level=Qn(e.group_level),e.limit=Qn(e.limit),e.skip=Qn(e.skip),e}function Yn(e){if(e){if("number"!=typeof e)return new Rn('Invalid value for integer: "'+e+'"');if(e<0)return new Rn('Invalid value for positive integer: "'+e+'"')}}function Zn(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if("undefined"!=typeof e[n]&&"undefined"!=typeof e[r]&&bn(e[n],e[r])>0)throw new Rn("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&e.reduce!==!1){if(e.include_docs)throw new Rn("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Rn("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(t){var n=Yn(e[t]);if(n)throw n})}function er(e,t,n){var r,o=[],i="GET";if(Vn("reduce",n,o),Vn("include_docs",n,o),Vn("attachments",n,o),Vn("limit",n,o),Vn("descending",n,o),Vn("group",n,o),Vn("group_level",n,o),Vn("skip",n,o),Vn("stale",n,o),Vn("conflicts",n,o),Vn("startkey",n,o,!0),Vn("start_key",n,o,!0),Vn("endkey",n,o,!0),Vn("end_key",n,o,!0),Vn("inclusive_end",n,o),Vn("key",n,o,!0),o=o.join("&"),o=""===o?"":"?"+o,"undefined"!=typeof n.keys){var s=2e3,a="keys="+encodeURIComponent(JSON.stringify(n.keys));a.length+o.length+1<=s?o+=("?"===o[0]?"&":"?")+a:(i="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var u=Un(t);return e.request({method:i,url:"_design/"+u[0]+"/_view/"+u[1]+o,body:r}).then(Gn(n))}return r=r||{},Object.keys(t).forEach(function(e){Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString()}),e.request({method:"POST",url:"_temp_view"+o,body:r}).then(Gn(n))}function tr(e,t,n){return new Xr(function(r,o){e._query(t,n,function(e,t){return e?o(e):void r(t)})})}function nr(e){return new Xr(function(t,n){e._viewCleanup(function(e,r){return e?n(e):void t(r)})})}function rr(e){return function(t){if(404===t.status)return e;throw t}}function or(e,t,n){function r(){return Mn(f)?Xr.resolve(a):t.db.get(s).catch(rr(a))}function o(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Xr.resolve({rows:[]})}function i(e,t){for(var n=[],r={},o=0,i=t.rows.length;on))return e.doc.value}var r=xn(e.doc._id);return{key:r[0],id:r[1],value:"value"in e.doc?e.doc.value:null}})})}function r(n){var r;if(r=i?cr(e,n,t):{total_rows:o,offset:s,rows:n},t.include_docs){var a=Ei(n.map(zn));return e.sourceDB.allDocs({keys:a,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then(function(e){var t={};return e.rows.forEach(function(e){e.doc&&(t["$"+e.id]=e.doc)}),n.forEach(function(e){var n=zn(e),r=t["$"+n];r&&(e.doc=r)}),r})}return r}var o,i=e.reduceFun&&t.reduce!==!1,s=t.skip||0;if("undefined"==typeof t.keys||t.keys.length||(t.limit=0,delete t.keys),"undefined"!=typeof t.keys){var a=t.keys,u=a.map(function(e){var t={startkey:kn([e]),endkey:kn([e,{}])};return n(t)});return Xr.all(u).then(R).then(r)}var c={descending:t.descending};if(t.start_key&&(t.startkey=t.start_key),t.end_key&&(t.endkey=t.end_key),"undefined"!=typeof t.startkey&&(c.startkey=kn(t.descending?[t.startkey,{}]:[t.startkey])),"undefined"!=typeof t.endkey){var f=t.inclusive_end!==!1;t.descending&&(f=!f),c.endkey=kn(f?[t.endkey,{}]:[t.endkey])}if("undefined"!=typeof t.key){var l=kn([t.key]),d=kn([t.key,{}]);c.descending?(c.endkey=l,c.startkey=d):(c.startkey=l,c.endkey=d)}return i||("number"==typeof t.limit&&(c.limit=t.limit),c.skip=s),n(c).then(r)}function dr(e){return e.request({method:"POST",url:"_view_cleanup"})}function hr(e){return e.get("_local/mrviews").then(function(t){var n={};Object.keys(t.views).forEach(function(e){var t=Un(e),r="_design/"+t[0],o=t[1];n[r]=n[r]||{},n[r][o]=!0});var r={keys:Object.keys(n),include_docs:!0};return e.allDocs(r).then(function(r){var o={};r.rows.forEach(function(e){var r=e.key.substring(8);Object.keys(n[e.key]).forEach(function(n){var i=r+"/"+n;t.views[i]||(i=n);var s=Object.keys(t.views[i]),a=e.doc&&e.doc.views&&e.doc.views[n];s.forEach(function(e){o[e]=o[e]||a})})});var i=Object.keys(o).filter(function(e){return!o[e]}),s=i.map(function(t){return wi(sr(t),function(){return new e.constructor(t,e.__opts).destroy()})()});return Xr.all(s).then(function(){return{ok:!0}})})},rr({ok:!0}))}function pr(e,t,r){if("http"===e.type())return er(e,t,r);if("function"==typeof e._query)return tr(e,t,r);if("string"!=typeof t){Zn(r,t);var o={db:e,viewName:"temp_view/temp_view",map:t.map,reduce:t.reduce,temporary:!0};return Si.add(function(){return In(o).then(function(e){function t(){return e.db.destroy()}return bi(ar(e).then(function(){return fr(e,r)}),t)})}),Si.finish()}var i=t,s=Un(i),a=s[0],u=s[1];return e.get("_design/"+a).then(function(t){var o=t.views&&t.views[u];if(!o||"string"!=typeof o.map)throw new Dn("ddoc "+a+" has no view named "+u);Zn(r,o);var s={db:e,viewName:i,map:o.map,reduce:o.reduce};return In(s).then(function(e){return"ok"===r.stale||"update_after"===r.stale?("update_after"===r.stale&&n.nextTick(function(){ar(e)}),fr(e,r)):ar(e).then(function(){return fr(e,r)})})})}function vr(e){return/^1-/.test(e)}function yr(e,t,n){return!e._attachments||!e._attachments[n]||e._attachments[n].digest!==t._attachments[n].digest}function _r(e,t){var n=Object.keys(t._attachments);return Xr.all(n.map(function(n){return e.getAttachment(t._id,n,{rev:t._rev})}))}function mr(e,t,n){var r="http"===t.type()&&"http"!==e.type(),o=Object.keys(n._attachments);return r?e.get(n._id).then(function(r){return Xr.all(o.map(function(o){return yr(r,n,o)?t.getAttachment(n._id,o):e.getAttachment(r._id,o)}))}).catch(function(e){if(404!==e.status)throw e;return _r(t,n)}):_r(t,n)}function gr(e){var t=[];return Object.keys(e).forEach(function(n){var r=e[n].missing;r.forEach(function(e){t.push({id:n,rev:e})})}),{docs:t,revs:!0}}function br(e,t,n,r){function o(){var o=gr(n);if(o.docs.length)return e.bulkGet(o).then(function(n){if(r.cancelled)throw new Error("cancelled");return Xr.all(n.results.map(function(n){return Xr.all(n.docs.map(function(n){var r=n.ok;return n.error&&(f=!1),r&&r._attachments?mr(t,e,r).then(function(e){var t=Object.keys(r._attachments);return e.forEach(function(e,n){var o=r._attachments[t[n]];delete o.stub,delete o.length,o.data=e}),r}):r}))})).then(function(e){c=c.concat(R(e).filter(Boolean))})})}function i(e){return e._attachments&&Object.keys(e._attachments).length>0}function s(t){return e.allDocs({keys:t,include_docs:!0}).then(function(e){if(r.cancelled)throw new Error("cancelled");e.rows.forEach(function(e){!e.deleted&&e.doc&&vr(e.value.rev)&&!i(e.doc)&&(c.push(e.doc),delete n[e.id])})})}function a(){var e=Object.keys(n).filter(function(e){var t=n[e].missing;return 1===t.length&&vr(t[0])});if(e.length>0)return s(e)}function u(){return{ok:f,docs:c}}n=h(n);var c=[],f=!0;return Xr.resolve().then(a).then(o).then(u)}function wr(e,t,n,r,o){return e.get(t).catch(function(n){if(404===n.status)return"http"===e.type()&&T(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:r,_id:t,history:[],replicator:Ci,version:ji};throw n}).then(function(i){if(!o.cancelled&&i.last_seq!==n)return i.history=(i.history||[]).filter(function(e){return e.session_id!==r}),i.history.unshift({last_seq:n,session_id:r}),i.history=i.history.slice(0,Li),i.version=ji,i.replicator=Ci,i.session_id=r,i.last_seq=n,e.put(i).catch(function(i){if(409===i.status)return wr(e,t,n,r,o);throw i})})}function Er(e,t,n,r){this.src=e,this.target=t,this.id=n,this.returnValue=r}function kr(e,t){return e.session_id===t.session_id?{last_seq:e.last_seq,history:e.history}:Sr(e.history,t.history)}function Sr(e,t){var n=e[0],r=e.slice(1),o=t[0],i=t.slice(1);if(!n||0===t.length)return{last_seq:Ii,history:[]};var s=n.session_id;if(qr(s,t))return{last_seq:n.last_seq,history:e};var a=o.session_id;return qr(a,r)?{last_seq:o.last_seq,history:i}:Sr(r,i)}function qr(e,t){var n=t[0],r=t.slice(1);return!(!e||0===t.length)&&(e===n.session_id||qr(e,r))}function xr(e){return"number"==typeof e.status&&4===Math.floor(e.status/100)}function Ar(e,t,n,r){if(e.retry===!1)return t.emit("error",n),void t.removeAllListeners();if("function"!=typeof e.back_off_function&&(e.back_off_function=A),t.emit("requestError",n),"active"===t.state||"pending"===t.state){t.emit("paused",n),t.state="stopped";var o=function(){e.current_back_off=Di},i=function(){t.removeListener("active",o)};t.once("paused",i),t.once("active",o)}e.current_back_off=e.current_back_off||Di,e.current_back_off=e.back_off_function(e.current_back_off),setTimeout(r,e.current_back_off)}function Tr(e){return Object.keys(e).sort(bn).reduce(function(t,n){return t[n]=e[n],t},{})}function Or(e,t,n){var r=n.doc_ids?n.doc_ids.sort(bn):"",o=n.filter?n.filter.toString():"",i="",s="";return n.filter&&n.query_params&&(i=JSON.stringify(Tr(n.query_params))),n.filter&&"_view"===n.filter&&(s=n.view.toString()),Xr.all([e.id(),t.id()]).then(function(e){var t=e[0]+e[1]+o+s+i+r;return new Xr(function(e){Xe(t,e)})}).then(function(e){return e=e.replace(/\//g,".").replace(/\+/g,"_"),"_local/"+e})}function jr(e,t,n,r,o){function i(){return k?Xr.resolve():Or(e,t,n).then(function(n){E=n,k=new Er(e,t,E,r)})}function s(){if(N=[],0!==w.docs.length){var e=w.docs,i={timeout:n.timeout};return t.bulkDocs({docs:e,new_edits:!1},i).then(function(t){if(r.cancelled)throw p(),new Error("cancelled");var n=Object.create(null);t.forEach(function(e){e.error&&(n[e.id]=e)});var i=Object.keys(n).length;o.doc_write_failures+=i,o.docs_written+=e.length-i,e.forEach(function(e){var t=n[e._id];if(t){if(o.errors.push(t),"unauthorized"!==t.name&&"forbidden"!==t.name)throw t;r.emit("denied",h(t))}else N.push(e)})},function(t){throw o.doc_write_failures+=e.length,t})}}function a(){if(w.error)throw new Error("There was a problem getting docs.");o.last_seq=O=w.seq;var e=h(o);return N.length&&(e.docs=N,r.emit("change",e)),x=!0,k.writeCheckpoint(w.seq,B).then(function(){if(x=!1,r.cancelled)throw p(),new Error("cancelled");w=void 0,m()}).catch(function(e){throw b(e),e})}function u(){var e={};return w.changes.forEach(function(t){"_user/"!==t.id&&(e[t.id]=t.changes.map(function(e){return e.rev}))}),t.revsDiff(e).then(function(e){if(r.cancelled)throw p(),new Error("cancelled");w.diffs=e})}function c(){return br(e,t,w.diffs,r).then(function(e){w.error=!e.ok,e.docs.forEach(function(e){delete w.diffs[e._id],o.docs_read++,w.docs.push(e)})})}function f(){if(!r.cancelled&&!w){if(0===S.length)return void l(!0);w=S.shift(),u().then(c).then(s).then(a).then(f).catch(function(e){d("batch processing terminated with error",e)})}}function l(e){return 0===q.changes.length?void(0!==S.length||w||((j&&F.live||A)&&(r.state="pending",r.emit("paused")),A&&p())):void((e||A||q.changes.length>=C)&&(S.push(q),q={seq:0,changes:[],docs:[]},"pending"!==r.state&&"stopped"!==r.state||(r.state="active",r.emit("active")),f()))}function d(e,t){T||(t.message||(t.message=e),o.ok=!1,o.status="aborting",S=[],q={seq:0,changes:[],docs:[]},p(t))}function p(i){T||r.cancelled&&(o.status="cancelled",x)||(o.status=o.status||"complete",o.end_time=new Date,o.last_seq=O,T=!0,i?(i.result=o,"unauthorized"===i.name||"forbidden"===i.name?(r.emit("error",i),r.removeAllListeners()):Ar(n,r,i,function(){jr(e,t,n,r)})):(r.emit("complete",o),r.removeAllListeners()))}function v(e){if(r.cancelled)return p();var t=I(n)(e);t&&(q.seq=e.seq,q.changes.push(e),l(0===S.length&&F.live))}function y(e){if(R=!1,r.cancelled)return p();if(e.results.length>0)F.since=e.last_seq,m(),l(!0);else{var t=function(){j?(F.live=!0,m()):A=!0,l(!0)};w||0!==e.results.length?t():(x=!0,k.writeCheckpoint(e.last_seq,B).then(function(){x=!1,o.last_seq=O=e.last_seq,t()}).catch(b))}}function _(e){return R=!1,r.cancelled?p():void d("changes rejected",e)}function m(){function t(){i.cancel()}function o(){r.removeListener("cancel",t)}if(!R&&!A&&S.lengthr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===s&&setTimeout(function(){o()},0),s=!1}).on("error",e)}}if(!this._listeners[t]){var i=this,s=!1;this._listeners[t]=o,this.on(e,o)}},S.prototype.removeListener=function(e,t){t in this._listeners&&(Mr.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},S.prototype.notifyLocalWindows=function(e){w()?chrome.storage.local.set({dbName:e}):E()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},S.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},Pr(O,Error),O.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var Zr=(new O({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new O({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"})),eo=new O({status:404,error:"not_found",reason:"missing"}),to=new O({status:409,error:"conflict",reason:"Document update conflict"}),no=new O({status:400,error:"bad_request",reason:"_id field must contain a string"}),ro=new O({status:412,error:"missing_id",reason:"_id is required for puts"}),oo=new O({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),io=new O({status:412,error:"precondition_failed",reason:"Database not open"}),so=new O({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),ao=new O({status:500,error:"badarg",reason:"Some query argument is invalid"}),uo=(new O({status:400,error:"invalid_request",reason:"Request was invalid"}),new O({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"})),co=new O({status:500,error:"doc_validation",reason:"Bad special document member"}),fo=new O({status:400,error:"bad_request",reason:"Something wrong with the request"}),lo=new O({status:400,error:"bad_request",reason:"Document must be a JSON object"}),ho=(new O({status:404,error:"not_found",reason:"Database not found"}),new O({status:500,error:"indexed_db_went_bad",reason:"unknown"})),po=new O({status:500,error:"web_sql_went_bad",reason:"unknown"}),vo=(new O({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new O({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new O({status:400,error:"bad_request",reason:"Invalid rev format"})),yo=(new O({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new O({status:412,error:"missing_stub"})),_o=(new O({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]),mo="queryKey",go=/(?:^|&)([^&=]*)=?([^&]*)/g,bo=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");Pr(he,Mr.EventEmitter),he.prototype.cancel=function(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")},he.prototype.doChanges=function(e){var t=this,n=e.complete;if(e=h(e),"live"in e&&!("continuous"in e)&&(e.continuous=e.live),e.processChange=pe,"latest"===e.since&&(e.since="now"),e.since||(e.since=0),"now"===e.since)return void this.db.info().then(function(r){return t.isCancelled?void n(null,{status:"cancelled"}):(e.since=r.update_seq,void t.doChanges(e))},n);if(e.view&&!e.filter&&(e.filter="_view"),e.filter&&"string"==typeof e.filter&&("_view"===e.filter?e.view=F(e.view):e.filter=F(e.filter),"http"!==this.db.type()&&!e.doc_ids))return this.filterChanges(e);"descending"in e||(e.descending=!1),e.limit=0===e.limit?1:e.limit,e.complete=n;var r=this.db._changes(e);if(r&&"function"==typeof r.cancel){var o=t.cancel;t.cancel=Hr(function(e){r.cancel(),o.apply(this,e)})}},he.prototype.filterChanges=function(e){var t=this,n=e.complete;if("_view"===e.filter){if(!e.view||"string"!=typeof e.view){var r=j(fo,"`view` filter parameter not found or invalid.");return n(r)}var o=B(e.view);this.db.get("_design/"+o[0],function(r,i){if(t.isCancelled)return n(null,{status:"cancelled"});if(r)return n(C(r));var s=i&&i.views&&i.views[o[1]]&&i.views[o[1]].map;return s?(e.filter=le(s),void t.doChanges(e)):n(j(eo,i.views?"missing json key: "+o[1]:"missing json key: views"))})}else{var i=B(e.filter);if(!i)return t.doChanges(e);this.db.get("_design/"+i[0],function(r,o){if(t.isCancelled)return n(null,{status:"cancelled"});if(r)return n(C(r));var s=o&&o.filters&&o.filters[i[1]];return s?(e.filter=fe(s),void t.doChanges(e)):n(j(eo,o&&o.filters?"missing json key: "+i[1]:"missing json key: filters"))})}},Pr(Se,Mr.EventEmitter),Se.prototype.post=y("post",function(e,t,n){return"function"==typeof t&&(n=t,t={}),"object"!=typeof e||Array.isArray(e)?n(j(lo)):void this.bulkDocs({docs:[e]},t,_e(n))}),Se.prototype.put=y("put",function(e,t,n){return"function"==typeof t&&(n=t,t={}),"object"!=typeof e||Array.isArray(e)?n(j(lo)):(D(e._id),ce(e._id)&&"function"==typeof this._putLocal?e._deleted?this._removeLocal(e,n):this._putLocal(e,n):void("function"==typeof this._put&&t.new_edits!==!1?this._put(e,t,n):this.bulkDocs({docs:[e]},t,_e(n))))}),Se.prototype.putAttachment=y("putAttachment",function(e,t,n,r,o){function i(e){var n="_rev"in e?parseInt(e._rev,10):0;return e._attachments=e._attachments||{},e._attachments[t]={content_type:o,data:r,revpos:++n},s.put(e)}var s=this;return"function"==typeof o&&(o=r,r=n,n=null),"undefined"==typeof o&&(o=r,r=n,n=null),s.get(e).then(function(e){if(e._rev!==n)throw j(to);return i(e)},function(t){if(t.reason===eo.message)return i({_id:e});throw t})}),Se.prototype.removeAttachment=y("removeAttachment",function(e,t,n,r){var o=this;o.get(e,function(e,i){return e?void r(e):i._rev!==n?void r(j(to)):i._attachments?(delete i._attachments[t], -0===Object.keys(i._attachments).length&&delete i._attachments,void o.put(i,r)):r()})}),Se.prototype.remove=y("remove",function(e,t,n,r){var o;"string"==typeof t?(o={_id:e,_rev:t},"function"==typeof n&&(r=n,n={})):(o=e,"function"==typeof t?(r=t,n={}):(r=n,n=t)),n=n||{},n.was_delete=!0;var i={_id:o._id,_rev:o._rev||n.rev};return i._deleted=!0,ce(i._id)&&"function"==typeof this._removeLocal?this._removeLocal(o,r):void this.bulkDocs({docs:[i]},n,_e(r))}),Se.prototype.revsDiff=y("revsDiff",function(e,t,n){function r(e,t){u.has(e)||u.set(e,{missing:[]}),u.get(e).missing.push(t)}function o(t,n){var o=e[t].slice(0);K(n,function(e,n,i,s,a){var u=n+"-"+i,c=o.indexOf(u);c!==-1&&(o.splice(c,1),"available"!==a.status&&r(t,u))}),o.forEach(function(e){r(t,e)})}"function"==typeof t&&(n=t,t={});var i=Object.keys(e);if(!i.length)return n(null,{});var s=0,u=new a;i.map(function(t){this._getRevisionTree(t,function(r,a){if(r&&404===r.status&&"missing"===r.message)u.set(t,{missing:e[t]});else{if(r)return n(r);o(t,a)}if(++s===i.length){var c={};return u.forEach(function(e,t){c[t]=e}),n(null,c)}})},this)}),Se.prototype.bulkGet=y("bulkGet",function(e,t){b(this,e,t)}),Se.prototype.compactDocument=y("compactDocument",function(e,t,n){var r=this;this._getRevisionTree(e,function(o,i){if(o)return n(o);var s=be(i),a=[],u=[];Object.keys(s).forEach(function(e){s[e]>t&&a.push(e)}),K(i,function(e,t,n,r,o){var i=t+"-"+n;"available"===o.status&&a.indexOf(i)!==-1&&u.push(i)}),r._doCompaction(e,u,n)})}),Se.prototype.compact=y("compact",function(e,t){"function"==typeof e&&(t=e,e={});var n=this;e=e||{},n._compactionQueue=n._compactionQueue||[],n._compactionQueue.push({opts:e,callback:t}),1===n._compactionQueue.length&&Ee(n)}),Se.prototype._compact=function(e,t){function n(e){s.push(o.compactDocument(e.id,0))}function r(e){var n=e.last_seq;Xr.all(s).then(function(){return U(o,"_local/compaction",function(e){return(!e.last_seq||e.last_seq=31}function o(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,i=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r),e}function i(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function a(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(3),n.log=i,n.formatArgs=o,n.save=s,n.load=a,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(a())},{3:3}],3:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function o(e){function t(){}function o(){var e=o,t=+new Date,i=t-(c||t);e.diff=i,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=n.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;a++;var o=n.formatters[r];if("function"==typeof o){var i=s[a];t=o.call(e,i),s.splice(a,1),a--}return t}),"function"==typeof n.formatArgs&&(s=n.formatArgs.apply(e,s));var u=o.log||n.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,o.enabled=!0;var i=n.enabled(e)?o:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;o=0&&this._listeners[e].splice(n,1)}},e.prototype.dispatchEvent=function(e){if(this._listeners[e.type]&&this._listeners[e.type].length)for(var t=this._listeners[e.type].slice(),n=0,r=t.length;n0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,a;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=i;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],6:[function(e,t,n){(function(e){"use strict";function n(){f=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function o(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return s(e,f,"day")||s(e,c,"hour")||s(e,u,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,n){if(!(e1)for(var n=1;n>>32-o,n)}function n(e,n,r,o,i,s,a){return t(n&r|~n&o,e,n,i,s,a)}function r(e,n,r,o,i,s,a){return t(n&o|r&~o,e,n,i,s,a)}function o(e,n,r,o,i,s,a){return t(n^r^o,e,n,i,s,a)}function i(e,n,r,o,i,s,a){return t(r^(n|~o),e,n,i,s,a)}function s(e,t){var s=e[0],a=e[1],u=e[2],c=e[3];s=n(s,a,u,c,t[0],7,-680876936),c=n(c,s,a,u,t[1],12,-389564586),u=n(u,c,s,a,t[2],17,606105819),a=n(a,u,c,s,t[3],22,-1044525330),s=n(s,a,u,c,t[4],7,-176418897),c=n(c,s,a,u,t[5],12,1200080426),u=n(u,c,s,a,t[6],17,-1473231341),a=n(a,u,c,s,t[7],22,-45705983),s=n(s,a,u,c,t[8],7,1770035416),c=n(c,s,a,u,t[9],12,-1958414417),u=n(u,c,s,a,t[10],17,-42063),a=n(a,u,c,s,t[11],22,-1990404162),s=n(s,a,u,c,t[12],7,1804603682),c=n(c,s,a,u,t[13],12,-40341101),u=n(u,c,s,a,t[14],17,-1502002290),a=n(a,u,c,s,t[15],22,1236535329),s=r(s,a,u,c,t[1],5,-165796510),c=r(c,s,a,u,t[6],9,-1069501632),u=r(u,c,s,a,t[11],14,643717713),a=r(a,u,c,s,t[0],20,-373897302),s=r(s,a,u,c,t[5],5,-701558691),c=r(c,s,a,u,t[10],9,38016083),u=r(u,c,s,a,t[15],14,-660478335),a=r(a,u,c,s,t[4],20,-405537848),s=r(s,a,u,c,t[9],5,568446438),c=r(c,s,a,u,t[14],9,-1019803690),u=r(u,c,s,a,t[3],14,-187363961),a=r(a,u,c,s,t[8],20,1163531501),s=r(s,a,u,c,t[13],5,-1444681467),c=r(c,s,a,u,t[2],9,-51403784),u=r(u,c,s,a,t[7],14,1735328473),a=r(a,u,c,s,t[12],20,-1926607734),s=o(s,a,u,c,t[5],4,-378558),c=o(c,s,a,u,t[8],11,-2022574463),u=o(u,c,s,a,t[11],16,1839030562),a=o(a,u,c,s,t[14],23,-35309556),s=o(s,a,u,c,t[1],4,-1530992060),c=o(c,s,a,u,t[4],11,1272893353),u=o(u,c,s,a,t[7],16,-155497632),a=o(a,u,c,s,t[10],23,-1094730640),s=o(s,a,u,c,t[13],4,681279174),c=o(c,s,a,u,t[0],11,-358537222),u=o(u,c,s,a,t[3],16,-722521979),a=o(a,u,c,s,t[6],23,76029189),s=o(s,a,u,c,t[9],4,-640364487),c=o(c,s,a,u,t[12],11,-421815835),u=o(u,c,s,a,t[15],16,530742520),a=o(a,u,c,s,t[2],23,-995338651),s=i(s,a,u,c,t[0],6,-198630844),c=i(c,s,a,u,t[7],10,1126891415),u=i(u,c,s,a,t[14],15,-1416354905),a=i(a,u,c,s,t[5],21,-57434055),s=i(s,a,u,c,t[12],6,1700485571),c=i(c,s,a,u,t[3],10,-1894986606),u=i(u,c,s,a,t[10],15,-1051523),a=i(a,u,c,s,t[1],21,-2054922799),s=i(s,a,u,c,t[8],6,1873313359),c=i(c,s,a,u,t[15],10,-30611744),u=i(u,c,s,a,t[6],15,-1560198380),a=i(a,u,c,s,t[13],21,1309151649),s=i(s,a,u,c,t[4],6,-145523070),c=i(c,s,a,u,t[11],10,-1120210379),u=i(u,c,s,a,t[2],15,718787259),a=i(a,u,c,s,t[9],21,-343485551),e[0]=g(s,e[0]),e[1]=g(a,e[1]),e[2]=g(u,e[2]),e[3]=g(c,e[3])}function a(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function c(e){var t,n,r,o,i,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)s(f,a(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(f,r),t=0;t<16;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),u=parseInt(o[1],16)||0,r[14]=i,r[15]=u,s(f,r),f}function f(e){var t,n,r,o,i,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)s(f,u(e.subarray(t-64,t)));for(e=t-64>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(f,r),t=0;t<16;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),a=parseInt(o[1],16)||0,r[14]=i,r[15]=a,s(f,r),f}function l(e){var t,n="";for(t=0;t<4;t+=1)n+=b[e>>8*t+4&15]+b[e>>8*t&15];return n}function d(e){var t;for(t=0;t>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,e<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var o,i,s,a,u=this.byteLength,c=t(n,u),f=u;return r!==e&&(f=t(r,u)),c>f?new ArrayBuffer(0):(o=f-c,i=new ArrayBuffer(o),s=new Uint8Array(i),a=new Uint8Array(this,c,o),s.set(a),i)}}(),m.prototype.append=function(e){return this.appendBinary(h(e)),this},m.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)s(this._hash,a(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},m.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=d(this._hash),e&&(n=_(n)),this.reset(),n},m.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},m.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},m.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},m.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},m.prototype._finish=function(e,t){var n,r,o,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(s(this._hash,e),i=0;i<16;i+=1)e[i]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]=r,e[15]=o,s(this._hash,e)},m.hash=function(e,t){return m.hashBinary(h(e),t)},m.hashBinary=function(e,t){var n=c(e),r=d(n);return t?_(r):r},m.ArrayBuffer=function(){this.reset()},m.ArrayBuffer.prototype.append=function(e){var t,n=y(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;t<=r;t+=64)s(this._hash,u(n.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=d(this._hash),e&&(n=_(n)),this.reset(),n},m.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},m.ArrayBuffer.prototype.getState=function(){var e=m.prototype.getState.call(this);return e.buff=v(e.buff),e},m.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),m.prototype.setState.call(this,e)},m.ArrayBuffer.prototype.destroy=m.prototype.destroy,m.ArrayBuffer.prototype._finish=m.prototype._finish,m.ArrayBuffer.hash=function(e,t){var n=f(new Uint8Array(e)),r=d(n);return t?_(r):r},m})},{}],13:[function(e,t,n){"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[n.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(e);else if(i===t.length-2){var s=t.pop();o[s]=e}else t.push(e)}n.stringify=function(e){var t=[];t.push({obj:e});for(var n,r,o,i,s,a,u,c,f,l,d,h="";n=t.pop();)if(r=n.obj,o=n.prefix||"",i=n.val||"",h+=o,i)h+=i;else if("object"!=typeof r)h+="undefined"==typeof r?null:JSON.stringify(r);else if(null===r)h+="null";else if(Array.isArray(r)){for(t.push({val:"]"}),s=r.length-1;s>=0;s--)a=0===s?"":",",t.push({obj:r[s],prefix:a});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),s=u.length-1;s>=0;s--)f=u[s],l=r[f],d=s>0?",":"",d+=JSON.stringify(f)+":",t.push({obj:l,prefix:d});t.push({val:"{"})}return h},n.parse=function(e){for(var t,n,o,i,s,a,u,c,f,l=[],d=[],h=0;;)if(t=e[h++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":h+=3,r(null,l,d);break;case"t":h+=3,r(!0,l,d);break;case"f":h+=4,r(!1,l,d);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",h--;;){if(o=e[h++],!/[\d\.\-e\+]/.test(o)){h--;break}n+=o}r(parseFloat(n),l,d);break;case'"':for(i="",s=void 0,a=0;;){if(u=e[h++],'"'===u&&("\\"!==s||a%2!==1))break;i+=u,s=u,"\\"===s?a++:a=0}r(JSON.parse('"'+i+'"'),l,d);break;case"[":c={element:[],index:l.length},l.push(c.element),d.push(c);break;case"{":f={element:{},index:l.length},l.push(f.element),d.push(f);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,d)}}},{}],14:[function(e,t,n){(function(n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function i(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}function s(e){if("function"==typeof e.slice)return e.slice(0);var t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t),r=new Uint8Array(e);return n.set(r),t}function a(e){if(e instanceof ArrayBuffer)return s(e);var t=e.size,n=e.type;return"function"==typeof e.slice?e.slice(0,t,n):e.webkitSlice(0,t,n)}function u(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&Vr.call(n)==Qr}function c(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n=y.length)){var e=Math.min(_+Yr,y.length),t=y.slice(_,e);a(t,_),_+=t.length}}function a(n,r){n.forEach(function(n,o){var a=r+o,u=c[n],f=h(u[0],["atts_since","attachments"]);f.open_revs=u.map(function(e){return e.rev}),f.open_revs=f.open_revs.filter(p);var l=p;0===f.open_revs.length&&(delete f.open_revs,l=v),["revs","attachments","binary","ajax"].forEach(function(e){e in t&&(f[e]=t[e])}),e.get(n,f,function(e,t){var r;r=e?[{error:e}]:l(t),i(a,n,r),s()})})}var u=t.docs,c={};u.forEach(function(e){e.id in c?c[e.id].push(e):c[e.id]=[e]});var f=Object.keys(c).length,l=0,d=new Array(f),y=Object.keys(c),_=0;s()}function _(){return"undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage&&"undefined"!=typeof chrome.storage.local}function m(){return Fr}function g(e){_()?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):m()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(t){e.emit(t.key)}):window.attachEvent("storage",function(t){e.emit(t.key)}))}function b(){Hr.EventEmitter.call(this),this._listeners={},g(this)}function w(e){if("undefined"!==console&&e in console){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}function E(e,t){var n=6e5;e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||t<=e?t=(e||1)<<1:t+=1,t>n&&(e=n>>1,t=n);var r=Math.random(),o=t-e;return~~(o*r+e)}function k(e){var t=0;return e||(t=2e3),E(e,t)}function S(e,t){w("info","The above "+e+" is totally normal. "+t)}function q(e){if("object"!=typeof e)throw e+" is not an object";var t=Zr.call(arguments,1);return eo.call(t,function(t){if(t)for(var n in t)"object"==typeof t[n]&&e[n]?q.call(e,e[n],t[n]):e[n]=t[n]}),e}function x(e){Error.call(this,e.reason),this.status=e.status,this.name=e.error,this.message=e.reason,this.error=!0}function A(e,t){function n(t){for(var n in e)"function"!=typeof e[n]&&(this[n]=e[n]);void 0!==t&&(this.reason=t)}return n.prototype=x.prototype,new n(t)}function T(e){if("object"!=typeof e){var t=e;e=uo,e.data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),e}function O(e,t,n){try{return!e(t,n)}catch(e){var r="Filter function threw: "+e.toString();return A(ho,r)}}function j(e){var t={},n=e.filter&&"function"==typeof e.filter;return t.query=e.query_params,function(r){r.doc||(r.doc={});var o=n&&O(e.filter,r.doc,t);if("object"==typeof o)return o;if(o)return!1;if(e.include_docs){if(!e.attachments)for(var i in r.doc._attachments)r.doc._attachments.hasOwnProperty(i)&&(r.doc._attachments[i].stub=!0)}else delete r.doc;return!0}}function C(e){for(var t=[],n=0,r=e.length;n>>1,n(e[r],t)<0?o=r+1:i=r;return o}function ee(e,t,n){var r=Z(e,t,n);e.splice(r,0,t)}function te(e,t){for(var n,r,o=t,i=e.length;o0;){var o=n.pop(),i=o.tree1,s=o.tree2;(i[1].status||s[1].status)&&(i[1].status="available"===i[1].status||"available"===s[1].status?"available":"missing");for(var a=0;a0;){var v=p.pop();if(0!==v.diff)for(var y=v.ids[2],_=0,m=y.length;_0&&o.emit("error",t):o.emit("complete",n),o.removeAllListeners(),e.removeListener("destroyed",r)});n&&(o.on("complete",function(e){n(null,e)}),o.on("error",n)),e.once("destroyed",r),t.onChange=function(e){t.isCancelled||he(o,e)};var s=new Gr(function(e,n){t.complete=function(t,r){t?n(t):e(r)}});o.once("cancel",function(){e.removeListener("destroyed",r),t.complete(null,{status:"cancelled"})}),this.then=s.then.bind(s),this.catch=s.catch.bind(s),this.then(function(e){i(null,e)},i),e.taskqueue.isReady?o.doChanges(t):e.taskqueue.addTask(function(e){e?t.complete(e):o.isCancelled?o.emit("cancel"):o.doChanges(t)})}function ve(e,t,n){var r=[{rev:e._rev}];"all_docs"===n.style&&(r=G(t.rev_tree).map(function(e){return{rev:e.rev}}));var o={id:t.id,changes:r,doc:e};return ce(t,e._rev)&&(o.deleted=!0),n.conflicts&&(o.doc._conflicts=V(t),o.doc._conflicts.length||delete o.doc._conflicts),o}function ye(e,t){return et?1:0}function _e(e,t){for(var n=0;n0?t.keys.slice(t.skip):t.keys;if(t.descending&&r.reverse(),!r.length)return e._allDocs({limit:0},n);var o={offset:t.skip};return Gr.all(r.map(function(n){var r=q({key:n,deleted:"ok"},t);return["limit","skip","keys"].forEach(function(e){delete r[e]}),new Gr(function(t,i){e._allDocs(r,function(e,r){return e?i(e):(o.total_rows=r.total_rows,void t(r.rows[0]||{key:n,error:"not_found"}))})})})).then(function(e){return o.rows=e,o})}function ke(e){var t=e._compactionQueue[0],r=t.opts,o=t.callback;e.get("_local/compaction").catch(function(){return!1}).then(function(t){t&&t.last_seq&&(r.last_seq=t.last_seq),e._compact(r,function(t,r){t?o(t):o(null,r),n.nextTick(function(){e._compactionQueue.shift(),e._compactionQueue.length&&ke(e)})})})}function Se(e){return"_"===e.charAt(0)&&e+"is not a valid attachment name, attachment names cannot start with '_'"}function qe(){Hr.EventEmitter.call(this)}function xe(){this.isReady=!1,this.failed=!1,this.queue=[]}function Ae(e,t){var n=e.match(/([a-z\-]*):\/\/(.*)/);if(n)return e=/http(s?)/.test(n[1])?n[1]+"://"+n[2]:n[2],{name:e,adapter:n[1]};var r,o="idb"in Oe.adapters&&"websql"in Oe.adapters&&m()&&localStorage["_pouch__websqldb_"+Oe.prefix+e];if(t.adapter)r=t.adapter;else if("undefined"!=typeof t&&t.db)r="leveldb";else for(var i=0;i0||r0||r=43)}}).catch(function(){return!1})}function kt(e,t){var n=this;Mo.queue.push({action:function(t){St(n,e,t)},callback:t}),ut(n.constructor)}function St(e,t,r){function o(e){var t=e.createObjectStore(Ro,{keyPath:"id"});e.createObjectStore(Do,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore(No,{keyPath:"digest"}),e.createObjectStore(Fo,{keyPath:"id",autoIncrement:!1}),e.createObjectStore(Uo),t.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.createObjectStore(Po,{keyPath:"_id"});var n=e.createObjectStore(Bo,{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}function i(e,t){var n=e.objectStore(Ro);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var o=r.value,i=ce(o);o.deletedOrLocal=i?"1":"0",n.put(o),r.continue()}else t()}}function s(e){e.createObjectStore(Po,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function a(e,t){var n=e.objectStore(Po),r=e.objectStore(Ro),o=e.objectStore(Do),i=r.openCursor();i.onsuccess=function(e){var i=e.target.result;if(i){var s=i.value,a=s.id,u=fe(a),c=K(s);if(u){var f=a+"::"+c,l=a+"::",d=a+"::~",h=o.index("_doc_id_rev"),p=IDBKeyRange.bound(l,d,!1,!1),v=h.openCursor(p);v.onsuccess=function(e){if(v=e.target.result){var t=v.value;t._doc_id_rev===f&&n.put(t),o.delete(v.primaryKey),v.continue()}else r.delete(i.primaryKey),i.continue()}}else i.continue()}else t&&t()}}function u(e){var t=e.createObjectStore(Bo,{autoIncrement:!0});t.createIndex("seq","seq"),t.createIndex("digestSeq","digestSeq",{unique:!0})}function f(e,t){var n=e.objectStore(Do),r=e.objectStore(No),o=e.objectStore(Bo),i=r.count();i.onsuccess=function(e){var r=e.target.result;return r?void(n.openCursor().onsuccess=function(e){var n=e.target.result;if(!n)return t();for(var r=n.value,i=n.primaryKey,s=Object.keys(r._attachments||{}),a={},u=0;uo&&(o=n),t.continue()}}function i(){var e=ft(a,a.winningRev,a.deleted),t=r.put(e);t.onsuccess=function(){s.continue()}}var s=e.target.result;if(s){var a=t(s.value);return a.winningRev=a.winningRev||K(a),a.seq?i():void o()}}}var h=t.name,p=null;e._meta=null,e.type=function(){return"idb"},e._id=l(function(t){t(null,e._meta.instanceId)}),e._bulkDocs=function(n,r,o){mt(t,n,r,e,p,Wo,o)},e._get=function(e,t,n){function r(){n(s,{doc:o,metadata:i,ctx:a})}var o,i,s,a=t.ctx;if(!a){var u=_t(p,[Ro,Do,No],"readonly");if(u.error)return n(u.error);a=u.txn}a.objectStore(Ro).get(e).onsuccess=function(e){if(i=lt(e.target.result),!i)return s=A(no,"missing"),r();if(ce(i)&&!t.rev)return s=A(no,"deleted"),r();var n=a.objectStore(Do),u=t.rev||i.winningRev,c=i.id+"::"+u;n.index("_doc_id_rev").get(c).onsuccess=function(e){return o=e.target.result,o&&(o=dt(o)),o?void r():(s=A(no,"missing"),r())}}},e._getAttachment=function(e,t,n,r,o){var i;if(r.ctx)i=r.ctx;else{var s=_t(p,[Ro,Do,No],"readonly");if(s.error)return o(s.error);i=s.txn}var a=n.digest,u=n.content_type;i.objectStore(No).get(a).onsuccess=function(e){var t=e.target.result.body;ht(t,u,r.binary,function(e){o(null,e)})}},e._info=function(t){if(null===p||!Ho.has(h)){var n=new Error("db isn't open");return n.id="idbNull",t(n)}var r,o,i=_t(p,[Do],"readonly");if(i.error)return t(i.error);var s=i.txn,a=s.objectStore(Do).openCursor(null,"prev");a.onsuccess=function(t){var n=t.target.result;r=n?n.key:0,o=e._meta.docCount},s.oncomplete=function(){t(null,{doc_count:o,update_seq:r,idb_attachment_format:e._meta.blobSupport?"binary":"base64"})}},e._allDocs=function(t,n){wt(t,e,p,n)},e._changes=function(t){function n(e){function n(){return c.seq!==s?e.continue():(u=s,c.winningRev===i._rev?o(i):void r())}function r(){var e=i._id+"::"+c.winningRev,t=_.get(e);t.onsuccess=function(e){o(dt(e.target.result))}}function o(n){var r=t.processChange(n,c,t);r.seq=c.seq;var o=b(r);return"object"==typeof o?t.complete(o):(o&&(g++,l&&m.push(r),t.attachments&&t.include_docs?pt(n,t,d,function(){vt([r],t.binary).then(function(){t.onChange(r)})}):t.onChange(r)),void(g!==f&&e.continue()))}var i=dt(e.value),s=e.key;if(a&&!a.has(i._id))return e.continue();var c;return(c=w.get(i._id))?n():void(y.get(i._id).onsuccess=function(e){c=lt(e.target.result),w.set(i._id,c),n()})}function r(e){var t=e.target.result;t&&n(t)}function o(){var e=[Ro,Do];t.attachments&&e.push(No);var n=_t(p,e,"readonly");if(n.error)return t.complete(n.error);d=n.txn,d.onabort=ct(t.complete),d.oncomplete=i,v=d.objectStore(Do),y=d.objectStore(Ro),_=v.index("_doc_id_rev");var o;o=t.descending?v.openCursor(null,"prev"):v.openCursor(IDBKeyRange.lowerBound(t.since,!0)),o.onsuccess=r}function i(){function e(){t.complete(null,{results:m,last_seq:u})}!t.continuous&&t.attachments?vt(m).then(e):e()}if(t=c(t),t.continuous){var s=h+":"+U();return Wo.addListener(h,s,e,t),Wo.notify(h),{cancel:function(){Wo.removeListener(h,s)}}}var a=t.doc_ids&&new J(t.doc_ids);t.since=t.since||0;var u=t.since,f="limit"in t?t.limit:-1;0===f&&(f=1);var l;l="return_docs"in t?t.return_docs:!("returnDocs"in t)||t.returnDocs;var d,v,y,_,m=[],g=0,b=j(t),w=new W;o()},e._close=function(e){return null===p?e(A(ao)):(p.close(),Ho.delete(h),p=null,void e())},e._getRevisionTree=function(e,t){var n=_t(p,[Ro],"readonly");if(n.error)return t(n.error);var r=n.txn,o=r.objectStore(Ro).get(e);o.onsuccess=function(e){var n=lt(e.target.result);n?t(null,n.rev_tree):t(A(no))}},e._doCompaction=function(e,t,n){var r=[Ro,Do,No,Bo],o=_t(p,r,"readwrite");if(o.error)return n(o.error);var i=o.txn,s=i.objectStore(Ro);s.get(e).onsuccess=function(n){var r=lt(n.target.result);z(r.rev_tree,function(e,n,r,o,i){var s=n+"-"+r;t.indexOf(s)!==-1&&(i.status="missing")}),yt(t,e,i);var o=r.winningRev,s=r.deleted;i.objectStore(Ro).put(ft(r,o,s))},i.onabort=ct(n),i.oncomplete=function(){n()}},e._getLocal=function(e,t){var n=_t(p,[Po],"readonly");if(n.error)return t(n.error);var r=n.txn,o=r.objectStore(Po).get(e);o.onerror=ct(t),o.onsuccess=function(e){var n=e.target.result;n?(delete n._doc_id_rev,t(null,n)):t(A(no))}},e._putLocal=function(e,t,n){"function"==typeof t&&(n=t,t={}),delete e._revisions;var r=e._rev,o=e._id;r?e._rev="0-"+(parseInt(r.split("-")[1],10)+1):e._rev="0-1";var i,s=t.ctx;if(!s){var a=_t(p,[Po],"readwrite");if(a.error)return n(a.error);s=a.txn,s.onerror=ct(n),s.oncomplete=function(){i&&n(null,i)}}var u,c=s.objectStore(Po);r?(u=c.get(o),u.onsuccess=function(o){var s=o.target.result;if(s&&s._rev===r){var a=c.put(e);a.onsuccess=function(){i={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,i)}}else n(A(ro))}):(u=c.add(e),u.onerror=function(e){n(A(ro)),e.preventDefault(),e.stopPropagation()},u.onsuccess=function(){i={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,i)})},e._removeLocal=function(e,t,n){"function"==typeof t&&(n=t,t={});var r=t.ctx;if(!r){var o=_t(p,[Po],"readwrite");if(o.error)return n(o.error);r=o.txn,r.oncomplete=function(){i&&n(null,i)}}var i,s=e._id,a=r.objectStore(Po),u=a.get(s);u.onerror=ct(n),u.onsuccess=function(r){var o=r.target.result;o&&o._rev===e._rev?(a.delete(s),i={ok:!0,id:s,rev:"0-0"},t.ctx&&n(null,i)):n(A(no))}},e._destroy=function(e,t){Wo.removeAllListeners(h);var n=Jo.get(h);n&&n.result&&(n.result.close(),Ho.delete(h));var r=indexedDB.deleteDatabase(h);r.onsuccess=function(){Jo.delete(h),m()&&h in localStorage&&delete localStorage[h],t(null,{ok:!0})},r.onerror=ct(t)};var v=Ho.get(h);if(v)return p=v.idb,e._meta=v.global,void n.nextTick(function(){r(null,e)});var y;y=t.storage?qt(h,t.storage):indexedDB.open(h,Io),Jo.set(h,y),y.onupgradeneeded=function(e){function t(){var e=c[l-1];l++,e&&e(r,t)}var n=e.target.result;if(e.oldVersion<1)return o(n);var r=e.currentTarget.transaction;e.oldVersion<3&&s(n),e.oldVersion<4&&u(n);var c=[i,a,f,d],l=e.oldVersion;t()},y.onsuccess=function(t){p=t.target.result,p.onversionchange=function(){p.close(),Ho.delete(h)},p.onabort=function(e){w("error","Database has a global failure",e.target.error),p.close(),Ho.delete(h)};var n=p.transaction([Fo,Uo,Ro],"readwrite"),o=n.objectStore(Fo).get(Fo),i=null,s=null,a=null;o.onsuccess=function(t){var o=function(){null!==i&&null!==s&&null!==a&&(e._meta={name:h,instanceId:a,blobSupport:i,docCount:s},Ho.set(h,{idb:p,global:e._meta}),r(null,e))},u=t.target.result||{id:Fo};h+"_id"in u?(a=u[h+"_id"],o()):(a=U(),u[h+"_id"]=a,n.objectStore(Fo).put(u).onsuccess=function(){o()}),xo||(xo=Et(n)),xo.then(function(e){i=e,o()});var c=n.objectStore(Ro).index("deletedOrLocal");c.count(IDBKeyRange.only("0")).onsuccess=function(e){s=e.target.result,o()}}},y.onerror=function(){var e="Failed to open indexedDB, are you in private browsing mode?";w("error",e),r(A(vo,e))}}function qt(e,t){try{return indexedDB.open(e,{version:Io,storage:t})}catch(t){ +return indexedDB.open(e,Io)}}function xt(e){e.adapter("idb",kt,!0)}function At(e){return decodeURIComponent(escape(e))}function Tt(e){return e<65?e-48:e-55}function Ot(e,t,n){for(var r="";t0;){var e=E.pop();e(null,b)}}function h(e,t){if(0===t){var n="CREATE TABLE IF NOT EXISTS "+Qo+" (dbid, db_version INTEGER)",c="CREATE TABLE IF NOT EXISTS "+Go+" (digest UNIQUE, escaped TINYINT(1), body BLOB)",f="CREATE TABLE IF NOT EXISTS "+$o+" (digest, seq INTEGER)",l="CREATE TABLE IF NOT EXISTS "+zo+" (id unique, json, winningseq, max_seq INTEGER UNIQUE)",h="CREATE TABLE IF NOT EXISTS "+Xo+" (seq INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, json, deleted TINYINT(1), doc_id, rev)",p="CREATE TABLE IF NOT EXISTS "+Vo+" (id UNIQUE, rev, json)";e.executeSql(c),e.executeSql(p),e.executeSql(f,[],function(){e.executeSql(oi),e.executeSql(ii)}),e.executeSql(l,[],function(){e.executeSql(ri),e.executeSql(h,[],function(){e.executeSql(ti),e.executeSql(ni),e.executeSql(n,[],function(){var t="INSERT INTO "+Qo+" (db_version, dbid) VALUES (?,?)";b=U();var n=[Ko,b];e.executeSql(t,n,function(){d()})})})})}else{var v=function(){var n=t=")+" ?"),l.push(o)),i!==!1){var h=a?">":"<";f&&(h+="="),d.push(zo+".id "+h+" ?"),l.push(i)}s!==!1&&(d.push(zo+".id = ?"),l.push(s))}"ok"!==e.deleted&&d.push(Xo+".deleted = 0"),x.readTransaction(function(t){y(t,function(o){if(n=o,0!==u){var i=Ft(ai,[zo,Xo],si,d,zo+".id "+(a?"DESC":"ASC"));i+=" LIMIT "+u+" OFFSET "+c,t.executeSql(i,l,function(t,n){for(var o=0,i=n.rows.length;o ?"],f=[e.since];e.doc_ids&&(c.push(zo+".id IN "+Bt(e.doc_ids.length)),f=f.concat(e.doc_ids));var l="maxSeq "+(r?"DESC":"ASC"),d=Ft(t,n,u,c,l),h=j(e);e.view||e.filter||(d+=" LIMIT "+o);var p=e.since||0;x.readTransaction(function(t){t.executeSql(d,f,function(t,n){function r(t){return function(){e.onChange(t)}}for(var u=0,c=n.rows.length;u0&&(r=setTimeout(function(){n.reject(new Error("Load timeout for resource: "+e.url))},e.timeout)),n.promise.then(function(t){return o={statusCode:t.status},e.timeout>0&&clearTimeout(r),o.statusCode>=200&&o.statusCode<300?e.binary?t.blob():t.text():t.json()}).then(function(e){o.statusCode>=200&&o.statusCode<300?t(null,o,e):t(e,o)}).catch(function(e){t(e,o)}),{abort:n.reject}}function nn(e,t){var n,r,o=!1,i=function(){n.abort(),u()},s=function(){o=!0,n.abort(),u()},a={abort:i},u=function(){clearTimeout(r),a.abort=function(){},n&&(n.onprogress=void 0,n.upload&&(n.upload.onprogress=void 0),n.onreadystatechange=void 0,n=void 0)};n=e.xhr?new e.xhr:new XMLHttpRequest;try{n.open(e.method,e.url)}catch(e){return t(new Error(e.name||"Url is invalid"))}n.withCredentials=!("withCredentials"in e)||e.withCredentials,"GET"===e.method?delete e.headers["Content-Type"]:e.json&&(e.headers.Accept="application/json",e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.body&&e.processData&&"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.binary&&(n.responseType="arraybuffer"),"body"in e||(e.body=null);for(var c in e.headers)e.headers.hasOwnProperty(c)&&n.setRequestHeader(c,e.headers[c]);return e.timeout>0&&(r=setTimeout(s,e.timeout),n.onprogress=function(){clearTimeout(r),4!==n.readyState&&(r=setTimeout(s,e.timeout))},"undefined"!=typeof n.upload&&(n.upload.onprogress=n.onprogress)),n.onreadystatechange=function(){if(4===n.readyState){var r={statusCode:n.status};if(n.status>=200&&n.status<300){var i;i=e.binary?De([n.response||""],{type:n.getResponseHeader("Content-Type")}):n.responseText,t(null,r,i)}else{var s={};if(o)s=new Error("ETIMEDOUT"),s.code="ETIMEDOUT";else if("string"==typeof n.response)try{s=JSON.parse(n.response)}catch(e){}s.status=n.status,t(s)}u()}},e.body&&e.body instanceof Blob?We(e.body,function(e){n.send(e)}):n.send(e.body),a}function rn(){try{return new XMLHttpRequest,!0}catch(e){return!1}}function on(e,t){return ui||e.xhr?nn(e,t):tn(e,t)}function sn(){return""}function an(e,t){function n(t,n,r){if(!e.binary&&e.json&&"string"==typeof t)try{t=JSON.parse(t)}catch(e){return r(e)}Array.isArray(t)&&(t=t.map(function(e){return e.error||e.missing?T(e):e})),e.binary&&ci(t,n),r(null,t,n)}e=c(e);var r={method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1};return e=q(r,e),e.json&&(e.binary||(e.headers.Accept="application/json"),e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json"),e.binary&&(e.encoding=null,e.json=!1),e.processData||(e.json=!1),on(e,function(r,o,i){if(r)return t(T(r));var s,a=o.headers&&o.headers["content-type"],u=i||sn();if(!e.binary&&(e.json||!e.processData)&&"object"!=typeof u&&(/json/.test(a)||/^[\s]*\{/.test(u)&&/\}[\s]*$/.test(u)))try{u=JSON.parse(u.toString())}catch(e){}o.statusCode>=200&&o.statusCode<300?n(u,o,t):(s=T(u),s.status=o.statusCode,t(s))})}function un(e,t){var n=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=n.indexOf("safari")!==-1&&n.indexOf("chrome")===-1,o=n.indexOf("msie")!==-1,i=n.indexOf("edge")!==-1,s=r||(o||i)&&"GET"===e.method,a=!("cache"in e)||e.cache,u=/^blob:/.test(e.url);if(!u&&(s||!a)){var c=e.url.indexOf("?")!==-1;e.url+=(c?"&":"?")+"_nonce="+Date.now()}return an(e,t)}function cn(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];n.data=Fe(n.data,n.content_type)})}function fn(e){return/^_design/.test(e)?"_design/"+encodeURIComponent(e.slice(8)):/^_local/.test(e)?"_local/"+encodeURIComponent(e.slice(7)):encodeURIComponent(e)}function ln(e){return e._attachments&&Object.keys(e._attachments)?Gr.all(Object.keys(e._attachments).map(function(t){var n=e._attachments[t];if(n.data&&"string"!=typeof n.data)return new Gr(function(e){He(n.data,e)}).then(function(e){n.data=e})})):Gr.resolve()}function dn(e){if(!e.prefix)return!1;var t=N(e.prefix).protocol;return"http"===t||"https"===t}function hn(e,t){if(dn(t)){var n=t.name.substr(t.prefix.length);e=t.prefix+encodeURIComponent(n)}var r=N(e);(r.user||r.password)&&(r.auth={username:r.user,password:r.password});var o=r.path.replace(/(^\/|\/$)/g,"").split("/");return r.db=o.pop(),r.db.indexOf("%")===-1&&(r.db=encodeURIComponent(r.db)),r.path=o.join("/"),r}function pn(e,t){return vn(e,e.db+"/"+t)}function vn(e,t){var n=e.path?"/":"";return e.protocol+"://"+e.host+(e.port?":"+e.port:"")+"/"+e.path+n+t}function yn(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function _n(e,t){function n(e,t,n){var r=e.ajax||{},o=q(c(l),r,t);return hi(o.method+" "+o.url),a._ajax(o,n)}function r(e,t){return new Gr(function(r,o){n(e,t,function(e,t){return e?o(e):void r(t)})})}function o(e,t){return d(e,Ur(function(e){i().then(function(){return t.apply(this,e)}).catch(function(t){var n=e.pop();n(t)})}))}function i(){if(e.skipSetup||e.skip_setup)return Gr.resolve();if(m)return m;var t={method:"GET",url:f};return m=r({},t).catch(function(e){return e&&e.status&&404===e.status?(S(404,"PouchDB is just detecting if the remote exists."),r({},{method:"PUT",url:f})):Gr.reject(e)}).catch(function(e){return!(!e||!e.status||412!==e.status)||Gr.reject(e)}),m.catch(function(){m=null}),m}function s(e){return e.split("/").map(encodeURIComponent).join("/")}var a=this,u=hn(e.name,e),f=pn(u,"");e=c(e);var l=e.ajax||{};if(e.auth||u.auth){var p=e.auth||u.auth,v=p.username+":"+p.password,_=jo(unescape(encodeURIComponent(v)));l.headers=l.headers||{},l.headers.Authorization="Basic "+_}a._ajax=un;var m;setTimeout(function(){t(null,a)}),a.type=function(){return"http"},a.id=o("id",function(e){n({},{method:"GET",url:vn(u,"")},function(t,n){var r=n&&n.uuid?n.uuid+u.db:pn(u,"");e(null,r)})}),a.request=o("request",function(e,t){e.url=pn(u,e.url),n({},e,t)}),a.compact=o("compact",function(e,t){"function"==typeof e&&(t=e,e={}),e=c(e),n(e,{url:pn(u,"_compact"),method:"POST"},function(){function n(){a.info(function(r,o){o&&!o.compact_running?t(null,{ok:!0}):setTimeout(n,e.interval||200)})}n()})}),a.bulkGet=d("bulkGet",function(e,t){function r(t){var r={};e.revs&&(r.revs=!0),e.attachments&&(r.attachments=!0),n({},{url:pn(u,"_bulk_get"+yn(r)),method:"POST",body:{docs:e.docs}},t)}function o(){function n(e){return function(n,r){a[e]=r.results,++s===o&&t(null,{results:C(a)})}}for(var r=li,o=Math.ceil(e.docs.length/r),s=0,a=new Array(o),u=0;ut?t:a;var f={method:h,url:pn(u,"_changes"+yn(o)),timeout:e.timeout,body:d};v=r,e.aborted||i().then(function(){p=n(e,f,c)}).catch(c)}},_={results:[]},m=function(n,o){if(!e.aborted){var i=0;if(o&&o.results){i=o.results.length,_.last_seq=o.last_seq;var u={};u.query=e.query_params,o.results=o.results.filter(function(t){a--;var n=j(e)(t);return n&&(e.include_docs&&e.attachments&&e.binary&&cn(t),r&&_.results.push(t),e.onChange(t)),n})}else if(n)return e.aborted=!0,void e.complete(n);o&&o.last_seq&&(v=o.last_seq);var c=s&&a<=0||o&&it.length?1:-1}function On(e,t){return e===t?0:e>t?1:-1}function jn(e,t){for(var n=Object.keys(e),r=Object.keys(t),o=Math.min(n.length,r.length),i=0;ir.length?1:-1}function Cn(e){var t=["boolean","number","string","object"],n=t.indexOf(typeof e);return~n?null===e?1:Array.isArray(e)?5:n<3?n+2:n+3:Array.isArray(e)?5:void 0}function Ln(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,o=r?"0":"2",i=(r?-n:n)-pi,s=bn(i.toString(),"0",vi);o+=yi+s;var a=Math.abs(parseFloat(t[0]));r&&(a=10-a);var u=a.toFixed(20);return u=u.replace(/\.?0+$/,""),o+=yi+u}function In(){this.promise=new Gr(function(e){e()})}function Rn(e){var t,n=e.db,r=e.viewName,o=e.map,i=e.reduce,s=e.temporary,a=o.toString()+(i&&i.toString())+"undefined";if(!s&&(t=n._cachedViews=n._cachedViews||{},t[a]))return t[a];var u=n.info().then(function(e){function u(e){e.views=e.views||{};var t=r;t.indexOf("/")===-1&&(t=r+"/"+r);var n=e.views[t]=e.views[t]||{};if(!n[c])return n[c]=!0,e}var c=e.db_name+"-mrview-"+(s?"temp":Ve(a));return B(n,"_local/mrviews",u).then(function(){return n.registerDependentDatabase(c).then(function(e){var r=e.db;r.auto_compaction=!0;var s={name:c,db:r,sourceDB:n,adapter:n.adapter,mapFun:o,reduceFun:i};return s.db.get("_local/lastSeq").catch(function(e){if(404!==e.status)throw e}).then(function(e){return s.seq=e?e.seq:0,t&&s.db.once("destroyed",function(){delete t[a]}),s})})})});return t&&(t[a]=u),u}function Dn(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Dn)}catch(e){}}function Nn(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Nn)}catch(e){}}function Bn(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Bn)}catch(e){}}function Fn(e){var t="builtin "+e+" function requires map values to be numbers or number arrays";return new Bn(t)}function Pn(e){for(var t=0,n=0,r=e.length;n0?e.slice(n):e}function Xn(e){var t=e.value,n=t&&"object"==typeof t&&t._id||e.id;return n}function Gn(e){e.rows.forEach(function(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];t[e].data=Fe(n.data,n.content_type)})})}function Vn(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&Gn(t),t}}function Qn(e,t,n,r){var o=t[e];"undefined"!=typeof o&&(r&&(o=encodeURIComponent(JSON.stringify(o))),n.push(e+"="+o))}function $n(e){if("undefined"!=typeof e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function Yn(e){return e.group_level=$n(e.group_level),e.limit=$n(e.limit),e.skip=$n(e.skip),e}function Zn(e){if(e){if("number"!=typeof e)return new Dn('Invalid value for integer: "'+e+'"');if(e<0)return new Dn('Invalid value for positive integer: "'+e+'"')}}function er(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if("undefined"!=typeof e[n]&&"undefined"!=typeof e[r]&&wn(e[n],e[r])>0)throw new Dn("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&e.reduce!==!1){if(e.include_docs)throw new Dn("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Dn("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(t){var n=Zn(e[t]);if(n)throw n})}function tr(e,t,n){var r,o=[],i="GET";if(Qn("reduce",n,o),Qn("include_docs",n,o),Qn("attachments",n,o),Qn("limit",n,o),Qn("descending",n,o),Qn("group",n,o),Qn("group_level",n,o),Qn("skip",n,o),Qn("stale",n,o),Qn("conflicts",n,o),Qn("startkey",n,o,!0),Qn("start_key",n,o,!0),Qn("endkey",n,o,!0),Qn("end_key",n,o,!0),Qn("inclusive_end",n,o),Qn("key",n,o,!0),o=o.join("&"),o=""===o?"":"?"+o,"undefined"!=typeof n.keys){var s=2e3,a="keys="+encodeURIComponent(JSON.stringify(n.keys));a.length+o.length+1<=s?o+=("?"===o[0]?"&":"?")+a:(i="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var u=Mn(t);return e.request({method:i,url:"_design/"+u[0]+"/_view/"+u[1]+o,body:r}).then(Vn(n))}return r=r||{},Object.keys(t).forEach(function(e){Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString()}),e.request({method:"POST",url:"_temp_view"+o,body:r}).then(Vn(n))}function nr(e,t,n){return new Gr(function(r,o){e._query(t,n,function(e,t){return e?o(e):void r(t)})})}function rr(e){return new Gr(function(t,n){e._viewCleanup(function(e,r){return e?n(e):void t(r)})})}function or(e){return function(t){if(404===t.status)return e;throw t}}function ir(e,t,n){function r(){return Hn(f)?Gr.resolve(a):t.db.get(s).catch(or(a))}function o(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Gr.resolve({rows:[]})}function i(e,t){for(var n=[],r={},o=0,i=t.rows.length;on))return e.doc.value}var r=An(e.doc._id);return{key:r[0],id:r[1],value:"value"in e.doc?e.doc.value:null}})})}function r(n){var r;if(r=i?fr(e,n,t):{total_rows:o,offset:s,rows:n},t.include_docs){var a=Si(n.map(Xn));return e.sourceDB.allDocs({keys:a,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then(function(e){var t={};return e.rows.forEach(function(e){e.doc&&(t["$"+e.id]=e.doc)}),n.forEach(function(e){var n=Xn(e),r=t["$"+n];r&&(e.doc=r)}),r})}return r}var o,i=e.reduceFun&&t.reduce!==!1,s=t.skip||0;if("undefined"==typeof t.keys||t.keys.length||(t.limit=0,delete t.keys),"undefined"!=typeof t.keys){var a=t.keys,u=a.map(function(e){var t={startkey:Sn([e]),endkey:Sn([e,{}])};return n(t)});return Gr.all(u).then(C).then(r)}var c={descending:t.descending};if(t.start_key&&(t.startkey=t.start_key),t.end_key&&(t.endkey=t.end_key),"undefined"!=typeof t.startkey&&(c.startkey=Sn(t.descending?[t.startkey,{}]:[t.startkey])),"undefined"!=typeof t.endkey){var f=t.inclusive_end!==!1;t.descending&&(f=!f),c.endkey=Sn(f?[t.endkey,{}]:[t.endkey])}if("undefined"!=typeof t.key){var l=Sn([t.key]),d=Sn([t.key,{}]);c.descending?(c.endkey=l,c.startkey=d):(c.startkey=l,c.endkey=d)}return i||("number"==typeof t.limit&&(c.limit=t.limit),c.skip=s),n(c).then(r)}function hr(e){return e.request({method:"POST",url:"_view_cleanup"})}function pr(e){return e.get("_local/mrviews").then(function(t){var n={};Object.keys(t.views).forEach(function(e){var t=Mn(e),r="_design/"+t[0],o=t[1];n[r]=n[r]||{},n[r][o]=!0});var r={keys:Object.keys(n),include_docs:!0};return e.allDocs(r).then(function(r){var o={};r.rows.forEach(function(e){var r=e.key.substring(8);Object.keys(n[e.key]).forEach(function(n){var i=r+"/"+n;t.views[i]||(i=n);var s=Object.keys(t.views[i]),a=e.doc&&e.doc.views&&e.doc.views[n];s.forEach(function(e){o[e]=o[e]||a})})});var i=Object.keys(o).filter(function(e){return!o[e]}),s=i.map(function(t){return ki(ar(t),function(){return new e.constructor(t,e.__opts).destroy()})()});return Gr.all(s).then(function(){return{ok:!0}})})},or({ok:!0}))}function vr(e,t,r){if("http"===e.type())return tr(e,t,r);if("function"==typeof e._query)return nr(e,t,r);if("string"!=typeof t){er(r,t);var o={db:e,viewName:"temp_view/temp_view",map:t.map,reduce:t.reduce,temporary:!0};return xi.add(function(){return Rn(o).then(function(e){function t(){return e.db.destroy()}return Ei(ur(e).then(function(){return lr(e,r)}),t)})}),xi.finish()}var i=t,s=Mn(i),a=s[0],u=s[1];return e.get("_design/"+a).then(function(t){var o=t.views&&t.views[u];if(!o||"string"!=typeof o.map)throw new Nn("ddoc "+a+" has no view named "+u);er(r,o);var s={db:e,viewName:i,map:o.map,reduce:o.reduce};return Rn(s).then(function(e){return"ok"===r.stale||"update_after"===r.stale?("update_after"===r.stale&&n.nextTick(function(){ur(e)}),lr(e,r)):ur(e).then(function(){return lr(e,r)})})})}function yr(e){return/^1-/.test(e)}function _r(e,t,n){return!e._attachments||!e._attachments[n]||e._attachments[n].digest!==t._attachments[n].digest}function mr(e,t){var n=Object.keys(t._attachments);return Gr.all(n.map(function(n){return e.getAttachment(t._id,n,{rev:t._rev})}))}function gr(e,t,n){var r="http"===t.type()&&"http"!==e.type(),o=Object.keys(n._attachments);return r?e.get(n._id).then(function(r){return Gr.all(o.map(function(o){return _r(r,n,o)?t.getAttachment(n._id,o):e.getAttachment(r._id,o)}))}).catch(function(e){if(404!==e.status)throw e;return mr(t,n)}):mr(t,n)}function br(e){var t=[];return Object.keys(e).forEach(function(n){var r=e[n].missing;r.forEach(function(e){t.push({id:n,rev:e})})}),{docs:t,revs:!0}}function wr(e,t,n,r){function o(){var o=br(n);if(o.docs.length)return e.bulkGet(o).then(function(n){if(r.cancelled)throw new Error("cancelled");return Gr.all(n.results.map(function(n){return Gr.all(n.docs.map(function(n){var r=n.ok;return n.error&&(d=!1),r&&r._attachments?gr(t,e,r).then(function(e){var t=Object.keys(r._attachments);return e.forEach(function(e,n){var o=r._attachments[t[n]];delete o.stub,delete o.length,o.data=e}),r}):r}))})).then(function(e){l=l.concat(C(e).filter(Boolean))})})}function i(e){return e._attachments&&Object.keys(e._attachments).length>0}function s(e){return e._conflicts&&e._conflicts.length>0}function a(t){return e.allDocs({keys:t,include_docs:!0,conflicts:!0}).then(function(e){if(r.cancelled)throw new Error("cancelled");e.rows.forEach(function(e){e.deleted||!e.doc||!yr(e.value.rev)||i(e.doc)||s(e.doc)||(l.push(e.doc),delete n[e.id])})})}function u(){var e=Object.keys(n).filter(function(e){var t=n[e].missing;return 1===t.length&&yr(t[0])});if(e.length>0)return a(e)}function f(){return{ok:d,docs:l}}n=c(n);var l=[],d=!0;return Gr.resolve().then(u).then(o).then(f)}function Er(e,t,n,r,o){return e.get(t).catch(function(n){if(404===n.status)return"http"===e.type()&&S(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:r,_id:t,history:[],replicator:Ii,version:Li};throw n}).then(function(i){if(!o.cancelled&&i.last_seq!==n)return i.history=(i.history||[]).filter(function(e){return e.session_id!==r}),i.history.unshift({last_seq:n,session_id:r}),i.history=i.history.slice(0,Ri),i.version=Li,i.replicator=Ii,i.session_id=r,i.last_seq=n,e.put(i).catch(function(i){if(409===i.status)return Er(e,t,n,r,o);throw i})})}function kr(e,t,n,r){this.src=e,this.target=t,this.id=n,this.returnValue=r}function Sr(e,t){return e.session_id===t.session_id?{last_seq:e.last_seq,history:e.history}:qr(e.history,t.history)}function qr(e,t){var n=e[0],r=e.slice(1),o=t[0],i=t.slice(1);if(!n||0===t.length)return{last_seq:Di,history:[]};var s=n.session_id;if(xr(s,t))return{last_seq:n.last_seq,history:e};var a=o.session_id;return xr(a,r)?{last_seq:o.last_seq,history:i}:qr(r,i)}function xr(e,t){var n=t[0],r=t.slice(1);return!(!e||0===t.length)&&(e===n.session_id||xr(e,r))}function Ar(e){return"number"==typeof e.status&&4===Math.floor(e.status/100)}function Tr(e,t,n,r){if(e.retry===!1)return t.emit("error",n),void t.removeAllListeners();if("function"!=typeof e.back_off_function&&(e.back_off_function=k),t.emit("requestError",n),"active"===t.state||"pending"===t.state){t.emit("paused",n),t.state="stopped";var o=function(){e.current_back_off=Bi},i=function(){t.removeListener("active",o)};t.once("paused",i),t.once("active",o)}e.current_back_off=e.current_back_off||Bi,e.current_back_off=e.back_off_function(e.current_back_off),setTimeout(r,e.current_back_off)}function Or(e){return Object.keys(e).sort(wn).reduce(function(t,n){return t[n]=e[n],t},{})}function jr(e,t,n){var r=n.doc_ids?n.doc_ids.sort(wn):"",o=n.filter?n.filter.toString():"",i="",s="";return n.filter&&n.query_params&&(i=JSON.stringify(Or(n.query_params))),n.filter&&"_view"===n.filter&&(s=n.view.toString()),Gr.all([e.id(),t.id()]).then(function(e){var t=e[0]+e[1]+o+s+i+r;return new Gr(function(e){Ge(t,e)})}).then(function(e){return e=e.replace(/\//g,".").replace(/\+/g,"_"),"_local/"+e})}function Cr(e,t,n,r,o){function i(){return k?Gr.resolve():jr(e,t,n).then(function(n){E=n,k=new kr(e,t,E,r)})}function s(){if(N=[],0!==w.docs.length){var e=w.docs,i={timeout:n.timeout};return t.bulkDocs({docs:e,new_edits:!1},i).then(function(t){if(r.cancelled)throw p(),new Error("cancelled");var n=Object.create(null);t.forEach(function(e){e.error&&(n[e.id]=e)});var i=Object.keys(n).length;o.doc_write_failures+=i,o.docs_written+=e.length-i,e.forEach(function(e){var t=n[e._id];if(t){if(o.errors.push(t),"unauthorized"!==t.name&&"forbidden"!==t.name)throw t;r.emit("denied",c(t))}else N.push(e)})},function(t){throw o.doc_write_failures+=e.length,t})}}function a(){if(w.error)throw new Error("There was a problem getting docs.");o.last_seq=O=w.seq;var e=c(o);return N.length&&(e.docs=N,r.emit("change",e)),x=!0,k.writeCheckpoint(w.seq,B).then(function(){if(x=!1,r.cancelled)throw p(),new Error("cancelled");w=void 0,m()}).catch(function(e){throw b(e),e})}function u(){var e={};return w.changes.forEach(function(t){"_user/"!==t.id&&(e[t.id]=t.changes.map(function(e){return e.rev}))}),t.revsDiff(e).then(function(e){if(r.cancelled)throw p(),new Error("cancelled");w.diffs=e})}function f(){return wr(e,t,w.diffs,r).then(function(e){w.error=!e.ok,e.docs.forEach(function(e){delete w.diffs[e._id],o.docs_read++,w.docs.push(e)})})}function l(){if(!r.cancelled&&!w){if(0===S.length)return void d(!0);w=S.shift(),u().then(f).then(s).then(a).then(l).catch(function(e){h("batch processing terminated with error",e)})}}function d(e){return 0===q.changes.length?void(0!==S.length||w||((C&&F.live||A)&&(r.state="pending",r.emit("paused")),A&&p())):void((e||A||q.changes.length>=L)&&(S.push(q),q={seq:0,changes:[],docs:[]},"pending"!==r.state&&"stopped"!==r.state||(r.state="active",r.emit("active")),l()))}function h(e,t){T||(t.message||(t.message=e),o.ok=!1,o.status="aborting",S=[],q={seq:0,changes:[],docs:[]},p(t))}function p(i){T||r.cancelled&&(o.status="cancelled",x)||(o.status=o.status||"complete",o.end_time=new Date,o.last_seq=O,T=!0,i?(i.result=o,"unauthorized"===i.name||"forbidden"===i.name?(r.emit("error",i),r.removeAllListeners()):Tr(n,r,i,function(){Cr(e,t,n,r)})):(r.emit("complete",o),r.removeAllListeners()))}function v(e){if(r.cancelled)return p();var t=j(n)(e);t&&(q.seq=e.seq,q.changes.push(e),d(0===S.length&&F.live))}function y(e){if(R=!1,r.cancelled)return p();if(e.results.length>0)F.since=e.last_seq,m(),d(!0);else{var t=function(){C?(F.live=!0,m()):A=!0,d(!0)};w||0!==e.results.length?t():(x=!0,k.writeCheckpoint(e.last_seq,B).then(function(){x=!1,o.last_seq=O=e.last_seq,t()}).catch(b))}}function _(e){return R=!1,r.cancelled?p():void h("changes rejected",e)}function m(){function t(){i.cancel()}function o(){r.removeListener("cancel",t)}if(!R&&!A&&S.lengthr.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===s&&setTimeout(function(){o()},0),s=!1}).on("error",e)}}if(!this._listeners[t]){var i=this,s=!1;this._listeners[t]=o,this.on(e,o)}},b.prototype.removeListener=function(e,t){t in this._listeners&&(Hr.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},b.prototype.notifyLocalWindows=function(e){_()?chrome.storage.local.set({dbName:e}):m()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},b.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var Zr=Array.prototype.slice,eo=Array.prototype.forEach;Wr(x,Error),x.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var to=(new x({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new x({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"})),no=new x({status:404,error:"not_found",reason:"missing"}),ro=new x({status:409,error:"conflict",reason:"Document update conflict"}),oo=new x({status:400,error:"bad_request",reason:"_id field must contain a string"}),io=new x({status:412,error:"missing_id",reason:"_id is required for puts"}),so=new x({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),ao=new x({status:412,error:"precondition_failed",reason:"Database not open"}),uo=new x({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),co=new x({status:500,error:"badarg",reason:"Some query argument is invalid"}),fo=(new x({status:400,error:"invalid_request",reason:"Request was invalid"}),new x({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"})),lo=new x({status:500,error:"doc_validation",reason:"Bad special document member"}),ho=new x({status:400,error:"bad_request",reason:"Something wrong with the request"}),po=new x({status:400,error:"bad_request",reason:"Document must be a JSON object"}),vo=(new x({status:404,error:"not_found",reason:"Database not found"}),new x({status:500,error:"indexed_db_went_bad",reason:"unknown"})),yo=new x({status:500,error:"web_sql_went_bad",reason:"unknown"}),_o=(new x({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),new x({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),new x({status:400,error:"bad_request",reason:"Invalid rev format"})),mo=(new x({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),new x({status:412,error:"missing_stub"})),go=(new x({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]),bo="queryKey",wo=/(?:^|&)([^&=]*)=?([^&]*)/g,Eo=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ko="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");W.prototype.get=function(e){var t=M(e);return this.store[t]},W.prototype.set=function(e,t){var n=M(e);return this.store[n]=t,!0},W.prototype.has=function(e){var t=M(e);return t in this.store},W.prototype.delete=function(e){var t=M(e),n=t in this.store;return delete this.store[t],n},W.prototype.forEach=function(e){for(var t=Object.keys(this.store),n=0,r=t.length;nt&&a.push(e)}),z(i,function(e,t,n,r,o){var i=t+"-"+n;"available"===o.status&&a.indexOf(i)!==-1&&u.push(i)}),r._doCompaction(e,u,n)})}),qe.prototype.compact=d("compact",function(e,t){"function"==typeof e&&(t=e,e={});var n=this;e=e||{},n._compactionQueue=n._compactionQueue||[],n._compactionQueue.push({opts:e,callback:t}),1===n._compactionQueue.length&&ke(n)}),qe.prototype._compact=function(e,t){function n(e){s.push(o.compactDocument(e.id,0))}function r(e){var n=e.last_seq;Gr.all(s).then(function(){return B(o,"_local/compaction",function(e){return(!e.last_seq||e.last_seq 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne$1(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -10784,8 +10817,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? extend$1({}, opts, opts.push) : opts; + var optsPull = opts.pull ? extend$1({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); diff --git a/lib/pouchdb/lib/index-browser.js b/lib/pouchdb/lib/index-browser.js index dda9cfad..00cd4033 100644 --- a/lib/pouchdb/lib/index-browser.js +++ b/lib/pouchdb/lib/index-browser.js @@ -2,12 +2,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var jsExtend = require('js-extend'); -var debug = _interopDefault(require('debug')); -var inherits = _interopDefault(require('inherits')); var lie = _interopDefault(require('lie')); -var events = require('events'); var getArguments = _interopDefault(require('argsarray')); +var debug = _interopDefault(require('debug')); +var events = require('events'); +var inherits = _interopDefault(require('inherits')); var scopedEval = _interopDefault(require('scope-eval')); var Md5 = _interopDefault(require('spark-md5')); var vuvuzela = _interopDefault(require('vuvuzela')); @@ -16,62 +15,6 @@ var PromisePool = _interopDefault(require('es6-promise-pool')); /* istanbul ignore next */ var PouchPromise = typeof Promise === 'function' ? Promise : lie; -// based on https://github.com/montagejs/collections -function mangle(key) { - return '$' + key; -} -function unmangle(key) { - return key.substring(1); -} -function _Map() { - this.store = {}; -} -_Map.prototype.get = function (key) { - var mangled = mangle(key); - return this.store[mangled]; -}; -_Map.prototype.set = function (key, value) { - var mangled = mangle(key); - this.store[mangled] = value; - return true; -}; -_Map.prototype.has = function (key) { - var mangled = mangle(key); - return mangled in this.store; -}; -_Map.prototype.delete = function (key) { - var mangled = mangle(key); - var res = mangled in this.store; - delete this.store[mangled]; - return res; -}; -_Map.prototype.forEach = function (cb) { - var keys = Object.keys(this.store); - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i]; - var value = this.store[key]; - key = unmangle(key); - cb(value, key); - } -}; - -function _Set(array) { - this.store = new _Map(); - - // init with an array - if (array && Array.isArray(array)) { - for (var i = 0, len = array.length; i < len; i++) { - this.add(array[i]); - } - } -} -_Set.prototype.add = function (key) { - return this.store.set(key, true); -}; -_Set.prototype.has = function (key) { - return this.store.has(key); -}; - function isBinaryObject(object) { return (typeof ArrayBuffer !== 'undefined' && object instanceof ArrayBuffer) || (typeof Blob !== 'undefined' && object instanceof Blob); @@ -441,7 +384,7 @@ function hasLocalStorage() { return hasLocal; } -inherits(Changes$1, events.EventEmitter); +inherits(Changes, events.EventEmitter); /* istanbul ignore next */ function attachBrowserEvents(self) { @@ -466,13 +409,13 @@ function attachBrowserEvents(self) { } } -function Changes$1() { +function Changes() { events.EventEmitter.call(this); this._listeners = {}; attachBrowserEvents(this); } -Changes$1.prototype.addListener = function (dbName, id, db, opts) { +Changes.prototype.addListener = function (dbName, id, db, opts) { /* istanbul ignore if */ if (this._listeners[id]) { return; @@ -517,7 +460,7 @@ Changes$1.prototype.addListener = function (dbName, id, db, opts) { this.on(dbName, eventFunction); }; -Changes$1.prototype.removeListener = function (dbName, id) { +Changes.prototype.removeListener = function (dbName, id) { /* istanbul ignore if */ if (!(id in this._listeners)) { return; @@ -529,7 +472,7 @@ Changes$1.prototype.removeListener = function (dbName, id) { /* istanbul ignore next */ -Changes$1.prototype.notifyLocalWindows = function (dbName) { +Changes.prototype.notifyLocalWindows = function (dbName) { //do a useless change on a storage thing //in order to get other windows's listeners to activate if (isChromeApp()) { @@ -539,7 +482,7 @@ Changes$1.prototype.notifyLocalWindows = function (dbName) { } }; -Changes$1.prototype.notify = function (dbName) { +Changes.prototype.notify = function (dbName) { this.emit(dbName); this.notifyLocalWindows(dbName); }; @@ -586,6 +529,35 @@ function explainError(status, str) { guardedConsole('info', 'The above ' + status + ' is totally normal. ' + str); } +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -1050,6 +1022,62 @@ function uuid(len, radix) { return out; } +// based on https://github.com/montagejs/collections +function mangle(key) { + return '$' + key; +} +function unmangle(key) { + return key.substring(1); +} +function _Map() { + this.store = {}; +} +_Map.prototype.get = function (key) { + var mangled = mangle(key); + return this.store[mangled]; +}; +_Map.prototype.set = function (key, value) { + var mangled = mangle(key); + this.store[mangled] = value; + return true; +}; +_Map.prototype.has = function (key) { + var mangled = mangle(key); + return mangled in this.store; +}; +_Map.prototype.delete = function (key) { + var mangled = mangle(key); + var res = mangled in this.store; + delete this.store[mangled]; + return res; +}; +_Map.prototype.forEach = function (cb) { + var keys = Object.keys(this.store); + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var value = this.store[key]; + key = unmangle(key); + cb(value, key); + } +}; + +function _Set(array) { + this.store = new _Map(); + + // init with an array + if (array && Array.isArray(array)) { + for (var i = 0, len = array.length; i < len; i++) { + this.add(array[i]); + } + } +} +_Set.prototype.add = function (key) { + return this.store.set(key, true); +}; +_Set.prototype.has = function (key) { + return this.store.has(key); +}; + // We fetch all leafs of the revision tree, and sort them based on tree length // and whether they were deleted, undeleted documents with the longest revision // tree (most edits) win @@ -1482,7 +1510,7 @@ function evalView(input) { return scopedEval(code, {}); } -inherits(Changes, events.EventEmitter); +inherits(Changes$1, events.EventEmitter); function tryCatchInChangeListener(self, change) { // isolate try/catches to avoid V8 deoptimizations @@ -1493,7 +1521,7 @@ function tryCatchInChangeListener(self, change) { } } -function Changes(db, opts, callback) { +function Changes$1(db, opts, callback) { events.EventEmitter.call(this); var self = this; this.db = db; @@ -1563,7 +1591,7 @@ function Changes(db, opts, callback) { self.doChanges(opts); } } -Changes.prototype.cancel = function () { +Changes$1.prototype.cancel = function () { this.isCancelled = true; if (this.db.taskqueue.isReady) { this.emit('cancel'); @@ -1593,7 +1621,7 @@ function processChange(doc, metadata, opts) { return change; } -Changes.prototype.doChanges = function (opts) { +Changes$1.prototype.doChanges = function (opts) { var self = this; var callback = opts.complete; @@ -1657,7 +1685,7 @@ Changes.prototype.doChanges = function (opts) { } }; -Changes.prototype.filterChanges = function (opts) { +Changes$1.prototype.filterChanges = function (opts) { var self = this; var callback = opts.complete; if (opts.filter === '_view') { @@ -1813,7 +1841,7 @@ function allDocsKeysQuery(api, opts, callback) { offset: opts.skip }; return PouchPromise.all(keys.map(function (key) { - var subOpts = jsExtend.extend({key: key, deleted: 'ok'}, opts); + var subOpts = extend$1({key: key, deleted: 'ok'}, opts); ['limit', 'skip', 'keys'].forEach(function (optKey) { delete subOpts[optKey]; }); @@ -2405,7 +2433,7 @@ AbstractPouchDB.prototype.changes = function (opts, callback) { callback = opts; opts = {}; } - return new Changes(this, opts, callback); + return new Changes$1(this, opts, callback); }; AbstractPouchDB.prototype.close = adapterFun('close', function (callback) { @@ -2812,7 +2840,7 @@ PouchDB.defaults = function (defaultOpts) { delete opts.name; } - opts = jsExtend.extend({}, defaultOpts, opts); + opts = extend$1({}, defaultOpts, opts); PouchDB.call(this, name, opts); } @@ -2829,7 +2857,7 @@ PouchDB.defaults = function (defaultOpts) { }; // managed automatically by set-version.js -var version = "6.0.6"; +var version = "6.0.7"; PouchDB.version = version; @@ -3656,7 +3684,7 @@ function postProcessAttachments(results, asBlob) { var type = attObj.content_type; return new PouchPromise(function (resolve) { readBlobData(body, type, asBlob, function (data) { - row.doc._attachments[att] = jsExtend.extend( + row.doc._attachments[att] = extend$1( pick(attObj, ['digest', 'content_type']), {data: data} ); @@ -4292,7 +4320,7 @@ function checkBlobSupport(txn) { var cachedDBs = new _Map(); var blobSupportPromise; -var idbChanges = new Changes$1(); +var idbChanges = new Changes(); var openReqList = new _Map(); function IdbPouch(opts, callback) { @@ -5825,7 +5853,7 @@ function openDB$1(opts) { return cachedResult; } -var websqlChanges = new Changes$1(); +var websqlChanges = new Changes(); function fetchAttachmentsIfNecessary$1(doc, opts, api, txn, cb) { var attachments = Object.keys(doc._attachments || {}); @@ -5844,7 +5872,7 @@ function fetchAttachmentsIfNecessary$1(doc, opts, api, txn, cb) { var attObj = doc._attachments[att]; var attOpts = {binary: opts.binary, ctx: txn}; api._getAttachment(doc._id, att, attObj, attOpts, function (_, data) { - doc._attachments[att] = jsExtend.extend( + doc._attachments[att] = extend$1( pick(attObj, ['digest', 'content_type']), { data: data } ); @@ -5902,7 +5930,7 @@ function WebSqlPouch$1(opts, callback) { // extend the options here, because sqlite plugin has a ton of options // and they are constantly changing, so it's more prudent to allow anything - var websqlOpts = jsExtend.extend({}, opts, { + var websqlOpts = extend$1({}, opts, { version: POUCH_VERSION, description: opts.name, size: size @@ -6334,7 +6362,7 @@ function WebSqlPouch$1(opts, callback) { var tx = opts.ctx; if (!tx) { return db.readTransaction(function (txn) { - api._get(id, jsExtend.extend({ctx: txn}, opts), callback); + api._get(id, extend$1({ctx: txn}, opts), callback); }); } @@ -6872,7 +6900,7 @@ function openDB(name, version, description, size) { } function WebSQLPouch(opts, callback) { - var _opts = jsExtend.extend({ + var _opts = extend$1({ websql: openDB }, opts); @@ -7160,7 +7188,7 @@ function ajaxCore(options, callback) { cache: false }; - options = jsExtend.extend(defaultOptions, options); + options = extend$1(defaultOptions, options); function onSuccess(obj, resp, cb) { if (!options.binary && options.json && typeof obj === 'string') { @@ -7406,7 +7434,7 @@ function HttpPouch(opts, callback) { function ajax$$(userOpts, options, callback) { var reqAjax = userOpts.ajax || {}; - var reqOpts = jsExtend.extend(clone(ajaxOpts), reqAjax, options); + var reqOpts = extend$1(clone(ajaxOpts), reqAjax, options); log$1(reqOpts.method + ' ' + reqOpts.url); return api._ajax(reqOpts, callback); } @@ -9876,19 +9904,24 @@ function getDocs(src, target, diffs, state) { return doc._attachments && Object.keys(doc._attachments).length > 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne$1(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -10788,8 +10821,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? jsExtend.extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? jsExtend.extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? extend$1({}, opts, opts.push) : opts; + var optsPull = opts.pull ? extend$1({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); diff --git a/lib/pouchdb/lib/index.es.js b/lib/pouchdb/lib/index.es.js index 9875553c..93d2ec76 100644 --- a/lib/pouchdb/lib/index.es.js +++ b/lib/pouchdb/lib/index.es.js @@ -1,9 +1,8 @@ -import { extend } from 'js-extend'; -import debug from 'debug'; -import inherits from 'inherits'; import lie from 'lie'; -import events, { EventEmitter } from 'events'; import getArguments from 'argsarray'; +import debug from 'debug'; +import events, { EventEmitter } from 'events'; +import inherits from 'inherits'; import vm from 'vm'; import levelup from 'levelup'; import ltgt from 'ltgt'; @@ -22,62 +21,6 @@ import scopedEval from 'scope-eval'; /* istanbul ignore next */ var PouchPromise = typeof Promise === 'function' ? Promise : lie; -// based on https://github.com/montagejs/collections -function mangle(key) { - return '$' + key; -} -function unmangle(key) { - return key.substring(1); -} -function _Map() { - this.store = {}; -} -_Map.prototype.get = function (key) { - var mangled = mangle(key); - return this.store[mangled]; -}; -_Map.prototype.set = function (key, value) { - var mangled = mangle(key); - this.store[mangled] = value; - return true; -}; -_Map.prototype.has = function (key) { - var mangled = mangle(key); - return mangled in this.store; -}; -_Map.prototype.delete = function (key) { - var mangled = mangle(key); - var res = mangled in this.store; - delete this.store[mangled]; - return res; -}; -_Map.prototype.forEach = function (cb) { - var keys = Object.keys(this.store); - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i]; - var value = this.store[key]; - key = unmangle(key); - cb(value, key); - } -}; - -function _Set(array) { - this.store = new _Map(); - - // init with an array - if (array && Array.isArray(array)) { - for (var i = 0, len = array.length; i < len; i++) { - this.add(array[i]); - } - } -} -_Set.prototype.add = function (key) { - return this.store.set(key, true); -}; -_Set.prototype.has = function (key) { - return this.store.has(key); -}; - function isBinaryObject(object) { return object instanceof Buffer; } @@ -413,7 +356,7 @@ function hasLocalStorage() { return false; } -inherits(Changes$1, EventEmitter); +inherits(Changes, EventEmitter); /* istanbul ignore next */ function attachBrowserEvents(self) { @@ -438,13 +381,13 @@ function attachBrowserEvents(self) { } } -function Changes$1() { +function Changes() { EventEmitter.call(this); this._listeners = {}; attachBrowserEvents(this); } -Changes$1.prototype.addListener = function (dbName, id, db, opts) { +Changes.prototype.addListener = function (dbName, id, db, opts) { /* istanbul ignore if */ if (this._listeners[id]) { return; @@ -489,7 +432,7 @@ Changes$1.prototype.addListener = function (dbName, id, db, opts) { this.on(dbName, eventFunction); }; -Changes$1.prototype.removeListener = function (dbName, id) { +Changes.prototype.removeListener = function (dbName, id) { /* istanbul ignore if */ if (!(id in this._listeners)) { return; @@ -501,7 +444,7 @@ Changes$1.prototype.removeListener = function (dbName, id) { /* istanbul ignore next */ -Changes$1.prototype.notifyLocalWindows = function (dbName) { +Changes.prototype.notifyLocalWindows = function (dbName) { //do a useless change on a storage thing //in order to get other windows's listeners to activate if (isChromeApp()) { @@ -511,7 +454,7 @@ Changes$1.prototype.notifyLocalWindows = function (dbName) { } }; -Changes$1.prototype.notify = function (dbName) { +Changes.prototype.notify = function (dbName) { this.emit(dbName); this.notifyLocalWindows(dbName); }; @@ -555,6 +498,35 @@ function defaultBackOff(min) { // We assume Node users don't need to see this warning var res = function () {}; +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -1042,6 +1014,62 @@ function uuid(len, radix) { return out; } +// based on https://github.com/montagejs/collections +function mangle(key) { + return '$' + key; +} +function unmangle(key) { + return key.substring(1); +} +function _Map() { + this.store = {}; +} +_Map.prototype.get = function (key) { + var mangled = mangle(key); + return this.store[mangled]; +}; +_Map.prototype.set = function (key, value) { + var mangled = mangle(key); + this.store[mangled] = value; + return true; +}; +_Map.prototype.has = function (key) { + var mangled = mangle(key); + return mangled in this.store; +}; +_Map.prototype.delete = function (key) { + var mangled = mangle(key); + var res = mangled in this.store; + delete this.store[mangled]; + return res; +}; +_Map.prototype.forEach = function (cb) { + var keys = Object.keys(this.store); + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var value = this.store[key]; + key = unmangle(key); + cb(value, key); + } +}; + +function _Set(array) { + this.store = new _Map(); + + // init with an array + if (array && Array.isArray(array)) { + for (var i = 0, len = array.length; i < len; i++) { + this.add(array[i]); + } + } +} +_Set.prototype.add = function (key) { + return this.store.set(key, true); +}; +_Set.prototype.has = function (key) { + return this.store.has(key); +}; + // We fetch all leafs of the revision tree, and sort them based on tree length // and whether they were deleted, undeleted documents with the longest revision // tree (most edits) win @@ -1474,7 +1502,7 @@ function evalView(input) { return vm.runInNewContext('(function(doc) {\n' + code + '\n})'); } -inherits(Changes, EventEmitter); +inherits(Changes$1, EventEmitter); function tryCatchInChangeListener(self, change) { // isolate try/catches to avoid V8 deoptimizations @@ -1485,7 +1513,7 @@ function tryCatchInChangeListener(self, change) { } } -function Changes(db, opts, callback) { +function Changes$1(db, opts, callback) { EventEmitter.call(this); var self = this; this.db = db; @@ -1555,7 +1583,7 @@ function Changes(db, opts, callback) { self.doChanges(opts); } } -Changes.prototype.cancel = function () { +Changes$1.prototype.cancel = function () { this.isCancelled = true; if (this.db.taskqueue.isReady) { this.emit('cancel'); @@ -1585,7 +1613,7 @@ function processChange(doc, metadata, opts) { return change; } -Changes.prototype.doChanges = function (opts) { +Changes$1.prototype.doChanges = function (opts) { var self = this; var callback = opts.complete; @@ -1649,7 +1677,7 @@ Changes.prototype.doChanges = function (opts) { } }; -Changes.prototype.filterChanges = function (opts) { +Changes$1.prototype.filterChanges = function (opts) { var self = this; var callback = opts.complete; if (opts.filter === '_view') { @@ -1805,7 +1833,7 @@ function allDocsKeysQuery(api, opts, callback) { offset: opts.skip }; return PouchPromise.all(keys.map(function (key) { - var subOpts = extend({key: key, deleted: 'ok'}, opts); + var subOpts = extend$1({key: key, deleted: 'ok'}, opts); ['limit', 'skip', 'keys'].forEach(function (optKey) { delete subOpts[optKey]; }); @@ -2397,7 +2425,7 @@ AbstractPouchDB.prototype.changes = function (opts, callback) { callback = opts; opts = {}; } - return new Changes(this, opts, callback); + return new Changes$1(this, opts, callback); }; AbstractPouchDB.prototype.close = adapterFun('close', function (callback) { @@ -2804,7 +2832,7 @@ PouchDB.defaults = function (defaultOpts) { delete opts.name; } - opts = extend({}, defaultOpts, opts); + opts = extend$1({}, defaultOpts, opts); PouchDB.call(this, name, opts); } @@ -2821,7 +2849,7 @@ PouchDB.defaults = function (defaultOpts) { }; // managed automatically by set-version.js -var version = "6.0.6"; +var version = "6.0.7"; PouchDB.version = version; @@ -3710,7 +3738,7 @@ var safeJsonEncoding = { type: 'cheap-json' }; -var levelChanges = new Changes$1(); +var levelChanges = new Changes(); // winningRev and deleted are performance-killers, but // in newer versions of PouchDB, they are cached on the metadata @@ -5342,7 +5370,7 @@ function LevelDownPouch(opts, callback) { } } - var _opts = extend({ + var _opts = extend$1({ db: leveldown, migrate: migrate }, opts); @@ -5386,7 +5414,7 @@ function ajaxCore(options, callback) { cache: false }; - options = extend(defaultOptions, options); + options = extend$1(defaultOptions, options); function onSuccess(obj, resp, cb) { if (!options.binary && options.json && typeof obj === 'string') { @@ -5608,7 +5636,7 @@ function HttpPouch(opts, callback) { function ajax$$(userOpts, options, callback) { var reqAjax = userOpts.ajax || {}; - var reqOpts = extend(clone(ajaxOpts), reqAjax, options); + var reqOpts = extend$1(clone(ajaxOpts), reqAjax, options); log$1(reqOpts.method + ' ' + reqOpts.url); return api._ajax(reqOpts, callback); } @@ -8125,19 +8153,24 @@ function getDocs(src, target, diffs, state) { return doc._attachments && Object.keys(doc._attachments).length > 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne$1(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -9037,8 +9070,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? extend$1({}, opts, opts.push) : opts; + var optsPull = opts.pull ? extend$1({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); diff --git a/lib/pouchdb/lib/index.js b/lib/pouchdb/lib/index.js index 30144d07..bba52f09 100644 --- a/lib/pouchdb/lib/index.js +++ b/lib/pouchdb/lib/index.js @@ -2,13 +2,12 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var jsExtend = require('js-extend'); -var debug = _interopDefault(require('debug')); -var inherits = _interopDefault(require('inherits')); var lie = _interopDefault(require('lie')); +var getArguments = _interopDefault(require('argsarray')); +var debug = _interopDefault(require('debug')); var events = require('events'); var events__default = _interopDefault(events); -var getArguments = _interopDefault(require('argsarray')); +var inherits = _interopDefault(require('inherits')); var vm = _interopDefault(require('vm')); var levelup = _interopDefault(require('levelup')); var ltgt = _interopDefault(require('ltgt')); @@ -27,62 +26,6 @@ var scopedEval = _interopDefault(require('scope-eval')); /* istanbul ignore next */ var PouchPromise = typeof Promise === 'function' ? Promise : lie; -// based on https://github.com/montagejs/collections -function mangle(key) { - return '$' + key; -} -function unmangle(key) { - return key.substring(1); -} -function _Map() { - this.store = {}; -} -_Map.prototype.get = function (key) { - var mangled = mangle(key); - return this.store[mangled]; -}; -_Map.prototype.set = function (key, value) { - var mangled = mangle(key); - this.store[mangled] = value; - return true; -}; -_Map.prototype.has = function (key) { - var mangled = mangle(key); - return mangled in this.store; -}; -_Map.prototype.delete = function (key) { - var mangled = mangle(key); - var res = mangled in this.store; - delete this.store[mangled]; - return res; -}; -_Map.prototype.forEach = function (cb) { - var keys = Object.keys(this.store); - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i]; - var value = this.store[key]; - key = unmangle(key); - cb(value, key); - } -}; - -function _Set(array) { - this.store = new _Map(); - - // init with an array - if (array && Array.isArray(array)) { - for (var i = 0, len = array.length; i < len; i++) { - this.add(array[i]); - } - } -} -_Set.prototype.add = function (key) { - return this.store.set(key, true); -}; -_Set.prototype.has = function (key) { - return this.store.has(key); -}; - function isBinaryObject(object) { return object instanceof Buffer; } @@ -418,7 +361,7 @@ function hasLocalStorage() { return false; } -inherits(Changes$1, events.EventEmitter); +inherits(Changes, events.EventEmitter); /* istanbul ignore next */ function attachBrowserEvents(self) { @@ -443,13 +386,13 @@ function attachBrowserEvents(self) { } } -function Changes$1() { +function Changes() { events.EventEmitter.call(this); this._listeners = {}; attachBrowserEvents(this); } -Changes$1.prototype.addListener = function (dbName, id, db, opts) { +Changes.prototype.addListener = function (dbName, id, db, opts) { /* istanbul ignore if */ if (this._listeners[id]) { return; @@ -494,7 +437,7 @@ Changes$1.prototype.addListener = function (dbName, id, db, opts) { this.on(dbName, eventFunction); }; -Changes$1.prototype.removeListener = function (dbName, id) { +Changes.prototype.removeListener = function (dbName, id) { /* istanbul ignore if */ if (!(id in this._listeners)) { return; @@ -506,7 +449,7 @@ Changes$1.prototype.removeListener = function (dbName, id) { /* istanbul ignore next */ -Changes$1.prototype.notifyLocalWindows = function (dbName) { +Changes.prototype.notifyLocalWindows = function (dbName) { //do a useless change on a storage thing //in order to get other windows's listeners to activate if (isChromeApp()) { @@ -516,7 +459,7 @@ Changes$1.prototype.notifyLocalWindows = function (dbName) { } }; -Changes$1.prototype.notify = function (dbName) { +Changes.prototype.notify = function (dbName) { this.emit(dbName); this.notifyLocalWindows(dbName); }; @@ -560,6 +503,35 @@ function defaultBackOff(min) { // We assume Node users don't need to see this warning var res = function () {}; +// forked from +// https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js +// TODO: I don't know why we have two different extend() functions in PouchDB + +var slice = Array.prototype.slice; +var each = Array.prototype.forEach; + +function extend$1(obj) { + if (typeof obj !== 'object') { + throw obj + ' is not an object' ; + } + + var sources = slice.call(arguments, 1); + + each.call(sources, function (source) { + if (source) { + for (var prop in source) { + if (typeof source[prop] === 'object' && obj[prop]) { + extend$1.call(obj, obj[prop], source[prop]); + } else { + obj[prop] = source[prop]; + } + } + } + }); + + return obj; +} + inherits(PouchError, Error); function PouchError(opts) { @@ -1047,6 +1019,62 @@ function uuid(len, radix) { return out; } +// based on https://github.com/montagejs/collections +function mangle(key) { + return '$' + key; +} +function unmangle(key) { + return key.substring(1); +} +function _Map() { + this.store = {}; +} +_Map.prototype.get = function (key) { + var mangled = mangle(key); + return this.store[mangled]; +}; +_Map.prototype.set = function (key, value) { + var mangled = mangle(key); + this.store[mangled] = value; + return true; +}; +_Map.prototype.has = function (key) { + var mangled = mangle(key); + return mangled in this.store; +}; +_Map.prototype.delete = function (key) { + var mangled = mangle(key); + var res = mangled in this.store; + delete this.store[mangled]; + return res; +}; +_Map.prototype.forEach = function (cb) { + var keys = Object.keys(this.store); + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var value = this.store[key]; + key = unmangle(key); + cb(value, key); + } +}; + +function _Set(array) { + this.store = new _Map(); + + // init with an array + if (array && Array.isArray(array)) { + for (var i = 0, len = array.length; i < len; i++) { + this.add(array[i]); + } + } +} +_Set.prototype.add = function (key) { + return this.store.set(key, true); +}; +_Set.prototype.has = function (key) { + return this.store.has(key); +}; + // We fetch all leafs of the revision tree, and sort them based on tree length // and whether they were deleted, undeleted documents with the longest revision // tree (most edits) win @@ -1479,7 +1507,7 @@ function evalView(input) { return vm.runInNewContext('(function(doc) {\n' + code + '\n})'); } -inherits(Changes, events.EventEmitter); +inherits(Changes$1, events.EventEmitter); function tryCatchInChangeListener(self, change) { // isolate try/catches to avoid V8 deoptimizations @@ -1490,7 +1518,7 @@ function tryCatchInChangeListener(self, change) { } } -function Changes(db, opts, callback) { +function Changes$1(db, opts, callback) { events.EventEmitter.call(this); var self = this; this.db = db; @@ -1560,7 +1588,7 @@ function Changes(db, opts, callback) { self.doChanges(opts); } } -Changes.prototype.cancel = function () { +Changes$1.prototype.cancel = function () { this.isCancelled = true; if (this.db.taskqueue.isReady) { this.emit('cancel'); @@ -1590,7 +1618,7 @@ function processChange(doc, metadata, opts) { return change; } -Changes.prototype.doChanges = function (opts) { +Changes$1.prototype.doChanges = function (opts) { var self = this; var callback = opts.complete; @@ -1654,7 +1682,7 @@ Changes.prototype.doChanges = function (opts) { } }; -Changes.prototype.filterChanges = function (opts) { +Changes$1.prototype.filterChanges = function (opts) { var self = this; var callback = opts.complete; if (opts.filter === '_view') { @@ -1810,7 +1838,7 @@ function allDocsKeysQuery(api, opts, callback) { offset: opts.skip }; return PouchPromise.all(keys.map(function (key) { - var subOpts = jsExtend.extend({key: key, deleted: 'ok'}, opts); + var subOpts = extend$1({key: key, deleted: 'ok'}, opts); ['limit', 'skip', 'keys'].forEach(function (optKey) { delete subOpts[optKey]; }); @@ -2402,7 +2430,7 @@ AbstractPouchDB.prototype.changes = function (opts, callback) { callback = opts; opts = {}; } - return new Changes(this, opts, callback); + return new Changes$1(this, opts, callback); }; AbstractPouchDB.prototype.close = adapterFun('close', function (callback) { @@ -2809,7 +2837,7 @@ PouchDB.defaults = function (defaultOpts) { delete opts.name; } - opts = jsExtend.extend({}, defaultOpts, opts); + opts = extend$1({}, defaultOpts, opts); PouchDB.call(this, name, opts); } @@ -2826,7 +2854,7 @@ PouchDB.defaults = function (defaultOpts) { }; // managed automatically by set-version.js -var version = "6.0.6"; +var version = "6.0.7"; PouchDB.version = version; @@ -3715,7 +3743,7 @@ var safeJsonEncoding = { type: 'cheap-json' }; -var levelChanges = new Changes$1(); +var levelChanges = new Changes(); // winningRev and deleted are performance-killers, but // in newer versions of PouchDB, they are cached on the metadata @@ -5347,7 +5375,7 @@ function LevelDownPouch(opts, callback) { } } - var _opts = jsExtend.extend({ + var _opts = extend$1({ db: leveldown, migrate: migrate }, opts); @@ -5391,7 +5419,7 @@ function ajaxCore(options, callback) { cache: false }; - options = jsExtend.extend(defaultOptions, options); + options = extend$1(defaultOptions, options); function onSuccess(obj, resp, cb) { if (!options.binary && options.json && typeof obj === 'string') { @@ -5613,7 +5641,7 @@ function HttpPouch(opts, callback) { function ajax$$(userOpts, options, callback) { var reqAjax = userOpts.ajax || {}; - var reqOpts = jsExtend.extend(clone(ajaxOpts), reqAjax, options); + var reqOpts = extend$1(clone(ajaxOpts), reqAjax, options); log$1(reqOpts.method + ' ' + reqOpts.url); return api._ajax(reqOpts, callback); } @@ -8130,19 +8158,24 @@ function getDocs(src, target, diffs, state) { return doc._attachments && Object.keys(doc._attachments).length > 0; } + function hasConflicts(doc) { + return doc._conflicts && doc._conflicts.length > 0; + } + function fetchRevisionOneDocs(ids) { // Optimization: fetch gen-1 docs and attachments in // a single request using _all_docs return src.allDocs({ keys: ids, - include_docs: true + include_docs: true, + conflicts: true }).then(function (res) { if (state.cancelled) { throw new Error('cancelled'); } res.rows.forEach(function (row) { if (row.deleted || !row.doc || !isGenOne$1(row.value.rev) || - hasAttachments(row.doc)) { + hasAttachments(row.doc) || hasConflicts(row.doc)) { // if any of these conditions apply, we need to fetch using get() return; } @@ -9042,8 +9075,8 @@ function Sync(src, target, opts, callback) { var self = this; this.canceled = false; - var optsPush = opts.push ? jsExtend.extend({}, opts, opts.push) : opts; - var optsPull = opts.pull ? jsExtend.extend({}, opts, opts.pull) : opts; + var optsPush = opts.push ? extend$1({}, opts, opts.push) : opts; + var optsPull = opts.pull ? extend$1({}, opts, opts.pull) : opts; this.push = replicate(src, target, optsPush); this.pull = replicate(target, src, optsPull); diff --git a/lib/pouchdb/package.json b/lib/pouchdb/package.json index 794463c1..d12be2c4 100644 --- a/lib/pouchdb/package.json +++ b/lib/pouchdb/package.json @@ -1,6 +1,6 @@ { "name": "pouchdb", - "version": "6.0.6", + "version": "6.0.7", "description": "PouchDB is a pocket-sized database", "main": "./lib/index.js", "jsnext:main": "./lib/index.es.js", @@ -39,11 +39,10 @@ "double-ended-queue": "2.1.0-0", "es6-promise-pool": "2.4.4", "inherits": "2.0.3", - "js-extend": "1.0.1", "level-codec": "6.2.0", "level-write-stream": "1.0.0", "leveldown": "1.5.0", - "levelup": "1.3.2", + "levelup": "1.3.3", "lie": "3.1.0", "ltgt": "2.1.2", "readable-stream": "1.0.33", diff --git a/lib/prism-element/.bower.json b/lib/prism-element/.bower.json index 54ed55ee..b5088350 100644 --- a/lib/prism-element/.bower.json +++ b/lib/prism-element/.bower.json @@ -39,6 +39,6 @@ "commit": "5f742212fac3b391f964fb9dd35cf351301bec9b" }, "_source": "git://github.com/PolymerElements/prism-element.git", - "_target": "^1.1.0", + "_target": "^1.0.0", "_originalSource": "PolymerElements/prism-element" } \ No newline at end of file diff --git a/lib/promise-polyfill/.bower.json b/lib/promise-polyfill/.bower.json index a7798268..83447106 100644 --- a/lib/promise-polyfill/.bower.json +++ b/lib/promise-polyfill/.bower.json @@ -34,7 +34,7 @@ "tag": "v1.0.1", "commit": "263b98bcc9b746a8852bf57ce1500c71222680b9" }, - "_source": "git://github.com/polymerlabs/promise-polyfill.git", + "_source": "git://github.com/PolymerLabs/promise-polyfill.git", "_target": "^1.0.0", - "_originalSource": "polymerlabs/promise-polyfill" + "_originalSource": "PolymerLabs/promise-polyfill" } \ No newline at end of file diff --git a/lib/sw-toolbox/.bower.json b/lib/sw-toolbox/.bower.json index d5ad5423..0a0a00d5 100644 --- a/lib/sw-toolbox/.bower.json +++ b/lib/sw-toolbox/.bower.json @@ -12,12 +12,12 @@ "gulpfile.js" ], "homepage": "https://github.com/GoogleChrome/sw-toolbox", - "version": "3.3.0", - "_release": "3.3.0", + "version": "3.4.0", + "_release": "3.4.0", "_resolution": { "type": "version", - "tag": "v3.3.0", - "commit": "f2bd806f1f3c857b17ce84aba2d6aa636793b292" + "tag": "v3.4.0", + "commit": "f67bc1a7c69da54b600191b938f809c24881ef51" }, "_source": "https://github.com/GoogleChrome/sw-toolbox.git", "_target": "^3.1.1", diff --git a/lib/sw-toolbox/README.md b/lib/sw-toolbox/README.md index 877e72f3..3695a336 100644 --- a/lib/sw-toolbox/README.md +++ b/lib/sw-toolbox/README.md @@ -2,9 +2,9 @@ [![Build Status](https://travis-ci.org/GoogleChrome/sw-toolbox.svg?branch=master)](https://travis-ci.org/GoogleChrome/sw-toolbox) [![Dependency Status](https://david-dm.org/googlechrome/sw-toolbox.svg)](https://david-dm.org/googlechrome/sw-toolbox) [![devDependency Status](https://david-dm.org/googlechrome/sw-toolbox/dev-status.svg)](https://david-dm.org/googlechrome/sw-toolbox#info=devDependencies) -> A collection of tools for [service workers](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/) +> A collection of tools for [service workers](https://w3c.github.io/ServiceWorker/) -Service Worker Toolbox provides some simple helpers for use in creating your own service workers. Specifically, it provides common caching patterns and an [expressive approach](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-api#expressive-approach) to using those strategies for runtime requests. If you're not sure what service workers are or what they are for, start with [the explainer doc](https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md). +Service Worker Toolbox provides some simple helpers for use in creating your own service workers. Specifically, it provides common caching patterns and an [expressive approach](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-api.html#expressive-approach) to using those strategies for runtime requests. If you're not sure what service workers are or what they are for, start with [the explainer doc](https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md). ## Install @@ -23,9 +23,10 @@ From your registering page, register your service worker in the normal way. For ```javascript navigator.serviceWorker.register('my-service-worker.js'); ``` + As implemented in Chrome 40 or later, a service worker must exist at the root of the scope that you intend it to control, or higher. So if you want all of the pages under `/myapp/` to be controlled by the worker, the worker script itself must be served from either `/` or `/myapp/`. The default scope is the containing path of the service worker script. -For even lower friction you can instead include the Service Worker Toolbox companion script in your HTML as shown below. Be aware that this is not customizable. If you need to do anything fancier than registering with a default scope, you'll need to use the standard registration. +For even lower friction, you can instead include the Service Worker Toolbox companion script in your HTML as shown below. Be aware that this is not customizable. If you need to do anything fancier than register with a default scope, you'll need to use the standard registration. ```html @@ -33,25 +34,25 @@ For even lower friction you can instead include the Service Worker Toolbox compa ### Add Service Worker Toolbox to your service worker script -In your service worker you just need to use `importScripts` to load Service Worker Toolbox +In your service worker you just need to use `importScripts` to load Service Worker Toolbox: ```javascript -importScripts('bower_components/sw-toolbox/sw-toolbox.js'); // Update path to match your own setup +importScripts('bower_components/sw-toolbox/sw-toolbox.js'); // Update path to match your own setup. ``` ### Use the toolbox -To understand how to use the toolbox read the [usage](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-usage) and [api](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-api) documentation. +To understand how to use the toolbox read the [Usage](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-usage) and [API](https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-api) documentation. ## Support -If you’ve found an error in this library, please file an issue at: https://github.com/GoogleChrome/sw-toolbox/issues. +If you’ve found an error in this library, please file an issue at https://github.com/GoogleChrome/sw-toolbox/issues. -Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub. +Patches are encouraged, and may be submitted by forking this project and submitting a [pull request through this GitHub repo](https://github.com/GoogleChrome/sw-toolbox/pulls). ## License -Copyright 2015 Google, Inc. +Copyright 2015-2016 Google, Inc. Licensed under the [Apache License, Version 2.0](LICENSE) (the "License"); you may not use this file except in compliance with the License. You may diff --git a/lib/sw-toolbox/docs/_config.yml b/lib/sw-toolbox/docs/_config.yml new file mode 100644 index 00000000..c0b70098 --- /dev/null +++ b/lib/sw-toolbox/docs/_config.yml @@ -0,0 +1,3 @@ +source: . +layouts_dir: ./jekyll-theme/_layouts/ +includes_dir: ./jekyll-theme/_includes/ diff --git a/lib/sw-toolbox/docs/index.md b/lib/sw-toolbox/docs/index.md index 19f12545..4be09310 100644 --- a/lib/sw-toolbox/docs/index.md +++ b/lib/sw-toolbox/docs/index.md @@ -6,6 +6,55 @@ navigation_weight: 0 # Why +Service Worker Toolbox (or SW-Toolbox) provides some simple helpers for use +in creating your own service workers. Specifically, it provides common caching +patterns and an [expressive approach]({{ project_root_url }}/api#expressive-approach) +to using those strategies for runtime requests. If you're not sure what +service workers are or what they are for, start with +[the explainer doc](https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md). + # Install +Service Worker Toolbox is available through Bower, npm or direct from GitHub: + +`bower install --save sw-toolbox` + +`npm install --save sw-toolbox` + +`git clone https://github.com/GoogleChrome/sw-toolbox.git` + # Usage + +### Register your service worker + +From your registering page, register your service worker in the normal way. +For example: + +```javascript +navigator.serviceWorker.register('my-service-worker.js'); +``` +As implemented in Chrome 40 or later, a service worker must exist at the root +of the scope that you intend it to control, or higher. So if you want all of +the pages under `/myapp/` to be controlled by the worker, the worker script +itself must be served from either `/` or `/myapp/`. The default scope is the +containing path of the service worker script. + +For even lower friction you can instead include the Service Worker Toolbox +companion script in your HTML as shown below. Be aware that this is not +customizable. If you need to do anything fancier than registering with a +default scope, you'll need to use the standard registration. + +```html + +``` + +### Add Service Worker Toolbox to your service worker script + +In your service worker you just need to use `importScripts` to load Service Worker Toolbox + +```javascript +importScripts('bower_components/sw-toolbox/sw-toolbox.js'); // Update path to match your own setup +``` + +For more information on how to use the toolbox read +the [usage]({{ project_root_url }}/usage) and [api]({{ project_root_url }}/api) documentation. diff --git a/lib/sw-toolbox/docs/recipes.md b/lib/sw-toolbox/docs/recipes.md index b430f327..1e2483e7 100644 --- a/lib/sw-toolbox/docs/recipes.md +++ b/lib/sw-toolbox/docs/recipes.md @@ -6,7 +6,7 @@ navigation_weight: 3
  • -

    Cache Expiration

    +

    Cache Expiration

    Demonstrates using the maxEntries and maxAgeSeconds options to limit the number and age of entries stored in a cache dedicated to images fetched diff --git a/lib/sw-toolbox/docs/recipes/cache-expiration-options/app.js b/lib/sw-toolbox/docs/recipes/cache-expiration-options/app.js new file mode 100644 index 00000000..28acc85d --- /dev/null +++ b/lib/sw-toolbox/docs/recipes/cache-expiration-options/app.js @@ -0,0 +1,55 @@ +/* eslint-env browser */ +'use strict'; + +// Please register for your own YouTube API key! +// https://developers.google.com/youtube/v3/getting-started#before-you-start +const API_KEY = 'AIzaSyC4trKMxwT42TUFHmikCc4xxQTWWxq5S0g'; +const API_URL = 'https://www.googleapis.com/youtube/v3/search'; + +function serializeUrlParams(params) { + return Object.keys(params).map(key => { + return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]); + }).join('&'); +} + +function youtubeSearch(searchTerm, maxResults) { + let params = { + part: 'snippet', + maxResults: maxResults, + order: 'date', + key: API_KEY, + q: searchTerm + }; + + let url = new URL(API_URL); + url.search = serializeUrlParams(params); + + return fetch(url).then(response => { + if (response.ok) { + return response.json(); + } + throw new Error(`${response.status}: ${response.statusText}`); + }).then(function(json) { + return json.items; + }); +} + +document.querySelector('#search').addEventListener('submit', event => { + event.preventDefault(); + + var results = document.querySelector('#results'); + while (results.firstChild) { + results.removeChild(results.firstChild); + } + + let searchTerm = document.querySelector('#searchTerm').value; + let maxResults = document.querySelector('#maxResults').value; + + youtubeSearch(searchTerm, maxResults).then(videos => { + videos.forEach(video => { + let img = document.createElement('img'); + img.src = video.snippet.thumbnails.medium.url; + results.appendChild(img); + }); + }).catch(error => console.warn('YouTube search failed due to', error)); +}); diff --git a/lib/sw-toolbox/docs/recipes/cache-expiration-options/index.html b/lib/sw-toolbox/docs/recipes/cache-expiration-options/index.html new file mode 100644 index 00000000..e30b37cf --- /dev/null +++ b/lib/sw-toolbox/docs/recipes/cache-expiration-options/index.html @@ -0,0 +1,74 @@ + + + Cache Expiration Demo + + + + + +

    Cache Expiration Demo

    + +

    Background

    +

    + The service worker in this example + demonstrates using the maxCacheEntries and maxCacheAgeSeconds + options. It uses a dedicated cache to hold YouTube video thumbnails. That + dedicated cache will purge entries once they're older than 30 seconds, and store at most 10 + entries. It uses the cacheFirst strategy, so any responses that are still in the + cache will be used directly, without going against the network. +

    + +

    + While this example uses both maxCacheEntries and maxCacheAgeSeconds, + it's possible to use each of those options independently. +

    + +

    + The cache used for YouTube thumbnail URLs is separate from the "default" cache, which is + used for all other requests, like YouTube API responses and this page's CSS, JavaScript, and + HTML. The page doesn't impose any upper limit on the size of that default cache, and we can + use a networkFirst strategy for it. +

    + +

    + Creating a dedicated cache with expiration options for dynamic, unbounded requests is a useful + pattern to follow. If we just used the default cache without imposing a cache expiration, + then that cache would grow in size as more and more searches were performed, needlessly + consuming disk space for old thumbnails that are likely no longer needed. +

    + +

    Live Demo

    +

    + Try increasing the number of thumbnails returned, or changing the search term, and then + observe the cache expirations logged in the developer console. +

    + + +
    + + + + + diff --git a/lib/sw-toolbox/docs/recipes/cache-expiration-options/service-worker.js b/lib/sw-toolbox/docs/recipes/cache-expiration-options/service-worker.js new file mode 100644 index 00000000..a69822c1 --- /dev/null +++ b/lib/sw-toolbox/docs/recipes/cache-expiration-options/service-worker.js @@ -0,0 +1,38 @@ +(global => { + 'use strict'; + + // Load the sw-tookbox library. + importScripts('/build/sw-toolbox.js'); + + // Turn on debug logging, visible in the Developer Tools' console. + global.toolbox.options.debug = true; + + // Set up a handler for HTTP GET requests: + // - /\.ytimg\.com\// will match any requests whose URL contains 'ytimg.com'. + // A narrower RegExp could be used, but just checking for ytimg.com anywhere + // in the URL should be fine for this sample. + // - toolbox.cacheFirst let us to use the predefined cache strategy for those + // requests. + global.toolbox.router.get(/\.ytimg\.com\//, global.toolbox.cacheFirst, { + // Use a dedicated cache for the responses, separate from the default cache. + cache: { + name: 'youtube-thumbnails', + // Store up to 10 entries in that cache. + maxEntries: 10, + // Expire any entries that are older than 30 seconds. + maxAgeSeconds: 30 + } + }); + + // By default, all requests that don't match our custom handler will use the + // toolbox.networkFirst cache strategy, and their responses will be stored in + // the default cache. + global.toolbox.router.default = global.toolbox.networkFirst; + + // Boilerplate to ensure our service worker takes control of the page as soon + // as possible. + global.addEventListener('install', + event => event.waitUntil(global.skipWaiting())); + global.addEventListener('activate', + event => event.waitUntil(global.clients.claim())); +})(self); diff --git a/lib/sw-toolbox/docs/recipes/cache-expiration-options/styles.css b/lib/sw-toolbox/docs/recipes/cache-expiration-options/styles.css new file mode 100644 index 00000000..699f63ac --- /dev/null +++ b/lib/sw-toolbox/docs/recipes/cache-expiration-options/styles.css @@ -0,0 +1,10 @@ +#results { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +#results > img { + margin: 4px; + width: 320px; +} diff --git a/lib/sw-toolbox/docs/usage.md b/lib/sw-toolbox/docs/usage.md index f268c754..7ccf601c 100644 --- a/lib/sw-toolbox/docs/usage.md +++ b/lib/sw-toolbox/docs/usage.md @@ -58,7 +58,8 @@ toolbox.router.post('/(.*)', apiHandler, {origin: 'https://api.example.com'}); ## Regular Expression Routes Developers who are more comfortable using [regular expressions](https://regex101.com/) -can use an alternative syntax to define routes, passing in a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) +can use an alternative syntax to define routes, passing in a +[`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) object as the first parameter. This `RegExp` will be matched against the full request URL when determining whether the route applies, including the origin and path. This can lead to simpler cross-origin routing vs. Express-style routes, @@ -113,7 +114,8 @@ var myHandler = function(request, values, options) { } ``` -- `request` - The [Request](https://fetch.spec.whatwg.org/#request) object that triggered the `fetch` event +- `request` - The [Request](https://fetch.spec.whatwg.org/#request) object that +triggered the `fetch` event - `values` - When using Express-style routing paths, this will be an object whose keys are the placeholder names in the URL pattern, with the values being the corresponding part of the request URL. For example, with a URL pattern of @@ -122,4 +124,9 @@ the corresponding part of the request URL. For example, with a URL pattern of When using a RegExp for the path, `values` will not be set. - `options` - the [options](#options) passed to one of the [router methods](#methods). -The return value should be a [Response](https://fetch.spec.whatwg.org/#response), or a [Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) that resolves with a Response. If another value is returned, or if the returned Promise is rejected, the Request will fail which will appear to be a [NetworkError](https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-NetworkError) to the page that made the request. +The return value should be a [Response](https://fetch.spec.whatwg.org/#response), +or a [Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) that +resolves with a Response. If another value is returned, or if the returned +Promise is rejected, the Request will fail which will appear to be a +[NetworkError](https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-NetworkError) +to the page that made the request. diff --git a/lib/sw-toolbox/package.json b/lib/sw-toolbox/package.json index f2ea611f..7b3cd2f5 100644 --- a/lib/sw-toolbox/package.json +++ b/lib/sw-toolbox/package.json @@ -1,6 +1,6 @@ { "name": "sw-toolbox", - "version": "3.3.0", + "version": "3.4.0", "description": "Service Worker Toolbox provides some simple helpers for use in creating your own service workers.", "license": "Apache-2.0", "scripts": { @@ -18,8 +18,7 @@ "path-to-regexp": "^1.0.1" }, "devDependencies": { - "browserify": "^12.0.1", - "browserify-header": "^0.9.2", + "browserify": "^13.1.0", "chai": "^3.4.1", "chromedriver": "^2.24.1", "cookie-parser": "^1.4.1", @@ -30,9 +29,11 @@ "gulp": "^3.9.0", "gulp-eslint": "^1.1.1", "gulp-gh-pages": "^0.5.4", + "gulp-header": "^1.8.8", + "gulp-sourcemaps": "^1.6.0", + "gulp-uglify": "^2.0.0", "jsdoc": "^3.4.0", "jshint-stylish": "^2.1.0", - "minifyify": "^7.1.0", "mocha": "^2.3.4", "npm-publish-scripts": "^2.0.7", "operadriver": "^0.2.2", @@ -41,7 +42,14 @@ "selenium-webdriver": "^3.0.0-beta-2", "sw-testing-helpers": "0.1.4", "temp": "^0.8.3", + "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", "which": "^1.2.4" - } + }, + "files": [ + "lib/", + "companion.js", + "sw-toolbox.js", + "sw-toolbox.js.map" + ] } diff --git a/lib/sw-toolbox/sw-toolbox.js b/lib/sw-toolbox/sw-toolbox.js index 98302e4f..413fc72a 100644 --- a/lib/sw-toolbox/sw-toolbox.js +++ b/lib/sw-toolbox/sw-toolbox.js @@ -1,51 +1,16 @@ -/* - Copyright 2014 Google Inc. All Rights Reserved. +/* + Copyright 2016 Google Inc. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toolbox = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;or.value[TIMESTAMP_PROPERTY]){var t=r.value[URL_PROPERTY];u.push(t),s.delete(t),r.continue()}},c.oncomplete=function(){t(u)},c.onabort=o}):Promise.resolve([])}function expireExtraEntries(e,r){return r?new Promise(function(n,t){var o=[],i=e.transaction(STORE_NAME,"readwrite"),u=i.objectStore(STORE_NAME),c=u.index(TIMESTAMP_PROPERTY),s=c.count();c.count().onsuccess=function(){var e=s.result;e>r&&(c.openCursor().onsuccess=function(n){var t=n.target.result;if(t){var i=t.value[URL_PROPERTY];o.push(i),u.delete(i),e-o.length>r&&t.continue()}})},i.oncomplete=function(){n(o)},i.onabort=t}):Promise.resolve([])}function expireEntries(e,r,n,t){return expireOldEntries(e,n,t).then(function(n){return expireExtraEntries(e,r).then(function(e){return n.concat(e)})})}var DB_PREFIX="sw-toolbox-",DB_VERSION=1,STORE_NAME="store",URL_PROPERTY="url",TIMESTAMP_PROPERTY="timestamp",cacheNameToDbPromise={};module.exports={getDb:getDb,setTimestampForUrl:setTimestampForUrl,expireEntries:expireEntries}; -},{}],3:[function(require,module,exports){ -"use strict";var scope;scope=self.registration?self.registration.scope:self.scope||new URL("./",self.location).href,module.exports={cache:{name:"$$$toolbox-cache$$$"+scope+"$$$",maxAgeSeconds:null,maxEntries:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}; -},{}],4:[function(require,module,exports){ -"use strict";var url=new URL("./",self.location),basePath=url.pathname,pathRegexp=require("path-to-regexp"),Route=function(e,t,i,s){t instanceof RegExp?this.fullUrlRegExp=t:(0!==t.indexOf("/")&&(t=basePath+t),this.keys=[],this.regexp=pathRegexp(t,this.keys)),this.method=e,this.options=s,this.handler=i};Route.prototype.makeHandler=function(e){var t;if(this.regexp){var i=this.regexp.exec(e);t={},this.keys.forEach(function(e,s){t[e.name]=i[s+1]})}return function(e){return this.handler(e,t,this.options)}.bind(this)},module.exports=Route; -},{"path-to-regexp":14}],5:[function(require,module,exports){ -"use strict";function regexEscape(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var Route=require("./route"),helpers=require("./helpers"),keyMatch=function(e,t){for(var r=e.entries(),o=r.next(),n=[];!o.done;){var u=new RegExp(o.value[0]);u.test(t)&&n.push(o.value[1]),o=r.next()}return n},Router=function(){this.routes=new Map,this.routes.set(RegExp,new Map),this.default=null};["get","post","put","delete","head","any"].forEach(function(e){Router.prototype[e]=function(t,r,o){return this.add(e,t,r,o)}}),Router.prototype.add=function(e,t,r,o){o=o||{};var n;t instanceof RegExp?n=RegExp:(n=o.origin||self.location.origin,n=n instanceof RegExp?n.source:regexEscape(n)),e=e.toLowerCase();var u=new Route(e,t,r,o);this.routes.has(n)||this.routes.set(n,new Map);var s=this.routes.get(n);s.has(e)||s.set(e,new Map);var a=s.get(e),h=u.regexp||u.fullUrlRegExp;a.has(h.source)&&helpers.debug('"'+t+'" resolves to same regex as existing route.'),a.set(h.source,u)},Router.prototype.matchMethod=function(e,t){var r=new URL(t),o=r.origin,n=r.pathname;return this._match(e,keyMatch(this.routes,o),n)||this._match(e,[this.routes.get(RegExp)],t)},Router.prototype._match=function(e,t,r){if(0===t.length)return null;for(var o=0;o0)return s[0].makeHandler(r)}}return null},Router.prototype.match=function(e){return this.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},module.exports=new Router; -},{"./helpers":1,"./route":4}],6:[function(require,module,exports){ -"use strict";function cacheFirst(e,r,t){return helpers.debug("Strategy: cache first ["+e.url+"]",t),helpers.openCache(t).then(function(r){return r.match(e).then(function(r){return r?r:helpers.fetchAndCache(e,t)})})}var helpers=require("../helpers");module.exports=cacheFirst; -},{"../helpers":1}],7:[function(require,module,exports){ -"use strict";function cacheOnly(e,r,c){return helpers.debug("Strategy: cache only ["+e.url+"]",c),helpers.openCache(c).then(function(r){return r.match(e)})}var helpers=require("../helpers");module.exports=cacheOnly; -},{"../helpers":1}],8:[function(require,module,exports){ -"use strict";function fastest(e,n,t){return helpers.debug("Strategy: fastest ["+e.url+"]",t),new Promise(function(r,s){var c=!1,o=[],a=function(e){o.push(e.toString()),c?s(new Error('Both cache and network failed: "'+o.join('", "')+'"')):c=!0},h=function(e){e instanceof Response?r(e):a("No result returned")};helpers.fetchAndCache(e.clone(),t).then(h,a),cacheOnly(e,n,t).then(h,a)})}var helpers=require("../helpers"),cacheOnly=require("./cacheOnly");module.exports=fastest; -},{"../helpers":1,"./cacheOnly":7}],9:[function(require,module,exports){ -module.exports={networkOnly:require("./networkOnly"),networkFirst:require("./networkFirst"),cacheOnly:require("./cacheOnly"),cacheFirst:require("./cacheFirst"),fastest:require("./fastest")}; -},{"./cacheFirst":6,"./cacheOnly":7,"./fastest":8,"./networkFirst":10,"./networkOnly":11}],10:[function(require,module,exports){ -"use strict";function networkFirst(e,r,t){t=t||{};var s=t.successResponses||globalOptions.successResponses,n=t.networkTimeoutSeconds||globalOptions.networkTimeoutSeconds;return helpers.debug("Strategy: network first ["+e.url+"]",t),helpers.openCache(t).then(function(r){var o,u,i=[];if(n){var c=new Promise(function(t){o=setTimeout(function(){r.match(e).then(function(e){e&&t(e)})},1e3*n)});i.push(c)}var a=helpers.fetchAndCache(e,t).then(function(e){if(o&&clearTimeout(o),s.test(e.status))return e;throw helpers.debug("Response was an HTTP error: "+e.statusText,t),u=e,new Error("Bad response")}).catch(function(s){return helpers.debug("Network or response error, fallback to cache ["+e.url+"]",t),r.match(e).then(function(e){if(e)return e;if(u)return u;throw s})});return i.push(a),Promise.race(i)})}var globalOptions=require("../options"),helpers=require("../helpers");module.exports=networkFirst; -},{"../helpers":1,"../options":3}],11:[function(require,module,exports){ -"use strict";function networkOnly(e,r,t){return helpers.debug("Strategy: network only ["+e.url+"]",t),fetch(e)}var helpers=require("../helpers");module.exports=networkOnly; -},{"../helpers":1}],12:[function(require,module,exports){ -"use strict";function cache(e,t){return helpers.openCache(t).then(function(t){return t.add(e)})}function uncache(e,t){return helpers.openCache(t).then(function(t){return t.delete(e)})}function precache(e){e instanceof Promise||validatePrecacheInput(e),options.preCacheItems=options.preCacheItems.concat(e)}require("serviceworker-cache-polyfill");var options=require("./options"),router=require("./router"),helpers=require("./helpers"),strategies=require("./strategies");helpers.debug("Service Worker Toolbox is loading");var flatten=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},validatePrecacheInput=function(e){var t=Array.isArray(e);if(t&&e.forEach(function(e){"string"==typeof e||e instanceof Request||(t=!1)}),!t)throw new TypeError("The precache method expects either an array of strings and/or Requests or a Promise that resolves to an array of strings and/or Requests.");return e};self.addEventListener("install",function(e){var t=options.cache.name+"$$$inactive$$$";helpers.debug("install event fired"),helpers.debug("creating cache ["+t+"]"),e.waitUntil(helpers.openCache({cache:{name:t}}).then(function(e){return Promise.all(options.preCacheItems).then(flatten).then(validatePrecacheInput).then(function(t){return helpers.debug("preCache list: "+(t.join(", ")||"(none)")),e.addAll(t)})}))}),self.addEventListener("activate",function(e){helpers.debug("activate event fired");var t=options.cache.name+"$$$inactive$$$";e.waitUntil(helpers.renameCache(t,options.cache.name))}),self.addEventListener("fetch",function(e){var t=router.match(e.request);t?e.respondWith(t(e.request)):router.default&&"GET"===e.request.method&&e.respondWith(router.default(e.request))}),module.exports={networkOnly:strategies.networkOnly,networkFirst:strategies.networkFirst,cacheOnly:strategies.cacheOnly,cacheFirst:strategies.cacheFirst,fastest:strategies.fastest,router:router,options:options,cache:cache,uncache:uncache,precache:precache}; -},{"./helpers":1,"./options":3,"./router":5,"./strategies":9,"serviceworker-cache-polyfill":15}],13:[function(require,module,exports){ -module.exports=Array.isArray||function(r){return"[object Array]"==Object.prototype.toString.call(r)}; -},{}],14:[function(require,module,exports){ -function parse(e){for(var t,r=[],n=0,o=0,a="";null!=(t=PATH_REGEXP.exec(e));){var p=t[0],i=t[1],s=t.index;if(a+=e.slice(o,s),o=s+p.length,i)a+=i[1];else{var c=e[o],u=t[2],l=t[3],f=t[4],g=t[5],x=t[6],h=t[7];a&&(r.push(a),a="");var d=null!=u&&null!=c&&c!==u,y="+"===x||"*"===x,m="?"===x||"*"===x,R=t[2]||"/",T=f||g||(h?".*":"[^"+R+"]+?");r.push({name:l||n++,prefix:u||"",delimiter:R,optional:m,repeat:y,partial:d,asterisk:!!h,pattern:escapeGroup(T)})}}return o=46||"Chrome"===r&&n>=50)||(Cache.prototype.addAll=function(t){function e(t){this.name="NetworkError",this.code=19,this.message=t}var r=this;return e.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)throw new TypeError;return t=t.map(function(t){return t instanceof Request?t:String(t)}),Promise.all(t.map(function(t){"string"==typeof t&&(t=new Request(t));var r=new URL(t.url).protocol;if("http:"!==r&&"https:"!==r)throw new e("Invalid scheme");return fetch(t.clone())}))}).then(function(n){if(n.some(function(t){return!t.ok}))throw new e("Incorrect response status");return Promise.all(n.map(function(e,n){return r.put(t[n],e)}))}).then(function(){})},Cache.prototype.add=function(t){return this.addAll([t])})}(); -},{}]},{},[12])(12) -}); - - -//# sourceMappingURL=./build/sw-toolbox.map.json \ No newline at end of file + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.toolbox=e()}}(function(){return function e(t,n,r){function o(c,s){if(!n[c]){if(!t[c]){var a="function"==typeof require&&require;if(!s&&a)return a(c,!0);if(i)return i(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[c]={exports:{}};t[c][0].call(f.exports,function(e){var n=t[c][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[c].exports}for(var i="function"==typeof require&&require,c=0;ct.value[l]){var r=t.value[p];c.push(r),a.delete(r),t.continue()}},s.oncomplete=function(){r(c)},s.onabort=o}):Promise.resolve([])}function s(e,t){return t?new Promise(function(n,r){var o=[],i=e.transaction(h,"readwrite"),c=i.objectStore(h),s=c.index(l),a=s.count();s.count().onsuccess=function(){var e=a.result;e>t&&(s.openCursor().onsuccess=function(n){var r=n.target.result;if(r){var i=r.value[p];o.push(i),c.delete(i),e-o.length>t&&r.continue()}})},i.oncomplete=function(){n(o)},i.onabort=r}):Promise.resolve([])}function a(e,t,n,r){return c(e,n,r).then(function(n){return s(e,t).then(function(e){return n.concat(e)})})}var u="sw-toolbox-",f=1,h="store",p="url",l="timestamp",d={};t.exports={getDb:o,setTimestampForUrl:i,expireEntries:a}},{}],3:[function(e,t,n){"use strict";function r(e){var t=a.match(e.request);t?e.respondWith(t(e.request)):a.default&&"GET"===e.request.method&&0===e.request.url.indexOf("http")&&e.respondWith(a.default(e.request))}function o(e){s.debug("activate event fired");var t=u.cache.name+"$$$inactive$$$";e.waitUntil(s.renameCache(t,u.cache.name))}function i(e){return e.reduce(function(e,t){return e.concat(t)},[])}function c(e){var t=u.cache.name+"$$$inactive$$$";s.debug("install event fired"),s.debug("creating cache ["+t+"]"),e.waitUntil(s.openCache({cache:{name:t}}).then(function(e){return Promise.all(u.preCacheItems).then(i).then(s.validatePrecacheInput).then(function(t){return s.debug("preCache list: "+(t.join(", ")||"(none)")),e.addAll(t)})}))}e("serviceworker-cache-polyfill");var s=e("./helpers"),a=e("./router"),u=e("./options");t.exports={fetchListener:r,activateListener:o,installListener:c}},{"./helpers":1,"./options":4,"./router":6,"serviceworker-cache-polyfill":16}],4:[function(e,t,n){"use strict";var r;r=self.registration?self.registration.scope:self.scope||new URL("./",self.location).href,t.exports={cache:{name:"$$$toolbox-cache$$$"+r+"$$$",maxAgeSeconds:null,maxEntries:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}},{}],5:[function(e,t,n){"use strict";var r=new URL("./",self.location),o=r.pathname,i=e("path-to-regexp"),c=function(e,t,n,r){t instanceof RegExp?this.fullUrlRegExp=t:(0!==t.indexOf("/")&&(t=o+t),this.keys=[],this.regexp=i(t,this.keys)),this.method=e,this.options=r,this.handler=n};c.prototype.makeHandler=function(e){var t;if(this.regexp){var n=this.regexp.exec(e);t={},this.keys.forEach(function(e,r){t[e.name]=n[r+1]})}return function(e){return this.handler(e,t,this.options)}.bind(this)},t.exports=c},{"path-to-regexp":15}],6:[function(e,t,n){"use strict";function r(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var o=e("./route"),i=e("./helpers"),c=function(e,t){for(var n=e.entries(),r=n.next(),o=[];!r.done;){var i=new RegExp(r.value[0]);i.test(t)&&o.push(r.value[1]),r=n.next()}return o},s=function(){this.routes=new Map,this.routes.set(RegExp,new Map),this.default=null};["get","post","put","delete","head","any"].forEach(function(e){s.prototype[e]=function(t,n,r){return this.add(e,t,n,r)}}),s.prototype.add=function(e,t,n,c){c=c||{};var s;t instanceof RegExp?s=RegExp:(s=c.origin||self.location.origin,s=s instanceof RegExp?s.source:r(s)),e=e.toLowerCase();var a=new o(e,t,n,c);this.routes.has(s)||this.routes.set(s,new Map);var u=this.routes.get(s);u.has(e)||u.set(e,new Map);var f=u.get(e),h=a.regexp||a.fullUrlRegExp;f.has(h.source)&&i.debug('"'+t+'" resolves to same regex as existing route.'),f.set(h.source,a)},s.prototype.matchMethod=function(e,t){var n=new URL(t),r=n.origin,o=n.pathname;return this._match(e,c(this.routes,r),o)||this._match(e,[this.routes.get(RegExp)],t)},s.prototype._match=function(e,t,n){if(0===t.length)return null;for(var r=0;r0)return s[0].makeHandler(n)}}return null},s.prototype.match=function(e){return this.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},t.exports=new s},{"./helpers":1,"./route":5}],7:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: cache first ["+e.url+"]",n),o.openCache(n).then(function(t){return t.match(e).then(function(t){return t?t:o.fetchAndCache(e,n)})})}var o=e("../helpers");t.exports=r},{"../helpers":1}],8:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: cache only ["+e.url+"]",n),o.openCache(n).then(function(t){return t.match(e)})}var o=e("../helpers");t.exports=r},{"../helpers":1}],9:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: fastest ["+e.url+"]",n),new Promise(function(r,c){var s=!1,a=[],u=function(e){a.push(e.toString()),s?c(new Error('Both cache and network failed: "'+a.join('", "')+'"')):s=!0},f=function(e){e instanceof Response?r(e):u("No result returned")};o.fetchAndCache(e.clone(),n).then(f,u),i(e,t,n).then(f,u)})}var o=e("../helpers"),i=e("./cacheOnly");t.exports=r},{"../helpers":1,"./cacheOnly":8}],10:[function(e,t,n){t.exports={networkOnly:e("./networkOnly"),networkFirst:e("./networkFirst"),cacheOnly:e("./cacheOnly"),cacheFirst:e("./cacheFirst"),fastest:e("./fastest")}},{"./cacheFirst":7,"./cacheOnly":8,"./fastest":9,"./networkFirst":11,"./networkOnly":12}],11:[function(e,t,n){"use strict";function r(e,t,n){n=n||{};var r=n.successResponses||o.successResponses,c=n.networkTimeoutSeconds||o.networkTimeoutSeconds;return i.debug("Strategy: network first ["+e.url+"]",n),i.openCache(n).then(function(t){var o,s,a=[];if(c){var u=new Promise(function(n){o=setTimeout(function(){t.match(e).then(function(e){e&&n(e)})},1e3*c)});a.push(u)}var f=i.fetchAndCache(e,n).then(function(e){if(o&&clearTimeout(o),r.test(e.status))return e;throw i.debug("Response was an HTTP error: "+e.statusText,n),s=e,new Error("Bad response")}).catch(function(r){return i.debug("Network or response error, fallback to cache ["+e.url+"]",n),t.match(e).then(function(e){if(e)return e;if(s)return s;throw r})});return a.push(f),Promise.race(a)})}var o=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],12:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: network only ["+e.url+"]",n),fetch(e)}var o=e("../helpers");t.exports=r},{"../helpers":1}],13:[function(e,t,n){"use strict";var r=e("./options"),o=e("./router"),i=e("./helpers"),c=e("./strategies"),s=e("./listeners");i.debug("Service Worker Toolbox is loading"),self.addEventListener("install",s.installListener),self.addEventListener("activate",s.activateListener),self.addEventListener("fetch",s.fetchListener),t.exports={networkOnly:c.networkOnly,networkFirst:c.networkFirst,cacheOnly:c.cacheOnly,cacheFirst:c.cacheFirst,fastest:c.fastest,router:o,options:r,cache:i.cache,uncache:i.uncache,precache:i.precache}},{"./helpers":1,"./listeners":3,"./options":4,"./router":6,"./strategies":10}],14:[function(e,t,n){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],15:[function(e,t,n){function r(e){for(var t,n=[],r=0,o=0,i="";null!=(t=x.exec(e));){var c=t[0],s=t[1],a=t.index;if(i+=e.slice(o,a),o=a+c.length,s)i+=s[1];else{var f=e[o],h=t[2],p=t[3],l=t[4],d=t[5],g=t[6],m=t[7];i&&(n.push(i),i="");var v=null!=h&&null!=f&&f!==h,w="+"===g||"*"===g,y="?"===g||"*"===g,b=t[2]||"/",E=l||d||(m?".*":"[^"+b+"]+?");n.push({name:p||r++,prefix:h||"",delimiter:b,optional:y,repeat:w,partial:v,asterisk:!!m,pattern:u(E)})}}return o=46||"Chrome"===n&&r>=50)||(Cache.prototype.addAll=function(e){function t(e){this.name="NetworkError",this.code=19,this.message=e}var n=this;return t.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)throw new TypeError;return e=e.map(function(e){return e instanceof Request?e:String(e)}),Promise.all(e.map(function(e){"string"==typeof e&&(e=new Request(e));var n=new URL(e.url).protocol;if("http:"!==n&&"https:"!==n)throw new t("Invalid scheme");return fetch(e.clone())}))}).then(function(r){if(r.some(function(e){return!e.ok}))throw new t("Incorrect response status");return Promise.all(r.map(function(t,r){return n.put(e[r],t)}))}).then(function(){})},Cache.prototype.add=function(e){return this.addAll([e])})}()},{}]},{},[13])(13)}); +//# sourceMappingURL=sw-toolbox.js.map diff --git a/lib/sw-toolbox/sw-toolbox.js.map b/lib/sw-toolbox/sw-toolbox.js.map new file mode 100644 index 00000000..e869f6f2 --- /dev/null +++ b/lib/sw-toolbox/sw-toolbox.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","lib/helpers.js","lib/idb-cache-expiration.js","lib/listeners.js","lib/options.js","lib/route.js","lib/router.js","lib/strategies/cacheFirst.js","lib/strategies/cacheOnly.js","lib/strategies/fastest.js","lib/strategies/index.js","lib/strategies/networkFirst.js","lib/strategies/networkOnly.js","lib/sw-toolbox.js","node_modules/isarray/index.js","node_modules/path-to-regexp/index.js","node_modules/serviceworker-cache-polyfill/index.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","toolbox","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","debug","message","options","flag","globalOptions","console","log","openCache","cacheName","cache","name","caches","open","fetchAndCache","request","successResponses","fetch","clone","then","response","method","test","status","put","cacheOptions","maxEntries","maxAgeSeconds","queueCacheExpiration","cleanup","cleanupCache","bind","cleanupQueue","requestUrl","url","now","Date","idbCacheExpiration","getDb","db","setTimestampForUrl","expireEntries","urlsToDelete","deletionPromises","map","urlToDelete","delete","Promise","all","catch","error","renameCache","source","destination","results","sourceCache","destCache","keys","requests","match","add","uncache","precache","items","validatePrecacheInput","preCacheItems","concat","isValid","Array","isArray","forEach","item","Request","TypeError","openDb","resolve","reject","indexedDB","DB_PREFIX","DB_VERSION","onupgradeneeded","objectStore","result","createObjectStore","STORE_NAME","keyPath","URL_PROPERTY","createIndex","TIMESTAMP_PROPERTY","unique","onsuccess","onerror","cacheNameToDbPromise","transaction","timestamp","oncomplete","onabort","expireOldEntries","maxAgeMillis","urls","index","openCursor","cursorEvent","cursor","target","value","push","continue","expireExtraEntries","countRequest","count","initialCount","oldUrls","extraUrls","fetchListener","event","handler","router","respondWith","default","indexOf","activateListener","helpers","inactiveCache","waitUntil","flatten","reduce","b","installListener","join","addAll","scope","registration","URL","location","href","networkTimeoutSeconds","basePath","pathname","pathRegexp","Route","path","RegExp","fullUrlRegExp","regexp","prototype","makeHandler","values","exec","key","regexEscape","replace","keyMatch","string","entriesIterator","entries","next","matches","done","pattern","Router","routes","Map","set","origin","toLowerCase","route","has","methodMap","get","routeMap","regExp","matchMethod","urlObject","_match","methodMaps","pathOrUrl","cacheFirst","cacheOnly","fastest","rejected","reasons","maybeReject","reason","toString","maybeResolve","Response","networkOnly","networkFirst","timeoutId","originalResponse","promises","cacheWhenTimedOutPromise","setTimeout","networkPromise","clearTimeout","statusText","race","strategies","listeners","addEventListener","arr","Object","parse","str","res","tokens","PATH_REGEXP","m","escaped","offset","slice","prefix","capture","group","modifier","asterisk","partial","repeat","optional","delimiter","escapeGroup","substr","compile","tokensToFunction","encodeURIComponentPretty","encodeURI","c","charCodeAt","toUpperCase","encodeAsterisk","obj","opts","data","encode","pretty","encodeURIComponent","token","segment","isarray","JSON","stringify","j","escapeString","attachKeys","re","flags","sensitive","regexpToRegexp","groups","arrayToRegexp","parts","pathToRegexp","stringToRegexp","tokensToRegExp","strict","end","lastToken","endsWithSlash","nativeAddAll","Cache","userAgent","navigator","agent","version","parseInt","NetworkError","create","arguments","String","scheme","protocol","responses","some","ok"],"mappings":";;;;;;;;;;;;;;GAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,QAAAV,MAAA,WAAA,MAAA,SAAAW,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAhB,GAAA,GAAAqB,OAAA,uBAAAL,EAAA,IAAA,MAAAhB,GAAAsB,KAAA,mBAAAtB,EAAA,GAAAuB,GAAAV,EAAAG,IAAAf,WAAAW,GAAAI,GAAA,GAAAQ,KAAAD,EAAAtB,QAAA,SAAAU,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,EAAAA,EAAAF,IAAAY,EAAAA,EAAAtB,QAAAU,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAf,QAAA,IAAA,GAAAmB,GAAA,kBAAAD,UAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAW,OAAAT,IAAAD,EAAAD,EAAAE,GAAA,OAAAD,KAAAW,GAAA,SAAAP,EAAAjB,EAAAD,GCeA,YAKA,SAAA0B,GAAAC,EAAAC,GACAA,EAAAA,KACA,IAAAC,GAAAD,EAAAF,OAAAI,EAAAJ,KACAG,IACAE,QAAAC,IAAA,gBAAAL,GAIA,QAAAM,GAAAL,GACA,GAAAM,EAMA,OALAN,IAAAA,EAAAO,QACAD,EAAAN,EAAAO,MAAAC,MAEAF,EAAAA,GAAAJ,EAAAK,MAAAC,KAEAC,OAAAC,KAAAJ,GAGA,QAAAK,GAAAC,EAAAZ,GACAA,EAAAA,KACA,IAAAa,GAAAb,EAAAa,kBACAX,EAAAW,gBAEA,OAAAC,OAAAF,EAAAG,SAAAC,KAAA,SAAAC,GAwBA,MAnBA,QAAAL,EAAAM,QAAAL,EAAAM,KAAAF,EAAAG,SACAf,EAAAL,GAAAgB,KAAA,SAAAT,GACAA,EAAAc,IAAAT,EAAAK,GAAAD,KAAA,WAIA,GAAAM,GAAAtB,EAAAO,OAAAL,EAAAK,OAKAe,EAAAC,YAAAD,EAAAE,gBACAF,EAAAd,MACAiB,EAAAb,EAAAL,EAAAe,OAMAL,EAAAF,UAKA,QAAAU,GAAAb,EAAAL,EAAAe,GACA,GAAAI,GAAAC,EAAAC,KAAA,KAAAhB,EAAAL,EAAAe,EAGAO,GADAA,EACAA,EAAAb,KAAAU,GAEAA,IAIA,QAAAC,GAAAf,EAAAL,EAAAe,GACA,GAAAQ,GAAAlB,EAAAmB,IACAP,EAAAF,EAAAE,cACAD,EAAAD,EAAAC,WACAjB,EAAAgB,EAAAd,KAEAwB,EAAAC,KAAAD,KAIA,OAHAlC,GAAA,0BAAAgC,EAAA,oBACAP,EAAA,gBAAAC,GAEAU,EAAAC,MAAA7B,GAAAU,KAAA,SAAAoB,GACA,MAAAF,GAAAG,mBAAAD,EAAAN,EAAAE,KACAhB,KAAA,SAAAoB,GACA,MAAAF,GAAAI,cAAAF,EAAAb,EAAAC,EAAAQ,KACAhB,KAAA,SAAAuB,GACAzC,EAAA,4BAEA,IAAA0C,GAAAD,EAAAE,IAAA,SAAAC,GACA,MAAAnC,GAAAoC,OAAAD,IAGA,OAAAE,SAAAC,IAAAL,GAAAxB,KAAA,WACAlB,EAAA,gCAEAgD,MAAA,SAAAC,GACAjD,EAAAiD,KAIA,QAAAC,GAAAC,EAAAC,EAAAlD,GAEA,MADAF,GAAA,oBAAAmD,EAAA,SAAAC,EAAA,IAAAlD,GACAS,OAAAkC,OAAAO,GAAAlC,KAAA,WACA,MAAA4B,SAAAC,KACApC,OAAAC,KAAAuC,GACAxC,OAAAC,KAAAwC,KACAlC,KAAA,SAAAmC,GACA,GAAAC,GAAAD,EAAA,GACAE,EAAAF,EAAA,EAEA,OAAAC,GAAAE,OAAAtC,KAAA,SAAAuC,GACA,MAAAX,SAAAC,IAAAU,EAAAd,IAAA,SAAA7B,GACA,MAAAwC,GAAAI,MAAA5C,GAAAI,KAAA,SAAAC,GACA,MAAAoC,GAAAhC,IAAAT,EAAAK,UAGAD,KAAA,WACA,MAAAP,QAAAkC,OAAAM,SAMA,QAAA1C,GAAAwB,EAAA/B,GACA,MAAAK,GAAAL,GAAAgB,KAAA,SAAAT,GACA,MAAAA,GAAAkD,IAAA1B,KAIA,QAAA2B,GAAA3B,EAAA/B,GACA,MAAAK,GAAAL,GAAAgB,KAAA,SAAAT,GACA,MAAAA,GAAAoC,OAAAZ,KAIA,QAAA4B,GAAAC,GACAA,YAAAhB,UACAiB,EAAAD,GAGA1D,EAAA4D,cAAA5D,EAAA4D,cAAAC,OAAAH,GAGA,QAAAC,GAAAD,GACA,GAAAI,GAAAC,MAAAC,QAAAN,EASA,IARAI,GACAJ,EAAAO,QAAA,SAAAC,GACA,gBAAAA,IAAAA,YAAAC,WACAL,GAAA,MAKAA,EACA,KAAA,IAAAM,WAAA,4IAKA,OAAAV,GAzJA,GAsDA/B,GAtDA3B,EAAAZ,EAAA,aACA4C,EAAA5C,EAAA,yBA2JAjB,GAAAD,SACA0B,MAAAA,EACAa,cAAAA,EACAN,UAAAA,EACA2C,YAAAA,EACAzC,MAAAA,EACAmD,QAAAA,EACAC,SAAAA,EACAE,sBAAAA,mECtKA,YASA,SAAAU,GAAAjE,GACA,MAAA,IAAAsC,SAAA,SAAA4B,EAAAC,GACA,GAAA7D,GAAA8D,UAAAhE,KAAAiE,EAAArE,EAAAsE,EAEAhE,GAAAiE,gBAAA,WACA,GAAAC,GAAAlE,EAAAmE,OAAAC,kBAAAC,GACAC,QAAAC,GACAL,GAAAM,YAAAC,EAAAA,GACAC,QAAA,KAGA1E,EAAA2E,UAAA,WACAf,EAAA5D,EAAAmE,SAGAnE,EAAA4E,QAAA,WACAf,EAAA7D,EAAAmC,UAKA,QAAAZ,GAAA7B,GAKA,MAJAA,KAAAmF,KACAA,EAAAnF,GAAAiE,EAAAjE,IAGAmF,EAAAnF,GAGA,QAAA+B,GAAAD,EAAAL,EAAAC,GACA,MAAA,IAAAY,SAAA,SAAA4B,EAAAC,GACA,GAAAiB,GAAAtD,EAAAsD,YAAAT,EAAA,aACAH,EAAAY,EAAAZ,YAAAG,EACAH,GAAAzD,KAAAU,IAAAA,EAAA4D,UAAA3D,IAEA0D,EAAAE,WAAA,WACApB,EAAApC,IAGAsD,EAAAG,QAAA,WACApB,EAAAiB,EAAA3C,UAKA,QAAA+C,GAAA1D,EAAAZ,EAAAQ,GAGA,MAAAR,GAIA,GAAAoB,SAAA,SAAA4B,EAAAC,GACA,GAAAsB,GAAA,IAAAvE,EACAwE,KAEAN,EAAAtD,EAAAsD,YAAAT,EAAA,aACAH,EAAAY,EAAAZ,YAAAG,GACAgB,EAAAnB,EAAAmB,MAAAZ,EAEAY,GAAAC,aAAAX,UAAA,SAAAY,GACA,GAAAC,GAAAD,EAAAE,OAAAtB,MACA,IAAAqB,GACApE,EAAA+D,EAAAK,EAAAE,MAAAjB,GAAA,CACA,GAAAtD,GAAAqE,EAAAE,MAAAnB,EACAa,GAAAO,KAAAxE,GACA+C,EAAAnC,OAAAZ,GACAqE,EAAAI,aAKAd,EAAAE,WAAA,WACApB,EAAAwB,IAGAN,EAAAG,QAAApB,IA3BA7B,QAAA4B,YA+BA,QAAAiC,GAAArE,EAAAb,GAGA,MAAAA,GAIA,GAAAqB,SAAA,SAAA4B,EAAAC,GACA,GAAAuB,MAEAN,EAAAtD,EAAAsD,YAAAT,EAAA,aACAH,EAAAY,EAAAZ,YAAAG,GACAgB,EAAAnB,EAAAmB,MAAAZ,GAEAqB,EAAAT,EAAAU,OACAV,GAAAU,QAAApB,UAAA,WACA,GAAAqB,GAAAF,EAAA3B,MAEA6B,GAAArF,IACA0E,EAAAC,aAAAX,UAAA,SAAAY,GACA,GAAAC,GAAAD,EAAAE,OAAAtB,MACA,IAAAqB,EAAA,CACA,GAAArE,GAAAqE,EAAAE,MAAAnB,EACAa,GAAAO,KAAAxE,GACA+C,EAAAnC,OAAAZ,GACA6E,EAAAZ,EAAApG,OAAA2B,GACA6E,EAAAI,eAOAd,EAAAE,WAAA,WACApB,EAAAwB,IAGAN,EAAAG,QAAApB,IAjCA7B,QAAA4B,YAqCA,QAAAlC,GAAAF,EAAAb,EAAAC,EAAAQ,GACA,MAAA8D,GAAA1D,EAAAZ,EAAAQ,GAAAhB,KAAA,SAAA6F,GACA,MAAAJ,GAAArE,EAAAb,GAAAP,KAAA,SAAA8F,GACA,MAAAD,GAAA9C,OAAA+C,OAnIA,GAAAnC,GAAA,cACAC,EAAA,EACAK,EAAA,QACAE,EAAA,MACAE,EAAA,YACAI,IAmIApH,GAAAD,SACA+D,MAAAA,EACAE,mBAAAA,EACAC,cAAAA,2BC7IA,YAWA,SAAAyE,GAAAC,GACA,GAAAC,GAAAC,EAAA1D,MAAAwD,EAAApG,QAEAqG,GACAD,EAAAG,YAAAF,EAAAD,EAAApG,UACAsG,EAAAE,SACA,QAAAJ,EAAApG,QAAAM,QAEA,IAAA8F,EAAApG,QAAAmB,IAAAsF,QAAA,SACAL,EAAAG,YAAAD,EAAAE,QAAAJ,EAAApG,UAIA,QAAA0G,GAAAN,GACAO,EAAAzH,MAAA,uBACA,IAAA0H,GAAAxH,EAAAO,MAAAC,KAAA,gBACAwG,GAAAS,UAAAF,EAAAvE,YAAAwE,EAAAxH,EAAAO,MAAAC,OAGA,QAAAkH,GAAA9D,GACA,MAAAA,GAAA+D,OAAA,SAAAtI,EAAAuI,GACA,MAAAvI,GAAA0E,OAAA6D,QAIA,QAAAC,GAAAb,GACA,GAAAQ,GAAAxH,EAAAO,MAAAC,KAAA,gBACA+G,GAAAzH,MAAA,uBACAyH,EAAAzH,MAAA,mBAAA0H,EAAA,KACAR,EAAAS,UACAF,EAAAlH,WAAAE,OAAAC,KAAAgH,KACAxG,KAAA,SAAAT,GACA,MAAAqC,SAAAC,IAAA7C,EAAA8D,eACA9C,KAAA0G,GACA1G,KAAAuG,EAAA1D,uBACA7C,KAAA,SAAA8C,GAGA,MAFAyD,GAAAzH,MAAA,mBACAgE,EAAAgE,KAAA,OAAA,WACAvH,EAAAwH,OAAAjE,QA9CAxE,EAAA,+BAEA,IAAAiI,GAAAjI,EAAA,aACA4H,EAAA5H,EAAA,YACAU,EAAAV,EAAA,YAgDAjB,GAAAD,SACA2I,cAAAA,EACAO,iBAAAA,EACAO,gBAAAA,qGC1DA,YAIA,IAAAG,EAEAA,GADArJ,KAAAsJ,aACAtJ,KAAAsJ,aAAAD,MAEArJ,KAAAqJ,OAAA,GAAAE,KAAA,KAAAvJ,KAAAwJ,UAAAC,KAGA/J,EAAAD,SACAmC,OACAC,KAAA,sBAAAwH,EAAA,MACAxG,cAAA,KACAD,WAAA,MAEAzB,OAAA,EACAuI,sBAAA,KACAvE,iBAIAjD,iBAAA,2DCvBA,YAGA,IAAAkB,GAAA,GAAAmG,KAAA,KAAAvJ,KAAAwJ,UACAG,EAAAvG,EAAAwG,SACAC,EAAAlJ,EAAA,kBAEAmJ,EAAA,SAAAvH,EAAAwH,EAAAzB,EAAAjH,GACA0I,YAAAC,QACA/J,KAAAgK,cAAAF,GAOA,IAAAA,EAAArB,QAAA,OACAqB,EAAAJ,EAAAI,GAGA9J,KAAA0E,QACA1E,KAAAiK,OAAAL,EAAAE,EAAA9J,KAAA0E,OAGA1E,KAAAsC,OAAAA,EACAtC,KAAAoB,QAAAA,EACApB,KAAAqI,QAAAA,EAGAwB,GAAAK,UAAAC,YAAA,SAAAhH,GACA,GAAAiH,EACA,IAAApK,KAAAiK,OAAA,CACA,GAAArF,GAAA5E,KAAAiK,OAAAI,KAAAlH,EACAiH,MACApK,KAAA0E,KAAAa,QAAA,SAAA+E,EAAAjD,GACA+C,EAAAE,EAAA1I,MAAAgD,EAAAyC,EAAA,KAIA,MAAA,UAAArF,GACA,MAAAhC,MAAAqI,QAAArG,EAAAoI,EAAApK,KAAAoB,UACA4B,KAAAhD,OAGAP,EAAAD,QAAAqK,6CC5CA,YAKA,SAAAU,GAAAjK,GACA,MAAAA,GAAAkK,QAAA,yBAAA,QAJA,GAAAX,GAAAnJ,EAAA,WACAiI,EAAAjI,EAAA,aAMA+J,EAAA,SAAA5G,EAAA6G,GAMA,IAHA,GAAAC,GAAA9G,EAAA+G,UACApF,EAAAmF,EAAAE,OACAC,MACAtF,EAAAuF,MAAA,CACA,GAAAC,GAAA,GAAAjB,QAAAvE,EAAAkC,MAAA,GACAsD,GAAAzI,KAAAmI,IACAI,EAAAnD,KAAAnC,EAAAkC,MAAA,IAEAlC,EAAAmF,EAAAE,OAEA,MAAAC,IAGAG,EAAA,WACAjL,KAAAkL,OAAA,GAAAC,KAEAnL,KAAAkL,OAAAE,IAAArB,OAAA,GAAAoB,MACAnL,KAAAwI,QAAA,OAGA,MAAA,OAAA,MAAA,SAAA,OAAA,OAAAjD,QAAA,SAAAjD,GACA2I,EAAAf,UAAA5H,GAAA,SAAAwH,EAAAzB,EAAAjH,GACA,MAAApB,MAAA6E,IAAAvC,EAAAwH,EAAAzB,EAAAjH,MAIA6J,EAAAf,UAAArF,IAAA,SAAAvC,EAAAwH,EAAAzB,EAAAjH,GACAA,EAAAA,KACA,IAAAiK,EAEAvB,aAAAC,QAIAsB,EAAAtB,QAEAsB,EAAAjK,EAAAiK,QAAAtL,KAAAwJ,SAAA8B,OAEAA,EADAA,YAAAtB,QACAsB,EAAAhH,OAEAkG,EAAAc,IAIA/I,EAAAA,EAAAgJ,aAEA,IAAAC,GAAA,GAAA1B,GAAAvH,EAAAwH,EAAAzB,EAAAjH,EAEApB,MAAAkL,OAAAM,IAAAH,IACArL,KAAAkL,OAAAE,IAAAC,EAAA,GAAAF,KAGA,IAAAM,GAAAzL,KAAAkL,OAAAQ,IAAAL,EACAI,GAAAD,IAAAlJ,IACAmJ,EAAAL,IAAA9I,EAAA,GAAA6I,KAGA,IAAAQ,GAAAF,EAAAC,IAAApJ,GACAsJ,EAAAL,EAAAtB,QAAAsB,EAAAvB,aAEA2B,GAAAH,IAAAI,EAAAvH,SACAsE,EAAAzH,MAAA,IAAA4I,EAAA,+CAGA6B,EAAAP,IAAAQ,EAAAvH,OAAAkH,IAGAN,EAAAf,UAAA2B,YAAA,SAAAvJ,EAAAa,GACA,GAAA2I,GAAA,GAAAxC,KAAAnG,GACAkI,EAAAS,EAAAT,OACAvB,EAAAgC,EAAAnC,QAOA,OAAA3J,MAAA+L,OAAAzJ,EAAAmI,EAAAzK,KAAAkL,OAAAG,GAAAvB,IACA9J,KAAA+L,OAAAzJ,GAAAtC,KAAAkL,OAAAQ,IAAA3B,SAAA5G,IAGA8H,EAAAf,UAAA6B,OAAA,SAAAzJ,EAAA0J,EAAAC,GACA,GAAA,IAAAD,EAAAhL,OACA,MAAA,KAGA,KAAA,GAAAL,GAAA,EAAAA,EAAAqL,EAAAhL,OAAAL,IAAA,CACA,GAAA8K,GAAAO,EAAArL,GACAgL,EAAAF,GAAAA,EAAAC,IAAApJ,EAAAgJ,cACA,IAAAK,EAAA,CACA,GAAAT,GAAAT,EAAAkB,EAAAM,EACA,IAAAf,EAAAlK,OAAA,EACA,MAAAkK,GAAA,GAAAf,YAAA8B,IAKA,MAAA,OAGAhB,EAAAf,UAAAtF,MAAA,SAAA5C,GACA,MAAAhC,MAAA6L,YAAA7J,EAAAM,OAAAN,EAAAmB,MACAnD,KAAA6L,YAAA,MAAA7J,EAAAmB,MAGA1D,EAAAD,QAAA,GAAAyL,oDCrHA,YAGA,SAAAiB,GAAAlK,EAAAoI,EAAAhJ,GAEA,MADAuH,GAAAzH,MAAA,0BAAAc,EAAAmB,IAAA,IAAA/B,GACAuH,EAAAlH,UAAAL,GAAAgB,KAAA,SAAAT,GACA,MAAAA,GAAAiD,MAAA5C,GAAAI,KAAA,SAAAC,GACA,MAAAA,GACAA,EAGAsG,EAAA5G,cAAAC,EAAAZ,OAVA,GAAAuH,GAAAjI,EAAA,aAeAjB,GAAAD,QAAA0M,wCChBA,YAGA,SAAAC,GAAAnK,EAAAoI,EAAAhJ,GAEA,MADAuH,GAAAzH,MAAA,yBAAAc,EAAAmB,IAAA,IAAA/B,GACAuH,EAAAlH,UAAAL,GAAAgB,KAAA,SAAAT,GACA,MAAAA,GAAAiD,MAAA5C,KALA,GAAA2G,GAAAjI,EAAA,aASAjB,GAAAD,QAAA2M,wCCVA,YAIA,SAAAC,GAAApK,EAAAoI,EAAAhJ,GAGA,MAFAuH,GAAAzH,MAAA,sBAAAc,EAAAmB,IAAA,IAAA/B,GAEA,GAAA4C,SAAA,SAAA4B,EAAAC,GACA,GAAAwG,IAAA,EACAC,KAEAC,EAAA,SAAAC,GACAF,EAAA3E,KAAA6E,EAAAC,YACAJ,EACAxG,EAAA,GAAAjF,OAAA,mCACA0L,EAAApD,KAAA,QAAA,MAEAmD,GAAA,GAIAK,EAAA,SAAAvG,GACAA,YAAAwG,UACA/G,EAAAO,GAEAoG,EAAA,sBAIA5D,GAAA5G,cAAAC,EAAAG,QAAAf,GACAgB,KAAAsK,EAAAH,GAEAJ,EAAAnK,EAAAoI,EAAAhJ,GACAgB,KAAAsK,EAAAH,KAhCA,GAAA5D,GAAAjI,EAAA,cACAyL,EAAAzL,EAAA,cAmCAjB,GAAAD,QAAA4M,yDCrCA3M,EAAAD,SACAoN,YAAAlM,EAAA,iBACAmM,aAAAnM,EAAA,kBACAyL,UAAAzL,EAAA,eACAwL,WAAAxL,EAAA,gBACA0L,QAAA1L,EAAA,4HCLA,YAIA,SAAAmM,GAAA7K,EAAAoI,EAAAhJ,GACAA,EAAAA,KACA,IAAAa,GAAAb,EAAAa,kBACAX,EAAAW,iBAGAwH,EAAArI,EAAAqI,uBACAnI,EAAAmI,qBAGA,OAFAd,GAAAzH,MAAA,4BAAAc,EAAAmB,IAAA,IAAA/B,GAEAuH,EAAAlH,UAAAL,GAAAgB,KAAA,SAAAT,GACA,GAAAmL,GAEAC,EADAC,IAGA,IAAAvD,EAAA,CACA,GAAAwD,GAAA,GAAAjJ,SAAA,SAAA4B,GACAkH,EAAAI,WAAA,WACAvL,EAAAiD,MAAA5C,GAAAI,KAAA,SAAAC,GACAA,GAKAuD,EAAAvD,MAGA,IAAAoH,IAEAuD,GAAArF,KAAAsF,GAGA,GAAAE,GAAAxE,EAAA5G,cAAAC,EAAAZ,GACAgB,KAAA,SAAAC,GAMA,GAJAyK,GACAM,aAAAN,GAGA7K,EAAAM,KAAAF,EAAAG,QACA,MAAAH,EAMA,MAHAsG,GAAAzH,MAAA,+BAAAmB,EAAAgL,WACAjM,GACA2L,EAAA1K,EACA,GAAAzB,OAAA,kBACAsD,MAAA,SAAAC,GAGA,MAFAwE,GAAAzH,MAAA,iDACAc,EAAAmB,IAAA,IAAA/B,GACAO,EAAAiD,MAAA5C,GAAAI,KAAA,SAAAC,GAEA,GAAAA,EACA,MAAAA,EAKA,IAAA0K,EACA,MAAAA,EAKA,MAAA5I,MAMA,OAFA6I,GAAArF,KAAAwF,GAEAnJ,QAAAsJ,KAAAN,KAzEA,GAAA1L,GAAAZ,EAAA,cACAiI,EAAAjI,EAAA,aA4EAjB,GAAAD,QAAAqN,wDC9EA,YAGA,SAAAD,GAAA5K,EAAAoI,EAAAhJ,GAEA,MADAuH,GAAAzH,MAAA,2BAAAc,EAAAmB,IAAA,IAAA/B,GACAc,MAAAF,GAJA,GAAA2G,GAAAjI,EAAA,aAOAjB,GAAAD,QAAAoN,yCCRA,YAKA,IAAAxL,GAAAV,EAAA,aACA4H,EAAA5H,EAAA,YACAiI,EAAAjI,EAAA,aACA6M,EAAA7M,EAAA,gBACA8M,EAAA9M,EAAA,cAEAiI,GAAAzH,MAAA,qCAIAnB,KAAA0N,iBAAA,UAAAD,EAAAvE,iBACAlJ,KAAA0N,iBAAA,WAAAD,EAAA9E,kBACA3I,KAAA0N,iBAAA,QAAAD,EAAArF,eAEA1I,EAAAD,SACAoN,YAAAW,EAAAX,YACAC,aAAAU,EAAAV,aACAV,UAAAoB,EAAApB,UACAD,WAAAqB,EAAArB,WACAE,QAAAmB,EAAAnB,QACA9D,OAAAA,EACAlH,QAAAA,EACAO,MAAAgH,EAAAhH,MACAmD,QAAA6D,EAAA7D,QACAC,SAAA4D,EAAA5D,6GC5CAtF,EAAAD,QAAA6F,MAAAC,SAAA,SAAAoI,GACA,MAAA,kBAAAC,OAAAzD,UAAAuC,SAAA1L,KAAA2M,6BCkCA,QAAAE,GAAAC,GAOA,IANA,GAIAC,GAJAC,KACAzD,EAAA,EACAjD,EAAA,EACAyC,EAAA,GAGA,OAAAgE,EAAAE,EAAA3D,KAAAwD,KAAA,CACA,GAAAI,GAAAH,EAAA,GACAI,EAAAJ,EAAA,GACAK,EAAAL,EAAAzG,KAKA,IAJAyC,GAAA+D,EAAAO,MAAA/G,EAAA8G,GACA9G,EAAA8G,EAAAF,EAAAjN,OAGAkN,EACApE,GAAAoE,EAAA,OADA,CAKA,GAAArD,GAAAgD,EAAAxG,GACAgH,EAAAP,EAAA,GACAlM,EAAAkM,EAAA,GACAQ,EAAAR,EAAA,GACAS,EAAAT,EAAA,GACAU,EAAAV,EAAA,GACAW,EAAAX,EAAA,EAGAhE,KACAiE,EAAApG,KAAAmC,GACAA,EAAA,GAGA,IAAA4E,GAAA,MAAAL,GAAA,MAAAxD,GAAAA,IAAAwD,EACAM,EAAA,MAAAH,GAAA,MAAAA,EACAI,EAAA,MAAAJ,GAAA,MAAAA,EACAK,EAAAf,EAAA,IAAA,IACA9C,EAAAsD,GAAAC,IAAAE,EAAA,KAAA,KAAAI,EAAA,MAEAd,GAAApG,MACA/F,KAAAA,GAAA0I,IACA+D,OAAAA,GAAA,GACAQ,UAAAA,EACAD,SAAAA,EACAD,OAAAA,EACAD,QAAAA,EACAD,WAAAA,EACAzD,QAAA8D,EAAA9D,MAcA,MATA3D,GAAAwG,EAAA7M,SACA8I,GAAA+D,EAAAkB,OAAA1H,IAIAyC,GACAiE,EAAApG,KAAAmC,GAGAiE,EASA,QAAAiB,GAAAnB,GACA,MAAAoB,GAAArB,EAAAC,IASA,QAAAqB,GAAArB,GACA,MAAAsB,WAAAtB,GAAArD,QAAA,UAAA,SAAA4E,GACA,MAAA,IAAAA,EAAAC,WAAA,GAAA5C,SAAA,IAAA6C,gBAUA,QAAAC,GAAA1B,GACA,MAAAsB,WAAAtB,GAAArD,QAAA,QAAA,SAAA4E,GACA,MAAA,IAAAA,EAAAC,WAAA,GAAA5C,SAAA,IAAA6C,gBAOA,QAAAL,GAAAlB,GAKA,IAAA,GAHAjD,GAAA,GAAAzF,OAAA0I,EAAA/M,QAGAL,EAAA,EAAAA,EAAAoN,EAAA/M,OAAAL,IACA,gBAAAoN,GAAApN,KACAmK,EAAAnK,GAAA,GAAAoJ,QAAA,OAAAgE,EAAApN,GAAAqK,QAAA,MAIA,OAAA,UAAAwE,EAAAC,GAMA,IAAA,GALA3F,GAAA,GACA4F,EAAAF,MACApO,EAAAqO,MACAE,EAAAvO,EAAAwO,OAAAV,EAAAW,mBAEAlP,EAAA,EAAAA,EAAAoN,EAAA/M,OAAAL,IAAA,CACA,GAAAmP,GAAA/B,EAAApN,EAEA,IAAA,gBAAAmP,GAAA,CAMA,GACAC,GADArI,EAAAgI,EAAAI,EAAAlO,KAGA,IAAA,MAAA8F,EAAA,CACA,GAAAoI,EAAAlB,SAAA,CAEAkB,EAAApB,UACA5E,GAAAgG,EAAAzB,OAGA,UAEA,KAAA,IAAA3I,WAAA,aAAAoK,EAAAlO,KAAA,mBAIA,GAAAoO,EAAAtI,GAAA,CACA,IAAAoI,EAAAnB,OACA,KAAA,IAAAjJ,WAAA,aAAAoK,EAAAlO,KAAA,kCAAAqO,KAAAC,UAAAxI,GAAA,IAGA,IAAA,IAAAA,EAAA1G,OAAA,CACA,GAAA8O,EAAAlB,SACA,QAEA,MAAA,IAAAlJ,WAAA,aAAAoK,EAAAlO,KAAA,qBAIA,IAAA,GAAAuO,GAAA,EAAAA,EAAAzI,EAAA1G,OAAAmP,IAAA,CAGA,GAFAJ,EAAAJ,EAAAjI,EAAAyI,KAEArF,EAAAnK,GAAA4B,KAAAwN,GACA,KAAA,IAAArK,WAAA,iBAAAoK,EAAAlO,KAAA,eAAAkO,EAAA9E,QAAA,oBAAAiF,KAAAC,UAAAH,GAAA,IAGAjG,KAAA,IAAAqG,EAAAL,EAAAzB,OAAAyB,EAAAjB,WAAAkB,OApBA,CA4BA,GAFAA,EAAAD,EAAArB,SAAAc,EAAA7H,GAAAiI,EAAAjI,IAEAoD,EAAAnK,GAAA4B,KAAAwN,GACA,KAAA,IAAArK,WAAA,aAAAoK,EAAAlO,KAAA,eAAAkO,EAAA9E,QAAA,oBAAA+E,EAAA,IAGAjG,IAAAgG,EAAAzB,OAAA0B,OArDAjG,IAAAgG,EAwDA,MAAAhG,IAUA,QAAAsG,GAAAvC,GACA,MAAAA,GAAArD,QAAA,6BAAA,QASA,QAAAsE,GAAAP,GACA,MAAAA,GAAA/D,QAAA,gBAAA,QAUA,QAAA6F,GAAAC,EAAA5L,GAEA,MADA4L,GAAA5L,KAAAA,EACA4L,EASA,QAAAC,GAAAnP,GACA,MAAAA,GAAAoP,UAAA,GAAA,IAUA,QAAAC,GAAA3G,EAAApF,GAEA,GAAAgM,GAAA5G,EAAAzF,OAAAO,MAAA,YAEA,IAAA8L,EACA,IAAA,GAAA/P,GAAA,EAAAA,EAAA+P,EAAA1P,OAAAL,IACA+D,EAAAiD,MACA/F,KAAAjB,EACA0N,OAAA,KACAQ,UAAA,KACAD,UAAA,EACAD,QAAA,EACAD,SAAA,EACAD,UAAA,EACAzD,QAAA,MAKA,OAAAqF,GAAAvG,EAAApF,GAWA,QAAAiM,GAAA7G,EAAApF,EAAAtD,GAGA,IAAA,GAFAwP,MAEAjQ,EAAA,EAAAA,EAAAmJ,EAAA9I,OAAAL,IACAiQ,EAAAjJ,KAAAkJ,EAAA/G,EAAAnJ,GAAA+D,EAAAtD,GAAAiD,OAGA,IAAA4F,GAAA,GAAAF,QAAA,MAAA6G,EAAA1H,KAAA,KAAA,IAAAqH,EAAAnP,GAEA,OAAAiP,GAAApG,EAAAvF,GAWA,QAAAoM,GAAAhH,EAAApF,EAAAtD,GAKA,IAAA,GAJA2M,GAAAH,EAAA9D,GACAwG,EAAAS,EAAAhD,EAAA3M,GAGAT,EAAA,EAAAA,EAAAoN,EAAA/M,OAAAL,IACA,gBAAAoN,GAAApN,IACA+D,EAAAiD,KAAAoG,EAAApN,GAIA,OAAA0P,GAAAC,EAAA5L,GAUA,QAAAqM,GAAAhD,EAAA3M,GACAA,EAAAA,KASA,KAAA,GAPA4P,GAAA5P,EAAA4P,OACAC,EAAA7P,EAAA6P,OAAA,EACA1F,EAAA,GACA2F,EAAAnD,EAAAA,EAAA/M,OAAA,GACAmQ,EAAA,gBAAAD,IAAA,MAAA3O,KAAA2O,GAGAvQ,EAAA,EAAAA,EAAAoN,EAAA/M,OAAAL,IAAA,CACA,GAAAmP,GAAA/B,EAAApN,EAEA,IAAA,gBAAAmP,GACAvE,GAAA6E,EAAAN,OACA,CACA,GAAAzB,GAAA+B,EAAAN,EAAAzB,QACAC,EAAA,MAAAwB,EAAA9E,QAAA,GAEA8E,GAAAnB,SACAL,GAAA,MAAAD,EAAAC,EAAA,MAOAA,EAJAwB,EAAAlB,SACAkB,EAAApB,QAGAL,EAAA,IAAAC,EAAA,KAFA,MAAAD,EAAA,IAAAC,EAAA,MAKAD,EAAA,IAAAC,EAAA,IAGA/C,GAAA+C,GAoBA,MAZA0C,KACAzF,GAAA4F,EAAA5F,EAAA6C,MAAA,GAAA,GAAA7C,GAAA,iBAIAA,GADA0F,EACA,IAIAD,GAAAG,EAAA,GAAA,YAGA,GAAApH,QAAA,IAAAwB,EAAAgF,EAAAnP,IAeA,QAAAyP,GAAA/G,EAAApF,EAAAtD,GAUA,MATAsD,GAAAA,MAEAsL,EAAAtL,GAGAtD,IACAA,OAHAA,EAAA,EACAsD,MAKAoF,YAAAC,QACA0G,EAAA3G,EAAA,GAGAkG,EAAAlG,GACA6G,EAAA,EAAA,EAAAvP,GAGA0P,EAAA,EAAA,EAAA1P,GAxaA,GAAA4O,GAAAtP,EAAA,UAKAjB,GAAAD,QAAAqR,EACApR,EAAAD,QAAAoO,MAAAA,EACAnO,EAAAD,QAAAwP,QAAAA,EACAvP,EAAAD,QAAAyP,iBAAAA,EACAxP,EAAAD,QAAAuR,eAAAA,CAOA,IAAA/C,GAAA,GAAAjE,SAGA,UAOA,0GACAb,KAAA,KAAA,yCCVA,WACA,GAAAkI,GAAAC,MAAAnH,UAAAf,OACAmI,EAAAC,UAAAD,UAAA1M,MAAA,4BAGA,IAAA0M,EACA,GAAAE,GAAAF,EAAA,GACAG,EAAAC,SAAAJ,EAAA,GAIAF,MAAAE,GACA,YAAAE,GAAAC,GAAA,IACA,WAAAD,GAAAC,GAAA,MAMAJ,MAAAnH,UAAAf,OAAA,SAAAxE,GAIA,QAAAgN,GAAAxQ,GACAnB,KAAA4B,KAAA,eACA5B,KAAAa,KAAA,GACAb,KAAAmB,QAAAA,EANA,GAAAQ,GAAA3B,IAWA,OAFA2R,GAAAzH,UAAAyD,OAAAiE,OAAAhR,MAAAsJ,WAEAlG,QAAA4B,UAAAxD,KAAA,WACA,GAAAyP,UAAA7Q,OAAA,EAAA,KAAA,IAAA0E,UAcA,OATAf,GAAAA,EAAAd,IAAA,SAAA7B,GACA,MAAAA,aAAAyD,SACAzD,EAGA8P,OAAA9P,KAIAgC,QAAAC,IACAU,EAAAd,IAAA,SAAA7B,GACA,gBAAAA,KACAA,EAAA,GAAAyD,SAAAzD,GAGA,IAAA+P,GAAA,GAAAzI,KAAAtH,EAAAmB,KAAA6O,QAEA,IAAA,UAAAD,GAAA,WAAAA,EACA,KAAA,IAAAJ,GAAA,iBAGA,OAAAzP,OAAAF,EAAAG,cAGAC,KAAA,SAAA6P,GAGA,GAAAA,EAAAC,KAAA,SAAA7P,GACA,OAAAA,EAAA8P,KAEA,KAAA,IAAAR,GAAA,4BAKA,OAAA3N,SAAAC,IACAgO,EAAApO,IAAA,SAAAxB,EAAA1B,GACA,MAAAgB,GAAAc,IAAAkC,EAAAhE,GAAA0B,QAGAD,KAAA,eAKAiP,MAAAnH,UAAArF,IAAA,SAAA7C,GACA,MAAAhC,MAAAmJ,QAAAnH","file":"sw-toolbox.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o cursor.value[TIMESTAMP_PROPERTY]) {\n var url = cursor.value[URL_PROPERTY];\n urls.push(url);\n objectStore.delete(url);\n cursor.continue();\n }\n }\n };\n\n transaction.oncomplete = function() {\n resolve(urls);\n };\n\n transaction.onabort = reject;\n });\n}\n\nfunction expireExtraEntries(db, maxEntries) {\n // Bail out early by resolving with an empty array if we're not using\n // maxEntries.\n if (!maxEntries) {\n return Promise.resolve([]);\n }\n\n return new Promise(function(resolve, reject) {\n var urls = [];\n\n var transaction = db.transaction(STORE_NAME, 'readwrite');\n var objectStore = transaction.objectStore(STORE_NAME);\n var index = objectStore.index(TIMESTAMP_PROPERTY);\n\n var countRequest = index.count();\n index.count().onsuccess = function() {\n var initialCount = countRequest.result;\n\n if (initialCount > maxEntries) {\n index.openCursor().onsuccess = function(cursorEvent) {\n var cursor = cursorEvent.target.result;\n if (cursor) {\n var url = cursor.value[URL_PROPERTY];\n urls.push(url);\n objectStore.delete(url);\n if (initialCount - urls.length > maxEntries) {\n cursor.continue();\n }\n }\n };\n }\n };\n\n transaction.oncomplete = function() {\n resolve(urls);\n };\n\n transaction.onabort = reject;\n });\n}\n\nfunction expireEntries(db, maxEntries, maxAgeSeconds, now) {\n return expireOldEntries(db, maxAgeSeconds, now).then(function(oldUrls) {\n return expireExtraEntries(db, maxEntries).then(function(extraUrls) {\n return oldUrls.concat(extraUrls);\n });\n });\n}\n\nmodule.exports = {\n getDb: getDb,\n setTimestampForUrl: setTimestampForUrl,\n expireEntries: expireEntries\n};\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\n// For cache.addAll.\nrequire('serviceworker-cache-polyfill');\n\nvar helpers = require('./helpers');\nvar router = require('./router');\nvar options = require('./options');\n\n// Event listeners\n\nfunction fetchListener(event) {\n var handler = router.match(event.request);\n\n if (handler) {\n event.respondWith(handler(event.request));\n } else if (router.default &&\n event.request.method === 'GET' &&\n // Ensure that chrome-extension:// requests don't trigger the default route.\n event.request.url.indexOf('http') === 0) {\n event.respondWith(router.default(event.request));\n }\n}\n\nfunction activateListener(event) {\n helpers.debug('activate event fired');\n var inactiveCache = options.cache.name + '$$$inactive$$$';\n event.waitUntil(helpers.renameCache(inactiveCache, options.cache.name));\n}\n\nfunction flatten(items) {\n return items.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n}\n\nfunction installListener(event) {\n var inactiveCache = options.cache.name + '$$$inactive$$$';\n helpers.debug('install event fired');\n helpers.debug('creating cache [' + inactiveCache + ']');\n event.waitUntil(\n helpers.openCache({cache: {name: inactiveCache}})\n .then(function(cache) {\n return Promise.all(options.preCacheItems)\n .then(flatten)\n .then(helpers.validatePrecacheInput)\n .then(function(preCacheItems) {\n helpers.debug('preCache list: ' +\n (preCacheItems.join(', ') || '(none)'));\n return cache.addAll(preCacheItems);\n });\n })\n );\n}\n\nmodule.exports = {\n fetchListener: fetchListener,\n activateListener: activateListener,\n installListener: installListener\n};\n","/*\n\tCopyright 2015 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\n\n// TODO: This is necessary to handle different implementations in the wild\n// The spec defines self.registration, but it was not implemented in Chrome 40.\nvar scope;\nif (self.registration) {\n scope = self.registration.scope;\n} else {\n scope = self.scope || new URL('./', self.location).href;\n}\n\nmodule.exports = {\n cache: {\n name: '$$$toolbox-cache$$$' + scope + '$$$',\n maxAgeSeconds: null,\n maxEntries: null\n },\n debug: false,\n networkTimeoutSeconds: null,\n preCacheItems: [],\n // A regular expression to apply to HTTP response codes. Codes that match\n // will be considered successes, while others will not, and will not be\n // cached.\n successResponses: /^0|([123]\\d\\d)|(40[14567])|410$/\n};\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\n// TODO: Use self.registration.scope instead of self.location\nvar url = new URL('./', self.location);\nvar basePath = url.pathname;\nvar pathRegexp = require('path-to-regexp');\n\nvar Route = function(method, path, handler, options) {\n if (path instanceof RegExp) {\n this.fullUrlRegExp = path;\n } else {\n // The URL() constructor can't parse express-style routes as they are not\n // valid urls. This means we have to manually manipulate relative urls into\n // absolute ones. This check is extremely naive but implementing a tweaked\n // version of the full algorithm seems like overkill\n // (https://url.spec.whatwg.org/#concept-basic-url-parser)\n if (path.indexOf('/') !== 0) {\n path = basePath + path;\n }\n\n this.keys = [];\n this.regexp = pathRegexp(path, this.keys);\n }\n\n this.method = method;\n this.options = options;\n this.handler = handler;\n};\n\nRoute.prototype.makeHandler = function(url) {\n var values;\n if (this.regexp) {\n var match = this.regexp.exec(url);\n values = {};\n this.keys.forEach(function(key, index) {\n values[key.name] = match[index + 1];\n });\n }\n\n return function(request) {\n return this.handler(request, values, this.options);\n }.bind(this);\n};\n\nmodule.exports = Route;\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nvar Route = require('./route');\nvar helpers = require('./helpers');\n\nfunction regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nvar keyMatch = function(map, string) {\n // This would be better written as a for..of loop, but that would break the\n // minifyify process in the build.\n var entriesIterator = map.entries();\n var item = entriesIterator.next();\n var matches = [];\n while (!item.done) {\n var pattern = new RegExp(item.value[0]);\n if (pattern.test(string)) {\n matches.push(item.value[1]);\n }\n item = entriesIterator.next();\n }\n return matches;\n};\n\nvar Router = function() {\n this.routes = new Map();\n // Create the dummy origin for RegExp-based routes\n this.routes.set(RegExp, new Map());\n this.default = null;\n};\n\n['get', 'post', 'put', 'delete', 'head', 'any'].forEach(function(method) {\n Router.prototype[method] = function(path, handler, options) {\n return this.add(method, path, handler, options);\n };\n});\n\nRouter.prototype.add = function(method, path, handler, options) {\n options = options || {};\n var origin;\n\n if (path instanceof RegExp) {\n // We need a unique key to use in the Map to distinguish RegExp paths\n // from Express-style paths + origins. Since we can use any object as the\n // key in a Map, let's use the RegExp constructor!\n origin = RegExp;\n } else {\n origin = options.origin || self.location.origin;\n if (origin instanceof RegExp) {\n origin = origin.source;\n } else {\n origin = regexEscape(origin);\n }\n }\n\n method = method.toLowerCase();\n\n var route = new Route(method, path, handler, options);\n\n if (!this.routes.has(origin)) {\n this.routes.set(origin, new Map());\n }\n\n var methodMap = this.routes.get(origin);\n if (!methodMap.has(method)) {\n methodMap.set(method, new Map());\n }\n\n var routeMap = methodMap.get(method);\n var regExp = route.regexp || route.fullUrlRegExp;\n\n if (routeMap.has(regExp.source)) {\n helpers.debug('\"' + path + '\" resolves to same regex as existing route.');\n }\n\n routeMap.set(regExp.source, route);\n};\n\nRouter.prototype.matchMethod = function(method, url) {\n var urlObject = new URL(url);\n var origin = urlObject.origin;\n var path = urlObject.pathname;\n\n // We want to first check to see if there's a match against any\n // \"Express-style\" routes (string for the path, RegExp for the origin).\n // Checking for Express-style matches first maintains the legacy behavior.\n // If there's no match, we next check for a match against any RegExp routes,\n // where the RegExp in question matches the full URL (both origin and path).\n return this._match(method, keyMatch(this.routes, origin), path) ||\n this._match(method, [this.routes.get(RegExp)], url);\n};\n\nRouter.prototype._match = function(method, methodMaps, pathOrUrl) {\n if (methodMaps.length === 0) {\n return null;\n }\n\n for (var i = 0; i < methodMaps.length; i++) {\n var methodMap = methodMaps[i];\n var routeMap = methodMap && methodMap.get(method.toLowerCase());\n if (routeMap) {\n var routes = keyMatch(routeMap, pathOrUrl);\n if (routes.length > 0) {\n return routes[0].makeHandler(pathOrUrl);\n }\n }\n }\n\n return null;\n};\n\nRouter.prototype.match = function(request) {\n return this.matchMethod(request.method, request.url) ||\n this.matchMethod('any', request.url);\n};\n\nmodule.exports = new Router();\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheFirst(request, values, options) {\n helpers.debug('Strategy: cache first [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request).then(function(response) {\n if (response) {\n return response;\n }\n\n return helpers.fetchAndCache(request, options);\n });\n });\n}\n\nmodule.exports = cacheFirst;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheOnly(request, values, options) {\n helpers.debug('Strategy: cache only [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request);\n });\n}\n\nmodule.exports = cacheOnly;\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\nvar cacheOnly = require('./cacheOnly');\n\nfunction fastest(request, values, options) {\n helpers.debug('Strategy: fastest [' + request.url + ']', options);\n\n return new Promise(function(resolve, reject) {\n var rejected = false;\n var reasons = [];\n\n var maybeReject = function(reason) {\n reasons.push(reason.toString());\n if (rejected) {\n reject(new Error('Both cache and network failed: \"' +\n reasons.join('\", \"') + '\"'));\n } else {\n rejected = true;\n }\n };\n\n var maybeResolve = function(result) {\n if (result instanceof Response) {\n resolve(result);\n } else {\n maybeReject('No result returned');\n }\n };\n\n helpers.fetchAndCache(request.clone(), options)\n .then(maybeResolve, maybeReject);\n\n cacheOnly(request, values, options)\n .then(maybeResolve, maybeReject);\n });\n}\n\nmodule.exports = fastest;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\nmodule.exports = {\n networkOnly: require('./networkOnly'),\n networkFirst: require('./networkFirst'),\n cacheOnly: require('./cacheOnly'),\n cacheFirst: require('./cacheFirst'),\n fastest: require('./fastest')\n};\n","/*\n Copyright 2015 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar globalOptions = require('../options');\nvar helpers = require('../helpers');\n\nfunction networkFirst(request, values, options) {\n options = options || {};\n var successResponses = options.successResponses ||\n globalOptions.successResponses;\n // This will bypass options.networkTimeout if it's set to a false-y value like\n // 0, but that's the sane thing to do anyway.\n var networkTimeoutSeconds = options.networkTimeoutSeconds ||\n globalOptions.networkTimeoutSeconds;\n helpers.debug('Strategy: network first [' + request.url + ']', options);\n\n return helpers.openCache(options).then(function(cache) {\n var timeoutId;\n var promises = [];\n var originalResponse;\n\n if (networkTimeoutSeconds) {\n var cacheWhenTimedOutPromise = new Promise(function(resolve) {\n timeoutId = setTimeout(function() {\n cache.match(request).then(function(response) {\n if (response) {\n // Only resolve this promise if there's a valid response in the\n // cache. This ensures that we won't time out a network request\n // unless there's a cached entry to fallback on, which is arguably\n // the preferable behavior.\n resolve(response);\n }\n });\n }, networkTimeoutSeconds * 1000);\n });\n promises.push(cacheWhenTimedOutPromise);\n }\n\n var networkPromise = helpers.fetchAndCache(request, options)\n .then(function(response) {\n // We've got a response, so clear the network timeout if there is one.\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n if (successResponses.test(response.status)) {\n return response;\n }\n\n helpers.debug('Response was an HTTP error: ' + response.statusText,\n options);\n originalResponse = response;\n throw new Error('Bad response');\n }).catch(function(error) {\n helpers.debug('Network or response error, fallback to cache [' +\n request.url + ']', options);\n return cache.match(request).then(function(response) {\n // If there's a match in the cache, resolve with that.\n if (response) {\n return response;\n }\n\n // If we have a Response object from the previous fetch, then resolve\n // with that, even though it corresponds to an error status code.\n if (originalResponse) {\n return originalResponse;\n }\n\n // If we don't have a Response object from the previous fetch, likely\n // due to a network failure, then reject with the failure error.\n throw error;\n });\n });\n\n promises.push(networkPromise);\n\n return Promise.race(promises);\n });\n}\n\nmodule.exports = networkFirst;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction networkOnly(request, values, options) {\n helpers.debug('Strategy: network only [' + request.url + ']', options);\n return fetch(request);\n}\n\nmodule.exports = networkOnly;\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\n// This is the entrypoint for the sw-toolbox bundle. All code with\n// side effects (e.g. adding event listeners) should be in this file.\n\nvar options = require('./options');\nvar router = require('./router');\nvar helpers = require('./helpers');\nvar strategies = require('./strategies');\nvar listeners = require('./listeners');\n\nhelpers.debug('Service Worker Toolbox is loading');\n\n// Set up listeners.\n\nself.addEventListener('install', listeners.installListener);\nself.addEventListener('activate', listeners.activateListener);\nself.addEventListener('fetch', listeners.fetchListener);\n\nmodule.exports = {\n networkOnly: strategies.networkOnly,\n networkFirst: strategies.networkFirst,\n cacheOnly: strategies.cacheOnly,\n cacheFirst: strategies.cacheFirst,\n fastest: strategies.fastest,\n router: router,\n options: options,\n cache: helpers.cache,\n uncache: helpers.uncache,\n precache: helpers.precache\n};\n","module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n","var isarray = require('isarray')\n\n/**\n * Expose `pathToRegexp`.\n */\nmodule.exports = pathToRegexp\nmodule.exports.parse = parse\nmodule.exports.compile = compile\nmodule.exports.tokensToFunction = tokensToFunction\nmodule.exports.tokensToRegExp = tokensToRegExp\n\n/**\n * The main path matching regexp utility.\n *\n * @type {RegExp}\n */\nvar PATH_REGEXP = new RegExp([\n // Match escaped characters that would otherwise appear in future matches.\n // This allows the user to escape special characters that won't transform.\n '(\\\\\\\\.)',\n // Match Express-style parameters and un-named parameters with a prefix\n // and optional suffixes. Matches appear as:\n //\n // \"/:test(\\\\d+)?\" => [\"/\", \"test\", \"\\d+\", undefined, \"?\", undefined]\n // \"/route(\\\\d+)\" => [undefined, undefined, undefined, \"\\d+\", undefined, undefined]\n // \"/*\" => [\"/\", undefined, undefined, undefined, undefined, \"*\"]\n '([\\\\/.])?(?:(?:\\\\:(\\\\w+)(?:\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))?|\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))([+*?])?|(\\\\*))'\n].join('|'), 'g')\n\n/**\n * Parse a string for the raw tokens.\n *\n * @param {string} str\n * @return {!Array}\n */\nfunction parse (str) {\n var tokens = []\n var key = 0\n var index = 0\n var path = ''\n var res\n\n while ((res = PATH_REGEXP.exec(str)) != null) {\n var m = res[0]\n var escaped = res[1]\n var offset = res.index\n path += str.slice(index, offset)\n index = offset + m.length\n\n // Ignore already escaped sequences.\n if (escaped) {\n path += escaped[1]\n continue\n }\n\n var next = str[index]\n var prefix = res[2]\n var name = res[3]\n var capture = res[4]\n var group = res[5]\n var modifier = res[6]\n var asterisk = res[7]\n\n // Push the current path onto the tokens.\n if (path) {\n tokens.push(path)\n path = ''\n }\n\n var partial = prefix != null && next != null && next !== prefix\n var repeat = modifier === '+' || modifier === '*'\n var optional = modifier === '?' || modifier === '*'\n var delimiter = res[2] || '/'\n var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?')\n\n tokens.push({\n name: name || key++,\n prefix: prefix || '',\n delimiter: delimiter,\n optional: optional,\n repeat: repeat,\n partial: partial,\n asterisk: !!asterisk,\n pattern: escapeGroup(pattern)\n })\n }\n\n // Match any characters still remaining.\n if (index < str.length) {\n path += str.substr(index)\n }\n\n // If the path exists, push it onto the end.\n if (path) {\n tokens.push(path)\n }\n\n return tokens\n}\n\n/**\n * Compile a string to a template function for the path.\n *\n * @param {string} str\n * @return {!function(Object=, Object=)}\n */\nfunction compile (str) {\n return tokensToFunction(parse(str))\n}\n\n/**\n * Prettier encoding of URI path segments.\n *\n * @param {string}\n * @return {string}\n */\nfunction encodeURIComponentPretty (str) {\n return encodeURI(str).replace(/[\\/?#]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase()\n })\n}\n\n/**\n * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.\n *\n * @param {string}\n * @return {string}\n */\nfunction encodeAsterisk (str) {\n return encodeURI(str).replace(/[?#]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase()\n })\n}\n\n/**\n * Expose a method for transforming tokens into the path function.\n */\nfunction tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length)\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n }\n }\n\n return function (obj, opts) {\n var path = ''\n var data = obj || {}\n var options = opts || {}\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (typeof token === 'string') {\n path += token\n\n continue\n }\n\n var value = data[token.name]\n var segment\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j])\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment\n }\n\n return path\n }\n}\n\n/**\n * Escape a regular expression string.\n *\n * @param {string} str\n * @return {string}\n */\nfunction escapeString (str) {\n return str.replace(/([.+*?=^!:${}()[\\]|\\/\\\\])/g, '\\\\$1')\n}\n\n/**\n * Escape the capturing group by escaping special characters and meaning.\n *\n * @param {string} group\n * @return {string}\n */\nfunction escapeGroup (group) {\n return group.replace(/([=!:$\\/()])/g, '\\\\$1')\n}\n\n/**\n * Attach the keys as a property of the regexp.\n *\n * @param {!RegExp} re\n * @param {Array} keys\n * @return {!RegExp}\n */\nfunction attachKeys (re, keys) {\n re.keys = keys\n return re\n}\n\n/**\n * Get the flags for a regexp from the options.\n *\n * @param {Object} options\n * @return {string}\n */\nfunction flags (options) {\n return options.sensitive ? '' : 'i'\n}\n\n/**\n * Pull out keys from a regexp.\n *\n * @param {!RegExp} path\n * @param {!Array} keys\n * @return {!RegExp}\n */\nfunction regexpToRegexp (path, keys) {\n // Use a negative lookahead to match only capturing groups.\n var groups = path.source.match(/\\((?!\\?)/g)\n\n if (groups) {\n for (var i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n prefix: null,\n delimiter: null,\n optional: false,\n repeat: false,\n partial: false,\n asterisk: false,\n pattern: null\n })\n }\n }\n\n return attachKeys(path, keys)\n}\n\n/**\n * Transform an array into a regexp.\n *\n * @param {!Array} path\n * @param {Array} keys\n * @param {!Object} options\n * @return {!RegExp}\n */\nfunction arrayToRegexp (path, keys, options) {\n var parts = []\n\n for (var i = 0; i < path.length; i++) {\n parts.push(pathToRegexp(path[i], keys, options).source)\n }\n\n var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))\n\n return attachKeys(regexp, keys)\n}\n\n/**\n * Create a path regexp from string input.\n *\n * @param {string} path\n * @param {!Array} keys\n * @param {!Object} options\n * @return {!RegExp}\n */\nfunction stringToRegexp (path, keys, options) {\n var tokens = parse(path)\n var re = tokensToRegExp(tokens, options)\n\n // Attach keys back to the regexp.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] !== 'string') {\n keys.push(tokens[i])\n }\n }\n\n return attachKeys(re, keys)\n}\n\n/**\n * Expose a function for taking tokens and returning a RegExp.\n *\n * @param {!Array} tokens\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction tokensToRegExp (tokens, options) {\n options = options || {}\n\n var strict = options.strict\n var end = options.end !== false\n var route = ''\n var lastToken = tokens[tokens.length - 1]\n var endsWithSlash = typeof lastToken === 'string' && /\\/$/.test(lastToken)\n\n // Iterate over the tokens and create our regexp string.\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (typeof token === 'string') {\n route += escapeString(token)\n } else {\n var prefix = escapeString(token.prefix)\n var capture = '(?:' + token.pattern + ')'\n\n if (token.repeat) {\n capture += '(?:' + prefix + capture + ')*'\n }\n\n if (token.optional) {\n if (!token.partial) {\n capture = '(?:' + prefix + '(' + capture + '))?'\n } else {\n capture = prefix + '(' + capture + ')?'\n }\n } else {\n capture = prefix + '(' + capture + ')'\n }\n\n route += capture\n }\n }\n\n // In non-strict mode we allow a slash at the end of match. If the path to\n // match already ends with a slash, we remove it for consistency. The slash\n // is valid at the end of a path match, not in the middle. This is important\n // in non-ending mode, where \"/test/\" shouldn't match \"/test//route\".\n if (!strict) {\n route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\\\/(?=$))?'\n }\n\n if (end) {\n route += '$'\n } else {\n // In non-ending mode, we need the capturing groups to match as much as\n // possible by using a positive lookahead to the end or next path segment.\n route += strict && endsWithSlash ? '' : '(?=\\\\/|$)'\n }\n\n return new RegExp('^' + route, flags(options))\n}\n\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n *\n * @param {(string|RegExp|Array)} path\n * @param {(Array|Object)=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction pathToRegexp (path, keys, options) {\n keys = keys || []\n\n if (!isarray(keys)) {\n options = /** @type {!Object} */ (keys)\n keys = []\n } else if (!options) {\n options = {}\n }\n\n if (path instanceof RegExp) {\n return regexpToRegexp(path, /** @type {!Array} */ (keys))\n }\n\n if (isarray(path)) {\n return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)\n }\n\n return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)\n}\n","/**\n * Copyright 2015 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n(function() {\n var nativeAddAll = Cache.prototype.addAll;\n var userAgent = navigator.userAgent.match(/(Firefox|Chrome)\\/(\\d+\\.)/);\n\n // Has nice behavior of `var` which everyone hates\n if (userAgent) {\n var agent = userAgent[1];\n var version = parseInt(userAgent[2]);\n }\n\n if (\n nativeAddAll && (!userAgent ||\n (agent === 'Firefox' && version >= 46) ||\n (agent === 'Chrome' && version >= 50)\n )\n ) {\n return;\n }\n\n Cache.prototype.addAll = function addAll(requests) {\n var cache = this;\n\n // Since DOMExceptions are not constructable:\n function NetworkError(message) {\n this.name = 'NetworkError';\n this.code = 19;\n this.message = message;\n }\n\n NetworkError.prototype = Object.create(Error.prototype);\n\n return Promise.resolve().then(function() {\n if (arguments.length < 1) throw new TypeError();\n\n // Simulate sequence<(Request or USVString)> binding:\n var sequence = [];\n\n requests = requests.map(function(request) {\n if (request instanceof Request) {\n return request;\n }\n else {\n return String(request); // may throw TypeError\n }\n });\n\n return Promise.all(\n requests.map(function(request) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n var scheme = new URL(request.url).protocol;\n\n if (scheme !== 'http:' && scheme !== 'https:') {\n throw new NetworkError(\"Invalid scheme\");\n }\n\n return fetch(request.clone());\n })\n );\n }).then(function(responses) {\n // If some of the responses has not OK-eish status,\n // then whole operation should reject\n if (responses.some(function(response) {\n return !response.ok;\n })) {\n throw new NetworkError('Incorrect response status');\n }\n\n // TODO: check that requests don't overwrite one another\n // (don't think this is possible to polyfill due to opaque responses)\n return Promise.all(\n responses.map(function(response, i) {\n return cache.put(requests[i], response);\n })\n );\n }).then(function() {\n return undefined;\n });\n };\n\n Cache.prototype.add = function add(request) {\n return this.addAll([request]);\n };\n}());"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/lib/sw-toolbox/sw-toolbox.map.json b/lib/sw-toolbox/sw-toolbox.map.json deleted file mode 100644 index 58191476..00000000 --- a/lib/sw-toolbox/sw-toolbox.map.json +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","lib/sw-toolbox.js","lib/options.js","lib/router.js","lib/helpers.js","lib/strategies/index.js","lib/route.js","lib/idb-cache-expiration.js","node_modules/serviceworker-cache-polyfill/index.js","lib/strategies/networkOnly.js","lib/strategies/networkFirst.js","lib/strategies/cacheOnly.js","lib/strategies/cacheFirst.js","lib/strategies/fastest.js","node_modules/path-to-regexp/index.js","node_modules/isarray/index.js"],"names":["cache","url","options","helpers","openCache","then","add","uncache","delete","precache","items","Promise","validatePrecacheInput","preCacheItems","concat","require","router","strategies","debug","flatten","reduce","a","b","isValid","Array","isArray","forEach","item","Request","TypeError","self","addEventListener","event","inactiveCache","name","waitUntil","all","join","addAll","renameCache","handler","match","request","respondWith","default","method","module","exports","networkOnly","networkFirst","cacheOnly","cacheFirst","fastest","scope","registration","URL","location","href","maxAgeSeconds","maxEntries","networkTimeoutSeconds","successResponses","regexEscape","s","replace","Route","keyMatch","map","string","entriesIterator","entries","next","matches","done","pattern","RegExp","value","test","push","Router","this","routes","Map","set","prototype","path","origin","source","toLowerCase","route","has","methodMap","get","routeMap","regExp","regexp","fullUrlRegExp","matchMethod","urlObject","pathname","_match","methodMaps","pathOrUrl","length","i","makeHandler","message","flag","globalOptions","console","log","cacheName","caches","open","fetchAndCache","fetch","clone","response","status","put","cacheOptions","queueCacheExpiration","cleanup","cleanupCache","bind","cleanupQueue","requestUrl","now","Date","idbCacheExpiration","getDb","db","setTimestampForUrl","expireEntries","urlsToDelete","deletionPromises","urlToDelete","catch","error","destination","results","sourceCache","destCache","keys","requests","basePath","pathRegexp","indexOf","values","exec","key","index","openDb","resolve","reject","indexedDB","DB_PREFIX","DB_VERSION","onupgradeneeded","objectStore","result","createObjectStore","STORE_NAME","keyPath","URL_PROPERTY","createIndex","TIMESTAMP_PROPERTY","unique","onsuccess","onerror","cacheNameToDbPromise","transaction","timestamp","oncomplete","onabort","expireOldEntries","maxAgeMillis","urls","openCursor","cursorEvent","cursor","target","continue","expireExtraEntries","countRequest","count","initialCount","oldUrls","extraUrls","nativeAddAll","Cache","userAgent","navigator","agent","version","parseInt","NetworkError","code","Object","create","Error","arguments","String","scheme","protocol","responses","some","ok","timeoutId","originalResponse","promises","cacheWhenTimedOutPromise","setTimeout","networkPromise","clearTimeout","statusText","race","rejected","reasons","maybeReject","reason","toString","maybeResolve","Response","parse","str","res","tokens","PATH_REGEXP","m","escaped","offset","slice","prefix","capture","group","modifier","asterisk","partial","repeat","optional","delimiter","escapeGroup","substr","compile","tokensToFunction","encodeURIComponentPretty","encodeURI","c","charCodeAt","toUpperCase","encodeAsterisk","obj","opts","data","encode","pretty","encodeURIComponent","token","segment","isarray","JSON","stringify","j","escapeString","attachKeys","re","flags","sensitive","regexpToRegexp","groups","arrayToRegexp","parts","pathToRegexp","stringToRegexp","tokensToRegExp","strict","end","lastToken","endsWithSlash","arr","call"],"mappings":"AAAA;AIeA,YAKA,SAASkB,OAAMwF,EAASxG,GACtBA,EAAUA,KACV,IAAIyG,GAAOzG,EAAQgB,OAAS0F,cAAc1F,KACtCyF,IACFE,QAAQC,IAAI,gBAAkBJ,GAIlC,QAAStG,WAAUF,GACjB,GAAI6G,EAMJ,OALI7G,IAAWA,EAAQF,QACrB+G,EAAY7G,EAAQF,MAAMkC,MAE5B6E,EAAYA,GAAaH,cAAc5G,MAAMkC,KAEtC8E,OAAOC,KAAKF,GAGrB,QAASG,eAAcxE,EAASxC,GAC9BA,EAAUA,KACV,IAAI2D,GAAmB3D,EAAQ2D,kBAC3B+C,cAAc/C,gBAElB,OAAOsD,OAAMzE,EAAQ0E,SAAS/G,KAAK,SAASgH,GAwB1C,MAnBuB,QAAnB3E,EAAQG,QAAoBgB,EAAiBgB,KAAKwC,EAASC,SAC7DlH,UAAUF,GAASG,KAAK,SAASL,GAC/BA,EAAMuH,IAAI7E,EAAS2E,GAAUhH,KAAK,WAIhC,GAAImH,GAAetH,EAAQF,OAAS4G,cAAc5G,OAK7CwH,EAAa7D,YAAc6D,EAAa9D,gBACzC8D,EAAatF,MACfuF,qBAAqB/E,EAAS1C,EAAOwH,OAMtCH,EAASD,UAKpB,QAASK,sBAAqB/E,EAAS1C,EAAOwH,GAC5C,GAAIE,GAAUC,aAAaC,KAAK,KAAMlF,EAAS1C,EAAOwH,EAGpDK,cADEA,aACaA,aAAaxH,KAAKqH,GAElBA,IAInB,QAASC,cAAajF,EAAS1C,EAAOwH,GACpC,GAAIM,GAAapF,EAAQzC,IACrByD,EAAgB8D,EAAa9D,cAC7BC,EAAa6D,EAAa7D,WAC1BoD,EAAYS,EAAatF,KAEzB6F,EAAMC,KAAKD,KAIf,OAHA7G,OAAM,0BAA4B4G,EAAa,oBAC7CnE,EAAa,gBAAkBD,GAE1BuE,mBAAmBC,MAAMnB,GAAW1G,KAAK,SAAS8H,GACvD,MAAOF,oBAAmBG,mBAAmBD,EAAIL,EAAYC,KAC5D1H,KAAK,SAAS8H,GACf,MAAOF,oBAAmBI,cAAcF,EAAIxE,EAAYD,EAAeqE,KACtE1H,KAAK,SAASiI,GACfpH,MAAM,4BAEN,IAAIqH,GAAmBD,EAAanE,IAAI,SAASqE,GAC/C,MAAOxI,GAAMQ,OAAOgI,IAGtB,OAAO7H,SAAQyB,IAAImG,GAAkBlI,KAAK,WACxCa,MAAM,gCAEPuH,MAAM,SAASC,GAChBxH,MAAMwH,KAIV,QAASnG,aAAYgD,EAAQoD,EAAazI,GAExC,MADAgB,OAAM,oBAAsBqE,EAAS,SAAWoD,EAAc,IAAKzI,GAC5D8G,OAAOxG,OAAOmI,GAAatI,KAAK,WACrC,MAAOM,SAAQyB,KACb4E,OAAOC,KAAK1B,GACZyB,OAAOC,KAAK0B,KACXtI,KAAK,SAASuI,GACf,GAAIC,GAAcD,EAAQ,GACtBE,EAAYF,EAAQ,EAExB,OAAOC,GAAYE,OAAO1I,KAAK,SAAS2I,GACtC,MAAOrI,SAAQyB,IAAI4G,EAAS7E,IAAI,SAASzB,GACvC,MAAOmG,GAAYpG,MAAMC,GAASrC,KAAK,SAASgH,GAC9C,MAAOyB,GAAUvB,IAAI7E,EAAS2E,UAGjChH,KAAK,WACN,MAAO2G,QAAOxG,OAAO+E,SA/G7B,GAAIqB,eAAgB7F,QAAQ,aACxBkH,mBAAqBlH,QAAQ,0BAqD7B8G,YA+DJ/E,QAAOC,SACL7B,MAAOA,MACPgG,cAAeA,cACf9G,UAAWA,UACXmC,YAAaA;;AG3Hf,YASA,SAASiH,QAAOzC,GACd,MAAO,IAAIpG,SAAQ,SAAS8I,EAASC,GACnC,GAAIhH,GAAUiH,UAAU1C,KAAK2C,UAAY7C,EAAW8C,WAEpDnH,GAAQoH,gBAAkB,WACxB,GAAIC,GAAcrH,EAAQsH,OAAOC,kBAAkBC,YAC9CC,QAASC,cACdL,GAAYM,YAAYC,mBAAoBA,oBACvCC,QAAQ,KAGf7H,EAAQ8H,UAAY,WAClBf,EAAQ/G,EAAQsH,SAGlBtH,EAAQ+H,QAAU,WAChBf,EAAOhH,EAAQgG,UAKrB,QAASR,OAAMnB,GAKb,MAJMA,KAAa2D,wBACjBA,qBAAqB3D,GAAayC,OAAOzC,IAGpC2D,qBAAqB3D,GAG9B,QAASqB,oBAAmBD,EAAIlI,EAAK8H,GACnC,MAAO,IAAIpH,SAAQ,SAAS8I,EAASC,GACnC,GAAIiB,GAAcxC,EAAGwC,YAAYT,WAAY,aACzCH,EAAcY,EAAYZ,YAAYG,WAC1CH,GAAYxC,KAAKtH,IAAKA,EAAK2K,UAAW7C,IAEtC4C,EAAYE,WAAa,WACvBpB,EAAQtB,IAGVwC,EAAYG,QAAU,WACpBpB,EAAOiB,EAAYjC,UAKzB,QAASqC,kBAAiB5C,EAAIzE,EAAeqE,GAG3C,MAAKrE,GAIE,GAAI/C,SAAQ,SAAS8I,EAASC,GACnC,GAAIsB,GAA+B,IAAhBtH,EACfuH,KAEAN,EAAcxC,EAAGwC,YAAYT,WAAY,aACzCH,EAAcY,EAAYZ,YAAYG,YACtCX,EAAQQ,EAAYR,MAAMe,mBAE9Bf,GAAM2B,aAAaV,UAAY,SAASW,GACtC,GAAIC,GAASD,EAAYE,OAAOrB,MAChC,IAAIoB,GACErD,EAAMiD,EAAeI,EAAOxG,MAAM0F,oBAAqB,CACzD,GAAIrK,GAAMmL,EAAOxG,MAAMwF,aACvBa,GAAKnG,KAAK7E,GACV8J,EAAYvJ,OAAOP,GACnBmL,EAAOE,aAKbX,EAAYE,WAAa,WACvBpB,EAAQwB,IAGVN,EAAYG,QAAUpB,IA3Bf/I,QAAQ8I,YA+BnB,QAAS8B,oBAAmBpD,EAAIxE,GAG9B,MAAKA,GAIE,GAAIhD,SAAQ,SAAS8I,EAASC,GACnC,GAAIuB,MAEAN,EAAcxC,EAAGwC,YAAYT,WAAY,aACzCH,EAAcY,EAAYZ,YAAYG,YACtCX,EAAQQ,EAAYR,MAAMe,oBAE1BkB,EAAejC,EAAMkC,OACzBlC,GAAMkC,QAAQjB,UAAY,WACxB,GAAIkB,GAAeF,EAAaxB,MAE5B0B,GAAe/H,IACjB4F,EAAM2B,aAAaV,UAAY,SAASW,GACtC,GAAIC,GAASD,EAAYE,OAAOrB,MAChC,IAAIoB,EAAQ,CACV,GAAInL,GAAMmL,EAAOxG,MAAMwF,aACvBa,GAAKnG,KAAK7E,GACV8J,EAAYvJ,OAAOP,GACfyL,EAAeT,EAAK1E,OAAS5C,GAC/ByH,EAAOE,eAOjBX,EAAYE,WAAa,WACvBpB,EAAQwB,IAGVN,EAAYG,QAAUpB,IAjCf/I,QAAQ8I,YAqCnB,QAASpB,eAAcF,EAAIxE,EAAYD,EAAeqE,GACpD,MAAOgD,kBAAiB5C,EAAIzE,EAAeqE,GAAK1H,KAAK,SAASsL,GAC5D,MAAOJ,oBAAmBpD,EAAIxE,GAAYtD,KAAK,SAASuL,GACtD,MAAOD,GAAQ7K,OAAO8K,OAnI5B,GAAIhC,WAAY,cACZC,WAAa,EACbK,WAAa,QACbE,aAAe,MACfE,mBAAqB,YACrBI,uBAmIJ5H,QAAOC,SACLmF,MAAOA,MACPE,mBAAoBA,mBACpBC,cAAeA;;AL7IjB,YAIA,IAAIhF,MAEFA,OADEvB,KAAKwB,aACCxB,KAAKwB,aAAaD,MAElBvB,KAAKuB,OAAS,GAAIE,KAAI,KAAMzB,KAAK0B,UAAUC,KAGrDX,OAAOC,SACL/C,OACEkC,KAAM,sBAAwBmB,MAAQ,MACtCK,cAAe,KACfC,WAAY,MAEdzC,OAAO,EACP0C,sBAAuB,KACvB/C,iBAIAgD,iBAAkB;;AIvBpB,YAGA,IAAI5D,KAAM,GAAIsD,KAAI,KAAMzB,KAAK0B,UACzByF,SAAWhJ,IAAIkG,SACf+C,WAAanI,QAAQ,kBAErBkD,MAAQ,SAASpB,EAAQwC,EAAM7C,EAAStC,GACtCmF,YAAgBV,QAClBK,KAAKgB,cAAgBX,GAOK,IAAtBA,EAAK8D,QAAQ,OACf9D,EAAO4D,SAAW5D,GAGpBL,KAAK+D,QACL/D,KAAKe,OAASmD,WAAW7D,EAAML,KAAK+D,OAGtC/D,KAAKnC,OAASA,EACdmC,KAAK9E,QAAUA,EACf8E,KAAKxC,QAAUA,EAGjByB,OAAMmB,UAAUqB,YAAc,SAASxG,GACrC,GAAImJ,EACJ,IAAIpE,KAAKe,OAAQ,CACf,GAAItD,GAAQuC,KAAKe,OAAOsD,KAAKpJ,EAC7BmJ,MACApE,KAAK+D,KAAKrH,QAAQ,SAAS4H,EAAKC,GAC9BH,EAAOE,EAAIpH,MAAQO,EAAM8G,EAAQ,KAIrC,MAAO,UAAS7G,GACd,MAAOsC,MAAKxC,QAAQE,EAAS0G,EAAQpE,KAAK9E,UAC1C0H,KAAK5C,OAGTlC,OAAOC,QAAUkB;;AH5CjB,YAKA,SAASH,aAAYC,GACnB,MAAOA,GAAEC,QAAQ,yBAA0B,QAJ7C,GAAIC,OAAQlD,QAAQ,WAChBZ,QAAUY,QAAQ,aAMlBmD,SAAW,SAASC,EAAKC,GAM3B,IAHA,GAAIC,GAAkBF,EAAIG,UACtB3C,EAAO0C,EAAgBE,OACvBC,MACI7C,EAAK8C,MAAM,CACjB,GAAIC,GAAU,GAAIC,QAAOhD,EAAKiD,MAAM,GAChCF,GAAQG,KAAKT,IACfI,EAAQM,KAAKnD,EAAKiD,MAAM,IAE1BjD,EAAO0C,EAAgBE,OAEzB,MAAOC,IAGLO,OAAS,WACXC,KAAKC,OAAS,GAAIC,KAElBF,KAAKC,OAAOE,IAAIR,OAAQ,GAAIO,MAC5BF,KAAKpC,QAAU,OAGhB,MAAO,OAAQ,MAAO,SAAU,OAAQ,OAAOlB,QAAQ,SAASmB,GAC/DkC,OAAOK,UAAUvC,GAAU,SAASwC,EAAM7C,EAAStC,GACjD,MAAO8E,MAAK1E,IAAIuC,EAAQwC,EAAM7C,EAAStC,MAI3C6E,OAAOK,UAAU9E,IAAM,SAASuC,EAAQwC,EAAM7C,EAAStC,GACrDA,EAAUA,KACV,IAAIoF,EAEAD,aAAgBV,QAIlBW,EAASX,QAETW,EAASpF,EAAQoF,QAAUxD,KAAK0B,SAAS8B,OAEvCA,EADEA,YAAkBX,QACXW,EAAOC,OAEPzB,YAAYwB,IAIzBzC,EAASA,EAAO2C,aAEhB,IAAIC,GAAQ,GAAIxB,OAAMpB,EAAQwC,EAAM7C,EAAStC,EAExC8E,MAAKC,OAAOS,IAAIJ,IACnBN,KAAKC,OAAOE,IAAIG,EAAQ,GAAIJ,KAG9B,IAAIS,GAAYX,KAAKC,OAAOW,IAAIN,EAC3BK,GAAUD,IAAI7C,IACjB8C,EAAUR,IAAItC,EAAQ,GAAIqC,KAG5B,IAAIW,GAAWF,EAAUC,IAAI/C,GACzBiD,EAASL,EAAMM,QAAUN,EAAMO,aAE/BH,GAASH,IAAII,EAAOP,SACtBpF,QAAQe,MAAM,IAAMmE,EAAO,+CAG7BQ,EAASV,IAAIW,EAAOP,OAAQE,IAG9BV,OAAOK,UAAUa,YAAc,SAASpD,EAAQ5C,GAC9C,GAAIiG,GAAY,GAAI3C,KAAItD,GACpBqF,EAASY,EAAUZ,OACnBD,EAAOa,EAAUC,QAOrB,OAAOnB,MAAKoB,OAAOvD,EAAQqB,SAASc,KAAKC,OAAQK,GAASD,IACxDL,KAAKoB,OAAOvD,GAASmC,KAAKC,OAAOW,IAAIjB,SAAU1E,IAGnD8E,OAAOK,UAAUgB,OAAS,SAASvD,EAAQwD,EAAYC,GACrD,GAA0B,IAAtBD,EAAWE,OACb,MAAO,KAGT,KAAK,GAAIC,GAAI,EAAGA,EAAIH,EAAWE,OAAQC,IAAK,CAC1C,GAAIb,GAAYU,EAAWG,GACvBX,EAAWF,GAAaA,EAAUC,IAAI/C,EAAO2C,cACjD,IAAIK,EAAU,CACZ,GAAIZ,GAASf,SAAS2B,EAAUS,EAChC,IAAIrB,EAAOsB,OAAS,EAClB,MAAOtB,GAAO,GAAGwB,YAAYH,IAKnC,MAAO,OAGTvB,OAAOK,UAAU3C,MAAQ,SAASC,GAChC,MAAOsC,MAAKiB,YAAYvD,EAAQG,OAAQH,EAAQzC,MAC5C+E,KAAKiB,YAAY,MAAOvD,EAAQzC,MAGtC6C,OAAOC,QAAU,GAAIgC;;ASrHrB,YAGA,SAAS5B,YAAWT,EAAS0G,EAAQlJ,GAEnC,MADAC,SAAQe,MAAM,0BAA4BwB,EAAQzC,IAAM,IAAKC,GACtDC,QAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,MAAOA,GAAMyC,MAAMC,GAASrC,KAAK,SAASgH,GACxC,MAAIA,GACKA,EAGFlH,QAAQ+G,cAAcxE,EAASxC,OAV5C,GAAIC,SAAUY,QAAQ,aAetB+B,QAAOC,QAAUI;;ADhBjB,YAGA,SAASD,WAAUR,EAAS0G,EAAQlJ,GAElC,MADAC,SAAQe,MAAM,yBAA2BwB,EAAQzC,IAAM,IAAKC,GACrDC,QAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,MAAOA,GAAMyC,MAAMC,KALvB,GAAIvC,SAAUY,QAAQ,aAStB+B,QAAOC,QAAUG;;AEVjB,YAIA,SAASE,SAAQV,EAAS0G,EAAQlJ,GAGhC,MAFAC,SAAQe,MAAM,sBAAwBwB,EAAQzC,IAAM,IAAKC,GAElD,GAAIS,SAAQ,SAAS8I,EAASC,GACnC,GAAI+D,IAAW,EACXC,KAEAC,EAAc,SAASC,GACzBF,EAAQ5I,KAAK8I,EAAOC,YAChBJ,EACF/D,EAAO,GAAI8C,OAAM,mCACbkB,EAAQrL,KAAK,QAAU,MAE3BoL,GAAW,GAIXK,EAAe,SAAS9D,GACtBA,YAAkB+D,UACpBtE,EAAQO,GAER2D,EAAY,sBAIhBxN,SAAQ+G,cAAcxE,EAAQ0E,QAASlH,GACpCG,KAAKyN,EAAcH,GAEtBzK,UAAUR,EAAS0G,EAAQlJ,GACxBG,KAAKyN,EAAcH,KAhC1B,GAAIxN,SAAUY,QAAQ,cAClBmC,UAAYnC,QAAQ,cAmCxB+B,QAAOC,QAAUK;;ARrCjBN,OAAOC,SACLC,YAAajC,QAAQ,iBACrBkC,aAAclC,QAAQ,kBACtBmC,UAAWnC,QAAQ,eACnBoC,WAAYpC,QAAQ,gBACpBqC,QAASrC,QAAQ;;AKLnB,YAIA,SAASkC,cAAaP,EAAS0G,EAAQlJ,GACrCA,EAAUA,KACV,IAAI2D,GAAmB3D,EAAQ2D,kBAC3B+C,cAAc/C,iBAGdD,EAAwB1D,EAAQ0D,uBAChCgD,cAAchD,qBAGlB,OAFAzD,SAAQe,MAAM,4BAA8BwB,EAAQzC,IAAM,IAAKC,GAExDC,QAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,GAAIgN,GAEAC,EADAC,IAGJ,IAAItJ,EAAuB,CACzB,GAAIuJ,GAA2B,GAAIxM,SAAQ,SAAS8I,GAClDuD,EAAYI,WAAW,WACrBpN,EAAMyC,MAAMC,GAASrC,KAAK,SAASgH,GAC7BA,GAKFoC,EAAQpC,MAGa,IAAxBzD,IAELsJ,GAASpI,KAAKqI,GAGhB,GAAIE,GAAiBlN,QAAQ+G,cAAcxE,EAASxC,GACjDG,KAAK,SAASgH,GAMb,GAJI2F,GACFM,aAAaN,GAGXnJ,EAAiBgB,KAAKwC,EAASC,QACjC,MAAOD,EAMT,MAHAlH,SAAQe,MAAM,+BAAiCmG,EAASkG,WACpDrN,GACJ+M,EAAmB5F,EACb,GAAImF,OAAM,kBACf/D,MAAM,SAASC,GAGhB,MAFAvI,SAAQe,MAAM,iDACVwB,EAAQzC,IAAM,IAAKC,GAChBF,EAAMyC,MAAMC,GAASrC,KAAK,SAASgH,GAExC,GAAIA,EACF,MAAOA,EAKT,IAAI4F,EACF,MAAOA,EAKT,MAAMvE,MAMZ,OAFAwE,GAASpI,KAAKuI,GAEP1M,QAAQ6M,KAAKN,KAzExB,GAAItG,eAAgB7F,QAAQ,cACxBZ,QAAUY,QAAQ,aA4EtB+B,QAAOC,QAAUE;;AD9EjB,YAGA,SAASD,aAAYN,EAAS0G,EAAQlJ,GAEpC,MADAC,SAAQe,MAAM,2BAA6BwB,EAAQzC,IAAM,IAAKC,GACvDiH,MAAMzE,GAJf,GAAIvC,SAAUY,QAAQ,aAOtB+B,QAAOC,QAAUC;;ARRjB,YA6EA,SAAShD,OAAMC,EAAKC,GAClB,MAAOC,SAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,MAAOA,GAAMM,IAAIL,KAIrB,QAASM,SAAQN,EAAKC,GACpB,MAAOC,SAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,MAAOA,GAAMQ,OAAOP,KAIxB,QAASQ,UAASC,GACVA,YAAiBC,UACrBC,sBAAsBF,GAGxBR,QAAQW,cAAgBX,QAAQW,cAAcC,OAAOJ,GA5FvDK,QAAQ,+BACR,IAAIb,SAAUa,QAAQ,aAClBC,OAASD,QAAQ,YACjBZ,QAAUY,QAAQ,aAClBE,WAAaF,QAAQ,eAEzBZ,SAAQe,MAAM,oCAGd,IAAIC,SAAU,SAAST,GACrB,MAAOA,GAAMU,OAAO,SAASC,EAAGC,GAC9B,MAAOD,GAAEP,OAAOQ,SAIhBV,sBAAwB,SAASF,GACnC,GAAIa,GAAUC,MAAMC,QAAQf,EAS5B,IARIa,GACFb,EAAMgB,QAAQ,SAASC,GACC,gBAATA,IAAsBA,YAAgBC,WACjDL,GAAU,MAKXA,EACH,KAAM,IAAIM,WAAU,4IAKtB,OAAOnB,GAGToB,MAAKC,iBAAiB,UAAW,SAASC,GACxC,GAAIC,GAAgB/B,QAAQF,MAAMkC,KAAO,gBACzC/B,SAAQe,MAAM,uBACdf,QAAQe,MAAM,mBAAqBe,EAAgB,KACnDD,EAAMG,UACJhC,QAAQC,WAAWJ,OAAQkC,KAAMD,KAChC5B,KAAK,SAASL,GACb,MAAOW,SAAQyB,IAAIlC,QAAQW,eAC1BR,KAAKc,SACLd,KAAKO,uBACLP,KAAK,SAASQ,GAGb,MAFAV,SAAQe,MAAM,mBACTL,EAAcwB,KAAK,OAAS,WAC1BrC,EAAMsC,OAAOzB,UAQ5BiB,KAAKC,iBAAiB,WAAY,SAASC,GACzC7B,QAAQe,MAAM,uBACd,IAAIe,GAAgB/B,QAAQF,MAAMkC,KAAO,gBACzCF,GAAMG,UAAUhC,QAAQoC,YAAYN,EAAe/B,QAAQF,MAAMkC,SAKnEJ,KAAKC,iBAAiB,QAAS,SAASC,GACtC,GAAIQ,GAAUxB,OAAOyB,MAAMT,EAAMU,QAE7BF,GACFR,EAAMW,YAAYH,EAAQR,EAAMU,UACvB1B,OAAO4B,SAAoC,QAAzBZ,EAAMU,QAAQG,QACzCb,EAAMW,YAAY3B,OAAO4B,QAAQZ,EAAMU,YA0B3CI,OAAOC,SACLC,YAAa/B,WAAW+B,YACxBC,aAAchC,WAAWgC,aACzBC,UAAWjC,WAAWiC,UACtBC,WAAYlC,WAAWkC,WACvBC,QAASnC,WAAWmC,QACpBpC,OAAQA,OACRd,QAASA,QACTF,MAAOA,MACPO,QAASA,QACTE,SAAUA;;Ac1HZqC,OAAOC,QAAUvB,MAAMC,SAAW,SAAU+P,GAC1C,MAA8C,kBAAvClF,OAAOlH,UAAUyI,SAAS4D,KAAKD;;ADkCxC,QAASxD,OAAOC,GAOd,IANA,GAIIC,GAJAC,KACA7E,EAAM,EACNC,EAAQ,EACRlE,EAAO,GAG6B,OAAhC6I,EAAME,YAAY/E,KAAK4E,KAAe,CAC5C,GAAII,GAAIH,EAAI,GACRI,EAAUJ,EAAI,GACdK,EAASL,EAAI3E,KAKjB,IAJAlE,GAAQ4I,EAAIO,MAAMjF,EAAOgF,GACzBhF,EAAQgF,EAASF,EAAE9H,OAGf+H,EACFjJ,GAAQiJ,EAAQ,OADlB,CAKA,GAAI/J,GAAO0J,EAAI1E,GACXkF,EAASP,EAAI,GACbhM,EAAOgM,EAAI,GACXQ,EAAUR,EAAI,GACdS,EAAQT,EAAI,GACZU,EAAWV,EAAI,GACfW,EAAWX,EAAI,EAGf7I,KACF8I,EAAOrJ,KAAKO,GACZA,EAAO,GAGT,IAAIyJ,GAAoB,MAAVL,GAA0B,MAARlK,GAAgBA,IAASkK,EACrDM,EAAsB,MAAbH,GAAiC,MAAbA,EAC7BI,EAAwB,MAAbJ,GAAiC,MAAbA,EAC/BK,EAAYf,EAAI,IAAM,IACtBxJ,EAAUgK,GAAWC,IAAUE,EAAW,KAAO,KAAOI,EAAY,MAExEd,GAAOrJ,MACL5C,KAAMA,GAAQoH,IACdmF,OAAQA,GAAU,GAClBQ,UAAWA,EACXD,SAAUA,EACVD,OAAQA,EACRD,QAASA,EACTD,WAAYA,EACZnK,QAASwK,YAAYxK,MAczB,MATI6E,GAAQ0E,EAAI1H,SACdlB,GAAQ4I,EAAIkB,OAAO5F,IAIjBlE,GACF8I,EAAOrJ,KAAKO,GAGP8I,EAST,QAASiB,SAASnB,GAChB,MAAOoB,kBAAiBrB,MAAMC,IAShC,QAASqB,0BAA0BrB,GACjC,MAAOsB,WAAUtB,GAAKjK,QAAQ,UAAW,SAAUwL,GACjD,MAAO,IAAMA,EAAEC,WAAW,GAAG5B,SAAS,IAAI6B,gBAU9C,QAASC,gBAAgB1B,GACvB,MAAOsB,WAAUtB,GAAKjK,QAAQ,QAAS,SAAUwL,GAC/C,MAAO,IAAMA,EAAEC,WAAW,GAAG5B,SAAS,IAAI6B,gBAO9C,QAASL,kBAAkBlB,GAKzB,IAAK,GAHD3J,GAAU,GAAIhD,OAAM2M,EAAO5H,QAGtBC,EAAI,EAAGA,EAAI2H,EAAO5H,OAAQC,IACR,gBAAd2H,GAAO3H,KAChBhC,EAAQgC,GAAK,GAAI7B,QAAO,OAASwJ,EAAO3H,GAAG9B,QAAU,MAIzD,OAAO,UAAUkL,EAAKC,GAMpB,IAAK,GALDxK,GAAO,GACPyK,EAAOF,MACP1P,EAAU2P,MACVE,EAAS7P,EAAQ8P,OAASV,yBAA2BW,mBAEhDzJ,EAAI,EAAGA,EAAI2H,EAAO5H,OAAQC,IAAK,CACtC,GAAI0J,GAAQ/B,EAAO3H,EAEnB,IAAqB,gBAAV0J,GAAX,CAMA,GACIC,GADAvL,EAAQkL,EAAKI,EAAMhO,KAGvB,IAAa,MAAT0C,EAAe,CACjB,GAAIsL,EAAMlB,SAAU,CAEdkB,EAAMpB,UACRzJ,GAAQ6K,EAAMzB,OAGhB,UAEA,KAAM,IAAI5M,WAAU,aAAeqO,EAAMhO,KAAO,mBAIpD,GAAIkO,QAAQxL,GAAZ,CACE,IAAKsL,EAAMnB,OACT,KAAM,IAAIlN,WAAU,aAAeqO,EAAMhO,KAAO,kCAAoCmO,KAAKC,UAAU1L,GAAS,IAG9G,IAAqB,IAAjBA,EAAM2B,OAAc,CACtB,GAAI2J,EAAMlB,SACR,QAEA,MAAM,IAAInN,WAAU,aAAeqO,EAAMhO,KAAO,qBAIpD,IAAK,GAAIqO,GAAI,EAAGA,EAAI3L,EAAM2B,OAAQgK,IAAK,CAGrC,GAFAJ,EAAUJ,EAAOnL,EAAM2L,KAElB/L,EAAQgC,GAAG3B,KAAKsL,GACnB,KAAM,IAAItO,WAAU,iBAAmBqO,EAAMhO,KAAO,eAAiBgO,EAAMxL,QAAU,oBAAsB2L,KAAKC,UAAUH,GAAW,IAGvI9K,KAAe,IAANkL,EAAUL,EAAMzB,OAASyB,EAAMjB,WAAakB,OApBzD,CA4BA,GAFAA,EAAUD,EAAMrB,SAAWc,eAAe/K,GAASmL,EAAOnL,IAErDJ,EAAQgC,GAAG3B,KAAKsL,GACnB,KAAM,IAAItO,WAAU,aAAeqO,EAAMhO,KAAO,eAAiBgO,EAAMxL,QAAU,oBAAsByL,EAAU,IAGnH9K,IAAQ6K,EAAMzB,OAAS0B,OArDrB9K,IAAQ6K,EAwDZ,MAAO7K,IAUX,QAASmL,cAAcvC,GACrB,MAAOA,GAAIjK,QAAQ,6BAA8B,QASnD,QAASkL,aAAaP,GACpB,MAAOA,GAAM3K,QAAQ,gBAAiB,QAUxC,QAASyM,YAAYC,EAAI3H,GAEvB,MADA2H,GAAG3H,KAAOA,EACH2H,EAST,QAASC,OAAOzQ,GACd,MAAOA,GAAQ0Q,UAAY,GAAK,IAUlC,QAASC,gBAAgBxL,EAAM0D,GAE7B,GAAI+H,GAASzL,EAAKE,OAAO9C,MAAM,YAE/B,IAAIqO,EACF,IAAK,GAAItK,GAAI,EAAGA,EAAIsK,EAAOvK,OAAQC,IACjCuC,EAAKjE,MACH5C,KAAMsE,EACNiI,OAAQ,KACRQ,UAAW,KACXD,UAAU,EACVD,QAAQ,EACRD,SAAS,EACTD,UAAU,EACVnK,QAAS,MAKf,OAAO+L,YAAWpL,EAAM0D,GAW1B,QAASgI,eAAe1L,EAAM0D,EAAM7I,GAGlC,IAAK,GAFD8Q,MAEKxK,EAAI,EAAGA,EAAInB,EAAKkB,OAAQC,IAC/BwK,EAAMlM,KAAKmM,aAAa5L,EAAKmB,GAAIuC,EAAM7I,GAASqF,OAGlD,IAAIQ,GAAS,GAAIpB,QAAO,MAAQqM,EAAM3O,KAAK,KAAO,IAAKsO,MAAMzQ,GAE7D,OAAOuQ,YAAW1K,EAAQgD,GAW5B,QAASmI,gBAAgB7L,EAAM0D,EAAM7I,GAKnC,IAAK,GAJDiO,GAASH,MAAM3I,GACfqL,EAAKS,eAAehD,EAAQjO,GAGvBsG,EAAI,EAAGA,EAAI2H,EAAO5H,OAAQC,IACR,gBAAd2H,GAAO3H,IAChBuC,EAAKjE,KAAKqJ,EAAO3H,GAIrB,OAAOiK,YAAWC,EAAI3H,GAUxB,QAASoI,gBAAgBhD,EAAQjO,GAC/BA,EAAUA,KASV,KAAK,GAPDkR,GAASlR,EAAQkR,OACjBC,EAAMnR,EAAQmR,OAAQ,EACtB5L,EAAQ,GACR6L,EAAYnD,EAAOA,EAAO5H,OAAS,GACnCgL,EAAqC,gBAAdD,IAA0B,MAAMzM,KAAKyM,GAGvD9K,EAAI,EAAGA,EAAI2H,EAAO5H,OAAQC,IAAK,CACtC,GAAI0J,GAAQ/B,EAAO3H,EAEnB,IAAqB,gBAAV0J,GACTzK,GAAS+K,aAAaN,OACjB,CACL,GAAIzB,GAAS+B,aAAaN,EAAMzB,QAC5BC,EAAU,MAAQwB,EAAMxL,QAAU,GAElCwL,GAAMnB,SACRL,GAAW,MAAQD,EAASC,EAAU,MAOpCA,EAJAwB,EAAMlB,SACHkB,EAAMpB,QAGCL,EAAS,IAAMC,EAAU,KAFzB,MAAQD,EAAS,IAAMC,EAAU,MAKnCD,EAAS,IAAMC,EAAU,IAGrCjJ,GAASiJ,GAoBb,MAZK0C,KACH3L,GAAS8L,EAAgB9L,EAAM+I,MAAM,GAAG,GAAM/I,GAAS,iBAIvDA,GADE4L,EACO,IAIAD,GAAUG,EAAgB,GAAK,YAGnC,GAAI5M,QAAO,IAAMc,EAAOkL,MAAMzQ,IAevC,QAAS+Q,cAAc5L,EAAM0D,EAAM7I,GAUjC,MATA6I,GAAOA,MAEFqH,QAAQrH,GAGD7I,IACVA,OAHAA,EAAiC,EACjC6I,MAKE1D,YAAgBV,QACXkM,eAAexL,EAA4B,GAGhD+K,QAAQ/K,GACH0L,cAAoC,EAA8B,EAAQ7Q,GAG5EgR,eAAqC,EAA8B,EAAQhR,GAxapF,GAAIkQ,SAAUrP,QAAQ,UAKtB+B,QAAOC,QAAUkO,aACjBnO,OAAOC,QAAQiL,MAAQA,MACvBlL,OAAOC,QAAQqM,QAAUA,QACzBtM,OAAOC,QAAQsM,iBAAmBA,iBAClCvM,OAAOC,QAAQoO,eAAiBA,cAOhC,IAAI/C,aAAc,GAAIzJ,SAGpB,UAOA,0GACAtC,KAAK,KAAM;;CNVZ,WACC,GAAIwJ,GAAeC,MAAM1G,UAAU9C,OAC/ByJ,EAAYC,UAAUD,UAAUtJ,MAAM,4BAG1C,IAAIsJ,EACF,GAAIE,GAAQF,EAAU,GAClBG,EAAUC,SAASJ,EAAU,GAIjCF,MAAkBE,GACL,YAAVE,GAAuBC,GAAW,IACxB,WAAVD,GAAuBC,GAAW,MAMvCJ,MAAM1G,UAAU9C,OAAS,SAAgB0G,GAIvC,QAASoD,GAAa1F,GACpB1B,KAAK9C,KAAO,eACZ8C,KAAKqH,KAAO,GACZrH,KAAK0B,QAAUA,EANjB,GAAI1G,GAAQgF,IAWZ,OAFAoH,GAAahH,UAAYkH,OAAOC,OAAOC,MAAMpH,WAEtCzE,QAAQ8I,UAAUpJ,KAAK,WAC5B,GAAIoM,UAAUlG,OAAS,EAAG,KAAM,IAAI1E,UAcpC,OATAmH,GAAWA,EAAS7E,IAAI,SAASzB,GAC/B,MAAIA,aAAmBd,SACdc,EAGAgK,OAAOhK,KAIX/B,QAAQyB,IACb4G,EAAS7E,IAAI,SAASzB,GACG,gBAAZA,KACTA,EAAU,GAAId,SAAQc,GAGxB,IAAIiK,GAAS,GAAIpJ,KAAIb,EAAQzC,KAAK2M,QAElC,IAAe,UAAXD,GAAiC,WAAXA,EACxB,KAAM,IAAIP,GAAa,iBAGzB,OAAOjF,OAAMzE,EAAQ0E,cAGxB/G,KAAK,SAASwM,GAGf,GAAIA,EAAUC,KAAK,SAASzF,GAC1B,OAAQA,EAAS0F,KAEjB,KAAM,IAAIX,GAAa,4BAKzB,OAAOzL,SAAQyB,IACbyK,EAAU1I,IAAI,SAASkD,EAAUb,GAC/B,MAAOxG,GAAMuH,IAAIyB,EAASxC,GAAIa,QAGjChH,KAAK,eAKVyL,MAAM1G,UAAU9E,IAAM,SAAaoC,GACjC,MAAOsC,MAAK1C,QAAQI","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0) {\n return routes[0].makeHandler(pathOrUrl);\n }\n }\n }\n\n return null;\n};\n\nRouter.prototype.match = function(request) {\n return this.matchMethod(request.method, request.url) ||\n this.matchMethod('any', request.url);\n};\n\nmodule.exports = new Router();\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nvar globalOptions = require('./options');\nvar idbCacheExpiration = require('./idb-cache-expiration');\n\nfunction debug(message, options) {\n options = options || {};\n var flag = options.debug || globalOptions.debug;\n if (flag) {\n console.log('[sw-toolbox] ' + message);\n }\n}\n\nfunction openCache(options) {\n var cacheName;\n if (options && options.cache) {\n cacheName = options.cache.name;\n }\n cacheName = cacheName || globalOptions.cache.name;\n\n return caches.open(cacheName);\n}\n\nfunction fetchAndCache(request, options) {\n options = options || {};\n var successResponses = options.successResponses ||\n globalOptions.successResponses;\n\n return fetch(request.clone()).then(function(response) {\n // Only cache GET requests with successful responses.\n // Since this is not part of the promise chain, it will be done\n // asynchronously and will not block the response from being returned to the\n // page.\n if (request.method === 'GET' && successResponses.test(response.status)) {\n openCache(options).then(function(cache) {\n cache.put(request, response).then(function() {\n // If any of the options are provided in options.cache then use them.\n // Do not fallback to the global options for any that are missing\n // unless they are all missing.\n var cacheOptions = options.cache || globalOptions.cache;\n\n // Only run the cache expiration logic if at least one of the maximums\n // is set, and if we have a name for the cache that the options are\n // being applied to.\n if ((cacheOptions.maxEntries || cacheOptions.maxAgeSeconds) &&\n cacheOptions.name) {\n queueCacheExpiration(request, cache, cacheOptions);\n }\n });\n });\n }\n\n return response.clone();\n });\n}\n\nvar cleanupQueue;\nfunction queueCacheExpiration(request, cache, cacheOptions) {\n var cleanup = cleanupCache.bind(null, request, cache, cacheOptions);\n\n if (cleanupQueue) {\n cleanupQueue = cleanupQueue.then(cleanup);\n } else {\n cleanupQueue = cleanup();\n }\n}\n\nfunction cleanupCache(request, cache, cacheOptions) {\n var requestUrl = request.url;\n var maxAgeSeconds = cacheOptions.maxAgeSeconds;\n var maxEntries = cacheOptions.maxEntries;\n var cacheName = cacheOptions.name;\n\n var now = Date.now();\n debug('Updating LRU order for ' + requestUrl + '. Max entries is ' +\n maxEntries + ', max age is ' + maxAgeSeconds);\n\n return idbCacheExpiration.getDb(cacheName).then(function(db) {\n return idbCacheExpiration.setTimestampForUrl(db, requestUrl, now);\n }).then(function(db) {\n return idbCacheExpiration.expireEntries(db, maxEntries, maxAgeSeconds, now);\n }).then(function(urlsToDelete) {\n debug('Successfully updated IDB.');\n\n var deletionPromises = urlsToDelete.map(function(urlToDelete) {\n return cache.delete(urlToDelete);\n });\n\n return Promise.all(deletionPromises).then(function() {\n debug('Done with cache cleanup.');\n });\n }).catch(function(error) {\n debug(error);\n });\n}\n\nfunction renameCache(source, destination, options) {\n debug('Renaming cache: [' + source + '] to [' + destination + ']', options);\n return caches.delete(destination).then(function() {\n return Promise.all([\n caches.open(source),\n caches.open(destination)\n ]).then(function(results) {\n var sourceCache = results[0];\n var destCache = results[1];\n\n return sourceCache.keys().then(function(requests) {\n return Promise.all(requests.map(function(request) {\n return sourceCache.match(request).then(function(response) {\n return destCache.put(request, response);\n });\n }));\n }).then(function() {\n return caches.delete(source);\n });\n });\n });\n}\n\nmodule.exports = {\n debug: debug,\n fetchAndCache: fetchAndCache,\n openCache: openCache,\n renameCache: renameCache\n};\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\nmodule.exports = {\n networkOnly: require('./networkOnly'),\n networkFirst: require('./networkFirst'),\n cacheOnly: require('./cacheOnly'),\n cacheFirst: require('./cacheFirst'),\n fastest: require('./fastest')\n};\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\n// TODO: Use self.registration.scope instead of self.location\nvar url = new URL('./', self.location);\nvar basePath = url.pathname;\nvar pathRegexp = require('path-to-regexp');\n\nvar Route = function(method, path, handler, options) {\n if (path instanceof RegExp) {\n this.fullUrlRegExp = path;\n } else {\n // The URL() constructor can't parse express-style routes as they are not\n // valid urls. This means we have to manually manipulate relative urls into\n // absolute ones. This check is extremely naive but implementing a tweaked\n // version of the full algorithm seems like overkill\n // (https://url.spec.whatwg.org/#concept-basic-url-parser)\n if (path.indexOf('/') !== 0) {\n path = basePath + path;\n }\n\n this.keys = [];\n this.regexp = pathRegexp(path, this.keys);\n }\n\n this.method = method;\n this.options = options;\n this.handler = handler;\n};\n\nRoute.prototype.makeHandler = function(url) {\n var values;\n if (this.regexp) {\n var match = this.regexp.exec(url);\n values = {};\n this.keys.forEach(function(key, index) {\n values[key.name] = match[index + 1];\n });\n }\n\n return function(request) {\n return this.handler(request, values, this.options);\n }.bind(this);\n};\n\nmodule.exports = Route;\n","/*\n Copyright 2015 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nvar DB_PREFIX = 'sw-toolbox-';\nvar DB_VERSION = 1;\nvar STORE_NAME = 'store';\nvar URL_PROPERTY = 'url';\nvar TIMESTAMP_PROPERTY = 'timestamp';\nvar cacheNameToDbPromise = {};\n\nfunction openDb(cacheName) {\n return new Promise(function(resolve, reject) {\n var request = indexedDB.open(DB_PREFIX + cacheName, DB_VERSION);\n\n request.onupgradeneeded = function() {\n var objectStore = request.result.createObjectStore(STORE_NAME,\n {keyPath: URL_PROPERTY});\n objectStore.createIndex(TIMESTAMP_PROPERTY, TIMESTAMP_PROPERTY,\n {unique: false});\n };\n\n request.onsuccess = function() {\n resolve(request.result);\n };\n\n request.onerror = function() {\n reject(request.error);\n };\n });\n}\n\nfunction getDb(cacheName) {\n if (!(cacheName in cacheNameToDbPromise)) {\n cacheNameToDbPromise[cacheName] = openDb(cacheName);\n }\n\n return cacheNameToDbPromise[cacheName];\n}\n\nfunction setTimestampForUrl(db, url, now) {\n return new Promise(function(resolve, reject) {\n var transaction = db.transaction(STORE_NAME, 'readwrite');\n var objectStore = transaction.objectStore(STORE_NAME);\n objectStore.put({url: url, timestamp: now});\n\n transaction.oncomplete = function() {\n resolve(db);\n };\n\n transaction.onabort = function() {\n reject(transaction.error);\n };\n });\n}\n\nfunction expireOldEntries(db, maxAgeSeconds, now) {\n // Bail out early by resolving with an empty array if we're not using\n // maxAgeSeconds.\n if (!maxAgeSeconds) {\n return Promise.resolve([]);\n }\n\n return new Promise(function(resolve, reject) {\n var maxAgeMillis = maxAgeSeconds * 1000;\n var urls = [];\n\n var transaction = db.transaction(STORE_NAME, 'readwrite');\n var objectStore = transaction.objectStore(STORE_NAME);\n var index = objectStore.index(TIMESTAMP_PROPERTY);\n\n index.openCursor().onsuccess = function(cursorEvent) {\n var cursor = cursorEvent.target.result;\n if (cursor) {\n if (now - maxAgeMillis > cursor.value[TIMESTAMP_PROPERTY]) {\n var url = cursor.value[URL_PROPERTY];\n urls.push(url);\n objectStore.delete(url);\n cursor.continue();\n }\n }\n };\n\n transaction.oncomplete = function() {\n resolve(urls);\n };\n\n transaction.onabort = reject;\n });\n}\n\nfunction expireExtraEntries(db, maxEntries) {\n // Bail out early by resolving with an empty array if we're not using\n // maxEntries.\n if (!maxEntries) {\n return Promise.resolve([]);\n }\n\n return new Promise(function(resolve, reject) {\n var urls = [];\n\n var transaction = db.transaction(STORE_NAME, 'readwrite');\n var objectStore = transaction.objectStore(STORE_NAME);\n var index = objectStore.index(TIMESTAMP_PROPERTY);\n\n var countRequest = index.count();\n index.count().onsuccess = function() {\n var initialCount = countRequest.result;\n\n if (initialCount > maxEntries) {\n index.openCursor().onsuccess = function(cursorEvent) {\n var cursor = cursorEvent.target.result;\n if (cursor) {\n var url = cursor.value[URL_PROPERTY];\n urls.push(url);\n objectStore.delete(url);\n if (initialCount - urls.length > maxEntries) {\n cursor.continue();\n }\n }\n };\n }\n };\n\n transaction.oncomplete = function() {\n resolve(urls);\n };\n\n transaction.onabort = reject;\n });\n}\n\nfunction expireEntries(db, maxEntries, maxAgeSeconds, now) {\n return expireOldEntries(db, maxAgeSeconds, now).then(function(oldUrls) {\n return expireExtraEntries(db, maxEntries).then(function(extraUrls) {\n return oldUrls.concat(extraUrls);\n });\n });\n}\n\nmodule.exports = {\n getDb: getDb,\n setTimestampForUrl: setTimestampForUrl,\n expireEntries: expireEntries\n};\n","/**\n * Copyright 2015 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n(function() {\n var nativeAddAll = Cache.prototype.addAll;\n var userAgent = navigator.userAgent.match(/(Firefox|Chrome)\\/(\\d+\\.)/);\n\n // Has nice behavior of `var` which everyone hates\n if (userAgent) {\n var agent = userAgent[1];\n var version = parseInt(userAgent[2]);\n }\n\n if (\n nativeAddAll && (!userAgent ||\n (agent === 'Firefox' && version >= 46) ||\n (agent === 'Chrome' && version >= 50)\n )\n ) {\n return;\n }\n\n Cache.prototype.addAll = function addAll(requests) {\n var cache = this;\n\n // Since DOMExceptions are not constructable:\n function NetworkError(message) {\n this.name = 'NetworkError';\n this.code = 19;\n this.message = message;\n }\n\n NetworkError.prototype = Object.create(Error.prototype);\n\n return Promise.resolve().then(function() {\n if (arguments.length < 1) throw new TypeError();\n\n // Simulate sequence<(Request or USVString)> binding:\n var sequence = [];\n\n requests = requests.map(function(request) {\n if (request instanceof Request) {\n return request;\n }\n else {\n return String(request); // may throw TypeError\n }\n });\n\n return Promise.all(\n requests.map(function(request) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n var scheme = new URL(request.url).protocol;\n\n if (scheme !== 'http:' && scheme !== 'https:') {\n throw new NetworkError(\"Invalid scheme\");\n }\n\n return fetch(request.clone());\n })\n );\n }).then(function(responses) {\n // If some of the responses has not OK-eish status,\n // then whole operation should reject\n if (responses.some(function(response) {\n return !response.ok;\n })) {\n throw new NetworkError('Incorrect response status');\n }\n\n // TODO: check that requests don't overwrite one another\n // (don't think this is possible to polyfill due to opaque responses)\n return Promise.all(\n responses.map(function(response, i) {\n return cache.put(requests[i], response);\n })\n );\n }).then(function() {\n return undefined;\n });\n };\n\n Cache.prototype.add = function add(request) {\n return this.addAll([request]);\n };\n}());","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction networkOnly(request, values, options) {\n helpers.debug('Strategy: network only [' + request.url + ']', options);\n return fetch(request);\n}\n\nmodule.exports = networkOnly;\n","/*\n Copyright 2015 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar globalOptions = require('../options');\nvar helpers = require('../helpers');\n\nfunction networkFirst(request, values, options) {\n options = options || {};\n var successResponses = options.successResponses ||\n globalOptions.successResponses;\n // This will bypass options.networkTimeout if it's set to a false-y value like\n // 0, but that's the sane thing to do anyway.\n var networkTimeoutSeconds = options.networkTimeoutSeconds ||\n globalOptions.networkTimeoutSeconds;\n helpers.debug('Strategy: network first [' + request.url + ']', options);\n\n return helpers.openCache(options).then(function(cache) {\n var timeoutId;\n var promises = [];\n var originalResponse;\n\n if (networkTimeoutSeconds) {\n var cacheWhenTimedOutPromise = new Promise(function(resolve) {\n timeoutId = setTimeout(function() {\n cache.match(request).then(function(response) {\n if (response) {\n // Only resolve this promise if there's a valid response in the\n // cache. This ensures that we won't time out a network request\n // unless there's a cached entry to fallback on, which is arguably\n // the preferable behavior.\n resolve(response);\n }\n });\n }, networkTimeoutSeconds * 1000);\n });\n promises.push(cacheWhenTimedOutPromise);\n }\n\n var networkPromise = helpers.fetchAndCache(request, options)\n .then(function(response) {\n // We've got a response, so clear the network timeout if there is one.\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n if (successResponses.test(response.status)) {\n return response;\n }\n\n helpers.debug('Response was an HTTP error: ' + response.statusText,\n options);\n originalResponse = response;\n throw new Error('Bad response');\n }).catch(function(error) {\n helpers.debug('Network or response error, fallback to cache [' +\n request.url + ']', options);\n return cache.match(request).then(function(response) {\n // If there's a match in the cache, resolve with that.\n if (response) {\n return response;\n }\n\n // If we have a Response object from the previous fetch, then resolve\n // with that, even though it corresponds to an error status code.\n if (originalResponse) {\n return originalResponse;\n }\n\n // If we don't have a Response object from the previous fetch, likely\n // due to a network failure, then reject with the failure error.\n throw error;\n });\n });\n\n promises.push(networkPromise);\n\n return Promise.race(promises);\n });\n}\n\nmodule.exports = networkFirst;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheOnly(request, values, options) {\n helpers.debug('Strategy: cache only [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request);\n });\n}\n\nmodule.exports = cacheOnly;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheFirst(request, values, options) {\n helpers.debug('Strategy: cache first [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request).then(function(response) {\n if (response) {\n return response;\n }\n\n return helpers.fetchAndCache(request, options);\n });\n });\n}\n\nmodule.exports = cacheFirst;\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\nvar cacheOnly = require('./cacheOnly');\n\nfunction fastest(request, values, options) {\n helpers.debug('Strategy: fastest [' + request.url + ']', options);\n\n return new Promise(function(resolve, reject) {\n var rejected = false;\n var reasons = [];\n\n var maybeReject = function(reason) {\n reasons.push(reason.toString());\n if (rejected) {\n reject(new Error('Both cache and network failed: \"' +\n reasons.join('\", \"') + '\"'));\n } else {\n rejected = true;\n }\n };\n\n var maybeResolve = function(result) {\n if (result instanceof Response) {\n resolve(result);\n } else {\n maybeReject('No result returned');\n }\n };\n\n helpers.fetchAndCache(request.clone(), options)\n .then(maybeResolve, maybeReject);\n\n cacheOnly(request, values, options)\n .then(maybeResolve, maybeReject);\n });\n}\n\nmodule.exports = fastest;\n","var isarray = require('isarray')\n\n/**\n * Expose `pathToRegexp`.\n */\nmodule.exports = pathToRegexp\nmodule.exports.parse = parse\nmodule.exports.compile = compile\nmodule.exports.tokensToFunction = tokensToFunction\nmodule.exports.tokensToRegExp = tokensToRegExp\n\n/**\n * The main path matching regexp utility.\n *\n * @type {RegExp}\n */\nvar PATH_REGEXP = new RegExp([\n // Match escaped characters that would otherwise appear in future matches.\n // This allows the user to escape special characters that won't transform.\n '(\\\\\\\\.)',\n // Match Express-style parameters and un-named parameters with a prefix\n // and optional suffixes. Matches appear as:\n //\n // \"/:test(\\\\d+)?\" => [\"/\", \"test\", \"\\d+\", undefined, \"?\", undefined]\n // \"/route(\\\\d+)\" => [undefined, undefined, undefined, \"\\d+\", undefined, undefined]\n // \"/*\" => [\"/\", undefined, undefined, undefined, undefined, \"*\"]\n '([\\\\/.])?(?:(?:\\\\:(\\\\w+)(?:\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))?|\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))([+*?])?|(\\\\*))'\n].join('|'), 'g')\n\n/**\n * Parse a string for the raw tokens.\n *\n * @param {string} str\n * @return {!Array}\n */\nfunction parse (str) {\n var tokens = []\n var key = 0\n var index = 0\n var path = ''\n var res\n\n while ((res = PATH_REGEXP.exec(str)) != null) {\n var m = res[0]\n var escaped = res[1]\n var offset = res.index\n path += str.slice(index, offset)\n index = offset + m.length\n\n // Ignore already escaped sequences.\n if (escaped) {\n path += escaped[1]\n continue\n }\n\n var next = str[index]\n var prefix = res[2]\n var name = res[3]\n var capture = res[4]\n var group = res[5]\n var modifier = res[6]\n var asterisk = res[7]\n\n // Push the current path onto the tokens.\n if (path) {\n tokens.push(path)\n path = ''\n }\n\n var partial = prefix != null && next != null && next !== prefix\n var repeat = modifier === '+' || modifier === '*'\n var optional = modifier === '?' || modifier === '*'\n var delimiter = res[2] || '/'\n var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?')\n\n tokens.push({\n name: name || key++,\n prefix: prefix || '',\n delimiter: delimiter,\n optional: optional,\n repeat: repeat,\n partial: partial,\n asterisk: !!asterisk,\n pattern: escapeGroup(pattern)\n })\n }\n\n // Match any characters still remaining.\n if (index < str.length) {\n path += str.substr(index)\n }\n\n // If the path exists, push it onto the end.\n if (path) {\n tokens.push(path)\n }\n\n return tokens\n}\n\n/**\n * Compile a string to a template function for the path.\n *\n * @param {string} str\n * @return {!function(Object=, Object=)}\n */\nfunction compile (str) {\n return tokensToFunction(parse(str))\n}\n\n/**\n * Prettier encoding of URI path segments.\n *\n * @param {string}\n * @return {string}\n */\nfunction encodeURIComponentPretty (str) {\n return encodeURI(str).replace(/[\\/?#]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase()\n })\n}\n\n/**\n * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.\n *\n * @param {string}\n * @return {string}\n */\nfunction encodeAsterisk (str) {\n return encodeURI(str).replace(/[?#]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase()\n })\n}\n\n/**\n * Expose a method for transforming tokens into the path function.\n */\nfunction tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length)\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n }\n }\n\n return function (obj, opts) {\n var path = ''\n var data = obj || {}\n var options = opts || {}\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (typeof token === 'string') {\n path += token\n\n continue\n }\n\n var value = data[token.name]\n var segment\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j])\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment\n }\n\n return path\n }\n}\n\n/**\n * Escape a regular expression string.\n *\n * @param {string} str\n * @return {string}\n */\nfunction escapeString (str) {\n return str.replace(/([.+*?=^!:${}()[\\]|\\/\\\\])/g, '\\\\$1')\n}\n\n/**\n * Escape the capturing group by escaping special characters and meaning.\n *\n * @param {string} group\n * @return {string}\n */\nfunction escapeGroup (group) {\n return group.replace(/([=!:$\\/()])/g, '\\\\$1')\n}\n\n/**\n * Attach the keys as a property of the regexp.\n *\n * @param {!RegExp} re\n * @param {Array} keys\n * @return {!RegExp}\n */\nfunction attachKeys (re, keys) {\n re.keys = keys\n return re\n}\n\n/**\n * Get the flags for a regexp from the options.\n *\n * @param {Object} options\n * @return {string}\n */\nfunction flags (options) {\n return options.sensitive ? '' : 'i'\n}\n\n/**\n * Pull out keys from a regexp.\n *\n * @param {!RegExp} path\n * @param {!Array} keys\n * @return {!RegExp}\n */\nfunction regexpToRegexp (path, keys) {\n // Use a negative lookahead to match only capturing groups.\n var groups = path.source.match(/\\((?!\\?)/g)\n\n if (groups) {\n for (var i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n prefix: null,\n delimiter: null,\n optional: false,\n repeat: false,\n partial: false,\n asterisk: false,\n pattern: null\n })\n }\n }\n\n return attachKeys(path, keys)\n}\n\n/**\n * Transform an array into a regexp.\n *\n * @param {!Array} path\n * @param {Array} keys\n * @param {!Object} options\n * @return {!RegExp}\n */\nfunction arrayToRegexp (path, keys, options) {\n var parts = []\n\n for (var i = 0; i < path.length; i++) {\n parts.push(pathToRegexp(path[i], keys, options).source)\n }\n\n var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))\n\n return attachKeys(regexp, keys)\n}\n\n/**\n * Create a path regexp from string input.\n *\n * @param {string} path\n * @param {!Array} keys\n * @param {!Object} options\n * @return {!RegExp}\n */\nfunction stringToRegexp (path, keys, options) {\n var tokens = parse(path)\n var re = tokensToRegExp(tokens, options)\n\n // Attach keys back to the regexp.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] !== 'string') {\n keys.push(tokens[i])\n }\n }\n\n return attachKeys(re, keys)\n}\n\n/**\n * Expose a function for taking tokens and returning a RegExp.\n *\n * @param {!Array} tokens\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction tokensToRegExp (tokens, options) {\n options = options || {}\n\n var strict = options.strict\n var end = options.end !== false\n var route = ''\n var lastToken = tokens[tokens.length - 1]\n var endsWithSlash = typeof lastToken === 'string' && /\\/$/.test(lastToken)\n\n // Iterate over the tokens and create our regexp string.\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (typeof token === 'string') {\n route += escapeString(token)\n } else {\n var prefix = escapeString(token.prefix)\n var capture = '(?:' + token.pattern + ')'\n\n if (token.repeat) {\n capture += '(?:' + prefix + capture + ')*'\n }\n\n if (token.optional) {\n if (!token.partial) {\n capture = '(?:' + prefix + '(' + capture + '))?'\n } else {\n capture = prefix + '(' + capture + ')?'\n }\n } else {\n capture = prefix + '(' + capture + ')'\n }\n\n route += capture\n }\n }\n\n // In non-strict mode we allow a slash at the end of match. If the path to\n // match already ends with a slash, we remove it for consistency. The slash\n // is valid at the end of a path match, not in the middle. This is important\n // in non-ending mode, where \"/test/\" shouldn't match \"/test//route\".\n if (!strict) {\n route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\\\/(?=$))?'\n }\n\n if (end) {\n route += '$'\n } else {\n // In non-ending mode, we need the capturing groups to match as much as\n // possible by using a positive lookahead to the end or next path segment.\n route += strict && endsWithSlash ? '' : '(?=\\\\/|$)'\n }\n\n return new RegExp('^' + route, flags(options))\n}\n\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n *\n * @param {(string|RegExp|Array)} path\n * @param {(Array|Object)=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction pathToRegexp (path, keys, options) {\n keys = keys || []\n\n if (!isarray(keys)) {\n options = /** @type {!Object} */ (keys)\n keys = []\n } else if (!options) {\n options = {}\n }\n\n if (path instanceof RegExp) {\n return regexpToRegexp(path, /** @type {!Array} */ (keys))\n }\n\n if (isarray(path)) {\n return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)\n }\n\n return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)\n}\n","module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 45f39c0f..f058ea22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polymer-cdn", - "version": "1.7.0", + "version": "1.7.0.2", "description": "A mirror of Polymer so it can be used from CDN.", "keywords": ["polymer", "cdn"], "homepage": "https://github.com/download/polymer-cdn",