Skip to content

Instantly share code, notes, and snippets.

@joallard
Created August 18, 2020 00:30
Show Gist options
  • Save joallard/bfbb428586a5de553e14fcbdf0ddd25a to your computer and use it in GitHub Desktop.
Save joallard/bfbb428586a5de553e14fcbdf0ddd25a to your computer and use it in GitHub Desktop.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pouchdbLiveFind=e()}}((function(){return function e(t,n,r){function o(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[u]={exports:{}};t[u][0].call(f.exports,(function(e){return o(t[u][1][e]||e)}),f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var s,a=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),s=0===c.x}catch(e){s=!1}function f(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n){if(t)e.call(n);else for(var r=e.length,o=w(e,r),i=0;i<r;++i)o[i].call(n)}function p(e,t,n,r){if(t)e.call(n,r);else for(var o=e.length,i=w(e,o),u=0;u<o;++u)i[u].call(n,r)}function d(e,t,n,r,o){if(t)e.call(n,r,o);else for(var i=e.length,u=w(e,i),s=0;s<i;++s)u[s].call(n,r,o)}function h(e,t,n,r,o,i){if(t)e.call(n,r,o,i);else for(var u=e.length,s=w(e,u),a=0;a<u;++a)s[a].call(n,r,o,i)}function v(e,t,n,r){if(t)e.apply(n,r);else for(var o=e.length,i=w(e,o),u=0;u<o;++u)i[u].apply(n,r)}function y(e,t,n,o){var i,u,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),u=e._events),s=u[t]):(u=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=u[t]=o?[n,s]:[s,n]:o?s.unshift(n):s.push(n),!s.warned&&(i=f(e))&&i>0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else s=u[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function m(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=i.call(g,r);return o.listener=n,r.wrapFn=o,o}function b(e,t,n){var r=e._events;if(!r)return[];var o=r[t];return o?"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):w(o,o.length):[]}function _(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}s?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');a=e}}):u.defaultMaxListeners=a,u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return f(this)},u.prototype.emit=function(e){var t,n,r,o,i,u,s="error"===e;if(u=this._events)s=s&&null==u.error;else if(!s)return!1;if(s){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var a=new Error('Unhandled "error" event. ('+t+")");throw a.context=t,a}if(!(n=u[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:l(n,c,this);break;case 2:p(n,c,this,arguments[1]);break;case 3:d(n,c,this,arguments[1],arguments[2]);break;case 4:h(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(r-1),i=1;i<r;i++)o[i-1]=arguments[i];v(n,c,this,o)}return!0},u.prototype.addListener=function(e,t){return y(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return y(this,e,t,!0)},u.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,m(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,m(this,e,t)),this},u.prototype.removeListener=function(e,t){var n,o,i,u,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(n=o[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,u=n.length-1;u>=0;u--)if(n[u]===t||n[u].listener===t){s=n[u].listener,i=u;break}if(i<0)return this;0===i?n.shift():function(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i),1===n.length&&(o[e]=n[0]),o.removeListener&&this.emit("removeListener",e,s||t)}return this},u.prototype.removeAllListeners=function(e){var t,n,i;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var u,s=o(n);for(i=0;i<s.length;++i)"removeListener"!==(u=s[i])&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},u.prototype.listeners=function(e){return b(this,e,!0)},u.prototype.rawListeners=function(e){return b(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_.call(e,t)},u.prototype.listenerCount=_,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],2:[function(e,t,n){"use strict";var r=e("pouchdb-collate").collate,o=e("pouchdb-selector-core"),i=o.filterInMemoryFields,u=e("./utils"),s=o.compare,a=u.getUserFields,c=o.getKey,f=o.getValue,l=o.parseField;n.memoryFilter=function(e,t){var n=a(t.selector,t.sort).fields,r=e.map((function(e){return{doc:e}}));return i(r,t,n).map((function(e){return e.doc}))},n.createFieldSorter=function(e){function t(t){return e.map((function(e){var n=c(e),r=l(n);return function(e,t){for(var n=e,r=0,o=t.length;r<o;r++){var i=t[r];if(!(n=n[i]))break}return n}(t,r)}))}var n=e.map((function(e){return"string"!=typeof e&&"desc"===f(e)?-1:1}));return function(e,o){for(var i=t(e),u=t(o),a=0,c=n.length;a<c;a++){var f=r(i[a],u[a]);if(0!==f)return f*n[a]}return s(e._id,o._id)*n[0]}}},{"./utils":4,"pouchdb-collate":9,"pouchdb-selector-core":13}],3:[function(e,t,n){"use strict";var r=e("events"),o=e("./helpers"),i=(e("pouchdb-collate").collate,e("pouchdb-selector-core")),u=e("./utils"),s=(i.getValue,i.massageSelector),a=u.massageSort;n.liveFind=function(e){if("function"!=typeof this.find)throw new Error("ERROR: PouchDB Find is a requirement for LiveFind and must be loaded first.");var t,n,i,c=this,f=!1,l={},p=new r,d=[],h=e.aggregate||!1,v=e.fields,y=!1,g=!1;v&&(-1===v.indexOf("_id")&&(v.unshift("_id"),y=!0),-1===v.indexOf("_rev")&&(v.push("_rev"),g=!0)),e.selector&&(t=s(e.selector)),e.sort&&(n=a(e.sort),i=o.createFieldSorter(n));var m=parseInt(e.skip,10)||0,b=parseInt(e.limit,10)||0,_={selector:t,fields:v},w=c.find(_).then((function(e){e.docs.forEach((function(e){!function(e){l[e._id]=e._rev;var t=e._id,n=e._rev;y&&delete e._id;g&&delete e._rev;A(e,t,n)}(e)})),p.emit("ready")})).catch((function(e){throw p.emit("error",e),O(),e}));function E(e){w.then((function(){e.doc&&function(e){if(l[e._id]===e._rev)return;var n=e._id,r=e._rev;if(e._deleted&&l[n])return l[n]=null,L({_id:n,_rev:r,deleted:!0},n,r);var i=function(e){var n=o.memoryFilter([e],{selector:t});if(n.length)return n[0];return null}(e);if(!i&&l[n])return l[n]=null,L({_id:n,_rev:r},n,r);if(i&&!l[n])return l[n]=r,A(j(i),n,r);if(i&&l[n])l[n]=r,function(e,t,n){var r;h&&(d=d.map((function(t){return t._id===e._id?e:t})),r=S(d));p.emit("update",{action:"UPDATE",id:t,rev:n,doc:e},r)}(j(i),n,r)}(e.doc)}))}function $(e){p.emit("error",e)}function O(){f||(c._activeQueries--,c._activeQueries?(c._changeListener.removeListener("change",E),c._changeListener.removeListener("error",$)):(c._changeListener.cancel(),delete c._changeListener),p.emit("cancelled"),p.removeAllListeners(),f=!0)}function j(e){if(v){var t=u.pick(e,v);return y&&delete t._id,g&&delete t._rev,t}return e}function L(e,t,n){var r;h&&(r=S(d=d.filter((function(t){return t._id!==e._id})))),p.emit("update",{action:"REMOVE",id:t,rev:n,doc:e},r)}function A(e,t,n){var r;h&&(r=S(d=d.concat(e))),p.emit("update",{action:"ADD",id:t,rev:n,doc:e},r)}function x(e){return e.sort(i)}function S(e){return n&&(e=x(e)),(m||b)&&(e=b?e.slice(m,m+b):e.slice(m)),e}return c._changeListener||(c._changeListener=c.changes({live:!0,retry:!0,include_docs:!0,since:"now"})),c._activeQueries?c._activeQueries++:c._activeQueries=1,c._changeListener.on("change",E).on("error",$),p.cancel=O,p.then=w.then.bind(w),p.catch=w.catch.bind(w),p.sort=function(e){return n?x(e):e},p.paginate=function(e){if(!h||!e||"object"!=typeof e)return;null!=e.skip&&(m=parseInt(e.skip,10)||0);null!=e.limit&&(b=parseInt(e.limit,10)||0);e.sort&&e.sort instanceof Array&&(n=a(e.sort),i=o.createFieldSorter(n));return S(d)},p},"undefined"!=typeof window&&window.PouchDB&&window.PouchDB.plugin(n)},{"./helpers":2,"./utils":4,events:1,"pouchdb-collate":9,"pouchdb-selector-core":13}],4:[function(e,t,n){"use strict";var r=e("pouchdb-selector-core"),o=r.getKey,i=r.getFieldFromDoc,u=r.setFieldInDoc,s=r.parseField;n.getUserFields=function(e,t){var n,r=Object.keys(e),i=t?t.map(o):[];return n=r.length>=i.length?r:i,0===i.length?{fields:n}:{fields:n=n.sort((function(e,t){var n=i.indexOf(e);-1===n&&(n=Number.MAX_VALUE);var r=i.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),n<r?-1:n>r?1:0})),sortOrder:t.map(o)}},n.massageSort=function(e){if(!Array.isArray(e))throw new Error("invalid sort json - should be an array");return e.map((function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e}))},n.pick=function(e,t){for(var n={},r=0,o=t.length;r<o;r++){var a=s(t[r]),c=i(e,a);void 0!==c&&u(n,a,c)}return n}},{"pouchdb-selector-core":13}],5:[function(e,t,n){"use strict";t.exports=function(e){return function(){var t=arguments.length;if(t){for(var n=[],r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}return e.call(this,[])}}},{}],6:[function(e,t,n){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,u=new o(f),s=e.document.createTextNode("");u.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var a=new e.MessageChannel;a.port1.onmessage=f,n=function(){a.port2.postMessage(0)}}var c=[];function f(){var e,t;r=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}r=!1}t.exports=function(e){1!==c.push(e)||r||n()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],8:[function(e,t,n){"use strict";var r=e("immediate");function o(){}var i={},u=["REJECTED"],s=["FULFILLED"],a=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)}))}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var u=h((function(){t(o,r)}));"error"===u.status&&r(u.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===u)return this;var n=new this.constructor(o);this.state!==a?l(n,this.state===s?e:t,this.outcome):this.queue.push(new f(n,e,t));return n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(p,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)d(e,r);else{e.state=s,e.outcome=t;for(var o=-1,u=e.queue.length;++o<u;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=u,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},c.resolve=function(e){if(e instanceof this)return e;return i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o);return i.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);var u=new Array(n),s=0,a=-1,c=new this(o);for(;++a<n;)f(e[a],a);return c;function f(e,o){t.resolve(e).then((function(e){u[o]=e,++s!==n||r||(r=!0,i.resolve(c,u))}),(function(e){r||(r=!0,i.reject(c,e))}))}},c.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);var u=-1,s=new this(o);for(;++u<n;)a=e[u],t.resolve(a).then((function(e){r||(r=!0,i.resolve(s,e))}),(function(e){r||(r=!0,i.reject(s,e))}));var a;return s}},{immediate:6}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=-324,o=3,i="";function u(e,t){if(e===t)return 0;e=s(e),t=s(t);var n=p(e),r=p(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return function(e,t){return e===t?0:e>t?1:-1}(e,t)}return Array.isArray(e)?function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var o=u(e[r],t[r]);if(0!==o)return o}return e.length===t.length?0:e.length>t.length?1:-1}(e,t):function(e,t){for(var n=Object.keys(e),r=Object.keys(t),o=Math.min(n.length,r.length),i=0;i<o;i++){var s=u(n[i],r[i]);if(0!==s)return s;if(0!==(s=u(e[n[i]],t[r[i]])))return s}return n.length===r.length?0:n.length>r.length?1:-1}(e,t)}function s(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=s(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e)for(var o in e={},t)if(t.hasOwnProperty(o)){var i=t[o];void 0!==i&&(e[o]=s(i))}}}return e}function a(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return function(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),u=e<0,s=u?"0":"2",a=(c=((u?-n:n)-r).toString(),f="0",l=o,function(e,t,n){for(var r="",o=n-e.length;r.length<o;)r+=t;return r}(c,f,l)+c);var c,f,l;s+=i+a;var p=Math.abs(parseFloat(t[0]));u&&(p=10-p);var d=p.toFixed(20);return d=d.replace(/\.?0+$/,""),s+=i+d}(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),u=-1,s=n.length,a="";if(t)for(;++u<s;)a+=c(n[u]);else for(;++u<s;){var f=n[u];a+=c(f)+c(e[f])}return a}return""}function c(e){return p(e=s(e))+i+a(e)+"\0"}function f(e,t){var n,i=t;if("1"===e[t])n=0,t++;else{var u="0"===e[t];t++;var s="",a=e.substring(t,t+o),c=parseInt(a,10)+r;for(u&&(c=-c),t+=o;;){var f=e[t];if("\0"===f)break;s+=f,t++}n=1===(s=s.split(".")).length?parseInt(s,10):parseFloat(s[0]+"."+s[1]),u&&(n-=10),0!==c&&(n=parseFloat(n+"e"+c))}return{num:n,length:t-i}}function l(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(n);else if(i===e.length-2){o[e.pop()]=n}else e.push(n)}}function p(e){var t=["boolean","number","string","object"].indexOf(typeof e);return~t?null===e?1:Array.isArray(e)?5:t<3?t+2:t+3:Array.isArray(e)?5:void 0}n.collate=u,n.normalizeKey=s,n.toIndexableString=c,n.parseIndexableString=function(e){for(var t=[],n=[],r=0;;){var o=e[r++];if("\0"!==o)switch(o){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var i=f(e,r);t.push(i.num),r+=i.length;break;case"4":for(var u="";;){var s=e[r];if("\0"===s)break;u+=s,r++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var a={element:[],index:t.length};t.push(a.element),n.push(a);break;case"6":var c={element:{},index:t.length};t.push(c.element),n.push(c);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+o)}else{if(1===t.length)return t.pop();l(t,n)}}}},{}],10:[function(e,t,n){"use strict";function r(e){return"$"+e}function o(e){return e.substring(1)}function i(){this._store={}}function u(e){if(this._store=new i,e&&Array.isArray(e))for(var t=0,n=e.length;t<n;t++)this.add(e[t])}Object.defineProperty(n,"__esModule",{value:!0}),i.prototype.get=function(e){var t=r(e);return this._store[t]},i.prototype.set=function(e,t){var n=r(e);return this._store[n]=t,!0},i.prototype.has=function(e){return r(e)in this._store},i.prototype.delete=function(e){var t=r(e),n=t in this._store;return delete this._store[t],n},i.prototype.forEach=function(e){for(var t=Object.keys(this._store),n=0,r=t.length;n<r;n++){var i=t[n];e(this._store[i],i=o(i))}},Object.defineProperty(i.prototype,"size",{get:function(){return Object.keys(this._store).length}}),u.prototype.add=function(e){return this._store.set(e,!0)},u.prototype.has=function(e){return this._store.has(e)},u.prototype.forEach=function(e){this._store.forEach((function(t,n){e(n)}))},Object.defineProperty(u.prototype,"size",{get:function(){return this._store.size}}),!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var e=Object.getOwnPropertyDescriptor(Map,Symbol.species);return e&&"get"in e&&Map[Symbol.species]===Map}()?(n.Set=u,n.Map=i):(n.Set=Set,n.Map=Map)},{}],11:[function(e,t,n){"use strict";var r;function o(e,t,n){Error.call(this,n),this.status=e,this.name=t,this.message=n,this.error=!0}Object.defineProperty(n,"__esModule",{value:!0}),((r=e("inherits"))&&"object"==typeof r&&"default"in r?r.default:r)(o,Error),o.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var i=new o(401,"unauthorized","Name or password is incorrect."),u=new o(400,"bad_request","Missing JSON list of 'docs'"),s=new o(404,"not_found","missing"),a=new o(409,"conflict","Document update conflict"),c=new o(400,"bad_request","_id field must contain a string"),f=new o(412,"missing_id","_id is required for puts"),l=new o(400,"bad_request","Only reserved document ids may start with underscore."),p=new o(412,"precondition_failed","Database not open"),d=new o(500,"unknown_error","Database encountered an unknown error"),h=new o(500,"badarg","Some query argument is invalid"),v=new o(400,"invalid_request","Request was invalid"),y=new o(400,"query_parse_error","Some query parameter is invalid"),g=new o(500,"doc_validation","Bad special document member"),m=new o(400,"bad_request","Something wrong with the request"),b=new o(400,"bad_request","Document must be a JSON object"),_=new o(404,"not_found","Database not found"),w=new o(500,"indexed_db_went_bad","unknown"),E=new o(500,"web_sql_went_bad","unknown"),$=new o(500,"levelDB_went_went_bad","unknown"),O=new o(403,"forbidden","Forbidden by design doc validate_doc_update function"),j=new o(400,"bad_request","Invalid rev format"),L=new o(412,"file_exists","The database could not be created, the file already exists."),A=new o(412,"missing_stub","A pre-existing attachment stub wasn't found"),x=new o(413,"invalid_url","Provided URL is invalid");n.UNAUTHORIZED=i,n.MISSING_BULK_DOCS=u,n.MISSING_DOC=s,n.REV_CONFLICT=a,n.INVALID_ID=c,n.MISSING_ID=f,n.RESERVED_ID=l,n.NOT_OPEN=p,n.UNKNOWN_ERROR=d,n.BAD_ARG=h,n.INVALID_REQUEST=v,n.QUERY_PARSE_ERROR=y,n.DOC_VALIDATION=g,n.BAD_REQUEST=m,n.NOT_AN_OBJECT=b,n.DB_MISSING=_,n.WSQ_ERROR=E,n.LDB_ERROR=$,n.FORBIDDEN=O,n.INVALID_REV=j,n.FILE_EXISTS=L,n.MISSING_STUB=A,n.IDB_ERROR=w,n.INVALID_URL=x,n.createError=function(e,t){function n(t){for(var n in e)"function"!=typeof e[n]&&(this[n]=e[n]);void 0!==t&&(this.reason=t)}return n.prototype=o.prototype,new n(t)},n.generateErrorFromResponse=function(e){if("object"!=typeof e){var t=e;(e=d).data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),e}},{inherits:7}],12:[function(e,t,n){"use strict";var r,o=(r=e("lie"))&&"object"==typeof r&&"default"in r?r.default:r,i="function"==typeof Promise?Promise:o;t.exports=i},{lie:8}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("pouchdb-utils"),o=e("pouchdb-collate");function i(e,t){for(var n=e,r=0,o=t.length;r<o;r++){if(!(n=n[t[r]]))break}return n}function u(e,t){return e<t?-1:e>t?1:0}function s(e){for(var t=[],n="",r=0,o=e.length;r<o;r++){var i=e[r];"."===i?r>0&&"\\"===e[r-1]?n=n.substring(0,n.length-1)+".":(t.push(n),n=""):n+=i}return t.push(n),t}var a=["$or","$nor","$not"];function c(e){return a.indexOf(e)>-1}function f(e){return Object.keys(e)[0]}function l(e){return e[f(e)]}function p(e){var t={};return e.forEach((function(e){Object.keys(e).forEach((function(n){var r=e[n];if("object"!=typeof r&&(r={$eq:r}),c(n))r instanceof Array?t[n]=r.map((function(e){return p([e])})):t[n]=p([r]);else{var o=t[n]=t[n]||{};Object.keys(r).forEach((function(e){var t=r[e];return"$gt"===e||"$gte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t}(e,t,o):"$lt"===e||"$lte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t}(e,t,o):"$ne"===e?function(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}(t,o):"$eq"===e?function(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}(t,o):void(o[e]=t)}))}}))})),t}function d(e){var t=r.clone(e),n=!1;"$and"in t&&(t=p(t.$and),n=!0),["$or","$nor"].forEach((function(e){e in t&&t[e].forEach((function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],o=e[r];"object"==typeof o&&null!==o||(e[r]={$eq:o})}}))})),"$not"in t&&(t.$not=p([t.$not]));for(var o=Object.keys(t),i=0;i<o.length;i++){var u=o[i],s=t[u];"object"!=typeof s||null===s?s={$eq:s}:"$ne"in s&&!n&&(s.$ne=[s.$ne]),t[u]=s}return t}function h(e){function t(t){return e.map((function(e){var n=s(f(e));return i(t,n)}))}return function(e,n){var r=t(e.doc),i=t(n.doc),s=o.collate(r,i);return 0!==s?s:u(e.doc._id,n.doc._id)}}function v(e,t,n){if(e=e.filter((function(e){return y(e.doc,t.selector,n)})),t.sort){var r=h(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===l(t.sort[0])&&(e=e.reverse())}if("limit"in t||"skip"in t){var o=t.skip||0,i=("limit"in t?t.limit:e.length)+o;e=e.slice(o,i)}return e}function y(e,t,n){return n.every((function(n){var r=t[n],o=s(n),u=i(e,o);return c(n)?function(e,t,n){if("$or"===e)return t.some((function(e){return y(n,e,Object.keys(e))}));if("$not"===e)return!y(n,t,Object.keys(t));return!t.find((function(e){return y(n,e,Object.keys(e))}))}(n,r,e):g(r,e,o,u)}))}function g(e,t,n,r){return!e||Object.keys(e).every((function(o){var i=e[o];return function(e,t,n,r,o){if(!w[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return w[e](t,n,r,o)}(o,t,i,n,r)}))}function m(e){return null!=e}function b(e){return void 0!==e}function _(e,t){return t.some((function(t){return e instanceof Array?e.indexOf(t)>-1:e===t}))}var w={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.some((function(e){return y(e,t,Object.keys(t))})):r.some((function(r){return g(t,e,n,r)}))))},$allMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]?r.every((function(e){return y(e,t,Object.keys(t))})):r.every((function(r){return g(t,e,n,r)}))))},$eq:function(e,t,n,r){return b(r)&&0===o.collate(r,t)},$gte:function(e,t,n,r){return b(r)&&o.collate(r,t)>=0},$gt:function(e,t,n,r){return b(r)&&o.collate(r,t)>0},$lte:function(e,t,n,r){return b(r)&&o.collate(r,t)<=0},$lt:function(e,t,n,r){return b(r)&&o.collate(r,t)<0},$exists:function(e,t,n,r){return t?b(r):!b(r)},$mod:function(e,t,n,r){return m(r)&&function(e,t){var n=t[0],r=t[1];if(0===n)throw new Error("Bad divisor, cannot divide by zero");if(parseInt(n,10)!==n)throw new Error("Divisor is not an integer");if(parseInt(r,10)!==r)throw new Error("Modulus is not an integer");return parseInt(e,10)===e&&e%n===r}(r,t)},$ne:function(e,t,n,r){return t.every((function(e){return 0!==o.collate(r,e)}))},$in:function(e,t,n,r){return m(r)&&_(r,t)},$nin:function(e,t,n,r){return m(r)&&!_(r,t)},$size:function(e,t,n,r){return m(r)&&function(e,t){return e.length===t}(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&function(e,t){return t.every((function(t){return e.indexOf(t)>-1}))}(r,t)},$regex:function(e,t,n,r){return m(r)&&function(e,t){return new RegExp(t).test(e)}(r,t)},$type:function(e,t,n,r){return function(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}throw new Error(t+" not supported as a type.Please use one of object, string, array, number, boolean or null.")}(r,t)}};n.massageSelector=d,n.matchesSelector=function(e,t){if("object"!=typeof t)throw new Error("Selector error: expected a JSON object");var n=v([{doc:e}],{selector:t=d(t)},Object.keys(t));return n&&1===n.length},n.filterInMemoryFields=v,n.createFieldSorter=h,n.rowFilter=y,n.isCombinationalField=c,n.getKey=f,n.getValue=l,n.getFieldFromDoc=i,n.setFieldInDoc=function(e,t,n){for(var r=0,o=t.length;r<o-1;r++){e=e[t[r]]={}}e[t[o-1]]=n},n.compare=u,n.parseField=s},{"pouchdb-collate":9,"pouchdb-utils":14}],14:[function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(n,"__esModule",{value:!0});var o=r(e("argsarray")),i=r(e("pouchdb-promise")),u=e("pouchdb-collections"),s=r(e("immediate")),a=e("events"),c=r(e("inherits")),f=e("pouchdb-errors"),l=r(e("uuid"));function p(e){if(e instanceof ArrayBuffer)return function(e){if("function"==typeof e.slice)return e.slice(0);var t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t),r=new Uint8Array(e);return n.set(r),t}(e);var t=e.size,n=e.type;return"function"==typeof e.slice?e.slice(0,t,n):e.webkitSlice(0,t,n)}var d=Function.prototype.toString,h=d.call(Object);function v(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n<r;n++)t[n]=v(e[n]);return t}if(e instanceof Date)return e.toISOString();if(function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}(e))return p(e);if(!function(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&d.call(n)==h}(e))return e;for(n in t={},e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=v(e[n]);void 0!==o&&(t[n]=o)}return t}function y(e){var t=!1;return o((function(n){if(t)throw new Error("once called more than once");t=!0,e.apply(this,n)}))}function g(e){return o((function(t){t=v(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),o=new i((function(r,o){var i;try{var u=y((function(e,t){e?o(e):r(t)}));t.push(u),(i=e.apply(n,t))&&"function"==typeof i.then&&r(i)}catch(e){o(e)}}));return r&&o.then((function(e){r(null,e)}),r),o}))}function m(e,t){for(var n={},r=0,o=t.length;r<o;r++){var i=t[r];i in e&&(n[i]=e[i])}return n}var b,_=6;function w(e){return e}function E(e){return[{ok:e}]}function $(){return"undefined"!=typeof chrome&&void 0!==chrome.storage&&void 0!==chrome.storage.local}if($())b=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),b=!!localStorage.getItem("_pouch_check_localstorage")}catch(e){b=!1}function O(){return b}function j(){a.EventEmitter.call(this),this._listeners={},function(e){$()?chrome.storage.onChanged.addListener((function(t){null!=t.db_name&&e.emit(t.dbName.newValue)})):O()&&("undefined"!=typeof addEventListener?addEventListener("storage",(function(t){e.emit(t.key)})):window.attachEvent("storage",(function(t){e.emit(t.key)})))}(this)}function L(e){if("undefined"!=typeof console&&"function"==typeof console[e]){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}c(j,a.EventEmitter),j.prototype.addListener=function(e,t,n,r){if(!this._listeners[t]){var o=this,i=!1;this._listeners[t]=u,this.on(e,u)}function u(){if(o._listeners[t])if(i)i="waiting";else{i=!0;var e=m(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(e).on("change",(function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))})).on("complete",(function(){"waiting"===i&&s(u),i=!1})).on("error",(function(){i=!1}))}}},j.prototype.removeListener=function(e,t){t in this._listeners&&(a.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])},j.prototype.notifyLocalWindows=function(e){$()?chrome.storage.local.set({dbName:e}):O()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},j.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var A="function"==typeof Object.assign?Object.assign:function(e){for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};var x=function(){}.name?function(e){return e.name}:function(e){return e.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};function S(e){if(!e)return null;var t=e.split("/");return 2===t.length?t:1===t.length?[e,e]:null}var k=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],I="queryKey",D=/(?:^|&)([^&=]*)=?([^&]*)/g,F=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function R(e,t,n){return new i((function(r,o){e.get(t,(function(i,u){if(i){if(404!==i.status)return o(i);u={}}var s=u._rev,a=n(u);if(!a)return r({updated:!1,rev:s});a._id=t,a._rev=s,r(function(e,t,n){return e.put(t).then((function(e){return{updated:!0,rev:e.rev}}),(function(r){if(409!==r.status)throw r;return R(e,t._id,n)}))}(e,a,n))}))}))}var M=l.v4;n.adapterFun=function(e,t){return g(o((function(n){if(this._closed)return i.reject(new Error("database is closed"));if(this._destroyed)return i.reject(new Error("database is destroyed"));var r=this;return function(e,t,n){if(e.constructor.listeners("debug").length){for(var r=["api",e.name,t],o=0;o<n.length-1;o++)r.push(n[o]);e.constructor.emit("debug",r);var i=n[n.length-1];n[n.length-1]=function(n,r){var o=["api",e.name,t];o=o.concat(n?["error",n]:["success",r]),e.constructor.emit("debug",o),i(n,r)}}}(r,e,n),this.taskqueue.isReady?t.apply(this,n):new i((function(t,o){r.taskqueue.addTask((function(i){i?o(i):t(r[e].apply(r,n))}))}))})))},n.assign=A,n.bulkGetShim=function(e,t,n){var r=t.docs,o=new u.Map;r.forEach((function(e){o.has(e.id)?o.get(e.id).push(e):o.set(e.id,[e])}));var i=o.size,s=0,a=new Array(i);function c(){var e;++s===i&&(e=[],a.forEach((function(t){t.docs.forEach((function(n){e.push({id:t.id,docs:[n]})}))})),n(null,{results:e}))}var f=[];o.forEach((function(e,t){f.push(t)}));var l=0;function p(){if(!(l>=f.length)){var n=Math.min(l+_,f.length),r=f.slice(l,n);!function(n,r){n.forEach((function(n,i){var u=r+i,s=o.get(n),f=m(s[0],["atts_since","attachments"]);f.open_revs=s.map((function(e){return e.rev})),f.open_revs=f.open_revs.filter(w);var l=w;0===f.open_revs.length&&(delete f.open_revs,l=E),["revs","attachments","binary","ajax","latest"].forEach((function(e){e in t&&(f[e]=t[e])})),e.get(n,f,(function(e,t){var r,o,i;r=e?[{error:e}]:l(t),o=n,i=r,a[u]={id:o,docs:i},c(),p()}))}))}(r,l),l+=r.length}}p()},n.changesHandler=j,n.clone=v,n.defaultBackOff=function(e){var t=0;return e||(t=2e3),function(e,t){return e=parseInt(e,10)||0,(t=parseInt(t,10))!=t||t<=e?t=(e||1)<<1:t+=1,t>6e5&&(e=3e5,t=6e5),~~((t-e)*Math.random()+e)}(e,t)},n.explainError=function(e,t){L("info","The above "+e+" is totally normal. "+t)},n.filterChange=function(e){var t={},n=e.filter&&"function"==typeof e.filter;return t.query=e.query_params,function(r){r.doc||(r.doc={});var o=n&&function(e,t,n){try{return!e(t,n)}catch(e){var r="Filter function threw: "+e.toString();return f.createError(f.BAD_REQUEST,r)}}(e.filter,r.doc,t);if("object"==typeof o)return o;if(o)return!1;if(e.include_docs){if(!e.attachments)for(var i in r.doc._attachments)r.doc._attachments.hasOwnProperty(i)&&(r.doc._attachments[i].stub=!0)}else delete r.doc;return!0}},n.flatten=function(e){for(var t=[],n=0,r=e.length;n<r;n++)t=t.concat(e[n]);return t},n.functionName=x,n.guardedConsole=L,n.hasLocalStorage=O,n.invalidIdError=function(e){var t;if(e?"string"!=typeof e?t=f.createError(f.INVALID_ID):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=f.createError(f.RESERVED_ID)):t=f.createError(f.MISSING_ID),t)throw t},n.isChromeApp=$,n.isCordova=function(){return"undefined"!=typeof cordova||"undefined"!=typeof PhoneGap||"undefined"!=typeof phonegap},n.isRemote=function(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(L("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())},n.listenerCount=function(e,t){return"listenerCount"in e?e.listenerCount(t):a.EventEmitter.listenerCount(e,t)},n.nextTick=s,n.normalizeDdocFunctionName=function(e){var t=S(e);return t?t.join("/"):null},n.once=y,n.parseDdocFunctionName=S,n.parseUri=function(e){for(var t=F.exec(e),n={},r=14;r--;){var o=k[r],i=t[r]||"",u=-1!==["user","password"].indexOf(o);n[o]=u?decodeURIComponent(i):i}return n[I]={},n[k[12]].replace(D,(function(e,t,r){t&&(n[I][t]=r)})),n},n.pick=m,n.rev=function(){return l.v4().replace(/-/g,"").toLowerCase()},n.scopeEval=function(e,t){var n=[],r=[];for(var o in t)t.hasOwnProperty(o)&&(n.push(o),r.push(t[o]));return n.push(e),Function.apply(null,n).apply(null,r)},n.toPromise=g,n.upsert=R,n.uuid=M},{argsarray:5,events:1,immediate:6,inherits:7,"pouchdb-collections":10,"pouchdb-errors":11,"pouchdb-promise":12,uuid:15}],15:[function(e,t,n){var r=e("./v1"),o=e("./v4"),i=o;i.v1=r,i.v4=o,t.exports=i},{"./v1":18,"./v4":19}],16:[function(e,t,n){for(var r=[],o=0;o<256;++o)r[o]=(o+256).toString(16).substr(1);t.exports=function(e,t){var n=t||0,o=r;return o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]}},{}],17:[function(e,t,n){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var o=new Uint8Array(16);t.exports=function(){return r(o),o}}else{var i=new Array(16);t.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},{}],18:[function(e,t,n){var r,o,i=e("./lib/rng"),u=e("./lib/bytesToUuid"),s=0,a=0;t.exports=function(e,t,n){var c=t&&n||0,f=t||[],l=(e=e||{}).node||r,p=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==p){var d=i();null==l&&(l=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=o=16383&(d[6]<<8|d[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:a+1,y=h-s+(v-a)/1e4;if(y<0&&void 0===e.clockseq&&(p=p+1&16383),(y<0||h>s)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,a=v,o=p;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[c++]=g>>>24&255,f[c++]=g>>>16&255,f[c++]=g>>>8&255,f[c++]=255&g;var m=h/4294967296*1e4&268435455;f[c++]=m>>>8&255,f[c++]=255&m,f[c++]=m>>>24&15|16,f[c++]=m>>>16&255,f[c++]=p>>>8|128,f[c++]=255&p;for(var b=0;b<6;++b)f[c+b]=l[b];return t||u(f)}},{"./lib/bytesToUuid":16,"./lib/rng":17}],19:[function(e,t,n){var r=e("./lib/rng"),o=e("./lib/bytesToUuid");t.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var u=(e=e||{}).random||(e.rng||r)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,t)for(var s=0;s<16;++s)t[i+s]=u[s];return t||o(u)}},{"./lib/bytesToUuid":16,"./lib/rng":17}]},{},[3])(3)}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment