insomnia/app/external/pouchdb.find.min.js

3 lines
56 KiB
JavaScript
Raw Normal View History

2016-04-21 05:47:03 +00:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.pouchdbFind=e()}}(function(){var e;return function t(e,n,r){function o(u,s){if(!n[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[u]={exports:{}};e[u][0].call(f.exports,function(t){var n=e[u][1][t];return o(n?n:t)},f,f.exports,t,e,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){"use strict";function r(e){if(!e)return"undefined";switch(typeof e){case"function":return e.toString();case"string":return e.toString();default:return JSON.stringify(e)}}var o=e(4),i=e(5),u=i.Promise;t.exports=function(e){var t=e.db,n=e.viewName,s=e.map,c=e.reduce,a=e.temporary,f=e.pluginName,l=r(s)+r(c)+"undefined";if(!a&&t._cachedViews){var d=t._cachedViews[l];if(d)return u.resolve(d)}return t.info().then(function(e){function r(e){e.views=e.views||{};var t=n;-1===t.indexOf("/")&&(t=n+"/"+n);var r=e.views[t]=e.views[t]||{};if(!r[u])return r[u]=!0,e}var u=e.db_name+"-mrview-"+(a?"temp":i.MD5(l));return o(t,"_local/"+f,r).then(function(){return t.registerDependentDatabase(u).then(function(e){var n=e.db;n.auto_compaction=!0;var r={name:u,db:n,sourceDB:t,adapter:t.adapter,mapFun:s,reduceFun:c};return r.db.get("_local/lastSeq")["catch"](function(e){if(404!==e.status)throw e}).then(function(e){return r.seq=e?e.seq:0,a||(t._cachedViews=t._cachedViews||{},t._cachedViews[l]=r,r.db.on("destroyed",function(){delete t._cachedViews[l]})),r})})})})}},{4:4,5:5}],2:[function(e,t,n){(function(n){"use strict";function r(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,r)}catch(t){}}function o(e){this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,o)}catch(t){}}function i(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function u(e){return 1===e.length&&/^1-/.test(e[0].rev)}function s(e,t){var n=m(e.key,t.key);return 0!==n?n:m(e.value,t.value)}function c(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function a(e){var t=e.value,n=t&&"object"==typeof t&&t._id||e.id;return n}function f(e,t){try{e.emit("error",t)}catch(n){console.error("The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),console.error(t)}}function l(e,t,n){try{return{output:t.apply(null,n)}}catch(r){return f(e,r),{error:r}}}function d(e,t){var n=e.descending?"endkey":"startkey",o=e.descending?"startkey":"endkey";if("undefined"!=typeof e[n]&&"undefined"!=typeof e[o]&&m(e[n],e[o])>0)throw new r("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&e.reduce!==!1){if(e.include_docs)throw new r("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new r("Multi-key fetches for reduce views must use {group: true}")}if(e.group_level){if("number"!=typeof e.group_level)throw new r('Invalid value for integer: "'+e.group_level+'"');if(e.group_level<0)throw new r('Invalid value for positive integer: "'+e.group_level+'"')}}function h(e){return function(t){if(404===t.status)return e;throw t}}function p(e){function t(e,t,n){function r(){return u(l)?_.resolve(c):t.db.get(s)["catch"](h(c))}function o(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):_.resolve({rows:[]})}function i(e,t){for(var n=[],r={},o=0,i=t.rows.length;i>o;o++){var u=t.rows[o],s=u.doc;if(s&&(n.push(s),r[s._id]=!0,s._deleted=!f[s._id],!s._deleted)){var c=f[s._id];"value"in c&&(s.value=c.value)}}var a=Object.keys(f);return a.forEach(function(e){if(!r[e]){var t={_id:e},o=f[e];"
}],21:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function o(e){function t(){}function o(){var e=o,t=+new Date,i=t-(a||t);e.diff=i,e.prev=a,e.curr=t,a=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var u=Array.prototype.slice.call(arguments);u[0]=n.coerce(u[0]),"string"!=typeof u[0]&&(u=["%o"].concat(u));var s=0;u[0]=u[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var o=n.formatters[r];if("function"==typeof o){var i=u[s];t=o.call(e,i),u.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(u=n.formatArgs.apply(e,u));var c=o.log||n.log||console.log.bind(console);c.apply(e,u)}t.enabled=!1,o.enabled=!0;var i=n.enabled(e)?o:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;r>o;o++)t[o]&&(e=t[o].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function u(){n.enable("")}function s(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=o,n.coerce=c,n.disable=u,n.enable=i,n.enabled=s,n.humanize=e(37),n.names=[],n.skips=[],n.formatters={};var a,f=0},{37:37}],22:[function(e,t,n){(function(e){"use strict";function n(){f=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}f=!1}function r(e){1!==l.push(e)||f||o()}var o,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var u=0,s=new i(n),c=e.document.createTextNode("");s.observe(c,{characterData:!0}),o=function(){c.data=u=++u%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)o="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var a=new e.MessageChannel;a.port1.onmessage=n,o=function(){a.port2.postMessage(0)}}var f,l=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[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}},{}],24:[function(e,t,n){"use strict";function r(){}t.exports=r},{}],25:[function(e,t,n){"use strict";function r(e){function t(e,t){function o(e){a[t]=e,++f===n&!r&&(r=!0,c.resolve(d,a))}u(e).then(o,function(e){r||(r=!0,c.reject(d,e))})}if("[object Array]"!==Object.prototype.toString.call(e))return i(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return u([]);for(var a=new Array(n),f=0,l=-1,d=new o(s);++l<n;)t(e[l],l);return d}var o=e(28),i=e(31),u=e(32),s=e(24),c=e(26);t.exports=r},{24:24,26:26,28:28,31:31,32:32}],26:[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(35),i=e(33),u=e(34);n.resolve=function(e,t){var s=o(r,t);if("error"===s.status)return n.reject(e,s.value);var c=s.value;if(c)i.safely(e,c);else{e.state=u.FULFILLED,e.outcome=t;for(var a=-1,f=e.queue.length;++a<f;)e.queue[a].callFulfilled(t)}return e},n.reject=function(e,t){e.state=u.REJECTED,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e}},{33:33,34:34,35:35}],27:[function(e,t,n){t.exports=n=e(28),n.resolve=e(32),n.reject=e(31),n.all=e(25),n.race=e(30)},{25:25,28:28,30:30,31:31,32:32}],28:[function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=s.PENDING,this.queue=[],this.outcome=void 0,e!==i&&u.safely(this,e)}var o=e(36),i=e(24),u=e(33),s=e(34),c=e(2