text: //    PouchDB localStorage plugin 3.1.0
  //    Based on localstorage-down: https://github.com/No9/localstorage-down
  //    
  //    (c) 2012-2014 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
  require=function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){(function(n,r){"use strict";function o(e,t){function h(){M.docStore=D.sublevel(g,{valueEncoding:L}),M.bySeqStore=D.sublevel(y,{valueEncoding:"json"}),M.attachmentStore=D.sublevel(b,{valueEncoding:"json"}),M.binaryStore=D.sublevel(v,{valueEncoding:"binary"}),M.localStore=D.sublevel(m,{valueEncoding:"json"}),M.metaStore=D.sublevel(w,{valueEncoding:"json"}),f.localAndMetaStores(D,M,function(){M.metaStore.get(k,function(e,r){"undefined"==typeof D._updateSeq&&(D._updateSeq=r||0),M.metaStore.get(S,function(e,r){D._docCountQueue.docCount=e?0:r,O(function(e){e&&U.emit("error",e),M.metaStore.get(x,function(e,r){R=e?d.uuid():r,M.metaStore.put(x,R,function(){n.nextTick(function(){t(null,U)})})})})})})})}function O(e){return D._docCountQueue.running||!D._docCountQueue.queue.length||-1===D._docCountQueue.docCount?I(0,e):D._docCountQueue.docCount}function N(){if(!D._docCountQueue.running&&D._docCountQueue.queue.length&&-1!==D._docCountQueue.docCount){D._docCountQueue.running=!0;var e=D._docCountQueue.queue.shift();return D.isClosed()?e.callback(new Error("database is closed")):void M.metaStore.get(S,function(t,n){function r(t){D._docCountQueue.docCount=n,e.callback(t,n),D._docCountQueue.running=!1,N()}n=t?0:n,0===e.delta?r():M.metaStore.put(S,n+e.delta,r)})}}function I(e,t){D._docCountQueue.queue.push({delta:e,callback:t}),N()}function B(e){return d.getArguments(function(t){var r=t[t.length-1];t[t.length-1]=d.getArguments(function(e){r.apply(null,e),n.nextTick(function(){D._writeQueue.shift(),D._writeQueue.length&&D._writeQueue.peekFront()()})}),D._writeQueue.push(function(){e.apply(null,t)}),1===D._writeQueue.length&&D._writeQueue.peekFront()()})}function A(e){return("0000000000000000"+e).slice(-16)}function T(e){return parseInt(e,10)}function C(e,t){var n=e.data;if(n._id=e.metadata.id,"_rev"in n){if(n._rev!==e.metadata.rev)return t(new Error("wrong doc returned"))}else n._rev=e.metadata.rev;t(null,{doc:n,metadata:e.metadata})}e=d.clone(e);var R,D,U=this,M={},P=e.name;"undefined"==typeof e.createIfMissing&&(e.createIfMissing=!0);var q=e.db||s;"function"!=typeof q.destroy&&(q.destroy=function(e,t){t()});var W;E.has(q.name)?W=E.get(q.name):(W=new d.Map,E.set(q.name,W)),W.has(P)?(D=W.get(P),h()):W.set(P,a(i(P,e,function(n){return n?(W["delete"](P),t(n)):(D=W.get(P),D._docCountQueue={queue:[],running:!1,docCount:-1},D._writeQueue=new p,void(e.db||e.noMigrate?h():f.toSublevel(P,D,h)))}))),U.type=function(){return"leveldb"},U._id=function(e){e(null,R)},U._info=function(e){O(function(t,n){return t?e(t):void M.metaStore.get(k,function(t,r){return t&&(r=D._updateSeq),e(null,{doc_count:n,update_seq:r})})})},U._get=function(e,t,n){function r(e){o.push(e)}t=d.clone(t);var o=[];D.on("pouchdb-id-"+e,r),M.docStore.get(e,function(i,s){function a(e){u=e}if(D.removeListener("pouchdb-id-"+e,r),i||!s)return n(c.MISSING_DOC);if(d.isDeleted(s)&&!t.rev)return n(c.error(c.MISSING_DOC,"deleted"));var u,f=l.winningRev(s);f=t.rev?t.rev:f;var h=s.rev_map[f],p=o.filter(function(e){return e.metadata.seq===h});return p.length?C(p.pop(),n):(D.on("pouchdb-"+h,a),void M.bySeqStore.get(A(h),function(e,t){if(D.removeListener("pouchdb-"+h,a),u)return C(u,n);if(!t)return n(c.MISSING_DOC);if("_id"in t&&t._id!==s.id)return n(new Error("wrong doc returned"));if(t._id=s.id,"_rev"in t){if(t._rev!==f)return n(new Error("wrong doc returned"))}else t._rev=f;return n(null,{doc:t,metadata:s})}))})},U._getAttachment=function(e,t,o){var i=e.digest;M.binaryStore.get(i,function(i,s){var a;return i&&"NotFoundError"===i.name?(a=t.encode?"":n.browser?d.createBlob([""],{type:e.content_type}):new r(""),o(null,a)):i?o(i):(a=n.browser?t.encode?d.btoa(s):d.createBlob([d.fixBinary(s)],{type:e.content_type}):t.encode?d.btoa(s):s,void o(null,a))})},U._bulkDocs=B(function(e,t,r){function i(e,t){M.attachmentStore.get(e,function(n){if(n){var r=new Error("unknown stub attachment with digest "+e);r.status=412,t(r)}else t()})}function s(e){function t(){++o===n.length&&e(r)}var n=[];if(E.forEach(function(e){e&&e._attachments&&Object.keys(e._attachments).forEach(function(t){var r=e._attachments[t];r.stub&&n.push(r.digest)})}),!n.length)return e();var r,o=0;n.forEach(function(e){i(e,function(e){e&&!r&&(r=e),t()})})}function a(){var e=x;if(!(N>_)){if(e>=S.length)return 0===N?y():void 0;var t=S[e];if(x++,N++,t._id&&d.isLocalId(t._id))return void U[t._deleted?"_removeLocalNoLock":"_putLocalNoLock"](t,function(t){m[e]=t?t:{},N--,a()});if(w.has(t.metadata.id))return m[e]=b(c.REV_CONFLICT,"somebody else is accessing this"),N--,a();w.add(t.metadata.id),M.docStore.get(t.metadata.id,function(n,r){n?"NotFoundError"===n.name?u(t,e,function(){w["delete"](t.metadata.id),N--,a()}):(n.error=!0,m[e]=n,w["delete"](t.metadata.id),N--,a()):f(r,t,e,function(){w["delete"](t.metadata.id),N--,a()})}),v&&a()}}function u(e,n,r){return"was_delete"in t&&d.isDeleted(e.metadata)?(m[n]=b(c.MISSING_DOC,e._bulk_seq),r()):void h(e,n,function(t){return t?r(t):d.isDeleted(e.metadata)?r():void I(1,r)})}function f(e,t,n,r){if(d.revExists(e,t.metadata.rev))return m[n]=t,void r();var o=l.merge(e.rev_tree,t.metadata.rev_tree[0],1e3),i=d.isDeleted(e),s=d.isDeleted(t.metadata),a=i&&s&&v||!i&&v&&"new_leaf"!==o.conflicts||i&&!s&&"new_branch"===o.conflicts;if(a)return m[n]=b(c.REV_CONFLICT,t._bulk_seq),r();var u=t.metadata.rev;t.metadata.rev_tree=o.tree,t.metadata.rev_map=e.rev_map;var f=0;(v||l.winningRev(t.metadata)===u)&&(f=i===s?0:s>i?-1:1),I(f,function(e){return e?r(e):void h(t,n,r)})}function h(e,t,o){function i(e){f||(e?(f=e,o(f)):h===y.length&&l())}function s(e){h++,i(e)}function a(e,t,n,r){return function(o){g(e,j+o,t,n,r)}}function u(e,t,n){return function(r){d.MD5(r).then(a(e,t,r,n))}}function l(){var n=e.metadata.rev_map[e.metadata.rev];n||(n=++D._updateSeq),e.metadata.rev_map[e.metadata.rev]=e.metadata.seq=n;var r=A(n);D.emit("pouchdb-id-"+e.metadata.id,e),D.emit("pouchdb-"+r,e),D.batch([{key:r,value:e.data,prefix:M.bySeqStore,type:"put",valueEncoding:"json"},{key:e.metadata.id,value:e.metadata,prefix:M.docStore,type:"put",valueEncoding:L}],function(n){return n||(D.emit("pouchdb-id-"+e.metadata.id,e),D.emit("pouchdb-"+r,e)),M.metaStore.put(k,D._updateSeq,function(n){return m[t]=n?n:e,o()})})}var f=null,h=0;e.data._id=e.metadata.id,e.data._rev=e.metadata.rev,d.isDeleted(e.metadata)&&(e.data._deleted=!0);for(var y=e.data._attachments?Object.keys(e.data._attachments):[],b=0;b<y.length;b++){var v=y[b],w=e.data._attachments[v];if(w.stub){var _=e.data._id,E=e.data._rev;p(_,E,w.digest,s)}else{var S;if("string"==typeof w.data)try{S=d.atob(w.data)}catch(x){return void r(d.extend({},c.BAD_ARG,{reason:"Attachments need to be base64 encoded"}))}else{if(n.browser){d.readAsBinaryString(w.data,u(e,v,s));continue}S=w.data}d.MD5(S).then(a(e,v,S,s))}}y.length||l()}function p(e,t,n,r){M.attachmentStore.get(n,function(o,i){var s=!1;if(o){if("NotFoundError"!==o.name)return r(o);s=!0}var a=[e,t].join("@"),u={};i?i.refs&&(u.refs=i.refs,u.refs[a]=!0):(u.refs={},u.refs[a]=!0),M.attachmentStore.put(n,u,function(e){return e?r(e):void r(null,s)})})}function g(e,t,n,r,o){var i=e.data._attachments[n];delete i.data,i.digest=t,i.length=r.length;var s=e.metadata.id,a=e.metadata.rev;p(s,a,t,function(e,n){return e?o(e):0===r.length?o(e):n?void M.binaryStore.put(t,r,function(e){o(e)}):o(e)})}function y(){m.sort(function(e,t){return e._bulk_seq-t._bulk_seq});var e=m.map(function(e){if(e._bulk_seq)delete e._bulk_seq;else if(!Object.keys(e).length)return{ok:!0};if(e.error)return e;var t=e.metadata,n=l.winningRev(t);return{ok:!0,id:t.id,rev:n}});o.Changes.notify(P),n.nextTick(function(){r(null,e)})}function b(e,t){return e._bulk_seq=t,e}var v=t.new_edits,m=new Array(e.docs.length),w=new d.Set,E=e.docs,S=E.map(function(e,t){if(e._id&&d.isLocalId(e._id))return e;var n=d.parseDoc(e,v);return n._bulk_seq=t,n.metadata&&!n.metadata.rev_map&&(n.metadata.rev_map={}),n}),x=0,O=S.filter(function(e){return e.error});if(O.length)return r(O[0]);var N=0;s(function(e){return e?r(e):void a()})}),U._allDocs=function(e,t){e=d.clone(e),O(function(n,r){if(n)return t(n);var o={},i=e.skip||0;if(e.startkey&&(o.start=e.startkey),e.endkey&&(o.end=e.endkey),e.key&&(o.start=o.end=e.key),e.descending){o.reverse=!0;var s=o.start;o.start=o.end,o.end=s}var a;if(a="number"==typeof e.limit?e.limit:-1,0===a||"start"in o&&"end"in o&&o.start>o.end)return t(null,{total_rows:r,offset:e.skip,rows:[]});var c=[],f=M.docStore.readStream(o),h=u(function(t,n,r){function o(t,n){var o={id:t.id,key:t.id,value:{rev:l.winningRev(t)}};if(e.include_docs){o.doc=n,o.doc._rev=o.value.rev,e.conflicts&&(o.doc._conflicts=l.collectConflicts(t));for(var i in o.doc._attachments)o.doc._attachments.hasOwnProperty(i)&&(o.doc._attachments[i].stub=!0)}if(e.inclusive_end===!1&&t.id===e.endkey)return r();if(d.isDeleted(t)){if("ok"!==e.deleted)return r();o.value.deleted=!0,o.doc=null}c.push(o),r()}if(d.isDeleted(t.value)){if("ok"!==e.deleted)return void r()}else{if(i-->0)return void r();if(0===a--)return f.unpipe(),f.destroy(),void r()}var s=t.value;if(e.include_docs){var u=s.rev_map[l.winningRev(s)];M.bySeqStore.get(A(u),function(e,t){o(s,t)})}else o(s)},function(n){t(null,{total_rows:r,offset:e.skip,rows:c}),n()}).on("unpipe",function(){h.end()});f.on("error",t),f.pipe(h)})},U._changes=function(e){function t(){e.done=!0,h&&e.limit&&e.limit<s.length&&(s.length=e.limit),g.unpipe(y),g.destroy(),e.continuous||e.cancelled||e.complete(null,{results:s,last_seq:a})}if(e=d.clone(e),e.continuous){var n=P+":"+d.uuid();return o.Changes.addListener(P,n,U,e),o.Changes.notify(P),{cancel:function(){o.Changes.removeListener(P,n)}}}var r,i=e.descending,s=[],a=0,c=0,f={reverse:i};"limit"in e&&e.limit>0&&(r=e.limit),f.reverse||(f.start=A(e.since?e.since+1:0));var h,p=d.filterChange(e);h="returnDocs"in e?e.returnDocs:!0;var g=M.bySeqStore.readStream(f),y=u(function(n,o,i){return r&&c>=r?(t(),i()):e.cancelled||e.done?i():void M.docStore.get(n.value._id,function(t,r){if(e.cancelled||e.done||D.isClosed()||d.isLocalId(r.id))return i();var o=n.value;o._rev=l.winningRev(r);var u=e.processChange(o,r,e);u.seq=r.seq,a<r.seq&&(a=r.seq),T(n.key)===r.rev_map[u.doc._rev]&&p(u)&&(c++,d.call(e.onChange,u),h&&s.push(u)),i()})},function(t){return e.cancelled?t():(h&&e.limit&&e.limit<s.length&&(s.length=e.limit),void t())}).on("unpipe",function(){y.end(),t()});return g.pipe(y),{cancel:function(){e.cancelled=!0,t()}}},U._close=function(e){return D.isClosed()?e(c.NOT_OPEN):void D.close(function(t){t?e(t):(W["delete"](P),e())})},U._getRevisionTree=function(e,t){M.docStore.get(e,function(e,n){e?t(c.MISSING_DOC):t(null,n.rev_tree)})},U._doCompaction=B(function(e,t,n){return t.length?void M.docStore.get(e,function(r,o){function i(e){if(e&&(f=e),++p===t.length){if(f)return n(e);a()}}function s(e){return e?n(e):void D.batch(c,n)}function a(){function n(e){e&&(o=e),++i===r.length&&s(o)}var r=Object.keys(h);if(!r.length)return s();var o,i=0,a=new d.Map;t.forEach(function(t){a.set(e+"@"+t,!0)}),r.forEach(function(e){M.attachmentStore.get(e,function(t,r){if(t)return"NotFoundError"===t.name?n():n(t);var o=Object.keys(r.refs||{}).filter(function(e){return!a.has(e)}),i={};o.forEach(function(e){i[e]=!0}),o.length?c.push({key:e,type:"put",valueEncoding:"json",value:{refs:i},prefix:M.attachmentStore}):c=c.concat([{key:e,type:"del",prefix:M.attachmentStore},{key:e,type:"del",prefix:M.binaryStore}]),n()})})}if(r)return n(r);var u=o.rev_map;l.traverseRevTree(o.rev_tree,function(e,n,r,o,i){var s=n+"-"+r;-1!==t.indexOf(s)&&(i.status="missing")});var c=[];c.push({key:o.id,value:o,type:"put",valueEncoding:L,prefix:M.docStore});var f,h={},p=0;t.forEach(function(e){var t=u[e];t&&(c.push({key:A(t),type:"del",prefix:M.bySeqStore}),M.bySeqStore.get(A(t),function(e,t){if(e)return"NotFoundError"===e.name?i():i(e);var n=Object.keys(t._attachments||{});n.forEach(function(e){var n=t._attachments[e].digest;h[n]=!0}),i()}))})}):n()}),U._getLocal=function(e,t){M.localStore.get(e,function(e,n){e?t(c.MISSING_DOC):t(null,n)})},U._putLocal=B(function(e,t){U._putLocalNoLock(e,t)}),U._putLocalNoLock=function(e,t){delete e._revisions;var n=e._rev,r=e._id;M.localStore.get(r,function(o,i){return o&&n?t(c.REV_CONFLICT):i&&i._rev!==n?t(c.REV_CONFLICT):(e._rev=n?"0-"+(parseInt(n.split("-")[1],10)+1):"0-1",void M.localStore.put(r,e,function(n){if(n)return t(n);var r={ok:!0,id:e._id,rev:e._rev};t(null,r)}))})},U._removeLocal=B(function(e,t){U._removeLocalNoLock(e,t)}),U._removeLocalNoLock=function(e,t){M.localStore.get(e._id,function(n,r){return n?t(n):r._rev!==e._rev?t(c.REV_CONFLICT):void M.localStore.del(e._id,function(n){if(n)return t(n);var r={ok:!0,id:e._id,rev:"0-0"};t(null,r)})})}}var i=e("levelup"),s=e("leveldown"),a=e("level-sublevel"),u=e("through2").obj,c=e("../deps/errors"),l=e("../merge"),d=e("../utils"),f=e("../deps/migrate"),h=e("vuvuzela"),p=e("double-ended-queue"),g="document-store",y="by-sequence",b="attach-store",v="attach-binary-store",m="local-store",w="meta-store",_=50,E=new d.Map,k="_local_last_update_seq",S="_local_doc_count",x="_local_uuid",j="md5-",L={encode:h.stringify,decode:h.parse,buffer:!1,type:"cheap-json"};o.valid=function(){return n&&!n.browser},o.destroy=d.toPromise(function(e,t,r){function i(e,t){"function"==typeof u.destroy?u.destroy(e,t):n.nextTick(r)}t=d.clone(t);var a,u=t.db||s;return E.has(u.name)?(a=E.get(u.name),void(a.has(e)?(o.Changes.removeAllListeners(e),a.get(e).close(function(){a["delete"](e),i(e,r)})):i(e,r))):i(e,r)}),o.use_prefix=!1,o.Changes=new d.Changes,t.exports=o}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),e("buffer").Buffer)},{"../deps/errors":5,"../deps/migrate":"x33H+M","../merge":9,"../utils":16,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,"double-ended-queue":34,"level-sublevel":37,leveldown:"IG9xsc",levelup:51,through2:120,vuvuzela:121}],2:[function(e,t){"use strict";function n(e,t){function n(t,n,r){if(e.binary||e.json||!e.processData||"string"==typeof t){if(!e.binary&&e.json&&"string"==typeof t)try{t=JSON.parse(t)}catch(o){return r(o)}}else t=JSON.stringify(t);Array.isArray(t)&&(t=t.map(function(e){var t;return e.ok?e:e.error&&"conflict"===e.error?(t=i.REV_CONFLICT,t.id=e.id,t):e.error&&"forbidden"===e.error?(t=i.FORBIDDEN,t.id=e.id,t.reason=e.reason,t):e.missing?(t=i.MISSING_DOC,t.missing=e.missing,t):e})),r(null,t,n)}function a(e,t){var n,r,o,s;try{n=JSON.parse(e.responseText);for(s in i)if(i.hasOwnProperty(s)&&i[s].name===n.error){o=i[s];break}o||(o=i.UNKNOWN_ERROR,e.status&&(o.status=e.status),e.statusText&&(e.name=e.statusText)),r=i.error(o,n.reason)}catch(a){for(var s in i)if(i.hasOwnProperty(s)&&i[s].status===e.status){o=i[s];break}o||(o=i.UNKNOWN_ERROR,e.status&&(o.status=e.status),e.statusText&&(e.name=e.statusText)),r=i.error(o)}e.withCredentials&&0===e.status&&(r.status=405,r.statusText="Method Not Allowed"),t(r)}var u=!1,c=s.getArguments(function(e){u||(t.apply(this,e),u=!0)});"function"==typeof e&&(c=e,e={}),e=s.clone(e);var l={method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1};if(e=s.extend(!0,l,e),"GET"===e.method&&!e.cache){var d=-1!==e.url.indexOf("?");e.url+=(d?"&":"?")+"_nonce="+s.uuid(16)}var f,h;h=e.xhr?new e.xhr:new XMLHttpRequest,h.open(e.method,e.url),h.withCredentials=!0,e.json&&(e.headers.Accept="application/json",e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.body&&e.processData&&"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.binary&&(h.responseType="arraybuffer");var p=function(e,t,n){var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires="+o.toGMTString()}document.cookie=e+"="+t+r+"; path=/"};for(var g in e.headers)if("Cookie"===g){var y=e.headers[g].split("=");p(y[0],y[1],10)}else h.setRequestHeader(g,e.headers[g]);"body"in e||(e.body=null);var b=function(){u||(h.abort(),a(h,c))};return h.onreadystatechange=function(){if(4===h.readyState&&!u)if(clearTimeout(f),h.status>=200&&h.status<300){var t;t=e.binary?o([h.response||""],{type:h.getResponseHeader("Content-Type")}):h.responseText,n(t,h,c)}else a(h,c)},e.timeout>0&&(f=setTimeout(b,e.timeout),h.onprogress=function(){clearTimeout(f),f=setTimeout(b,e.timeout)},"undefined"==typeof r&&(r=-1!==Object.keys(h).indexOf("upload")),r&&(h.upload.onprogress=h.onprogress)),e.body&&e.body instanceof Blob?s.readAsBinaryString(e.body,function(e){h.send(s.fixBinary(e))}):h.send(e.body),{abort:b}}var r,o=e("./blob.js"),i=e("./errors"),s=e("../utils");t.exports=n},{"../utils":16,"./blob.js":3,"./errors":5}],3:[function(e,t){(function(e){"use strict";function n(t,n){t=t||[],n=n||{};try{return new Blob(t,n)}catch(r){if("TypeError"!==r.name)throw r;for(var o=e.BlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder||e.WebKitBlobBuilder,i=new o,s=0;s<t.length;s+=1)i.append(t[s]);return i.getBlob(n.type)}}t.exports=n}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,n){"use strict";function r(){this.store={}}function o(){this.store=new r}n.Map=r,n.Set=o,r.prototype.mangle=function(e){if("string"!=typeof e)throw new TypeError("key must be a string but Got "+e);return"$"+e},r.prototype.unmangle=function(e){return e.substring(1)},r.prototype.get=function(e){var t=this.mangle(e);return t in this.store?this.store[t]:void 0},r.prototype.set=function(e,t){var n=this.mangle(e);return this.store[n]=t,!0},r.prototype.has=function(e){var t=this.mangle(e);return t in this.store},r.prototype["delete"]=function(e){var t=this.mangle(e);return t in this.store?(delete this.store[t],!0):!1},r.prototype.forEach=function(e){var t=this,n=Object.keys(t.store);n.forEach(function(n){var r=t.store[n];n=t.unmangle(n),e(r,n)})},o.prototype.add=function(e){return this.store.set(e,!0)},o.prototype.has=function(e){return this.store.has(e)},o.prototype["delete"]=function(e){return this.store["delete"](e)}},{}],5:[function(e,t,n){"use strict";function r(e){this.status=e.status,this.name=e.error,this.message=e.reason,this.error=!0}r.prototype__proto__=Error.prototype,r.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message})},n.UNAUTHORIZED=new r({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),n.MISSING_BULK_DOCS=new r({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),n.MISSING_DOC=new r({status:404,error:"not_found",reason:"missing"}),n.REV_CONFLICT=new r({status:409,error:"conflict",reason:"Document update conflict"}),n.INVALID_ID=new r({status:400,error:"invalid_id",reason:"_id field must contain a string"}),n.MISSING_ID=new r({status:412,error:"missing_id",reason:"_id is required for puts"}),n.RESERVED_ID=new r({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),n.NOT_OPEN=new r({status:412,error:"precondition_failed",reason:"Database not open"}),n.UNKNOWN_ERROR=new r({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),n.BAD_ARG=new r({status:500,error:"badarg",reason:"Some query argument is invalid"}),n.INVALID_REQUEST=new r({status:400,error:"invalid_request",reason:"Request was invalid"}),n.QUERY_PARSE_ERROR=new r({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),n.DOC_VALIDATION=new r({status:500,error:"doc_validation",reason:"Bad special document member"}),n.BAD_REQUEST=new r({status:400,error:"bad_request",reason:"Something wrong with the request"}),n.NOT_AN_OBJECT=new r({status:400,error:"bad_request",reason:"Document must be a JSON object"}),n.DB_MISSING=new r({status:404,error:"not_found",reason:"Database not found"}),n.IDB_ERROR=new r({status:500,error:"indexed_db_went_bad",reason:"unknown"}),n.WSQ_ERROR=new r({status:500,error:"web_sql_went_bad",reason:"unknown"}),n.LDB_ERROR=new r({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),n.FORBIDDEN=new r({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),n.error=function(e,t,n){function r(){this.message=t,n&&(this.name=n)}return r.prototype=e,new r(t)}},{}],6:[function(e,t){(function(n,r){"use strict";function o(e,t,n){if("function"==typeof e.slice)return t?n?e.slice(t,n):e.slice(t):e.slice();t=Math.floor(t||0),n=Math.floor(n||0);var r=e.byteLength;if(t=0>t?Math.max(t+r,0):Math.min(r,t),n=0>n?Math.max(n+r,0):Math.min(r,n),0>=n-t)return new ArrayBuffer(0);var o=new ArrayBuffer(n-t),i=new Uint8Array(o),s=new Uint8Array(e,t,n-t);return i.set(s),o}function i(e){var t=[255&e,e>>>8&255,e>>>16&255,e>>>24&255];return t.map(function(e){return String.fromCharCode(e)}).join("")}function s(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n]);return r.btoa(t)}var a=e("crypto"),u=e("spark-md5"),c=r.setImmediate||r.setTimeout,l=32768;t.exports=function(e,t){function r(e,t,n,r){f?e.appendBinary(t.substring(n,r)):e.append(o(t,n,r))}function i(){var n=y*p,o=n+p;if(n+p>=e.size&&(o=e.size),y++,g>y)r(b,e,n,o),c(i);else{r(b,e,n,o);var a=b.end(!0),u=s(a);t(null,u),b.destroy()}}if(!n.browser){var d=a.createHash("md5").update(e).digest("base64");return void t(null,d)}var f="string"==typeof e,h=f?e.length:e.byteLength,p=Math.min(l,h),g=Math.ceil(h/p),y=0,b=f?new u:new u.ArrayBuffer;i()}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,crypto:18,"spark-md5":105}],7:[function(e,t){"use strict";function n(e){for(var t=r,n=t.parser[t.strictMode?"strict":"loose"].exec(e),o={},i=14;i--;){var s=t.key[i],a=n[i]||"",u=-1!==["user","password"].indexOf(s);o[s]=u?decodeURIComponent(a):a}return o[t.q.name]={},o[t.key[12]].replace(t.q.parser,function(e,n,r){n&&(o[t.q.name][n]=r)}),o}var r={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};t.exports=n},{}],8:[function(e,t){"use strict";function n(e){return 0|Math.random()*e}function r(e,t){t=t||o.length;var r="",i=-1;if(e){for(;++i<e;)r+=o[n(t)];return r}for(;++i<36;)switch(i){case 8:case 13:case 18:case 23:r+="-";break;case 19:r+=o[3&n(16)|8];break;default:r+=o[n(16)]}return r}var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");t.exports=r},{}],9:[function(e,t){"use strict";function n(e){for(var t,n=e.shift(),r=[n.id,n.opts,[]],o=r;e.length;)n=e.shift(),t=[n.id,n.opts,[]],o[2].push(t),o=t;return r}function r(e,t){for(var n=[{tree1:e,tree2:t}],r=!1;n.length>0;){var o=n.pop(),i=o.tree1,s=o.tree2;(i[1].status||s[1].status)&&(i[1].status="available"===i[1].status||"available"===s[1].status?"available":"missing");for(var a=0;a<s[2].length;a++)if(i[2][0]){for(var u=!1,c=0;c<i[2].length;c++)i[2][c][0]===s[2][a][0]&&(n.push({tree1:i[2][c],tree2:s[2][a]}),u=!0);u||(r="new_branch",i[2].push(s[2][a]),i[2].sort())}else r="new_leaf",i[2][0]=s[2][a]}return{conflicts:r,tree:e}}function o(e,t,n){var o,i=[],s=!1,a=!1;return e.length?(e.forEach(function(e){if(e.pos===t.pos&&e.ids[0]===t.ids[0])o=r(e.ids,t.ids),i.push({pos:e.pos,ids:o.tree}),s=s||o.conflicts,a=!0;else if(n!==!0){var u=e.pos<t.pos?e:t,c=e.pos<t.pos?t:e,l=c.pos-u.pos,d=[],f=[];for(f.push({ids:u.ids,diff:l,parent:null,parentIdx:null});f.length>0;){var h=f.pop();0!==h.diff?h.ids&&h.ids[2].forEach(function(e,t){f.push({ids:e,diff:h.diff-1,parent:h.ids,parentIdx:t})}):h.ids[0]===c.ids[0]&&d.push(h)}var p=d[0];p?(o=r(p.ids,c.ids),p.parent[2][p.parentIdx]=o.tree,i.push({pos:u.pos,ids:u.ids}),s=s||o.conflicts,a=!0):i.push(e)}else i.push(e)}),a||i.push(t),i.sort(function(e,t){return e.pos-t.pos}),{tree:i,conflicts:s||"internal_node"}):{tree:[t],conflicts:"new_leaf"}}function i(e,t){var r=a.rootToLeaf(e).map(function(e){var r=e.ids.slice(-t);return{pos:e.pos+(e.ids.length-r.length),ids:n(r)}});return r.reduce(function(e,t){return o(e,t,!0).tree},[r.shift()])}var s=e("pouchdb-extend"),a={};a.merge=function(e,t,n){e=s(!0,[],e),t=s(!0,{},t);var r=o(e,t);return{tree:i(r.tree,n),conflicts:r.conflicts}},a.winningRev=function(e){var t=[];return a.traverseRevTree(e.rev_tree,function(e,n,r,o,i){e&&t.push({pos:n,id:r,deleted:!!i.deleted})}),t.sort(function(e,t){return e.deleted!==t.deleted?e.deleted>t.deleted?1:-1:e.pos!==t.pos?t.pos-e.pos:e.id<t.id?1:-1}),t[0].pos+"-"+t[0].id},a.traverseRevTree=function(e,t){for(var n,r=e.slice();n=r.pop();)for(var o=n.pos,i=n.ids,s=i[2],a=t(0===s.length,o,i[0],n.ctx,i[1]),u=0,c=s.length;c>u;u++)r.push({pos:o+1,ids:s[u],ctx:a})},a.collectLeaves=function(e){var t=[];return a.traverseRevTree(e,function(e,n,r,o,i){e&&t.unshift({rev:n+"-"+r,pos:n,opts:i})}),t.sort(function(e,t){return t.pos-e.pos}),t.map(function(e){delete e.pos}),t},a.collectConflicts=function(e){var t=a.winningRev(e),n=a.collectLeaves(e.rev_tree),r=[];return n.forEach(function(e){e.rev===t||e.opts.deleted||r.push(e.rev)}),r},a.rootToLeaf=function(e){var t=[];return a.traverseRevTree(e,function(e,n,r,o,i){if(o=o?o.slice(0):[],o.push({id:r,opts:i}),e){var s=n+1-o.length;t.unshift({pos:s,ids:o})}return o}),t},t.exports=a},{"pouchdb-extend":104}],NJ843k:[function(e,t){"use strict";t.exports={name:"localstorage",valid:function(){return"localStorage"in window},use_prefix:!0}},{}],"adapter-config":[function(e,t){t.exports=e("NJ843k")},{}],12:[function(e){"use strict";var t=e("adapter-config"),n=t.name,r=e("./levelalt");window.PouchDB.adapter(n,r),window.PouchDB.preferredAdapters.push(n)},{"./levelalt":13,"adapter-config":"NJ843k"}],13:[function(e,t){"use strict";function n(e,t){var n=s.extend({db:o},e);r.call(this,n,t)}var r=e("../adapters/leveldb"),o=e("leveldown"),i=e("adapter-config"),s=e("../utils");n.valid=function(){return i.valid()},n.use_prefix=i.use_prefix,n.destroy=s.toPromise(function(e,t,n){"function"==typeof t&&(n=t,t={});var i=s.extend({db:o},t);return r.destroy(e,i,n)}),t.exports=n},{"../adapters/leveldb":1,"../utils":16,"adapter-config":"NJ843k",leveldown:"IG9xsc"}],"x33H+M":[function(e,t,n){(function(e){"use strict";n.toSublevel=function(t,n,r){e.nextTick(function(){r()})},n.localAndMetaStores=function(t,n,r){e.nextTick(function(){r()})}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],"../adapters/../deps/migrate":[function(e,t){t.exports=e("x33H+M")},{}],16:[function(e,t,n){(function(t,r){function o(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function i(){return"undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage&&"undefined"!=typeof chrome.storage.local}function s(){if(!(this instanceof s))return new s;var e=this;l.call(this),this.isChrome=i(),this.listeners={},this.hasLocal=!1,this.isChrome||(this.hasLocal=n.hasLocalStorage()),this.isChrome?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):this.hasLocal&&(r.addEventListener?r.addEventListener("storage",function(t){e.emit(t.key)}):r.attachEvent("storage",function(t){e.emit(t.key)}))}var a=e("./merge");n.extend=e("pouchdb-extend"),n.ajax=e("./deps/ajax"),n.createBlob=e("./deps/blob"),n.uuid=e("./deps/uuid"),n.getArguments=e("argsarray");var u=e("./deps/buffer"),c=e("./deps/errors"),l=e("events").EventEmitter,d=e("./deps/collections");n.Map=d.Map,n.Set=d.Set,n.Promise="function"==typeof r.Promise?r.Promise:e("bluebird");var f=n.Promise,h=o(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),p=o(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);n.lastIndexOf=function(e,t){for(var n=e.length-1;n>=0;n--)if(e.charAt(n)===t)return n;return-1},n.clone=function(e){return n.extend(!0,{},e)},n.inherits=e("inherits"),n.invalidIdError=function(e){var t;if(e?"string"!=typeof e?(t=new TypeError(c.INVALID_ID.message),t.status=400):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=new TypeError(c.RESERVED_ID.message),t.status=400):(t=new TypeError(c.MISSING_ID.message),t.status=412),t)throw t},n.call=n.getArguments(function(e){if(e.length){var t=e.shift();"function"==typeof t&&t.apply(this,e)}}),n.isLocalId=function(e){return/^_local/.test(e)},n.isDeleted=function(e,t){t||(t=a.winningRev(e));var n=t.indexOf("-");-1!==n&&(t=t.substring(n+1));var r=!1;return a.traverseRevTree(e.rev_tree,function(e,n,o,i,s){o===t&&(r=!!s.deleted)}),r},n.revExists=function(e,t){var n=!1;return a.traverseRevTree(e.rev_tree,function(e,r,o){r+"-"+o===t&&(n=!0)}),n},n.filterChange=function(e){return function(t){var n={},r=e.filter&&"function"==typeof e.filter;if(n.query=e.query_params,e.filter&&r&&!e.filter.call(this,t.doc,n))return!1;if(e.doc_ids&&-1===e.doc_ids.indexOf(t.id))return!1;if(e.include_docs)for(var o in t.doc._attachments)t.doc._attachments.hasOwnProperty(o)&&(t.doc._attachments[o].stub=!0);else delete t.doc;return!0}},n.parseDoc=function(e,t){var r,o,i,s,a={status:"available"};if(e._deleted&&(a.deleted=!0),t)if(e._id||(e._id=n.uuid()),o=n.uuid(32,16).toLowerCase(),e._rev){if(i=/^(\d+)-(.+)$/.exec(e._rev),!i){var u=new TypeError("invalid value for property '_rev'");u.status=400}e._rev_tree=[{pos:parseInt(i[1],10),ids:[i[2],{status:"missing"},[[o,a,[]]]]}],r=parseInt(i[1],10)+1}else e._rev_tree=[{pos:1,ids:[o,a,[]]}],r=1;else if(e._revisions&&(e._rev_tree=[{pos:e._revisions.start-e._revisions.ids.length+1,ids:e._revisions.ids.reduce(function(e,t){return null===e?[t,a,[]]:[t,{status:"missing"},[e]]},null)}],r=e._revisions.start,o=e._revisions.ids[0]),!e._rev_tree){if(i=/^(\d+)-(.+)$/.exec(e._rev),!i)throw s=new TypeError(c.BAD_ARG.message),s.status=c.BAD_ARG.status,s;r=parseInt(i[1],10),o=i[2],e._rev_tree=[{pos:parseInt(i[1],10),ids:[i[2],a,[]]}]}n.invalidIdError(e._id),e._rev=[r,o].join("-");var l={metadata:{},data:{}};for(var d in e)if(e.hasOwnProperty(d)){var f="_"===d[0];if(f&&!h[d])throw s=new Error(c.DOC_VALIDATION.message+": "+d),s.status=c.DOC_VALIDATION.status,s;f&&!p[d]?l.metadata[d.slice(1)]=e[d]:l.data[d]=e[d]}return l},n.isCordova=function(){return"undefined"!=typeof cordova||"undefined"!=typeof PhoneGap||"undefined"!=typeof phonegap},n.hasLocalStorage=function(){if(i())return!1;try{return r.localStorage}catch(e){return!1}},n.Changes=s,n.inherits(s,l),s.prototype.addListener=function(e,t,r,o){function i(){r.changes({include_docs:o.include_docs,conflicts:o.conflicts,continuous:!1,descending:!1,filter:o.filter,view:o.view,since:o.since,query_params:o.query_params,onChange:function(e){e.seq>o.since&&!o.cancelled&&(o.since=e.seq,n.call(o.onChange,e))}})}this.listeners[t]||(this.listeners[t]=i,this.on(e,i))},s.prototype.removeListener=function(e,t){t in this.listeners&&l.prototype.removeListener.call(this,e,this.listeners[t])},s.prototype.notifyLocalWindows=function(e){this.isChrome?chrome.storage.local.set({dbName:e}):this.hasLocal&&(localStorage[e]="a"===localStorage[e]?"b":"a")
  },s.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},n.atob=t.browser&&"atob"in r?function(e){return atob(e)}:function(e){var t=new u(e,"base64");if(t.toString("base64")!==e)throw"Cannot base64 encode full string";return t.toString("binary")},n.btoa=t.browser&&"btoa"in r?function(e){return btoa(e)}:function(e){return new u(e,"binary").toString("base64")},n.fixBinary=function(e){if(!t.browser)return e;for(var n=e.length,r=new ArrayBuffer(n),o=new Uint8Array(r),i=0;n>i;i++)o[i]=e.charCodeAt(i);return r},n.readAsBinaryString=function(e,t){var r=new FileReader,o="function"==typeof r.readAsBinaryString;r.onloadend=function(e){var r=e.target.result||"";return o?t(r):void t(n.arrayBufferToBinaryString(r))},o?r.readAsBinaryString(e):r.readAsArrayBuffer(e)},n.once=function(e){var t=!1;return n.getArguments(function(n){if(t)throw new Error("once called  more than once");t=!0,e.apply(this,n)})},n.toPromise=function(e){return n.getArguments(function(r){var o,i=this,s="function"==typeof r[r.length-1]?r.pop():!1;s&&(o=function(e,n){t.nextTick(function(){s(e,n)})});var a=new f(function(t,o){var s;try{var a=n.once(function(e,n){e?o(e):t(n)});r.push(a),s=e.apply(i,r),s&&"function"==typeof s.then&&t(s)}catch(u){o(u)}});return o&&a.then(function(e){o(null,e)},o),a.cancel=function(){return this},a})},n.adapterFun=function(e,t){return n.toPromise(n.getArguments(function(r){if(this._closed)return f.reject(new Error("database is closed"));var o=this;return this.taskqueue.isReady?t.apply(this,r):new n.Promise(function(t,n){o.taskqueue.addTask(function(i){i?n(i):t(o[e].apply(o,r))})})}))},n.arrayBufferToBinaryString=function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,o=0;r>o;o++)t+=String.fromCharCode(n[o]);return t},n.cancellableFun=function(e,t,r){r=r?n.clone(!0,{},r):{};var o=new l,i=r.complete||function(){},s=r.complete=n.once(function(e,t){e?i(e):(o.emit("end",t),i(null,t)),o.removeAllListeners()}),a=r.onChange||function(){},u=0;t.on("destroyed",function(){o.removeAllListeners()}),r.onChange=function(e){a(e),e.seq<=u||(u=e.seq,o.emit("change",e),e.deleted?o.emit("delete",e):1===e.changes.length&&"1-"===e.changes[0].rev.slice(0,1)?o.emit("create",e):o.emit("update",e))};var c=new f(function(e,t){r.complete=function(n,r){n?t(n):e(r)}});return c.then(function(e){s(null,e)},s),c.cancel=function(){c.isCancelled=!0,t.taskqueue.isReady&&r.complete(null,{status:"cancelled"})},t.taskqueue.isReady?e(t,r,c):t.taskqueue.addTask(function(){c.isCancelled?r.complete(null,{status:"cancelled"}):e(t,r,c)}),c.on=o.on.bind(o),c.once=o.once.bind(o),c.addListener=o.addListener.bind(o),c.removeListener=o.removeListener.bind(o),c.removeAllListeners=o.removeAllListeners.bind(o),c.setMaxListeners=o.setMaxListeners.bind(o),c.listeners=o.listeners.bind(o),c.emit=o.emit.bind(o),c},n.MD5=n.toPromise(e("./deps/md5")),n.explain404=function(e){t.browser&&"console"in r&&"info"in console&&console.info("The above 404 is totally normal. "+e+"\n♥ the PouchDB team")},n.parseUri=e("./deps/parse-uri"),n.compare=function(e,t){return t>e?-1:e>t?1:0}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./deps/ajax":2,"./deps/blob":3,"./deps/buffer":18,"./deps/collections":4,"./deps/errors":5,"./deps/md5":6,"./deps/parse-uri":7,"./deps/uuid":8,"./merge":9,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,argsarray:17,bluebird:77,events:19,inherits:35,"pouchdb-extend":104}],17:[function(e,t){"use strict";function n(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=n},{}],18:[function(){},{}],19:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(r(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:for(o=arguments.length,a=new Array(o-1),u=1;o>u;u++)a[u-1]=arguments[u];n.apply(this,a)}else if(i(n)){for(o=arguments.length,a=new Array(o-1),u=1;o>u;u++)a[u-1]=arguments[u];for(c=n.slice(),o=c.length,u=0;o>u;u++)c[u].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var o;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned){var o;o=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,o&&o>0&&this._events[e].length>o&&(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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=a;break}if(0>o)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],20:[function(e,t){var n=t.exports={};n.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],21:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))return new r(e,t,n);var o=typeof e;if("base64"===t&&"string"===o)for(e=j(e);e.length%4!==0;)e+="=";var i;if("number"===o)i=N(e);else if("string"===o)i=r.byteLength(e,t);else{if("object"!==o)throw new Error("First argument needs to be a number, array or string.");i=N(e.length)}var s;r._useTypedArrays?s=L(new Uint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);var a;if(r._useTypedArrays&&"function"==typeof Uint8Array&&e instanceof Uint8Array)s._set(e);else if(B(e))for(a=0;i>a;a++)s[a]=r.isBuffer(e)?e.readUInt8(a):e[a];else if("string"===o)s.write(e,0,t);else if("number"===o&&!r._useTypedArrays&&!n)for(a=0;i>a;a++)s[a]=0;return s}function o(e,t,n,o){n=Number(n)||0;var i=e.length-n;o?(o=Number(o),o>i&&(o=i)):o=i;var s=t.length;W(s%2===0,"Invalid hex string"),o>s/2&&(o=s/2);for(var a=0;o>a;a++){var u=parseInt(t.substr(2*a,2),16);W(!isNaN(u),"Invalid hex string"),e[n+a]=u}return r._charsWritten=2*a,a}function i(e,t,n,o){var i=r._charsWritten=D(T(t),e,n,o);return i}function s(e,t,n,o){var i=r._charsWritten=D(C(t),e,n,o);return i}function a(e,t,n,r){return s(e,t,n,r)}function u(e,t,n,o){var i=r._charsWritten=D(R(t),e,n,o);return i}function c(e,t,n){return F.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function l(e,t,n){var r="",o="";n=Math.min(e.length,n);for(var i=t;n>i;i++)e[i]<=127?(r+=U(o)+String.fromCharCode(e[i]),o=""):o+="%"+e[i].toString(16);return r+U(o)}function d(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;n>o;o++)r+=String.fromCharCode(e[o]);return r}function f(e,t,n){return d(e,t,n)}function h(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var o="",i=t;n>i;i++)o+=A(e[i]);return o}function p(e,t,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==t&&null!==t,"missing offset"),W(t+1<e.length,"Trying to read beyond buffer length"));var o=e.length;if(!(t>=o)){var i;return n?(i=e[t],o>t+1&&(i|=e[t+1]<<8)):(i=e[t]<<8,o>t+1&&(i|=e[t+1])),i}}function g(e,t,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==t&&null!==t,"missing offset"),W(t+3<e.length,"Trying to read beyond buffer length"));var o=e.length;if(!(t>=o)){var i;return n?(o>t+2&&(i=e[t+2]<<16),o>t+1&&(i|=e[t+1]<<8),i|=e[t],o>t+3&&(i+=e[t+3]<<24>>>0)):(o>t+1&&(i=e[t+1]<<16),o>t+2&&(i|=e[t+2]<<8),o>t+3&&(i|=e[t+3]),i+=e[t]<<24>>>0),i}}function y(e,t,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==t&&null!==t,"missing offset"),W(t+1<e.length,"Trying to read beyond buffer length"));var o=e.length;if(!(t>=o)){var i=p(e,t,n,!0),s=32768&i;return s?-1*(65535-i+1):i}}function b(e,t,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==t&&null!==t,"missing offset"),W(t+3<e.length,"Trying to read beyond buffer length"));var o=e.length;if(!(t>=o)){var i=g(e,t,n,!0),s=2147483648&i;return s?-1*(4294967295-i+1):i}}function v(e,t,n,r){return r||(W("boolean"==typeof n,"missing or invalid endian"),W(t+3<e.length,"Trying to read beyond buffer length")),z.read(e,t,n,23,4)}function m(e,t,n,r){return r||(W("boolean"==typeof n,"missing or invalid endian"),W(t+7<e.length,"Trying to read beyond buffer length")),z.read(e,t,n,52,8)}function w(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+1<e.length,"trying to write beyond buffer length"),M(t,65535));var i=e.length;if(!(n>=i))for(var s=0,a=Math.min(i-n,2);a>s;s++)e[n+s]=(t&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function _(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+3<e.length,"trying to write beyond buffer length"),M(t,4294967295));var i=e.length;if(!(n>=i))for(var s=0,a=Math.min(i-n,4);a>s;s++)e[n+s]=t>>>8*(r?s:3-s)&255}function E(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+1<e.length,"Trying to write beyond buffer length"),P(t,32767,-32768));var i=e.length;n>=i||(t>=0?w(e,t,n,r,o):w(e,65535+t+1,n,r,o))}function k(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+3<e.length,"Trying to write beyond buffer length"),P(t,2147483647,-2147483648));var i=e.length;n>=i||(t>=0?_(e,t,n,r,o):_(e,4294967295+t+1,n,r,o))}function S(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+3<e.length,"Trying to write beyond buffer length"),q(t,3.4028234663852886e38,-3.4028234663852886e38));var i=e.length;n>=i||z.write(e,t,n,r,23,4)}function x(e,t,n,r,o){o||(W(void 0!==t&&null!==t,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(n+7<e.length,"Trying to write beyond buffer length"),q(t,1.7976931348623157e308,-1.7976931348623157e308));var i=e.length;n>=i||z.write(e,t,n,r,52,8)}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function L(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=K.get,e.set=K.set,e.write=K.write,e.toString=K.toString,e.toLocaleString=K.toString,e.toJSON=K.toJSON,e.copy=K.copy,e.slice=K.slice,e.readUInt8=K.readUInt8,e.readUInt16LE=K.readUInt16LE,e.readUInt16BE=K.readUInt16BE,e.readUInt32LE=K.readUInt32LE,e.readUInt32BE=K.readUInt32BE,e.readInt8=K.readInt8,e.readInt16LE=K.readInt16LE,e.readInt16BE=K.readInt16BE,e.readInt32LE=K.readInt32LE,e.readInt32BE=K.readInt32BE,e.readFloatLE=K.readFloatLE,e.readFloatBE=K.readFloatBE,e.readDoubleLE=K.readDoubleLE,e.readDoubleBE=K.readDoubleBE,e.writeUInt8=K.writeUInt8,e.writeUInt16LE=K.writeUInt16LE,e.writeUInt16BE=K.writeUInt16BE,e.writeUInt32LE=K.writeUInt32LE,e.writeUInt32BE=K.writeUInt32BE,e.writeInt8=K.writeInt8,e.writeInt16LE=K.writeInt16LE,e.writeInt16BE=K.writeInt16BE,e.writeInt32LE=K.writeInt32LE,e.writeInt32BE=K.writeInt32BE,e.writeFloatLE=K.writeFloatLE,e.writeFloatBE=K.writeFloatBE,e.writeDoubleLE=K.writeDoubleLE,e.writeDoubleBE=K.writeDoubleBE,e.fill=K.fill,e.inspect=K.inspect,e.toArrayBuffer=K.toArrayBuffer,e}function O(e,t,n){return"number"!=typeof e?n:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))}function N(e){return e=~~Math.ceil(+e),0>e?0:e}function I(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function B(e){return I(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function A(e){return 16>e?"0"+e.toString(16):e.toString(16)}function T(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(127>=r)t.push(e.charCodeAt(n));else{var o=n;r>=55296&&57343>=r&&n++;for(var i=encodeURIComponent(e.slice(o,n+1)).substr(1).split("%"),s=0;s<i.length;s++)t.push(parseInt(i[s],16))}}return t}function C(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function R(e){return F.toByteArray(e)}function D(e,t,n,r){for(var o=0;r>o&&!(o+n>=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function U(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function M(e,t){W("number"==typeof e,"cannot write a non-number as a number"),W(e>=0,"specified a negative value for writing an unsigned value"),W(t>=e,"value is larger than maximum value for type"),W(Math.floor(e)===e,"value has a fractional component")}function P(e,t,n){W("number"==typeof e,"cannot write a non-number as a number"),W(t>=e,"value larger than maximum allowed value"),W(e>=n,"value smaller than minimum allowed value"),W(Math.floor(e)===e,"value has a fractional component")}function q(e,t,n){W("number"==typeof e,"cannot write a non-number as a number"),W(t>=e,"value larger than maximum allowed value"),W(e>=n,"value smaller than minimum allowed value")}function W(e,t){if(!e)throw new Error(t||"Failed assertion")}var F=e("base64-js"),z=e("ieee754");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192,r._useTypedArrays=function(){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer)return!1;try{var e=new Uint8Array(0);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),r.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.isBuffer=function(e){return!(null===e||void 0===e||!e._isBuffer)},r.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=T(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=R(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},r.concat=function(e,t){if(W(I(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new r(0);if(1===e.length)return e[0];var n;if("number"!=typeof t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var o=new r(t),i=0;for(n=0;n<e.length;n++){var s=e[n];s.copy(o,i),i+=s.length}return o},r.prototype.write=function(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var c=r;r=t,t=n,n=c}t=Number(t)||0;var l=this.length-t;switch(n?(n=Number(n),n>l&&(n=l)):n=l,r=String(r||"utf8").toLowerCase()){case"hex":return o(this,e,t,n);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i(this,e,t,n);case"ascii":return s(this,e,t,n);case"binary":return a(this,e,t,n);case"base64":return u(this,e,t,n);default:throw new Error("Unknown encoding")}},r.prototype.toString=function(e,t,n){var r=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,n=void 0!==n?Number(n):n=r.length,n===t)return"";switch(e){case"hex":return h(r,t,n);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(r,t,n);case"ascii":return d(r,t,n);case"binary":return f(r,t,n);case"base64":return c(r,t,n);default:throw new Error("Unknown encoding")}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.copy=function(e,t,n,r){var o=this;if(n||(n=0),r||0===r||(r=this.length),t||(t=0),r!==n&&0!==e.length&&0!==o.length){W(r>=n,"sourceEnd < sourceStart"),W(t>=0&&t<e.length,"targetStart out of bounds"),W(n>=0&&n<o.length,"sourceStart out of bounds"),W(r>=0&&r<=o.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);for(var i=0;r-n>i;i++)e[i+t]=this[i+n]}},r.prototype.slice=function(e,t){var n=this.length;if(e=O(e,n,0),t=O(t,n,n),r._useTypedArrays)return L(this.subarray(e,t));for(var o=t-e,i=new r(o,void 0,!0),s=0;o>s;s++)i[s]=this[s+e];return i},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.readUInt8=function(e,t){return t||(W(void 0!==e&&null!==e,"missing offset"),W(e<this.length,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},r.prototype.readUInt16LE=function(e,t){return p(this,e,!0,t)},r.prototype.readUInt16BE=function(e,t){return p(this,e,!1,t)},r.prototype.readUInt32LE=function(e,t){return g(this,e,!0,t)},r.prototype.readUInt32BE=function(e,t){return g(this,e,!1,t)},r.prototype.readInt8=function(e,t){if(t||(W(void 0!==e&&null!==e,"missing offset"),W(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length)){var n=128&this[e];return n?-1*(255-this[e]+1):this[e]}},r.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},r.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},r.prototype.readInt32LE=function(e,t){return b(this,e,!0,t)},r.prototype.readInt32BE=function(e,t){return b(this,e,!1,t)},r.prototype.readFloatLE=function(e,t){return v(this,e,!0,t)},r.prototype.readFloatBE=function(e,t){return v(this,e,!1,t)},r.prototype.readDoubleLE=function(e,t){return m(this,e,!0,t)},r.prototype.readDoubleBE=function(e,t){return m(this,e,!1,t)},r.prototype.writeUInt8=function(e,t,n){n||(W(void 0!==e&&null!==e,"missing value"),W(void 0!==t&&null!==t,"missing offset"),W(t<this.length,"trying to write beyond buffer length"),M(e,255)),t>=this.length||(this[t]=e)},r.prototype.writeUInt16LE=function(e,t,n){w(this,e,t,!0,n)},r.prototype.writeUInt16BE=function(e,t,n){w(this,e,t,!1,n)},r.prototype.writeUInt32LE=function(e,t,n){_(this,e,t,!0,n)},r.prototype.writeUInt32BE=function(e,t,n){_(this,e,t,!1,n)},r.prototype.writeInt8=function(e,t,n){n||(W(void 0!==e&&null!==e,"missing value"),W(void 0!==t&&null!==t,"missing offset"),W(t<this.length,"Trying to write beyond buffer length"),P(e,127,-128)),t>=this.length||(e>=0?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},r.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},r.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},r.prototype.writeInt32LE=function(e,t,n){k(this,e,t,!0,n)},r.prototype.writeInt32BE=function(e,t,n){k(this,e,t,!1,n)},r.prototype.writeFloatLE=function(e,t,n){S(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){S(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){x(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){x(this,e,t,!1,n)},r.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),W("number"==typeof e&&!isNaN(e),"value is not a number"),W(n>=t,"end < start"),n!==t&&0!==this.length){W(t>=0&&t<this.length,"start out of bounds"),W(n>=0&&n<=this.length,"end out of bounds");for(var r=t;n>r;r++)this[r]=e}},r.prototype.inspect=function(){for(var e=[],t=this.length,r=0;t>r;r++)if(e[r]=A(this[r]),r===n.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},r.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(r._useTypedArrays)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var K=r.prototype},{"base64-js":22,ieee754:23}],22:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s?62:t===a?63:u>t?-1:u+10>t?t-u+26+26:l+26>t?t-l:c+26>t?t-c+26:void 0}function n(e){function n(e){c[d++]=e}var r,o,s,a,u,c;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;u="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,c=new i(3*e.length/4-u),s=u>0?e.length-4:e.length;var d=0;for(r=0,o=0;s>r;r+=4,o+=3)a=t(e.charAt(r))<<18|t(e.charAt(r+1))<<12|t(e.charAt(r+2))<<6|t(e.charAt(r+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=t(e.charAt(r))<<2|t(e.charAt(r+1))>>4,n(255&a)):1===u&&(a=t(e.charAt(r))<<10|t(e.charAt(r+1))<<4|t(e.charAt(r+2))>>2,n(a>>8&255),n(255&a)),c}function o(e){function t(e){return r.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var o,i,s,a=e.length%3,u="";for(o=0,s=e.length-a;s>o;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],u+=n(i);switch(a){case 1:i=e[e.length-1],u+=t(i>>2),u+=t(i<<4&63),u+="==";break;case 2:i=(e[e.length-2]<<8)+e[e.length-1],u+=t(i>>10),u+=t(i>>4&63),u+=t(i<<2&63),u+="="}return u}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),c="a".charCodeAt(0),l="A".charCodeAt(0);e.toByteArray=n,e.fromByteArray=o}("undefined"==typeof n?this.base64js={}:n)},{}],23:[function(e,t,n){n.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=a;l>0;i=256*i+e[t+d],d+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return s?0/0:1/0*(h?-1:1);s+=Math.pow(2,r),i-=c}return(h?-1:1)*s*Math.pow(2,i-r)},n.write=function(e,t,n,r,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+d>=1?f/u:f*Math.pow(2,1-d),t*u>=2&&(s++,u/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*u-1)*Math.pow(2,o),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=255&a,h+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*g}},{}],24:[function(e,t){function n(e){return this instanceof n?(s.call(this,e),a.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",r)):new n(e)}function r(){if(!this.allowHalfOpen&&!this._writableState.ended){var e=this;i(function(){e.end()})}}t.exports=n;var o=e("inherits"),i=e("process/browser.js").nextTick,s=e("./readable.js"),a=e("./writable.js");o(n,s),n.prototype.write=a.prototype.write,n.prototype.end=a.prototype.end,n.prototype._write=a.prototype._write},{"./readable.js":28,"./writable.js":30,inherits:35,"process/browser.js":26}],25:[function(e,t){function n(){r.call(this)}t.exports=n;var r=e("events").EventEmitter,o=e("inherits");o(n,r),n.Readable=e("./readable.js"),n.Writable=e("./writable.js"),n.Duplex=e("./duplex.js"),n.Transform=e("./transform.js"),n.PassThrough=e("./passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function o(){c.readable&&c.resume&&c.resume()}function i(){l||(l=!0,e.end())}function s(){l||(l=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===r.listenerCount(this,"error"))throw e}function u(){c.removeListener("data",n),e.removeListener("drain",o),c.removeListener("end",i),c.removeListener("close",s),c.removeListener("error",a),e.removeListener("error",a),c.removeListener("end",u),c.removeListener("close",u),e.removeListener("close",u)}var c=this;c.on("data",n),e.on("drain",o),e._isStdio||t&&t.end===!1||(c.on("end",i),c.on("close",s));var l=!1;return c.on("error",a),e.on("error",a),c.on("end",u),c.on("close",u),e.on("close",u),e.emit("pipe",c),e}},{"./duplex.js":24,"./passthrough.js":27,"./readable.js":28,"./transform.js":29,"./writable.js":30,events:19,inherits:35}],26:[function(e,t){t.exports=e(20)},{}],27:[function(e,t){function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./transform.js"),o=e("inherits");o(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./transform.js":29,inherits:35}],28:[function(e,t){(function(n){function r(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(k||(k=e("string_decoder").StringDecoder),this.decoder=new k(t.encoding),this.encoding=t.encoding)}function o(e){return this instanceof o?(this._readableState=new r(e,this),this.readable=!0,void x.call(this)):new o(e)}function i(e,t,n,r,o){var i=c(t,n);if(i)e.emit("error",i);else if(null===n||void 0===n)t.reading=!1,t.ended||l(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!o){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&o){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||o||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&d(e),h(e,t);else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=N)e=N;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?d(e):w(e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?L(function(){f(e)}):f(e))}function f(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,L(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function g(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&y(e)}}function y(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):_(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(S.listenerCount(e,"data")>0&&v(e))):void(r.ranOut=!0)}function b(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function v(e,t){var n=e._readableState;if(n.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,o=!1;e.readable=!0,e.pipe=x.prototype.pipe,e.on=e.addListener=x.prototype.on,e.on("readable",function(){o=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,o?L(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,o=t.length,i=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===o)n=null;else if(s)n=r.shift();else if(!e||e>=o)n=i?r.join(""):j.concat(r,o),r.length=0;else if(e<r[0].length){var a=r[0];n=a.slice(0,e),r[0]=a.slice(e)}else if(e===r[0].length)n=r.shift();else{n=i?"":new j(e);for(var u=0,c=0,l=r.length;l>c&&e>u;c++){var a=r[0],d=Math.min(e-u,a.length);i?n+=a.slice(0,d):a.copy(n,u,0,d),d<a.length?r[0]=a.slice(d):r.shift(),u+=d}}return n}function w(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,L(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function _(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function E(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=o,o.ReadableState=r;var k,S=e("events").EventEmitter,x=e("./index.js"),j=e("buffer").Buffer,L=e("process/browser.js").nextTick,O=e("inherits");O(o,x),o.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new j(e,t),t="")),i(this,n,e,t,!1)},o.prototype.unshift=function(e){var t=this._readableState;return i(this,t,e,"",!0)},o.prototype.setEncoding=function(t){k||(k=e("string_decoder").StringDecoder),this._readableState.decoder=new k(t),this._readableState.encoding=t};var N=8388608;o.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(this),null;var r=t.needReadable;t.length-e<=t.highWaterMark&&(r=!0),(t.ended||t.reading)&&(r=!1),r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=u(n,t));
  var o;return o=e>0?m(e,t):null,null===o&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&w(this),o},o.prototype._read=function(){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function r(e){e===l&&i()}function o(){e.end()}function i(){e.removeListener("close",a),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",o),l.removeListener("end",i),(!e._writableState||e._writableState.needDrain)&&p()}function s(t){c(),0===v&&0===S.listenerCount(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",u),c()}function u(){e.removeListener("close",a),c()}function c(){l.unpipe(e)}var l=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1;var f=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,h=f?o:i;d.endEmitted?L(h):l.once("end",h),e.on("unpipe",r);var p=g(l);e.on("drain",p);var v=S.listenerCount(e,"error");return e.once("error",s),e.once("close",a),e.once("finish",u),e.emit("pipe",l),d.flowing||(this.on("readable",b),d.flowing=!0,L(function(){y(l)})),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",b),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",b),t.flowing=!1;for(var o=0;r>o;o++)n[o].emit("unpipe",this);return this}var o=E(t.pipes,e);return-1===o?this:(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},o.prototype.on=function(e,t){var n=x.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||v(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&d(this,r):this.read(0))}return n},o.prototype.addListener=o.prototype.on,o.prototype.resume=function(){v(this),this.read(0),this.emit("resume")},o.prototype.pause=function(){v(this,!0),this.emit("pause")},o.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(o){if(t.decoder&&(o=t.decoder.write(o)),o&&(t.objectMode||o.length)){var i=r.push(o);i||(n=!0,e.pause())}});for(var o in e)"function"==typeof e[o]&&"undefined"==typeof this[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));var i=["error","close","destroy","pause","resume"];return _(i,function(t){e.on(t,function(e){return r.emit.apply(r,t,e)})}),r._read=function(){n&&(n=!1,e.resume())},r},o._fromList=m}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./index.js":25,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,events:19,inherits:35,"process/browser.js":26,string_decoder:31}],29:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return r(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,n){var r=e._transformState;r.transforming=!1;var o=r.writecb;if(!o)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&e.push(n),o&&o(t);var i=e._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&e._read(i.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);s.call(this,e);var t=(this._transformState=new n(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){i(t,e)}):i(t)})}function i(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=(e._readableState,e._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=o;var s=e("./duplex.js"),a=e("inherits");a(o,s),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},o.prototype._transform=function(){throw new Error("not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},o.prototype._read=function(){var e=this._transformState;e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./duplex.js":24,inherits:35}],30:[function(e,t){function n(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function r(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){f(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}function o(e){return this instanceof o||this instanceof E.Duplex?(this._writableState=new r(e,this),this.writable=!0,void E.call(this)):new o(e)}function i(e,t,n){var r=new Error("write after end");e.emit("error",r),k(function(){n(r)})}function s(e,t,n,r){var o=!0;if(!S.isBuffer(n)&&"string"!=typeof n&&null!==n&&void 0!==n&&!t.objectMode){var i=new TypeError("Invalid non-string/buffer chunk");e.emit("error",i),k(function(){r(i)}),o=!1}return o}function a(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new S(t,n)),t}function u(e,t,r,o,i){r=a(t,r,o);var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;return t.needDrain=!u,t.writing?t.buffer.push(new n(r,o,i)):c(e,t,s,r,o,i),u}function c(e,t,n,r,o,i){t.writelen=n,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,o,t.onwrite),t.sync=!1}function l(e,t,n,r,o){n?k(function(){o(r)}):o(r),e.emit("error",r)}function d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function f(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(d(n),t)l(e,n,r,t,o);else{var i=y(e,n);i||n.bufferProcessing||!n.buffer.length||g(e,n),r?k(function(){h(e,n,i,o)}):h(e,n,i,o)}}function h(e,t,n,r){n||p(e,t),r(),n&&b(e,t)}function p(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function g(e,t){t.bufferProcessing=!0;for(var n=0;n<t.buffer.length;n++){var r=t.buffer[n],o=r.chunk,i=r.encoding,s=r.callback,a=t.objectMode?1:o.length;if(c(e,t,a,o,i,s),t.writing){n++;break}}t.bufferProcessing=!1,n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}function y(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function b(e,t){var n=y(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function v(e,t,n){t.ending=!0,b(e,t),n&&(t.finished?k(n):e.once("finish",n)),t.ended=!0}t.exports=o,o.WritableState=r;var m="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array}:function(e){return e&&e.constructor&&"Uint8Array"===e.constructor.name},w="undefined"!=typeof ArrayBuffer?function(e){return e instanceof ArrayBuffer}:function(e){return e&&e.constructor&&"ArrayBuffer"===e.constructor.name},_=e("inherits"),E=e("./index.js"),k=e("process/browser.js").nextTick,S=e("buffer").Buffer;_(o,E),o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,n){var r=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),!S.isBuffer(e)&&m(e)&&(e=new S(e)),w(e)&&"undefined"!=typeof Uint8Array&&(e=new S(new Uint8Array(e))),S.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=function(){}),r.ended?i(this,r,n):s(this,r,e,n)&&(o=u(this,r,e,t,n)),o},o.prototype._write=function(e,t,n){n(new Error("not implemented"))},o.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),r.ending||r.finished||v(this,r,n)}},{"./index.js":25,buffer:21,inherits:35,"process/browser.js":26}],31:[function(e,t,n){function r(e){if(e&&!a.isEncoding(e))throw new Error("Unknown encoding: "+e)}function o(e){return e.toString(this.encoding)}function i(e){var t=this.charReceived=e.length%2;return this.charLength=t?2:0,t}function s(e){var t=this.charReceived=e.length%3;return this.charLength=t?3:0,t}var a=e("buffer").Buffer,u=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=o)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="",n=0;this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,n,r),this.charReceived+=r-n,n=r,this.charReceived<this.charLength)return"";t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var o=t.charCodeAt(t.length-1);if(!(o>=55296&&56319>=o)){if(this.charReceived=this.charLength=0,r==e.length)return t;e=e.slice(r,e.length);break}this.charLength+=this.surrogateSize,t=""}var i=this.detectIncompleteChar(e),s=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-i,s),this.charReceived=i,s-=i),t+=e.toString(this.encoding,0,s);var s=t.length-1,o=t.charCodeAt(s);if(o>=55296&&56319>=o){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(t.charAt(t.length-1),this.encoding),t.substring(0,s)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}return t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,o=this.encoding;t+=r.slice(0,n).toString(o)}return t}},{buffer:21}],32:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],33:[function(e,t,n){(function(t,r){function o(e,t){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),u(r,e,r.depth)}function i(e,t){var n=o.styles[t];return n?"["+o.colors[n][0]+"m"+e+"["+o.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&j(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var o=t.inspect(r,e);return m(o)||(o=u(e,o,r)),o}var i=c(e,t);if(i)return i;var s=Object.keys(t),g=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),x(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(j(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return l(t)}var b="",v=!1,w=["{","}"];if(p(t)&&(v=!0,w=["[","]"]),j(t)){var _=t.name?": "+t.name:"";b=" [Function"+_+"]"}if(E(t)&&(b=" "+RegExp.prototype.toString.call(t)),S(t)&&(b=" "+Date.prototype.toUTCString.call(t)),x(t)&&(b=" "+l(t)),0===s.length&&(!v||0==t.length))return w[0]+b+w[1];if(0>r)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=v?d(e,t,r,g,s):s.map(function(n){return f(e,t,r,g,n,v)}),e.seen.pop(),h(k,b,w)}function c(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return v(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,o){for(var i=[],s=0,a=t.length;a>s;++s)i.push(B(t,String(s))?f(e,t,n,r,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(f(e,t,n,r,o,!0))}),i}function f(e,t,n,r,o,i){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},c.get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),B(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=y(n)?u(e,c.value,null):u(e,c.value,n-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return"   "+e}).join("\n"))):a=e.stylize("[Circular]","special")),_(s)){if(i&&o.match(/^\d+$/))return a;s=JSON.stringify(""+o),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function h(e,t,n){var r=0,o=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function b(e){return null==e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function w(e){return"symbol"==typeof e}function _(e){return void 0===e}function E(e){return k(e)&&"[object RegExp]"===O(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===O(e)}function x(e){return k(e)&&("[object Error]"===O(e)||e instanceof Error)}function j(e){return"function"==typeof e}function L(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function O(e){return Object.prototype.toString.call(e)}function N(e){return 10>e?"0"+e.toString(10):e.toString(10)}function I(){var e=new Date,t=[N(e.getHours()),N(e.getMinutes()),N(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(o(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,i=r.length,s=String(e).replace(A,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),a=r[n];i>n;a=r[++n])s+=y(a)||!k(a)?" "+a:" "+o(a);return s},n.deprecate=function(e,o){function i(){if(!s){if(t.throwDeprecation)throw new Error(o);t.traceDeprecation?console.trace(o):console.error(o),s=!0}return e.apply(this,arguments)}if(_(r.process))return function(){return n.deprecate(e,o).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return i};var T,C={};n.debuglog=function(e){if(_(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!C[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var r=t.pid;C[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else C[e]=function(){};return C[e]},n.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=g,n.isNull=y,n.isNullOrUndefined=b,n.isNumber=v,n.isString=m,n.isSymbol=w,n.isUndefined=_,n.isRegExp=E,n.isObject=k,n.isDate=S,n.isError=x,n.isFunction=j,n.isPrimitive=L,n.isBuffer=e("./support/isBuffer");var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",I(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!k(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":32,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,inherits:35}],34:[function(e,t){"use strict";function n(e){if(this._capacity=i(e),this._length=0,this._front=0,this._makeCapacity(),s(e)){for(var t=e.length,n=0;t>n;++n)this[n]=e[n];this._length=t}}function r(e,t,n,r,o){for(var i=0;o>i;++i)n[i+r]=e[i+t]}function o(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function i(e){if("number"!=typeof e){if(!s(e))return 16;e=e.length}return o(Math.min(Math.max(16,e),1073741824))}n.prototype.toArray=function(){for(var e=this._length,t=new Array(e),n=this._front,r=this._capacity,o=0;e>o;++o)t[o]=this[n+o&r-1];return t},n.prototype.push=function(e){var t=arguments.length,n=this._length;if(t>1){var r=this._capacity;if(n+t>r){for(var o=0;t>o;++o){this._checkCapacity(n+1);var i=this._front+n&this._capacity-1;this[i]=arguments[o],n++,this._length=n}return n}for(var i=this._front,o=0;t>o;++o)this[i+n&r-1]=arguments[o],i++;return this._length=n+t,n+t}if(0===t)return n;this._checkCapacity(n+1);var o=this._front+n&this._capacity-1;return this[o]=e,this._length=n+1,n+1},n.prototype.pop=function(){var e=this._length;if(0===e)return void 0;var t=this._front+e-1&this._capacity-1,n=this[t];return this[t]=void 0,this._length=e-1,n},n.prototype.shift=function(){var e=this._length;if(0===e)return void 0;var t=this._front,n=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length=e-1,n},n.prototype.unshift=function(e){var t=this._length,n=arguments.length;if(n>1){var r=this._capacity;if(t+n>r){for(var o=n-1;o>=0;o--){this._checkCapacity(t+1);var r=this._capacity,i=(this._front-1&r-1^r)-r;this[i]=arguments[o],t++,this._length=t,this._front=i}return t}for(var s=this._front,o=n-1;o>=0;o--){var i=(s-1&r-1^r)-r;this[i]=arguments[o],s=i}return this._front=s,this._length=t+n,t+n}if(0===n)return t;this._checkCapacity(t+1);var r=this._capacity,o=(this._front-1&r-1^r)-r;return this[o]=e,this._length=t+1,this._front=o,t+1},n.prototype.peekBack=function(){var e=this._length;if(0===e)return void 0;var t=this._front+e-1&this._capacity-1;return this[t]},n.prototype.peekFront=function(){return 0===this._length?void 0:this[this._front]},n.prototype.get=function(e){var t=e;if(t!==(0|t))return void 0;var n=this._length;return 0>t&&(t+=n),0>t||t>=n?void 0:this[this._front+t&this._capacity-1]},n.prototype.isEmpty=function(){return 0===this._length},n.prototype.clear=function(){this._length=0,this._front=0,this._makeCapacity()},n.prototype.toString=function(){return this.toArray().toString()},n.prototype.valueOf=n.prototype.toString,n.prototype.removeFront=n.prototype.shift,n.prototype.removeBack=n.prototype.pop,n.prototype.insertFront=n.prototype.unshift,n.prototype.insertBack=n.prototype.push,n.prototype.enqueue=n.prototype.push,n.prototype.dequeue=n.prototype.shift,n.prototype.toJSON=n.prototype.toArray,Object.defineProperty(n.prototype,"length",{get:function(){return this._length},set:function(){throw new RangeError("")}}),n.prototype._makeCapacity=function(){for(var e=this._capacity,t=0;e>t;++t)this[t]=void 0},n.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(i(1.5*this._capacity+16))},n.prototype._resizeTo=function(e){var t=this._front,n=this._capacity,o=new Array(n),i=this._length;if(r(this,0,o,0,n),this._capacity=e,this._makeCapacity(),this._front=0,n>=t+i)r(o,t,this,0,i);else{var s=i-(t+i&n-1);r(o,t,this,0,s),r(o,0,this,s,i-s)}};var s=Array.isArray;t.exports=n},{}],35:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],36:[function(e,t){function n(e,t,n,r){var o={type:e,key:t,value:n,options:r};return r&&r.prefix&&(o.prefix=r.prefix,delete r.prefix),this._operations.push(o),this}function r(e){this._operations=[],this._sdb=e,this.put=n.bind(this,"put"),this.del=n.bind(this,"del")}var o=r.prototype;o.clear=function(){this._operations=[]},o.write=function(e){this._sdb.batch(this._operations,e)},t.exports=r},{}],37:[function(e,t){(function(n){var r=(e("events").EventEmitter,n.nextTick,e("./sub")),o=e("./batch"),i=e("level-fix-range"),s=e("level-hooks");t.exports=function(e,t){function n(){}function a(e){return function(t){return t=t||{},t=i(t),t.reverse?t.start=t.start||c:t.end=t.end||c,e.call(u,t)}}n.prototype=e;var u=new n;if(u.sublevel)return u;t=t||{};var c=t.sep=t.sep||"ÿ";u._options=t,s(u),u.sublevels={},u.sublevel=function(e,t){return u.sublevels[e]?u.sublevels[e]:new r(u,e,t||this._options)},u.methods={},u.prefix=function(e){return""+(e||"")},u.pre=function(e,t){return t||(t=e,e={max:c}),u.hooks.pre(e,t)},u.post=function(e,t){return t||(t=e,e={max:c}),u.hooks.post(e,t)},u.readStream=u.createReadStream=a(u.createReadStream),u.keyStream=u.createKeyStream=a(u.createKeyStream),u.valuesStream=u.createValueStream=a(u.createValueStream);var l=u.batch;return u.batch=function(e,t,n){return Array.isArray(e)?(e.forEach(function(e){e.prefix&&("function"==typeof e.prefix.prefix?e.key=e.prefix.prefix(e.key):"string"==typeof e.prefix&&(e.key=e.prefix+e.key))}),void l.call(u,e,t,n)):new o(u)},u}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./batch":36,"./sub":48,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,events:19,"level-fix-range":38,"level-hooks":40}],38:[function(e,t){var n=e("clone");t.exports=function(e){e=n(e);var t=e.reverse,r=e.max||e.end,o=e.min||e.start,i=[o,r];return null!=o&&null!=r&&i.sort(),t&&(i=i.reverse()),e.start=i[0],e.end=i[1],delete e.min,delete e.max,e}},{clone:39}],39:[function(e,t){(function(e){"use strict";function n(e){return Object.prototype.toString.call(e)}function r(t,n,r,i){function s(t,r){if(null===t)return null;if(0==r)return t;var l;if("object"!=typeof t)return t;if(o.isArray(t))l=[];else if(o.isRegExp(t))l=new RegExp(t.source,o.getRegExpFlags(t)),t.lastIndex&&(l.lastIndex=t.lastIndex);else if(o.isDate(t))l=new Date(t.getTime());else{if(c&&e.isBuffer(t))return l=new e(t.length),t.copy(l),l;l=Object.create("undefined"==typeof i?Object.getPrototypeOf(t):i)}if(n){var d=a.indexOf(t);if(-1!=d)return u[d];a.push(t),u.push(l)}for(var f in t)l[f]=s(t[f],r-1);return l}var a=[],u=[],c="undefined"!=typeof e;return"undefined"==typeof n&&(n=!0),"undefined"==typeof r&&(r=1/0),s(t,r)}var o={isArray:function(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===n(e)},isDate:function(e){return"object"==typeof e&&"[object Date]"===n(e)},isRegExp:function(e){return"object"==typeof e&&"[object RegExp]"===n(e)},getRegExpFlags:function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}};"object"==typeof t&&(t.exports=r),r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t}}).call(this,e("buffer").Buffer)},{buffer:21}],40:[function(e,t){var n=e("string-range");t.exports=function(e){function t(e){return e&&("string"==typeof e?e:"string"==typeof e.prefix?e.prefix:"function"==typeof e.prefix?e.prefix():"")}function r(e){return e&&e._getKeyEncoding?e._getKeyEncoding(e):void 0}function o(e){return e&&e._getValueEncoding?e._getValueEncoding(e):void 0}function i(e,t){return function(){var n=e.indexOf(t);return~n?(e.splice(n,1),!0):!1}}function s(e){e&&e.type&&u.forEach(function(t){t.test(e.key)&&t.hook(e)})}function a(n,i,s,a){try{i.forEach(function p(e,n){c.forEach(function(s){if(s.test(String(e.key))){var a={add:function(e,a){if("undefined"==typeof e)return this;if(e===!1)return delete i[n];var u=t(e.prefix)||t(a)||s.prefix||"";if(u&&(e.prefix=u),e.key=u+e.key,s.safe&&s.test(String(e.key)))throw new Error("prehook cannot insert into own range");var c=e.keyEncoding||r(e.prefix),l=e.valueEncoding||o(e.prefix);return c&&(e.keyEncoding=c),l&&(e.valueEncoding=l),i.push(e),p(e,i.length-1),this},put:function(e,t){return"object"==typeof e&&(e.type="put"),this.add(e,t)},del:function(e,t){return"object"==typeof e&&(e.type="del"),this.add(e,t)},veto:function(){return this.add(!1)}};s.hook.call(a,e,a.add,i)}})})}catch(u){return(a||s)(u)}if(i=i.filter(function(e){return e&&e.type}),1==i.length&&!n){var h=i[0];return"put"==h.type?l.call(e,h.key,h.value,s,a):d.call(e,h.key,s,a)}return f.call(e,i,s,a)}if(!e.hooks){var u=[],c=[];e.hooks={post:function(e,t){t||(t=e,e="");var r={test:n.checker(e),hook:t};return u.push(r),i(u,r)},pre:function(e,t){t||(t=e,e="");var r={test:n.checker(e),hook:t,safe:!1!==e.safe};return c.push(r),i(c,r)},posthooks:u,prehooks:c},e.on("put",function(e,t){s({type:"put",key:e,value:t})}),e.on("del",function(e,t){s({type:"del",key:e,value:t})}),e.on("batch",function(e){e.forEach(s)});var l=e.put,d=e.del,f=e.batch;e.put=function(e,t,n,r){var o=[{key:e,value:t,type:"put"}];return a(!1,o,n,r)},e.del=function(e,t,n){var r=[{key:e,type:"del"}];return a(!1,r,t,n)},e.batch=function(e,t,n){return a(!0,e,t,n)}}}},{"string-range":41}],41:[function(e,t,n){{var r=n.range=function(e){return null==e?{}:"string"==typeof r?{min:r,max:r+"ÿ"}:e},o=(n.prefix=function(e,t,r){e=n.range(e);var o={};return r=r||"ÿ",e instanceof RegExp||"function"==typeof e?(o.min=t,o.max=t+r,o.inner=function(n){var r=n.substring(t.length);return e.test?e.test(r):e(r)}):"object"==typeof e&&(o.min=t+(e.min||e.start||""),o.max=t+(e.max||e.end||r||"~"),o.reverse=!!e.reverse),o},n.checker=function(e){return e||(e={}),"string"==typeof e?function(t){return 0==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:"object"==typeof e?function(t){var n=e.min||e.start,r=e.max||e.end;return t=String(t),(!n||t>=n)&&(!r||r>=t)&&(!e.inner||(e.inner.test?e.inner.test(t):e.inner(t)))}:"function"==typeof e?e:void 0});n.satisfies=function(e,t){return o(t)(e)}}},{}],42:[function(e,t){function n(e){return null!==e&&("object"==typeof e||"function"==typeof e)}t.exports=n},{}],43:[function(e,t){function n(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];if(o(n))for(var i=r(n),s=0;s<i.length;s++){var a=i[s];e[a]=n[a]}}return e}var r=e("object-keys"),o=e("./has-keys");t.exports=n},{"./has-keys":42,"object-keys":44}],44:[function(e,t){t.exports=Object.keys||e("./shim")},{"./shim":47}],45:[function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=function(e,t,o){if("[object Function]"!==r.call(t))throw new TypeError("iterator must be a function");var i=e.length;if(i===+i)for(var s=0;i>s;s++)t.call(o,e[s],s,e);else for(var a in e)n.call(e,a)&&t.call(o,e[a],a,e)}},{}],46:[function(e,t){var n=Object.prototype,r=n.hasOwnProperty,o=n.toString,i=function(e){return e!==e},s={"boolean":1,number:1,string:1,undefined:1},a=t.exports={};a.a=a.type=function(e,t){return typeof e===t},a.defined=function(e){return void 0!==e},a.empty=function(e){var t,n=o.call(e);if("[object Array]"===n||"[object Arguments]"===n)return 0===e.length;if("[object Object]"===n){for(t in e)if(r.call(e,t))return!1;return!0}return"[object String]"===n?""===e:!1},a.equal=function(e,t){var n,r=o.call(e);if(r!==o.call(t))return!1;if("[object Object]"===r){for(n in e)if(!a.equal(e[n],t[n]))return!1;return!0}if("[object Array]"===r){if(n=e.length,n!==t.length)return!1;for(;--n;)if(!a.equal(e[n],t[n]))return!1;return!0}return"[object Function]"===r?e.prototype===t.prototype:"[object Date]"===r?e.getTime()===t.getTime():e===t},a.hosted=function(e,t){var n=typeof t[e];return"object"===n?!!t[e]:!s[n]},a.instance=a["instanceof"]=function(e,t){return e instanceof t},a["null"]=function(e){return null===e},a.undefined=function(e){return void 0===e},a.arguments=function(e){var t="[object Arguments]"===o.call(e),n=!a.array(e)&&a.arraylike(e)&&a.object(e)&&a.fn(e.callee);return t||n},a.array=function(e){return"[object Array]"===o.call(e)},a.arguments.empty=function(e){return a.arguments(e)&&0===e.length},a.array.empty=function(e){return a.array(e)&&0===e.length},a.arraylike=function(e){return!!e&&!a.boolean(e)&&r.call(e,"length")&&isFinite(e.length)&&a.number(e.length)&&e.length>=0},a.boolean=function(e){return"[object Boolean]"===o.call(e)},a["false"]=function(e){return a.boolean(e)&&(e===!1||e.valueOf()===!1)},a["true"]=function(e){return a.boolean(e)&&(e===!0||e.valueOf()===!0)},a.date=function(e){return"[object Date]"===o.call(e)},a.element=function(e){return void 0!==e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&1===e.nodeType},a.error=function(e){return"[object Error]"===o.call(e)},a.fn=a["function"]=function(e){var t="undefined"!=typeof window&&e===window.alert;return t||"[object Function]"===o.call(e)},a.number=function(e){return"[object Number]"===o.call(e)},a.infinite=function(e){return 1/0===e||e===-1/0},a.decimal=function(e){return a.number(e)&&!i(e)&&!a.infinite(e)&&e%1!==0},a.divisibleBy=function(e,t){var n=a.infinite(e),r=a.infinite(t),o=a.number(e)&&!i(e)&&a.number(t)&&!i(t)&&0!==t;return n||r||o&&e%t===0},a.int=function(e){return a.number(e)&&!i(e)&&e%1===0},a.maximum=function(e,t){if(i(e))throw new TypeError("NaN is not a valid value");if(!a.arraylike(t))throw new TypeError("second argument must be array-like");for(var n=t.length;--n>=0;)if(e<t[n])return!1;return!0},a.minimum=function(e,t){if(i(e))throw new TypeError("NaN is not a valid value");if(!a.arraylike(t))throw new TypeError("second argument must be array-like");for(var n=t.length;--n>=0;)if(e>t[n])return!1;return!0},a.nan=function(e){return!a.number(e)||e!==e},a.even=function(e){return a.infinite(e)||a.number(e)&&e===e&&e%2===0},a.odd=function(e){return a.infinite(e)||a.number(e)&&e===e&&e%2!==0},a.ge=function(e,t){if(i(e)||i(t))throw new TypeError("NaN is not a valid value");return!a.infinite(e)&&!a.infinite(t)&&e>=t},a.gt=function(e,t){if(i(e)||i(t))throw new TypeError("NaN is not a valid value");return!a.infinite(e)&&!a.infinite(t)&&e>t},a.le=function(e,t){if(i(e)||i(t))throw new TypeError("NaN is not a valid value");return!a.infinite(e)&&!a.infinite(t)&&t>=e},a.lt=function(e,t){if(i(e)||i(t))throw new TypeError("NaN is not a valid value");return!a.infinite(e)&&!a.infinite(t)&&t>e},a.within=function(e,t,n){if(i(e)||i(t)||i(n))throw new TypeError("NaN is not a valid value");if(!a.number(e)||!a.number(t)||!a.number(n))throw new TypeError("all arguments must be numbers");var r=a.infinite(e)||a.infinite(t)||a.infinite(n);return r||e>=t&&n>=e},a.object=function(e){return e&&"[object Object]"===o.call(e)},a.hash=function(e){return a.object(e)&&e.constructor===Object&&!e.nodeType&&!e.setInterval},a.regexp=function(e){return"[object RegExp]"===o.call(e)
  },a.string=function(e){return"[object String]"===o.call(e)}},{}],47:[function(e,t){!function(){"use strict";var n,r=Object.prototype.hasOwnProperty,o=e("is"),i=e("foreach"),s=!{toString:null}.propertyIsEnumerable("toString"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];n=function(e){if(!o.object(e)&&!o.array(e))throw new TypeError("Object.keys called on a non-object");var t,n=[];for(t in e)r.call(e,t)&&n.push(t);return s&&i(a,function(t){r.call(e,t)&&n.push(t)}),n},t.exports=n}()},{foreach:45,is:46}],48:[function(e,t){function n(e,t,r){if("string"==typeof r&&(console.error("db.sublevel(name, seperator<string>) is depreciated"),console.error("use db.sublevel(name, {sep: separator})) if you must"),r={sep:r}),!(this instanceof n))return new n(e,t,r);if(!e)throw new Error("must provide db");if(!t)throw new Error("must provide prefix");r=r||{},r.sep=r.sep||"ÿ",this._parent=e,this._options=r,this.options=r,this._prefix=t,this._root=o(this),e.sublevels[t]=this,this.sublevels={},this.methods={};var i=this;this.hooks={pre:function(){return i.pre.apply(i,arguments)},post:function(){return i.post.apply(i,arguments)}}}function r(e,t){["valueEncoding","encoding","keyEncoding","reverse","values","keys","limit","fillCache"].forEach(function(n){t.hasOwnProperty(n)&&(e[n]=t[n])})}function o(e){return e._parent?o(e._parent):e}var i=e("events").EventEmitter,s=e("util").inherits,a=e("string-range"),u=e("level-fix-range"),c=e("xtend"),l=e("./batch");s(n,i);var d=n.prototype;d._key=function(e){var t=this._options.sep;return t+this._prefix+t+e},d._getOptsAndCb=function(e,t){return"function"==typeof e&&(t=e,e={}),{opts:c(e,this._options),cb:t}},d.sublevel=function(e,t){return this.sublevels[e]?this.sublevels[e]:new n(this,e,t||this._options)},d.put=function(e,t,n,r){var o=this._getOptsAndCb(n,r);this._root.put(this.prefix(e),t,o.opts,o.cb)},d.get=function(e,t,n){var r=this._getOptsAndCb(t,n);this._root.get(this.prefix(e),r.opts,r.cb)},d.del=function(e,t,n){var r=this._getOptsAndCb(t,n);this._root.del(this.prefix(e),r.opts,r.cb)},d.batch=function(e,t,n){if(!Array.isArray(e))return new l(this);var r=this,o=this._getOptsAndCb(t,n);e.forEach(function(e){e.key="string"==typeof e.prefix?e.prefix+e.key:(e.prefix||r).prefix(e.key),e.prefix&&(e.prefix=null)}),this._root.batch(e,o.opts,o.cb)},d._getKeyEncoding=function(){return this.options.keyEncoding?this.options.keyEncoding:this._parent&&this._parent._getKeyEncoding?this._parent._getKeyEncoding():void 0},d._getValueEncoding=function(){return this.options.valueEncoding?this.options.valueEncoding:this._parent&&this._parent._getValueEncoding?this._parent._getValueEncoding():void 0},d.prefix=function(e){var t=this._options.sep;return this._parent.prefix()+t+this._prefix+t+(e||"")},d.keyStream=d.createKeyStream=function(e){return e=e||{},e.keys=!0,e.values=!1,this.createReadStream(e)},d.valueStream=d.createValueStream=function(e){return e=e||{},e.keys=!1,e.values=!0,e.keys=!1,this.createReadStream(e)},d.readStream=d.createReadStream=function(e){e=e||{};var t=o(this),n=this.prefix(),i=a.prefix(e,n);r(i,c(e,this._options));var s=t.createReadStream(i);if(i.values===!1){var u=s.read;if(u)s.read=function(e){var t=u.call(this,e);return t&&(t=t.substring(n.length)),t};else{var l=s.emit;s.emit=function(e,t){"data"===e?l.call(this,"data",t.substring(n.length)):l.call(this,e,t)}}return s}if(i.keys===!1)return s;var u=s.read;return u?s.read=function(e){var t=u.call(this,e);return t&&(t.key=t.key.substring(n.length)),t}:s.on("data",function(e){e.key=e.key.substring(n.length)}),s},d.writeStream=d.createWriteStream=function(){var e=o(this),t=this.prefix(),n=e.createWriteStream.apply(e,arguments),r=n.write,i=this._options.encoding,s=this._options.valueEncoding,a=this._options.keyEncoding,u=!i&&!s&&!a;return n.write=u?function(e){return e.key=t+e.key,r.call(n,e)}:function(e){return e.key=t+e.key,i&&"undefined"==typeof e.encoding&&(e.encoding=i),s&&"undefined"==typeof e.valueEncoding&&(e.valueEncoding=s),a&&"undefined"==typeof e.keyEncoding&&(e.keyEncoding=a),r.call(n,e)},n},d.approximateSize=function(){var e=o(db);return e.approximateSize.apply(e,arguments)},d.pre=function(e,t){t||(t=e,e=null),e=a.prefix(e,this.prefix(),this._options.sep);var n=o(this._parent),r=this.prefix();return n.hooks.pre(u(e),function(e,n,o){t({key:e.key.substring(r.length),value:e.value,type:e.type},function(e,t){n(e,e.prefix?t:t||r)},o)})},d.post=function(e,t){t||(t=e,e=null);var n=o(this._parent),r=this.prefix();return e=a.prefix(e,r,this._options.sep),n.hooks.post(u(e),function(e){t({key:e.key.substring(r.length),value:e.value,type:e.type})})};t.exports=n},{"./batch":36,events:19,"level-fix-range":38,"string-range":41,util:33,xtend:43}],49:[function(e,t){function n(e){this._levelup=e,this.batch=e.db.batch(),this.ops=[]}var r=e("./util"),o=e("./errors").WriteError,i=r.getOptions,s=r.dispatchError;n.prototype.put=function(e,t,n){n=i(this._levelup,n);var s=r.encodeKey(e,n),a=r.encodeValue(t,n);try{this.batch.put(s,a)}catch(u){throw new o(u)}return this.ops.push({type:"put",key:s,value:a}),this},n.prototype.del=function(e,t){t=i(this._levelup,t);var n=r.encodeKey(e,t);try{this.batch.del(n)}catch(s){throw new o(s)}return this.ops.push({type:"del",key:n}),this},n.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new o(e)}return this.ops=[],this},n.prototype.write=function(e){var t=this._levelup,n=this.ops;try{this.batch.write(function(r){return r?s(t,new o(r),e):(t.emit("batch",n),void(e&&e()))})}catch(r){throw new o(r)}},t.exports=n},{"./errors":50,"./util":53}],50:[function(e,t){var n=e("errno").create,r=n("LevelUPError"),o=n("NotFoundError",r);o.prototype.notFound=!0,o.prototype.status=404,t.exports={LevelUPError:r,InitializationError:n("InitializationError",r),OpenError:n("OpenError",r),ReadError:n("ReadError",r),WriteError:n("WriteError",r),NotFoundError:o,EncodingError:n("EncodingError",r)}},{errno:61}],51:[function(e,t){(function(n){function r(e,t){return"function"==typeof e?e:t}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var i;if(s.call(this),this.setMaxListeners(1/0),"function"==typeof e?(t="object"==typeof t?t:{},t.db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(i=new y("Must provide a location for the database"),r)return n.nextTick(function(){r(i)});throw i}t=_(this,t),this.options=u(E,t),this._status="new",c(this,"location",e,"e"),this.open(r)}function i(e){return function(t,n){k()[e](t,n||function(){})}}var s=e("events").EventEmitter,a=e("util").inherits,u=e("xtend"),c=e("prr"),l=e("deferred-leveldown"),d=e("./errors").WriteError,f=e("./errors").ReadError,h=e("./errors").NotFoundError,p=e("./errors").OpenError,g=e("./errors").EncodingError,y=e("./errors").InitializationError,b=e("./read-stream"),v=e("./write-stream"),m=e("./util"),w=e("./batch"),_=m.getOptions,E=m.defaultOptions,k=m.getLevelDOWN,S=m.dispatchError;a(o,s),o.prototype.open=function(e){var t,r,o=this;return this.isOpen()?(e&&n.nextTick(function(){e(null,o)}),this):this._isOpening()?e&&this.once("open",function(){e(null,o)}):(this.emit("opening"),this._status="opening",this.db=new l(this.location),t=this.options.db||k(),r=t(this.location),void r.open(this.options,function(t){return t?S(o,new p(t),e):(o.db.setDb(r),o.db=r,o._status="open",e&&e(null,o),o.emit("open"),o.emit("ready"),void 0)}))},o.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close(function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)}),this.emit("closing"),this.db=null;else{if("closed"==this._status&&e)return n.nextTick(e);"closing"==this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)})}},o.prototype.isOpen=function(){return"open"==this._status},o.prototype._isOpening=function(){return"opening"==this._status},o.prototype.isClosed=function(){return/^clos/.test(this._status)},o.prototype.get=function(e,t,n){var o,i=this;return n=r(t,n),"function"!=typeof n?S(this,new f("get() requires key and callback arguments")):this._isOpening()||this.isOpen()?(t=m.getOptions(this,t),o=m.encodeKey(e,t),t.asBuffer=m.isValueAsBuffer(t),void this.db.get(o,t,function(r,o){if(r)return r=/notfound/i.test(r)?new h("Key not found in database ["+e+"]",r):new f(r),S(i,r,n);if(n){try{o=m.decodeValue(o,t)}catch(s){return n(new g(s))}n(null,o)}})):S(this,new f("Database is not open"),n)},o.prototype.put=function(e,t,n,o){var i,s,a=this;return o=r(n,o),null===e||void 0===e||null===t||void 0===t?S(this,new d("put() requires key and value arguments"),o):this._isOpening()||this.isOpen()?(n=_(this,n),i=m.encodeKey(e,n),s=m.encodeValue(t,n),void this.db.put(i,s,n,function(n){return n?S(a,new d(n),o):(a.emit("put",e,t),void(o&&o()))})):S(this,new d("Database is not open"),o)},o.prototype.del=function(e,t,n){var o,i=this;return n=r(t,n),null===e||void 0===e?S(this,new d("del() requires a key argument"),n):this._isOpening()||this.isOpen()?(t=_(this,t),o=m.encodeKey(e,t),void this.db.del(o,t,function(t){return t?S(i,new d(t),n):(i.emit("del",e),void(n&&n()))})):S(this,new d("Database is not open"),n)},o.prototype.batch=function(e,t,n){var o,i,s,a=this;return arguments.length?(n=r(t,n),Array.isArray(e)?this._isOpening()||this.isOpen()?(t=_(this,t),o=t.keyEncoding,i=t.valueEncoding,s=e.map(function(e){if(void 0===e.type||void 0===e.key)return{};var n,r=e.keyEncoding||o,s=e.valueEncoding||e.encoding||i;return"utf8"!=r&&"binary"!=r||"utf8"!=s&&"binary"!=s?(n={type:e.type,key:m.encodeKey(e.key,t,e)},void 0!==e.value&&(n.value=m.encodeValue(e.value,t,e)),n):e}),void this.db.batch(s,t,function(t){return t?S(a,new d(t),n):(a.emit("batch",e),void(n&&n()))})):S(this,new d("Database is not open"),n):S(this,new d("batch() requires an array argument"),n)):new w(this)},o.prototype.approximateSize=function(e,t,n){var r,o,i=this;return null===e||void 0===e||null===t||void 0===t||"function"!=typeof n?S(this,new f("approximateSize() requires start, end and callback arguments"),n):(r=m.encodeKey(e,this.options),o=m.encodeKey(t,this.options),this._isOpening()||this.isOpen()?void this.db.approximateSize(r,o,function(e,t){return e?S(i,new p(e),n):void(n&&n(null,t))}):S(this,new d("Database is not open"),n))},o.prototype.readStream=o.prototype.createReadStream=function(e){var t=this;return e=u(this.options,e),new b(e,this,function(e){return t.db.iterator(e)})},o.prototype.keyStream=o.prototype.createKeyStream=function(e){return this.createReadStream(u(e,{keys:!0,values:!1}))},o.prototype.valueStream=o.prototype.createValueStream=function(e){return this.createReadStream(u(e,{keys:!1,values:!0}))},o.prototype.writeStream=o.prototype.createWriteStream=function(e){return new v(u(e),this)},o.prototype.toString=function(){return"LevelUP"},t.exports=o,t.exports.copy=m.copy,t.exports.destroy=i("destroy"),t.exports.repair=i("repair")}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./batch":49,"./errors":50,"./read-stream":52,"./util":53,"./write-stream":54,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,"deferred-leveldown":56,events:19,prr:62,util:33,xtend:72}],52:[function(e,t){function n(e,t,o){if(!(this instanceof n))return new n(e,t,o);r.call(this,{objectMode:!0,highWaterMark:e.highWaterMark}),this._db=t,e=this._options=i(u,e),this._keyEncoding=e.keyEncoding||e.encoding,this._valueEncoding=e.valueEncoding||e.encoding,"undefined"!=typeof this._options.start&&(this._options.start=a.encodeKey(this._options.start,this._options)),"undefined"!=typeof this._options.end&&(this._options.end=a.encodeKey(this._options.end,this._options)),"number"!=typeof this._options.limit&&(this._options.limit=-1),this._options.keyAsBuffer=a.isKeyAsBuffer(this._options),this._options.valueAsBuffer=a.isValueAsBuffer(this._options),this._makeData=this._options.keys&&this._options.values?c:this._options.keys?l:this._options.values?d:f;var s=this;this._db.isOpen()?this._iterator=o(this._options):this._db.once("ready",function(){s._destroyed||(s._iterator=o(s._options))})}var r=e("readable-stream").Readable,o=e("util").inherits,i=e("xtend"),s=e("./errors").EncodingError,a=e("./util"),u={keys:!0,values:!0},c=function(e,t){return{key:a.decodeKey(e,this._options),value:a.decodeValue(t,this._options)}},l=function(e){return a.decodeKey(e,this._options)},d=function(e,t){return a.decodeValue(t,this._options)},f=function(){return null};o(n,r),n.prototype._read=function h(){var e=this;return e._db.isOpen()?void(e._destroyed||e._iterator.next(function(t,n,r){if(t||void 0===n&&void 0===r)return t||e._destroyed||e.push(null),e._cleanup(t);try{r=e._makeData(n,r)}catch(o){return e._cleanup(new s(o))}e._destroyed||e.push(r)})):e._db.once("ready",function(){h.call(e)})},n.prototype._cleanup=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;e&&t.emit("error",e),t._iterator?t._iterator.end(function(){t._iterator=null,t.emit("close")}):t.emit("close")}},n.prototype.destroy=function(){this._cleanup()},n.prototype.toString=function(){return"LevelUP.ReadStream"},t.exports=n},{"./errors":50,"./util":53,"readable-stream":71,util:33,xtend:72}],53:[function(e,t){(function(n,r){function o(e,t,n){e.readStream().pipe(t.writeStream()).on("close",n?n:function(){}).on("error",n?n:function(e){throw e})}function i(e,t){var n="string"==typeof t;return!n&&t&&t.encoding&&!t.valueEncoding&&(t.valueEncoding=t.encoding),b(e&&e.options||{},n?E[t]||E[w.valueEncoding]:t)}function s(){if(y)return y;var t,n=e("../package.json").devDependencies.leveldown,r="Could not locate LevelDOWN, try `npm install leveldown`";try{t=e("leveldown/package").version}catch(o){throw new v(r)}if(!e("semver").satisfies(t,n))throw new v("Installed version of LevelDOWN ("+t+") does not match required version ("+n+")");try{return y=e("leveldown")}catch(o){throw new v(r)}}function a(e,t,n){return"function"==typeof n?n(t):e.emit("error",t)}function u(e,t){var n=t&&t.keyEncoding||e.keyEncoding||"utf8";return _[n]||n}function c(e,t){var n=t&&(t.valueEncoding||t.encoding)||e.valueEncoding||e.encoding||"utf8";return _[n]||n}function l(e,t,n){return u(t,n).encode(e)}function d(e,t,n){return c(t,n).encode(e)}function f(e,t){return u(t).decode(e)}function h(e,t){return c(t).decode(e)}function p(e,t){return c(e,t).buffer}function g(e,t){return u(e,t).buffer}var y,b=e("xtend"),v=e("./errors").LevelUPError,m=["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le"],w={createIfMissing:!0,errorIfExists:!1,keyEncoding:"utf8",valueEncoding:"utf8",compression:!0},_=function(){function e(e){return void 0===e||null===e||r.isBuffer(e)}var t={};return t.utf8=t["utf-8"]={encode:function(t){return e(t)?t:String(t)},decode:function(e){return e},buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},m.forEach(function(o){t[o]||(t[o]={encode:function(t){return e(t)?t:new r(t,o)},decode:function(e){return n.browser?e.toString(o):e},buffer:!0,type:o})}),t}(),E=function(){var e={};return m.forEach(function(t){e[t]={valueEncoding:t}}),e}();t.exports={defaultOptions:w,copy:o,getOptions:i,getLevelDOWN:s,dispatchError:a,encodeKey:l,encodeValue:d,isValueAsBuffer:p,isKeyAsBuffer:g,decodeValue:h,decodeKey:f}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),e("buffer").Buffer)},{"../package.json":73,"./errors":50,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,leveldown:"IG9xsc","leveldown/package":18,semver:18,xtend:72}],54:[function(e,t){(function(n,r){function o(e,t){if(!(this instanceof o))return new o(e,t);i.call(this),this._options=a(d,l(t,e)),this._db=t,this._buffer=[],this._status="init",this._end=!1,this.writable=!0,this.readable=!1;var n=this,r=function(){n.writable&&(n._status="ready",n.emit("ready"),n._process())};t.isOpen()?c(r):t.once("ready",r)}var i=e("stream").Stream,s=e("util").inherits,a=e("xtend"),u=e("bl"),c=r.setImmediate||n.nextTick,l=e("./util").getOptions,d={type:"put"};s(o,i),o.prototype.write=function(e){return this.writable?(this._buffer.push(e),"init"!=this._status&&this._processDelayed(),this._options.maxBufferLength&&this._buffer.length>this._options.maxBufferLength?(this._writeBlock=!0,!1):!0):!1},o.prototype.end=function(e){var t=this;e&&this.write(e),c(function(){t._end=!0,t._process()})},o.prototype.destroy=function(){this.writable=!1,this.end()},o.prototype.destroySoon=function(){this.end()},o.prototype.add=function(e){return e.props?(e.props.Directory?e.pipe(this._db.writeStream(this._options)):(e.props.File||e.File||"File"==e.type)&&this._write(e),!0):void 0},o.prototype._processDelayed=function(){var e=this;c(function(){e._process()})},o.prototype._process=function(){var e,t=this,n=function(e){return t.writable?("closed"!=t._status&&(t._status="ready"),e?(t.writable=!1,t.emit("error",e)):void t._process()):void 0};return"ready"!=t._status&&t.writable?void(t._buffer.length&&"closed"!=t._status&&t._processDelayed()):t._buffer.length&&t.writable?(t._status="writing",e=t._buffer,t._buffer=[],t._db.batch(e.map(function(e){return{type:e.type||t._options.type,key:e.key,value:e.value,keyEncoding:e.keyEncoding||t._options.keyEncoding,valueEncoding:e.valueEncoding||e.encoding||t._options.valueEncoding}}),n),void(t._writeBlock&&(t._writeBlock=!1,t.emit("drain")))):void(t._end&&"closed"!=t._status&&(t._status="closed",t.writable=!1,t.emit("close")))},o.prototype._write=function(e){var t=e.path||e.props.path,n=this;t&&e.pipe(u(function(e,r){return e?(n.writable=!1,n.emit("error",e)):(n._options.fstreamRoot&&t.indexOf(n._options.fstreamRoot)>-1&&(t=t.substr(n._options.fstreamRoot.length+1)),void n.write({key:t,value:r.slice(0)}))}))},o.prototype.toString=function(){return"LevelUP.WriteStream"},t.exports=o}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./util":53,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,bl:55,stream:25,util:33,xtend:72}],55:[function(e,t){(function(n){function r(e){if(!(this instanceof r))return new r(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)})}else n.isBuffer(e)?this.append(e):Array.isArray(e)&&e.forEach(function(e){n.isBuffer(e)&&this.append(e)}.bind(this));o.call(this)}var o=e("readable-stream").Duplex,i=e("util");i.inherits(r,o),r.prototype._offset=function(e){for(var t,n=0,r=0;r<this._bufs.length;r++){if(t=n+this._bufs[r].length,t>e)return[r,e-n];n=t}},r.prototype.append=function(e){return this._bufs.push(n.isBuffer(e)?e:new n(e)),this.length+=e.length,this},r.prototype._write=function(e,t,n){this.append(e),n&&n()},r.prototype._read=function(e){return this.length?(e=Math.min(e,this.length),this.push(this.slice(0,e)),void this.consume(e)):this.push(null)},r.prototype.end=function(e){o.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype.get=function(e){return this.slice(e,e+1)[0]},r.prototype.slice=function(e,t){return this.copy(null,0,e,t)},r.prototype.copy=function(e,t,r,o){if(("number"!=typeof r||0>r)&&(r=0),("number"!=typeof o||o>this.length)&&(o=this.length),r>=this.length)return e||new n(0);if(0>=o)return e||new n(0);var i,s,a=!!e,u=this._offset(r),c=o-r,l=c,d=a&&t||0,f=u[1];if(0===r&&o==this.length){if(!a)return n.concat(this._bufs);for(s=0;s<this._bufs.length;s++)this._bufs[s].copy(e,d),d+=this._bufs[s].length;return e}if(l<=this._bufs[u[0]].length-f)return a?this._bufs[u[0]].copy(e,t,f,f+l):this._bufs[u[0]].slice(f,f+l);for(a||(e=new n(c)),s=u[0];s<this._bufs.length;s++){if(i=this._bufs[s].length-f,!(l>i)){this._bufs[s].copy(e,d,f,f+l);break}this._bufs[s].copy(e,d,f),d+=i,l-=i,f&&(f=0)}return e},r.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},r.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},r.prototype.duplicate=function(){for(var e=0,t=new r;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},r.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},function(){var e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};for(var t in e)!function(t){r.prototype[t]=function(n){return this.slice(n,n+e[t])[t](0)}}(t)}(),t.exports=r}).call(this,e("buffer").Buffer)},{buffer:21,"readable-stream":71,util:33}],56:[function(e,t){(function(n,r){function o(e){s.call(this,"string"==typeof e?e:""),this._db=void 0,this._operations=[]}var i=e("util"),s=e("abstract-leveldown").AbstractLevelDOWN;i.inherits(o,s),o.prototype.setDb=function(e){this._db=e,this._operations.forEach(function(t){e[t.method].apply(e,t.args)})},o.prototype._open=function(e,t){return n.nextTick(t)},o.prototype._operation=function(e,t){return this._db?this._db[e].apply(this._db,t):void this._operations.push({method:e,args:t})},"put get del batch approximateSize".split(" ").forEach(function(e){o.prototype["_"+e]=function(){this._operation(e,arguments)}}),o.prototype._isBuffer=function(e){return r.isBuffer(e)},o.prototype._iterator=function(){throw new TypeError("not implemented")},t.exports=o}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),e("buffer").Buffer)},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,"abstract-leveldown":59,buffer:21,util:33}],57:[function(e,t){(function(e){function n(e){this._db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this._db._checkKeyValue(e,"key",this._db._isBuffer);if(n)throw n;if(n=this._db._checkKeyValue(t,"value",this._db._isBuffer))throw n;return this._db._isBuffer(e)||(e=String(e)),this._db._isBuffer(t)||(t=String(t)),"function"==typeof this._put?this._put(e,t):this._operations.push({type:"put",key:e,value:t}),this},n.prototype.del=function(e){this._checkWritten();var t=this._db._checkKeyValue(e,"key",this._db._isBuffer);if(t)throw t;return this._db._isBuffer(e)||(e=String(e)),"function"==typeof this._del?this._del(e):this._operations.push({type:"del",key:e}),this},n.prototype.clear=function(){return this._checkWritten(),this._operations=[],"function"==typeof this._clear&&this._clear(),this},n.prototype.write=function(t,n){if(this._checkWritten(),"function"==typeof t&&(n=t),"function"!=typeof n)throw new Error("write() requires a callback argument");return"object"!=typeof t&&(t={}),this._written=!0,"function"==typeof this._write?this._write(n):"function"==typeof this._db._batch?this._db._batch(this._operations,t,n):void e.nextTick(n)},t.exports=n}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],58:[function(e,t){(function(e){function n(e){this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(t){var n=this;if("function"!=typeof t)throw new Error("next() requires a callback argument");return n._ended?t(new Error("cannot call next() after end()")):n._nexting?t(new Error("cannot call next() before previous next() has completed")):(n._nexting=!0,"function"==typeof n._next?n._next(function(){n._nexting=!1,t.apply(null,arguments)}):void e.nextTick(function(){n._nexting=!1,t()}))},n.prototype.end=function(t){if("function"!=typeof t)throw new Error("end() requires a callback argument");return this._ended?t(new Error("end() already called on iterator")):(this._ended=!0,"function"==typeof this._end?this._end(t):void e.nextTick(t))},t.exports=n}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],59:[function(e,t){(function(n,r){function o(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e}var i=e("xtend"),s=e("./abstract-iterator"),a=e("./abstract-chained-batch");o.prototype.open=function(e,t){if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");return"object"!=typeof e&&(e={}),"function"==typeof this._open?this._open(e,t):void n.nextTick(t)},o.prototype.close=function(e){if("function"!=typeof e)throw new Error("close() requires a callback argument");return"function"==typeof this._close?this._close(e):void n.nextTick(e)},o.prototype.get=function(e,t,r){var o;if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("get() requires a callback argument");return(o=this._checkKeyValue(e,"key",this._isBuffer))?r(o):(this._isBuffer(e)||(e=String(e)),"object"!=typeof t&&(t={}),"function"==typeof this._get?this._get(e,t,r):void n.nextTick(function(){r(new Error("NotFound"))}))},o.prototype.put=function(e,t,r,o){var i;if("function"==typeof r&&(o=r),"function"!=typeof o)throw new Error("put() requires a callback argument");return(i=this._checkKeyValue(e,"key",this._isBuffer))?o(i):(i=this._checkKeyValue(t,"value",this._isBuffer))?o(i):(this._isBuffer(e)||(e=String(e)),this._isBuffer(t)||n.browser||(t=String(t)),"object"!=typeof r&&(r={}),"function"==typeof this._put?this._put(e,t,r,o):void n.nextTick(o))},o.prototype.del=function(e,t,r){var o;if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("del() requires a callback argument");return(o=this._checkKeyValue(e,"key",this._isBuffer))?r(o):(this._isBuffer(e)||(e=String(e)),"object"!=typeof t&&(t={}),"function"==typeof this._del?this._del(e,t,r):void n.nextTick(r))},o.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));"object"!=typeof t&&(t={});for(var o,i,s=0,a=e.length;a>s;s++)if(o=e[s],"object"==typeof o){if(i=this._checkKeyValue(o.type,"type",this._isBuffer))return r(i);if(i=this._checkKeyValue(o.key,"key",this._isBuffer))return r(i);if("put"==o.type&&(i=this._checkKeyValue(o.value,"value",this._isBuffer)))return r(i)}return"function"==typeof this._batch?this._batch(e,t,r):void n.nextTick(r)},o.prototype.approximateSize=function(e,t,r){if(null==e||null==t||"function"==typeof e||"function"==typeof t)throw new Error("approximateSize() requires valid `start`, `end` and `callback` arguments");if("function"!=typeof r)throw new Error("approximateSize() requires a callback argument");return this._isBuffer(e)||(e=String(e)),this._isBuffer(t)||(t=String(t)),"function"==typeof this._approximateSize?this._approximateSize(e,t,r):void n.nextTick(function(){r(null,0)})},o.prototype._setupIteratorOptions=function(e){var t=this;return e=i(e),["start","end","gt","gte","lt","lte"].forEach(function(n){e[n]&&t._isBuffer(e[n])&&0===e[n].length&&delete e[n]}),e.reverse=!!e.reverse,e.reverse&&e.lt&&(e.start=e.lt),e.reverse&&e.lte&&(e.start=e.lte),!e.reverse&&e.gt&&(e.start=e.gt),!e.reverse&&e.gte&&(e.start=e.gte),(e.reverse&&e.lt&&!e.lte||!e.reverse&&e.gt&&!e.gte)&&(e.exclusiveStart=!0),e},o.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),"function"==typeof this._iterator?this._iterator(e):new s(this)},o.prototype._chainedBatch=function(){return new a(this)},o.prototype._isBuffer=function(e){return r.isBuffer(e)},o.prototype._checkKeyValue=function(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(this._isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")},t.exports.AbstractLevelDOWN=o,t.exports.AbstractIterator=s,t.exports.AbstractChainedBatch=a}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),e("buffer").Buffer)},{"./abstract-chained-batch":57,"./abstract-iterator":58,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,xtend:72}],60:[function(e,t){function n(e,t,n){i(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t&&"string"!=typeof t?t.message:t},"ewr")}function r(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),n.call(this,"CustomError",e,t)}function o(e,t,o){var i=function(r,o){n.call(this,t,r,o),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee)};return i.prototype=o?new o:new r,i}var i=e("prr");r.prototype=new Error,t.exports=function(e){var t=function(t,n){return o(e,t,n)};return{CustomError:r,FilesystemError:t("FilesystemError"),createError:t}}},{prr:62}],61:[function(e,t){var n=t.exports.all=[{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];
  t.exports.errno={"-1":n[0],0:n[1],1:n[2],2:n[3],3:n[4],4:n[5],5:n[6],6:n[7],7:n[8],8:n[9],9:n[10],10:n[11],11:n[12],12:n[13],13:n[14],14:n[15],15:n[16],16:n[17],17:n[18],18:n[19],19:n[20],20:n[21],21:n[22],22:n[23],23:n[24],24:n[25],25:n[26],26:n[27],27:n[28],28:n[29],29:n[30],31:n[31],32:n[32],33:n[33],34:n[34],35:n[35],36:n[36],37:n[37],38:n[38],39:n[39],40:n[40],41:n[41],42:n[42],44:n[43],45:n[44],46:n[45],47:n[46],48:n[47],49:n[48],50:n[49],51:n[50],52:n[51],53:n[52],54:n[53],55:n[54],56:n[55],57:n[56],58:n[57],59:n[58]},t.exports.code={UNKNOWN:n[0],OK:n[1],EOF:n[2],EADDRINFO:n[3],EACCES:n[4],EAGAIN:n[5],EADDRINUSE:n[6],EADDRNOTAVAIL:n[7],EAFNOSUPPORT:n[8],EALREADY:n[9],EBADF:n[10],EBUSY:n[11],ECONNABORTED:n[12],ECONNREFUSED:n[13],ECONNRESET:n[14],EDESTADDRREQ:n[15],EFAULT:n[16],EHOSTUNREACH:n[17],EINTR:n[18],EINVAL:n[19],EISCONN:n[20],EMFILE:n[21],EMSGSIZE:n[22],ENETDOWN:n[23],ENETUNREACH:n[24],ENFILE:n[25],ENOBUFS:n[26],ENOMEM:n[27],ENOTDIR:n[28],EISDIR:n[29],ENONET:n[30],ENOTCONN:n[31],ENOTSOCK:n[32],ENOTSUP:n[33],ENOENT:n[34],ENOSYS:n[35],EPIPE:n[36],EPROTO:n[37],EPROTONOSUPPORT:n[38],EPROTOTYPE:n[39],ETIMEDOUT:n[40],ECHARSET:n[41],EAIFAMNOSUPPORT:n[42],EAISERVICE:n[43],EAISOCKTYPE:n[44],ESHUTDOWN:n[45],EEXIST:n[46],ESRCH:n[47],ENAMETOOLONG:n[48],EPERM:n[49],ELOOP:n[50],EXDEV:n[51],ENOTEMPTY:n[52],ENOSPC:n[53],EIO:n[54],EROFS:n[55],ENODEV:n[56],ESPIPE:n[57],ECANCELED:n[58]},t.exports.custom=e("./custom")(t.exports),t.exports.create=t.exports.custom.createError},{"./custom":60}],62:[function(e,t){!function(e,n,r){"undefined"!=typeof t&&t.exports?t.exports=r():n[e]=r()}("prr",this,function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,o=function(e){return n?!!t[e]:r?t.indexOf(e[0])>-1:!1};return{enumerable:o("enumerable"),configurable:o("configurable"),writable:o("writable"),value:e}},n=function(n,r,o,i){var s;if(i=t(o,i),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(i.value=r[s],e(n,s,i));return n}return e(n,r,i)};return n})},{}],63:[function(e,t){(function(n){function r(e){return this instanceof r?(u.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",o)):new r(e)}function o(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function i(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}t.exports=r;var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},a=e("core-util-is");a.inherits=e("inherits");var u=e("./_stream_readable"),c=e("./_stream_writable");a.inherits(r,u),i(s(c.prototype),function(e){r.prototype[e]||(r.prototype[e]=c.prototype[e])})}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./_stream_readable":65,"./_stream_writable":67,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,"core-util-is":68,inherits:35}],64:[function(e,t){function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform"),o=e("core-util-is");o.inherits=e("inherits"),o.inherits(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":66,"core-util-is":68,inherits:35}],65:[function(e,t){(function(n){function r(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(O||(O=e("string_decoder/").StringDecoder),this.decoder=new O(t.encoding),this.encoding=t.encoding)}function o(e){return this instanceof o?(this._readableState=new r(e,this),this.readable=!0,void j.call(this)):new o(e)}function i(e,t,n,r,o){var i=c(t,n);if(i)e.emit("error",i);else if(null===n||void 0===n)t.reading=!1,t.ended||l(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!o){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&o){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||o||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&d(e),h(e,t);else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=N)e=N;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?d(e):w(e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){f(e)}):f(e))}function f(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function g(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&y(e)}}function y(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):_(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(x.listenerCount(e,"data")>0&&v(e))):void(r.ranOut=!0)}function b(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function v(e,t){var r=e._readableState;if(r.flowing)throw new Error("Cannot switch to old mode now.");var o=t||!1,i=!1;e.readable=!0,e.pipe=j.prototype.pipe,e.on=e.addListener=j.prototype.on,e.on("readable",function(){i=!0;for(var t;!o&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){o=!0,this.emit("pause")},e.resume=function(){o=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,o=t.length,i=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===o)n=null;else if(s)n=r.shift();else if(!e||e>=o)n=i?r.join(""):S.concat(r,o),r.length=0;else if(e<r[0].length){var a=r[0];n=a.slice(0,e),r[0]=a.slice(e)}else if(e===r[0].length)n=r.shift();else{n=i?"":new S(e);for(var u=0,c=0,l=r.length;l>c&&e>u;c++){var a=r[0],d=Math.min(e-u,a.length);i?n+=a.slice(0,d):a.copy(n,u,0,d),d<a.length?r[0]=a.slice(d):r.shift(),u+=d}}return n}function w(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function _(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function E(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=o;var k=e("isarray"),S=e("buffer").Buffer;o.ReadableState=r;var x=e("events").EventEmitter;x.listenerCount||(x.listenerCount=function(e,t){return e.listeners(t).length});var j=e("stream"),L=e("core-util-is");L.inherits=e("inherits");var O;L.inherits(o,j),o.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new S(e,t),t="")),i(this,n,e,t,!1)},o.prototype.unshift=function(e){var t=this._readableState;return i(this,t,e,"",!0)},o.prototype.setEncoding=function(t){O||(O=e("string_decoder/").StringDecoder),this._readableState.decoder=new O(t),this._readableState.encoding=t};var N=8388608;o.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n,r=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=m(e,t),t.length-=n.length),0===t.length&&w(this),n;var o=t.needReadable;return t.length-e<=t.highWaterMark&&(o=!0),(t.ended||t.reading)&&(o=!1),o&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),o&&!t.reading&&(e=u(r,t)),n=e>0?m(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&w(this),n},o.prototype._read=function(){this.emit("error",new Error("not implemented"))},o.prototype.pipe=function(e,t){function r(e){e===l&&i()}function o(){e.end()}function i(){e.removeListener("close",a),e.removeListener("finish",u),e.removeListener("drain",p),e.removeListener("error",s),e.removeListener("unpipe",r),l.removeListener("end",o),l.removeListener("end",i),(!e._writableState||e._writableState.needDrain)&&p()}function s(t){c(),e.removeListener("error",s),0===x.listenerCount(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",u),c()}function u(){e.removeListener("close",a),c()}function c(){l.unpipe(e)}var l=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1;var f=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,h=f?o:i;d.endEmitted?n.nextTick(h):l.once("end",h),e.on("unpipe",r);var p=g(l);return e.on("drain",p),e._events&&e._events.error?k(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",a),e.once("finish",u),e.emit("pipe",l),d.flowing||(this.on("readable",b),d.flowing=!0,n.nextTick(function(){y(l)})),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",b),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",b),t.flowing=!1;for(var o=0;r>o;o++)n[o].emit("unpipe",this);return this}var o=E(t.pipes,e);return-1===o?this:(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},o.prototype.on=function(e,t){var n=j.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||v(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&d(this,r):this.read(0))}return n},o.prototype.addListener=o.prototype.on,o.prototype.resume=function(){v(this),this.read(0),this.emit("resume")},o.prototype.pause=function(){v(this,!0),this.emit("pause")},o.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(o){if(t.decoder&&(o=t.decoder.write(o)),(!t.objectMode||null!==o&&void 0!==o)&&(t.objectMode||o&&o.length)){var i=r.push(o);i||(n=!0,e.pause())}});for(var o in e)"function"==typeof e[o]&&"undefined"==typeof this[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));var i=["error","close","destroy","pause","resume"];return _(i,function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(){n&&(n=!1,e.resume())},r},o._fromList=m}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,"core-util-is":68,events:19,inherits:35,isarray:69,stream:25,"string_decoder/":70}],66:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return r(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,n){var r=e._transformState;r.transforming=!1;var o=r.writecb;if(!o)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&e.push(n),o&&o(t);var i=e._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&e._read(i.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);s.call(this,e);var t=(this._transformState=new n(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){i(t,e)}):i(t)})}function i(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=(e._readableState,e._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=o;var s=e("./_stream_duplex"),a=e("core-util-is");a.inherits=e("inherits"),a.inherits(o,s),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},o.prototype._transform=function(){throw new Error("not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},o.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":63,"core-util-is":68,inherits:35}],67:[function(e,t){(function(n){function r(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function o(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){h(t,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.errorEmitted=!1}function i(t){var n=e("./_stream_duplex");return this instanceof i||this instanceof n?(this._writableState=new o(t,this),this.writable=!0,void E.call(this)):new i(t)}function s(e,t,r){var o=new Error("write after end");e.emit("error",o),n.nextTick(function(){r(o)})}function a(e,t,r,o){var i=!0;if(!w.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),n.nextTick(function(){o(s)}),i=!1}return i}function u(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new w(t,n)),t}function c(e,t,n,o,i){n=u(t,n,o),w.isBuffer(n)&&(o="buffer");var s=t.objectMode?1:n.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing?t.buffer.push(new r(n,o,i)):l(e,t,s,n,o,i),a}function l(e,t,n,r,o,i){t.writelen=n,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,o,t.onwrite),t.sync=!1}function d(e,t,r,o,i){r?n.nextTick(function(){i(o)}):i(o),e._writableState.errorEmitted=!0,e.emit("error",o)}function f(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function h(e,t){var r=e._writableState,o=r.sync,i=r.writecb;if(f(r),t)d(e,r,o,t,i);else{var s=b(e,r);s||r.bufferProcessing||!r.buffer.length||y(e,r),o?n.nextTick(function(){p(e,r,s,i)}):p(e,r,s,i)}}function p(e,t,n,r){n||g(e,t),r(),n&&v(e,t)}function g(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function y(e,t){t.bufferProcessing=!0;for(var n=0;n<t.buffer.length;n++){var r=t.buffer[n],o=r.chunk,i=r.encoding,s=r.callback,a=t.objectMode?1:o.length;if(l(e,t,a,o,i,s),t.writing){n++;break}}t.bufferProcessing=!1,n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}function b(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function v(e,t){var n=b(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function m(e,t,r){t.ending=!0,v(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0}t.exports=i;var w=e("buffer").Buffer;i.WritableState=o;var _=e("core-util-is");_.inherits=e("inherits");var E=e("stream");_.inherits(i,E),i.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},i.prototype.write=function(e,t,n){var r=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),w.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=function(){}),r.ended?s(this,r,n):a(this,r,e,n)&&(o=c(this,r,e,t,n)),o},i.prototype._write=function(e,t,n){n(new Error("not implemented"))},i.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),r.ending||r.finished||m(this,r,n)}}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./_stream_duplex":63,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,"core-util-is":68,inherits:35,stream:25}],68:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function r(e){return"boolean"==typeof e}function o(e){return null===e}function i(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function l(e){return d(e)&&"[object RegExp]"===b(e)}function d(e){return"object"==typeof e&&null!==e}function f(e){return d(e)&&"[object Date]"===b(e)}function h(e){return d(e)&&("[object Error]"===b(e)||e instanceof Error)}function p(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function y(t){return e.isBuffer(t)}function b(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=r,n.isNull=o,n.isNullOrUndefined=i,n.isNumber=s,n.isString=a,n.isSymbol=u,n.isUndefined=c,n.isRegExp=l,n.isObject=d,n.isDate=f,n.isError=h,n.isFunction=p,n.isPrimitive=g,n.isBuffer=y}).call(this,e("buffer").Buffer)},{buffer:21}],69:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],70:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function o(e){return e.toString(this.encoding)}function i(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=e("buffer").Buffer,u=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=o)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(!(r>=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var o=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,o),o-=this.charReceived),t+=e.toString(this.encoding,0,o);var o=t.length-1,r=t.charCodeAt(o);if(r>=55296&&56319>=r){var i=this.surrogateSize;return this.charLength+=i,this.charReceived+=i,this.charBuffer.copy(this.charBuffer,i,0,i),e.copy(this.charBuffer,0,0,i),t.substring(0,o)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,o=this.encoding;t+=r.slice(0,n).toString(o)}return t}},{buffer:21}],71:[function(e,t,n){var r=e("stream");n=t.exports=e("./lib/_stream_readable.js"),n.Stream=r,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":63,"./lib/_stream_passthrough.js":64,"./lib/_stream_readable.js":65,"./lib/_stream_transform.js":66,"./lib/_stream_writable.js":67,stream:25}],72:[function(e,t){function n(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}t.exports=n},{}],73:[function(e,t){t.exports={name:"levelup",description:"Fast & simple storage - a Node.js-style LevelDB wrapper",version:"0.18.6",contributors:[{name:"Rod Vagg",email:"r@va.gg",url:"https://github.com/rvagg"},{name:"John Chesley",email:"john@chesl.es",url:"https://github.com/chesles/"},{name:"Jake Verbaten",email:"raynos2@gmail.com",url:"https://github.com/raynos"},{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"https://github.com/dominictarr"},{name:"Max Ogden",email:"max@maxogden.com",url:"https://github.com/maxogden"},{name:"Lars-Magnus Skog",email:"lars.magnus.skog@gmail.com",url:"https://github.com/ralphtheninja"},{name:"David Björklund",email:"david.bjorklund@gmail.com",url:"https://github.com/kesla"},{name:"Julian Gruber",email:"julian@juliangruber.com",url:"https://github.com/juliangruber"},{name:"Paolo Fragomeni",email:"paolo@async.ly",url:"https://github.com/hij1nx"},{name:"Anton Whalley",email:"anton.whalley@nearform.com",url:"https://github.com/No9"},{name:"Matteo Collina",email:"matteo.collina@gmail.com",url:"https://github.com/mcollina"},{name:"Pedro Teixeira",email:"pedro.teixeira@gmail.com",url:"https://github.com/pgte"},{name:"James Halliday",email:"mail@substack.net",url:"https://github.com/substack"}],repository:{type:"git",url:"https://github.com/rvagg/node-levelup.git"},homepage:"https://github.com/rvagg/node-levelup",keywords:["leveldb","stream","database","db","store","storage","json"],main:"lib/levelup.js",dependencies:{bl:"~0.8.1","deferred-leveldown":"~0.2.0",errno:"~0.1.1",prr:"~0.0.0","readable-stream":"~1.0.26",semver:"~2.3.1",xtend:"~3.0.0"},devDependencies:{leveldown:"~0.10.0",bustermove:"*",tap:"*",referee:"*",rimraf:"*",async:"*",fstream:"*",tar:"*",mkfiletree:"*",readfiletree:"*","slow-stream":">=0.0.4",delayed:"*",boganipsum:"*",du:"*",memdown:"*","msgpack-js":"*"},browser:{leveldown:!1,"leveldown/package":!1,semver:!1},scripts:{test:"tap test/*-test.js --stderr",functionaltests:"node ./test/functional/fstream-test.js && node ./test/functional/binary-data-test.js && node ./test/functional/compat-test.js",alltests:"npm test && npm run-script functionaltests"},license:"MIT",readme:"LevelUP\n=======\n\n![LevelDB Logo](https://0.gravatar.com/avatar/a498b122aecb7678490a38bb593cc12d)\n\n**Fast & simple storage - a Node.js-style LevelDB wrapper**\n\n[![Build Status](https://secure.travis-ci.org/rvagg/node-levelup.png)](http://travis-ci.org/rvagg/node-levelup)\n\n[![NPM](https://nodei.co/npm/levelup.png?stars&downloads)](https://nodei.co/npm/levelup/) [![NPM](https://nodei.co/npm-dl/levelup.png)](https://nodei.co/npm/levelup/)\n\n\n  * <a href=\"#intro\">Introduction</a>\n  * <a href=\"#leveldown\">Relationship to LevelDOWN</a>\n  * <a href=\"#platforms\">Tested &amp; supported platforms</a>\n  * <a href=\"#basic\">Basic usage</a>\n  * <a href=\"#api\">API</a>\n  * <a href=\"#events\">Events</a>\n  * <a href=\"#json\">JSON data</a>\n  * <a href=\"#custom_encodings\">Custom encodings</a>\n  * <a href=\"#extending\">Extending LevelUP</a>\n  * <a href=\"#multiproc\">Multi-process access</a>\n  * <a href=\"#support\">Getting support</a>\n  * <a href=\"#contributing\">Contributing</a>\n  * <a href=\"#licence\">Licence &amp; copyright</a>\n\n<a name=\"intro\"></a>\nIntroduction\n------------\n\n**[LevelDB](http://code.google.com/p/leveldb/)** is a simple key/value data store built by Google, inspired by BigTable. It's used in Google Chrome and many other products. LevelDB supports arbitrary byte arrays as both keys and values, singular *get*, *put* and *delete* operations, *batched put and delete*, bi-directional iterators and simple compression using the very fast [Snappy](http://code.google.com/p/snappy/) algorithm.\n\n**LevelUP** aims to expose the features of LevelDB in a **Node.js-friendly way**. All standard `Buffer` encoding types are supported, as is a special JSON encoding. LevelDB's iterators are exposed as a Node.js-style **readable stream** a matching **writeable stream** converts writes to *batch* operations.\n\nLevelDB stores entries **sorted lexicographically by keys**. This makes LevelUP's <a href=\"#createReadStream\"><code>ReadStream</code></a> interface a very powerful query mechanism.\n\n**LevelUP** is an **OPEN Open Source Project**, see the <a href=\"#contributing\">Contributing</a> section to find out what this means.\n\n<a name=\"leveldown\"></a>\nRelationship to LevelDOWN\n-------------------------\n\nLevelUP is designed to be backed by **[LevelDOWN](https://github.com/rvagg/node-leveldown/)** which provides a pure C++ binding to LevelDB and can be used as a stand-alone package if required.\n\n**As of version 0.9, LevelUP no longer requires LevelDOWN as a dependency so you must `npm install leveldown` when you install LevelUP.**\n\nLevelDOWN is now optional because LevelUP can be used with alternative backends, such as **[level.js](https://github.com/maxogden/level.js)** in the browser or [MemDOWN](https://github.com/rvagg/node-memdown) for a pure in-memory store.\n\nLevelUP will look for LevelDOWN and throw an error if it can't find it in its Node `require()` path. It will also tell you if the installed version of LevelDOWN is incompatible.\n\n**The [level](https://github.com/level/level) package is available as an alternative installation mechanism.** Install it instead to automatically get both LevelUP & LevelDOWN. It exposes LevelUP on its export (i.e. you can `var leveldb = require('level')`).\n\n\n<a name=\"platforms\"></a>\nTested & supported platforms\n----------------------------\n\n  * **Linux**: including ARM platforms such as Raspberry Pi *and Kindle!*\n  * **Mac OS**\n  * **Solaris**: including Joyent's SmartOS & Nodejitsu\n  * **Windows**: Node 0.10 and above only. See installation instructions for *node-gyp's* dependencies [here](https://github.com/TooTallNate/node-gyp#installation), you'll need these (free) components from Microsoft to compile and run any native Node add-on in Windows.\n\n<a name=\"basic\"></a>\nBasic usage\n-----------\n\nFirst you need to install LevelUP!\n\n```sh\n$ npm install levelup leveldown\n```\n\nOr\n\n```sh\n$ npm install level\n```\n\n*(this second option requires you to use LevelUP by calling `var levelup = require('level')`)*\n\n\nAll operations are asynchronous although they don't necessarily require a callback if you don't need to know when the operation was performed.\n\n```js\nvar levelup = require('levelup')\n\n// 1) Create our database, supply location and options.\n//    This will create or open the underlying LevelDB store.\nvar db = levelup('./mydb')\n\n// 2) put a key & value\ndb.put('name', 'LevelUP', function (err) {\n  if (err) return console.log('Ooops!', err) // some kind of I/O error\n\n  // 3) fetch by key\n  db.get('name', function (err, value) {\n    if (err) return console.log('Ooops!', err) // likely the key was not found\n\n    // ta da!\n    console.log('name=' + value)\n  })\n})\n```\n\n<a name=\"api\"></a>\n## API\n\n  * <a href=\"#ctor\"><code><b>levelup()</b></code></a>\n  * <a href=\"#open\"><code>db.<b>open()</b></code></a>\n  * <a href=\"#close\"><code>db.<b>close()</b></code></a>\n  * <a href=\"#put\"><code>db.<b>put()</b></code></a>\n  * <a href=\"#get\"><code>db.<b>get()</b></code></a>\n  * <a href=\"#del\"><code>db.<b>del()</b></code></a>\n  * <a href=\"#batch\"><code>db.<b>batch()</b></code> *(array form)*</a>\n  * <a href=\"#batch_chained\"><code>db.<b>batch()</b></code> *(chained form)*</a>\n  * <a href=\"#isOpen\"><code>db.<b>isOpen()</b></code></a>\n  * <a href=\"#isClosed\"><code>db.<b>isClosed()</b></code></a>\n  * <a href=\"#createReadStream\"><code>db.<b>createReadStream()</b></code></a>\n  * <a href=\"#createKeyStream\"><code>db.<b>createKeyStream()</b></code></a>\n  * <a href=\"#createValueStream\"><code>db.<b>createValueStream()</b></code></a>\n  * <a href=\"#createWriteStream\"><code>db.<b>createWriteStream()</b></code></a>\n\n### Special operations exposed by LevelDOWN\n\n  * <a href=\"#approximateSize\"><code>db.db.<b>approximateSize()</b></code></a>\n  * <a href=\"#getProperty\"><code>db.db.<b>getProperty()</b></code></a>\n  * <a href=\"#destroy\"><code><b>leveldown.destroy()</b></code></a>\n  * <a href=\"#repair\"><code><b>leveldown.repair()</b></code></a>\n\n\n--------------------------------------------------------\n<a name=\"ctor\"></a>\n### levelup(location[, options[, callback]])\n### levelup(options[, callback ])\n### levelup(db[, callback ])\n<code>levelup()</code> is the main entry point for creating a new LevelUP instance and opening the underlying store with LevelDB.\n\nThis function returns a new instance of LevelUP and will also initiate an <a href=\"#open\"><code>open()</code></a> operation. Opening the database is an asynchronous operation which will trigger your callback if you provide one. The callback should take the form: `function (err, db) {}` where the `db` is the LevelUP instance. If you don't provide a callback, any read & write operations are simply queued internally until the database is fully opened.\n\nThis leads to two alternative ways of managing a new LevelUP instance:\n\n```js\nlevelup(location, options, function (err, db) {\n  if (err) throw err\n  db.get('foo', function (err, value) {\n    if (err) return console.log('foo does not exist')\n    console.log('got foo =', value)\n  })\n})\n\n// vs the equivalent:\n\nvar db = levelup(location, options) // will throw if an error occurs\ndb.get('foo', function (err, value) {\n  if (err) return console.log('foo does not exist')\n  console.log('got foo =', value)\n})\n```\n\nThe `location` argument is available as a read-only property on the returned LevelUP instance.\n\nThe `levelup(options, callback)` form (with optional `callback`) is only available where you provide a valid `'db'` property on the options object (see below). Only for back-ends that don't require a `location` argument, such as [MemDOWN](https://github.com/rvagg/memdown).\n\nFor example:\n\n```js\nvar levelup = require('levelup')\nvar memdown = require('memdown')\nvar db = levelup({ db: memdown })\n```\n\nThe `levelup(db, callback)` form (with optional `callback`) is only available where `db` is a factory function, as would be provided as a `'db'` property on an `options` object (see below). Only for back-ends that don't require a `location` argument, such as [MemDOWN](https://github.com/rvagg/memdown).\n\nFor example:\n\n```js\nvar levelup = require('levelup')\nvar memdown = require('memdown')\nvar db = levelup(memdown)\n```\n\n#### `options`\n\n`levelup()` takes an optional options object as its second argument; the following properties are accepted:\n\n* `'createIfMissing'` *(boolean, default: `true`)*: If `true`, will initialise an empty database at the specified location if one doesn't already exist. If `false` and a database doesn't exist you will receive an error in your `open()` callback and your database won't open.\n\n* `'errorIfExists'` *(boolean, default: `false`)*: If `true`, you will receive an error in your `open()` callback if the database exists at the specified location.\n\n* `'compression'` *(boolean, default: `true`)*: If `true`, all *compressible* data will be run through the Snappy compression algorithm before being stored. Snappy is very fast and shouldn't gain much speed by disabling so leave this on unless you have good reason to turn it off.\n\n* `'cacheSize'` *(number, default: `8 * 1024 * 1024`)*: The size (in bytes) of the in-memory [LRU](http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used) cache with frequently used uncompressed block contents. \n\n* `'keyEncoding'` and `'valueEncoding'` *(string, default: `'utf8'`)*: The encoding of the keys and values passed through Node.js' `Buffer` implementation (see [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end)).\n  <p><code>'utf8'</code> is the default encoding for both keys and values so you can simply pass in strings and expect strings from your <code>get()</code> operations. You can also pass <code>Buffer</code> objects as keys and/or values and conversion will be performed.</p>\n  <p>Supported encodings are: hex, utf8, ascii, binary, base64, ucs2, utf16le.</p>\n  <p><code>'json'</code> encoding is also supported, see below.</p>\n\n* `'db'` *(object, default: LevelDOWN)*: LevelUP is backed by [LevelDOWN](https://github.com/rvagg/node-leveldown/) to provide an interface to LevelDB. You can completely replace the use of LevelDOWN by providing a \"factory\" function that will return a LevelDOWN API compatible object given a `location` argument. For further information, see [MemDOWN](https://github.com/rvagg/node-memdown/), a fully LevelDOWN API compatible replacement that uses a memory store rather than LevelDB. Also see [Abstract LevelDOWN](http://github.com/rvagg/node-abstract-leveldown), a partial implementation of the LevelDOWN API that can be used as a base prototype for a LevelDOWN substitute.\n\nAdditionally, each of the main interface methods accept an optional options object that can be used to override `'keyEncoding'` and `'valueEncoding'`.\n\n--------------------------------------------------------\n<a name=\"open\"></a>\n### db.open([callback])\n<code>open()</code> opens the underlying LevelDB store. In general **you should never need to call this method directly** as it's automatically called by <a href=\"#ctor\"><code>levelup()</code></a>.\n\nHowever, it is possible to *reopen* a database after it has been closed with <a href=\"#close\"><code>close()</code></a>, although this is not generally advised.\n\n--------------------------------------------------------\n<a name=\"close\"></a>\n### db.close([callback])\n<code>close()</code> closes the underlying LevelDB store. The callback will receive any error encountered during closing as the first argument.\n\nYou should always clean up your LevelUP instance by calling `close()` when you no longer need it to free up resources. A LevelDB store cannot be opened by multiple instances of LevelDB/LevelUP simultaneously.\n\n--------------------------------------------------------\n<a name=\"put\"></a>\n### db.put(key, value[, options][, callback])\n<code>put()</code> is the primary method for inserting data into the store. Both the `key` and `value` can be arbitrary data objects.\n\nThe callback argument is optional but if you don't provide one and an error occurs then expect the error to be thrown.\n\n#### `options`\n\nEncoding of the `key` and `value` objects will adhere to `'keyEncoding'` and `'valueEncoding'` options provided to <a href=\"#ctor\"><code>levelup()</code></a>, although you can provide alternative encoding settings in the options for `put()` (it's recommended that you stay consistent in your encoding of keys and values in a single store).\n\nIf you provide a `'sync'` value of `true` in your `options` object, LevelDB will perform a synchronous write of the data; although the operation will be asynchronous as far as Node is concerned. Normally, LevelDB passes the data to the operating system for writing and returns immediately, however a synchronous write will use `fsync()` or equivalent so your callback won't be triggered until the data is actually on disk. Synchronous filesystem writes are **significantly** slower than asynchronous writes but if you want to be absolutely sure that the data is flushed then you can use `'sync': true`.\n\n--------------------------------------------------------\n<a name=\"get\"></a>\n### db.get(key[, options][, callback])\n<code>get()</code> is the primary method for fetching data from the store. The `key` can be an arbitrary data object. If it doesn't exist in the store then the callback will receive an error as its first argument. A not-found err object will be of type `'NotFoundError'` so you can `err.type == 'NotFoundError'` or you can perform a truthy test on the property `err.notFound`.\n\n```js\ndb.get('foo', function (err, value) {\n  if (err) {\n    if (err.notFound) {\n      // handle a 'NotFoundError' here\n      return\n    }\n    // I/O or other error, pass it up the callback chain\n    return callback(err)\n  }\n\n  // .. handle `value` here\n})\n```\n\n#### `options`\n\nEncoding of the `key` object will adhere to the `'keyEncoding'` option provided to <a href=\"#ctor\"><code>levelup()</code></a>, although you can provide alternative encoding settings in the options for `get()` (it's recommended that you stay consistent in your encoding of keys and values in a single store).\n\nLevelDB will by default fill the in-memory LRU Cache with data from a call to get. Disabling this is done by setting `fillCache` to `false`. \n\n--------------------------------------------------------\n<a name=\"del\"></a>\n### db.del(key[, options][, callback])\n<code>del()</code> is the primary method for removing data from the store.\n\n#### `options`\n\nEncoding of the `key` object will adhere to the `'keyEncoding'` option provided to <a href=\"#ctor\"><code>levelup()</code></a>, although you can provide alternative encoding settings in the options for `del()` (it's recommended that you stay consistent in your encoding of keys and values in a single store).\n\nA `'sync'` option can also be passed, see <a href=\"#put\"><code>put()</code></a> for details on how this works.\n\n--------------------------------------------------------\n<a name=\"batch\"></a>\n### db.batch(array[, options][, callback]) *(array form)*\n<code>batch()</code> can be used for very fast bulk-write operations (both *put* and *delete*). The `array` argument should contain a list of operations to be executed sequentially, although as a whole they are performed as an atomic operation inside LevelDB. Each operation is contained in an object having the following properties: `type`, `key`, `value`, where the *type* is either `'put'` or `'del'`. In the case of `'del'` the `'value'` property is ignored. Any entries with a `'key'` of `null` or `undefined` will cause an error to be returned on the `callback` and any `'type': 'put'` entry with a `'value'` of `null` or `undefined` will return an error.\n\n```js\nvar ops = [\n    { type: 'del', key: 'father' }\n  , { type: 'put', key: 'name', value: 'Yuri Irsenovich Kim' }\n  , { type: 'put', key: 'dob', value: '16 February 1941' }\n  , { type: 'put', key: 'spouse', value: 'Kim Young-sook' }\n  , { type: 'put', key: 'occupation', value: 'Clown' }\n]\n\ndb.batch(ops, function (err) {\n  if (err) return console.log('Ooops!', err)\n  console.log('Great success dear leader!')\n})\n```\n\n#### `options`\n\nSee <a href=\"#put\"><code>put()</code></a> for a discussion on the `options` object. You can overwrite default `'keyEncoding'` and `'valueEncoding'` and also specify the use of `sync` filesystem operations.\n\nIn addition to encoding options for the whole batch you can also overwrite the encoding per operation, like:\n\n```js\nvar ops = [{\n    type          : 'put'\n  , key           : new Buffer([1, 2, 3])\n  , value         : { some: 'json' }\n  , keyEncoding   : 'binary'\n  , valueEncoding : 'json'\n}]\n```\n\n--------------------------------------------------------\n<a name=\"batch_chained\"></a>\n### db.batch() *(chained form)*\n<code>batch()</code>, when called with no arguments will return a `Batch` object which can be used to build, and eventually commit, an atomic LevelDB batch operation. Depending on how it's used, it is possible to obtain greater performance when using the chained form of `batch()` over the array form.\n\n```js\ndb.batch()\n  .del('father')\n  .put('name', 'Yuri Irsenovich Kim')\n  .put('dob', '16 February 1941')\n  .put('spouse', 'Kim Young-sook')\n  .put('occupation', 'Clown')\n  .write(function () { console.log('Done!') })\n```\n\n<b><code>batch.put(key, value[, options])</code></b>\n\nQueue a *put* operation on the current batch, not committed until a `write()` is called on the batch.\n\nThe optional `options` argument can be used to override the default `'keyEncoding'` and/or `'valueEncoding'`.\n\nThis method may `throw` a `WriteError` if there is a problem with your put (such as the `value` being `null` or `undefined`).\n\n<b><code>batch.del(key[, options])</code></b>\n\nQueue a *del* operation on the current batch, not committed until a `write()` is called on the batch.\n\nThe optional `options` argument can be used to override the default `'keyEncoding'`.\n\nThis method may `throw` a `WriteError` if there is a problem with your delete.\n\n<b><code>batch.clear()</code></b>\n\nClear all queued operations on the current batch, any previous operations will be discarded.\n\n<b><code>batch.write([callback])</code></b>\n\nCommit the queued operations for this batch. All operations not *cleared* will be written to the database atomically, that is, they will either all succeed or fail with no partial commits. The optional `callback` will be called when the operation has completed with an *error* argument if an error has occurred; if no `callback` is supplied and an error occurs then this method will `throw` a `WriteError`.\n\n\n--------------------------------------------------------\n<a name=\"isOpen\"></a>\n### db.isOpen()\n\nA LevelUP object can be in one of the following states:\n\n  * *\"new\"*     - newly created, not opened or closed\n  * *\"opening\"* - waiting for the database to be opened\n  * *\"open\"*    - successfully opened the database, available for use\n  * *\"closing\"* - waiting for the database to be closed\n  * *\"closed\"*  - database has been successfully closed, should not be used\n\n`isOpen()` will return `true` only when the state is \"open\".\n\n--------------------------------------------------------\n<a name=\"isClosed\"></a>\n### db.isClosed()\n\n*See <a href=\"#put\"><code>isOpen()</code></a>*\n\n`isClosed()` will return `true` only when the state is \"closing\" *or* \"closed\", it can be useful for determining if read and write operations are permissible.\n\n--------------------------------------------------------\n<a name=\"createReadStream\"></a>\n### db.createReadStream([options])\n\nYou can obtain a **ReadStream** of the full database by calling the `createReadStream()` method. The resulting stream is a complete Node.js-style [Readable Stream](http://nodejs.org/docs/latest/api/stream.html#stream_readable_stream) where `'data'` events emit objects with `'key'` and `'value'` pairs. You can also use the `start`, `end` and `limit` options to control the range of keys that are streamed.\n\n```js\ndb.createReadStream()\n  .on('data', function (data) {\n    console.log(data.key, '=', data.value)\n  })\n  .on('error', function (err) {\n    console.log('Oh my!', err)\n  })\n  .on('close', function () {\n    console.log('Stream closed')\n  })\n  .on('end', function () {\n    console.log('Stream closed')\n  })\n```\n\nThe standard `pause()`, `resume()` and `destroy()` methods are implemented on the ReadStream, as is `pipe()` (see below). `'data'`, '`error'`, `'end'` and `'close'` events are emitted.\n\nAdditionally, you can supply an options object as the first parameter to `createReadStream()` with the following options:\n\n* `'start'`: the key you wish to start the read at. By default it will start at the beginning of the store. Note that the *start* doesn't have to be an actual key that exists, LevelDB will simply find the *next* key, greater than the key you provide.\n\n* `'end'`: the key you wish to end the read on. By default it will continue until the end of the store. Again, the *end* doesn't have to be an actual key as an (inclusive) `<=`-type operation is performed to detect the end. You can also use the `destroy()` method instead of supplying an `'end'` parameter to achieve the same effect.\n\n* `'reverse'` *(boolean, default: `false`)*: a boolean, set to true if you want the stream to go in reverse order. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek.\n\n* `'keys'` *(boolean, default: `true`)*: whether the `'data'` event should contain keys. If set to `true` and `'values'` set to `false` then `'data'` events will simply be keys, rather than objects with a `'key'` property. Used internally by the `createKeyStream()` method.\n\n* `'values'` *(boolean, default: `true`)*: whether the `'data'` event should contain values. If set to `true` and `'keys'` set to `false` then `'data'` events will simply be values, rather than objects with a `'value'` property. Used internally by the `createValueStream()` method.\n\n* `'limit'` *(number, default: `-1`)*: limit the number of results collected by this stream. This number represents a *maximum* number of results and may not be reached if you get to the end of the store or your `'end'` value first. A value of `-1` means there is no limit.\n\n* `'fillCache'` *(boolean, default: `false`)*: wheather LevelDB's LRU-cache should be filled with data read.\n\n* `'keyEncoding'` / `'valueEncoding'` *(string)*: the encoding applied to each read piece of data.\n\n--------------------------------------------------------\n<a name=\"createKeyStream\"></a>\n### db.createKeyStream([options])\n\nA **KeyStream** is a **ReadStream** where the `'data'` events are simply the keys from the database so it can be used like a traditional stream rather than an object stream.\n\nYou can obtain a KeyStream either by calling the `createKeyStream()` method on a LevelUP object or by passing passing an options object to `createReadStream()` with `keys` set to `true` and `values` set to `false`.\n\n```js\ndb.createKeyStream()\n  .on('data', function (data) {\n    console.log('key=', data)\n  })\n\n// same as:\ndb.createReadStream({ keys: true, values: false })\n  .on('data', function (data) {\n    console.log('key=', data)\n  })\n```\n\n--------------------------------------------------------\n<a name=\"createValueStream\"></a>\n### db.createValueStream([options])\n\nA **ValueStream** is a **ReadStream** where the `'data'` events are simply the values from the database so it can be used like a traditional stream rather than an object stream.\n\nYou can obtain a ValueStream either by calling the `createValueStream()` method on a LevelUP object or by passing passing an options object to `createReadStream()` with `values` set to `true` and `keys` set to `false`.\n\n```js\ndb.createValueStream()\n  .on('data', function (data) {\n    console.log('value=', data)\n  })\n\n// same as:\ndb.createReadStream({ keys: false, values: true })\n  .on('data', function (data) {\n    console.log('value=', data)\n  })\n```\n\n--------------------------------------------------------\n<a name=\"createWriteStream\"></a>\n### db.createWriteStream([options])\n\nA **WriteStream** can be obtained by calling the `createWriteStream()` method. The resulting stream is a complete Node.js-style [Writable Stream](http://nodejs.org/docs/latest/api/stream.html#stream_writable_stream) which accepts objects with `'key'` and `'value'` pairs on its `write()` method.\n\nThe WriteStream will buffer writes and submit them as a `batch()` operations where writes occur *within the same tick*.\n\n```js\nvar ws = db.createWriteStream()\n\nws.on('error', function (err) {\n  console.log('Oh my!', err)\n})\nws.on('close', function () {\n  console.log('Stream closed')\n})\n\nws.write({ key: 'name', value: 'Yuri Irsenovich Kim' })\nws.write({ key: 'dob', value: '16 February 1941' })\nws.write({ key: 'spouse', value: 'Kim Young-sook' })\nws.write({ key: 'occupation', value: 'Clown' })\nws.end()\n```\n\nThe standard `write()`, `end()`, `destroy()` and `destroySoon()` methods are implemented on the WriteStream. `'drain'`, `'error'`, `'close'` and `'pipe'` events are emitted.\n\nYou can specify encodings both for the whole stream and individual entries:\n\nTo set the encoding for the whole stream, provide an options object as the first parameter to `createWriteStream()` with `'keyEncoding'` and/or `'valueEncoding'`.\n\nTo set the encoding for an individual entry:\n\n```js\nwriteStream.write({\n    key           : new Buffer([1, 2, 3])\n  , value         : { some: 'json' }\n  , keyEncoding   : 'binary'\n  , valueEncoding : 'json'\n})\n```\n\n#### write({ type: 'put' })\n\nIf individual `write()` operations are performed with a `'type'` property of `'del'`, they will be passed on as `'del'` operations to the batch.\n\n```js\nvar ws = db.createWriteStream()\n\nws.on('error', function (err) {\n  console.log('Oh my!', err)\n})\nws.on('close', function () {\n  console.log('Stream closed')\n})\n\nws.write({ type: 'del', key: 'name' })\nws.write({ type: 'del', key: 'dob' })\nws.write({ type: 'put', key: 'spouse' })\nws.write({ type: 'del', key: 'occupation' })\nws.end()\n```\n\n#### db.createWriteStream({ type: 'del' })\n\nIf the *WriteStream* is created with a `'type'` option of `'del'`, all `write()` operations will be interpreted as `'del'`, unless explicitly specified as `'put'`.\n\n```js\nvar ws = db.createWriteStream({ type: 'del' })\n\nws.on('error', function (err) {\n  console.log('Oh my!', err)\n})\nws.on('close', function () {\n  console.log('Stream closed')\n})\n\nws.write({ key: 'name' })\nws.write({ key: 'dob' })\n// but it can be overridden\nws.write({ type: 'put', key: 'spouse', value: 'Ri Sol-ju' })\nws.write({ key: 'occupation' })\nws.end()\n```\n\n#### Pipes and Node Stream compatibility\n\nA ReadStream can be piped directly to a WriteStream, allowing for easy copying of an entire database. A simple `copy()` operation is included in LevelUP that performs exactly this on two open databases:\n\n```js\nfunction copy (srcdb, dstdb, callback) {\n  srcdb.createReadStream().pipe(dstdb.createWriteStream()).on('close', callback)\n}\n```\n\nThe ReadStream is also [fstream](https://github.com/isaacs/fstream)-compatible which means you should be able to pipe to and from fstreams. So you can serialize and deserialize an entire database to a directory where keys are filenames and values are their contents, or even into a *tar* file using [node-tar](https://github.com/isaacs/node-tar). See the [fstream functional test](https://github.com/rvagg/node-levelup/blob/master/test/functional/fstream-test.js) for an example. *(Note: I'm not really sure there's a great use-case for this but it's a fun example and it helps to harden the stream implementations.)*\n\nKeyStreams and ValueStreams can be treated like standard streams of raw data. If `'keyEncoding'` or `'valueEncoding'` is set to `'binary'` the `'data'` events will simply be standard Node `Buffer` objects straight out of the data store.\n\n\n--------------------------------------------------------\n<a name='approximateSize'></a>\n### db.db.approximateSize(start, end, callback)\n<code>approximateSize()</code> can used to get the approximate number of bytes of file system space used by the range `[start..end)`. The result may not include recently written data.\n\n```js\nvar db = require('level')('./huge.db')\n\ndb.db.approximateSize('a', 'c', function (err, size) {\n  if (err) return console.error('Ooops!', err)\n  console.log('Approximate size of range is %d', size)\n})\n```\n\n**Note:** `approximateSize()` is available via [LevelDOWN](https://github.com/rvagg/node-leveldown/), which by default is accessible as the `db` property of your LevelUP instance. This is a specific LevelDB operation and is not likely to be available where you replace LevelDOWN with an alternative back-end via the `'db'` option.\n\n\n--------------------------------------------------------\n<a name='getProperty'></a>\n### db.db.getProperty(property)\n<code>getProperty</code> can be used to get internal details from LevelDB. When issued with a valid property string, a readable string will be returned (this method is synchronous).\n\nCurrently, the only valid properties are:\n\n* <b><code>'leveldb.num-files-at-levelN'</code></b>: returns the number of files at level *N*, where N is an integer representing a valid level (e.g. \"0\").\n\n* <b><code>'leveldb.stats'</code></b>: returns a multi-line string describing statistics about LevelDB's internal operation.\n\n* <b><code>'leveldb.sstables'</code></b>: returns a multi-line string describing all of the *sstables* that make up contents of the current database.\n\n\n```js\nvar db = require('level')('./huge.db')\nconsole.log(db.db.getProperty('leveldb.num-files-at-level3'))\n// → '243'\n```\n\n**Note:** `getProperty()` is available via [LevelDOWN](https://github.com/rvagg/node-leveldown/), which by default is accessible as the `db` property of your LevelUP instance. This is a specific LevelDB operation and is not likely to be available where you replace LevelDOWN with an alternative back-end via the `'db'` option.\n\n\n--------------------------------------------------------\n<a name=\"destroy\"></a>\n### leveldown.destroy(location, callback)\n<code>destroy()</code> is used to completely remove an existing LevelDB database directory. You can use this function in place of a full directory *rm* if you want to be sure to only remove LevelDB-related files. If the directory only contains LevelDB files, the directory itself will be removed as well. If there are additional, non-LevelDB files in the directory, those files, and the directory, will be left alone.\n\nThe callback will be called when the destroy operation is complete, with a possible `error` argument.\n\n**Note:** `destroy()` is available via [LevelDOWN](https://github.com/rvagg/node-leveldown/) which you will have to install seperately, e.g.:\n\n```js\nrequire('leveldown').destroy('./huge.db', function (err) { console.log('done!') })\n```\n\n--------------------------------------------------------\n<a name=\"repair\"></a>\n### leveldown.repair(location, callback)\n<code>repair()</code> can be used to attempt a restoration of a damaged LevelDB store. From the LevelDB documentation:\n\n> If a DB cannot be opened, you may attempt to call this method to resurrect as much of the contents of the database as possible. Some data may be lost, so be careful when calling this function on a database that contains important information.\n\nYou will find information on the *repair* operation in the *LOG* file inside the store directory. \n\nA `repair()` can also be used to perform a compaction of the LevelDB log into table files.\n\nThe callback will be called when the repair operation is complete, with a possible `error` argument.\n\n**Note:** `repair()` is available via [LevelDOWN](https://github.com/rvagg/node-leveldown/) which you will have to install seperately, e.g.:\n\n```js\nrequire('leveldown').repair('./huge.db', function (err) { console.log('done!') })\n```\n\n--------------------------------------------------------\n\n<a name=\"events\"></a>\nEvents\n------\n\nLevelUP emits events when the callbacks to the corresponding methods are called.\n\n* `db.emit('put', key, value)` emitted when a new value is `'put'`\n* `db.emit('del', key)` emitted when a value is deleted\n* `db.emit('batch', ary)` emitted when a batch operation has executed\n* `db.emit('ready')` emitted when the database has opened (`'open'` is synonym)\n* `db.emit('closed')` emitted when the database has closed\n* `db.emit('opening')` emitted when the database is opening\n* `db.emit('closing')` emitted when the database is closing\n\nIf you do not pass a callback to an async function, and there is an error, LevelUP will `emit('error', err)` instead.\n\n<a name=\"json\"></a>\nJSON data\n---------\n\nYou specify `'json'` encoding for both keys and/or values, you can then supply JavaScript objects to LevelUP and receive them from all fetch operations, including ReadStreams. LevelUP will automatically *stringify* your objects and store them as *utf8* and parse the strings back into objects before passing them back to you.\n\n<a name=\"custom_encodings\"></a>\nCustom encodings\n----------------\n\nA custom encoding may be provided by passing in an object as an value for `keyEncoding` or `valueEncoding` (wherever accepted), it must have the following properties:\n\n```js\n{\n    encode : function (val) { ... }\n  , decode : function (val) { ... }\n  , buffer : boolean // encode returns a buffer-like and decode accepts a buffer\n  , type   : String  // name of this encoding type.\n}\n```\n\n*\"buffer-like\"* means either a `Buffer` if running in Node, or a Uint8Array if in a browser. Use [bops](https://github.com/chrisdickinson/bops) to get portable binary operations.\n\n<a name=\"extending\"></a>\nExtending LevelUP\n-----------------\n\nA list of <a href=\"https://github.com/rvagg/node-levelup/wiki/Modules\"><b>Node.js LevelDB modules and projects</b></a> can be found in the wiki.\n\nWhen attempting to extend the functionality of LevelUP, it is recommended that you consider using [level-hooks](https://github.com/dominictarr/level-hooks) and/or [level-sublevel](https://github.com/dominictarr/level-sublevel). **level-sublevel** is particularly helpful for keeping additional, extension-specific, data in a LevelDB store. It allows you to partition a LevelUP instance into multiple sub-instances that each correspond to discrete namespaced key ranges.\n\n<a name=\"multiproc\"></a>\nMulti-process access\n--------------------\n\nLevelDB is thread-safe but is **not** suitable for accessing with multiple processes. You should only ever have a LevelDB database open from a single Node.js process. Node.js clusters are made up of multiple processes so a LevelUP instance cannot be shared between them either.\n\nSee the <a href=\"https://github.com/rvagg/node-levelup/wiki/Modules\"><b>wiki</b></a> for some LevelUP extensions, including [multilevel](https://github.com/juliangruber/multilevel), that may help if you require a single data store to be shared across processes.\n\n<a name=\"support\"></a>\nGetting support\n---------------\n\nThere are multiple ways you can find help in using LevelDB in Node.js:\n\n * **IRC:** you'll find an active group of LevelUP users in the **##leveldb** channel on Freenode, including most of the contributors to this project.\n * **Mailing list:** there is an active [Node.js LevelDB](https://groups.google.com/forum/#!forum/node-levelup) Google Group.\n * **GitHub:** you're welcome to open an issue here on this GitHub repository if you have a question.\n\n<a name=\"contributing\"></a>\nContributing\n------------\n\nLevelUP is an **OPEN Open Source Project**. This means that:\n\n> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [CONTRIBUTING.md](https://github.com/rvagg/node-levelup/blob/master/CONTRIBUTING.md) file for more details.\n\n### Contributors\n\nLevelUP is only possible due to the excellent work of the following contributors:\n\n<table><tbody>\n<tr><th align=\"left\">Rod Vagg</th><td><a href=\"https://github.com/rvagg\">GitHub/rvagg</a></td><td><a href=\"http://twitter.com/rvagg\">Twitter/@rvagg</a></td></tr>\n<tr><th align=\"left\">John Chesley</th><td><a href=\"https://github.com/chesles/\">GitHub/chesles</a></td><td><a href=\"http://twitter.com/chesles\">Twitter/@chesles</a></td></tr>\n<tr><th align=\"left\">Jake Verbaten</th><td><a href=\"https://github.com/raynos\">GitHub/raynos</a></td><td><a href=\"http://twitter.com/raynos2\">Twitter/@raynos2</a></td></tr>\n<tr><th align=\"left\">Dominic Tarr</th><td><a href=\"https://github.com/dominictarr\">GitHub/dominictarr</a></td><td><a href=\"http://twitter.com/dominictarr\">Twitter/@dominictarr</a></td></tr>\n<tr><th align=\"left\">Max Ogden</th><td><a href=\"https://github.com/maxogden\">GitHub/maxogden</a></td><td><a href=\"http://twitter.com/maxogden\">Twitter/@maxogden</a></td></tr>\n<tr><th align=\"left\">Lars-Magnus Skog</th><td><a href=\"https://github.com/ralphtheninja\">GitHub/ralphtheninja</a></td><td><a href=\"http://twitter.com/ralphtheninja\">Twitter/@ralphtheninja</a></td></tr>\n<tr><th align=\"left\">David Björklund</th><td><a href=\"https://github.com/kesla\">GitHub/kesla</a></td><td><a href=\"http://twitter.com/david_bjorklund\">Twitter/@david_bjorklund</a></td></tr>\n<tr><th align=\"left\">Julian Gruber</th><td><a href=\"https://github.com/juliangruber\">GitHub/juliangruber</a></td><td><a href=\"http://twitter.com/juliangruber\">Twitter/@juliangruber</a></td></tr>\n<tr><th align=\"left\">Paolo Fragomeni</th><td><a href=\"https://github.com/hij1nx\">GitHub/hij1nx</a></td><td><a href=\"http://twitter.com/hij1nx\">Twitter/@hij1nx</a></td></tr>\n<tr><th align=\"left\">Anton Whalley</th><td><a href=\"https://github.com/No9\">GitHub/No9</a></td><td><a href=\"https://twitter.com/antonwhalley\">Twitter/@antonwhalley</a></td></tr>\n<tr><th align=\"left\">Matteo Collina</th><td><a href=\"https://github.com/mcollina\">GitHub/mcollina</a></td><td><a href=\"https://twitter.com/matteocollina\">Twitter/@matteocollina</a></td></tr>\n<tr><th align=\"left\">Pedro Teixeira</th><td><a href=\"https://github.com/pgte\">GitHub/pgte</a></td><td><a href=\"https://twitter.com/pgte\">Twitter/@pgte</a></td></tr>\n<tr><th align=\"left\">James Halliday</th><td><a href=\"https://github.com/substack\">GitHub/substack</a></td><td><a href=\"https://twitter.com/substack\">Twitter/@substack</a></td></tr>\n</tbody></table>\n\n### Windows\n\nA large portion of the Windows support comes from code by [Krzysztof Kowalczyk](http://blog.kowalczyk.info/) [@kjk](https://twitter.com/kjk), see his Windows LevelDB port [here](http://code.google.com/r/kkowalczyk-leveldb/). If you're using LevelUP on Windows, you should give him your thanks!\n\n\n<a name=\"license\"></a>\nLicense &amp; copyright\n-------------------\n\nCopyright (c) 2012-2014 LevelUP contributors (listed above).\n\nLevelUP is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.\n\n=======\n*LevelUP builds on the excellent work of the LevelDB and Snappy teams from Google and additional contributors. LevelDB and Snappy are both issued under the [New BSD Licence](http://opensource.org/licenses/BSD-3-Clause).*\n",readmeFilename:"README.md",bugs:{url:"https://github.com/rvagg/node-levelup/issues"},_id:"levelup@0.18.6",_from:"levelup@~0.18.4"}
  },{}],74:[function(e,t){"use strict";function n(){}t.exports=n},{}],75:[function(e,t){"use strict";function n(e){function t(e,t){function r(e){c[t]=e,++l===n&!u&&(u=!0,a.resolve(f,c))}i(e).then(r,function(e){u||(u=!0,a.reject(f,e))})}if("[object Array]"!==Object.prototype.toString.call(e))return o(new TypeError("must be an array"));var n=e.length,u=!1;if(!n)return i([]);for(var c=new Array(n),l=0,d=-1,f=new r(s);++d<n;)t(e[d],d);return f}var r=e("./promise"),o=e("./reject"),i=e("./resolve"),s=e("./INTERNAL"),a=e("./handlers");t.exports=n},{"./INTERNAL":74,"./handlers":76,"./promise":78,"./reject":81,"./resolve":82}],76:[function(e,t,n){"use strict";function r(e){var t=e&&e.then;return e&&"object"==typeof e&&"function"==typeof t?function(){t.apply(e,arguments)}:void 0}var o=e("./tryCatch"),i=e("./resolveThenable"),s=e("./states");n.resolve=function(e,t){var a=o(r,t);if("error"===a.status)return n.reject(e,a.value);var u=a.value;if(u)i.safely(e,u);else{e.state=s.FULFILLED,e.outcome=t;for(var c=-1,l=e.queue.length;++c<l;)e.queue[c].callFulfilled(t)}return e},n.reject=function(e,t){e.state=s.REJECTED,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e}},{"./resolveThenable":83,"./states":84,"./tryCatch":85}],77:[function(e,t,n){t.exports=n=e("./promise"),n.resolve=e("./resolve"),n.reject=e("./reject"),n.all=e("./all"),n.race=e("./race")},{"./all":75,"./promise":78,"./race":80,"./reject":81,"./resolve":82}],78:[function(e,t){"use strict";function n(e){if(!(this instanceof n))return new n(e);if("function"!=typeof e)throw new TypeError("reslover must be a function");this.state=s.PENDING,this.queue=[],this.outcome=void 0,e!==o&&i.safely(this,e)}var r=e("./unwrap"),o=e("./INTERNAL"),i=e("./resolveThenable"),s=e("./states"),a=e("./queueItem");t.exports=n,n.prototype["catch"]=function(e){return this.then(null,e)},n.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s.FULFILLED||"function"!=typeof t&&this.state===s.REJECTED)return this;var i=new n(o);if(this.state!==s.PENDING){var u=this.state===s.FULFILLED?e:t;r(i,u,this.outcome)}else this.queue.push(new a(i,e,t));return i}},{"./INTERNAL":74,"./queueItem":79,"./resolveThenable":83,"./states":84,"./unwrap":86}],79:[function(e,t){"use strict";function n(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)}var r=e("./handlers"),o=e("./unwrap");t.exports=n,n.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},n.prototype.otherCallFulfilled=function(e){o(this.promise,this.onFulfilled,e)},n.prototype.callRejected=function(e){r.reject(this.promise,e)},n.prototype.otherCallRejected=function(e){o(this.promise,this.onRejected,e)}},{"./handlers":76,"./unwrap":86}],80:[function(e,t){"use strict";function n(e){function t(e){i(e).then(function(e){u||(u=!0,a.resolve(l,e))},function(e){u||(u=!0,a.reject(l,e))})}if("[object Array]"!==Object.prototype.toString.call(e))return o(new TypeError("must be an array"));var n=e.length,u=!1;if(!n)return i([]);for(var c=-1,l=new r(s);++c<n;)t(e[c]);return l}var r=e("./promise"),o=e("./reject"),i=e("./resolve"),s=e("./INTERNAL"),a=e("./handlers");t.exports=n},{"./INTERNAL":74,"./handlers":76,"./promise":78,"./reject":81,"./resolve":82}],81:[function(e,t){"use strict";function n(e){var t=new r(o);return i.reject(t,e)}var r=e("./promise"),o=e("./INTERNAL"),i=e("./handlers");t.exports=n},{"./INTERNAL":74,"./handlers":76,"./promise":78}],82:[function(e,t){"use strict";function n(e){if(e)return e instanceof r?e:i.resolve(new r(o),e);var t=typeof e;switch(t){case"boolean":return s;case"undefined":return u;case"object":return a;case"number":return c;case"string":return l}}var r=e("./promise"),o=e("./INTERNAL"),i=e("./handlers");t.exports=n;var s=i.resolve(new r(o),!1),a=i.resolve(new r(o),null),u=i.resolve(new r(o),void 0),c=i.resolve(new r(o),0),l=i.resolve(new r(o),"")},{"./INTERNAL":74,"./handlers":76,"./promise":78}],83:[function(e,t,n){"use strict";function r(e,t){function n(t){a||(a=!0,o.reject(e,t))}function r(t){a||(a=!0,o.resolve(e,t))}function s(){t(r,n)}var a=!1,u=i(s);"error"===u.status&&n(u.value)}var o=e("./handlers"),i=e("./tryCatch");n.safely=r},{"./handlers":76,"./tryCatch":85}],84:[function(e,t,n){n.REJECTED=["REJECTED"],n.FULFILLED=["FULFILLED"],n.PENDING=["PENDING"]},{}],85:[function(e,t){"use strict";function n(e,t){var n={};try{n.value=e(t),n.status="success"}catch(r){n.status="error",n.value=r}return n}t.exports=n},{}],86:[function(e,t){"use strict";function n(e,t,n){r(function(){var r;try{r=t(n)}catch(i){return o.reject(e,i)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)})}var r=e("immediate"),o=e("./handlers");t.exports=n},{"./handlers":76,immediate:87}],87:[function(e,t){"use strict";function n(){o=!0;for(var e,t,n=a.length;n;){for(t=a,a=[],e=-1;++e<n;)t[e]();n=a.length}o=!1}function r(e){1!==a.push(e)||o||i()}for(var o,i,s=[e("./nextTick"),e("./mutation.js"),e("./messageChannel"),e("./stateChange"),e("./timeout")],a=[],u=-1,c=s.length;++u<c;)if(s[u]&&s[u].test&&s[u].test()){i=s[u].install(n);break}t.exports=r},{"./messageChannel":88,"./mutation.js":89,"./nextTick":18,"./stateChange":90,"./timeout":91}],88:[function(e,t,n){(function(e){"use strict";n.test=function(){return e.setImmediate?!1:"undefined"!=typeof e.MessageChannel},n.install=function(t){var n=new e.MessageChannel;return n.port1.onmessage=t,function(){n.port2.postMessage(0)}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],89:[function(e,t,n){(function(e){"use strict";var t=e.MutationObserver||e.WebKitMutationObserver;n.test=function(){return t},n.install=function(n){var r=0,o=new t(n),i=e.document.createTextNode("");return o.observe(i,{characterData:!0}),function(){i.data=r=++r%2}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],90:[function(e,t,n){(function(e){"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,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],91:[function(e,t,n){"use strict";n.test=function(){return!0},n.install=function(e){return function(){setTimeout(e,0)}}},{}],IG9xsc:[function(e,t){(function(n,r,o){"use strict";function i(e,t){l.call(this,e),this._reverse=!!t.reverse,this._endkey=t.end,this._startkey=t.start,this._gt=t.gt,this._gte=t.gte,this._lt=t.lt,this._lte=t.lte,this._exclusiveStart=t.exclusiveStart,this._limit=t.limit,this._count=0,this.onInitCompleteListeners=[]}function s(e){return this instanceof s?(c.call(this,e),void(this.container=new d(e))):new s(e)}function a(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if("key"===t){if(e instanceof Boolean)return new Error(t+" cannot be `null` or `undefined`");if(""===e)return new Error(t+" cannot be empty")}if(0===e.toString().indexOf("[object ArrayBuffer]")&&(0===e.byteLength||void 0===e.byteLength))return new Error(t+" cannot be an empty Buffer");if(o.isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")}var u=e("inherits"),c=e("abstract-leveldown").AbstractLevelDOWN,l=e("abstract-leveldown").AbstractIterator,d=e("./localstorage").LocalStorage,f=e("./localstorage-core"),h=e("./utils"),p=r.setImmediate||n.nextTick;u(i,l),i.prototype._init=function(e){p(function(){e()})},i.prototype._next=function(e){function t(){if(n._pos===n._keys.length||n._pos<0)return e();var t=n._keys[n._pos];return n._endkey&&(n._reverse?t<n._endkey:t>n._endkey)?e():n._limit&&n._limit>0&&n._count++>=n._limit?e():n._lt&&t>=n._lt||n._lte&&t>n._lte||n._gt&&t<=n._gt||n._gte&&t<n._gte?e():(n._pos+=n._reverse?-1:1,void n.db.container.getItem(t,function(r,o){return r?"NotFound"===r.message?p(function(){n._next(e)}):e(r):void e(null,t,o)}))}var n=this;n.initStarted?n.initCompleted?t():n.onInitCompleteListeners.push(t):(n.initStarted=!0,n._init(function(r){return r?e(r):void n.db.container.keys(function(r,o){if(r)return e(r);if(n._keys=o,n._startkey){var i=h.sortedIndexOf(n._keys,n._startkey),s=i>=n._keys.length||0>i?void 0:n._keys[i];n._pos=i,n._reverse?(n._exclusiveStart||s!==n._startkey)&&n._pos--:n._exclusiveStart&&s===n._startkey&&n._pos++}else n._pos=n._reverse?n._keys.length-1:0;t(),n.initCompleted=!0;for(var a=-1;++a<n.onInitCompleteListeners;)p(n.onInitCompleteListeners[a])})}))},u(s,c),s.prototype._open=function(e,t){this.container.init(t)},s.prototype._put=function(e,t,n,r){var i=a(e,"key");if(i)return p(function(){r(i)});if(i=a(t,"value"))return p(function(){r(i)});if("object"==typeof t&&!o.isBuffer(t)&&void 0===t.buffer){var s={};s.storetype="json",s.data=t,t=JSON.stringify(s)}this.container.setItem(e,t,r)},s.prototype._get=function(e,t,n){var r=a(e,"key");return r?p(function(){n(r)}):(o.isBuffer(e)||(e=String(e)),void this.container.getItem(e,function(e,r){if(e)return n(e);if(t.asBuffer===!1||o.isBuffer(r)||(r=new o(r)),t.asBuffer===!1&&r.indexOf('{"storetype":"json","data"')>-1){var i=JSON.parse(r);r=i.data}n(null,r)}))},s.prototype._del=function(e,t,n){var r=a(e,"key");return r?p(function(){n(r)}):(o.isBuffer(e)||(e=String(e)),void this.container.removeItem(e,n))},s.prototype._batch=function(e,t,n){var r=this;p(function(){function i(){++d===e.length&&n(l)}var s,u,c,l,d=0;if(Array.isArray(e)&&e.length)for(var f=0;f<e.length;f++){var h=e[f];h?(u=o.isBuffer(h.key)?h.key:String(h.key),s=a(u,"key"),s?(l=s,i()):"del"===h.type?r._del(h.key,t,i):"put"===h.type&&(c=o.isBuffer(h.value)?h.value:String(h.value),s=a(c,"value"),s?(l=s,i()):r._put(u,c,t,i))):i()}else n()})},s.prototype._iterator=function(e){return new i(this,e)},s.destroy=function(e,t){f.destroy(e,t)},t.exports=s}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./localstorage":95,"./localstorage-core":94,"./utils":103,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,"abstract-leveldown":98,buffer:21,inherits:35}],leveldown:[function(e,t){t.exports=e("IG9xsc")},{}],94:[function(e,t){(function(e,n){"use strict";function r(e,t){var n,r;try{n=t()}catch(o){r=o}s(function(){e(r,n)})}function o(e){return e.replace(/!/g,"!!")+"!"}function i(e){this._prefix=o(e)}var s=n.setImmediate||e.nextTick;i.prototype.getKeys=function(e){var t=this;r(e,function(){for(var e=[],n=t._prefix.length,r=-1,o=window.localStorage.length;++r<o;){var i=window.localStorage.key(r);i.substring(0,n)===t._prefix&&e.push(i.substring(n))}return e.sort(),e})},i.prototype.put=function(e,t,n){var o=this;r(n,function(){window.localStorage.setItem(o._prefix+e,t)})},i.prototype.get=function(e,t){var n=this;r(t,function(){return window.localStorage.getItem(n._prefix+e)})},i.prototype.remove=function(e,t){var n=this;r(t,function(){window.localStorage.removeItem(n._prefix+e)})},i.destroy=function(e,t){var n=o(e);r(t,function(){Object.keys(localStorage).forEach(function(e){e.substring(0,n.length)===n&&localStorage.removeItem(e)})})},t.exports=i}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],95:[function(e,t,n){(function(t){"use strict";function r(e){this._store=new d(e),this._queue=new f}var o="ArrayBuffer:",i=new RegExp("^"+o),s="Uint8Array:",a=new RegExp("^"+s),u="Buff:",c=new RegExp("^"+u),l=e("./utils"),d=e("./localstorage-core"),f=e("./taskqueue"),h=e("d64");r.prototype.sequentialize=function(e,t){this._queue.add(t,e)},r.prototype.init=function(e){var t=this;t.sequentialize(e,function(e){t._store.getKeys(function(n,r){return n?e(n):(t._keys=r,e())})})},r.prototype.keys=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.slice())})},r.prototype.setItem=function(e,n,r){var o=this;o.sequentialize(r,function(r){t.isBuffer(n)&&(n=u+h.encode(n));var i=l.sortedIndexOf(o._keys,e);o._keys[i]!==e&&o._keys.splice(i,0,e),o._store.put(e,n,r)})},r.prototype.getItem=function(e,t){var n=this;n.sequentialize(t,function(t){n._store.get(e,function(e,n){return e?t(e):"undefined"==typeof n||null===n?t(new Error("NotFound")):("undefined"!=typeof n&&(c.test(n)?n=h.decode(n.substring(u.length)):i.test(n)?(n=n.substring(o.length),n=new ArrayBuffer(atob(n).split("").map(function(e){return e.charCodeAt(0)}))):a.test(n)&&(n=n.substring(s.length),n=new Uint8Array(atob(n).split("").map(function(e){return e.charCodeAt(0)})))),void t(null,n))})})},r.prototype.removeItem=function(e,t){var n=this;n.sequentialize(t,function(t){var r=l.sortedIndexOf(n._keys,e);n._keys[r]===e?(n._keys.splice(r,1),n._store.remove(e,function(e){return e?t(e):void t()})):t()})},r.prototype.length=function(e){var t=this;t.sequentialize(e,function(e){e(null,t._keys.length)})},n.LocalStorage=r}).call(this,e("buffer").Buffer)},{"./localstorage-core":94,"./taskqueue":102,"./utils":103,buffer:21,d64:100}],96:[function(e,t){t.exports=e(57)},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],97:[function(e,t){t.exports=e(58)},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20}],98:[function(e,t){(function(n,r){function o(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e}var i=e("xtend"),s=e("./abstract-iterator"),a=e("./abstract-chained-batch");o.prototype.open=function(e,t){if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");return"object"!=typeof e&&(e={}),"function"==typeof this._open?this._open(e,t):void n.nextTick(t)},o.prototype.close=function(e){if("function"!=typeof e)throw new Error("close() requires a callback argument");return"function"==typeof this._close?this._close(e):void n.nextTick(e)},o.prototype.get=function(e,t,r){var o;if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("get() requires a callback argument");return(o=this._checkKeyValue(e,"key",this._isBuffer))?r(o):(this._isBuffer(e)||(e=String(e)),"object"!=typeof t&&(t={}),"function"==typeof this._get?this._get(e,t,r):void n.nextTick(function(){r(new Error("NotFound"))}))},o.prototype.put=function(e,t,r,o){var i;if("function"==typeof r&&(o=r),"function"!=typeof o)throw new Error("put() requires a callback argument");return(i=this._checkKeyValue(e,"key",this._isBuffer))?o(i):(i=this._checkKeyValue(t,"value",this._isBuffer))?o(i):(this._isBuffer(e)||(e=String(e)),this._isBuffer(t)||n.browser||(t=String(t)),"object"!=typeof r&&(r={}),"function"==typeof this._put?this._put(e,t,r,o):void n.nextTick(o))},o.prototype.del=function(e,t,r){var o;if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("del() requires a callback argument");return(o=this._checkKeyValue(e,"key",this._isBuffer))?r(o):(this._isBuffer(e)||(e=String(e)),"object"!=typeof t&&(t={}),"function"==typeof this._del?this._del(e,t,r):void n.nextTick(r))},o.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));"object"!=typeof t&&(t={});for(var o,i,s=0,a=e.length;a>s;s++)if(o=e[s],"object"==typeof o){if(i=this._checkKeyValue(o.type,"type",this._isBuffer))return r(i);if(i=this._checkKeyValue(o.key,"key",this._isBuffer))return r(i);if("put"==o.type&&(i=this._checkKeyValue(o.value,"value",this._isBuffer)))return r(i)}return"function"==typeof this._batch?this._batch(e,t,r):void n.nextTick(r)},o.prototype.approximateSize=function(e,t,r){if(null==e||null==t||"function"==typeof e||"function"==typeof t)throw new Error("approximateSize() requires valid `start`, `end` and `callback` arguments");if("function"!=typeof r)throw new Error("approximateSize() requires a callback argument");return this._isBuffer(e)||(e=String(e)),this._isBuffer(t)||(t=String(t)),"function"==typeof this._approximateSize?this._approximateSize(e,t,r):void n.nextTick(function(){r(null,0)})},o.prototype._setupIteratorOptions=function(e){var t=this;return e=i(e),["start","end","gt","gte","lt","lte"].forEach(function(n){e[n]&&t._isBuffer(e[n])&&0===e[n].length&&delete e[n]}),e.reverse=!!e.reverse,e.reverse&&e.lt&&(e.start=e.lt),e.reverse&&e.lte&&(e.start=e.lte),!e.reverse&&e.gt&&(e.start=e.gt),!e.reverse&&e.gte&&(e.start=e.gte),(e.reverse&&e.lt&&!e.lte||!e.reverse&&e.gt&&!e.gte)&&(e.exclusiveStart=!0),e},o.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),"function"==typeof this._iterator?this._iterator(e):new s(this)},o.prototype._chainedBatch=function(){return new a(this)},o.prototype._isBuffer=function(e){return r.isBuffer(e)},o.prototype._checkKeyValue=function(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(this._isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")},t.exports.AbstractLevelDOWN=o,t.exports.AbstractIterator=s,t.exports.AbstractChainedBatch=a}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),e("buffer").Buffer)},{"./abstract-chained-batch":96,"./abstract-iterator":97,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,xtend:99}],99:[function(e,t){t.exports=e(72)},{}],100:[function(e,t){var n=e("buffer").Buffer,r=".PYFGCRLAOEUIDHTNSQJKXBMWVZ_pyfgcrlaoeuidhtnsqjkxbmwvz1234567890".split("").sort().join("");t.exports=function(e,t){if(e=e||r,t=t||{},64!==e.length)throw new Error("a base 64 encoding requires 64 chars");var o=new n(128);o.fill();for(var i=0;64>i;i++){var s=e.charCodeAt(i);o[s]=i}return t.encode=function(t){for(var n="",r=t.length,o=0,i=0;r>i;i++){var s=t[i];switch(i%3){case 0:n+=e[s>>2],o=(3&s)<<4;break;case 1:n+=e[o|s>>4],o=(15&s)<<2;break;case 2:n+=e[o|s>>6],n+=e[63&s],o=0}}return r%3&&(n+=e[o]),n},t.decode=function(e){for(var t=e.length,r=0,i=new n(~~(t/4*3)),s=0,a=0;t>a;a++){var u=o[e.charCodeAt(a)];switch(a%4){case 0:s=u<<2;break;case 1:i[r++]=s|u>>4,s=u<<4&255;break;case 2:i[r++]=s|u>>2,s=u<<6&255;break;case 3:i[r++]=s|u}}return i},t},t.exports(r,t.exports)},{buffer:21}],101:[function(e,t){"use strict";function n(){this.length=0}n.prototype.push=function(e){var t={item:e};this.last=this.last?this.last.next=t:this.first=t,this.length++},n.prototype.shift=function(){var e=this.first;return e?(this.first=e.next,--this.length||(this.last=void 0),e.item):void 0},n.prototype.slice=function(e,t){e="undefined"==typeof e?0:e,t="undefined"==typeof t?1/0:t;for(var n=[],r=0,o=this.first;o&&!(--t<0);o=o.next)++r>e&&n.push(o.item);return n},t.exports=n},{}],102:[function(e,t){(function(n,r){"use strict";function o(){this.queue=new s,this.running=!1}var i=e("argsarray"),s=e("tiny-queue"),a=r.setImmediate||n.nextTick;o.prototype.add=function(e,t){this.queue.push({fun:e,callback:t}),this.processNext()},o.prototype.processNext=function(){var e=this;if(!e.running&&e.queue.length){e.running=!0;var t=e.queue.shift();a(function(){t.fun(i(function(n){t.callback.apply(null,n),e.running=!1,e.processNext()}))})}},t.exports=o}).call(this,e("/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,argsarray:17,"tiny-queue":101}],103:[function(e,t,n){"use strict";n.sortedIndexOf=function(e,t){for(var n,r=0,o=e.length;o>r;)n=r+o>>>1,e[n]<t?r=n+1:o=n;return r}},{}],104:[function(e,t){"use strict";function n(e){return null===e?String(e):"object"==typeof e||"function"==typeof e?u[f.call(e)]||"object":typeof e}function r(e){return null!==e&&e===e.window}function o(e){if(!e||"object"!==n(e)||e.nodeType||r(e))return!1;try{if(e.constructor&&!h.call(e,"constructor")&&!h.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}var o;for(o in e);return void 0===o||h.call(e,o)}function i(e){return"function"===n(e)}function s(){for(var e=[],t=-1,n=arguments.length,r=new Array(n);++t<n;)r[t]=arguments[t];var o={};e.push({args:r,result:{container:o,key:"key"}});for(var i;i=e.pop();)a(e,i.args,i.result);return o.key}function a(e,t,n){var r,s,a,u,c,l,d,f=t[0]||{},h=1,g=t.length,y=!1,b=/\d+/;for("boolean"==typeof f&&(y=f,f=t[1]||{},h=2),"object"==typeof f||i(f)||(f={}),g===h&&(f=this,--h);g>h;h++)if(null!=(r=t[h])){d=p(r);for(s in r)if(!(s in Object.prototype)){if(d&&!b.test(s))continue;if(a=f[s],u=r[s],f===u)continue;y&&u&&(o(u)||(c=p(u)))?(c?(c=!1,l=a&&p(a)?a:[]):l=a&&o(a)?a:{},e.push({args:[y,l,u],result:{container:f,key:s}})):void 0!==u&&(p(r)&&i(u)||(f[s]=u))}}n.container[n.key]=f}for(var u={},c=["Boolean","Number","String","Function","Array","Date","RegExp","Object","Error"],l=0;l<c.length;l++){var d=c[l];u["[object "+d+"]"]=d.toLowerCase()}var f=u.toString,h=u.hasOwnProperty,p=Array.isArray||function(e){return"array"===n(e)};t.exports=s},{}],105:[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(o){r=self}r.SparkMD5=e()}}(function(){"use strict";var e=function(e,t){return e+t&4294967295},t=function(t,n,r,o,i,s){return n=e(e(n,t),e(o,s)),e(n<<i|n>>>32-i,r)},n=function(e,n,r,o,i,s,a){return t(n&r|~n&o,e,n,i,s,a)},r=function(e,n,r,o,i,s,a){return t(n&o|r&~o,e,n,i,s,a)},o=function(e,n,r,o,i,s,a){return t(n^r^o,e,n,i,s,a)},i=function(e,n,r,o,i,s,a){return t(r^(n|~o),e,n,i,s,a)},s=function(t,s){var a=t[0],u=t[1],c=t[2],l=t[3];a=n(a,u,c,l,s[0],7,-680876936),l=n(l,a,u,c,s[1],12,-389564586),c=n(c,l,a,u,s[2],17,606105819),u=n(u,c,l,a,s[3],22,-1044525330),a=n(a,u,c,l,s[4],7,-176418897),l=n(l,a,u,c,s[5],12,1200080426),c=n(c,l,a,u,s[6],17,-1473231341),u=n(u,c,l,a,s[7],22,-45705983),a=n(a,u,c,l,s[8],7,1770035416),l=n(l,a,u,c,s[9],12,-1958414417),c=n(c,l,a,u,s[10],17,-42063),u=n(u,c,l,a,s[11],22,-1990404162),a=n(a,u,c,l,s[12],7,1804603682),l=n(l,a,u,c,s[13],12,-40341101),c=n(c,l,a,u,s[14],17,-1502002290),u=n(u,c,l,a,s[15],22,1236535329),a=r(a,u,c,l,s[1],5,-165796510),l=r(l,a,u,c,s[6],9,-1069501632),c=r(c,l,a,u,s[11],14,643717713),u=r(u,c,l,a,s[0],20,-373897302),a=r(a,u,c,l,s[5],5,-701558691),l=r(l,a,u,c,s[10],9,38016083),c=r(c,l,a,u,s[15],14,-660478335),u=r(u,c,l,a,s[4],20,-405537848),a=r(a,u,c,l,s[9],5,568446438),l=r(l,a,u,c,s[14],9,-1019803690),c=r(c,l,a,u,s[3],14,-187363961),u=r(u,c,l,a,s[8],20,1163531501),a=r(a,u,c,l,s[13],5,-1444681467),l=r(l,a,u,c,s[2],9,-51403784),c=r(c,l,a,u,s[7],14,1735328473),u=r(u,c,l,a,s[12],20,-1926607734),a=o(a,u,c,l,s[5],4,-378558),l=o(l,a,u,c,s[8],11,-2022574463),c=o(c,l,a,u,s[11],16,1839030562),u=o(u,c,l,a,s[14],23,-35309556),a=o(a,u,c,l,s[1],4,-1530992060),l=o(l,a,u,c,s[4],11,1272893353),c=o(c,l,a,u,s[7],16,-155497632),u=o(u,c,l,a,s[10],23,-1094730640),a=o(a,u,c,l,s[13],4,681279174),l=o(l,a,u,c,s[0],11,-358537222),c=o(c,l,a,u,s[3],16,-722521979),u=o(u,c,l,a,s[6],23,76029189),a=o(a,u,c,l,s[9],4,-640364487),l=o(l,a,u,c,s[12],11,-421815835),c=o(c,l,a,u,s[15],16,530742520),u=o(u,c,l,a,s[2],23,-995338651),a=i(a,u,c,l,s[0],6,-198630844),l=i(l,a,u,c,s[7],10,1126891415),c=i(c,l,a,u,s[14],15,-1416354905),u=i(u,c,l,a,s[5],21,-57434055),a=i(a,u,c,l,s[12],6,1700485571),l=i(l,a,u,c,s[3],10,-1894986606),c=i(c,l,a,u,s[10],15,-1051523),u=i(u,c,l,a,s[1],21,-2054922799),a=i(a,u,c,l,s[8],6,1873313359),l=i(l,a,u,c,s[15],10,-30611744),c=i(c,l,a,u,s[6],15,-1560198380),u=i(u,c,l,a,s[13],21,1309151649),a=i(a,u,c,l,s[4],6,-145523070),l=i(l,a,u,c,s[11],10,-1120210379),c=i(c,l,a,u,s[2],15,718787259),u=i(u,c,l,a,s[9],21,-343485551),t[0]=e(a,t[0]),t[1]=e(u,t[1]),t[2]=e(c,t[2]),t[3]=e(l,t[3])},a=function(e){var t,n=[];for(t=0;64>t;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},u=function(e){var t,n=[];for(t=0;64>t;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n},c=function(e){var t,n,r,o,i,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;c>=t;t+=64)s(l,a(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;n>t;t+=1)r[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(l,r),t=0;16>t;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),u=parseInt(o[1],16)||0,r[14]=i,r[15]=u,s(l,r),l},l=function(e){var t,n,r,o,i,a,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;c>=t;t+=64)s(l,u(e.subarray(t-64,t)));for(e=c>t-64?e.subarray(t-64):new Uint8Array(0),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;n>t;t+=1)r[t>>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(l,r),t=0;16>t;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),a=parseInt(o[1],16)||0,r[14]=i,r[15]=a,s(l,r),l},d=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],f=function(e){var t,n="";for(t=0;4>t;t+=1)n+=d[e>>8*t+4&15]+d[e>>8*t&15];return n},h=function(e){var t;for(t=0;t<e.length;t+=1)e[t]=f(e[t]);return e.join("")},p=function(e){return h(c(e))},g=function(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==p("hello")&&(e=function(e,t){var n=(65535&e)+(65535&t),r=(e>>16)+(t>>16)+(n>>16);return r<<16|65535&n}),g.prototype.append=function(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),this.appendBinary(e),this},g.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;n>=t;t+=64)s(this._state,a(this._buff.substring(t-64,t)));return this._buff=this._buff.substr(t-64),this},g.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;o>t;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=e?this._state:h(this._state),this.reset(),n},g.prototype._finish=function(e,t){var n,r,o,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(s(this._state,e),i=0;16>i;i+=1)e[i]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]=r,e[15]=o,s(this._state,e)},g.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},g.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},g.hash=function(e,t){/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e)));var n=c(e);return t?n:h(n)},g.hashBinary=function(e,t){var n=c(e);return t?n:h(n)},g.ArrayBuffer=function(){this.reset()},g.ArrayBuffer.prototype.append=function(e){var t,n=this._concatArrayBuffer(this._buff,e),r=n.length;for(this._length+=e.byteLength,t=64;r>=t;t+=64)s(this._state,u(n.subarray(t-64,t)));return this._buff=r>t-64?n.subarray(t-64):new Uint8Array(0),this},g.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;o>t;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=e?this._state:h(this._state),this.reset(),n},g.ArrayBuffer.prototype._finish=g.prototype._finish,g.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},g.ArrayBuffer.prototype.destroy=g.prototype.destroy,g.ArrayBuffer.prototype._concatArrayBuffer=function(e,t){var n=e.length,r=new Uint8Array(n+t.byteLength);return r.set(e),r.set(new Uint8Array(t),n),r},g.ArrayBuffer.hash=function(e,t){var n=l(new Uint8Array(e));return t?n:h(n)},g})},{}],106:[function(e,t,n){arguments[4][63][0].apply(n,arguments)},{"./_stream_readable":107,"./_stream_writable":109,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,"core-util-is":110,inherits:35}],107:[function(e,t){t.exports=e(65)},{"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,"core-util-is":110,events:19,inherits:35,isarray:111,stream:25,"string_decoder/":112}],108:[function(e,t,n){arguments[4][66][0].apply(n,arguments)},{"./_stream_duplex":106,"core-util-is":110,inherits:35}],109:[function(e,t,n){arguments[4][67][0].apply(n,arguments)},{"./_stream_duplex":106,"/Users/daleharvey/src/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":20,buffer:21,"core-util-is":110,inherits:35,stream:25}],110:[function(e,t){t.exports=e(68)},{buffer:21}],111:[function(e,t){t.exports=e(69)},{}],112:[function(e,t){t.exports=e(70)},{buffer:21}],113:[function(e,t){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":108}],114:[function(e,t){t.exports=e(42)},{}],115:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{"./has-keys":114,"object-keys":117}],116:[function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,o=function(e){var t="function"==typeof e&&!(e instanceof RegExp)||"[object Function]"===r.call(e);return t||"undefined"==typeof window||(t=e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt),t};t.exports=function(e,t){if(!o(t))throw new TypeError("iterator must be a function");var r,i,s="string"==typeof e,a=e.length,u=arguments.length>2?arguments[2]:null;if(a===+a)for(r=0;a>r;r++)null===u?t(s?e.charAt(r):e[r],r,e):t.call(u,s?e.charAt(r):e[r],r,e);else for(i in e)n.call(e,i)&&(null===u?t(e[i],i,e):t.call(u,e[i],i,e))}},{}],117:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"./shim":119}],118:[function(e,t){var n=Object.prototype.toString;t.exports=function r(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}},{}],119:[function(e,t){!function(){"use strict";var n,r=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=e("./foreach"),s=e("./isArguments"),a=!{toString:null}.propertyIsEnumerable("toString"),u=function(){}.propertyIsEnumerable("prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];n=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===o.call(e),l=s(e),d=[];if(!t&&!n&&!l)throw new TypeError("Object.keys called on a non-object");if(l)i(e,function(e){d.push(e)});else{var f,h=u&&n;for(f in e)h&&"prototype"===f||!r.call(e,f)||d.push(f)}if(a){var p=e.constructor,g=p&&p.prototype===e;i(c,function(t){g&&"constructor"===t||!r.call(e,t)||d.push(t)})}return d},t.exports=n}()},{"./foreach":116,"./isArguments":118}],120:[function(e,t){function n(e,t,n){n(null,e)}function r(e){return function(t,r,o){return"function"==typeof t&&(o=r,r=t,t={}),"function"!=typeof r&&(r=n),"function"!=typeof o&&(o=null),e(t,r,o)
  }}var o=e("readable-stream/transform"),i=e("util").inherits,s=e("xtend");t.exports=r(function(e,t,n){var r=new o(e);return r._transform=t,n&&(r._flush=n),r}),t.exports.ctor=r(function(e,t,n){function r(t){return this instanceof r?(this.options=s(e,t),void o.call(this,this.options)):new r(t)}return i(r,o),r.prototype._transform=t,n&&(r.prototype._flush=n),r}),t.exports.obj=r(function(e,t,n){var r=new o(s({objectMode:!0},e));return r._transform=t,n&&(r._flush=n),r})},{"readable-stream/transform":113,util:33,xtend:115}],121:[function(e,t,n){"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[n.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(e);else if(i===t.length-2){var s=t.pop();o[s]=e}else t.push(e)}n.stringify=function(e){var t=[];t.push({obj:e});for(var n,r,o,i,s,a,u,c,l,d,f,h="";n=t.pop();)if(r=n.obj,o=n.prefix||"",i=n.val||"",h+=o,i)h+=i;else if("object"!=typeof r)h+="undefined"==typeof r?null:JSON.stringify(r);else if(null===r)h+="null";else if(Array.isArray(r)){for(t.push({val:"]"}),s=r.length-1;s>=0;s--)a=0===s?"":",",t.push({obj:r[s],prefix:a});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),s=u.length-1;s>=0;s--)l=u[s],d=r[l],f=s>0?",":"",f+=JSON.stringify(l)+":",t.push({obj:d,prefix:f});t.push({val:"{"})}return h},n.parse=function(e){for(var t,n,o,i,s,a,u,c,l,d=[],f=[],h=0;;)if(t=e[h++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case"	":case"\n":case":":case",":break;case"n":h+=3,r(null,d,f);break;case"t":h+=3,r(!0,d,f);break;case"f":h+=4,r(!1,d,f);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",h--;;){if(o=e[h++],!/[\d\.\-e\+]/.test(o)){h--;break}n+=o}r(parseFloat(n),d,f);break;case'"':for(i="",s=void 0,a=0;;){if(u=e[h++],'"'===u&&("\\"!==s||a%2!==1))break;i+=u,s=u,"\\"===s?a++:a=0}r(JSON.parse('"'+i+'"'),d,f);break;case"[":c={element:[],index:d.length},d.push(c.element),f.push(c);break;case"{":l={element:{},index:d.length},d.push(l.element),f.push(l);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===d.length)return d.pop();r(d.pop(),d,f)}}},{}]},{},[12]);