pWiki/v2/ext-lib/pouchdb.find.min.js
Alex A. Naanou 11ce24e145 cleanup:separating versions...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-20 16:31:25 +03:00

8 lines
72 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// pouchdb-find plugin 7.3.0
// Based on Mango: https://github.com/cloudant/mango
//
// (c) 2012-2022 Dale Harvey and the PouchDB team
// PouchDB may be freely distributed under the Apache license, version 2.0.
// For all details and documentation:
// http://pouchdb.com
!function e(t,n,r){function i(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 f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[u]={exports:{}};t[u][0].call(c.exports,(function(e){return i(t[u][1][e]||e)}),c,c.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";t.exports=function(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,[])}}},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var s,a=10;try{var f={};Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),s=0===f.x}catch(e){s=!1}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n){if(t)e.call(n);else for(var r=e.length,i=w(e,r),o=0;o<r;++o)i[o].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=w(e,i),u=0;u<i;++u)o[u].call(n,r)}function h(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,u=w(e,o),s=0;s<o;++s)u[s].call(n,r,i)}function p(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var u=e.length,s=w(e,u),a=0;a<u;++a)s[a].call(n,r,i,o)}function y(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=w(e,i),u=0;u<i;++u)o[u].apply(n,r)}function v(e,t,n,i){var o,u,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),u=e._events),s=u[t]):(u=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=u[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(o=c(e))&&o>0&&s.length>o){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else s=u[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function m(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(g,r);return i.listener=n,r.wrapFn=i,i}function b(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):w(i,i.length):[]}function _(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}s?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');a=e}}):u.defaultMaxListeners=a,u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(e){var t,n,r,i,o,u,s="error"===e;if(u=this._events)s=s&&null==u.error;else if(!s)return!1;if(s){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var a=new Error('Unhandled "error" event. ('+t+")");throw a.context=t,a}if(!(n=u[e]))return!1;var f="function"==typeof n;switch(r=arguments.length){case 1:l(n,f,this);break;case 2:d(n,f,this,arguments[1]);break;case 3:h(n,f,this,arguments[1],arguments[2]);break;case 4:p(n,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];y(n,f,this,i)}return!0},u.prototype.addListener=function(e,t){return v(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return v(this,e,t,!0)},u.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,m(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,m(this,e,t)),this},u.prototype.removeListener=function(e,t){var n,i,o,u,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,u=n.length-1;u>=0;u--)if(n[u]===t||n[u].listener===t){s=n[u].listener,o=u;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,s||t)}return this},u.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var u,s=i(n);for(o=0;o<s.length;++o)"removeListener"!==(u=s[o])&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},u.prototype.listeners=function(e){return b(this,e,!0)},u.prototype.rawListeners=function(e){return b(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_.call(e,t)},u.prototype.listenerCount=_,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],4:[function(e,t,n){"use strict";var r,i,o,u=[e(2),e(7),e(6),e(5),e(8),e(9)],s=-1,a=[],f=!1;function c(){r&&i&&(r=!1,i.length?a=i.concat(a):s=-1,a.length&&l())}function l(){if(!r){f=!1,r=!0;for(var e=a.length,t=setTimeout(c);e;){for(i=a,a=[];i&&++s<e;)i[s].run();s=-1,e=a.length}i=null,s=-1,r=!1,clearTimeout(t)}}for(var d=-1,h=u.length;++d<h;)if(u[d]&&u[d].test&&u[d].test()){o=u[d].install(l);break}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){var e=this.fun,t=this.array;switch(t.length){case 0:return e();case 1:return e(t[0]);case 2:return e(t[0],t[1]);case 3:return e(t[0],t[1],t[2]);default:return e.apply(null,t)}},t.exports=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];a.push(new p(e,t)),f||r||(f=!0,o())}},{2:2,5:5,6:6,7:7,8:8,9:9}],5:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return!e.setImmediate&&void 0!==e.MessageChannel},n.install=function(t){var n=new e.MessageChannel;return n.port1.onmessage=t,function(){n.port2.postMessage(0)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,n){(function(e){(function(){"use strict";var t=e.MutationObserver||e.WebKitMutationObserver;n.test=function(){return t},n.install=function(n){var r=0,i=new t(n),o=e.document.createTextNode("");return i.observe(o,{characterData:!0}),function(){o.data=r=++r%2}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return"function"==typeof e.queueMicrotask},n.install=function(t){return function(){e.queueMicrotask(t)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return"document"in e&&"onreadystatechange"in e.document.createElement("script")},n.install=function(t){return function(){var n=e.document.createElement("script");return n.onreadystatechange=function(){t(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},e.document.documentElement.appendChild(n),t}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,n){"use strict";n.test=function(){return!0},n.install=function(e){return function(){setTimeout(e,0)}}},{}],10:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],11:[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";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<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 r(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 i(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 o(e){var t,i,o,u,s,a,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)n(c,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(c,o),t=0;t<16;t+=1)o[t]=0;return u=(u=8*f).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,n(c,o),c}function u(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}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 f(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 c(){this.reset()}return"5d41402abc4b2a76b9719d911017c592"!==s(o("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)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,u,s,a=this.byteLength,f=t(n,a),c=a;return r!==e&&(c=t(r,a)),f>c?new ArrayBuffer(0):(i=c-f,o=new ArrayBuffer(i),u=new Uint8Array(o),s=new Uint8Array(this,f,i),u.set(s),o)}}(),c.prototype.append=function(e){return this.appendBinary(a(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.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=f(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,i,o,u=t;if(e[u>>2]|=128<<(u%4<<3),u>55)for(n(this._hash,e),u=0;u<16;u+=1)e[u]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(a(e),t)},c.hashBinary=function(e,t){var n=s(o(e));return t?f(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,o,u,s,a=(r=this._buff.buffer,o=e,u=!0,(s=new Uint8Array(r.byteLength+o.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(o),r.byteLength),u?s:s.buffer),f=a.length;for(this._length+=e.byteLength,t=64;t<=f;t+=64)n(this._hash,i(a.subarray(t-64,t)));return this._buff=t-64<f?new Uint8Array(a.buffer.slice(t-64)):new Uint8Array(0),this},c.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=f(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(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}(e.buff,!0),c.prototype.setState.call(this,e)},c.ArrayBuffer.prototype.destroy=c.prototype.destroy,c.ArrayBuffer.prototype._finish=c.prototype._finish,c.ArrayBuffer.hash=function(e,t){var r=s(function(e){var t,r,o,u,s,a,f=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=f;t+=64)n(c,i(e.subarray(t-64,t)));for(r=(e=t-64<f?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(c,o),t=0;t<16;t+=1)o[t]=0;return u=(u=8*f).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,n(c,o),c}(new Uint8Array(e)));return t?f(r):r},c}))},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"v1",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(n,"v3",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"v4",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(n,"v5",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(n,"NIL",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(n,"version",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(n,"parse",{enumerable:!0,get:function(){return l.default}});var r=d(e(20)),i=d(e(21)),o=d(e(23)),u=d(e(24)),s=d(e(14)),a=d(e(26)),f=d(e(25)),c=d(e(19)),l=d(e(15));function d(e){return e&&e.__esModule?e:{default:e}}},{14:14,15:15,19:19,20:20,21:21,23:23,24:24,25:25,26:26}],13:[function(e,t,n){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function i(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,r,o,u){return i((s=i(i(t,e),i(r,u)))<<(a=o)|s>>>32-a,n);var s,a}function u(e,t,n,r,i,u,s){return o(t&n|~t&r,e,t,i,u,s)}function s(e,t,n,r,i,u,s){return o(t&r|n&~r,e,t,i,u,s)}function a(e,t,n,r,i,u,s){return o(t^n^r,e,t,i,u,s)}function f(e,t,n,r,i,u,s){return o(n^(t|~r),e,t,i,u,s)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var c=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let r=0;r<n;r+=8){const n=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;let n=1732584193,o=-271733879,c=-1732584194,l=271733878;for(let t=0;t<e.length;t+=16){const r=n,d=o,h=c,p=l;n=u(n,o,c,l,e[t],7,-680876936),l=u(l,n,o,c,e[t+1],12,-389564586),c=u(c,l,n,o,e[t+2],17,606105819),o=u(o,c,l,n,e[t+3],22,-1044525330),n=u(n,o,c,l,e[t+4],7,-176418897),l=u(l,n,o,c,e[t+5],12,1200080426),c=u(c,l,n,o,e[t+6],17,-1473231341),o=u(o,c,l,n,e[t+7],22,-45705983),n=u(n,o,c,l,e[t+8],7,1770035416),l=u(l,n,o,c,e[t+9],12,-1958414417),c=u(c,l,n,o,e[t+10],17,-42063),o=u(o,c,l,n,e[t+11],22,-1990404162),n=u(n,o,c,l,e[t+12],7,1804603682),l=u(l,n,o,c,e[t+13],12,-40341101),c=u(c,l,n,o,e[t+14],17,-1502002290),o=u(o,c,l,n,e[t+15],22,1236535329),n=s(n,o,c,l,e[t+1],5,-165796510),l=s(l,n,o,c,e[t+6],9,-1069501632),c=s(c,l,n,o,e[t+11],14,643717713),o=s(o,c,l,n,e[t],20,-373897302),n=s(n,o,c,l,e[t+5],5,-701558691),l=s(l,n,o,c,e[t+10],9,38016083),c=s(c,l,n,o,e[t+15],14,-660478335),o=s(o,c,l,n,e[t+4],20,-405537848),n=s(n,o,c,l,e[t+9],5,568446438),l=s(l,n,o,c,e[t+14],9,-1019803690),c=s(c,l,n,o,e[t+3],14,-187363961),o=s(o,c,l,n,e[t+8],20,1163531501),n=s(n,o,c,l,e[t+13],5,-1444681467),l=s(l,n,o,c,e[t+2],9,-51403784),c=s(c,l,n,o,e[t+7],14,1735328473),o=s(o,c,l,n,e[t+12],20,-1926607734),n=a(n,o,c,l,e[t+5],4,-378558),l=a(l,n,o,c,e[t+8],11,-2022574463),c=a(c,l,n,o,e[t+11],16,1839030562),o=a(o,c,l,n,e[t+14],23,-35309556),n=a(n,o,c,l,e[t+1],4,-1530992060),l=a(l,n,o,c,e[t+4],11,1272893353),c=a(c,l,n,o,e[t+7],16,-155497632),o=a(o,c,l,n,e[t+10],23,-1094730640),n=a(n,o,c,l,e[t+13],4,681279174),l=a(l,n,o,c,e[t],11,-358537222),c=a(c,l,n,o,e[t+3],16,-722521979),o=a(o,c,l,n,e[t+6],23,76029189),n=a(n,o,c,l,e[t+9],4,-640364487),l=a(l,n,o,c,e[t+12],11,-421815835),c=a(c,l,n,o,e[t+15],16,530742520),o=a(o,c,l,n,e[t+2],23,-995338651),n=f(n,o,c,l,e[t],6,-198630844),l=f(l,n,o,c,e[t+7],10,1126891415),c=f(c,l,n,o,e[t+14],15,-1416354905),o=f(o,c,l,n,e[t+5],21,-57434055),n=f(n,o,c,l,e[t+12],6,1700485571),l=f(l,n,o,c,e[t+3],10,-1894986606),c=f(c,l,n,o,e[t+10],15,-1051523),o=f(o,c,l,n,e[t+1],21,-2054922799),n=f(n,o,c,l,e[t+8],6,1873313359),l=f(l,n,o,c,e[t+15],10,-30611744),c=f(c,l,n,o,e[t+6],15,-1560198380),o=f(o,c,l,n,e[t+13],21,1309151649),n=f(n,o,c,l,e[t+4],6,-145523070),l=f(l,n,o,c,e[t+11],10,-1120210379),c=f(c,l,n,o,e[t+2],15,718787259),o=f(o,c,l,n,e[t+9],21,-343485551),n=i(n,r),o=i(o,d),c=i(c,h),l=i(l,p)}return[n,o,c,l]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(r(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))};n.default=c},{}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default="00000000-0000-0000-0000-000000000000"},{}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(25))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};n.default=o},{25:25}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],17:[function(e,t,n){"use strict";let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)};const i=new Uint8Array(16)},{}],18:[function(e,t,n){"use strict";function r(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function i(e,t){return e<<t|e>>>32-t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const o=e.length/4+2,u=Math.ceil(o/16),s=new Array(u);for(let t=0;t<u;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[u-1][14]=8*(e.length-1)/Math.pow(2,32),s[u-1][14]=Math.floor(s[u-1][14]),s[u-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<u;++e){const o=new Uint32Array(80);for(let t=0;t<16;++t)o[t]=s[e][t];for(let e=16;e<80;++e)o[e]=i(o[e-3]^o[e-8]^o[e-14]^o[e-16],1);let u=n[0],a=n[1],f=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=i(u,5)+r(n,a,f,c)+l+t[n]+o[e]>>>0;l=c,c=f,f=i(a,30)>>>0,a=u,u=s}n[0]=n[0]+u>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+f>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]};n.default=o},{}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(25))&&r.__esModule?r:{default:r};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).substr(1));var u=function(e,t=0){const n=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!(0,i.default)(n))throw TypeError("Stringified UUID is invalid");return n};n.default=u},{25:25}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(17)),i=o(e(19));function o(e){return e&&e.__esModule?e:{default:e}}let u,s,a=0,f=0;var c=function(e,t,n){let o=t&&n||0;const c=t||new Array(16);let l=(e=e||{}).node||u,d=void 0!==e.clockseq?e.clockseq:s;if(null==l||null==d){const t=e.random||(e.rng||r.default)();null==l&&(l=u=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=s=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:f+1;const y=h-a+(p-f)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||h>a)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,f=p,s=d,h+=122192928e5;const v=(1e4*(268435455&h)+p)%4294967296;c[o++]=v>>>24&255,c[o++]=v>>>16&255,c[o++]=v>>>8&255,c[o++]=255&v;const g=h/4294967296*1e4&268435455;c[o++]=g>>>8&255,c[o++]=255&g,c[o++]=g>>>24&15|16,c[o++]=g>>>16&255,c[o++]=d>>>8|128,c[o++]=255&d;for(let e=0;e<6;++e)c[o+e]=l[e];return t||(0,i.default)(c)};n.default=c},{17:17,19:19}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(22)),i=o(e(13));function o(e){return e&&e.__esModule?e:{default:e}}var u=(0,r.default)("v3",48,i.default);n.default=u},{13:13,22:22}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t,n){function o(e,o,u,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof o&&(o=(0,i.default)(o)),16!==o.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+e.length);if(a.set(o),a.set(e,o.length),a=n(a),a[6]=15&a[6]|t,a[8]=63&a[8]|128,u){s=s||0;for(let e=0;e<16;++e)u[s+e]=a[e];return u}return(0,r.default)(a)}try{o.name=e}catch(e){}return o.DNS=u,o.URL=s,o},n.URL=n.DNS=void 0;var r=o(e(19)),i=o(e(15));function o(e){return e&&e.__esModule?e:{default:e}}const u="6ba7b810-9dad-11d1-80b4-00c04fd430c8";n.DNS=u;const s="6ba7b811-9dad-11d1-80b4-00c04fd430c8";n.URL=s},{15:15,19:19}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(17)),i=o(e(19));function o(e){return e&&e.__esModule?e:{default:e}}var u=function(e,t,n){const o=(e=e||{}).random||(e.rng||r.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return(0,i.default)(o)};n.default=u},{17:17,19:19}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(22)),i=o(e(18));function o(e){return e&&e.__esModule?e:{default:e}}var u=(0,r.default)("v5",80,i.default);n.default=u},{18:18,22:22}],25:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(16))&&r.__esModule?r:{default:r};var o=function(e){return"string"==typeof e&&i.default.test(e)};n.default=o},{16:16}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(25))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};n.default=o},{25:25}],27:[function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(e(4)),o=r(e(3));e(12);var u=r(e(11)),s=r(e(1)),a=r(e(10));function f(e){if(e instanceof ArrayBuffer)return function(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}(e);var t=e.size,n=e.type;return"function"==typeof e.slice?e.slice(0,t,n):e.webkitSlice(0,t,n)}var c,l,d,h=Function.prototype.toString,p=h.call(Object);function y(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n<r;n++)t[n]=y(e[n]);return t}if(e instanceof Date&&isFinite(e))return e.toISOString();if(function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}(e))return f(e);if(!function(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&h.call(n)==p}(e))return e;for(n in t={},e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=y(e[n]);void 0!==i&&(t[n]=i)}return t}function v(e){return s((function(t){t=y(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),i=new Promise((function(r,i){var o,u,a;try{var f=(u=function(e,t){e?i(e):r(t)},a=!1,s((function(e){if(a)throw new Error("once called more than once");a=!0,u.apply(this,e)})));t.push(f),(o=e.apply(n,t))&&"function"==typeof o.then&&r(o)}catch(e){i(e)}}));return r&&i.then((function(e){r(null,e)}),r),i}))}function g(e){return"$"+e}function m(e){return e.substring(1)}function b(){this._store={}}function _(e){if(this._store=new b,e&&Array.isArray(e))for(var t=0,n=e.length;t<n;t++)this.add(e[t])}b.prototype.get=function(e){var t=g(e);return this._store[t]},b.prototype.set=function(e,t){var n=g(e);return this._store[n]=t,!0},b.prototype.has=function(e){return g(e)in this._store},b.prototype.keys=function(){return Object.keys(this._store).map(e=>m(e))},b.prototype.delete=function(e){var t=g(e),n=t in this._store;return delete this._store[t],n},b.prototype.forEach=function(e){for(var t=Object.keys(this._store),n=0,r=t.length;n<r;n++){var i=t[n];e(this._store[i],i=m(i))}},Object.defineProperty(b.prototype,"size",{get:function(){return Object.keys(this._store).length}}),_.prototype.add=function(e){return this._store.set(e,!0)},_.prototype.has=function(e){return this._store.has(e)},_.prototype.forEach=function(e){this._store.forEach((function(t,n){e(n)}))},Object.defineProperty(_.prototype,"size",{get:function(){return this._store.size}}),!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}()?(c=_,l=b):(c=Set,l=Map);try{localStorage.setItem("_pouch_check_localstorage",1),d=!!localStorage.getItem("_pouch_check_localstorage")}catch(e){d=!1}function w(){return d}function k(){o.call(this),this._listeners={},function(e){w()&&addEventListener("storage",(function(t){e.emit(t.key)}))}(this)}function $(e){if("undefined"!=typeof console&&"function"==typeof console[e]){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}a(k,o),k.prototype.addListener=function(e,t,n,r){if(!this._listeners[t]){var o=this,u=!1;this._listeners[t]=s,this.on(e,s)}function s(){if(o._listeners[t])if(u)u="waiting";else{u=!0;var e=function(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}(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);n.changes(e).on("change",(function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))})).on("complete",(function(){"waiting"===u&&i(s),u=!1})).on("error",(function(){u=!1}))}}},k.prototype.removeListener=function(e,t){t in this._listeners&&(o.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},k.prototype.notifyLocalWindows=function(e){w()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},k.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var O="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};function j(e,t,n){Error.call(this,n),this.status=e,this.name=t,this.message=n,this.error=!0}a(j,Error),j.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};new j(401,"unauthorized","Name or password is incorrect."),new j(400,"bad_request","Missing JSON list of 'docs'"),new j(404,"not_found","missing"),new j(409,"conflict","Document update conflict"),new j(400,"bad_request","_id field must contain a string"),new j(412,"missing_id","_id is required for puts"),new j(400,"bad_request","Only reserved document ids may start with underscore."),new j(412,"precondition_failed","Database not open");var x=new j(500,"unknown_error","Database encountered an unknown error");new j(500,"badarg","Some query argument is invalid"),new j(400,"invalid_request","Request was invalid"),new j(400,"query_parse_error","Some query parameter is invalid"),new j(500,"doc_validation","Bad special document member"),new j(400,"bad_request","Something wrong with the request"),new j(400,"bad_request","Document must be a JSON object"),new j(404,"not_found","Database not found"),new j(500,"indexed_db_went_bad","unknown"),new j(500,"web_sql_went_bad","unknown"),new j(500,"levelDB_went_went_bad","unknown"),new j(403,"forbidden","Forbidden by design doc validate_doc_update function"),new j(400,"bad_request","Invalid rev format"),new j(412,"file_exists","The database could not be created, the file already exists."),new j(412,"missing_stub","A pre-existing attachment stub wasn't found"),new j(413,"invalid_url","Provided URL is invalid");function A(e){if("object"!=typeof e){var t=e;(e=x).data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),"stack"in e||(e.stack=(new Error).stack),e}function E(e){for(var t=[],n=0,r=e.length;n<r;n++)t=t.concat(e[n]);return t}function M(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 q(e,t,n){return e.get(t).catch((function(e){if(404!==e.status)throw e;return{}})).then((function(r){var i=r._rev,o=n(r);return o?(o._id=t,o._rev=i,function(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 q(e,t._id,n)}))}(e,o,n)):{updated:!1,rev:i}}))}function S(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 P(e,t){return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}([S(e)],{type:t})}function L(e,t){return P(atob(e),t)}self.setImmediate||self.setTimeout;function C(e){return u.hash(e)}var B=Headers;function I(e){return(e=y(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 U(e,t,n){var r="",i=t,o=!0;if(-1!==["$in","$nin","$or","$and","$mod","$nor","$all"].indexOf(e)&&(Array.isArray(t)||(r="Query operator "+e+" must be an array.")),-1!==["$not","$elemMatch","$allMatch"].indexOf(e)&&(Array.isArray(t)||"object"!=typeof t||null===t)&&(r="Query operator "+e+" must be an object."),"$mod"===e&&Array.isArray(t))if(2!==t.length)r="Query operator $mod must be in the format [divisor, remainder], where divisor and remainder are both integers.";else{var u=t[0],s=t[1];0===u&&(r="Query operator $mod's divisor cannot be 0, cannot divide by zero.",o=!1),"number"==typeof u&&parseInt(u,10)===u||(r="Query operator $mod's divisor is not an integer.",i=u),parseInt(s,10)!==s&&(r="Query operator $mod's remainder is not an integer.",i=s)}if("$exists"===e&&"boolean"!=typeof t&&(r="Query operator $exists must be a boolean."),"$type"===e){var a=["null","boolean","number","string","array","object"],f='"'+a.slice(0,a.length-1).join('", "')+'", or "'+a[a.length-1]+'"';("string"!=typeof t||-1==a.indexOf(t))&&(r="Query operator $type must be a string. Supported values: "+f+".")}if("$size"===e&&parseInt(t,10)!==t&&(r="Query operator $size must be a integer."),"$regex"===e&&"string"!=typeof t&&(console.log("here",n),n?r="Query operator $regex must be a string.":t instanceof RegExp||(r="Query operator $regex must be a string or an instance of a javascript regular expression.")),r){if(o)r+=" Received"+(null===i?" ":Array.isArray(i)?" array":" "+typeof i)+": "+("object"==typeof i&&null!==i?JSON.stringify(i,null,"\t"):i);throw new Error(r)}}var N=["$all","$allMatch","$and","$elemMatch","$exists","$in","$mod","$nin","$nor","$not","$or","$regex","$size","$type"],D=["$in","$nin","$mod","$all"],T=["$eq","$gt","$gte","$lt","$lte"];function F(e,t){if(Array.isArray(e))for(var n of e)"object"==typeof n&&null!==u&&F(n,t);else for(var r=Object.keys(e),i=0;i<r.length;i++){var o=r[i],u=e[o];-1!==N.indexOf(o)&&U(o,u,t),-1===T.indexOf(o)&&(-1===D.indexOf(o)&&"object"==typeof u&&null!==u&&F(u,t))}}function R(e,t,n,r){var i,o;n.headers=new B({"Content-type":"application/json"}),e.fetch(t,n).then((function(e){return i=e.status,o=e.ok,e.json()})).then((function(e){if(o)r(null,e);else{e.status=i;var t=A(e);r(t)}})).catch(r)}function z(e,t,n){t=I(t),R(e,"_index",{method:"POST",body:JSON.stringify(t)},n)}function J(e,t,n){F(t.selector,!0),R(e,"_find",{method:"POST",body:JSON.stringify(t)},n)}function V(e,t,n){R(e,"_explain",{method:"POST",body:JSON.stringify(t)},n)}function Q(e,t){R(e,"_index",{method:"GET"},t)}function K(e,t,n){var r=t.ddoc,i=t.type||"json",o=t.name;return r?o?void R(e,"_index/"+[r,i,o].map(encodeURIComponent).join("/"),{method:"DELETE"},n):n(new Error("you must provide an index's name")):n(new Error("you must provide an index's ddoc"))}function W(e,t){for(var n=e,r=0,i=t.length;r<i;r++){if(!(n=n[t[r]]))break}return n}function X(e,t,n){for(var r=0,i=t.length;r<i-1;r++){var o=t[r];e=e[o]=e[o]||{}}e[t[i-1]]=n}function G(e,t){return e<t?-1:e>t?1:0}function Y(e){for(var t=[],n="",r=0,i=e.length;r<i;r++){var o=e[r];r>0&&"\\"===e[r-1]&&("$"===o||"."===o)?n=n.substring(0,n.length-1)+o:"."===o?(t.push(n),n=""):n+=o}return t.push(n),t}var H=["$or","$nor","$not"];function Z(e){return H.indexOf(e)>-1}function ee(e){return Object.keys(e)[0]}function te(e){return e[ee(e)]}function ne(e){var t={},n={$or:!0,$nor:!0};return e.forEach((function(e){Object.keys(e).forEach((function(r){var i=e[r];if("object"!=typeof i&&(i={$eq:i}),Z(r))if(i instanceof Array){if(n[r])return n[r]=!1,void(t[r]=i);var o=[];t[r].forEach((function(e){Object.keys(i).forEach((function(t){var n=i[t],r=Math.max(Object.keys(e).length,Object.keys(n).length),u=ne([e,n]);Object.keys(u).length<=r||o.push(u)}))})),t[r]=o}else t[r]=ne([i]);else{var u=t[r]=t[r]||{};Object.keys(i).forEach((function(e){var t=i[e];return"$gt"===e||"$gte"===e?function(e,t,n){if(void 0!==n.$eq)return;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}(e,t,u):"$lt"===e||"$lte"===e?function(e,t,n){if(void 0!==n.$eq)return;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}(e,t,u):"$ne"===e?function(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}(t,u):"$eq"===e?function(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}(t,u):"$regex"===e?function(e,t){"$regex"in t?t.$regex.push(e):t.$regex=[e]}(t,u):void(u[e]=t)}))}}))})),t}function re(e){var t=y(e),n=!1;(function e(t,n){for(var r in t){"$and"===r&&(n=!0);var i=t[r];"object"==typeof i&&(n=e(i,n))}return n})(t,!1)&&("$and"in(t=function e(t){for(var n in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=ne(t[r].$and));var i=t[n];"object"==typeof i&&e(i)}return t}(t))&&(t=ne(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=ne([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}:n||("$ne"in u&&(u.$ne=[u.$ne]),"$regex"in u&&(u.$regex=[u.$regex])),t[o]=u}return t}function ie(e,t){if(e===t)return 0;e=oe(e),t=oe(t);var n=ce(e),r=ce(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 function(e,t){return e===t?0:e>t?1:-1}(e,t)}return Array.isArray(e)?function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=ie(e[r],t[r]);if(0!==i)return i}return e.length===t.length?0:e.length>t.length?1:-1}(e,t):function(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=ie(n[o],r[o]);if(0!==u)return u;if(0!==(u=ie(e[n[o]],t[r[o]])))return u}return n.length===r.length?0:n.length>r.length?1:-1}(e,t)}function oe(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]=oe(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e)for(var i in e={},t)if(Object.prototype.hasOwnProperty.call(t,i)){var o=t[i];void 0!==o&&(e[i]=oe(o))}}}return e}function ue(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return function(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=(u=((r?-n:n)- -324).toString(),s="0",a=3,function(e,t,n){for(var r="",i=n-e.length;r.length<i;)r+=t;return r}(u,s,a)+u);var u,s,a;i+=""+o;var f=Math.abs(parseFloat(t[0]));r&&(f=10-f);var c=f.toFixed(20);return c=c.replace(/\.?0+$/,""),i+=""+c}(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+=se(n[r]);else for(;++r<i;){var u=n[r];o+=se(u)+se(e[u])}return o}return""}function se(e){return ce(e=oe(e))+""+ue(e)+"\0"}function ae(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+3),s=parseInt(u,10)+-324;for(i&&(s=-s),t+=3;;){var a=e[t];if("\0"===a)break;o+=a,t++}n=1===(o=o.split(".")).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 fe(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){i[e.pop()]=n}else e.push(n)}}function ce(e){var t=["boolean","number","string","object"].indexOf(typeof e);return~t?null===e?1:Array.isArray(e)?5:t<3?t+2:t+3:Array.isArray(e)?5:void 0}function le(e,t,n){if(e=e.filter((function(e){return de(e.doc,t.selector,n)})),t.sort){var r=function(e){function t(t){return e.map((function(e){var n=Y(ee(e));return W(t,n)}))}return function(e,n){var r=ie(t(e.doc),t(n.doc));return 0!==r?r:G(e.doc._id,n.doc._id)}}(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===te(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 de(e,t,n){return n.every((function(n){var r=t[n],i=Y(n),o=W(e,i);return Z(n)?function(e,t,n){if("$or"===e)return t.some((function(e){return de(n,e,Object.keys(e))}));if("$not"===e)return!de(n,t,Object.keys(t));return!t.find((function(e){return de(n,e,Object.keys(e))}))}(n,r,e):he(r,e,i,o)}))}function he(e,t,n,r){return!e||("object"==typeof e?Object.keys(e).every((function(i){var o=e[i];if(0===i.indexOf("$"))return pe(i,t,o,n,r);var u=Y(i);if(void 0===r&&"object"!=typeof o&&u.length>0)return!1;var s=W(r,u);return"object"==typeof o?he(o,t,n,s):pe("$eq",t,o,u,s)})):e===r)}function pe(e,t,n,r,i){if(!me[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 me[e](t,n,r,i)}function ye(e){return null!=e}function ve(e){return void 0!==e}function ge(e,t){return t.some((function(t){return e instanceof Array?e.some((function(e){return 0===ie(t,e)})):0===ie(t,e)}))}var me={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.some((function(e){return de(e,t,Object.keys(t))})):r.some((function(r){return he(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 de(e,t,Object.keys(t))})):r.every((function(r){return he(t,e,n,r)}))))},$eq:function(e,t,n,r){return ve(r)&&0===ie(r,t)},$gte:function(e,t,n,r){return ve(r)&&ie(r,t)>=0},$gt:function(e,t,n,r){return ve(r)&&ie(r,t)>0},$lte:function(e,t,n,r){return ve(r)&&ie(r,t)<=0},$lt:function(e,t,n,r){return ve(r)&&ie(r,t)<0},$exists:function(e,t,n,r){return t?ve(r):!ve(r)},$mod:function(e,t,n,r){return ye(r)&&function(e,t){return"number"==typeof e&&parseInt(e,10)===e&&e%t[0]===t[1]}(r,t)},$ne:function(e,t,n,r){return t.every((function(e){return 0!==ie(r,e)}))},$in:function(e,t,n,r){return ye(r)&&ge(r,t)},$nin:function(e,t,n,r){return ye(r)&&!ge(r,t)},$size:function(e,t,n,r){return ye(r)&&Array.isArray(r)&&function(e,t){return e.length===t}(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&function(e,t){return t.every((function(t){return e.some((function(e){return 0===ie(t,e)}))}))}(r,t)},$regex:function(e,t,n,r){return ye(r)&&"string"==typeof r&&t.every((function(e){return function(e,t){return new RegExp(t).test(e)}(r,e)}))},$type:function(e,t,n,r){return function(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)}}(r,t)}};function be(e,t){if("object"!=typeof t)throw new Error("Selector error: expected a JSON object");var n=le([{doc:e}],{selector:t=re(t)},Object.keys(t));return n&&1===n.length}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 we(e){return _e((function(t){var n=t.pop(),r=e.apply(this,t);return function(e,t){e.then((function(e){i((function(){t(null,e)}))}),(function(e){i((function(){t(e)}))}))}(r,n),r}))}var ke=_e((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];Array.isArray(i)?t=t.concat(ke.apply(null,i)):t.push(i)}return t}));function $e(e){for(var t={},n=0,r=e.length;n<r;n++)t=O(t,e[n]);return t}function Oe(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){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 xe(){this.promise=new Promise((function(e){e()}))}function Ae(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}function Ee(e,t,n,r,i,o){var u,s=function(e,t){return Ae(e)+Ae(t)+"undefined"}(n,r);if(!i&&(u=e._cachedViews=e._cachedViews||{})[s])return u[s];var a=e.info().then((function(a){var f=a.db_name+"-mrview-"+(i?"temp":C(s));return q(e,"_local/"+o,(function(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})).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 Me(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Me)}catch(e){}}function qe(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,qe)}catch(e){}}function Se(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Se)}catch(e){}}function Pe(e,t){return t&&e.then((function(e){i((function(){t(null,e)}))}),(function(e){i((function(){t(e)}))})),e}function Le(e,t){return function(){var n=arguments,r=this;return e.add((function(){return t.apply(r,n)}))}}function Ce(e){var t=new c(e),n=new Array(t.size),r=-1;return t.forEach((function(e){n[++r]=e})),n}function Be(e){var t=new Array(e.size),n=-1;return e.forEach((function(e,r){t[++n]=r})),t}xe.prototype.add=function(e){return this.promise=this.promise.catch((function(){})).then((function(){return e()})),this.promise},xe.prototype.finish=function(){return this.promise},a(Me,Error),a(qe,Error),a(Se,Error);var Ie={},Ue=new xe;function Ne(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function De(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 Te(e,t,n){var r=function(e){for(var t=0,n=e.length;t<n;t++){if(-1!==e[t].indexOf("."))return!1}return!0}(e),i=1===e.length;return r?i?function(e,t,n){return function(r){n&&!be(r,n)||t(r[e])}}(e[0],t,n):function(e,t,n){return function(r){if(!n||be(r,n)){for(var i=[],o=0,u=e.length;o<u;o++)i.push(r[e[o]]);t(i)}}}(e,t,n):i?function(e,t,n){var r=Y(e);return function(e){if(!n||be(e,n)){for(var i=e,o=0,u=r.length;o<u;o++){if(void 0===(i=i[r[o]]))return}t(i)}}}(e[0],t,n):function(e,t,n){return function(r){if(!n||be(r,n)){for(var i=[],o=0,u=e.length;o<u;o++){for(var s=Y(e[o]),a=r,f=0,c=s.length;f<c;f++){if(void 0===(a=a[s[f]]))return}i.push(a)}t(i)}}}(e,t,n)}var Fe=function(e,t,n,r){function o(e,t,n){try{t(n)}catch(t){De(e,t)}}function u(e,t,n,r,i){try{return{output:t(n,r,i)}}catch(t){return De(e,t),{error:t}}}function a(e,t){var n=ie(e.key,t.key);return 0!==n?n:ie(e.value,t.value)}function f(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function d(e){var t=e.value;return t&&"object"==typeof t&&t._id||e.id}function h(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&function(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=L(n.data,n.content_type)}))}))}(t),t}}function p(e,t,n,r){var i=t[e];void 0!==i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function y(e){if(void 0!==e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function v(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&ie(e[n],e[r])>0)throw new Me("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 Me("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Me("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach((function(t){var n=function(e){if(e){if("number"!=typeof e)return new Me('Invalid value for integer: "'+e+'"');if(e<0)return new Me('Invalid value for positive integer: "'+e+'"')}}(e[t]);if(n)throw n}))}function g(e){return function(t){if(404===t.status)return e;throw t}}function m(e,t,n){var r="_local/doc_"+e,i={_id:r,keys:[]},o=n.get(e),u=o[0];return(function(e){return 1===e.length&&/^1-/.test(e[0].rev)}(o[1])?Promise.resolve(i):t.db.get(r).catch(g(i))).then((function(e){return function(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Promise.resolve({rows:[]})}(e).then((function(t){return function(e,t){for(var n=[],r=new c,i=0,o=t.rows.length;i<o;i++){var s=t.rows[i].doc;if(s&&(n.push(s),r.add(s._id),s._deleted=!u.has(s._id),!s._deleted)){var a=u.get(s._id);"value"in a&&(s.value=a.value)}}var f=Be(u);return f.forEach((function(e){if(!r.has(e)){var t={_id:e},i=u.get(e);"value"in i&&(t.value=i.value),n.push(t)}})),e.keys=Ce(f.concat(e.keys)),n.push(e),n}(e,t)}))}))}function b(e){var t="string"==typeof e?e:e.name,n=Ie[t];return n||(n=Ie[t]=new xe),n}function _(e,n){return Le(b(e),(function(){return function(e,n){var r,i;var u=t(e.mapFun,(function(e,t){var n={id:i._id,key:oe(e)};null!=t&&(n.value=oe(t)),r.push(n)})),s=e.seq||0;function f(t,n){return function(){return function(e,t,n){return e.db.get("_local/lastSeq").catch(g({_id:"_local/lastSeq",seq:0})).then((function(r){var i=Be(t);return Promise.all(i.map((function(n){return m(n,e,t)}))).then((function(t){var i=E(t);return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})}))}))}(e,t,n)}}let c=0,d={view:e.name,indexed_docs:c};e.sourceDB.emit("indexing",d);var h=new xe;function p(){return e.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:s,limit:n.changes_batch_size}).then(y)}function y(t){var d=t.results;if(!d.length)return;var y=function(t){for(var n=new l,f=0,c=t.length;f<c;f++){var d=t[f];if("_"!==d.doc._id[0]){r=[],(i=d.doc)._deleted||o(e.sourceDB,u,i),r.sort(a);var h=v(r);n.set(d.doc._id,[h,d.changes])}s=d.seq}return n}(d);h.add(f(y,s)),c+=d.length;let g={view:e.name,last_seq:t.last_seq,results_count:d.length,indexed_docs:c};return e.sourceDB.emit("indexing",g),d.length<n.changes_batch_size?void 0:p()}function v(e){for(var t,n=new l,r=0,i=e.length;r<i;r++){var o=e[r],u=[o.key,o.id];r>0&&0===ie(o.key,t)&&u.push(r),n.set(se(u),o),t=o.key}return n}return p().then((function(){return h.finish()})).then((function(){e.seq=s}))}(e,n)}))()}function w(e,t){return Le(b(e),(function(){return function(e,t){var r,i=e.reduceFun&&!1!==t.reduce,o=t.skip||0;void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys);function s(t){return t.include_docs=!0,e.db.allDocs(t).then((function(e){return r=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=function(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=ae(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 f={element:{},index:t.length};t.push(f.element),n.push(f);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}else{if(1===t.length)return t.pop();fe(t,n)}}}(e.doc._id);return{key:r[0],id:r[1],value:"value"in e.doc?e.doc.value:null}}))}))}function a(s){var a;if(a=i?function(e,t,r){0===r.group_level&&delete r.group_level;var i=r.group||r.group_level,o=n(e.reduceFun),s=[],a=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;t.forEach((function(e){var t=s[s.length-1],n=i?e.key:null;if(i&&Array.isArray(n)&&(n=n.slice(0,a)),t&&0===ie(t.groupKey,n))return t.keys.push([e.key,e.id]),void t.values.push(e.value);s.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})})),t=[];for(var c=0,l=s.length;c<l;c++){var d=s[c],h=u(e.sourceDB,o,d.keys,d.values,!1);if(h.error&&h.error instanceof Se)throw h.error;t.push({value:h.error?null:h.output,key:d.groupKey})}return{rows:f(t,r.limit,r.skip)}}(e,s,t):void 0===t.keys?{total_rows:r,offset:o,rows:s}:{total_rows:r,offset:o,rows:f(s,t.limit,t.skip)},t.update_seq&&(a.update_seq=e.seq),t.include_docs){var c=Ce(s.map(d));return e.sourceDB.allDocs({keys:c,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then((function(e){var t=new l;return e.rows.forEach((function(e){t.set(e.id,e.doc)})),s.forEach((function(e){var n=d(e),r=t.get(n);r&&(e.doc=r)})),a}))}return a}if(void 0!==t.keys){var c=t.keys.map((function(e){var n={startkey:se([e]),endkey:se([e,{}])};return t.update_seq&&(n.update_seq=!0),s(n)}));return Promise.all(c).then(E).then(a)}var h,p,y={descending:t.descending};if(t.update_seq&&(y.update_seq=!0),"start_key"in t&&(h=t.start_key),"startkey"in t&&(h=t.startkey),"end_key"in t&&(p=t.end_key),"endkey"in t&&(p=t.endkey),void 0!==h&&(y.startkey=t.descending?se([h,{}]):se([h])),void 0!==p){var v=!1!==t.inclusive_end;t.descending&&(v=!v),y.endkey=se(v?[p,{}]:[p])}if(void 0!==t.key){var g=se([t.key]),m=se([t.key,{}]);y.descending?(y.endkey=g,y.startkey=m):(y.startkey=g,y.endkey=m)}return i||("number"==typeof t.limit&&(y.limit=t.limit),y.skip=o),s(y).then(a)}(e,t)}))()}function k(t,n,o){if("function"==typeof t._query)return function(e,t,n){return new Promise((function(r,i){e._query(t,n,(function(e,t){if(e)return i(e);r(t)}))}))}(t,n,o);if(M(t))return function(e,t,n){var r,i,o,u=[],s="GET";if(p("reduce",n,u),p("include_docs",n,u),p("attachments",n,u),p("limit",n,u),p("descending",n,u),p("group",n,u),p("group_level",n,u),p("skip",n,u),p("stale",n,u),p("conflicts",n,u),p("startkey",n,u,!0),p("start_key",n,u,!0),p("endkey",n,u,!0),p("end_key",n,u,!0),p("inclusive_end",n,u),p("key",n,u,!0),p("update_seq",n,u),u=""===(u=u.join("&"))?"":"?"+u,void 0!==n.keys){var a="keys="+encodeURIComponent(JSON.stringify(n.keys));a.length+u.length+1<=2e3?u+=("?"===u[0]?"&":"?")+a:(s="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var f=Ne(t);return e.fetch("_design/"+f[0]+"/_view/"+f[1]+u,{headers:new B({"Content-Type":"application/json"}),method:s,body:JSON.stringify(r)}).then((function(e){return i=e.ok,o=e.status,e.json()})).then((function(e){if(!i)throw e.status=o,A(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(h(n))}return r=r||{},Object.keys(t).forEach((function(e){Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString()})),e.fetch("_temp_view"+u,{headers:new B({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(r)}).then((function(e){return i=e.ok,o=e.status,e.json()})).then((function(e){if(!i)throw e.status=o,A(e);return e})).then(h(n))}(t,n,o);var u={changes_batch_size:t.__opts.view_update_changes_batch_size||50};if("string"!=typeof n)return v(o,n),Ue.add((function(){return Ee(t,"temp_view/temp_view",n.map,n.reduce,!0,e).then((function(e){return t=_(e,u).then((function(){return w(e,o)})),n=function(){return e.db.destroy()},t.then((function(e){return n().then((function(){return e}))}),(function(e){return n().then((function(){throw e}))}));var t,n}))})),Ue.finish();var s=n,a=Ne(s),f=a[0],c=a[1];return t.get("_design/"+f).then((function(n){var a=n.views&&n.views[c];if(!a)throw new qe("ddoc "+n._id+" has no view named "+c);return r(n,c),v(o,a),Ee(t,s,a.map,a.reduce,!1,e).then((function(e){return"ok"===o.stale||"update_after"===o.stale?("update_after"===o.stale&&i((function(){_(e,u)})),w(e,o)):_(e,u).then((function(){return w(e,o)}))}))}))}var $;return{query:function(e,t,n){var r=this;"function"==typeof t&&(n=t,t={}),t=t?function(e){return e.group_level=y(e.group_level),e.limit=y(e.limit),e.skip=y(e.skip),e}(t):{},"function"==typeof e&&(e={map:e});var i=Promise.resolve().then((function(){return k(r,e,t)}));return Pe(i,n),i},viewCleanup:($=function(){var t=this;return"function"==typeof t._viewCleanup?function(e){return new Promise((function(t,n){e._viewCleanup((function(e,r){if(e)return n(e);t(r)}))}))}(t):M(t)?function(e){return e.fetch("_view_cleanup",{headers:new B({"Content-Type":"application/json"}),method:"POST"}).then((function(e){return e.json()}))}(t):function(t){return t.get("_local/"+e).then((function(e){var n=new l;Object.keys(e.views).forEach((function(e){var t=Ne(e),r="_design/"+t[0],i=t[1],o=n.get(r);o||(o=new c,n.set(r,o)),o.add(i)}));var r={keys:Be(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]})).map((function(e){return Le(b(e),(function(){return new t.constructor(e,t.__opts).destroy()}))()}));return Promise.all(o).then((function(){return{ok:!0}}))}))}),g({ok:!0}))}(t)},s((function(e){var t=e.pop(),n=$.apply(this,e);return"function"==typeof t&&Pe(n,t),n})))}}("indexes",(function(e,t){return Te(Object.keys(e.fields),t,e.partial_filter_selector)}),(function(){throw new Error("reduce not supported")}),(function(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 Re(e){return e._customFindAbstractMapper||Fe}function ze(e){return e.fields=e.fields.map((function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e})),e}function Je(e,t){for(var n=[],r=0;r<t.def.fields.length;r++){var i=ee(t.def.fields[r]);n.push(e[i])}return n}function Ve(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=ke(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:ze(n.options.def)}}))}))),t.indexes.sort((function(e,t){return G(e.name,t.name)})),t.total_rows=t.indexes.length,t}))}var Qe={"￿":{}};const Ke={queryOpts:{limit:0,startkey:Qe,endkey:null},inMemoryFields:[]};function We(e,t){for(var n=e.def.fields.map(ee),r=0,i=n.length;r<i;r++){if(t===n[r])return!0}return!1}function Xe(e,t){return"$eq"!==ee(e[t])}function Ge(e,t){var n=t.def.fields.map(ee);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),G(r,i)}))}function Ye(e,t,n,r){var i=ke(e,function(e,t,n){for(var r=!1,i=0,o=(n=Ge(n,e)).length;i<o;i++){var u=n[i];if(r||!We(e,u))return n.slice(i);i<o-1&&Xe(t,u)&&(r=!0)}return[]}(t,n,r),function(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}(n));return Ge(function(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)}))}(i),t)}function He(e,t,n){if(t){var r=(u=e,!((o=t).length>u.length)&&Oe(o,u)),i=Oe(n,e);return r&&i}var o,u;return function(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}(n,e)}var Ze=["$eq","$gt","$gte","$lt","$lte"];function et(e){return-1===Ze.indexOf(e)}function tt(e,t,n,r){var i=e.def.fields.map(ee);return!!He(i,t,n)&&function(e,t){var n=t[e[0]];return void 0===n||!(1===Object.keys(n).length&&"$ne"===ee(n))}(i,r)}function nt(e,t,n,r,i){var o=function(e,t,n,r){return r.filter((function(r){return tt(r,n,t,e)}))}(e,t,n,r);if(0===o.length){if(i)throw{error:"no_usable_index",message:"There is no index available for this selector."};var u=r[0];return u.defaultUsed=!0,u}if(1===o.length&&!i)return o[0];var s=function(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}(t);if(i){var a="_design/"+i[0],f=2===i.length&&i[1],c=o.find((function(e){return!(!f||e.ddoc!==a||f!==e.name)||e.ddoc===a}));if(!c)throw{error:"unknown_error",message:"Could not find that index or could not use that index for the query"};return c}return function(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}(o,(function(e){for(var t=e.def.fields.map(ee),n=0,r=0,i=t.length;r<i;r++){var o=t[r];s[o]&&n++}return n}))}function rt(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 it(e,t){return t.defaultUsed?function(e){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(e)]}}(e):1===t.def.fields.length?function(e,t){var n,r=ee(t.def.fields[0]),i=e[r]||{},o=[];return Object.keys(i).forEach((function(e){et(e)&&o.push(r);var t=function(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}}return{startkey:null}}(e,i[e]);n=n?$e([n,t]):t})),{queryOpts:n,inMemoryFields:o}}(e,t):function(e,t){var n,r,i=t.def.fields.map(ee),o=[],u=[],s=[];function a(e){!1!==n&&u.push(null),!1!==r&&s.push(Qe),o=i.slice(e)}for(var f=0,c=i.length;f<c;f++){var l=e[i[f]];if(!l||!Object.keys(l).length){a(f);break}if(Object.keys(l).some(et)){a(f);break}if(f>0){var d="$gt"in l||"$gte"in l||"$lt"in l||"$lte"in l,h=Object.keys(e[i[f-1]]),p=je(h,["$eq"]),y=je(h,Object.keys(l));if(d&&!p&&!y){a(f);break}}for(var v=Object.keys(l),g=null,m=0;m<v.length;m++){var b=v[m],_=rt(b,l[b]);g=g?$e([g,_]):_}u.push("startkey"in g?g.startkey:null),s.push("endkey"in g?g.endkey:Qe),"inclusive_start"in g&&(n=g.inclusive_start),"inclusive_end"in g&&(r=g.inclusive_end)}var w={startkey:u,endkey:s};return void 0!==n&&(w.inclusive_start=n),void 0!==r&&(w.inclusive_end=r),{queryOpts:w,inMemoryFields:o}}(e,t)}function ot(e,t){var n=e.selector,r=e.sort;if(function(e){return Object.keys(e).map((function(t){return e[t]})).some((function(e){return"object"==typeof e&&0===Object.keys(e).length}))}(n))return O({},Ke,{index:t[0]});var i=function(e,t){var n,r=Object.keys(e),i=t?t.map(ee):[];return n=r.length>=i.length?r:i,0===i.length?{fields:n}:{fields: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})),sortOrder:t.map(ee)}}(n,r),o=i.fields,u=nt(n,o,i.sortOrder,t,e.use_index),s=it(n,u);return{queryOpts:s.queryOpts,index:u,inMemoryFields:Ye(s.inMemoryFields,u,n,o)}}function ut(e,t,n){var r,i;return t.selector&&(F(t.selector,!1),t.selector=re(t.selector)),t.sort&&(t.sort=function(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}))}(t.sort)),t.use_index&&(t.use_index=(r=t.use_index,i=[],"string"==typeof r?i.push(r):i=r,i.map((function(e){return e.replace("_design/","")})))),function(e){if("object"!=typeof e.selector)throw new Error("you must provide a selector when you find()")}(t),Ve(e).then((function(r){e.constructor.emit("debug",["find","planning query",t]);var i=ot(t,r.indexes);e.constructor.emit("debug",["find","query plan",i]);var o=i.index;!function(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}(t,o);var u=O({include_docs:!0,reduce:!1,indexes_count:r.total_rows},i.queryOpts);return"startkey"in u&&"endkey"in u&&ie(u.startkey,u.endkey)>0?{docs:[]}:(t.sort&&"string"!=typeof t.sort[0]&&"desc"===te(t.sort[0])&&(u.descending=!0,u=function(e){var t=y(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}(u)),i.inMemoryFields.length||("limit"in t&&(u.limit=t.limit),"skip"in t&&(u.skip=t.skip)),n?Promise.resolve(i,u):Promise.resolve().then((function(){if("_all_docs"===o.name)return function(e,t){var n=y(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),n.limit>0&&n.indexes_count&&(n.original_limit=n.limit,n.limit+=n.indexes_count),e.allDocs(n).then((function(e){return e.rows=e.rows.filter((function(e){return!/^_design\//.test(e.id)})),n.original_limit&&(n.limit=n.original_limit),e.rows=e.rows.slice(0,n.limit),e}))}(e,u);var t,n=(t=o).ddoc.substring(8)+"/"+t.name;return Re(e).query.call(e,n,u)})).then((function(e){!1===u.inclusive_start&&(e.rows=function(e,t,n){for(var r=n.def.fields,i=0,o=e.length;i<o;i++){var u=Je(e[i].doc,n);if(1===r.length)u=u[0];else for(;u.length>t.length;)u.pop();if(Math.abs(ie(u,t))>0)break}return i>0?e.slice(i):e}(e.rows,u.startkey,o)),i.inMemoryFields.length&&(e.rows=le(e.rows,t,i.inMemoryFields));var n={docs:e.rows.map((function(e){var n=e.doc;return t.fields?function(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=Y(t[r]),u=W(e,o);void 0!==u&&X(n,o,u)}return n}(n,t.fields):n}))};return o.defaultUsed&&(n.warning="No matching index found, create an index to optimize query time."),n})))}))}var st=we((function(e,t){var n,r=y((t=I(t)).index);function i(){return n||(n=C(JSON.stringify(t)))}t.index=ze(t.index),function(e){var t=e.fields.filter((function(e){return"asc"===te(e)}));if(0!==t.length&&t.length!==e.fields.length)throw new Error("unsupported mixed sorting")}(t.index);var o=t.name||"idx-"+i(),u=t.ddoc||"idx-"+i(),s="_design/"+u,a=!1,f=!1;return e.constructor.emit("debug",["find","creating index",s]),q(e,s,(function(e){return e._rev&&"query"!==e.language&&(a=!0),e.language="query",e.views=e.views||{},!(f=!!e.views[o])&&(e.views[o]={map:{fields:$e(t.index.fields)},reduce:"_count",options:{def:r}},e)})).then((function(){if(a)throw new Error('invalid language for ddoc with id "'+s+'" (should be "query")')})).then((function(){var t=u+"/"+o;return Re(e).query.call(e,t,{limit:0,reduce:!1}).then((function(){return{id:s,name:o,result:f?"exists":"created"}}))}))})),at=we(ut),ft=we((function(e,t){return ut(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}}))})),ct=we(Ve),lt=we((function(e,t){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 n=t.ddoc,r=t.name;return q(e,n,(function(e){return 1===Object.keys(e.views).length&&e.views[r]?{_id:n,_deleted:!0}:(delete e.views[r],e)})).then((function(){return Re(e).viewCleanup.apply(e)})).then((function(){return{ok:!0}}))})),dt={};dt.createIndex=v((function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to create"));(M(this)?z:st)(this,e,t)})),dt.find=v((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()"));(M(this)?J:at)(this,e,t)})),dt.explain=v((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()"));(M(this)?V:ft)(this,e,t)})),dt.getIndexes=v((function(e){(M(this)?Q:ct)(this,e)})),dt.deleteIndex=v((function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to delete"));(M(this)?K:lt)(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(dt)},{1:1,10:10,11:11,12:12,3:3,4:4}]},{},[27]);