New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb

Package Overview
Dependencies
Maintainers
8
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb - npm Package Compare versions

Comparing version 6.2.0 to 6.2.1-prerelease

bower.json

6

dist/pouchdb.find.min.js

@@ -1,2 +0,2 @@

// pouchdb-find plugin 6.2.0
// pouchdb-find plugin 6.2.1-prerelease
// Based on Mango: https://github.com/cloudant/mango

@@ -8,3 +8,3 @@ //

// http://pouchdb.com
!function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return i(n||e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t,n){"use strict";function r(e){return function(){var t=arguments.length;if(t){for(var n=[],r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}return e.call(this,[])}}t.exports=r},{}],2:[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 u(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,a,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])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(u(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,a=0;a<r;a++)c[a].apply(this,o);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?u(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,u(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&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(u(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){return 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)}},{}],3:[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<n;)t[e]();n=l.length}f=!1}function r(e){1!==l.push(e)||f||i()}var i,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var u=0,s=new o(n),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),i=function(){a.data=u=++u%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var c=new e.MessageChannel;c.port1.onmessage=n,i=function(){c.port2.postMessage(0)}}var f,l=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],5:[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=m,this.queue=[],this.outcome=void 0,e!==r&&a(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 u(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return v.reject(e,t)}r===e?v.reject(e,new TypeError("Cannot resolve promise with itself")):v.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function a(e,t){function n(t){o||(o=!0,v.reject(e,t))}function r(t){o||(o=!0,v.resolve(e,t))}function i(){t(r,n)}var o=!1,u=c(i);"error"===u.status&&n(u.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:v.resolve(new this(r),e)}function l(e){var t=new this(r);return v.reject(t,e)}function d(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),u=0,s=-1,a=new this(r);++s<n;)!function(e,r){function s(e){o[r]=e,++u!==n||i||(i=!0,v.resolve(a,o))}t.resolve(e).then(s,function(e){i||(i=!0,v.reject(a,e))})}(e[s],s);return a}function h(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,u=new this(r);++o<n;)!function(e){t.resolve(e).then(function(e){i||(i=!0,v.resolve(u,e))},function(e){i||(i=!0,v.reject(u,e))})}(e[o]);return u}var p=e(3),v={},y=["REJECTED"],g=["FULFILLED"],m=["PENDING"];t.exports=i,i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){if("function"!=typeof e&&this.state===g||"function"!=typeof t&&this.state===y)return this;var n=new this.constructor(r);if(this.state!==m){u(n,this.state===g?e:t,this.outcome)}else this.queue.push(new o(n,e,t));return n},o.prototype.callFulfilled=function(e){v.resolve(this.promise,e)},o.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},o.prototype.callRejected=function(e){v.reject(this.promise,e)},o.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},v.resolve=function(e,t){var n=c(s,t);if("error"===n.status)return v.reject(e,n.value);var r=n.value;if(r)a(e,r);else{e.state=g,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},v.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},i.resolve=f,i.reject=l,i.all=d,i.race=h},{3:3}],6:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function u(e){if(d===clearTimeout)return clearTimeout(e);if((d===i||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function s(){y&&p&&(y=!1,p.length?v=p.concat(v):g=-1,v.length&&a())}function a(){if(!y){var e=o(s);y=!0;for(var t=v.length;t;){for(p=v,v=[];++g<t;)p&&p[g].run();g=-1,t=v.length}p=null,y=!1,u(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,d,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{d="function"==typeof clearTimeout?clearTimeout:i}catch(e){d=i}}();var p,v=[],y=!1,g=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];v.push(new c(e,t)),1!==v.length||y||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],7:[function(e,t,n){!function(e){if("object"==typeof n)t.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;try{r=window}catch(e){r=self}r.SparkMD5=e()}}(function(e){"use strict";function t(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];n+=(r&i|~r&o)+t[0]-680876936|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[1]-389564586|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[2]+606105819|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[3]-1044525330|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[4]-176418897|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[5]+1200080426|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[6]-1473231341|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[7]-45705983|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[8]+1770035416|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[9]-1958414417|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[10]-42063|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[11]-1990404162|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[12]+1804603682|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[13]-40341101|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[14]-1502002290|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[15]+1236535329|0,r=(r<<22|r>>>10)+i|0,n+=(r&o|i&~o)+t[1]-165796510|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[6]-1069501632|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[11]+643717713|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[0]-373897302|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[5]-701558691|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[10]+38016083|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[15]-660478335|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[4]-405537848|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[9]+568446438|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[14]-1019803690|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[3]-187363961|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[8]+1163531501|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[13]-1444681467|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[2]-51403784|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[7]+1735328473|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[12]-1926607734|0,r=(r<<20|r>>>12)+i|0,n+=(r^i^o)+t[5]-378558|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[8]-2022574463|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[11]+1839030562|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[14]-35309556|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[1]-1530992060|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[4]+1272893353|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[7]-155497632|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[10]-1094730640|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[13]+681279174|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[0]-358537222|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[3]-722521979|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[6]+76029189|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[9]-640364487|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[12]-421815835|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[15]+530742520|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[2]-995338651|0,r=(r<<23|r>>>9)+i|0,n+=(i^(r|~o))+t[0]-198630844|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[7]+1126891415|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[14]-1416354905|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[5]-57434055|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[12]+1700485571|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[3]-1894986606|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[10]-1051523|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[1]-2054922799|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[8]+1873313359|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[15]-30611744|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[6]-1560198380|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[13]+1309151649|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[4]-145523070|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[11]-1120210379|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[2]+718787259|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[9]-343485551|0,r=(r<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function n(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 r(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 i(e){var r,i,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(r=64;r<=c;r+=64)t(f,n(e.substring(r-64,r)));for(e=e.substring(r-64),i=e.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<i;r+=1)o[r>>2]|=e.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(t(f,o),r=0;r<16;r+=1)o[r]=0;return u=8*c,u=u.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,t(f,o),f}function o(e){var n,i,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=c;n+=64)t(f,r(e.subarray(n-64,n)));for(e=n-64<c?e.subarray(n-64):new Uint8Array(0),i=e.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<i;n+=1)o[n>>2]|=e[n]<<(n%4<<3);if(o[n>>2]|=128<<(n%4<<3),n>55)for(t(f,o),n=0;n<16;n+=1)o[n]=0;return u=8*c,u=u.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,t(f,o),f}function u(e){var t,n="";for(t=0;t<4;t+=1)n+=p[e>>8*t+4&15]+p[e>>8*t&15];return n}function s(e){var t;for(t=0;t<e.length;t+=1)e[t]=u(e[t]);return e.join("")}function a(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function f(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function l(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function d(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function h(){this.reset()}var p=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==s(i("hello"))&&function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<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,u,s,a=this.byteLength,c=t(n,a),f=a;return r!==e&&(f=t(r,a)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),u=new Uint8Array(o),s=new Uint8Array(this,c,i),u.set(s),o)}}(),h.prototype.append=function(e){return this.appendBinary(a(e)),this},h.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var r,i=this._buff.length;for(r=64;r<=i;r+=64)t(this._hash,n(this._buff.substring(r-64,r)));return this._buff=this._buff.substring(r-64),this},h.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<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=d(n)),this.reset(),n},h.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},h.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},h.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},h.prototype._finish=function(e,n){var r,i,o,u=n;if(e[u>>2]|=128<<(u%4<<3),u>55)for(t(this._hash,e),u=0;u<16;u+=1)e[u]=0;r=8*this._length,r=r.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,t(this._hash,e)},h.hash=function(e,t){return h.hashBinary(a(e),t)},h.hashBinary=function(e,t){var n=i(e),r=s(n);return t?d(r):r},h.ArrayBuffer=function(){this.reset()},h.ArrayBuffer.prototype.append=function(e){var n,i=l(this._buff.buffer,e,!0),o=i.length;for(this._length+=e.byteLength,n=64;n<=o;n+=64)t(this._hash,r(i.subarray(n-64,n)));return this._buff=n-64<o?new Uint8Array(i.buffer.slice(n-64)):new Uint8Array(0),this},h.ArrayBuffer.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<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=d(n)),this.reset(),n},h.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.ArrayBuffer.prototype.getState=function(){var e=h.prototype.getState.call(this);return e.buff=f(e.buff),e},h.ArrayBuffer.prototype.setState=function(e){return e.buff=c(e.buff,!0),h.prototype.setState.call(this,e)},h.ArrayBuffer.prototype.destroy=h.prototype.destroy,h.ArrayBuffer.prototype._finish=h.prototype._finish,h.ArrayBuffer.hash=function(e,t){var n=o(new Uint8Array(e)),r=s(n);return t?d(r):r},h})},{}],8:[function(e,t,n){(function(t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function r(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}function i(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 o(e){if(e instanceof ArrayBuffer)return i(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&&Xt.call(n)==Gt}function s(e){var t,n,i;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,i=e.length;n<i;n++)t[n]=s(e[n]);return t}if(e instanceof Date)return e.toISOString();if(r(e))return o(e);if(!u(e))return e;t={};for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var a=s(e[n]);void 0!==a&&(t[n]=a)}return t}function a(e){var t=!1;return Rt(function(n){if(t)throw new Error("once called more than once");t=!0,e.apply(this,n)})}function c(e){return Rt(function(t){t=s(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),i=new Wt(function(r,i){var o;try{var u=a(function(e,t){e?i(e):r(t)});t.push(u),o=e.apply(n,t),o&&"function"==typeof o.then&&r(o)}catch(e){i(e)}});return r&&i.then(function(e){r(null,e)},r),i})}function f(e){return"$"+e}function l(e){return e.substring(1)}function d(){this._store={}}function h(e){if(this._store=new d,e&&Array.isArray(e))for(var t=0,n=e.length;t<n;t++)this.add(e[t])}function p(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=t[r];o in e&&(n[o]=e[o])}return n}function v(){return"undefined"!=typeof chrome&&void 0!==chrome.storage&&void 0!==chrome.storage.local}function y(){return Qt}function g(e){v()?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):y()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(t){e.emit(t.key)}):window.attachEvent("storage",function(t){e.emit(t.key)}))}function m(){zt.EventEmitter.call(this),this._listeners={},g(this)}function _(e){if("undefined"!==console&&e in console){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}function b(e,t,n){Error.call(this,n),this.status=e,this.name=t,this.message=n,this.error=!0}function w(e){for(var t=[],n=0,r=e.length;n<r;n++)t=t.concat(e[n]);return t}function k(){}function $(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(_("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())}function j(e,t,n){return new Wt(function(r,i){e.get(t,function(o,u){if(o){if(404!==o.status)return i(o);u={}}var s=u._rev,a=n(u);if(!a)return r({updated:!1,rev:s});a._id=t,a._rev=s,r(E(e,a,n))})})}function E(e,t,n){return e.put(t).then(function(e){return{updated:!0,rev:e.rev}},function(r){if(409!==r.status)throw r;return j(e,t._id,n)})}function O(e){return e=s(e),e.index||(e.index={}),["type","name","ddoc"].forEach(function(t){e.index[t]&&(e[t]=e.index[t],delete e.index[t])}),e.fields&&(e.index.fields=e.fields,delete e.fields),e.type||(e.type="json"),e}function A(e,t,n){t=O(t),e.request({method:"POST",url:"_index",body:t},n)}function x(e,t,n){e.request({method:"POST",url:"_find",body:t},n)}function q(e,t){e.request({method:"GET",url:"_index"},t)}function S(e,t,n){var r=t.ddoc,i=t.type||"json",o=t.name;if(!r)return n(new Error("you must provide an index's ddoc"));if(!o)return n(new Error("you must provide an index's name"));var u="_index/"+[r,i,o].map(encodeURIComponent).join("/");e.request({method:"DELETE",url:u},n)}function L(e,t){for(var n=e,r=0,i=t.length;r<i;r++){if(!(n=n[t[r]]))break}return n}function B(e,t,n){for(var r=0,i=t.length;r<i-1;r++){e=e[t[r]]={}}e[t[i-1]]=n}function T(e,t){return e<t?-1:e>t?1:0}function M(e){for(var t=[],n="",r=0,i=e.length;r<i;r++){var o=e[r];"."===o?r>0&&"\\"===e[r-1]?n=n.substring(0,n.length-1)+".":(t.push(n),n=""):n+=o}return t.push(n),t}function C(e){return nn.indexOf(e)>-1}function D(e){return Object.keys(e)[0]}function I(e){return e[D(e)]}function F(e){var t={};return e.forEach(function(e){Object.keys(e).forEach(function(n){var r=e[n];if("object"!=typeof r&&(r={$eq:r}),C(n))r instanceof Array?t[n]=r.map(function(e){return F([e])}):t[n]=F([r]);else{var i=t[n]=t[n]||{};Object.keys(r).forEach(function(e){var t=r[e];return"$gt"===e||"$gte"===e?N(e,t,i):"$lt"===e||"$lte"===e?U(e,t,i):"$ne"===e?P(t,i):"$eq"===e?R(t,i):void(i[e]=t)})}})}),t}function N(e,t,n){void 0===n.$eq&&(void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t)}function U(e,t,n){void 0===n.$eq&&(void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t)}function P(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}function R(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}function z(e){var t=s(e),n=!1;"$and"in t&&(t=F(t.$and),n=!0),["$or","$nor"].forEach(function(e){e in t&&t[e].forEach(function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],i=e[r];"object"==typeof i&&null!==i||(e[r]={$eq:i})}})}),"$not"in t&&(t.$not=F([t.$not]));for(var r=Object.keys(t),i=0;i<r.length;i++){var o=r[i],u=t[o];"object"!=typeof u||null===u?u={$eq:u}:"$ne"in u&&!n&&(u.$ne=[u.$ne]),t[o]=u}return t}function J(e,t,n){for(var r="",i=n-e.length;r.length<i;)r+=t;return r}function V(e,t,n){return J(e,t,n)+e}function K(e,t){if(e===t)return 0;e=W(e),t=W(t);var n=ne(e),r=ne(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return ee(e,t)}return Array.isArray(e)?Z(e,t):te(e,t)}function W(e){switch(typeof e){case"undefined":return null;case"number":return 1/0===e||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=W(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e){e={};for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];void 0!==o&&(e[i]=W(o))}}}}return e}function X(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return re(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),r=-1,i=n.length,o="";if(t)for(;++r<i;)o+=G(n[r]);else for(;++r<i;){var u=n[r];o+=G(u)+G(e[u])}return o}return""}function G(e){return e=W(e),ne(e)+un+X(e)+"\0"}function Y(e,t){var n,r=t;if("1"===e[t])n=0,t++;else{var i="0"===e[t];t++;var o="",u=e.substring(t,t+on),s=parseInt(u,10)+rn;for(i&&(s=-s),t+=on;;){var a=e[t];if("\0"===a)break;o+=a,t++}o=o.split("."),n=1===o.length?parseInt(o,10):parseFloat(o[0]+"."+o[1]),i&&(n-=10),0!==s&&(n=parseFloat(n+"e"+s))}return{num:n,length:t-r}}function H(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(n);else if(o===e.length-2){var u=e.pop();i[u]=n}else e.push(n)}}function Q(e){for(var t=[],n=[],r=0;;){var i=e[r++];if("\0"!==i)switch(i){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var o=Y(e,r);t.push(o.num),r+=o.length;break;case"4":for(var u="";;){var s=e[r];if("\0"===s)break;u+=s,r++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var a={element:[],index:t.length};t.push(a.element),n.push(a);break;case"6":var c={element:{},index:t.length};t.push(c.element),n.push(c);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}else{if(1===t.length)return t.pop();H(t,n)}}}function Z(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=K(e[r],t[r]);if(0!==i)return i}return e.length===t.length?0:e.length>t.length?1:-1}function ee(e,t){return e===t?0:e>t?1:-1}function te(e,t){for(var n=Object.keys(e),r=Object.keys(t),i=Math.min(n.length,r.length),o=0;o<i;o++){var u=K(n[o],r[o]);if(0!==u)return u;if(0!==(u=K(e[n[o]],t[r[o]])))return u}return n.length===r.length?0:n.length>r.length?1:-1}function ne(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 re(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,i=r?"0":"2",o=(r?-n:n)-rn,u=V(o.toString(),"0",on);i+=un+u;var s=Math.abs(parseFloat(t[0]));r&&(s=10-s);var a=s.toFixed(20);return a=a.replace(/\.?0+$/,""),i+=un+a}function ie(e){function t(t){return e.map(function(e){var n=D(e),r=M(n);return L(t,r)})}return function(e,n){var r=t(e.doc),i=t(n.doc),o=K(r,i);return 0!==o?o:T(e.doc._id,n.doc._id)}}function oe(e,t,n){if(e=e.filter(function(e){return ue(e.doc,t.selector,n)}),t.sort){var r=ie(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===I(t.sort[0])&&(e=e.reverse())}if("limit"in t||"skip"in t){var i=t.skip||0,o=("limit"in t?t.limit:e.length)+i;e=e.slice(i,o)}return e}function ue(e,t,n){return n.every(function(n){if(se(e))return!1;var r=t[n],i=M(n),o=L(e,i);return C(n)?ce(n,r,e):ae(r,e,i,o)})}function se(e){return/^_design\//.test(e._id)}function ae(e,t,n,r){return!e||Object.keys(e).every(function(i){var o=e[i];return fe(i,t,o,n,r)})}function ce(e,t,n){return"$or"===e?t.some(function(e){return ue(n,e,Object.keys(e))}):"$not"===e?!ue(n,t,Object.keys(t)):!t.find(function(e){return ue(n,e,Object.keys(e))})}function fe(e,t,n,r,i){if(!sn[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type or $all');return sn[e](t,n,r,i)}function le(e){return void 0!==e&&null!==e}function de(e){return void 0!==e}function he(e,t){var n=t[0],r=t[1];if(0===n)throw new Error("Bad divisor, cannot divide by zero");if(parseInt(n,10)!==n)throw new Error("Divisor is not an integer");if(parseInt(r,10)!==r)throw new Error("Modulus is not an integer");return parseInt(e,10)===e&&e%n===r}function pe(e,t){return t.some(function(t){return e instanceof Array?e.indexOf(t)>-1:e===t})}function ve(e,t){return t.every(function(t){return e.indexOf(t)>-1})}function ye(e,t){return e.length===t}function ge(e,t){return new RegExp(t).test(e)}function me(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}throw new Error(t+" not supported as a type.Please use one of object, string, array, number, boolean or null.")}function _e(e){return function(){for(var t=arguments.length,n=new Array(t),r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}}function be(e){return _e(function(t){var n=t.pop(),r=e.apply(this,t);return we(r,n),r})}function we(e,n){return e.then(function(e){t.nextTick(function(){n(null,e)})},function(e){t.nextTick(function(){n(e)})}),e}function ke(e){for(var t={},n=0,r=e.length;n<r;n++)t=en(t,e[n]);return t}function $e(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=M(t[r]),u=L(e,o);void 0!==u&&B(n,o,u)}return n}function je(e,t){for(var n=0,r=Math.min(e.length,t.length);n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ee(e,t){return!(e.length>t.length)&&je(e,t)}function Oe(e,t){e=e.slice();for(var n=0,r=t.length;n<r;n++){var i=t[n];if(!e.length)break;var o=e.indexOf(i);if(o===-1)return!1;e.splice(o,1)}return!0}function Ae(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function xe(e,t){for(var n=null,r=-1,i=0,o=e.length;i<o;i++){var u=e[i],s=t(u);s>r&&(r=s,n=u)}return n}function qe(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Se(e){for(var t={},n=0;n<e.length;n++)t["$"+e[n]]=!0;return Object.keys(t).map(function(e){return e.substring(1)})}function Le(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,r=new n,i=0;i<e.length;i+=1)r.append(e[i]);return r.getBlob(t.type)}}function Be(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function Te(e,t){return Le([Be(e)],{type:t})}function Me(e,t){return Te(cn(e),t)}function Ce(){this.promise=new Wt(function(e){e()})}function De(e){return Kt.hash(e)}function Ie(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}function Fe(e,t){return Ie(e)+Ie(t)+"undefined"}function Ne(e,t,n,r,i,o){var u,s=Fe(n,r);if(!i&&(u=e._cachedViews=e._cachedViews||{},u[s]))return u[s];var a=e.info().then(function(a){function c(e){e.views=e.views||{};var n=t;n.indexOf("/")===-1&&(n=t+"/"+t);var r=e.views[n]=e.views[n]||{};if(!r[f])return r[f]=!0,e}var f=a.db_name+"-mrview-"+(i?"temp":De(s));return j(e,"_local/"+o,c).then(function(){return e.registerDependentDatabase(f).then(function(t){var i=t.db;i.auto_compaction=!0;var o={name:f,db:i,sourceDB:e,adapter:e.adapter,mapFun:n,reduceFun:r};return o.db.get("_local/lastSeq").catch(function(e){if(404!==e.status)throw e}).then(function(e){return o.seq=e?e.seq:0,u&&o.db.once("destroyed",function(){delete u[s]}),o})})})});return u&&(u[s]=a),a}function Ue(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{
Error.captureStackTrace(this,Ue)}catch(e){}}function Pe(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Pe)}catch(e){}}function Re(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Re)}catch(e){}}function ze(e,t){return t&&e.then(function(e){Vt(function(){t(null,e)})},function(e){Vt(function(){t(e)})}),e}function Je(e){return Rt(function(t){var n=t.pop(),r=e.apply(this,t);return"function"==typeof n&&ze(r,n),r})}function Ve(e,t){return e.then(function(e){return t().then(function(){return e})},function(e){return t().then(function(){throw e})})}function Ke(e,t){return function(){var n=arguments,r=this;return e.add(function(){return t.apply(r,n)})}}function We(e){var t=new Yt(e),n=new Array(t.size),r=-1;return t.forEach(function(e){n[++r]=e}),n}function Xe(e){var t=new Array(e.size),n=-1;return e.forEach(function(e,r){t[++n]=r}),t}function Ge(e){return e.indexOf("/")===-1?[e,e]:e.split("/")}function Ye(e){return 1===e.length&&/^1-/.test(e[0].rev)}function He(e,t){try{e.emit("error",t)}catch(e){_("error","The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),_("error",t)}}function Qe(e,t){return function(n){for(var r=[],i=0,o=e.length;i<o;i++){for(var u=M(e[i]),s=n,a=0,c=u.length;a<c;a++){if(!(s=s[u[a]]))return}r.push(s)}t(r)}}function Ze(e,t){var n=M(e);return function(e){for(var r=e,i=0,o=n.length;i<o;i++){if(!(r=r[n[i]]))return}t(r)}}function et(e,t){return function(n){t(n[e])}}function tt(e,t){return function(n){for(var r=[],i=0,o=e.length;i<o;i++)r.push(n[e[i]]);t(r)}}function nt(e){for(var t=0,n=e.length;t<n;t++){if(e[t].indexOf(".")!==-1)return!1}return!0}function rt(e,t){var n=nt(e),r=1===e.length;return n?r?et(e[0],t):tt(e,t):r?Ze(e[0],t):Qe(e,t)}function it(e,t){return rt(Object.keys(e.fields),t)}function ot(){throw new Error("reduce not supported")}function ut(e,t){var n=e.views[t];if(!n.map||!n.map.fields)throw new Error("ddoc "+e._id+" with view "+t+" doesn't have map.fields defined. maybe it wasn't created by this plugin?")}function st(e){if(!Array.isArray(e))throw new Error("invalid sort json - should be an array");return e.map(function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e})}function at(e){return e.fields=e.fields.map(function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e}),e}function ct(e,t){for(var n=[],r=0;r<t.def.fields.length;r++){var i=D(t.def.fields[r]);n.push(e[i])}return n}function ft(e,t,n){for(var r=n.def.fields,i=0,o=e.length;i<o;i++){var u=e[i],s=ct(u.doc,n);if(1===r.length)s=s[0];else for(;s.length>t.length;)s.pop();if(Math.abs(K(s,t))>0)break}return i>0?e.slice(i):e}function lt(e){var t=s(e);return delete t.startkey,delete t.endkey,delete t.inclusive_start,delete t.inclusive_end,"endkey"in e&&(t.startkey=e.endkey),"startkey"in e&&(t.endkey=e.startkey),"inclusive_start"in e&&(t.inclusive_end=e.inclusive_start),"inclusive_end"in e&&(t.inclusive_start=e.inclusive_end),t}function dt(e){var t=e.fields.filter(function(e){return"asc"===I(e)});if(0!==t.length&&t.length!==e.fields.length)throw new Error("unsupported mixed sorting")}function ht(e,t){if(t.defaultUsed&&e.sort){var n=e.sort.filter(function(e){return"_id"!==Object.keys(e)[0]}).map(function(e){return Object.keys(e)[0]});if(n.length>0)throw new Error('Cannot sort on field(s) "'+n.join(",")+'" when using the default index')}t.defaultUsed}function pt(e){if("object"!=typeof e.selector)throw new Error("you must provide a selector when you find()")}function vt(e,t){var n,r=Object.keys(e),i=t?t.map(D):[];return n=r.length>=i.length?r:i,0===i.length?{fields:n}:(n=n.sort(function(e,t){var n=i.indexOf(e);n===-1&&(n=Number.MAX_VALUE);var r=i.indexOf(t);return r===-1&&(r=Number.MAX_VALUE),n<r?-1:n>r?1:0}),{fields:n,sortOrder:t.map(D)})}function yt(e,t){function n(e){return e._rev&&"query"!==e.language&&(c=!0),e.language="query",e.views=e.views||{},!(f=!!e.views[o])&&(e.views[o]={map:{fields:ke(t.index.fields)},reduce:"_count",options:{def:r}},e)}t=O(t);var r=s(t.index);t.index=at(t.index),dt(t.index);var i=De(JSON.stringify(t)),o=t.name||"idx-"+i,u=t.ddoc||"idx-"+i,a="_design/"+u,c=!1,f=!1;return e.constructor.emit("debug",["find","creating index",a]),j(e,a,n).then(function(){if(c)throw new Error('invalid language for ddoc with id "'+a+'" (should be "query")')}).then(function(){var t=u+"/"+o;return hn.query.call(e,t,{limit:0,reduce:!1}).then(function(){return{id:a,name:o,result:f?"exists":"created"}})})}function gt(e){return e.allDocs({startkey:"_design/",endkey:"_design/￿",include_docs:!0}).then(function(e){var t={indexes:[{ddoc:null,name:"_all_docs",type:"special",def:{fields:[{_id:"asc"}]}}]};return t.indexes=an(t.indexes,e.rows.filter(function(e){return"query"===e.doc.language}).map(function(e){return(void 0!==e.doc.views?Object.keys(e.doc.views):[]).map(function(t){var n=e.doc.views[t];return{ddoc:e.id,name:t,type:"json",def:at(n.options.def)}})})),t.indexes.sort(function(e,t){return T(e.name,t.name)}),t.total_rows=t.indexes.length,t})}function mt(e,t){for(var n=e.def.fields.map(D),r=0,i=n.length;r<i;r++){if(t===n[r])return!0}return!1}function _t(e,t){return"$eq"!==D(e[t])}function bt(e,t){var n=t.def.fields.map(D);return e.slice().sort(function(e,t){var r=n.indexOf(e),i=n.indexOf(t);return r===-1&&(r=Number.MAX_VALUE),i===-1&&(i=Number.MAX_VALUE),T(r,i)})}function wt(e,t,n){n=bt(n,e);for(var r=!1,i=0,o=n.length;i<o;i++){var u=n[i];if(r||!mt(e,u))return n.slice(i);i<o-1&&_t(t,u)&&(r=!0)}return[]}function kt(e){var t=[];return Object.keys(e).forEach(function(n){var r=e[n];Object.keys(r).forEach(function(e){"$ne"===e&&t.push(n)})}),t}function $t(e,t,n,r){return bt(Se(an(e,wt(t,n,r),kt(n))),t)}function jt(e,t,n){if(t){var r=Ee(t,e),i=je(n,e);return r&&i}return Oe(n,e)}function Et(e){return yn.indexOf(e)===-1}function Ot(e,t){var n=e[0],r=t[n];return void 0===r||!!Object.keys(r).some(function(e){return!Et(e)})&&!(1===Object.keys(r).length&&"$ne"===D(r))}function At(e,t,n,r){var i=e.def.fields.map(D);return!!jt(i,t,n)&&Ot(i,r)}function xt(e,t,n,r){return r.reduce(function(r,i){return At(i,n,t,e)&&r.push(i),r},[])}function qt(e,t,n,r){function i(e){for(var t=e.def.fields.map(D),n=0,r=0,i=t.length;r<i;r++){var o=t[r];s[o]&&n++}return n}var o=xt(e,t,n,r);if(0===o.length){var u=r[0];return u.defaultUsed=!0,u}if(1===o.length)return o[0];var s=Ae(t);return xe(o,i)}function St(e,t){switch(e){case"$eq":return{key:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Lt(e,t){var n,r=D(t.def.fields[0]),i=e[r]||{},o=[],u=Object.keys(i);return u.forEach(function(e){if(Et(e))return void o.push(r);var t=i[e],u=St(e,t);n=n?ke([n,u]):u}),{queryOpts:n,inMemoryFields:o}}function Bt(e,t){switch(e){case"$eq":return{startkey:t,endkey:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Tt(e,t){function n(e){r!==!1&&s.push(pn),i!==!1&&a.push(vn),u=o.slice(e)}for(var r,i,o=t.def.fields.map(D),u=[],s=[],a=[],c=0,f=o.length;c<f;c++){var l=o[c],d=e[l];if(!d||!Object.keys(d).length){n(c);break}if(c>0){if(Object.keys(d).some(Et)){n(c);break}var h="$gt"in d||"$gte"in d||"$lt"in d||"$lte"in d,p=Object.keys(e[o[c-1]]),v=qe(p,["$eq"]),y=qe(p,Object.keys(d));if(h&&!v&&!y){n(c);break}}for(var g=Object.keys(d),m=null,_=0;_<g.length;_++){var b=g[_],w=d[b],k=Bt(b,w);m=m?ke([m,k]):k}s.push("startkey"in m?m.startkey:pn),a.push("endkey"in m?m.endkey:vn),"inclusive_start"in m&&(r=m.inclusive_start),"inclusive_end"in m&&(i=m.inclusive_end)}var $={startkey:s,endkey:a};return void 0!==r&&($.inclusive_start=r),void 0!==i&&($.inclusive_end=i),{queryOpts:$,inMemoryFields:u}}function Mt(e){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(e)]}}function Ct(e,t){return t.defaultUsed?Mt(e,t):1===t.def.fields.length?Lt(e,t):Tt(e,t)}function Dt(e,t){var n=e.selector,r=e.sort,i=vt(n,r),o=i.fields,u=i.sortOrder,s=qt(n,o,u,t),a=Ct(n,s);return{queryOpts:a.queryOpts,index:s,inMemoryFields:$t(a.inMemoryFields,s,n,o)}}function It(e){return e.ddoc.substring(8)+"/"+e.name}function Ft(e,t){var n=s(t);return n.descending?("endkey"in n&&"string"!=typeof n.endkey&&(n.endkey=""),"startkey"in n&&"string"!=typeof n.startkey&&(n.limit=0)):("startkey"in n&&"string"!=typeof n.startkey&&(n.startkey=""),"endkey"in n&&"string"!=typeof n.endkey&&(n.limit=0)),"key"in n&&"string"!=typeof n.key&&(n.limit=0),e.allDocs(n)}function Nt(e,t){return t.selector&&(t.selector=z(t.selector)),t.sort&&(t.sort=st(t.sort)),pt(t),gt(e).then(function(n){e.constructor.emit("debug",["find","planning query",t]);var r=Dt(t,n.indexes);e.constructor.emit("debug",["find","query plan",r]);var i=r.index;ht(t,i);var o=en({include_docs:!0,reduce:!1},r.queryOpts);return"startkey"in o&&"endkey"in o&&K(o.startkey,o.endkey)>0?{docs:[]}:(t.sort&&"string"!=typeof t.sort[0]&&"desc"===I(t.sort[0])&&(o.descending=!0,o=lt(o)),r.inMemoryFields.length||("limit"in t&&(o.limit=t.limit),"skip"in t&&(o.skip=t.skip)),Wt.resolve().then(function(){if("_all_docs"===i.name)return Ft(e,o);var t=It(i);return hn.query.call(e,t,o)}).then(function(e){o.inclusive_start===!1&&(e.rows=ft(e.rows,o.startkey,i)),r.inMemoryFields.length&&(e.rows=oe(e.rows,t,r.inMemoryFields));var n={docs:e.rows.map(function(e){var n=e.doc;return t.fields?$e(n,t.fields):n})};return i.defaultUsed&&(n.warning="no matching index found, create an index to optimize query time"),n}))})}function Ut(e,t){function n(e){return 1===Object.keys(e.views).length&&e.views[i]?{_id:r,_deleted:!0}:(delete e.views[i],e)}if(!t.ddoc)throw new Error("you must supply an index.ddoc when deleting");if(!t.name)throw new Error("you must supply an index.name when deleting");var r=t.ddoc,i=t.name;return j(e,r,n).then(function(){return hn.viewCleanup.apply(e)}).then(function(){return{ok:!0}})}var Pt=n(e(5)),Rt=n(e(1)),zt=e(2),Jt=n(e(4)),Vt=n(e(3)),Kt=n(e(7)),Wt="function"==typeof Promise?Promise:Pt,Xt=Function.prototype.toString,Gt=Xt.call(Object);d.prototype.get=function(e){var t=f(e);return this._store[t]},d.prototype.set=function(e,t){var n=f(e);return this._store[n]=t,!0},d.prototype.has=function(e){return f(e)in this._store},d.prototype.delete=function(e){var t=f(e),n=t in this._store;return delete this._store[t],n},d.prototype.forEach=function(e){for(var t=Object.keys(this._store),n=0,r=t.length;n<r;n++){var i=t[n],o=this._store[i];i=l(i),e(o,i)}},Object.defineProperty(d.prototype,"size",{get:function(){return Object.keys(this._store).length}}),h.prototype.add=function(e){return this._store.set(e,!0)},h.prototype.has=function(e){return this._store.has(e)},h.prototype.forEach=function(e){this._store.forEach(function(t,n){e(n)})},Object.defineProperty(h.prototype,"size",{get:function(){return this._store.size}});var Yt,Ht;!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var e=Object.getOwnPropertyDescriptor(Map,Symbol.species);return e&&"get"in e&&Map[Symbol.species]===Map}()?(Yt=h,Ht=d):(Yt=Set,Ht=Map);var Qt;if(v())Qt=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),Qt=!!localStorage.getItem("_pouch_check_localstorage")}catch(e){Qt=!1}Jt(m,zt.EventEmitter),m.prototype.addListener=function(e,t,n,r){function i(){function e(){u=!1}if(o._listeners[t]){if(u)return void(u="waiting");u=!0;var s=p(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(s).on("change",function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===u&&Vt(i),u=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,u=!1;this._listeners[t]=i,this.on(e,i)}},m.prototype.removeListener=function(e,t){t in this._listeners&&(zt.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},m.prototype.notifyLocalWindows=function(e){v()?chrome.storage.local.set({dbName:e}):y()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},m.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var Zt;Zt="function"==typeof Object.assign?Object.assign:function(e){for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};var en=Zt;Jt(b,Error),b.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var tn=(new b(401,"unauthorized","Name or password is incorrect."),new b(400,"bad_request","Missing JSON list of 'docs'"),new b(404,"not_found","missing"),new b(409,"conflict","Document update conflict"),new b(400,"bad_request","_id field must contain a string"),new b(412,"missing_id","_id is required for puts"),new b(400,"bad_request","Only reserved document ids may start with underscore."),new b(412,"precondition_failed","Database not open"),new b(500,"unknown_error","Database encountered an unknown error"),new b(500,"badarg","Some query argument is invalid"),new b(400,"invalid_request","Request was invalid"),new b(400,"query_parse_error","Some query parameter is invalid"),new b(500,"doc_validation","Bad special document member"),new b(400,"bad_request","Something wrong with the request"),new b(400,"bad_request","Document must be a JSON object"),new b(404,"not_found","Database not found"),new b(500,"indexed_db_went_bad","unknown"),new b(500,"web_sql_went_bad","unknown"),new b(500,"levelDB_went_went_bad","unknown"),new b(403,"forbidden","Forbidden by design doc validate_doc_update function"),new b(400,"bad_request","Invalid rev format"),new b(412,"file_exists","The database could not be created, the file already exists."),new b(412,"missing_stub","A pre-existing attachment stub wasn't found"),new b(413,"invalid_url","Provided URL is invalid"),k.name);var nn=("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),["$or","$nor","$not"]),rn=-324,on=3,un="",sn={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.some(function(e){return ue(e,t,Object.keys(t))}):r.some(function(r){return ae(t,e,n,r)})))},$eq:function(e,t,n,r){return de(r)&&0===K(r,t)},$gte:function(e,t,n,r){return de(r)&&K(r,t)>=0},$gt:function(e,t,n,r){return de(r)&&K(r,t)>0},$lte:function(e,t,n,r){return de(r)&&K(r,t)<=0},$lt:function(e,t,n,r){return de(r)&&K(r,t)<0},$exists:function(e,t,n,r){return t?de(r):!de(r)},$mod:function(e,t,n,r){return le(r)&&he(r,t)},$ne:function(e,t,n,r){return t.every(function(e){return 0!==K(r,e)})},$in:function(e,t,n,r){return le(r)&&pe(r,t)},$nin:function(e,t,n,r){return le(r)&&!pe(r,t)},$size:function(e,t,n,r){return le(r)&&ye(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&ve(r,t)},$regex:function(e,t,n,r){return le(r)&&ge(r,t)},$type:function(e,t,n,r){return me(r,t)}},an=_e(function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];Array.isArray(i)?t=t.concat(an.apply(null,i)):t.push(i)}return t}),cn=function(e){return atob(e)};Ce.prototype.add=function(e){return this.promise=this.promise.catch(function(){}).then(function(){return e()}),this.promise},Ce.prototype.finish=function(){return this.promise},Jt(Ue,Error),Jt(Pe,Error),Jt(Re,Error);var fn={},ln=new Ce,dn=50,hn=function(e,t,n,r){function i(e,t,n){try{t(n)}catch(t){He(e,t)}}function o(e,t,n,r,i){try{return{output:t(n,r,i)}}catch(t){return He(e,t),{error:t}}}function u(e,t){var n=K(e.key,t.key);return 0!==n?n:K(e.value,t.value)}function s(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function a(e){var t=e.value;return t&&"object"==typeof t&&t._id||e.id}function c(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=Me(n.data,n.content_type)})})}function f(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&c(t),t}}function l(e,t,n,r){var i=t[e];void 0!==i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function d(e){if(void 0!==e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function h(e){return e.group_level=d(e.group_level),e.limit=d(e.limit),e.skip=d(e.skip),e}function p(e){if(e){if("number"!=typeof e)return new Ue('Invalid value for integer: "'+e+'"');if(e<0)return new Ue('Invalid value for positive integer: "'+e+'"')}}function v(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&K(e[n],e[r])>0)throw new Ue("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 Ue("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Ue("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(t){var n=p(e[t]);if(n)throw n})}function y(e,t,n){var r,i=[],o="GET";if(l("reduce",n,i),l("include_docs",n,i),l("attachments",n,i),l("limit",n,i),l("descending",n,i),l("group",n,i),l("group_level",n,i),l("skip",n,i),l("stale",n,i),l("conflicts",n,i),l("startkey",n,i,!0),l("start_key",n,i,!0),l("endkey",n,i,!0),l("end_key",n,i,!0),l("inclusive_end",n,i),l("key",n,i,!0),i=i.join("&"),i=""===i?"":"?"+i,void 0!==n.keys){var u="keys="+encodeURIComponent(JSON.stringify(n.keys));u.length+i.length+1<=2e3?i+=("?"===i[0]?"&":"?")+u:(o="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var s=Ge(t);return e.request({method:o,url:"_design/"+s[0]+"/_view/"+s[1]+i,body:r}).then(f(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"+i,body:r}).then(f(n))}function g(e,t,n){return new Wt(function(r,i){e._query(t,n,function(e,t){if(e)return i(e);r(t)})})}function m(e){return new Wt(function(t,n){e._viewCleanup(function(e,r){if(e)return n(e);t(r)})})}function _(e){return function(t){if(404===t.status)return e;throw t}}function b(e,t,n){function r(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Wt.resolve({rows:[]})}function i(e,t){for(var n=[],r=new Yt,i=0,o=t.rows.length;i<o;i++){var u=t.rows[i],s=u.doc;if(s&&(n.push(s),r.add(s._id),s._deleted=!a.has(s._id),!s._deleted)){var c=a.get(s._id);"value"in c&&(s.value=c.value)}}var f=Xe(a);return f.forEach(function(e){if(!r.has(e)){var t={_id:e},i=a.get(e);"value"in i&&(t.value=i.value),n.push(t)}}),e.keys=We(f.concat(e.keys)),n.push(e),n}var o="_local/doc_"+e,u={_id:o,keys:[]},s=n.get(e),a=s[0],c=s[1];return function(){return Ye(c)?Wt.resolve(u):t.db.get(o).catch(_(u))}().then(function(e){return r(e).then(function(t){return i(e,t)})})}function k(e,t,n){return e.db.get("_local/lastSeq").catch(_({_id:"_local/lastSeq",seq:0})).then(function(r){var i=Xe(t);return Wt.all(i.map(function(n){return b(n,e,t)})).then(function(t){var i=w(t);return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})})})}function j(e){var t="string"==typeof e?e:e.name,n=fn[t];return n||(n=fn[t]=new Ce),n}function E(e){return Ke(j(e),function(){return O(e)})()}function O(e){function n(e,t){var n={id:l._id,key:W(e)};void 0!==t&&null!==t&&(n.value=W(t)),f.push(n)}function r(t,n){return function(){return k(e,t,n)}}function o(){return e.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:h,limit:dn}).then(s)}function s(e){var t=e.results;if(t.length){var n=a(t);if(p.add(r(n,h)),!(t.length<dn))return o()}}function a(t){for(var n=new Ht,r=0,o=t.length;r<o;r++){var s=t[r];if("_"!==s.doc._id[0]){f=[],l=s.doc,l._deleted||i(e.sourceDB,d,l),f.sort(u);var a=c(f);n.set(s.doc._id,[a,s.changes])}h=s.seq}return n}function c(e){for(var t,n=new Ht,r=0,i=e.length;r<i;r++){var o=e[r],u=[o.key,o.id];r>0&&0===K(o.key,t)&&u.push(r),n.set(G(u),o),t=o.key}return n}var f,l,d=t(e.mapFun,n),h=e.seq||0,p=new Ce;return o().then(function(){return p.finish()}).then(function(){e.seq=h})}function A(e,t,r){0===r.group_level&&delete r.group_level;var i=r.group||r.group_level,u=n(e.reduceFun),a=[],c=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;t.forEach(function(e){var t=a[a.length-1],n=i?e.key:null;if(i&&Array.isArray(n)&&(n=n.slice(0,c)),t&&0===K(t.groupKey,n))return t.keys.push([e.key,e.id]),void t.values.push(e.value);a.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})}),t=[];for(var f=0,l=a.length;f<l;f++){var d=a[f],h=o(e.sourceDB,u,d.keys,d.values,!1);if(h.error&&h.error instanceof Re)throw h.error;t.push({value:h.error?null:h.output,key:d.groupKey})}return{rows:s(t,r.limit,r.skip)}}function x(e,t){return Ke(j(e),function(){return q(e,t)})()}function q(e,t){function n(t){return t.include_docs=!0,e.db.allDocs(t).then(function(e){return i=e.total_rows,e.rows.map(function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){var t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(t<n||t>n))return e.doc.value}var r=Q(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=o?A(e,n,t):{total_rows:i,offset:u,rows:n},t.include_docs){var s=We(n.map(a));return e.sourceDB.allDocs({keys:s,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then(function(e){var t=new Ht;return e.rows.forEach(function(e){t.set(e.id,e.doc)}),n.forEach(function(e){var n=a(e),r=t.get(n);r&&(e.doc=r)}),r})}return r}var i,o=e.reduceFun&&t.reduce!==!1,u=t.skip||0;if(void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys),void 0!==t.keys){var s=t.keys,c=s.map(function(e){return n({startkey:G([e]),endkey:G([e,{}])})});return Wt.all(c).then(w).then(r)}var f,l,d={descending:t.descending};if("start_key"in t&&(f=t.start_key),"startkey"in t&&(f=t.startkey),"end_key"in t&&(l=t.end_key),"endkey"in t&&(l=t.endkey),void 0!==f&&(d.startkey=G(t.descending?[f,{}]:[f])),void 0!==l){var h=t.inclusive_end!==!1;t.descending&&(h=!h),d.endkey=G(h?[l,{}]:[l])}if(void 0!==t.key){var p=G([t.key]),v=G([t.key,{}]);d.descending?(d.endkey=p,d.startkey=v):(d.startkey=p,d.endkey=v)}return o||("number"==typeof t.limit&&(d.limit=t.limit),d.skip=u),n(d).then(r)}function S(e){return e.request({method:"POST",url:"_view_cleanup"})}function L(t){return t.get("_local/"+e).then(function(e){var n=new Ht;Object.keys(e.views).forEach(function(e){var t=Ge(e),r="_design/"+t[0],i=t[1],o=n.get(r);o||(o=new Yt,n.set(r,o)),o.add(i)});var r={keys:Xe(n),include_docs:!0};return t.allDocs(r).then(function(r){var i={};r.rows.forEach(function(t){var r=t.key.substring(8);n.get(t.key).forEach(function(n){var o=r+"/"+n;e.views[o]||(o=n);var u=Object.keys(e.views[o]),s=t.doc&&t.doc.views&&t.doc.views[n];u.forEach(function(e){i[e]=i[e]||s})})});var o=Object.keys(i).filter(function(e){return!i[e]}),u=o.map(function(e){return Ke(j(e),function(){return new t.constructor(e,t.__opts).destroy()})()});return Wt.all(u).then(function(){return{ok:!0}})})},_({ok:!0}))}function B(t,n,i){if("function"==typeof t._query)return g(t,n,i);if($(t))return y(t,n,i);if("string"!=typeof n)return v(i,n),ln.add(function(){return Ne(t,"temp_view/temp_view",n.map,n.reduce,!0,e).then(function(e){return Ve(E(e).then(function(){return x(e,i)}),function(){return e.db.destroy()})})}),ln.finish();var o=n,u=Ge(o),s=u[0],a=u[1];return t.get("_design/"+s).then(function(n){var u=n.views&&n.views[a];if(!u)throw new Pe("ddoc "+n._id+" has no view named "+a);return r(n,a),v(i,u),Ne(t,o,u.map,u.reduce,!1,e).then(function(e){return"ok"===i.stale||"update_after"===i.stale?("update_after"===i.stale&&Vt(function(){E(e)}),x(e,i)):E(e).then(function(){return x(e,i)})})})}function T(e,t,n){var r=this;"function"==typeof t&&(n=t,t={}),t=t?h(t):{},"function"==typeof e&&(e={map:e});var i=Wt.resolve().then(function(){return B(r,e,t)});return ze(i,n),i}return{query:T,viewCleanup:Je(function(){var e=this;return"function"==typeof e._viewCleanup?m(e):$(e)?S(e):L(e)})}}("indexes",it,ot,ut),pn=null,vn={"￿":{}},yn=["$eq","$gt","$gte","$lt","$lte"],gn=be(yt),mn=be(Nt),_n=be(gt),bn=be(Ut),wn={};wn.createIndex=c(function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to create"));($(this)?A:gn)(this,e,t)}),wn.find=c(function(e,t){if(void 0===t&&(t=e,e=void 0),"object"!=typeof e)return t(new Error("you must provide search parameters to find()"));($(this)?x:mn)(this,e,t)}),wn.getIndexes=c(function(e){($(this)?q:_n)(this,e)}),wn.deleteIndex=c(function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to delete"));($(this)?S:bn)(this,e,t)}),"undefined"==typeof PouchDB?_("error",'pouchdb-find plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?'):PouchDB.plugin(wn)}).call(this,e(6))},{1:1,2:2,3:3,4:4,5:5,6:6,7:7}]},{},[8]);
!function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return i(n||e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t,n){"use strict";function r(e){return function(){var t=arguments.length;if(t){for(var n=[],r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}return e.call(this,[])}}t.exports=r},{}],2:[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 u(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,a,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])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(u(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,a=0;a<r;a++)c[a].apply(this,o);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?u(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,u(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&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(u(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){return 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)}},{}],3:[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<n;)t[e]();n=l.length}f=!1}function r(e){1!==l.push(e)||f||i()}var i,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var u=0,s=new o(n),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),i=function(){a.data=u=++u%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var c=new e.MessageChannel;c.port1.onmessage=n,i=function(){c.port2.postMessage(0)}}var f,l=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],5:[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=m,this.queue=[],this.outcome=void 0,e!==r&&a(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 u(e,t,n){p(function(){var r;try{r=t(n)}catch(t){return v.reject(e,t)}r===e?v.reject(e,new TypeError("Cannot resolve promise with itself")):v.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function a(e,t){function n(t){o||(o=!0,v.reject(e,t))}function r(t){o||(o=!0,v.resolve(e,t))}function i(){t(r,n)}var o=!1,u=c(i);"error"===u.status&&n(u.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:v.resolve(new this(r),e)}function l(e){var t=new this(r);return v.reject(t,e)}function d(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),u=0,s=-1,a=new this(r);++s<n;)!function(e,r){function s(e){o[r]=e,++u!==n||i||(i=!0,v.resolve(a,o))}t.resolve(e).then(s,function(e){i||(i=!0,v.reject(a,e))})}(e[s],s);return a}function h(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,u=new this(r);++o<n;)!function(e){t.resolve(e).then(function(e){i||(i=!0,v.resolve(u,e))},function(e){i||(i=!0,v.reject(u,e))})}(e[o]);return u}var p=e(3),v={},y=["REJECTED"],g=["FULFILLED"],m=["PENDING"];t.exports=i,i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){if("function"!=typeof e&&this.state===g||"function"!=typeof t&&this.state===y)return this;var n=new this.constructor(r);if(this.state!==m){u(n,this.state===g?e:t,this.outcome)}else this.queue.push(new o(n,e,t));return n},o.prototype.callFulfilled=function(e){v.resolve(this.promise,e)},o.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},o.prototype.callRejected=function(e){v.reject(this.promise,e)},o.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},v.resolve=function(e,t){var n=c(s,t);if("error"===n.status)return v.reject(e,n.value);var r=n.value;if(r)a(e,r);else{e.state=g,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},v.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},i.resolve=f,i.reject=l,i.all=d,i.race=h},{3:3}],6:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function u(e){if(d===clearTimeout)return clearTimeout(e);if((d===i||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function s(){y&&p&&(y=!1,p.length?v=p.concat(v):g=-1,v.length&&a())}function a(){if(!y){var e=o(s);y=!0;for(var t=v.length;t;){for(p=v,v=[];++g<t;)p&&p[g].run();g=-1,t=v.length}p=null,y=!1,u(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,d,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{d="function"==typeof clearTimeout?clearTimeout:i}catch(e){d=i}}();var p,v=[],y=!1,g=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];v.push(new c(e,t)),1!==v.length||y||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],7:[function(e,t,n){!function(e){if("object"==typeof n)t.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;try{r=window}catch(e){r=self}r.SparkMD5=e()}}(function(e){"use strict";function t(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];n+=(r&i|~r&o)+t[0]-680876936|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[1]-389564586|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[2]+606105819|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[3]-1044525330|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[4]-176418897|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[5]+1200080426|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[6]-1473231341|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[7]-45705983|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[8]+1770035416|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[9]-1958414417|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[10]-42063|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[11]-1990404162|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&o)+t[12]+1804603682|0,n=(n<<7|n>>>25)+r|0,o+=(n&r|~n&i)+t[13]-40341101|0,o=(o<<12|o>>>20)+n|0,i+=(o&n|~o&r)+t[14]-1502002290|0,i=(i<<17|i>>>15)+o|0,r+=(i&o|~i&n)+t[15]+1236535329|0,r=(r<<22|r>>>10)+i|0,n+=(r&o|i&~o)+t[1]-165796510|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[6]-1069501632|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[11]+643717713|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[0]-373897302|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[5]-701558691|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[10]+38016083|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[15]-660478335|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[4]-405537848|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[9]+568446438|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[14]-1019803690|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[3]-187363961|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[8]+1163531501|0,r=(r<<20|r>>>12)+i|0,n+=(r&o|i&~o)+t[13]-1444681467|0,n=(n<<5|n>>>27)+r|0,o+=(n&i|r&~i)+t[2]-51403784|0,o=(o<<9|o>>>23)+n|0,i+=(o&r|n&~r)+t[7]+1735328473|0,i=(i<<14|i>>>18)+o|0,r+=(i&n|o&~n)+t[12]-1926607734|0,r=(r<<20|r>>>12)+i|0,n+=(r^i^o)+t[5]-378558|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[8]-2022574463|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[11]+1839030562|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[14]-35309556|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[1]-1530992060|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[4]+1272893353|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[7]-155497632|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[10]-1094730640|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[13]+681279174|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[0]-358537222|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[3]-722521979|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[6]+76029189|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^o)+t[9]-640364487|0,n=(n<<4|n>>>28)+r|0,o+=(n^r^i)+t[12]-421815835|0,o=(o<<11|o>>>21)+n|0,i+=(o^n^r)+t[15]+530742520|0,i=(i<<16|i>>>16)+o|0,r+=(i^o^n)+t[2]-995338651|0,r=(r<<23|r>>>9)+i|0,n+=(i^(r|~o))+t[0]-198630844|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[7]+1126891415|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[14]-1416354905|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[5]-57434055|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[12]+1700485571|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[3]-1894986606|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[10]-1051523|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[1]-2054922799|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[8]+1873313359|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[15]-30611744|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[6]-1560198380|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[13]+1309151649|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~o))+t[4]-145523070|0,n=(n<<6|n>>>26)+r|0,o+=(r^(n|~i))+t[11]-1120210379|0,o=(o<<10|o>>>22)+n|0,i+=(n^(o|~r))+t[2]+718787259|0,i=(i<<15|i>>>17)+o|0,r+=(o^(i|~n))+t[9]-343485551|0,r=(r<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function n(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 r(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 i(e){var r,i,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(r=64;r<=c;r+=64)t(f,n(e.substring(r-64,r)));for(e=e.substring(r-64),i=e.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<i;r+=1)o[r>>2]|=e.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(t(f,o),r=0;r<16;r+=1)o[r]=0;return u=8*c,u=u.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,t(f,o),f}function o(e){var n,i,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=c;n+=64)t(f,r(e.subarray(n-64,n)));for(e=n-64<c?e.subarray(n-64):new Uint8Array(0),i=e.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<i;n+=1)o[n>>2]|=e[n]<<(n%4<<3);if(o[n>>2]|=128<<(n%4<<3),n>55)for(t(f,o),n=0;n<16;n+=1)o[n]=0;return u=8*c,u=u.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,t(f,o),f}function u(e){var t,n="";for(t=0;t<4;t+=1)n+=p[e>>8*t+4&15]+p[e>>8*t&15];return n}function s(e){var t;for(t=0;t<e.length;t+=1)e[t]=u(e[t]);return e.join("")}function a(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function f(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function l(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function d(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function h(){this.reset()}var p=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==s(i("hello"))&&function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<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,u,s,a=this.byteLength,c=t(n,a),f=a;return r!==e&&(f=t(r,a)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),u=new Uint8Array(o),s=new Uint8Array(this,c,i),u.set(s),o)}}(),h.prototype.append=function(e){return this.appendBinary(a(e)),this},h.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var r,i=this._buff.length;for(r=64;r<=i;r+=64)t(this._hash,n(this._buff.substring(r-64,r)));return this._buff=this._buff.substring(r-64),this},h.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<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=d(n)),this.reset(),n},h.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},h.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},h.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},h.prototype._finish=function(e,n){var r,i,o,u=n;if(e[u>>2]|=128<<(u%4<<3),u>55)for(t(this._hash,e),u=0;u<16;u+=1)e[u]=0;r=8*this._length,r=r.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,t(this._hash,e)},h.hash=function(e,t){return h.hashBinary(a(e),t)},h.hashBinary=function(e,t){var n=i(e),r=s(n);return t?d(r):r},h.ArrayBuffer=function(){this.reset()},h.ArrayBuffer.prototype.append=function(e){var n,i=l(this._buff.buffer,e,!0),o=i.length;for(this._length+=e.byteLength,n=64;n<=o;n+=64)t(this._hash,r(i.subarray(n-64,n)));return this._buff=n-64<o?new Uint8Array(i.buffer.slice(n-64)):new Uint8Array(0),this},h.ArrayBuffer.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<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=d(n)),this.reset(),n},h.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.ArrayBuffer.prototype.getState=function(){var e=h.prototype.getState.call(this);return e.buff=f(e.buff),e},h.ArrayBuffer.prototype.setState=function(e){return e.buff=c(e.buff,!0),h.prototype.setState.call(this,e)},h.ArrayBuffer.prototype.destroy=h.prototype.destroy,h.ArrayBuffer.prototype._finish=h.prototype._finish,h.ArrayBuffer.hash=function(e,t){var n=o(new Uint8Array(e)),r=s(n);return t?d(r):r},h})},{}],8:[function(e,t,n){function r(e,t){var n=t||0,r=i;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}for(var i=[],o=0;o<256;++o)i[o]=(o+256).toString(16).substr(1);t.exports=r},{}],9:[function(e,t,n){(function(e){var n,r=e.crypto||e.msCrypto;if(r&&r.getRandomValues){var i=new Uint8Array(16);n=function(){return r.getRandomValues(i),i}}if(!n){var o=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(e,t,n){function r(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var u=e.random||(e.rng||i)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,t)for(var s=0;s<16;++s)t[r+s]=u[s];return t||o(u)}var i=e(9),o=e(8);t.exports=r},{8:8,9:9}],11:[function(e,t,n){(function(t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function r(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}function i(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 o(e){if(e instanceof ArrayBuffer)return i(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&&Yt.call(n)==Ht}function s(e){var t,n,i;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,i=e.length;n<i;n++)t[n]=s(e[n]);return t}if(e instanceof Date)return e.toISOString();if(r(e))return o(e);if(!u(e))return e;t={};for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var a=s(e[n]);void 0!==a&&(t[n]=a)}return t}function a(e){var t=!1;return Vt(function(n){if(t)throw new Error("once called more than once");t=!0,e.apply(this,n)})}function c(e){return Vt(function(t){t=s(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),i=new Gt(function(r,i){var o;try{var u=a(function(e,t){e?i(e):r(t)});t.push(u),o=e.apply(n,t),o&&"function"==typeof o.then&&r(o)}catch(e){i(e)}});return r&&i.then(function(e){r(null,e)},r),i})}function f(e){return"$"+e}function l(e){return e.substring(1)}function d(){this._store={}}function h(e){if(this._store=new d,e&&Array.isArray(e))for(var t=0,n=e.length;t<n;t++)this.add(e[t])}function p(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=t[r];o in e&&(n[o]=e[o])}return n}function v(){return"undefined"!=typeof chrome&&void 0!==chrome.storage&&void 0!==chrome.storage.local}function y(){return en}function g(e){v()?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):y()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(t){e.emit(t.key)}):window.attachEvent("storage",function(t){e.emit(t.key)}))}function m(){Jt.EventEmitter.call(this),this._listeners={},g(this)}function _(e){if("undefined"!==console&&e in console){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}function b(e,t,n){Error.call(this,n),this.status=e,this.name=t,this.message=n,this.error=!0}function w(e){for(var t=[],n=0,r=e.length;n<r;n++)t=t.concat(e[n]);return t}function k(){}function $(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(_("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())}function x(e,t,n){return new Gt(function(r,i){e.get(t,function(o,u){if(o){if(404!==o.status)return i(o);u={}}var s=u._rev,a=n(u);if(!a)return r({updated:!1,rev:s});a._id=t,a._rev=s,r(j(e,a,n))})})}function j(e,t,n){return e.put(t).then(function(e){return{updated:!0,rev:e.rev}},function(r){if(409!==r.status)throw r;return x(e,t._id,n)})}function E(e){return e=s(e),e.index||(e.index={}),["type","name","ddoc"].forEach(function(t){e.index[t]&&(e[t]=e.index[t],delete e.index[t])}),e.fields&&(e.index.fields=e.fields,delete e.fields),e.type||(e.type="json"),e}function O(e,t,n){t=E(t),e.request({method:"POST",url:"_index",body:t},n)}function A(e,t,n){e.request({method:"POST",url:"_find",body:t},n)}function q(e,t,n){e.request({method:"POST",url:"_explain",body:t},n)}function S(e,t){e.request({method:"GET",url:"_index"},t)}function L(e,t,n){var r=t.ddoc,i=t.type||"json",o=t.name;if(!r)return n(new Error("you must provide an index's ddoc"));if(!o)return n(new Error("you must provide an index's name"));var u="_index/"+[r,i,o].map(encodeURIComponent).join("/");e.request({method:"DELETE",url:u},n)}function B(e,t){for(var n=e,r=0,i=t.length;r<i;r++){if(!(n=n[t[r]]))break}return n}function T(e,t,n){for(var r=0,i=t.length;r<i-1;r++){e=e[t[r]]={}}e[t[i-1]]=n}function M(e,t){return e<t?-1:e>t?1:0}function C(e){for(var t=[],n="",r=0,i=e.length;r<i;r++){var o=e[r];"."===o?r>0&&"\\"===e[r-1]?n=n.substring(0,n.length-1)+".":(t.push(n),n=""):n+=o}return t.push(n),t}function D(e){return on.indexOf(e)>-1}function I(e){return Object.keys(e)[0]}function U(e){return e[I(e)]}function F(e){var t={};return e.forEach(function(e){Object.keys(e).forEach(function(n){var r=e[n];if("object"!=typeof r&&(r={$eq:r}),D(n))r instanceof Array?t[n]=r.map(function(e){return F([e])}):t[n]=F([r]);else{var i=t[n]=t[n]||{};Object.keys(r).forEach(function(e){var t=r[e];return"$gt"===e||"$gte"===e?N(e,t,i):"$lt"===e||"$lte"===e?P(e,t,i):"$ne"===e?R(t,i):"$eq"===e?z(t,i):void(i[e]=t)})}})}),t}function N(e,t,n){void 0===n.$eq&&(void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t)}function P(e,t,n){void 0===n.$eq&&(void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t)}function R(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}function z(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}function V(e){var t=s(e),n=!1;"$and"in t&&(t=F(t.$and),n=!0),["$or","$nor"].forEach(function(e){e in t&&t[e].forEach(function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],i=e[r];"object"==typeof i&&null!==i||(e[r]={$eq:i})}})}),"$not"in t&&(t.$not=F([t.$not]));for(var r=Object.keys(t),i=0;i<r.length;i++){var o=r[i],u=t[o];"object"!=typeof u||null===u?u={$eq:u}:"$ne"in u&&!n&&(u.$ne=[u.$ne]),t[o]=u}return t}function J(e,t,n){for(var r="",i=n-e.length;r.length<i;)r+=t;return r}function K(e,t,n){return J(e,t,n)+e}function W(e,t){if(e===t)return 0;e=X(e),t=X(t);var n=re(e),r=re(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return te(e,t)}return Array.isArray(e)?ee(e,t):ne(e,t)}function X(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=X(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e){e={};for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];void 0!==o&&(e[i]=X(o))}}}}return e}function G(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return ie(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),r=-1,i=n.length,o="";if(t)for(;++r<i;)o+=Y(n[r]);else for(;++r<i;){var u=n[r];o+=Y(u)+Y(e[u])}return o}return""}function Y(e){return e=X(e),re(e)+an+G(e)+"\0"}function H(e,t){var n,r=t;if("1"===e[t])n=0,t++;else{var i="0"===e[t];t++;var o="",u=e.substring(t,t+sn),s=parseInt(u,10)+un;for(i&&(s=-s),t+=sn;;){var a=e[t];if("\0"===a)break;o+=a,t++}o=o.split("."),n=1===o.length?parseInt(o,10):parseFloat(o[0]+"."+o[1]),i&&(n-=10),0!==s&&(n=parseFloat(n+"e"+s))}return{num:n,length:t-r}}function Q(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(n);else if(o===e.length-2){var u=e.pop();i[u]=n}else e.push(n)}}function Z(e){for(var t=[],n=[],r=0;;){var i=e[r++];if("\0"!==i)switch(i){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var o=H(e,r);t.push(o.num),r+=o.length;break;case"4":for(var u="";;){var s=e[r];if("\0"===s)break;u+=s,r++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var a={element:[],index:t.length};t.push(a.element),n.push(a);break;case"6":var c={element:{},index:t.length};t.push(c.element),n.push(c);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}else{if(1===t.length)return t.pop();Q(t,n)}}}function ee(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=W(e[r],t[r]);if(0!==i)return i}return e.length===t.length?0:e.length>t.length?1:-1}function te(e,t){return e===t?0:e>t?1:-1}function ne(e,t){for(var n=Object.keys(e),r=Object.keys(t),i=Math.min(n.length,r.length),o=0;o<i;o++){var u=W(n[o],r[o]);if(0!==u)return u;if(0!==(u=W(e[n[o]],t[r[o]])))return u}return n.length===r.length?0:n.length>r.length?1:-1}function re(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 ie(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,i=r?"0":"2",o=(r?-n:n)-un,u=K(o.toString(),"0",sn);i+=an+u;var s=Math.abs(parseFloat(t[0]));r&&(s=10-s);var a=s.toFixed(20);return a=a.replace(/\.?0+$/,""),i+=an+a}function oe(e){function t(t){return e.map(function(e){var n=I(e),r=C(n);return B(t,r)})}return function(e,n){var r=t(e.doc),i=t(n.doc),o=W(r,i);return 0!==o?o:M(e.doc._id,n.doc._id)}}function ue(e,t,n){if(e=e.filter(function(e){return se(e.doc,t.selector,n)}),t.sort){var r=oe(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===U(t.sort[0])&&(e=e.reverse())}if("limit"in t||"skip"in t){var i=t.skip||0,o=("limit"in t?t.limit:e.length)+i;e=e.slice(i,o)}return e}function se(e,t,n){return n.every(function(n){var r=t[n],i=C(n),o=B(e,i);return D(n)?ce(n,r,e):ae(r,e,i,o)})}function ae(e,t,n,r){return!e||Object.keys(e).every(function(i){var o=e[i];return fe(i,t,o,n,r)})}function ce(e,t,n){return"$or"===e?t.some(function(e){return se(n,e,Object.keys(e))}):"$not"===e?!se(n,t,Object.keys(t)):!t.find(function(e){return se(n,e,Object.keys(e))})}function fe(e,t,n,r,i){if(!cn[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return cn[e](t,n,r,i)}function le(e){return void 0!==e&&null!==e}function de(e){return void 0!==e}function he(e,t){var n=t[0],r=t[1];if(0===n)throw new Error("Bad divisor, cannot divide by zero");if(parseInt(n,10)!==n)throw new Error("Divisor is not an integer");if(parseInt(r,10)!==r)throw new Error("Modulus is not an integer");return parseInt(e,10)===e&&e%n===r}function pe(e,t){return t.some(function(t){return e instanceof Array?e.indexOf(t)>-1:e===t})}function ve(e,t){return t.every(function(t){return e.indexOf(t)>-1})}function ye(e,t){return e.length===t}function ge(e,t){return new RegExp(t).test(e)}function me(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}throw new Error(t+" not supported as a type.Please use one of object, string, array, number, boolean or null.")}function _e(e){return function(){for(var t=arguments.length,n=new Array(t),r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}}function be(e){return _e(function(t){var n=t.pop(),r=e.apply(this,t);return we(r,n),r})}function we(e,n){return e.then(function(e){t.nextTick(function(){n(null,e)})},function(e){t.nextTick(function(){n(e)})}),e}function ke(e){for(var t={},n=0,r=e.length;n<r;n++)t=nn(t,e[n]);return t}function $e(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=C(t[r]),u=B(e,o);void 0!==u&&T(n,o,u)}return n}function xe(e,t){for(var n=0,r=Math.min(e.length,t.length);n<r;n++)if(e[n]!==t[n])return!1;return!0}function je(e,t){return!(e.length>t.length)&&xe(e,t)}function Ee(e,t){e=e.slice();for(var n=0,r=t.length;n<r;n++){var i=t[n];if(!e.length)break;var o=e.indexOf(i);if(-1===o)return!1;e.splice(o,1)}return!0}function Oe(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function Ae(e,t){for(var n=null,r=-1,i=0,o=e.length;i<o;i++){var u=e[i],s=t(u);s>r&&(r=s,n=u)}return n}function qe(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Se(e){for(var t={},n=0;n<e.length;n++)t["$"+e[n]]=!0;return Object.keys(t).map(function(e){return e.substring(1)})}function Le(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,r=new n,i=0;i<e.length;i+=1)r.append(e[i]);return r.getBlob(t.type)}}function Be(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function Te(e,t){return Le([Be(e)],{type:t})}
function Me(e,t){return Te(ln(e),t)}function Ce(){this.promise=new Gt(function(e){e()})}function De(e){return Xt.hash(e)}function Ie(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}function Ue(e,t){return Ie(e)+Ie(t)+"undefined"}function Fe(e,t,n,r,i,o){var u,s=Ue(n,r);if(!i&&(u=e._cachedViews=e._cachedViews||{},u[s]))return u[s];var a=e.info().then(function(a){function c(e){e.views=e.views||{};var n=t;-1===n.indexOf("/")&&(n=t+"/"+t);var r=e.views[n]=e.views[n]||{};if(!r[f])return r[f]=!0,e}var f=a.db_name+"-mrview-"+(i?"temp":De(s));return x(e,"_local/"+o,c).then(function(){return e.registerDependentDatabase(f).then(function(t){var i=t.db;i.auto_compaction=!0;var o={name:f,db:i,sourceDB:e,adapter:e.adapter,mapFun:n,reduceFun:r};return o.db.get("_local/lastSeq").catch(function(e){if(404!==e.status)throw e}).then(function(e){return o.seq=e?e.seq:0,u&&o.db.once("destroyed",function(){delete u[s]}),o})})})});return u&&(u[s]=a),a}function Ne(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Ne)}catch(e){}}function Pe(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Pe)}catch(e){}}function Re(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Re)}catch(e){}}function ze(e,t){return t&&e.then(function(e){Wt(function(){t(null,e)})},function(e){Wt(function(){t(e)})}),e}function Ve(e){return Vt(function(t){var n=t.pop(),r=e.apply(this,t);return"function"==typeof n&&ze(r,n),r})}function Je(e,t){return e.then(function(e){return t().then(function(){return e})},function(e){return t().then(function(){throw e})})}function Ke(e,t){return function(){var n=arguments,r=this;return e.add(function(){return t.apply(r,n)})}}function We(e){var t=new Qt(e),n=new Array(t.size),r=-1;return t.forEach(function(e){n[++r]=e}),n}function Xe(e){var t=new Array(e.size),n=-1;return e.forEach(function(e,r){t[++n]=r}),t}function Ge(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function Ye(e){return 1===e.length&&/^1-/.test(e[0].rev)}function He(e,t){try{e.emit("error",t)}catch(e){_("error","The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),_("error",t)}}function Qe(e,t){return function(n){for(var r=[],i=0,o=e.length;i<o;i++){for(var u=C(e[i]),s=n,a=0,c=u.length;a<c;a++){if(!(s=s[u[a]]))return}r.push(s)}t(r)}}function Ze(e,t){var n=C(e);return function(e){for(var r=e,i=0,o=n.length;i<o;i++){if(!(r=r[n[i]]))return}t(r)}}function et(e,t){return function(n){t(n[e])}}function tt(e,t){return function(n){for(var r=[],i=0,o=e.length;i<o;i++)r.push(n[e[i]]);t(r)}}function nt(e){for(var t=0,n=e.length;t<n;t++){if(-1!==e[t].indexOf("."))return!1}return!0}function rt(e,t){var n=nt(e),r=1===e.length;return n?r?et(e[0],t):tt(e,t):r?Ze(e[0],t):Qe(e,t)}function it(e,t){return rt(Object.keys(e.fields),t)}function ot(){throw new Error("reduce not supported")}function ut(e,t){var n=e.views[t];if(!n.map||!n.map.fields)throw new Error("ddoc "+e._id+" with view "+t+" doesn't have map.fields defined. maybe it wasn't created by this plugin?")}function st(e){if(!Array.isArray(e))throw new Error("invalid sort json - should be an array");return e.map(function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e})}function at(e){var t=[];return"string"==typeof e?t.push(e):t=e,t.map(function(e){return e.replace("_design/","")})}function ct(e){return e.fields=e.fields.map(function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e}),e}function ft(e,t){for(var n=[],r=0;r<t.def.fields.length;r++){var i=I(t.def.fields[r]);n.push(e[i])}return n}function lt(e,t,n){for(var r=n.def.fields,i=0,o=e.length;i<o;i++){var u=e[i],s=ft(u.doc,n);if(1===r.length)s=s[0];else for(;s.length>t.length;)s.pop();if(Math.abs(W(s,t))>0)break}return i>0?e.slice(i):e}function dt(e){var t=s(e);return delete t.startkey,delete t.endkey,delete t.inclusive_start,delete t.inclusive_end,"endkey"in e&&(t.startkey=e.endkey),"startkey"in e&&(t.endkey=e.startkey),"inclusive_start"in e&&(t.inclusive_end=e.inclusive_start),"inclusive_end"in e&&(t.inclusive_start=e.inclusive_end),t}function ht(e){var t=e.fields.filter(function(e){return"asc"===U(e)});if(0!==t.length&&t.length!==e.fields.length)throw new Error("unsupported mixed sorting")}function pt(e,t){if(t.defaultUsed&&e.sort){var n=e.sort.filter(function(e){return"_id"!==Object.keys(e)[0]}).map(function(e){return Object.keys(e)[0]});if(n.length>0)throw new Error('Cannot sort on field(s) "'+n.join(",")+'" when using the default index')}t.defaultUsed}function vt(e){if("object"!=typeof e.selector)throw new Error("you must provide a selector when you find()")}function yt(e,t){var n,r=Object.keys(e),i=t?t.map(I):[];return n=r.length>=i.length?r:i,0===i.length?{fields:n}:(n=n.sort(function(e,t){var n=i.indexOf(e);-1===n&&(n=Number.MAX_VALUE);var r=i.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),n<r?-1:n>r?1:0}),{fields:n,sortOrder:t.map(I)})}function gt(e,t){function n(){return o||(o=De(JSON.stringify(t)))}function r(e){return e._rev&&"query"!==e.language&&(f=!0),e.language="query",e.views=e.views||{},!(l=!!e.views[u])&&(e.views[u]={map:{fields:ke(t.index.fields)},reduce:"_count",options:{def:i}},e)}t=E(t);var i=s(t.index);t.index=ct(t.index),ht(t.index);var o,u=t.name||"idx-"+n(),a=t.ddoc||"idx-"+n(),c="_design/"+a,f=!1,l=!1;return e.constructor.emit("debug",["find","creating index",c]),x(e,c,r).then(function(){if(f)throw new Error('invalid language for ddoc with id "'+c+'" (should be "query")')}).then(function(){var t=a+"/"+u;return vn.query.call(e,t,{limit:0,reduce:!1}).then(function(){return{id:c,name:u,result:l?"exists":"created"}})})}function mt(e){return e.allDocs({startkey:"_design/",endkey:"_design/￿",include_docs:!0}).then(function(e){var t={indexes:[{ddoc:null,name:"_all_docs",type:"special",def:{fields:[{_id:"asc"}]}}]};return t.indexes=fn(t.indexes,e.rows.filter(function(e){return"query"===e.doc.language}).map(function(e){return(void 0!==e.doc.views?Object.keys(e.doc.views):[]).map(function(t){var n=e.doc.views[t];return{ddoc:e.id,name:t,type:"json",def:ct(n.options.def)}})})),t.indexes.sort(function(e,t){return M(e.name,t.name)}),t.total_rows=t.indexes.length,t})}function _t(e,t){for(var n=e.def.fields.map(I),r=0,i=n.length;r<i;r++){if(t===n[r])return!0}return!1}function bt(e,t){return"$eq"!==I(e[t])}function wt(e,t){var n=t.def.fields.map(I);return e.slice().sort(function(e,t){var r=n.indexOf(e),i=n.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),-1===i&&(i=Number.MAX_VALUE),M(r,i)})}function kt(e,t,n){n=wt(n,e);for(var r=!1,i=0,o=n.length;i<o;i++){var u=n[i];if(r||!_t(e,u))return n.slice(i);i<o-1&&bt(t,u)&&(r=!0)}return[]}function $t(e){var t=[];return Object.keys(e).forEach(function(n){var r=e[n];Object.keys(r).forEach(function(e){"$ne"===e&&t.push(n)})}),t}function xt(e,t,n,r){return wt(Se(fn(e,kt(t,n,r),$t(n))),t)}function jt(e,t,n){if(t){var r=je(t,e),i=xe(n,e);return r&&i}return Ee(n,e)}function Et(e){return-1===mn.indexOf(e)}function Ot(e,t){var n=e[0],r=t[n];return void 0===r||!!Object.keys(r).some(function(e){return!Et(e)})&&!(1===Object.keys(r).length&&"$ne"===I(r))}function At(e,t,n,r){var i=e.def.fields.map(I);return!!jt(i,t,n)&&Ot(i,r)}function qt(e,t,n,r){return r.reduce(function(r,i){return At(i,n,t,e)&&r.push(i),r},[])}function St(e,t,n,r,i){function o(e){for(var t=e.def.fields.map(I),n=0,r=0,i=t.length;r<i;r++){var o=t[r];a[o]&&n++}return n}var u=qt(e,t,n,r);if(0===u.length){if(i)throw{error:"no_usable_index",message:"There is no index available for this selector."};var s=r[0];return s.defaultUsed=!0,s}if(1===u.length&&!i)return u[0];var a=Oe(t);if(i){var c="_design/"+i[0],f=2===i.length&&i[1],l=u.find(function(e){return!(!f||e.ddoc!==c||f!==e.name)||e.ddoc===c});if(!l)throw{error:"unknown_error",message:"Could not find that index or could not use that index for the query"};return l}return Ae(u,o)}function Lt(e,t){switch(e){case"$eq":return{key:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Bt(e,t){var n,r=I(t.def.fields[0]),i=e[r]||{},o=[],u=Object.keys(i);return u.forEach(function(e){if(Et(e))return void o.push(r);var t=i[e],u=Lt(e,t);n=n?ke([n,u]):u}),{queryOpts:n,inMemoryFields:o}}function Tt(e,t){switch(e){case"$eq":return{startkey:t,endkey:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Mt(e,t){function n(e){!1!==r&&s.push(yn),!1!==i&&a.push(gn),u=o.slice(e)}for(var r,i,o=t.def.fields.map(I),u=[],s=[],a=[],c=0,f=o.length;c<f;c++){var l=o[c],d=e[l];if(!d||!Object.keys(d).length){n(c);break}if(c>0){if(Object.keys(d).some(Et)){n(c);break}var h="$gt"in d||"$gte"in d||"$lt"in d||"$lte"in d,p=Object.keys(e[o[c-1]]),v=qe(p,["$eq"]),y=qe(p,Object.keys(d));if(h&&!v&&!y){n(c);break}}for(var g=Object.keys(d),m=null,_=0;_<g.length;_++){var b=g[_],w=d[b],k=Tt(b,w);m=m?ke([m,k]):k}s.push("startkey"in m?m.startkey:yn),a.push("endkey"in m?m.endkey:gn),"inclusive_start"in m&&(r=m.inclusive_start),"inclusive_end"in m&&(i=m.inclusive_end)}var $={startkey:s,endkey:a};return void 0!==r&&($.inclusive_start=r),void 0!==i&&($.inclusive_end=i),{queryOpts:$,inMemoryFields:u}}function Ct(e){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(e)]}}function Dt(e,t){return t.defaultUsed?Ct(e,t):1===t.def.fields.length?Bt(e,t):Mt(e,t)}function It(e,t){var n=e.selector,r=e.sort,i=yt(n,r),o=i.fields,u=i.sortOrder,s=St(n,o,u,t,e.use_index),a=Dt(n,s);return{queryOpts:a.queryOpts,index:s,inMemoryFields:xt(a.inMemoryFields,s,n,o)}}function Ut(e){return e.ddoc.substring(8)+"/"+e.name}function Ft(e,t){var n=s(t);return n.descending?("endkey"in n&&"string"!=typeof n.endkey&&(n.endkey=""),"startkey"in n&&"string"!=typeof n.startkey&&(n.limit=0)):("startkey"in n&&"string"!=typeof n.startkey&&(n.startkey=""),"endkey"in n&&"string"!=typeof n.endkey&&(n.limit=0)),"key"in n&&"string"!=typeof n.key&&(n.limit=0),e.allDocs(n).then(function(e){return e.rows=e.rows.filter(function(e){return!/^_design\//.test(e.id)}),e})}function Nt(e,t,n){return t.selector&&(t.selector=V(t.selector)),t.sort&&(t.sort=st(t.sort)),t.use_index&&(t.use_index=at(t.use_index)),vt(t),mt(e).then(function(r){e.constructor.emit("debug",["find","planning query",t]);var i=It(t,r.indexes);e.constructor.emit("debug",["find","query plan",i]);var o=i.index;pt(t,o);var u=nn({include_docs:!0,reduce:!1},i.queryOpts);return"startkey"in u&&"endkey"in u&&W(u.startkey,u.endkey)>0?{docs:[]}:(t.sort&&"string"!=typeof t.sort[0]&&"desc"===U(t.sort[0])&&(u.descending=!0,u=dt(u)),i.inMemoryFields.length||("limit"in t&&(u.limit=t.limit),"skip"in t&&(u.skip=t.skip)),n?Gt.resolve(i,u):Gt.resolve().then(function(){if("_all_docs"===o.name)return Ft(e,u);var t=Ut(o);return vn.query.call(e,t,u)}).then(function(e){!1===u.inclusive_start&&(e.rows=lt(e.rows,u.startkey,o)),i.inMemoryFields.length&&(e.rows=ue(e.rows,t,i.inMemoryFields));var n={docs:e.rows.map(function(e){var n=e.doc;return t.fields?$e(n,t.fields):n})};return o.defaultUsed&&(n.warning="no matching index found, create an index to optimize query time"),n}))})}function Pt(e,t){return Nt(e,t,!0).then(function(n){return{dbname:e.name,index:n.index,selector:t.selector,range:{start_key:n.queryOpts.startkey,end_key:n.queryOpts.endkey},opts:{use_index:t.use_index||[],bookmark:"nil",limit:t.limit,skip:t.skip,sort:t.sort||{},fields:t.fields,conflicts:!1,r:[49]},limit:t.limit,skip:t.skip||0,fields:t.fields}})}function Rt(e,t){function n(e){return 1===Object.keys(e.views).length&&e.views[i]?{_id:r,_deleted:!0}:(delete e.views[i],e)}if(!t.ddoc)throw new Error("you must supply an index.ddoc when deleting");if(!t.name)throw new Error("you must supply an index.name when deleting");var r=t.ddoc,i=t.name;return x(e,r,n).then(function(){return vn.viewCleanup.apply(e)}).then(function(){return{ok:!0}})}var zt=n(e(5)),Vt=n(e(1)),Jt=e(2),Kt=n(e(4)),Wt=n(e(3)),Xt=(n(e(10)),n(e(7))),Gt="function"==typeof Promise?Promise:zt,Yt=Function.prototype.toString,Ht=Yt.call(Object);d.prototype.get=function(e){var t=f(e);return this._store[t]},d.prototype.set=function(e,t){var n=f(e);return this._store[n]=t,!0},d.prototype.has=function(e){return f(e)in this._store},d.prototype.delete=function(e){var t=f(e),n=t in this._store;return delete this._store[t],n},d.prototype.forEach=function(e){for(var t=Object.keys(this._store),n=0,r=t.length;n<r;n++){var i=t[n],o=this._store[i];i=l(i),e(o,i)}},Object.defineProperty(d.prototype,"size",{get:function(){return Object.keys(this._store).length}}),h.prototype.add=function(e){return this._store.set(e,!0)},h.prototype.has=function(e){return this._store.has(e)},h.prototype.forEach=function(e){this._store.forEach(function(t,n){e(n)})},Object.defineProperty(h.prototype,"size",{get:function(){return this._store.size}});var Qt,Zt;!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var e=Object.getOwnPropertyDescriptor(Map,Symbol.species);return e&&"get"in e&&Map[Symbol.species]===Map}()?(Qt=h,Zt=d):(Qt=Set,Zt=Map);var en;if(v())en=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),en=!!localStorage.getItem("_pouch_check_localstorage")}catch(e){en=!1}Kt(m,Jt.EventEmitter),m.prototype.addListener=function(e,t,n,r){function i(){function e(){u=!1}if(o._listeners[t]){if(u)return void(u="waiting");u=!0;var s=p(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(s).on("change",function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===u&&Wt(i),u=!1}).on("error",e)}}if(!this._listeners[t]){var o=this,u=!1;this._listeners[t]=i,this.on(e,i)}},m.prototype.removeListener=function(e,t){t in this._listeners&&(Jt.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},m.prototype.notifyLocalWindows=function(e){v()?chrome.storage.local.set({dbName:e}):y()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},m.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var tn;tn="function"==typeof Object.assign?Object.assign:function(e){for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};var nn=tn;Kt(b,Error),b.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var rn=(new b(401,"unauthorized","Name or password is incorrect."),new b(400,"bad_request","Missing JSON list of 'docs'"),new b(404,"not_found","missing"),new b(409,"conflict","Document update conflict"),new b(400,"bad_request","_id field must contain a string"),new b(412,"missing_id","_id is required for puts"),new b(400,"bad_request","Only reserved document ids may start with underscore."),new b(412,"precondition_failed","Database not open"),new b(500,"unknown_error","Database encountered an unknown error"),new b(500,"badarg","Some query argument is invalid"),new b(400,"invalid_request","Request was invalid"),new b(400,"query_parse_error","Some query parameter is invalid"),new b(500,"doc_validation","Bad special document member"),new b(400,"bad_request","Something wrong with the request"),new b(400,"bad_request","Document must be a JSON object"),new b(404,"not_found","Database not found"),new b(500,"indexed_db_went_bad","unknown"),new b(500,"web_sql_went_bad","unknown"),new b(500,"levelDB_went_went_bad","unknown"),new b(403,"forbidden","Forbidden by design doc validate_doc_update function"),new b(400,"bad_request","Invalid rev format"),new b(412,"file_exists","The database could not be created, the file already exists."),new b(412,"missing_stub","A pre-existing attachment stub wasn't found"),new b(413,"invalid_url","Provided URL is invalid"),k.name);var on=["$or","$nor","$not"],un=-324,sn=3,an="",cn={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.some(function(e){return se(e,t,Object.keys(t))}):r.some(function(r){return ae(t,e,n,r)})))},$allMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.every(function(e){return se(e,t,Object.keys(t))}):r.every(function(r){return ae(t,e,n,r)})))},$eq:function(e,t,n,r){return de(r)&&0===W(r,t)},$gte:function(e,t,n,r){return de(r)&&W(r,t)>=0},$gt:function(e,t,n,r){return de(r)&&W(r,t)>0},$lte:function(e,t,n,r){return de(r)&&W(r,t)<=0},$lt:function(e,t,n,r){return de(r)&&W(r,t)<0},$exists:function(e,t,n,r){return t?de(r):!de(r)},$mod:function(e,t,n,r){return le(r)&&he(r,t)},$ne:function(e,t,n,r){return t.every(function(e){return 0!==W(r,e)})},$in:function(e,t,n,r){return le(r)&&pe(r,t)},$nin:function(e,t,n,r){return le(r)&&!pe(r,t)},$size:function(e,t,n,r){return le(r)&&ye(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&ve(r,t)},$regex:function(e,t,n,r){return le(r)&&ge(r,t)},$type:function(e,t,n,r){return me(r,t)}},fn=_e(function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];Array.isArray(i)?t=t.concat(fn.apply(null,i)):t.push(i)}return t}),ln=function(e){return atob(e)};Ce.prototype.add=function(e){return this.promise=this.promise.catch(function(){}).then(function(){return e()}),this.promise},Ce.prototype.finish=function(){return this.promise},Kt(Ne,Error),Kt(Pe,Error),Kt(Re,Error);var dn={},hn=new Ce,pn=50,vn=function(e,t,n,r){function i(e,t,n){try{t(n)}catch(t){He(e,t)}}function o(e,t,n,r,i){try{return{output:t(n,r,i)}}catch(t){return He(e,t),{error:t}}}function u(e,t){var n=W(e.key,t.key);return 0!==n?n:W(e.value,t.value)}function s(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function a(e){var t=e.value;return t&&"object"==typeof t&&t._id||e.id}function c(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=Me(n.data,n.content_type)})})}function f(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&c(t),t}}function l(e,t,n,r){var i=t[e];void 0!==i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function d(e){if(void 0!==e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function h(e){return e.group_level=d(e.group_level),e.limit=d(e.limit),e.skip=d(e.skip),e}function p(e){if(e){if("number"!=typeof e)return new Ne('Invalid value for integer: "'+e+'"');if(e<0)return new Ne('Invalid value for positive integer: "'+e+'"')}}function v(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&W(e[n],e[r])>0)throw new Ne("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&!1!==e.reduce){if(e.include_docs)throw new Ne("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Ne("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(t){var n=p(e[t]);if(n)throw n})}function y(e,t,n){var r,i=[],o="GET";if(l("reduce",n,i),l("include_docs",n,i),l("attachments",n,i),l("limit",n,i),l("descending",n,i),l("group",n,i),l("group_level",n,i),l("skip",n,i),l("stale",n,i),l("conflicts",n,i),l("startkey",n,i,!0),l("start_key",n,i,!0),l("endkey",n,i,!0),l("end_key",n,i,!0),l("inclusive_end",n,i),l("key",n,i,!0),i=i.join("&"),i=""===i?"":"?"+i,void 0!==n.keys){var u="keys="+encodeURIComponent(JSON.stringify(n.keys));u.length+i.length+1<=2e3?i+=("?"===i[0]?"&":"?")+u:(o="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var s=Ge(t);return e.request({method:o,url:"_design/"+s[0]+"/_view/"+s[1]+i,body:r}).then(function(e){return e.rows.forEach(function(e){if(e.value&&e.value.error&&"builtin_reduce_error"===e.value.error)throw new Error(e.reason)}),e}).then(f(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"+i,body:r}).then(f(n))}function g(e,t,n){return new Gt(function(r,i){e._query(t,n,function(e,t){if(e)return i(e);r(t)})})}function m(e){return new Gt(function(t,n){e._viewCleanup(function(e,r){if(e)return n(e);t(r)})})}function _(e){return function(t){if(404===t.status)return e;throw t}}function b(e,t,n){function r(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Gt.resolve({rows:[]})}function i(e,t){for(var n=[],r=new Qt,i=0,o=t.rows.length;i<o;i++){var u=t.rows[i],s=u.doc;if(s&&(n.push(s),r.add(s._id),s._deleted=!a.has(s._id),!s._deleted)){var c=a.get(s._id);"value"in c&&(s.value=c.value)}}var f=Xe(a);return f.forEach(function(e){if(!r.has(e)){var t={_id:e},i=a.get(e);"value"in i&&(t.value=i.value),n.push(t)}}),e.keys=We(f.concat(e.keys)),n.push(e),n}var o="_local/doc_"+e,u={_id:o,keys:[]},s=n.get(e),a=s[0],c=s[1];return function(){return Ye(c)?Gt.resolve(u):t.db.get(o).catch(_(u))}().then(function(e){return r(e).then(function(t){return i(e,t)})})}function k(e,t,n){return e.db.get("_local/lastSeq").catch(_({_id:"_local/lastSeq",seq:0})).then(function(r){var i=Xe(t);return Gt.all(i.map(function(n){return b(n,e,t)})).then(function(t){var i=w(t);return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})})})}function x(e){var t="string"==typeof e?e:e.name,n=dn[t];return n||(n=dn[t]=new Ce),n}function j(e){return Ke(x(e),function(){return E(e)})()}function E(e){function n(e,t){var n={id:l._id,key:X(e)};void 0!==t&&null!==t&&(n.value=X(t)),f.push(n)}function r(t,n){return function(){return k(e,t,n)}}function o(){return e.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:h,limit:pn}).then(s)}function s(e){var t=e.results;if(t.length){var n=a(t);if(p.add(r(n,h)),!(t.length<pn))return o()}}function a(t){for(var n=new Zt,r=0,o=t.length;r<o;r++){var s=t[r];if("_"!==s.doc._id[0]){f=[],l=s.doc,l._deleted||i(e.sourceDB,d,l),f.sort(u);var a=c(f);n.set(s.doc._id,[a,s.changes])}h=s.seq}return n}function c(e){for(var t,n=new Zt,r=0,i=e.length;r<i;r++){var o=e[r],u=[o.key,o.id];r>0&&0===W(o.key,t)&&u.push(r),n.set(Y(u),o),t=o.key}return n}var f,l,d=t(e.mapFun,n),h=e.seq||0,p=new Ce;return o().then(function(){return p.finish()}).then(function(){e.seq=h})}function O(e,t,r){0===r.group_level&&delete r.group_level;var i=r.group||r.group_level,u=n(e.reduceFun),a=[],c=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;t.forEach(function(e){var t=a[a.length-1],n=i?e.key:null;if(i&&Array.isArray(n)&&(n=n.slice(0,c)),t&&0===W(t.groupKey,n))return t.keys.push([e.key,e.id]),void t.values.push(e.value);a.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})}),t=[];for(var f=0,l=a.length;f<l;f++){var d=a[f],h=o(e.sourceDB,u,d.keys,d.values,!1);if(h.error&&h.error instanceof Re)throw h.error;t.push({value:h.error?null:h.output,key:d.groupKey})}return{rows:s(t,r.limit,r.skip)}}function A(e,t){return Ke(x(e),function(){return q(e,t)})()}function q(e,t){function n(t){return t.include_docs=!0,e.db.allDocs(t).then(function(e){return i=e.total_rows,e.rows.map(function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){var t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(t<n||t>n))return e.doc.value}var r=Z(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=o?O(e,n,t):{total_rows:i,offset:u,rows:n},t.include_docs){var s=We(n.map(a));return e.sourceDB.allDocs({keys:s,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then(function(e){var t=new Zt;return e.rows.forEach(function(e){t.set(e.id,e.doc)}),n.forEach(function(e){var n=a(e),r=t.get(n);r&&(e.doc=r)}),r})}return r}var i,o=e.reduceFun&&!1!==t.reduce,u=t.skip||0;if(void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys),void 0!==t.keys){var s=t.keys,c=s.map(function(e){return n({startkey:Y([e]),endkey:Y([e,{}])})});return Gt.all(c).then(w).then(r)}var f,l,d={descending:t.descending};if("start_key"in t&&(f=t.start_key),"startkey"in t&&(f=t.startkey),"end_key"in t&&(l=t.end_key),"endkey"in t&&(l=t.endkey),void 0!==f&&(d.startkey=Y(t.descending?[f,{}]:[f])),void 0!==l){var h=!1!==t.inclusive_end;t.descending&&(h=!h),d.endkey=Y(h?[l,{}]:[l])}if(void 0!==t.key){var p=Y([t.key]),v=Y([t.key,{}]);d.descending?(d.endkey=p,d.startkey=v):(d.startkey=p,d.endkey=v)}return o||("number"==typeof t.limit&&(d.limit=t.limit),d.skip=u),n(d).then(r)}function S(e){return e.request({method:"POST",url:"_view_cleanup"})}function L(t){return t.get("_local/"+e).then(function(e){var n=new Zt;Object.keys(e.views).forEach(function(e){var t=Ge(e),r="_design/"+t[0],i=t[1],o=n.get(r);o||(o=new Qt,n.set(r,o)),o.add(i)});var r={keys:Xe(n),include_docs:!0};return t.allDocs(r).then(function(r){var i={};r.rows.forEach(function(t){var r=t.key.substring(8);n.get(t.key).forEach(function(n){var o=r+"/"+n;e.views[o]||(o=n);var u=Object.keys(e.views[o]),s=t.doc&&t.doc.views&&t.doc.views[n];u.forEach(function(e){i[e]=i[e]||s})})});var o=Object.keys(i).filter(function(e){return!i[e]}),u=o.map(function(e){return Ke(x(e),function(){return new t.constructor(e,t.__opts).destroy()})()});return Gt.all(u).then(function(){return{ok:!0}})})},_({ok:!0}))}function B(t,n,i){if("function"==typeof t._query)return g(t,n,i);if($(t))return y(t,n,i);if("string"!=typeof n)return v(i,n),hn.add(function(){return Fe(t,"temp_view/temp_view",n.map,n.reduce,!0,e).then(function(e){return Je(j(e).then(function(){return A(e,i)}),function(){return e.db.destroy()})})}),hn.finish();var o=n,u=Ge(o),s=u[0],a=u[1];return t.get("_design/"+s).then(function(n){var u=n.views&&n.views[a];if(!u)throw new Pe("ddoc "+n._id+" has no view named "+a);return r(n,a),v(i,u),Fe(t,o,u.map,u.reduce,!1,e).then(function(e){return"ok"===i.stale||"update_after"===i.stale?("update_after"===i.stale&&Wt(function(){j(e)}),A(e,i)):j(e).then(function(){return A(e,i)})})})}function T(e,t,n){var r=this;"function"==typeof t&&(n=t,t={}),t=t?h(t):{},"function"==typeof e&&(e={map:e});var i=Gt.resolve().then(function(){return B(r,e,t)});return ze(i,n),i}return{query:T,viewCleanup:Ve(function(){var e=this;return"function"==typeof e._viewCleanup?m(e):$(e)?S(e):L(e)})}}("indexes",it,ot,ut),yn=null,gn={"￿":{}},mn=["$eq","$gt","$gte","$lt","$lte"],_n=be(gt),bn=be(Nt),wn=be(Pt),kn=be(mt),$n=be(Rt),xn={};xn.createIndex=c(function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to create"));($(this)?O:_n)(this,e,t)}),xn.find=c(function(e,t){if(void 0===t&&(t=e,e=void 0),"object"!=typeof e)return t(new Error("you must provide search parameters to find()"));($(this)?A:bn)(this,e,t)}),xn.explain=c(function(e,t){if(void 0===t&&(t=e,e=void 0),"object"!=typeof e)return t(new Error("you must provide search parameters to explain()"));($(this)?q:wn)(this,e,t)}),xn.getIndexes=c(function(e){($(this)?S:kn)(this,e)}),xn.deleteIndex=c(function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to delete"));($(this)?L:$n)(this,e,t)}),"undefined"==typeof PouchDB?_("error",'pouchdb-find plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?'):PouchDB.plugin(xn)}).call(this,e(6))},{1:1,10:10,2:2,3:3,4:4,5:5,6:6,7:7}]},{},[11]);
{
"name": "pouchdb",
"version": "6.2.0",
"version": "6.2.1-prerelease",
"description": "PouchDB is a pocket-sized database",

@@ -12,3 +12,3 @@ "main": "./lib/index.js",

"./lib/index.js": "./lib/index-browser.js",
"./lib/index.es.js": "./lib/index-browser.es.js"
"./src/pouchdb.js": "./src/pouchdb-browser.js"
},

@@ -28,28 +28,3 @@ "jspm": {

"pouchdb"
],
"dependencies": {
"argsarray": "0.0.1",
"buffer-from": "0.1.1",
"clone-buffer": "1.0.0",
"debug": "2.6.1",
"double-ended-queue": "2.1.0-0",
"immediate": "3.0.6",
"inherits": "2.0.3",
"level-codec": "7.0.0",
"level-write-stream": "1.0.0",
"leveldown": "1.5.0",
"levelup": "1.3.5",
"lie": "3.1.1",
"ltgt": "2.1.3",
"readable-stream": "1.0.33",
"request": "2.80.0",
"spark-md5": "3.0.0",
"through2": "2.0.3",
"vuvuzela": "1.0.3"
},
"files": [
"lib",
"dist",
"tonic-example.js"
]
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc