yomichan/ext/lib/dexie.min.js

3 lines
56 KiB
JavaScript
Raw Normal View History

2017-02-01 05:27:38 +00:00
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Dexie=t()}(this,function(){"use strict";function n(n,t){return"object"!=typeof t?n:(Cn(t).forEach(function(e){n[e]=t[e]}),n)}function t(n,t){return Fn.call(n,t)}function e(n,t){"function"==typeof t&&(t=t(Bn(n))),Cn(t).forEach(function(e){r(n,e,t[e])})}function r(e,r,i,o){Mn(e,r,n(i&&t(i,"get")&&"function"==typeof i.get?{get:i.get,set:i.set,configurable:!0}:{value:i,configurable:!0,writable:!0},o))}function i(n){return{from:function(t){return n.prototype=Object.create(t.prototype),r(n.prototype,"constructor",n),{extend:e.bind(null,n.prototype)}}}}function o(n,t){var e,r=Nn(n,t);return r||(e=Bn(n))&&o(e,t)}function u(n,t,e){return qn.call(n,t,e)}function a(n,t){return t(n)}function c(n){var t=setTimeout(n,1e3);clearTimeout(t)}function s(n){if(!n)throw new Error("Assertion Failed")}function f(n){Kn.setImmediate?setImmediate(n):setTimeout(n,0)}function l(n,t){return n.reduce(function(n,e,r){var i=t(e,r);return i&&(n[i[0]]=i[1]),n},{})}function h(n,t){return function(){try{n.apply(this,arguments)}catch(n){t(n)}}}function d(n,t,e){try{n.apply(null,e)}catch(n){t&&t(n)}}function v(n,e){if(t(n,e))return n[e];if(!e)return n;if("string"!=typeof e){for(var r=[],i=0,o=e.length;i<o;++i){var u=v(n,e[i]);r.push(u)}return r}var a=e.indexOf(".");if(a!==-1){var c=n[e.substr(0,a)];return void 0===c?void 0:v(c,e.substr(a+1))}}function p(n,t,e){if(n&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(n)))if("string"!=typeof t&&"length"in t){s("string"!=typeof e&&"length"in e);for(var r=0,i=t.length;r<i;++r)p(n,t[r],e[r])}else{var o=t.indexOf(".");if(o!==-1){var u=t.substr(0,o),a=t.substr(o+1);if(""===a)void 0===e?delete n[u]:n[u]=e;else{var c=n[u];c||(c=n[u]={}),p(c,a,e)}}else void 0===e?delete n[t]:n[t]=e}}function y(n,t){"string"==typeof t?p(n,t,void 0):"length"in t&&[].map.call(t,function(t){p(n,t,void 0)})}function m(n){var e={};for(var r in n)t(n,r)&&(e[r]=n[r]);return e}function g(n){return Rn.apply([],n)}function b(n){if(!n||"object"!=typeof n)return n;var e;if(Tn(n)){e=[];for(var r=0,i=n.length;r<i;++r)e.push(b(n[r]))}else if(Un.indexOf(n.constructor)>=0)e=n;else{e=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n)t(n,o)&&(e[o]=b(n[o]))}return e}function w(n,e,r,i){return r=r||{},i=i||"",Cn(n).forEach(function(o){if(t(e,o)){var u=n[o],a=e[o];"object"==typeof u&&"object"==typeof a&&u&&a&&u.constructor===a.constructor?w(u,a,r,i+o+"."):u!==a&&(r[i+o]=e[o])}else r[i+o]=void 0}),Cn(e).forEach(function(o){t(n,o)||(r[i+o]=e[o])}),r}function _(n){var t,e,r,i;if(1===arguments.length){if(Tn(n))return n.slice();if(this===Ln&&"string"==typeof n)return[n];if(i=zn(n)){for(e=[];r=i.next(),!r.done;)e.push(r.value);return e}if(null==n)return[n];if(t=n.length,"number"==typeof t){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}function k(n,t){Wn=n,Qn=t}function x(){if(Hn)try{throw x.arguments,new Error}catch(n){return n}return new Error}function j(n,t){var e=n.stack;return e?(t=t||0,0===e.indexOf(n.name)&&(t+=(n.name+n.message).split("\n").length),e.split("\n").slice(t).filter(Qn).map(function(n){return"\n"+n}).join("")):""}function E(n,t){return function(){return console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+j(x(),1)),t.apply(this,arguments)}}function P(n,t){this._e=x(),this.name=n,this.message=t}function A(n,t){return n+". Errors: "+t.map(function(n){return n.toString()}).filter(function(n,t,e){return e.indexOf(n)===t}).join("\n")}function O(n,t,e,r){this._e=x(),this.failures=t,this.failedKeys=r,this.successCount=e}function S(n,t){this._e=x(),this.name="BulkError",this.failures=t,this.message=A(n,t)}function I(n,t){if(!n||n instanceof P||n instanceof TypeError||n instanceof SyntaxError||!n.name||!tt[n.name])return n;var e=new tt[n.name](t||n.message,n);return"stack"in n&&r(e,"stack",{get:function(){return this.inner.stack}}),e}function D(){}function C(n){return n}function
var i=r.delete(n);i.onerror=xn(e),i.onsuccess=rn(function(){t(i.result)})})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(tt,function(n,t,e){var r=e.clear();r.onerror=xn(t),r.onsuccess=rn(function(){n(r.result)})})},update:function(n,t){if("object"!=typeof t||Tn(t))throw new nt.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||Tn(n))return this.where(":id").equals(n).modify(t);Cn(t).forEach(function(e){p(n,e,t[e])});var e=v(n,this.schema.primKey.keyPath);return void 0===e?Nt(new nt.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!Et.global),++this._reculock,1!==this._reculock||Et.global||(Et.lockOwnerFor=this),this},_unlock:function(){if(s(!Et.global),0===--this._reculock)for(Et.global||(Et.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{dn(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&Et.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(s(!this.idbtrans),!n&&!Gn)switch(Jn&&Jn.name){case"DatabaseClosedError":throw new nt.DatabaseClosed(Jn);case"MissingAPIError":throw new nt.MissingAPI(Jn.message,Jn);default:throw new nt.OpenFailed(Jn)}if(!this.active)throw new nt.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||Gn.transaction(In(this.storeNames),this.mode),n.onerror=rn(function(e){Pn(e),t._reject(n.error)}),n.onabort=rn(function(n){Pn(n),t.active&&t._reject(new nt.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=rn(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;if(n===tt&&this.mode!==tt)return Nt(new nt.ReadOnly("Transaction is readonly"));if(!this.active)return Nt(new nt.TransactionInactive);if(this._locked())return new R(function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},Et])});if(e)return on(function(){var n=new R(function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)});return n.finally(function(){return r._unlock()}),n._lib=!0,n});var i=new R(function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)});return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=R.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-(1/0)).onsuccess=n)}()}var r=t._waitingFor;return new R(function(e,i){n.then(function(n){return t._waitingQueue.push(rn(e.bind(null,n)))},function(n){return t._waitingQueue.push(rn(i.bind(null,n)))}).finally(function(){t._waitingFor===r&&(t._waitingFor=null)})})},abort:function(){this.active&&this._reject(new nt.Abort),this.active=!1},tables:{get:E("Transaction.tables",function(){return Hn})},table:function(n){var t=et.table(n);return new z(n,t.schema,this)}}),e(H.prototype,function(){function n(n,t,e){var r=n instanceof H?new G(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new G(n,function(){return Un.only("")}).limit(0)}function e(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}function r(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}function i(n,t,e,r,i,o){for(var u=Math.min(n.length,r.length),a=-1,c=0;c<u;++c){var s=t[c];if(s!==r[c])return i(n[c],e[c])<0?n.substr(0,c)+e[c]+e.substr(c+1):i(n[c],r[c])<0?n.substr(0,c)+r[c]+e.substr(c+1):a>=0?n.substr(0,a)+t[a]+e.substr(a+1):null;i(n[c],s)<0&&(a=c)}return u<r.length&&"next"===o?n+e.substr(n.length):u<n.length&&"prev"===o?n.substr(0,e.length):a<0?null:n.substr(0,a)+r[a]+e.substr(a+1)}function o(t,o,u,a){function c(n){s=e(n),f=r(n),l="next"===n?ln:hn;var t=u.map(function(n){return{lower:f(n),upper:s(n)}}).sort(function(n,t){return l(n.lower,t.lower)});h=t.map(function(n
//# sourceMappingURL=dist/dexie.min.js.map