w-orm-lowdb 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/babel.config.js +4 -3
- package/dist/w-orm-lowdb.umd.js +2 -2
- package/dist/w-orm-lowdb.umd.js.map +1 -1
- package/docs/WOrmLowdb.html +6 -6
- package/docs/WOrmLowdb.mjs.html +118 -26
- package/docs/index.html +1 -1
- package/g-basic.mjs +19 -0
- package/package.json +5 -5
- package/script.txt +0 -1
- package/src/WOrmLowdb.mjs +117 -25
- package/test/basic.test.mjs +33 -4
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# w-orm-lowdb
|
|
2
2
|
An operator for lowdb in nodejs.
|
|
3
3
|
|
|
4
|
+
## 注意
|
|
5
|
+
同 process 內多個 WOrm 實例共用記憶體鎖、序列化同一個 JSON 檔的讀寫。不支援多個 process 操作。
|
|
6
|
+
|
|
4
7
|

|
|
5
8
|
[](https://npmjs.org/package/w-orm-lolowdb
|
|
6
9
|
[](https://npmjs.org/package/w-orm-lolowdb
|
|
@@ -12,10 +15,12 @@ An operator for lowdb in nodejs.
|
|
|
12
15
|
To view documentation or get support, visit [docs](https://yuda-lyu.github.io/w-orm-lowdbOrm.html).
|
|
13
16
|
|
|
14
17
|
## Installation
|
|
18
|
+
|
|
15
19
|
### Using npm(ES6 module):
|
|
16
20
|
```alias
|
|
17
21
|
npm i w-orm-lowdb
|
|
18
22
|
```
|
|
23
|
+
|
|
19
24
|
#### Example
|
|
20
25
|
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-lowdblob/master/g-basic.mjs)]
|
|
21
26
|
```alias
|
|
@@ -64,6 +69,14 @@ let rsm = [
|
|
|
64
69
|
},
|
|
65
70
|
]
|
|
66
71
|
|
|
72
|
+
let rsa = [
|
|
73
|
+
{
|
|
74
|
+
id: 'id-rosemary',
|
|
75
|
+
name: 'rosemary',
|
|
76
|
+
value: 654.321,
|
|
77
|
+
},
|
|
78
|
+
]
|
|
79
|
+
|
|
67
80
|
async function test() {
|
|
68
81
|
|
|
69
82
|
//wo
|
|
@@ -125,6 +138,15 @@ async function test() {
|
|
|
125
138
|
// let sr = await wo.select({ name: { $regex: 'PeT', $options: '$i' } })
|
|
126
139
|
// console.log('selectReg', sr)
|
|
127
140
|
|
|
141
|
+
//save
|
|
142
|
+
await wo.save(rsa, { autoInsert: true })
|
|
143
|
+
.then(function(msg) {
|
|
144
|
+
console.log('save then', msg)
|
|
145
|
+
})
|
|
146
|
+
.catch(function(msg) {
|
|
147
|
+
console.log('save catch', msg)
|
|
148
|
+
})
|
|
149
|
+
|
|
128
150
|
//del
|
|
129
151
|
let d = ss.filter(function(v) {
|
|
130
152
|
return v.name === 'kettle'
|
|
@@ -179,6 +201,8 @@ test()
|
|
|
179
201
|
// value: 456
|
|
180
202
|
// }
|
|
181
203
|
// ]
|
|
204
|
+
// change save
|
|
205
|
+
// save then [ { n: 1, nModified: 1, ok: 1 } ]
|
|
182
206
|
// change del
|
|
183
207
|
// del then [ { n: 1, nDeleted: 1, ok: 1 } ]
|
|
184
208
|
```
|
package/babel.config.js
CHANGED
|
@@ -7,9 +7,10 @@ module.exports = {
|
|
|
7
7
|
],
|
|
8
8
|
'plugins': [
|
|
9
9
|
'@babel/plugin-transform-runtime',
|
|
10
|
-
'@babel/plugin-syntax-import-assertions',
|
|
11
10
|
'@babel/plugin-proposal-export-default-from',
|
|
12
|
-
'@babel/plugin-
|
|
13
|
-
'@babel/plugin-proposal-
|
|
11
|
+
// '@babel/plugin-syntax-import-assertions', //已被棄用
|
|
12
|
+
// '@babel/plugin-proposal-nullish-coalescing-operator', //browser與nodejs已支援
|
|
13
|
+
// '@babel/plugin-proposal-object-rest-spread', //browser與nodejs已支援
|
|
14
|
+
// '@babel/plugin-proposal-optional-chaining', //browser與nodejs已支援
|
|
14
15
|
]
|
|
15
16
|
}
|
package/dist/w-orm-lowdb.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* w-orm-lowdb v1.0.
|
|
2
|
+
* w-orm-lowdb v1.0.8
|
|
3
3
|
* (c) 2018-2021 yuda-lyu(semisphere)
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("events"),require("lowdb"),require("node:fs"),require("node:fs/promises"),require("node:path"),require("node:url"),require("mingo")):"function"==typeof define&&define.amd?define(["path","events","lowdb","node:fs","node:fs/promises","node:path","node:url","mingo"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-orm-lowdb"]=e(t.path$1,t.events,t.lowdb,null,t.promises,t.path,t.node_url,t.mingo)}(this,(function(t,e,r,n,o,i,u,a){"use strict";class c{#t;#e;#r=!1;#n=null;#o=null;#i=null;#u=null;#a(t){return this.#u=t,this.#i||=new Promise(((t,e)=>{this.#o=[t,e]})),new Promise(((t,e)=>{var r;null===(r=this.#i)||void 0===r||r.then(t).catch(e)}))}async#c(t){this.#r=!0;try{var e;await o.writeFile(this.#e,t,"utf-8"),await async function(t,e,r){for(let n=0;n<e;n++)try{return await t()}catch(t){if(!(n<e-1))throw t;await new Promise((t=>setTimeout(t,r)))}}((async()=>{await o.rename(this.#e,this.#t)}),10,100),null===(e=this.#n)||void 0===e||e[0]()}catch(t){var r;if(t instanceof Error)null===(r=this.#n)||void 0===r||r[1](t);throw t}finally{if(this.#r=!1,this.#n=this.#o,this.#o=this.#i=null,null!==this.#u){const t=this.#u;this.#u=null,await this.write(t)}}}constructor(t){this.#t=t,this.#e=function(t){const e=t instanceof URL?u.fileURLToPath(t):t.toString();return i.join(i.dirname(e),`.${i.basename(e)}.tmp`)}(t)}async write(t){return this.#r?this.#a(t):this.#c(t)}}class f{#t;#f;constructor(t){this.#t=t,this.#f=new c(t)}async read(){let t;try{t=await o.readFile(this.#t,"utf-8")}catch(t){if("ENOENT"===t.code)return null;throw t}return t}write(t){return this.#f.write(t)}}class l{#l;#s;#v;constructor(t,e){let{parse:r,stringify:n}=e;this.#l=new f(t),this.#s=r,this.#v=n}async read(){const t=await this.#l.read();return null===t?null:this.#s(t)}write(t){return this.#l.write(this.#v(t))}}class s extends l{constructor(t){super(t,{parse:JSON.parse,stringify:t=>JSON.stringify(t,null,2)})}}var v=Array.isArray,p="object"==typeof global&&global&&global.Object===Object&&global,d="object"==typeof self&&self&&self.Object===Object&&self,h=p||d||Function("return this")(),y=h.Symbol,b=Object.prototype,j=b.hasOwnProperty,g=b.toString,w=y?y.toStringTag:void 0;var _=Object.prototype.toString;var m=y?y.toStringTag:void 0;function O(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?function(t){var e=j.call(t,w),r=t[w];try{t[w]=void 0;var n=!0}catch(t){}var o=g.call(t);return n&&(e?t[w]=r:delete t[w]),o}(t):function(t){return _.call(t)}(t)}function A(t){return null!=t&&"object"==typeof t}function x(t){return"symbol"==typeof t||A(t)&&"[object Symbol]"==O(t)}var S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P=/^\w*$/;function k(t,e){if(v(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!x(t))||(P.test(t)||!S.test(t)||null!=e&&t in Object(e))}function z(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function F(t){if(!z(t))return!1;var e=O(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var E,I=h["__core-js_shared__"],D=(E=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"";var N=Function.prototype.toString;function M(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var U=/^\[object .+?Constructor\]$/,$=Function.prototype,T=Object.prototype,B=$.toString,q=T.hasOwnProperty,L=RegExp("^"+B.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function R(t){return!(!z(t)||(e=t,D&&D in e))&&(F(t)?L:U).test(M(t));var e}function C(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return R(r)?r:void 0}var V=C(Object,"create");var W=Object.prototype.hasOwnProperty;var G=Object.prototype.hasOwnProperty;function J(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Q(t,e){return t===e||t!=t&&e!=e}function H(t,e){for(var r=t.length;r--;)if(Q(t[r][0],e))return r;return-1}J.prototype.clear=function(){this.__data__=V?V(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(V){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return W.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return V?void 0!==e[t]:G.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=V&&void 0===e?"__lodash_hash_undefined__":e,this};var K=Array.prototype.splice;function X(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}X.prototype.clear=function(){this.__data__=[],this.size=0},X.prototype.delete=function(t){var e=this.__data__,r=H(e,t);return!(r<0)&&(r==e.length-1?e.pop():K.call(e,r,1),--this.size,!0)},X.prototype.get=function(t){var e=this.__data__,r=H(e,t);return r<0?void 0:e[r][1]},X.prototype.has=function(t){return H(this.__data__,t)>-1},X.prototype.set=function(t,e){var r=this.__data__,n=H(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var Y=C(h,"Map");function Z(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}tt.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(Y||X),string:new J}},tt.prototype.delete=function(t){var e=Z(this,t).delete(t);return this.size-=e?1:0,e},tt.prototype.get=function(t){return Z(this,t).get(t)},tt.prototype.has=function(t){return Z(this,t).has(t)},tt.prototype.set=function(t,e){var r=Z(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function et(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(et.Cache||tt),r}et.Cache=tt;var rt,nt,ot,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ut=/\\(\\)?/g,at=(rt=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(it,(function(t,r,n,o){e.push(n?o.replace(ut,"$1"):r||t)})),e},nt=et(rt,(function(t){return 500===ot.size&&ot.clear(),t})),ot=nt.cache,nt),ct=at;function ft(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var lt=y?y.prototype:void 0,st=lt?lt.toString:void 0;function vt(t){if("string"==typeof t)return t;if(v(t))return ft(t,vt)+"";if(x(t))return st?st.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function pt(t){return null==t?"":vt(t)}function dt(t,e){return v(t)?t:k(t,e)?[t]:ct(pt(t))}function ht(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function yt(t,e){for(var r=0,n=(e=dt(e,t)).length;null!=t&&r<n;)t=t[ht(e[r++])];return r&&r==n?t:void 0}function bt(t,e,r){var n=null==t?void 0:yt(t,e);return void 0===n?r:n}function jt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var gt,wt=function(t,e,r){for(var n=-1,o=Object(t),i=r(t),u=i.length;u--;){var a=i[gt?u:++n];if(!1===e(o[a],a,o))break}return t};function _t(t){return A(t)&&"[object Arguments]"==O(t)}var mt=Object.prototype,Ot=mt.hasOwnProperty,At=mt.propertyIsEnumerable,xt=_t(function(){return arguments}())?_t:function(t){return A(t)&&Ot.call(t,"callee")&&!At.call(t,"callee")},St=xt;var Pt="object"==typeof exports&&exports&&!exports.nodeType&&exports,kt=Pt&&"object"==typeof module&&module&&!module.nodeType&&module,zt=kt&&kt.exports===Pt?h.Buffer:void 0,Ft=(zt?zt.isBuffer:void 0)||function(){return!1},Et=/^(?:0|[1-9]\d*)$/;function It(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Et.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var Nt={};function Mt(t){return function(e){return t(e)}}Nt["[object Float32Array]"]=Nt["[object Float64Array]"]=Nt["[object Int8Array]"]=Nt["[object Int16Array]"]=Nt["[object Int32Array]"]=Nt["[object Uint8Array]"]=Nt["[object Uint8ClampedArray]"]=Nt["[object Uint16Array]"]=Nt["[object Uint32Array]"]=!0,Nt["[object Arguments]"]=Nt["[object Array]"]=Nt["[object ArrayBuffer]"]=Nt["[object Boolean]"]=Nt["[object DataView]"]=Nt["[object Date]"]=Nt["[object Error]"]=Nt["[object Function]"]=Nt["[object Map]"]=Nt["[object Number]"]=Nt["[object Object]"]=Nt["[object RegExp]"]=Nt["[object Set]"]=Nt["[object String]"]=Nt["[object WeakMap]"]=!1;var Ut="object"==typeof exports&&exports&&!exports.nodeType&&exports,$t=Ut&&"object"==typeof module&&module&&!module.nodeType&&module,Tt=$t&&$t.exports===Ut&&p.process,Bt=function(){try{var t=$t&&$t.require&&$t.require("util").types;return t||Tt&&Tt.binding&&Tt.binding("util")}catch(t){}}(),qt=Bt&&Bt.isTypedArray,Lt=qt?Mt(qt):function(t){return A(t)&&Dt(t.length)&&!!Nt[O(t)]},Rt=Object.prototype.hasOwnProperty;function Ct(t,e){var r=v(t),n=!r&&St(t),o=!r&&!n&&Ft(t),i=!r&&!n&&!o&&Lt(t),u=r||n||o||i,a=u?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var f in t)!e&&!Rt.call(t,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||It(f,c))||a.push(f);return a}var Vt=Object.prototype;function Wt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Vt)}function Gt(t,e){return function(r){return t(e(r))}}var Jt=Gt(Object.keys,Object),Qt=Object.prototype.hasOwnProperty;function Ht(t){if(!Wt(t))return Jt(t);var e=[];for(var r in Object(t))Qt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function Kt(t){return null!=t&&Dt(t.length)&&!F(t)}function Xt(t){return Kt(t)?Ct(t):Ht(t)}var Yt=function(t,e){return function(r,n){if(null==r)return r;if(!Kt(r))return t(r,n);for(var o=r.length,i=e?o:-1,u=Object(r);(e?i--:++i<o)&&!1!==n(u[i],i,u););return r}}((function(t,e){return t&&wt(t,e,Xt)})),Zt=Yt;function te(t){return t}function ee(t,e){var r;return(v(t)?jt:Zt)(t,"function"==typeof(r=e)?r:te)}function re(t){var e=this.__data__=new X(t);this.size=e.size}re.prototype.clear=function(){this.__data__=new X,this.size=0},re.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},re.prototype.get=function(t){return this.__data__.get(t)},re.prototype.has=function(t){return this.__data__.has(t)},re.prototype.set=function(t,e){var r=this.__data__;if(r instanceof X){var n=r.__data__;if(!Y||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new tt(n)}return r.set(t,e),this.size=r.size,this};function ne(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new tt;++e<r;)this.add(t[e])}function oe(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function ie(t,e){return t.has(e)}ne.prototype.add=ne.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ne.prototype.has=function(t){return this.__data__.has(t)};function ue(t,e,r,n,o,i){var u=1&r,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var f=i.get(t),l=i.get(e);if(f&&l)return f==e&&l==t;var s=-1,v=!0,p=2&r?new ne:void 0;for(i.set(t,e),i.set(e,t);++s<a;){var d=t[s],h=e[s];if(n)var y=u?n(h,d,s,e,t,i):n(d,h,s,t,e,i);if(void 0!==y){if(y)continue;v=!1;break}if(p){if(!oe(e,(function(t,e){if(!ie(p,e)&&(d===t||o(d,t,r,n,i)))return p.push(e)}))){v=!1;break}}else if(d!==h&&!o(d,h,r,n,i)){v=!1;break}}return i.delete(t),i.delete(e),v}var ae=h.Uint8Array;function ce(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function fe(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var le=y?y.prototype:void 0,se=le?le.valueOf:void 0;function ve(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function pe(t,e,r){var n=e(t);return v(t)?n:ve(n,r(t))}function de(){return[]}var he=Object.prototype.propertyIsEnumerable,ye=Object.getOwnPropertySymbols,be=ye?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}(ye(t),(function(e){return he.call(t,e)})))}:de,je=be;function ge(t){return pe(t,Xt,je)}var we=Object.prototype.hasOwnProperty;var _e=C(h,"DataView"),me=C(h,"Promise"),Oe=C(h,"Set"),Ae=C(h,"WeakMap"),xe="[object Map]",Se="[object Promise]",Pe="[object Set]",ke="[object WeakMap]",ze="[object DataView]",Fe=M(_e),Ee=M(Y),Ie=M(me),De=M(Oe),Ne=M(Ae),Me=O;(_e&&Me(new _e(new ArrayBuffer(1)))!=ze||Y&&Me(new Y)!=xe||me&&Me(me.resolve())!=Se||Oe&&Me(new Oe)!=Pe||Ae&&Me(new Ae)!=ke)&&(Me=function(t){var e=O(t),r="[object Object]"==e?t.constructor:void 0,n=r?M(r):"";if(n)switch(n){case Fe:return ze;case Ee:return xe;case Ie:return Se;case De:return Pe;case Ne:return ke}return e});var Ue=Me,$e="[object Arguments]",Te="[object Array]",Be="[object Object]",qe=Object.prototype.hasOwnProperty;function Le(t,e,r,n,o,i){var u=v(t),a=v(e),c=u?Te:Ue(t),f=a?Te:Ue(e),l=(c=c==$e?Be:c)==Be,s=(f=f==$e?Be:f)==Be,p=c==f;if(p&&Ft(t)){if(!Ft(e))return!1;u=!0,l=!1}if(p&&!l)return i||(i=new re),u||Lt(t)?ue(t,e,r,n,o,i):function(t,e,r,n,o,i,u){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new ae(t),new ae(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Q(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ce;case"[object Set]":var c=1&n;if(a||(a=fe),t.size!=e.size&&!c)return!1;var f=u.get(t);if(f)return f==e;n|=2,u.set(t,e);var l=ue(a(t),a(e),n,o,i,u);return u.delete(t),l;case"[object Symbol]":if(se)return se.call(t)==se.call(e)}return!1}(t,e,c,r,n,o,i);if(!(1&r)){var d=l&&qe.call(t,"__wrapped__"),h=s&&qe.call(e,"__wrapped__");if(d||h){var y=d?t.value():t,b=h?e.value():e;return i||(i=new re),o(y,b,r,n,i)}}return!!p&&(i||(i=new re),function(t,e,r,n,o,i){var u=1&r,a=ge(t),c=a.length;if(c!=ge(e).length&&!u)return!1;for(var f=c;f--;){var l=a[f];if(!(u?l in e:we.call(e,l)))return!1}var s=i.get(t),v=i.get(e);if(s&&v)return s==e&&v==t;var p=!0;i.set(t,e),i.set(e,t);for(var d=u;++f<c;){var h=t[l=a[f]],y=e[l];if(n)var b=u?n(y,h,l,e,t,i):n(h,y,l,t,e,i);if(!(void 0===b?h===y||o(h,y,r,n,i):b)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var j=t.constructor,g=e.constructor;j==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof g&&g instanceof g||(p=!1)}return i.delete(t),i.delete(e),p}(t,e,r,n,o,i))}function Re(t,e,r,n,o){return t===e||(null==t||null==e||!A(t)&&!A(e)?t!=t&&e!=e:Le(t,e,r,n,Re,o))}function Ce(t){return t==t&&!z(t)}function Ve(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function We(t){var e=function(t){for(var e=Xt(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,Ce(o)]}return e}(t);return 1==e.length&&e[0][2]?Ve(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,n){var o=r.length,i=o,u=!n;if(null==t)return!i;for(t=Object(t);o--;){var a=r[o];if(u&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var c=(a=r[o])[0],f=t[c],l=a[1];if(u&&a[2]){if(void 0===f&&!(c in t))return!1}else{var s=new re;if(n)var v=n(f,l,c,t,e,s);if(!(void 0===v?Re(l,f,3,n,s):v))return!1}}return!0}(r,t,e)}}function Ge(t,e){return null!=t&&e in Object(t)}function Je(t,e){return null!=t&&function(t,e,r){for(var n=-1,o=(e=dt(e,t)).length,i=!1;++n<o;){var u=ht(e[n]);if(!(i=null!=t&&r(t,u)))break;t=t[u]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Dt(o)&&It(u,o)&&(v(t)||St(t))}(t,e,Ge)}function Qe(t){return function(e){return null==e?void 0:e[t]}}function He(t){return k(t)?Qe(ht(t)):function(t){return function(e){return yt(e,t)}}(t)}function Ke(t){return"function"==typeof t?t:null==t?te:"object"==typeof t?v(t)?function(t,e){return k(t)&&Ce(e)?Ve(ht(t),e):function(r){var n=bt(r,t);return void 0===n&&n===e?Je(r,t):Re(e,n,3)}}(t[0],t[1]):We(t):He(t)}function Xe(t,e){var r=-1,n=Kt(t)?Array(t.length):[];return Zt(t,(function(t,o,i){n[++r]=e(t,o,i)})),n}function Ye(t,e){return(v(t)?ft:Xe)(t,Ke(e))}var Ze=function(){try{var t=C(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),tr=Ze;function er(t,e,r){"__proto__"==e&&tr?tr(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function rr(t,e,r){(void 0!==r&&!Q(t[e],r)||void 0===r&&!(e in t))&&er(t,e,r)}var nr="object"==typeof exports&&exports&&!exports.nodeType&&exports,or=nr&&"object"==typeof module&&module&&!module.nodeType&&module,ir=or&&or.exports===nr?h.Buffer:void 0,ur=ir?ir.allocUnsafe:void 0;function ar(t,e){if(e)return t.slice();var r=t.length,n=ur?ur(r):new t.constructor(r);return t.copy(n),n}function cr(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e}function fr(t,e){var r=e?cr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function lr(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var sr=Object.create,vr=function(){function t(){}return function(e){if(!z(e))return{};if(sr)return sr(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pr=vr,dr=Gt(Object.getPrototypeOf,Object);function hr(t){return"function"!=typeof t.constructor||Wt(t)?{}:pr(dr(t))}var yr=Function.prototype,br=Object.prototype,jr=yr.toString,gr=br.hasOwnProperty,wr=jr.call(Object);function _r(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var mr=Object.prototype.hasOwnProperty;function Or(t,e,r){var n=t[e];mr.call(t,e)&&Q(n,r)&&(void 0!==r||e in t)||er(t,e,r)}function Ar(t,e,r,n){var o=!r;r||(r={});for(var i=-1,u=e.length;++i<u;){var a=e[i],c=n?n(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),o?er(r,a,c):Or(r,a,c)}return r}var xr=Object.prototype.hasOwnProperty;function Sr(t){if(!z(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=Wt(t),r=[];for(var n in t)("constructor"!=n||!e&&xr.call(t,n))&&r.push(n);return r}function Pr(t){return Kt(t)?Ct(t,!0):Sr(t)}function kr(t,e,r,n,o,i,u){var a=_r(t,r),c=_r(e,r),f=u.get(c);if(f)rr(t,r,f);else{var l,s=i?i(a,c,r+"",t,e,u):void 0,p=void 0===s;if(p){var d=v(c),h=!d&&Ft(c),y=!d&&!h&&Lt(c);s=c,d||h||y?v(a)?s=a:A(l=a)&&Kt(l)?s=lr(a):h?(p=!1,s=ar(c,!0)):y?(p=!1,s=fr(c,!0)):s=[]:function(t){if(!A(t)||"[object Object]"!=O(t))return!1;var e=dr(t);if(null===e)return!0;var r=gr.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&jr.call(r)==wr}(c)||St(c)?(s=a,St(a)?s=function(t){return Ar(t,Pr(t))}(a):z(a)&&!F(a)||(s=hr(c))):p=!1}p&&(u.set(c,s),o(s,c,n,i,u),u.delete(c)),rr(t,r,s)}}function zr(t,e,r,n,o){t!==e&&wt(e,(function(i,u){if(o||(o=new re),z(i))kr(t,e,u,r,zr,n,o);else{var a=n?n(_r(t,u),i,u+"",t,e,o):void 0;void 0===a&&(a=i),rr(t,u,a)}}),Pr)}var Fr=Math.max;function Er(t,e,r){return e=Fr(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=Fr(n.length-e,0),u=Array(i);++o<i;)u[o]=n[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=n[o];return a[e]=r(u),function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(t,this,a)}}var Ir=tr?function(t,e){return tr(t,"toString",{configurable:!0,enumerable:!1,value:(r=e,function(){return r}),writable:!0});var r}:te,Dr=Ir,Nr=Date.now;var Mr=function(t){var e=0,r=0;return function(){var n=Nr(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Dr),Ur=Mr;var $r,Tr=($r=function(t,e,r){zr(t,e,r)},function(t,e){return Ur(Er(t,e,te),t+"")}((function(t,e){var r=-1,n=e.length,o=n>1?e[n-1]:void 0,i=n>2?e[2]:void 0;for(o=$r.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,e,r){if(!z(r))return!1;var n=typeof e;return!!("number"==n?Kt(r)&&It(e,r.length):"string"==n&&e in r)&&Q(r[e],t)}(e[0],e[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++r<n;){var u=e[r];u&&$r(t,u,r,o)}return t}))),Br=Tr;var qr=Qe("length"),Lr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Rr="\\ud800-\\udfff",Cr="["+Rr+"]",Vr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Wr="\\ud83c[\\udffb-\\udfff]",Gr="[^"+Rr+"]",Jr="(?:\\ud83c[\\udde6-\\uddff]){2}",Qr="[\\ud800-\\udbff][\\udc00-\\udfff]",Hr="(?:"+Vr+"|"+Wr+")"+"?",Kr="[\\ufe0e\\ufe0f]?",Xr=Kr+Hr+("(?:\\u200d(?:"+[Gr,Jr,Qr].join("|")+")"+Kr+Hr+")*"),Yr="(?:"+[Gr+Vr+"?",Vr,Jr,Qr,Cr].join("|")+")",Zr=RegExp(Wr+"(?="+Wr+")|"+Yr+Xr,"g");function tn(t){return function(t){return Lr.test(t)}(t)?function(t){for(var e=Zr.lastIndex=0;Zr.test(t);)++e;return e}(t):qr(t)}function en(t){if(null==t)return 0;if(Kt(t))return"string"==typeof(e=t)||!v(e)&&A(e)&&"[object String]"==O(e)?tn(t):t.length;var e,r=Ue(t);return"[object Map]"==r||"[object Set]"==r?t.size:Ht(t).length}var rn=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)ve(e,je(t)),t=dr(t);return e}:de,nn=rn;function on(t){return pe(t,Pr,nn)}var un=Object.prototype.hasOwnProperty;var an=/\w*$/;var cn=y?y.prototype:void 0,fn=cn?cn.valueOf:void 0;function ln(t,e,r){var n,o=t.constructor;switch(e){case"[object ArrayBuffer]":return cr(t);case"[object Boolean]":case"[object Date]":return new o(+t);case"[object DataView]":return function(t,e){var r=e?cr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return fr(t,r);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return n=t,fn?Object(fn.call(n)):{}}}var sn=Bt&&Bt.isMap,vn=sn?Mt(sn):function(t){return A(t)&&"[object Map]"==Ue(t)};var pn=Bt&&Bt.isSet,dn=pn?Mt(pn):function(t){return A(t)&&"[object Set]"==Ue(t)},hn="[object Arguments]",yn="[object Function]",bn="[object Object]",jn={};function gn(t,e,r,n,o,i){var u,a=1&e,c=2&e,f=4&e;if(r&&(u=o?r(t,n,o,i):r(t)),void 0!==u)return u;if(!z(t))return t;var l=v(t);if(l){if(u=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&un.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return lr(t,u)}else{var s=Ue(t),p=s==yn||"[object GeneratorFunction]"==s;if(Ft(t))return ar(t,a);if(s==bn||s==hn||p&&!o){if(u=c||p?{}:hr(t),!a)return c?function(t,e){return Ar(t,nn(t),e)}(t,function(t,e){return t&&Ar(e,Pr(e),t)}(u,t)):function(t,e){return Ar(t,je(t),e)}(t,function(t,e){return t&&Ar(e,Xt(e),t)}(u,t))}else{if(!jn[s])return o?t:{};u=ln(t,s,a)}}i||(i=new re);var d=i.get(t);if(d)return d;i.set(t,u),dn(t)?t.forEach((function(n){u.add(gn(n,e,r,n,t,i))})):vn(t)&&t.forEach((function(n,o){u.set(o,gn(n,e,r,o,t,i))}));var h=l?void 0:(f?c?on:ge:c?Pr:Xt)(t);return jt(h||t,(function(n,o){h&&(n=t[o=n]),Or(u,o,gn(n,e,r,o,t,i))})),u}jn[hn]=jn["[object Array]"]=jn["[object ArrayBuffer]"]=jn["[object DataView]"]=jn["[object Boolean]"]=jn["[object Date]"]=jn["[object Float32Array]"]=jn["[object Float64Array]"]=jn["[object Int8Array]"]=jn["[object Int16Array]"]=jn["[object Int32Array]"]=jn["[object Map]"]=jn["[object Number]"]=jn[bn]=jn["[object RegExp]"]=jn["[object Set]"]=jn["[object String]"]=jn["[object Symbol]"]=jn["[object Uint8Array]"]=jn["[object Uint8ClampedArray]"]=jn["[object Uint16Array]"]=jn["[object Uint32Array]"]=!0,jn["[object Error]"]=jn[yn]=jn["[object WeakMap]"]=!1;function wn(t){return gn(t,5)}var _n=/\s/;var mn=/^\s+/;function On(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&_n.test(t.charAt(e)););return e}(t)+1).replace(mn,""):t}var An=/^[-+]0x[0-9a-f]+$/i,xn=/^0b[01]+$/i,Sn=/^0o[0-7]+$/i,Pn=parseInt;function kn(t){if("number"==typeof t)return t;if(x(t))return NaN;if(z(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=z(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=On(t);var r=xn.test(t);return r||Sn.test(t)?Pn(t.slice(2),r?2:8):An.test(t)?NaN:+t}var zn=1/0;function Fn(t){return t?(t=kn(t))===zn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function En(t){var e=Fn(t),r=e%1;return e==e?r?e-r:e:0}function In(t){return"[object String]"===Object.prototype.toString.call(t)}function Dn(t){return!(!In(t)||""===t)}function Nn(t){return t!=t}function Mn(t){let e=!1;if(Dn(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(Nn(t))return!1;e=!0}return e}function Un(t){if(!Mn(t))return 0;return Fn(t)}function $n(t){return!!Mn(t)&&(t=Un(t),"number"==typeof(e=t)&&e==En(e));var e}var Tn=h.isFinite,Bn=Math.min;var qn=function(t){var e=Math[t];return function(t,r){if(t=kn(t),(r=null==r?0:Bn(En(r),292))&&Tn(t)){var n=(pt(t)+"e").split("e");return+((n=(pt(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),Ln=qn;function Rn(t){if(!Mn(t))return 0;t=Un(t);let e=Ln(t);return"0"===String(e)?0:e}function Cn(t){if(!$n(t))return!1;return Rn(t)>0}let Vn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Wn=Vn.length;function Gn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,e=[];t=Cn(t)?Rn(t):32;for(let r=0;r<t;r++)e[r]=Vn[0|Math.random()*Wn];return e.join("")}function Jn(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}function Qn(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}function Hn(t){return"[object Array]"===Object.prototype.toString.call(t)}function Kn(t){return"[object Object]"===Object.prototype.toString.call(t)}function Xn(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Yn(t,e){let r=Qn();if(!Hn(t)&&!Kn(t))return r.reject("rs is not an array or object"),r;let n=!1;if(Kn(t)){n=!0;let e=[];ee(t,((t,r)=>{e.push({k:r,v:t})})),t=e}Xn(e)||(e=function(t){return t});let o=-1,i=[];return t.reduce((function(t,r){return t.then((function(t){i.push(t),o+=1;let u=o,a=r;return n&&(u=r.k,a=r.v),Xn(e)?e(a,u):a}))}),Promise.resolve()).then((function(t){var e,n,o,u;i.push(t),u=null==(e=i)?0:e.length,i=u?Jn(e,(n=o||void 0===n?1:En(n))<0?0:n,u):[],r.resolve(i)})).catch((function(t){r.reject(t)})),r}function Zn(t){if(Kn(t)){for(let e in t)return!0;return!1}return!1}function to(t){return!!function(t){return"[object Undefined]"===Object.prototype.toString.call(t)}(t)||(!!function(t){return"[object Null]"===Object.prototype.toString.call(t)}(t)||(!!function(t){if(Kn(t)){for(let e in t)return!1;return!0}return!1}(t)||(!!function(t){return!(!In(t)||""!==t)}(t)||(!!function(t){return!!Hn(t)&&0===t.length}(t)||!!Nn(t)))))}function eo(t){return!!Hn(t)&&(0!==t.length&&(1!==t.length||!to(t[0])))}function ro(t,e){return!!Kn(t)&&(!(!Dn(e)&&!Mn(e))&&e in t)}function no(t,e){return null==(t=function(t,e){return e.length<2?t:yt(t,Jn(e,0,-1))}(t,e=dt(e,t)))||delete t[ht((r=e,n=null==r?0:r.length,n?r[n-1]:void 0))];var r,n}var oo=Array.prototype.splice;function io(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=x(t),u=void 0!==e,a=null===e,c=e==e,f=x(e);if(!a&&!f&&!i&&t>e||i&&u&&c&&!a&&!f||n&&u&&c||!r&&c||!o)return 1;if(!n&&!i&&!f&&t<e||f&&r&&o&&!n&&!i||a&&r&&o||!u&&o||!c)return-1}return 0}var uo=y?y.isConcatSpreadable:void 0;function ao(t){return v(t)||St(t)||!!(uo&&t&&t[uo])}function co(t,e,r,n,o){var i=-1,u=t.length;for(r||(r=ao),o||(o=[]);++i<u;){var a=t[i];e>0&&r(a)?e>1?co(a,e-1,r,n,o):ve(o,a):n||(o[o.length]=a)}return o}function fo(t){return(null==t?0:t.length)?co(t,1):[]}var lo=function(t){return Ur(Er(t,void 0,fo),t+"")}((function(t,e){var r=null==t?0:t.length,n=function(t,e){for(var r=-1,n=e.length,o=Array(n),i=null==t;++r<n;)o[r]=i?void 0:bt(t,e[r]);return o}(t,e);return function(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;It(o)?oo.call(t,o,1):no(t,o)}}}(t,ft(e,(function(t){return It(t,r)?+t:t})).sort(io)),n})),so=lo;function vo(t,e){if(!eo(t))return[];var r;if($n(r=e)&&Rn(r)>=0&&(e=[e]),!eo(e))return t;e=Ye(e,(t=>Rn(t)));let n=wn(t);return so(n,e),n}async function po(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,n=Qn();if(!Xn(t))return n.reject("waitfunction需輸入函數f"),n;let o=async()=>{let e=t();return function(t){let e,r=Object.prototype.toString.call(t);if(e="[object Promise]"===r,e)return!0;if("[object Function]"!==r)return!1;try{e="function"!=typeof t.subscribe&&"function"==typeof t.then}catch(t){}return e}(e)&&(e=await e),e};if(r=await o(),!0===r)return n.resolve(),n;let i=bt(e,"attemptNum",null);Cn(i)||(i=200);let u=bt(e,"timeInterval",null);Cn(u)||(u=1e3);let a=0,c=setInterval((async()=>{a+=1,r=await o(),!0===r&&(clearInterval(c),n.resolve()),a>i&&(clearInterval(c),n.reject(`exceeded attemptNum[${i}]`))}),u);return n}let ho={};return function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=bt(n,"url");Dn(o)||(o="./db.json");let i=bt(n,"db");Dn(i)||(i="worm");let u=bt(n,"cl");Dn(u)||(u="test");let c=`${i}:${u}`,f=new s(o),l=new r.Low(f,{}),v=new e.EventEmitter,p=t.resolve(o);async function d(t){let e=!1;if(!Zn(t)&&!eo(t))return{n:0,nInserted:0,ok:1};t=wn(t);let r=null;try{Hn(t)||(t=[t]),t=Ye(t,(function(t){return Dn(t.id)||(t.id=Gn()),t})),await l.read(),ro(l.data,c)||(l.data[c]=[]);let e={};ee(l.data[c],((t,r)=>{e[t.id]={k:r,v:t}}));let n=en(t),o=0,i=!1;ee(t,(t=>{ro(e,t.id)||(l.data[c].push(t),o++,i=!0)})),i&&await l.write(),r={n:n,nInserted:o,ok:1},v.emit("change","insert",t,r)}catch(t){e=!0,r=t}return e?Promise.reject(r):r}async function h(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!1;if(!Zn(t)&&!eo(t))return[];t=wn(t);let n=bt(e,"autoInsert",!0),o=null;try{Hn(t)||(t=[t]),t=Ye(t,(function(t){return Dn(t.id)||(t.id=Gn()),t})),await l.read(),ro(l.data,c)||(l.data[c]=[]);let e={};ee(l.data[c],((t,r)=>{e[t.id]={k:r,v:t}}));let r=!1;o=await Yn(t,(async t=>{let o=null,i=bt(e,t.id,null);var u,a;return Zn(i)&&(u=t,a=i.v,Re(u,a)||(l.data[c][i.k]=Br(l.data[c][i.k],t),o={update:!0},r=!0)),o=Zn(o)?{n:1,nModified:1,ok:1}:{n:0,nModified:0,ok:1},n&&0===o.n&&(o=await d(t)),o})),r&&await l.write(),v.emit("change","save",t,o)}catch(t){r=!0,o=t}return r?Promise.reject(o):o}return ro(ho,p)||(ho[p]=!1),v.select=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ho[p]&&await po((()=>!ho[p])),ho[p]=!0,await async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=null;try{await l.read(),ro(l.data,c)||(l.data[c]=[]),r=Zn(t)?new a.Query(t).find(l.data[c]).all():l.data[c]}catch(t){e=!0,r=t}return e?Promise.reject(r):r}(t).finally((()=>{ho[p]=!1}))},v.insert=async function(t){return ho[p]&&await po((()=>!ho[p])),ho[p]=!0,await d(t).finally((()=>{ho[p]=!1}))},v.save=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ho[p]&&await po((()=>!ho[p])),ho[p]=!0,await h(t,e).finally((()=>{ho[p]=!1}))},v.del=async function(t){return ho[p]&&await po((()=>!ho[p])),ho[p]=!0,await async function(t){let e=!1;if(!Zn(t)&&!eo(t))return[];t=wn(t);let r=null;try{Hn(t)||(t=[t]),await l.read(),ro(l.data,c)||(l.data[c]=[]);let e={};ee(l.data[c],((t,r)=>{e[t.id]={k:r,v:t}}));let n=[],o=!1;r=await Yn(t,(async t=>{let r=null,i=bt(t,"id","");if(Dn(i)){let t=bt(e,i,null);Zn(t)?(n.push(t.k),o=!0,r={n:1,nDeleted:1,ok:1}):r={n:1,nDeleted:0,ok:1}}else r={n:1,nDeleted:0,ok:0};return r})),o&&(l.data[c]=vo(l.data[c],n)),o&&await l.write(),v.emit("change","del",t,r)}catch(t){e=!0,r=t}return e?Promise.reject(r):r}(t).finally((()=>{ho[p]=!1}))},v.delAll=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ho[p]&&await po((()=>!ho[p])),ho[p]=!0,await async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=null;try{await l.read(),ro(l.data,c)||(l.data[c]=[]);let e=en(l.data[c]),n=0,o=!1;if(Zn(t)){let r=new a.Query(t).find(l.data[c]).all();if(n=en(r),0===n);else if(e===n)l.data[c]=[],o=!0;else{let t={};ee(r,((e,r)=>{t[e.id]={k:r,v:e}}));let e=[];ee(l.data[c],((r,n)=>{ro(t,r.id)||e.push(r)})),l.data[c]=e,o=!0}}else n=e,l.data[c]=[],o=!0;o&&await l.write(),r={n:e,nDeleted:n,ok:1},v.emit("change","delAll",null,r)}catch(t){e=!0,r=t}return e?Promise.reject(r):r}(t).finally((()=>{ho[p]=!1}))},v}}));
|
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("events"),require("lowdb"),require("node:fs"),require("node:fs/promises"),require("node:path"),require("node:url"),require("mingo")):"function"==typeof define&&define.amd?define(["path","events","lowdb","node:fs","node:fs/promises","node:path","node:url","mingo"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-orm-lowdb"]=e(t.path$1,t.events,t.lowdb,null,t.promises,t.path,t.node_url,t.mingo)}(this,(function(t,e,r,n,o,i,u,a){"use strict";class c{#t;#e;#r=!1;#n=null;#o=null;#i=null;#u=null;#a(t){return this.#u=t,this.#i||=new Promise(((t,e)=>{this.#o=[t,e]})),new Promise(((t,e)=>{this.#i?.then(t).catch(e)}))}async#c(t){this.#r=!0;try{await o.writeFile(this.#e,t,"utf-8"),await async function(t,e,r){for(let n=0;n<e;n++)try{return await t()}catch(t){if(!(n<e-1))throw t;await new Promise((t=>setTimeout(t,r)))}}((async()=>{await o.rename(this.#e,this.#t)}),10,100),this.#n?.[0]()}catch(t){throw t instanceof Error&&this.#n?.[1](t),t}finally{if(this.#r=!1,this.#n=this.#o,this.#o=this.#i=null,null!==this.#u){const t=this.#u;this.#u=null,await this.write(t)}}}constructor(t){this.#t=t,this.#e=function(t){const e=t instanceof URL?u.fileURLToPath(t):t.toString();return i.join(i.dirname(e),`.${i.basename(e)}.tmp`)}(t)}async write(t){return this.#r?this.#a(t):this.#c(t)}}class f{#t;#f;constructor(t){this.#t=t,this.#f=new c(t)}async read(){let t;try{t=await o.readFile(this.#t,"utf-8")}catch(t){if("ENOENT"===t.code)return null;throw t}return t}write(t){return this.#f.write(t)}}class l{#l;#s;#p;constructor(t,e){let{parse:r,stringify:n}=e;this.#l=new f(t),this.#s=r,this.#p=n}async read(){const t=await this.#l.read();return null===t?null:this.#s(t)}write(t){return this.#l.write(this.#p(t))}}class s extends l{constructor(t){super(t,{parse:JSON.parse,stringify:t=>JSON.stringify(t,null,2)})}}var p=Array.isArray,v="object"==typeof global&&global&&global.Object===Object&&global,d="object"==typeof self&&self&&self.Object===Object&&self,h=v||d||Function("return this")(),y=h.Symbol,b=Object.prototype,j=b.hasOwnProperty,g=b.toString,_=y?y.toStringTag:void 0;var w=Object.prototype.toString;var m=y?y.toStringTag:void 0;function O(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?function(t){var e=j.call(t,_),r=t[_];try{t[_]=void 0;var n=!0}catch(t){}var o=g.call(t);return n&&(e?t[_]=r:delete t[_]),o}(t):function(t){return w.call(t)}(t)}function A(t){return null!=t&&"object"==typeof t}function x(t){return"symbol"==typeof t||A(t)&&"[object Symbol]"==O(t)}var S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P=/^\w*$/;function k(t,e){if(p(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!x(t))||(P.test(t)||!S.test(t)||null!=e&&t in Object(e))}function z(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function F(t){if(!z(t))return!1;var e=O(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var E,I=h["__core-js_shared__"],D=(E=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"";var N=Function.prototype.toString;function M(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var U=/^\[object .+?Constructor\]$/,$=Function.prototype,T=Object.prototype,B=$.toString,q=T.hasOwnProperty,L=RegExp("^"+B.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function R(t){return!(!z(t)||(e=t,D&&D in e))&&(F(t)?L:U).test(M(t));var e}function C(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return R(r)?r:void 0}var V=C(Object,"create");var W=Object.prototype.hasOwnProperty;var G=Object.prototype.hasOwnProperty;function J(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Q(t,e){return t===e||t!=t&&e!=e}function H(t,e){for(var r=t.length;r--;)if(Q(t[r][0],e))return r;return-1}J.prototype.clear=function(){this.__data__=V?V(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(V){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return W.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return V?void 0!==e[t]:G.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=V&&void 0===e?"__lodash_hash_undefined__":e,this};var K=Array.prototype.splice;function X(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}X.prototype.clear=function(){this.__data__=[],this.size=0},X.prototype.delete=function(t){var e=this.__data__,r=H(e,t);return!(r<0)&&(r==e.length-1?e.pop():K.call(e,r,1),--this.size,!0)},X.prototype.get=function(t){var e=this.__data__,r=H(e,t);return r<0?void 0:e[r][1]},X.prototype.has=function(t){return H(this.__data__,t)>-1},X.prototype.set=function(t,e){var r=this.__data__,n=H(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var Y=C(h,"Map");function Z(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}tt.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(Y||X),string:new J}},tt.prototype.delete=function(t){var e=Z(this,t).delete(t);return this.size-=e?1:0,e},tt.prototype.get=function(t){return Z(this,t).get(t)},tt.prototype.has=function(t){return Z(this,t).has(t)},tt.prototype.set=function(t,e){var r=Z(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function et(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(et.Cache||tt),r}et.Cache=tt;var rt,nt,ot,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ut=/\\(\\)?/g,at=(rt=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(it,(function(t,r,n,o){e.push(n?o.replace(ut,"$1"):r||t)})),e},nt=et(rt,(function(t){return 500===ot.size&&ot.clear(),t})),ot=nt.cache,nt),ct=at;function ft(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var lt=y?y.prototype:void 0,st=lt?lt.toString:void 0;function pt(t){if("string"==typeof t)return t;if(p(t))return ft(t,pt)+"";if(x(t))return st?st.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function vt(t){return null==t?"":pt(t)}function dt(t,e){return p(t)?t:k(t,e)?[t]:ct(vt(t))}function ht(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function yt(t,e){for(var r=0,n=(e=dt(e,t)).length;null!=t&&r<n;)t=t[ht(e[r++])];return r&&r==n?t:void 0}function bt(t,e,r){var n=null==t?void 0:yt(t,e);return void 0===n?r:n}function jt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var gt,_t=function(t,e,r){for(var n=-1,o=Object(t),i=r(t),u=i.length;u--;){var a=i[gt?u:++n];if(!1===e(o[a],a,o))break}return t};function wt(t){return A(t)&&"[object Arguments]"==O(t)}var mt=Object.prototype,Ot=mt.hasOwnProperty,At=mt.propertyIsEnumerable,xt=wt(function(){return arguments}())?wt:function(t){return A(t)&&Ot.call(t,"callee")&&!At.call(t,"callee")},St=xt;var Pt="object"==typeof exports&&exports&&!exports.nodeType&&exports,kt=Pt&&"object"==typeof module&&module&&!module.nodeType&&module,zt=kt&&kt.exports===Pt?h.Buffer:void 0,Ft=(zt?zt.isBuffer:void 0)||function(){return!1},Et=/^(?:0|[1-9]\d*)$/;function It(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Et.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var Nt={};function Mt(t){return function(e){return t(e)}}Nt["[object Float32Array]"]=Nt["[object Float64Array]"]=Nt["[object Int8Array]"]=Nt["[object Int16Array]"]=Nt["[object Int32Array]"]=Nt["[object Uint8Array]"]=Nt["[object Uint8ClampedArray]"]=Nt["[object Uint16Array]"]=Nt["[object Uint32Array]"]=!0,Nt["[object Arguments]"]=Nt["[object Array]"]=Nt["[object ArrayBuffer]"]=Nt["[object Boolean]"]=Nt["[object DataView]"]=Nt["[object Date]"]=Nt["[object Error]"]=Nt["[object Function]"]=Nt["[object Map]"]=Nt["[object Number]"]=Nt["[object Object]"]=Nt["[object RegExp]"]=Nt["[object Set]"]=Nt["[object String]"]=Nt["[object WeakMap]"]=!1;var Ut="object"==typeof exports&&exports&&!exports.nodeType&&exports,$t=Ut&&"object"==typeof module&&module&&!module.nodeType&&module,Tt=$t&&$t.exports===Ut&&v.process,Bt=function(){try{var t=$t&&$t.require&&$t.require("util").types;return t||Tt&&Tt.binding&&Tt.binding("util")}catch(t){}}(),qt=Bt&&Bt.isTypedArray,Lt=qt?Mt(qt):function(t){return A(t)&&Dt(t.length)&&!!Nt[O(t)]},Rt=Object.prototype.hasOwnProperty;function Ct(t,e){var r=p(t),n=!r&&St(t),o=!r&&!n&&Ft(t),i=!r&&!n&&!o&&Lt(t),u=r||n||o||i,a=u?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var f in t)!e&&!Rt.call(t,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||It(f,c))||a.push(f);return a}var Vt=Object.prototype;function Wt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Vt)}function Gt(t,e){return function(r){return t(e(r))}}var Jt=Gt(Object.keys,Object),Qt=Object.prototype.hasOwnProperty;function Ht(t){if(!Wt(t))return Jt(t);var e=[];for(var r in Object(t))Qt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function Kt(t){return null!=t&&Dt(t.length)&&!F(t)}function Xt(t){return Kt(t)?Ct(t):Ht(t)}var Yt=function(t,e){return function(r,n){if(null==r)return r;if(!Kt(r))return t(r,n);for(var o=r.length,i=e?o:-1,u=Object(r);(e?i--:++i<o)&&!1!==n(u[i],i,u););return r}}((function(t,e){return t&&_t(t,e,Xt)})),Zt=Yt;function te(t){return t}function ee(t,e){var r;return(p(t)?jt:Zt)(t,"function"==typeof(r=e)?r:te)}function re(t){var e=this.__data__=new X(t);this.size=e.size}re.prototype.clear=function(){this.__data__=new X,this.size=0},re.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},re.prototype.get=function(t){return this.__data__.get(t)},re.prototype.has=function(t){return this.__data__.has(t)},re.prototype.set=function(t,e){var r=this.__data__;if(r instanceof X){var n=r.__data__;if(!Y||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new tt(n)}return r.set(t,e),this.size=r.size,this};function ne(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new tt;++e<r;)this.add(t[e])}function oe(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function ie(t,e){return t.has(e)}ne.prototype.add=ne.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ne.prototype.has=function(t){return this.__data__.has(t)};function ue(t,e,r,n,o,i){var u=1&r,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var f=i.get(t),l=i.get(e);if(f&&l)return f==e&&l==t;var s=-1,p=!0,v=2&r?new ne:void 0;for(i.set(t,e),i.set(e,t);++s<a;){var d=t[s],h=e[s];if(n)var y=u?n(h,d,s,e,t,i):n(d,h,s,t,e,i);if(void 0!==y){if(y)continue;p=!1;break}if(v){if(!oe(e,(function(t,e){if(!ie(v,e)&&(d===t||o(d,t,r,n,i)))return v.push(e)}))){p=!1;break}}else if(d!==h&&!o(d,h,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p}var ae=h.Uint8Array;function ce(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function fe(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var le=y?y.prototype:void 0,se=le?le.valueOf:void 0;function pe(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function ve(t,e,r){var n=e(t);return p(t)?n:pe(n,r(t))}function de(){return[]}var he=Object.prototype.propertyIsEnumerable,ye=Object.getOwnPropertySymbols,be=ye?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}(ye(t),(function(e){return he.call(t,e)})))}:de,je=be;function ge(t){return ve(t,Xt,je)}var _e=Object.prototype.hasOwnProperty;var we=C(h,"DataView"),me=C(h,"Promise"),Oe=C(h,"Set"),Ae=C(h,"WeakMap"),xe="[object Map]",Se="[object Promise]",Pe="[object Set]",ke="[object WeakMap]",ze="[object DataView]",Fe=M(we),Ee=M(Y),Ie=M(me),De=M(Oe),Ne=M(Ae),Me=O;(we&&Me(new we(new ArrayBuffer(1)))!=ze||Y&&Me(new Y)!=xe||me&&Me(me.resolve())!=Se||Oe&&Me(new Oe)!=Pe||Ae&&Me(new Ae)!=ke)&&(Me=function(t){var e=O(t),r="[object Object]"==e?t.constructor:void 0,n=r?M(r):"";if(n)switch(n){case Fe:return ze;case Ee:return xe;case Ie:return Se;case De:return Pe;case Ne:return ke}return e});var Ue=Me,$e="[object Arguments]",Te="[object Array]",Be="[object Object]",qe=Object.prototype.hasOwnProperty;function Le(t,e,r,n,o,i){var u=p(t),a=p(e),c=u?Te:Ue(t),f=a?Te:Ue(e),l=(c=c==$e?Be:c)==Be,s=(f=f==$e?Be:f)==Be,v=c==f;if(v&&Ft(t)){if(!Ft(e))return!1;u=!0,l=!1}if(v&&!l)return i||(i=new re),u||Lt(t)?ue(t,e,r,n,o,i):function(t,e,r,n,o,i,u){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new ae(t),new ae(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Q(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ce;case"[object Set]":var c=1&n;if(a||(a=fe),t.size!=e.size&&!c)return!1;var f=u.get(t);if(f)return f==e;n|=2,u.set(t,e);var l=ue(a(t),a(e),n,o,i,u);return u.delete(t),l;case"[object Symbol]":if(se)return se.call(t)==se.call(e)}return!1}(t,e,c,r,n,o,i);if(!(1&r)){var d=l&&qe.call(t,"__wrapped__"),h=s&&qe.call(e,"__wrapped__");if(d||h){var y=d?t.value():t,b=h?e.value():e;return i||(i=new re),o(y,b,r,n,i)}}return!!v&&(i||(i=new re),function(t,e,r,n,o,i){var u=1&r,a=ge(t),c=a.length;if(c!=ge(e).length&&!u)return!1;for(var f=c;f--;){var l=a[f];if(!(u?l in e:_e.call(e,l)))return!1}var s=i.get(t),p=i.get(e);if(s&&p)return s==e&&p==t;var v=!0;i.set(t,e),i.set(e,t);for(var d=u;++f<c;){var h=t[l=a[f]],y=e[l];if(n)var b=u?n(y,h,l,e,t,i):n(h,y,l,t,e,i);if(!(void 0===b?h===y||o(h,y,r,n,i):b)){v=!1;break}d||(d="constructor"==l)}if(v&&!d){var j=t.constructor,g=e.constructor;j==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof g&&g instanceof g||(v=!1)}return i.delete(t),i.delete(e),v}(t,e,r,n,o,i))}function Re(t,e,r,n,o){return t===e||(null==t||null==e||!A(t)&&!A(e)?t!=t&&e!=e:Le(t,e,r,n,Re,o))}function Ce(t){return t==t&&!z(t)}function Ve(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function We(t){var e=function(t){for(var e=Xt(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,Ce(o)]}return e}(t);return 1==e.length&&e[0][2]?Ve(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,n){var o=r.length,i=o,u=!n;if(null==t)return!i;for(t=Object(t);o--;){var a=r[o];if(u&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var c=(a=r[o])[0],f=t[c],l=a[1];if(u&&a[2]){if(void 0===f&&!(c in t))return!1}else{var s=new re;if(n)var p=n(f,l,c,t,e,s);if(!(void 0===p?Re(l,f,3,n,s):p))return!1}}return!0}(r,t,e)}}function Ge(t,e){return null!=t&&e in Object(t)}function Je(t,e){return null!=t&&function(t,e,r){for(var n=-1,o=(e=dt(e,t)).length,i=!1;++n<o;){var u=ht(e[n]);if(!(i=null!=t&&r(t,u)))break;t=t[u]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Dt(o)&&It(u,o)&&(p(t)||St(t))}(t,e,Ge)}function Qe(t){return function(e){return null==e?void 0:e[t]}}function He(t){return k(t)?Qe(ht(t)):function(t){return function(e){return yt(e,t)}}(t)}function Ke(t){return"function"==typeof t?t:null==t?te:"object"==typeof t?p(t)?function(t,e){return k(t)&&Ce(e)?Ve(ht(t),e):function(r){var n=bt(r,t);return void 0===n&&n===e?Je(r,t):Re(e,n,3)}}(t[0],t[1]):We(t):He(t)}function Xe(t,e){var r=-1,n=Kt(t)?Array(t.length):[];return Zt(t,(function(t,o,i){n[++r]=e(t,o,i)})),n}function Ye(t,e){return(p(t)?ft:Xe)(t,Ke(e))}var Ze=function(){try{var t=C(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),tr=Ze;function er(t,e,r){"__proto__"==e&&tr?tr(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function rr(t,e,r){(void 0!==r&&!Q(t[e],r)||void 0===r&&!(e in t))&&er(t,e,r)}var nr="object"==typeof exports&&exports&&!exports.nodeType&&exports,or=nr&&"object"==typeof module&&module&&!module.nodeType&&module,ir=or&&or.exports===nr?h.Buffer:void 0,ur=ir?ir.allocUnsafe:void 0;function ar(t,e){if(e)return t.slice();var r=t.length,n=ur?ur(r):new t.constructor(r);return t.copy(n),n}function cr(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e}function fr(t,e){var r=e?cr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function lr(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var sr=Object.create,pr=function(){function t(){}return function(e){if(!z(e))return{};if(sr)return sr(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),vr=pr,dr=Gt(Object.getPrototypeOf,Object);function hr(t){return"function"!=typeof t.constructor||Wt(t)?{}:vr(dr(t))}var yr=Function.prototype,br=Object.prototype,jr=yr.toString,gr=br.hasOwnProperty,_r=jr.call(Object);function wr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var mr=Object.prototype.hasOwnProperty;function Or(t,e,r){var n=t[e];mr.call(t,e)&&Q(n,r)&&(void 0!==r||e in t)||er(t,e,r)}function Ar(t,e,r,n){var o=!r;r||(r={});for(var i=-1,u=e.length;++i<u;){var a=e[i],c=n?n(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),o?er(r,a,c):Or(r,a,c)}return r}var xr=Object.prototype.hasOwnProperty;function Sr(t){if(!z(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=Wt(t),r=[];for(var n in t)("constructor"!=n||!e&&xr.call(t,n))&&r.push(n);return r}function Pr(t){return Kt(t)?Ct(t,!0):Sr(t)}function kr(t,e,r,n,o,i,u){var a=wr(t,r),c=wr(e,r),f=u.get(c);if(f)rr(t,r,f);else{var l,s=i?i(a,c,r+"",t,e,u):void 0,v=void 0===s;if(v){var d=p(c),h=!d&&Ft(c),y=!d&&!h&&Lt(c);s=c,d||h||y?p(a)?s=a:A(l=a)&&Kt(l)?s=lr(a):h?(v=!1,s=ar(c,!0)):y?(v=!1,s=fr(c,!0)):s=[]:function(t){if(!A(t)||"[object Object]"!=O(t))return!1;var e=dr(t);if(null===e)return!0;var r=gr.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&jr.call(r)==_r}(c)||St(c)?(s=a,St(a)?s=function(t){return Ar(t,Pr(t))}(a):z(a)&&!F(a)||(s=hr(c))):v=!1}v&&(u.set(c,s),o(s,c,n,i,u),u.delete(c)),rr(t,r,s)}}function zr(t,e,r,n,o){t!==e&&_t(e,(function(i,u){if(o||(o=new re),z(i))kr(t,e,u,r,zr,n,o);else{var a=n?n(wr(t,u),i,u+"",t,e,o):void 0;void 0===a&&(a=i),rr(t,u,a)}}),Pr)}var Fr=Math.max;function Er(t,e,r){return e=Fr(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=Fr(n.length-e,0),u=Array(i);++o<i;)u[o]=n[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=n[o];return a[e]=r(u),function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(t,this,a)}}var Ir=tr?function(t,e){return tr(t,"toString",{configurable:!0,enumerable:!1,value:(r=e,function(){return r}),writable:!0});var r}:te,Dr=Ir,Nr=Date.now;var Mr=function(t){var e=0,r=0;return function(){var n=Nr(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Dr),Ur=Mr;var $r,Tr=($r=function(t,e,r){zr(t,e,r)},function(t,e){return Ur(Er(t,e,te),t+"")}((function(t,e){var r=-1,n=e.length,o=n>1?e[n-1]:void 0,i=n>2?e[2]:void 0;for(o=$r.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,e,r){if(!z(r))return!1;var n=typeof e;return!!("number"==n?Kt(r)&&It(e,r.length):"string"==n&&e in r)&&Q(r[e],t)}(e[0],e[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++r<n;){var u=e[r];u&&$r(t,u,r,o)}return t}))),Br=Tr;var qr=Qe("length"),Lr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Rr="\\ud800-\\udfff",Cr="["+Rr+"]",Vr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Wr="\\ud83c[\\udffb-\\udfff]",Gr="[^"+Rr+"]",Jr="(?:\\ud83c[\\udde6-\\uddff]){2}",Qr="[\\ud800-\\udbff][\\udc00-\\udfff]",Hr="(?:"+Vr+"|"+Wr+")"+"?",Kr="[\\ufe0e\\ufe0f]?",Xr=Kr+Hr+("(?:\\u200d(?:"+[Gr,Jr,Qr].join("|")+")"+Kr+Hr+")*"),Yr="(?:"+[Gr+Vr+"?",Vr,Jr,Qr,Cr].join("|")+")",Zr=RegExp(Wr+"(?="+Wr+")|"+Yr+Xr,"g");function tn(t){return function(t){return Lr.test(t)}(t)?function(t){for(var e=Zr.lastIndex=0;Zr.test(t);)++e;return e}(t):qr(t)}function en(t){if(null==t)return 0;if(Kt(t))return"string"==typeof(e=t)||!p(e)&&A(e)&&"[object String]"==O(e)?tn(t):t.length;var e,r=Ue(t);return"[object Map]"==r||"[object Set]"==r?t.size:Ht(t).length}var rn=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)pe(e,je(t)),t=dr(t);return e}:de,nn=rn;function on(t){return ve(t,Pr,nn)}var un=Object.prototype.hasOwnProperty;var an=/\w*$/;var cn=y?y.prototype:void 0,fn=cn?cn.valueOf:void 0;function ln(t,e,r){var n,o=t.constructor;switch(e){case"[object ArrayBuffer]":return cr(t);case"[object Boolean]":case"[object Date]":return new o(+t);case"[object DataView]":return function(t,e){var r=e?cr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return fr(t,r);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return n=t,fn?Object(fn.call(n)):{}}}var sn=Bt&&Bt.isMap,pn=sn?Mt(sn):function(t){return A(t)&&"[object Map]"==Ue(t)};var vn=Bt&&Bt.isSet,dn=vn?Mt(vn):function(t){return A(t)&&"[object Set]"==Ue(t)},hn="[object Arguments]",yn="[object Function]",bn="[object Object]",jn={};function gn(t,e,r,n,o,i){var u,a=1&e,c=2&e,f=4&e;if(r&&(u=o?r(t,n,o,i):r(t)),void 0!==u)return u;if(!z(t))return t;var l=p(t);if(l){if(u=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&un.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return lr(t,u)}else{var s=Ue(t),v=s==yn||"[object GeneratorFunction]"==s;if(Ft(t))return ar(t,a);if(s==bn||s==hn||v&&!o){if(u=c||v?{}:hr(t),!a)return c?function(t,e){return Ar(t,nn(t),e)}(t,function(t,e){return t&&Ar(e,Pr(e),t)}(u,t)):function(t,e){return Ar(t,je(t),e)}(t,function(t,e){return t&&Ar(e,Xt(e),t)}(u,t))}else{if(!jn[s])return o?t:{};u=ln(t,s,a)}}i||(i=new re);var d=i.get(t);if(d)return d;i.set(t,u),dn(t)?t.forEach((function(n){u.add(gn(n,e,r,n,t,i))})):pn(t)&&t.forEach((function(n,o){u.set(o,gn(n,e,r,o,t,i))}));var h=l?void 0:(f?c?on:ge:c?Pr:Xt)(t);return jt(h||t,(function(n,o){h&&(n=t[o=n]),Or(u,o,gn(n,e,r,o,t,i))})),u}jn[hn]=jn["[object Array]"]=jn["[object ArrayBuffer]"]=jn["[object DataView]"]=jn["[object Boolean]"]=jn["[object Date]"]=jn["[object Float32Array]"]=jn["[object Float64Array]"]=jn["[object Int8Array]"]=jn["[object Int16Array]"]=jn["[object Int32Array]"]=jn["[object Map]"]=jn["[object Number]"]=jn[bn]=jn["[object RegExp]"]=jn["[object Set]"]=jn["[object String]"]=jn["[object Symbol]"]=jn["[object Uint8Array]"]=jn["[object Uint8ClampedArray]"]=jn["[object Uint16Array]"]=jn["[object Uint32Array]"]=!0,jn["[object Error]"]=jn[yn]=jn["[object WeakMap]"]=!1;function _n(t){return gn(t,5)}var wn=/\s/;var mn=/^\s+/;function On(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&wn.test(t.charAt(e)););return e}(t)+1).replace(mn,""):t}var An=/^[-+]0x[0-9a-f]+$/i,xn=/^0b[01]+$/i,Sn=/^0o[0-7]+$/i,Pn=parseInt;function kn(t){if("number"==typeof t)return t;if(x(t))return NaN;if(z(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=z(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=On(t);var r=xn.test(t);return r||Sn.test(t)?Pn(t.slice(2),r?2:8):An.test(t)?NaN:+t}var zn=1/0;function Fn(t){return t?(t=kn(t))===zn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function En(t){var e=Fn(t),r=e%1;return e==e?r?e-r:e:0}function In(t){return"[object String]"===Object.prototype.toString.call(t)}function Dn(t){return!(!In(t)||""===t)}function Nn(t){return t!=t}function Mn(t){let e=!1;if(Dn(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(Nn(t))return!1;e=!0}return e}function Un(t){if(!Mn(t))return 0;return Fn(t)}function $n(t){return!!Mn(t)&&(t=Un(t),"number"==typeof(e=t)&&e==En(e));var e}var Tn=h.isFinite,Bn=Math.min;var qn=function(t){var e=Math[t];return function(t,r){if(t=kn(t),(r=null==r?0:Bn(En(r),292))&&Tn(t)){var n=(vt(t)+"e").split("e");return+((n=(vt(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),Ln=qn;function Rn(t){if(!Mn(t))return 0;t=Un(t);let e=Ln(t);return"0"===String(e)?0:e}function Cn(t){if(!$n(t))return!1;return Rn(t)>0}let Vn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Wn=Vn.length;function Gn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,e=[];t=Cn(t)?Rn(t):32;for(let r=0;r<t;r++)e[r]=Vn[0|Math.random()*Wn];return e.join("")}function Jn(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}function Qn(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}function Hn(t){return"[object Array]"===Object.prototype.toString.call(t)}function Kn(t){return"[object Object]"===Object.prototype.toString.call(t)}function Xn(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Yn(t,e){let r=Qn();if(!Hn(t)&&!Kn(t))return r.reject("rs is not an array or object"),r;let n=!1;if(Kn(t)){n=!0;let e=[];ee(t,((t,r)=>{e.push({k:r,v:t})})),t=e}Xn(e)||(e=function(t){return t});let o=-1,i=[];return t.reduce((function(t,r){return t.then((function(t){i.push(t),o+=1;let u=o,a=r;return n&&(u=r.k,a=r.v),Xn(e)?e(a,u):a}))}),Promise.resolve()).then((function(t){var e,n,o,u;i.push(t),u=null==(e=i)?0:e.length,i=u?Jn(e,(n=o||void 0===n?1:En(n))<0?0:n,u):[],r.resolve(i)})).catch((function(t){r.reject(t)})),r}function Zn(t){if(Kn(t)){for(let e in t)return!0;return!1}return!1}function to(t){return!!function(t){return"[object Undefined]"===Object.prototype.toString.call(t)}(t)||(!!function(t){return"[object Null]"===Object.prototype.toString.call(t)}(t)||(!!function(t){if(Kn(t)){for(let e in t)return!1;return!0}return!1}(t)||(!!function(t){return!(!In(t)||""!==t)}(t)||(!!function(t){return!!Hn(t)&&0===t.length}(t)||!!Nn(t)))))}function eo(t){return!!Hn(t)&&(0!==t.length&&(1!==t.length||!to(t[0])))}function ro(t,e){return!!Kn(t)&&(!(!Dn(e)&&!Mn(e))&&e in t)}var no=Object.prototype.hasOwnProperty;function oo(t,e){var r=-1,n=(e=dt(e,t)).length;if(!n)return!0;for(;++r<n;){var o=ht(e[r]);if("__proto__"===o&&!no.call(t,"__proto__"))return!1;if(("constructor"===o||"prototype"===o)&&r<n-1)return!1}var i=function(t,e){return e.length<2?t:yt(t,Jn(e,0,-1))}(t,e);return null==i||delete i[ht(function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}(e))]}var io=Array.prototype.splice;function uo(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=x(t),u=void 0!==e,a=null===e,c=e==e,f=x(e);if(!a&&!f&&!i&&t>e||i&&u&&c&&!a&&!f||n&&u&&c||!r&&c||!o)return 1;if(!n&&!i&&!f&&t<e||f&&r&&o&&!n&&!i||a&&r&&o||!u&&o||!c)return-1}return 0}var ao=y?y.isConcatSpreadable:void 0;function co(t){return p(t)||St(t)||!!(ao&&t&&t[ao])}function fo(t,e,r,n,o){var i=-1,u=t.length;for(r||(r=co),o||(o=[]);++i<u;){var a=t[i];e>0&&r(a)?e>1?fo(a,e-1,r,n,o):pe(o,a):n||(o[o.length]=a)}return o}function lo(t){return(null==t?0:t.length)?fo(t,1):[]}var so=function(t){return Ur(Er(t,void 0,lo),t+"")}((function(t,e){var r=null==t?0:t.length,n=function(t,e){for(var r=-1,n=e.length,o=Array(n),i=null==t;++r<n;)o[r]=i?void 0:bt(t,e[r]);return o}(t,e);return function(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;It(o)?io.call(t,o,1):oo(t,o)}}}(t,ft(e,(function(t){return It(t,r)?+t:t})).sort(uo)),n})),po=so;function vo(t,e){if(!eo(t))return[];var r;if($n(r=e)&&Rn(r)>=0&&(e=[e]),!eo(e))return t;e=Ye(e,(t=>Rn(t)));let n=_n(t);return po(n,e),n}async function ho(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,n=Qn();if(!Xn(t))return n.reject("waitfunction需輸入函數f"),n;let o=async()=>{let e=t();return function(t){let e,r=Object.prototype.toString.call(t);if(e="[object Promise]"===r,e)return!0;if("[object Function]"!==r)return!1;try{e="function"!=typeof t.subscribe&&"function"==typeof t.then}catch(t){}return e}(e)&&(e=await e),e};if(r=await o(),!0===r)return n.resolve(),n;let i=bt(e,"attemptNum",null);Cn(i)||(i=200);let u=bt(e,"timeInterval",null);Cn(u)||(u=1e3);let a=0,c=setInterval((async()=>{a+=1,r=await o(),!0===r&&(clearInterval(c),n.resolve()),a>i&&(clearInterval(c),n.reject(`exceeded attemptNum[${i}]`))}),u);return n}let yo={};return function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=null,i=bt(n,"url");Dn(i)||(i="./db.json");let u=bt(n,"db");Dn(u)||(u="worm");let c=bt(n,"cl");Dn(c)||(c="test");let f=`${u}:${c}`,l=new s(i),p=new r.Low(l,{}),v=new e.EventEmitter,d=t.resolve(i);async function h(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=null;try{let e=await(async()=>(Hn(o)||(await p.read(),ro(p.data,f)||(p.data[f]=[]),o=p.data[f]),_n(o)))();if(Zn(t)){r=new a.Query(t).find(e).all()}else r=e}catch(t){e=!0,r=t}return e?Promise.reject(r):r}async function y(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!1;if(!Zn(t)&&!eo(t))return[];t=_n(t);let n=bt(e,"autoInsert",!0),i=null;try{Hn(t)||(t=[t]),t=Ye(t,(function(t){return Dn(t.id)||(t.id=Gn()),t})),await p.read(),ro(p.data,f)||(p.data[f]=[]);let e={};ee(p.data[f],((t,r)=>{e[t.id]={k:r,v:t}}));let r=!1;i=await Yn(t,(async t=>{let o=null,i=bt(e,t.id,null),u=Zn(i);var a,c;if(u&&(a=t,c=i.v,Re(a,c)||(p.data[f][i.k]=Br(p.data[f][i.k],t),o={update:!0},r=!0)),o=Zn(o)?{n:1,nModified:1,ok:1}:{n:0,nModified:0,ok:1},n&&0===o.n&&!u){let n=en(p.data[f]);p.data[f].push(t),e[t.id]={k:n,v:p.data[f][n]},r=!0,o={n:1,nInserted:1,ok:1}}return o})),r&&await p.write()}catch(t){r=!0,i=t}if(o=null,!r)try{v.emit("change","save",t,i)}catch(t){console.log(t)}return r?Promise.reject(i):i}return ro(yo,d)||(yo[d]=!1),v.select=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return yo[d]&&await ho((()=>!yo[d])),yo[d]=!0,await h(t).finally((()=>{yo[d]=!1}))},v.insert=async function(t){return yo[d]&&await ho((()=>!yo[d])),yo[d]=!0,await async function(t){let e=!1;if(!Zn(t)&&!eo(t))return{n:0,nInserted:0,ok:1};t=_n(t);let r=null;try{Hn(t)||(t=[t]),t=Ye(t,(function(t){return Dn(t.id)||(t.id=Gn()),t})),await p.read(),ro(p.data,f)||(p.data[f]=[]);let e={};ee(p.data[f],((t,r)=>{e[t.id]={k:r,v:t}}));let n=en(t),o=0,i=!1;ee(t,(t=>{ro(e,t.id)||(p.data[f].push(t),o++,i=!0)})),i&&await p.write(),r={n:n,nInserted:o,ok:1}}catch(t){e=!0,r=t}if(o=null,!e)try{v.emit("change","insert",t,r)}catch(t){console.log(t)}return e?Promise.reject(r):r}(t).finally((()=>{yo[d]=!1}))},v.save=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return yo[d]&&await ho((()=>!yo[d])),yo[d]=!0,await y(t,e).finally((()=>{yo[d]=!1}))},v.del=async function(t){return yo[d]&&await ho((()=>!yo[d])),yo[d]=!0,await async function(t){let e=!1;if(!Zn(t)&&!eo(t))return[];t=_n(t);let r=null;try{Hn(t)||(t=[t]),await p.read(),ro(p.data,f)||(p.data[f]=[]);let e={};ee(p.data[f],((t,r)=>{e[t.id]={k:r,v:t}}));let n=[],o=!1;r=await Yn(t,(async t=>{let r=null,i=bt(t,"id","");if(Dn(i)){let t=bt(e,i,null);Zn(t)?(n.push(t.k),o=!0,r={n:1,nDeleted:1,ok:1}):r={n:1,nDeleted:0,ok:1}}else r={n:1,nDeleted:0,ok:0};return r})),o&&(p.data[f]=vo(p.data[f],n)),o&&await p.write()}catch(t){e=!0,r=t}if(o=null,!e)try{v.emit("change","del",t,r)}catch(t){console.log(t)}return e?Promise.reject(r):r}(t).finally((()=>{yo[d]=!1}))},v.delAll=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return yo[d]&&await ho((()=>!yo[d])),yo[d]=!0,await async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=null;try{await p.read(),ro(p.data,f)||(p.data[f]=[]);let e=en(p.data[f]),n=0,o=!1;if(Zn(t)){let r=new a.Query(t).find(p.data[f]).all();if(n=en(r),0===n);else if(e===n)p.data[f]=[],o=!0;else{let t={};ee(r,((e,r)=>{t[e.id]={k:r,v:e}}));let e=[];ee(p.data[f],((r,n)=>{ro(t,r.id)||e.push(r)})),p.data[f]=e,o=!0}}else n=e,p.data[f]=[],o=!0;o&&await p.write(),r={n:e,nDeleted:n,ok:1}}catch(t){e=!0,r=t}if(o=null,!e)try{v.emit("change","delAll",null,r)}catch(t){console.log(t)}return e?Promise.reject(r):r}(t).finally((()=>{yo[d]=!1}))},v}}));
|
|
7
7
|
//# sourceMappingURL=w-orm-lowdb.umd.js.map
|