forked from mWater/minimongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminimongo.js.map
More file actions
1 lines (1 loc) · 286 KB
/
Copy pathminimongo.js.map
File metadata and controls
1 lines (1 loc) · 286 KB
1
{"version":3,"sources":["webpack:///webpack/bootstrap e67f479db04bee1dc2e6","webpack:///./lib/utils.js","webpack:///external \"_\"","webpack:///./lib/selector.js","webpack:///./node_modules/async/lib/async.js","webpack:///./lib/MemoryDb.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/process/browser.js","webpack:///./lib/IndexedDb.js","webpack:///./lib/WebSQLDb.js","webpack:///./lib/LocalStorageDb.js","webpack:///./lib/HybridDb.js","webpack:///./index.js","webpack:///./node_modules/node-libs-browser/node_modules/timers-browserify/main.js","webpack:///./node_modules/setimmediate/setImmediate.js","webpack:///./node_modules/bowser/bowser.js","webpack:///./lib/EJSON.js","webpack:///./node_modules/idb-wrapper/idbstore.js","webpack:///./lib/RemoteDb.js","webpack:///external \"$\"","webpack:///./lib/jQueryHttpClient.js","webpack:///./lib/ReplicatingDb.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC7DA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,iBAAiB;AACjB,eAAe;AACf,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,WAAW;AACjD;AACA;AACA;AACA,yCAAyC,YAAY;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,wCAAwC,YAAY;AACpD;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,mCAAmC,WAAW;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChVA,mB;;;;;;ACAA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,6BAA6B,OAAO;AACpC;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA,yBAAyB;AACzB,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA,6BAA6B,aAAa;AAC1C,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,+BAA+B,wBAAwB;AACvD,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,qBAAqB,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA,+BAA+B,IAAI,MAAM;AACzC,+BAA+B,IAAI,QAAQ;AAC3C,+BAA+B,KAAK;AACpC,+BAA+B,KAAK,KAAK;AACzC,oCAAoC,OAAO;AAC3C,oCAAoC,KAAK,EAAE;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA,OAAO;AACP;AACA,GAAG;;;AAGH;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAAuD,YAAY;AACnE;AACA;AACA;AACA,2BAA2B;;AAE3B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;;AAEA;AACA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;qECvuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mDAAmD,UAAU,EAAE;AAC/D;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gBAAgB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC,uBAAuB;AACzD;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,6BAA6B;AACjE;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;;;AAIA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8DAA8D,yBAAyB;AACvF,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AAAA;AACT;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;AChvCD;AACA,4BAA4B,mBAAmB,gCAAgC,GAAG;;AAElF;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,WAAW;AAChD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,WAAW;AAClD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;;;;;;AC9SD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;ACpBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;ACvLtC;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,mCAAmC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+CAA+C,mCAAmC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+CAA+C,mCAAmC;AAClF;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+CAA+C,mCAAmC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+CAA+C,mCAAmC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;;;;;;;AC9iBD;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0JAA0J;AAC1J;AACA,OAAO;AACP;AACA;AACA,kEAAkE;AAClE;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,mCAAmC;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,2CAA2C,WAAW;AACtD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb,WAAW;AACX,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,mCAAmC;AACzF;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,mCAAmC;AACzF;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,eAAe;AACf;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,eAAe;AACf,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,mCAAmC;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;;;;;;;ACrjBD;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yDAAyD,mCAAmC;AAC5F;AACA;AACA,sCAAsC,WAAW;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,mCAAmC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,WAAW;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,WAAW;AAChD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,WAAW;AAClD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,WAAW;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;ACnWD;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,mBAAmB;AACnB;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,WAAW;AACX;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,eAAe;AACf;AACA;AACA;AACA,mBAAmB;AACnB,iBAAiB;AACjB;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,iBAAiB;AACjB,eAAe;AACf,aAAa;AACb;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,eAAe;AACf,aAAa;AACb;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;AC3WD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;;;;;;ACpDA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C,sBAAsB,EAAE;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU;AACV;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;ACzLD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;ACnRD;;AAEA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP,cAAc;AACd,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,8BAA8B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,qBAAqB,8BAA8B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;;;;;;ACrUA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,eAAe,SAAS;AACxB;AACA,eAAe,SAAS;AACxB;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;;AAEA;;AAEA;AACA;AACA,iBAAiB;AACjB,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,qCAAqC;AACrC;AACA,mBAAmB,EAAE;AACrB;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wCAAwC;AACxC;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,EAAE;AACrB,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,EAAE;AACrB,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,gDAAgD;AAChD;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA,wBAAwB;AACxB,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC;;AAEpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA,wBAAwB;AACxB,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA,+DAA+D,IAAI;;AAEnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC,mBAAmB,eAAe;AAClC,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC,mBAAmB,eAAe;AAClC,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,mBAAmB,OAAO;AAC1B,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mDAAmD,OAAO;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,YAAY;AAC/B,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,QAAQ;AAC3B;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,eAAe;;AAE5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,YAAY;AAC/B,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,YAAY;AAC/B,mBAAmB,SAAS;AAC5B;AACA,qBAAqB,eAAe;AACpC;AACA;;AAEA;AACA;AACA;AACA,aAAa,eAAe;;AAE5B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,EAAE;AACrB,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,EAAE;AACrB,mBAAmB,QAAQ;AAC3B;AACA,mBAAmB,EAAE;AACrB;AACA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;AC53CD;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;;;;;;;ACrMD,mB;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;AC/BA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,WAAW;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC","file":"minimongo.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e67f479db04bee1dc2e6","var async, bowser, compileDocumentSelector, compileSort, deg2rad, getDistanceFromLatLngInM, isLocalStorageSupported, pointInPolygon, processGeoIntersectsOperator, processNearOperator, _;\n\n_ = require('lodash');\n\nasync = require('async');\n\nbowser = require('bowser');\n\ncompileDocumentSelector = require('./selector').compileDocumentSelector;\n\ncompileSort = require('./selector').compileSort;\n\nisLocalStorageSupported = function() {\n var e;\n if (!window.localStorage) {\n return false;\n }\n try {\n window.localStorage.setItem(\"test\", \"test\");\n window.localStorage.removeItem(\"test\");\n return true;\n } catch (_error) {\n e = _error;\n return false;\n }\n};\n\nexports.compileDocumentSelector = compileDocumentSelector;\n\nexports.autoselectLocalDb = function(options, success, error) {\n var IndexedDb, LocalStorageDb, MemoryDb, WebSQLDb, browser;\n IndexedDb = require('./IndexedDb');\n WebSQLDb = require('./WebSQLDb');\n LocalStorageDb = require('./LocalStorageDb');\n MemoryDb = require('./MemoryDb');\n browser = bowser.browser;\n if (!isLocalStorageSupported()) {\n return new MemoryDb(options, success);\n }\n if (window.cordova) {\n console.log(\"Selecting WebSQLDb for Cordova\");\n return new WebSQLDb(options, success, error);\n }\n if (browser.android || browser.ios || browser.chrome || browser.safari || browser.opera || browser.blackberry) {\n console.log(\"Selecting WebSQLDb for browser\");\n return new WebSQLDb(options, success, (function(_this) {\n return function(err) {\n console.log(\"Failed to create WebSQLDb: \" + (err ? err.message : void 0));\n return new IndexedDb(options, success, function(err) {\n console.log(\"Failed to create IndexedDb: \" + (err ? err.message : void 0));\n return new MemoryDb(options, success);\n });\n };\n })(this));\n }\n if (browser.firefox && browser.version >= 16) {\n console.log(\"Selecting IndexedDb for browser\");\n return new IndexedDb(options, success, (function(_this) {\n return function(err) {\n console.log(\"Failed to create IndexedDb: \" + (err ? err.message : void 0));\n return new MemoryDb(options, success);\n };\n })(this));\n }\n console.log(\"Selecting LocalStorageDb for fallback\");\n return new LocalStorageDb(options, success, error);\n};\n\nexports.migrateLocalDb = function(fromDb, toDb, success, error) {\n var HybridDb, col, hybridDb, name, _ref;\n HybridDb = require('./HybridDb');\n hybridDb = new HybridDb(fromDb, toDb);\n _ref = fromDb.collections;\n for (name in _ref) {\n col = _ref[name];\n if (toDb[name]) {\n hybridDb.addCollection(name);\n }\n }\n return hybridDb.upload(success, error);\n};\n\nexports.cloneLocalDb = function(fromDb, toDb, success, error) {\n var col, name, _ref;\n _ref = fromDb.collections;\n for (name in _ref) {\n col = _ref[name];\n if (!toDb[name]) {\n toDb.addCollection(name);\n }\n }\n return async.each(_.values(fromDb.collections), (function(_this) {\n return function(fromCol, cb) {\n var toCol;\n toCol = toDb[fromCol.name];\n return fromCol.find({}).fetch(function(items) {\n return toCol.seed(items, function() {\n return fromCol.pendingUpserts(function(upserts) {\n return toCol.upsert(_.pluck(upserts, \"doc\"), _.pluck(upserts, \"base\"), function() {\n return fromCol.pendingRemoves(function(removes) {\n return async.eachSeries(removes, function(remove, cb2) {\n return toCol.remove(remove, function() {\n return cb2();\n }, cb2);\n }, cb);\n }, cb);\n }, cb);\n }, cb);\n }, cb);\n }, cb);\n };\n })(this), (function(_this) {\n return function(err) {\n if (err) {\n return error(err);\n }\n return success();\n };\n })(this));\n};\n\nexports.processFind = function(items, selector, options) {\n var filtered;\n filtered = _.filter(items, compileDocumentSelector(selector));\n filtered = processNearOperator(selector, filtered);\n filtered = processGeoIntersectsOperator(selector, filtered);\n if (options && options.sort) {\n filtered.sort(compileSort(options.sort));\n }\n if (options && options.skip) {\n filtered = _.slice(filtered, options.skip);\n }\n if (options && options.limit) {\n filtered = _.take(filtered, options.limit);\n }\n if (options && options.fields) {\n filtered = exports.filterFields(filtered, options.fields);\n }\n return filtered;\n};\n\nexports.filterFields = function(items, fields) {\n if (fields == null) {\n fields = {};\n }\n if (_.keys(fields).length === 0) {\n return items;\n }\n return _.map(items, function(item) {\n var field, from, newItem, obj, path, pathElem, to, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3;\n newItem = {};\n if (_.first(_.values(fields)) === 1) {\n _ref = _.keys(fields).concat([\"_id\"]);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n field = _ref[_i];\n path = field.split(\".\");\n obj = item;\n for (_j = 0, _len1 = path.length; _j < _len1; _j++) {\n pathElem = path[_j];\n if (obj) {\n obj = obj[pathElem];\n }\n }\n if (obj == null) {\n continue;\n }\n from = item;\n to = newItem;\n _ref1 = _.initial(path);\n for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {\n pathElem = _ref1[_k];\n to[pathElem] = to[pathElem] || {};\n to = to[pathElem];\n from = from[pathElem];\n }\n to[_.last(path)] = from[_.last(path)];\n }\n return newItem;\n } else {\n item = _.cloneDeep(item);\n _ref2 = _.keys(fields);\n for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {\n field = _ref2[_l];\n path = field.split(\".\");\n obj = item;\n _ref3 = _.initial(path);\n for (_m = 0, _len4 = _ref3.length; _m < _len4; _m++) {\n pathElem = _ref3[_m];\n if (obj) {\n obj = obj[pathElem];\n }\n }\n if (obj == null) {\n continue;\n }\n delete obj[_.last(path)];\n }\n return item;\n }\n });\n};\n\nexports.createUid = function() {\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r, v;\n r = Math.random() * 16 | 0;\n v = c === 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n};\n\nprocessNearOperator = function(selector, list) {\n var distances, geo, key, value;\n for (key in selector) {\n value = selector[key];\n if ((value != null) && value['$near']) {\n geo = value['$near']['$geometry'];\n if (geo.type !== 'Point') {\n break;\n }\n list = _.filter(list, function(doc) {\n return doc[key] && doc[key].type === 'Point';\n });\n distances = _.map(list, function(doc) {\n return {\n doc: doc,\n distance: getDistanceFromLatLngInM(geo.coordinates[1], geo.coordinates[0], doc[key].coordinates[1], doc[key].coordinates[0])\n };\n });\n distances = _.filter(distances, function(item) {\n return item.distance >= 0;\n });\n distances = _.sortBy(distances, 'distance');\n if (value['$near']['$maxDistance']) {\n distances = _.filter(distances, function(item) {\n return item.distance <= value['$near']['$maxDistance'];\n });\n }\n list = _.pluck(distances, 'doc');\n }\n }\n return list;\n};\n\npointInPolygon = function(point, polygon) {\n if (!_.isEqual(_.first(polygon.coordinates[0]), _.last(polygon.coordinates[0]))) {\n throw new Error(\"First must equal last\");\n }\n if (point.coordinates[0] < Math.min.apply(this, _.map(polygon.coordinates[0], function(coord) {\n return coord[0];\n }))) {\n return false;\n }\n if (point.coordinates[1] < Math.min.apply(this, _.map(polygon.coordinates[0], function(coord) {\n return coord[1];\n }))) {\n return false;\n }\n if (point.coordinates[0] > Math.max.apply(this, _.map(polygon.coordinates[0], function(coord) {\n return coord[0];\n }))) {\n return false;\n }\n if (point.coordinates[1] > Math.max.apply(this, _.map(polygon.coordinates[0], function(coord) {\n return coord[1];\n }))) {\n return false;\n }\n return true;\n};\n\ngetDistanceFromLatLngInM = function(lat1, lng1, lat2, lng2) {\n var R, a, c, d, dLat, dLng;\n R = 6370986;\n dLat = deg2rad(lat2 - lat1);\n dLng = deg2rad(lng2 - lng1);\n a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLng / 2) * Math.sin(dLng / 2);\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n d = R * c;\n return d;\n};\n\ndeg2rad = function(deg) {\n return deg * (Math.PI / 180);\n};\n\nprocessGeoIntersectsOperator = function(selector, list) {\n var geo, key, value;\n for (key in selector) {\n value = selector[key];\n if ((value != null) && value['$geoIntersects']) {\n geo = value['$geoIntersects']['$geometry'];\n if (geo.type !== 'Polygon') {\n break;\n }\n list = _.filter(list, function(doc) {\n if (!doc[key] || doc[key].type !== 'Point') {\n return false;\n }\n return pointInPolygon(doc[key], geo);\n });\n }\n }\n return list;\n};\n\nexports.regularizeUpsert = function(docs, bases, success, error) {\n var item, items, _i, _len, _ref;\n if (_.isFunction(bases)) {\n _ref = [void 0, bases, success], bases = _ref[0], success = _ref[1], error = _ref[2];\n }\n if (!_.isArray(docs)) {\n docs = [docs];\n bases = [bases];\n } else {\n bases = bases || [];\n }\n items = _.map(docs, function(doc, i) {\n return {\n doc: doc,\n base: i < bases.length ? bases[i] : void 0\n };\n });\n for (_i = 0, _len = items.length; _i < _len; _i++) {\n item = items[_i];\n if (!item.doc._id) {\n item.doc._id = exports.createUid();\n }\n if (item.base && !item.base._id) {\n throw new Error(\"Base needs _id\");\n }\n if (item.base && item.base._id !== item.doc._id) {\n throw new Error(\"Base needs same _id\");\n }\n }\n return [items, success, error];\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 0\n// module chunks = 0","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 1\n// module chunks = 0","/*\n========================================\nMeteor is licensed under the MIT License\n========================================\n\nCopyright (C) 2011--2012 Meteor Development Group\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n====================================================================\nThis license applies to all code in Meteor that is not an externally\nmaintained library. Externally maintained libraries have their own\nlicenses, included below:\n====================================================================\n\n*/\n\nLocalCollection = {};\nEJSON = require(\"./EJSON\");\nvar _ = require('lodash');\n\n\n// Like _.isArray, but doesn't regard polyfilled Uint8Arrays on old browsers as\n// arrays.\nvar isArray = function (x) {\n return _.isArray(x) && !EJSON.isBinary(x);\n};\n\nvar _anyIfArray = function (x, f) {\n if (isArray(x))\n return _.any(x, f);\n return f(x);\n};\n\nvar _anyIfArrayPlus = function (x, f) {\n if (f(x))\n return true;\n return isArray(x) && _.any(x, f);\n};\n\nvar hasOperators = function(valueSelector) {\n var theseAreOperators = undefined;\n for (var selKey in valueSelector) {\n var thisIsOperator = selKey.substr(0, 1) === '$';\n if (theseAreOperators === undefined) {\n theseAreOperators = thisIsOperator;\n } else if (theseAreOperators !== thisIsOperator) {\n throw new Error(\"Inconsistent selector: \" + valueSelector);\n }\n }\n return !!theseAreOperators; // {} has no operators\n};\n\nvar compileValueSelector = function (valueSelector) {\n if (valueSelector == null) { // undefined or null\n return function (value) {\n return _anyIfArray(value, function (x) {\n return x == null; // undefined or null\n });\n };\n }\n\n // Selector is a non-null primitive (and not an array or RegExp either).\n if (!_.isObject(valueSelector)) {\n return function (value) {\n return _anyIfArray(value, function (x) {\n return x === valueSelector;\n });\n };\n }\n\n if (valueSelector instanceof RegExp) {\n return function (value) {\n if (value === undefined)\n return false;\n return _anyIfArray(value, function (x) {\n return valueSelector.test(x);\n });\n };\n }\n\n // Arrays match either identical arrays or arrays that contain it as a value.\n if (isArray(valueSelector)) {\n return function (value) {\n if (!isArray(value))\n return false;\n return _anyIfArrayPlus(value, function (x) {\n return LocalCollection._f._equal(valueSelector, x);\n });\n };\n }\n\n // It's an object, but not an array or regexp.\n if (hasOperators(valueSelector)) {\n var operatorFunctions = [];\n _.each(valueSelector, function (operand, operator) {\n if (!_.has(VALUE_OPERATORS, operator))\n throw new Error(\"Unrecognized operator: \" + operator);\n operatorFunctions.push(VALUE_OPERATORS[operator](\n operand, valueSelector.$options));\n });\n return function (value) {\n return _.all(operatorFunctions, function (f) {\n return f(value);\n });\n };\n }\n\n // It's a literal; compare value (or element of value array) directly to the\n // selector.\n return function (value) {\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._equal(valueSelector, x);\n });\n };\n};\n\n// XXX can factor out common logic below\nvar LOGICAL_OPERATORS = {\n \"$and\": function(subSelector) {\n if (!isArray(subSelector) || _.isEmpty(subSelector))\n throw Error(\"$and/$or/$nor must be nonempty array\");\n var subSelectorFunctions = _.map(\n subSelector, compileDocumentSelector);\n return function (doc) {\n return _.all(subSelectorFunctions, function (f) {\n return f(doc);\n });\n };\n },\n\n \"$or\": function(subSelector) {\n if (!isArray(subSelector) || _.isEmpty(subSelector))\n throw Error(\"$and/$or/$nor must be nonempty array\");\n var subSelectorFunctions = _.map(\n subSelector, compileDocumentSelector);\n return function (doc) {\n return _.any(subSelectorFunctions, function (f) {\n return f(doc);\n });\n };\n },\n\n \"$nor\": function(subSelector) {\n if (!isArray(subSelector) || _.isEmpty(subSelector))\n throw Error(\"$and/$or/$nor must be nonempty array\");\n var subSelectorFunctions = _.map(\n subSelector, compileDocumentSelector);\n return function (doc) {\n return _.all(subSelectorFunctions, function (f) {\n return !f(doc);\n });\n };\n },\n\n \"$where\": function(selectorValue) {\n if (!(selectorValue instanceof Function)) {\n selectorValue = Function(\"return \" + selectorValue);\n }\n return function (doc) {\n return selectorValue.call(doc);\n };\n }\n};\n\nvar VALUE_OPERATORS = {\n \"$in\": function (operand) {\n if (!isArray(operand))\n throw new Error(\"Argument to $in must be array\");\n\n // Create index if all strings\n var index = null;\n if (_.all(operand, _.isString))\n index = _.indexBy(operand);\n\n return function (value) {\n return _anyIfArrayPlus(value, function (x) {\n if (_.isString(x) && index !== null)\n return index[x] != undefined;\n \n return _.any(operand, function (operandElt) {\n return LocalCollection._f._equal(operandElt, x);\n });\n });\n };\n },\n\n \"$all\": function (operand) {\n if (!isArray(operand))\n throw new Error(\"Argument to $all must be array\");\n return function (value) {\n if (!isArray(value))\n return false;\n return _.all(operand, function (operandElt) {\n return _.any(value, function (valueElt) {\n return LocalCollection._f._equal(operandElt, valueElt);\n });\n });\n };\n },\n\n \"$lt\": function (operand) {\n return function (value) {\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._cmp(x, operand) < 0;\n });\n };\n },\n\n \"$lte\": function (operand) {\n return function (value) {\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._cmp(x, operand) <= 0;\n });\n };\n },\n\n \"$gt\": function (operand) {\n return function (value) {\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._cmp(x, operand) > 0;\n });\n };\n },\n\n \"$gte\": function (operand) {\n return function (value) {\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._cmp(x, operand) >= 0;\n });\n };\n },\n\n \"$ne\": function (operand) {\n return function (value) {\n return ! _anyIfArrayPlus(value, function (x) {\n return LocalCollection._f._equal(x, operand);\n });\n };\n },\n\n \"$nin\": function (operand) {\n if (!isArray(operand))\n throw new Error(\"Argument to $nin must be array\");\n var inFunction = VALUE_OPERATORS.$in(operand);\n return function (value) {\n // Field doesn't exist, so it's not-in operand\n if (value === undefined)\n return true;\n return !inFunction(value);\n };\n },\n\n \"$exists\": function (operand) {\n return function (value) {\n return operand === (value !== undefined);\n };\n },\n\n \"$mod\": function (operand) {\n var divisor = operand[0],\n remainder = operand[1];\n return function (value) {\n return _anyIfArray(value, function (x) {\n return x % divisor === remainder;\n });\n };\n },\n\n \"$size\": function (operand) {\n return function (value) {\n return isArray(value) && operand === value.length;\n };\n },\n\n \"$type\": function (operand) {\n return function (value) {\n // A nonexistent field is of no type.\n if (value === undefined)\n return false;\n // Definitely not _anyIfArrayPlus: $type: 4 only matches arrays that have\n // arrays as elements according to the Mongo docs.\n return _anyIfArray(value, function (x) {\n return LocalCollection._f._type(x) === operand;\n });\n };\n },\n\n \"$regex\": function (operand, options) {\n if (options !== undefined) {\n // Options passed in $options (even the empty string) always overrides\n // options in the RegExp object itself.\n\n // Be clear that we only support the JS-supported options, not extended\n // ones (eg, Mongo supports x and s). Ideally we would implement x and s\n // by transforming the regexp, but not today...\n if (/[^gim]/.test(options))\n throw new Error(\"Only the i, m, and g regexp options are supported\");\n\n var regexSource = operand instanceof RegExp ? operand.source : operand;\n operand = new RegExp(regexSource, options);\n } else if (!(operand instanceof RegExp)) {\n operand = new RegExp(operand);\n }\n\n return function (value) {\n if (value === undefined)\n return false;\n return _anyIfArray(value, function (x) {\n return operand.test(x);\n });\n };\n },\n\n \"$options\": function (operand) {\n // evaluation happens at the $regex function above\n return function (value) { return true; };\n },\n\n \"$elemMatch\": function (operand) {\n var matcher = compileDocumentSelector(operand);\n return function (value) {\n if (!isArray(value))\n return false;\n return _.any(value, function (x) {\n return matcher(x);\n });\n };\n },\n\n \"$not\": function (operand) {\n var matcher = compileValueSelector(operand);\n return function (value) {\n return !matcher(value);\n };\n },\n\n \"$near\": function (operand) {\n // Always returns true. Must be handled in post-filter/sort/limit\n return function (value) {\n return true;\n }\n },\n\n \"$geoIntersects\": function (operand) {\n // Always returns true. Must be handled in post-filter/sort/limit\n return function (value) {\n return true;\n }\n }\n\n};\n\n// helpers used by compiled selector code\nLocalCollection._f = {\n // XXX for _all and _in, consider building 'inquery' at compile time..\n\n _type: function (v) {\n if (typeof v === \"number\")\n return 1;\n if (typeof v === \"string\")\n return 2;\n if (typeof v === \"boolean\")\n return 8;\n if (isArray(v))\n return 4;\n if (v === null)\n return 10;\n if (v instanceof RegExp)\n return 11;\n if (typeof v === \"function\")\n // note that typeof(/x/) === \"function\"\n return 13;\n if (v instanceof Date)\n return 9;\n if (EJSON.isBinary(v))\n return 5;\n if (v instanceof Meteor.Collection.ObjectID)\n return 7;\n return 3; // object\n\n // XXX support some/all of these:\n // 14, symbol\n // 15, javascript code with scope\n // 16, 18: 32-bit/64-bit integer\n // 17, timestamp\n // 255, minkey\n // 127, maxkey\n },\n\n // deep equality test: use for literal document and array matches\n _equal: function (a, b) {\n return EJSON.equals(a, b, {keyOrderSensitive: true});\n },\n\n // maps a type code to a value that can be used to sort values of\n // different types\n _typeorder: function (t) {\n // http://www.mongodb.org/display/DOCS/What+is+the+Compare+Order+for+BSON+Types\n // XXX what is the correct sort position for Javascript code?\n // ('100' in the matrix below)\n // XXX minkey/maxkey\n return [-1, // (not a type)\n 1, // number\n 2, // string\n 3, // object\n 4, // array\n 5, // binary\n -1, // deprecated\n 6, // ObjectID\n 7, // bool\n 8, // Date\n 0, // null\n 9, // RegExp\n -1, // deprecated\n 100, // JS code\n 2, // deprecated (symbol)\n 100, // JS code\n 1, // 32-bit int\n 8, // Mongo timestamp\n 1 // 64-bit int\n ][t];\n },\n\n // compare two values of unknown type according to BSON ordering\n // semantics. (as an extension, consider 'undefined' to be less than\n // any other value.) return negative if a is less, positive if b is\n // less, or 0 if equal\n _cmp: function (a, b) {\n if (a === undefined)\n return b === undefined ? 0 : -1;\n if (b === undefined)\n return 1;\n var ta = LocalCollection._f._type(a);\n var tb = LocalCollection._f._type(b);\n var oa = LocalCollection._f._typeorder(ta);\n var ob = LocalCollection._f._typeorder(tb);\n if (oa !== ob)\n return oa < ob ? -1 : 1;\n if (ta !== tb)\n // XXX need to implement this if we implement Symbol or integers, or\n // Timestamp\n throw Error(\"Missing type coercion logic in _cmp\");\n if (ta === 7) { // ObjectID\n // Convert to string.\n ta = tb = 2;\n a = a.toHexString();\n b = b.toHexString();\n }\n if (ta === 9) { // Date\n // Convert to millis.\n ta = tb = 1;\n a = a.getTime();\n b = b.getTime();\n }\n\n if (ta === 1) // double\n return a - b;\n if (tb === 2) // string\n return a < b ? -1 : (a === b ? 0 : 1);\n if (ta === 3) { // Object\n // this could be much more efficient in the expected case ...\n var to_array = function (obj) {\n var ret = [];\n for (var key in obj) {\n ret.push(key);\n ret.push(obj[key]);\n }\n return ret;\n };\n return LocalCollection._f._cmp(to_array(a), to_array(b));\n }\n if (ta === 4) { // Array\n for (var i = 0; ; i++) {\n if (i === a.length)\n return (i === b.length) ? 0 : -1;\n if (i === b.length)\n return 1;\n var s = LocalCollection._f._cmp(a[i], b[i]);\n if (s !== 0)\n return s;\n }\n }\n if (ta === 5) { // binary\n // Surprisingly, a small binary blob is always less than a large one in\n // Mongo.\n if (a.length !== b.length)\n return a.length - b.length;\n for (i = 0; i < a.length; i++) {\n if (a[i] < b[i])\n return -1;\n if (a[i] > b[i])\n return 1;\n }\n return 0;\n }\n if (ta === 8) { // boolean\n if (a) return b ? 0 : 1;\n return b ? -1 : 0;\n }\n if (ta === 10) // null\n return 0;\n if (ta === 11) // regexp\n throw Error(\"Sorting not supported on regular expression\"); // XXX\n // 13: javascript code\n // 14: symbol\n // 15: javascript code with scope\n // 16: 32-bit integer\n // 17: timestamp\n // 18: 64-bit integer\n // 255: minkey\n // 127: maxkey\n if (ta === 13) // javascript code\n throw Error(\"Sorting not supported on Javascript code\"); // XXX\n throw Error(\"Unknown type to sort\");\n }\n};\n\n// For unit tests. True if the given document matches the given\n// selector.\nLocalCollection._matches = function (selector, doc) {\n return (LocalCollection._compileSelector(selector))(doc);\n};\n\n// _makeLookupFunction(key) returns a lookup function.\n//\n// A lookup function takes in a document and returns an array of matching\n// values. This array has more than one element if any segment of the key other\n// than the last one is an array. ie, any arrays found when doing non-final\n// lookups result in this function \"branching\"; each element in the returned\n// array represents the value found at this branch. If any branch doesn't have a\n// final value for the full key, its element in the returned list will be\n// undefined. It always returns a non-empty array.\n//\n// _makeLookupFunction('a.x')({a: {x: 1}}) returns [1]\n// _makeLookupFunction('a.x')({a: {x: [1]}}) returns [[1]]\n// _makeLookupFunction('a.x')({a: 5}) returns [undefined]\n// _makeLookupFunction('a.x')({a: [{x: 1},\n// {x: [2]},\n// {y: 3}]})\n// returns [1, [2], undefined]\nLocalCollection._makeLookupFunction = function (key) {\n var dotLocation = key.indexOf('.');\n var first, lookupRest, nextIsNumeric;\n if (dotLocation === -1) {\n first = key;\n } else {\n first = key.substr(0, dotLocation);\n var rest = key.substr(dotLocation + 1);\n lookupRest = LocalCollection._makeLookupFunction(rest);\n // Is the next (perhaps final) piece numeric (ie, an array lookup?)\n nextIsNumeric = /^\\d+(\\.|$)/.test(rest);\n }\n\n return function (doc) {\n if (doc == null) // null or undefined\n return [undefined];\n var firstLevel = doc[first];\n\n // We don't \"branch\" at the final level.\n if (!lookupRest)\n return [firstLevel];\n\n // It's an empty array, and we're not done: we won't find anything.\n if (isArray(firstLevel) && firstLevel.length === 0)\n return [undefined];\n\n // For each result at this level, finish the lookup on the rest of the key,\n // and return everything we find. Also, if the next result is a number,\n // don't branch here.\n //\n // Technically, in MongoDB, we should be able to handle the case where\n // objects have numeric keys, but Mongo doesn't actually handle this\n // consistently yet itself, see eg\n // https://jira.mongodb.org/browse/SERVER-2898\n // https://github.com/mongodb/mongo/blob/master/jstests/array_match2.js\n if (!isArray(firstLevel) || nextIsNumeric)\n firstLevel = [firstLevel];\n return Array.prototype.concat.apply([], _.map(firstLevel, lookupRest));\n };\n};\n\n// The main compilation function for a given selector.\nvar compileDocumentSelector = function (docSelector) {\n var perKeySelectors = [];\n _.each(docSelector, function (subSelector, key) {\n if (key.substr(0, 1) === '$') {\n // Outer operators are either logical operators (they recurse back into\n // this function), or $where.\n if (!_.has(LOGICAL_OPERATORS, key))\n throw new Error(\"Unrecognized logical operator: \" + key);\n perKeySelectors.push(LOGICAL_OPERATORS[key](subSelector));\n } else {\n var lookUpByIndex = LocalCollection._makeLookupFunction(key);\n var valueSelectorFunc = compileValueSelector(subSelector);\n perKeySelectors.push(function (doc) {\n var branchValues = lookUpByIndex(doc);\n // We apply the selector to each \"branched\" value and return true if any\n // match. This isn't 100% consistent with MongoDB; eg, see:\n // https://jira.mongodb.org/browse/SERVER-8585\n return _.any(branchValues, valueSelectorFunc);\n });\n }\n });\n\n\n return function (doc) {\n return _.all(perKeySelectors, function (f) {\n return f(doc);\n });\n };\n};\n\n// Given a selector, return a function that takes one argument, a\n// document, and returns true if the document matches the selector,\n// else false.\nLocalCollection._compileSelector = function (selector) {\n // you can pass a literal function instead of a selector\n if (selector instanceof Function)\n return function (doc) {return selector.call(doc);};\n\n // shorthand -- scalars match _id\n if (LocalCollection._selectorIsId(selector)) {\n return function (doc) {\n return EJSON.equals(doc._id, selector);\n };\n }\n\n // protect against dangerous selectors. falsey and {_id: falsey} are both\n // likely programmer error, and not what you want, particularly for\n // destructive operations.\n if (!selector || (('_id' in selector) && !selector._id))\n return function (doc) {return false;};\n\n // Top level can't be an array or true or binary.\n if (typeof(selector) === 'boolean' || isArray(selector) ||\n EJSON.isBinary(selector))\n throw new Error(\"Invalid selector: \" + selector);\n\n return compileDocumentSelector(selector);\n};\n\n// Give a sort spec, which can be in any of these forms:\n// {\"key1\": 1, \"key2\": -1}\n// [[\"key1\", \"asc\"], [\"key2\", \"desc\"]]\n// [\"key1\", [\"key2\", \"desc\"]]\n//\n// (.. with the first form being dependent on the key enumeration\n// behavior of your javascript VM, which usually does what you mean in\n// this case if the key names don't look like integers ..)\n//\n// return a function that takes two objects, and returns -1 if the\n// first object comes first in order, 1 if the second object comes\n// first, or 0 if neither object comes before the other.\n\nLocalCollection._compileSort = function (spec) {\n var sortSpecParts = [];\n\n if (spec instanceof Array) {\n for (var i = 0; i < spec.length; i++) {\n if (typeof spec[i] === \"string\") {\n sortSpecParts.push({\n lookup: LocalCollection._makeLookupFunction(spec[i]),\n ascending: true\n });\n } else {\n sortSpecParts.push({\n lookup: LocalCollection._makeLookupFunction(spec[i][0]),\n ascending: spec[i][1] !== \"desc\"\n });\n }\n }\n } else if (typeof spec === \"object\") {\n for (var key in spec) {\n sortSpecParts.push({\n lookup: LocalCollection._makeLookupFunction(key),\n ascending: spec[key] >= 0\n });\n }\n } else {\n throw Error(\"Bad sort specification: \", JSON.stringify(spec));\n }\n\n if (sortSpecParts.length === 0)\n return function () {return 0;};\n\n // reduceValue takes in all the possible values for the sort key along various\n // branches, and returns the min or max value (according to the bool\n // findMin). Each value can itself be an array, and we look at its values\n // too. (ie, we do a single level of flattening on branchValues, then find the\n // min/max.)\n var reduceValue = function (branchValues, findMin) {\n var reduced;\n var first = true;\n // Iterate over all the values found in all the branches, and if a value is\n // an array itself, iterate over the values in the array separately.\n _.each(branchValues, function (branchValue) {\n // Value not an array? Pretend it is.\n if (!isArray(branchValue))\n branchValue = [branchValue];\n // Value is an empty array? Pretend it was missing, since that's where it\n // should be sorted.\n if (isArray(branchValue) && branchValue.length === 0)\n branchValue = [undefined];\n _.each(branchValue, function (value) {\n // We should get here at least once: lookup functions return non-empty\n // arrays, so the outer loop runs at least once, and we prevented\n // branchValue from being an empty array.\n if (first) {\n reduced = value;\n first = false;\n } else {\n // Compare the value we found to the value we found so far, saving it\n // if it's less (for an ascending sort) or more (for a descending\n // sort).\n var cmp = LocalCollection._f._cmp(reduced, value);\n if ((findMin && cmp > 0) || (!findMin && cmp < 0))\n reduced = value;\n }\n });\n });\n return reduced;\n };\n\n return function (a, b) {\n for (var i = 0; i < sortSpecParts.length; ++i) {\n var specPart = sortSpecParts[i];\n var aValue = reduceValue(specPart.lookup(a), specPart.ascending);\n var bValue = reduceValue(specPart.lookup(b), specPart.ascending);\n var compare = LocalCollection._f._cmp(aValue, bValue);\n if (compare !== 0)\n return specPart.ascending ? compare : -compare;\n };\n return 0;\n };\n};\n\nexports.compileDocumentSelector = compileDocumentSelector;\nexports.compileSort = LocalCollection._compileSort;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/selector.js\n// module id = 2\n// module chunks = 0","/*!\n * async\n * https://github.com/caolan/async\n *\n * Copyright 2010-2014 Caolan McMahon\n * Released under the MIT license\n */\n(function () {\n\n var async = {};\n function noop() {}\n function identity(v) {\n return v;\n }\n function toBool(v) {\n return !!v;\n }\n function notId(v) {\n return !v;\n }\n\n // global on the server, window in the browser\n var previous_async;\n\n // Establish the root object, `window` (`self`) in the browser, `global`\n // on the server, or `this` in some virtual machines. We use `self`\n // instead of `window` for `WebWorker` support.\n var root = typeof self === 'object' && self.self === self && self ||\n typeof global === 'object' && global.global === global && global ||\n this;\n\n if (root != null) {\n previous_async = root.async;\n }\n\n async.noConflict = function () {\n root.async = previous_async;\n return async;\n };\n\n function only_once(fn) {\n return function() {\n if (fn === null) throw new Error(\"Callback was already called.\");\n fn.apply(this, arguments);\n fn = null;\n };\n }\n\n function _once(fn) {\n return function() {\n if (fn === null) return;\n fn.apply(this, arguments);\n fn = null;\n };\n }\n\n //// cross-browser compatiblity functions ////\n\n var _toString = Object.prototype.toString;\n\n var _isArray = Array.isArray || function (obj) {\n return _toString.call(obj) === '[object Array]';\n };\n\n // Ported from underscore.js isObject\n var _isObject = function(obj) {\n var type = typeof obj;\n return type === 'function' || type === 'object' && !!obj;\n };\n\n function _isArrayLike(arr) {\n return _isArray(arr) || (\n // has a positive integer length property\n typeof arr.length === \"number\" &&\n arr.length >= 0 &&\n arr.length % 1 === 0\n );\n }\n\n function _arrayEach(arr, iterator) {\n var index = -1,\n length = arr.length;\n\n while (++index < length) {\n iterator(arr[index], index, arr);\n }\n }\n\n function _map(arr, iterator) {\n var index = -1,\n length = arr.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iterator(arr[index], index, arr);\n }\n return result;\n }\n\n function _range(count) {\n return _map(Array(count), function (v, i) { return i; });\n }\n\n function _reduce(arr, iterator, memo) {\n _arrayEach(arr, function (x, i, a) {\n memo = iterator(memo, x, i, a);\n });\n return memo;\n }\n\n function _forEachOf(object, iterator) {\n _arrayEach(_keys(object), function (key) {\n iterator(object[key], key);\n });\n }\n\n function _indexOf(arr, item) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === item) return i;\n }\n return -1;\n }\n\n var _keys = Object.keys || function (obj) {\n var keys = [];\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n keys.push(k);\n }\n }\n return keys;\n };\n\n function _keyIterator(coll) {\n var i = -1;\n var len;\n var keys;\n if (_isArrayLike(coll)) {\n len = coll.length;\n return function next() {\n i++;\n return i < len ? i : null;\n };\n } else {\n keys = _keys(coll);\n len = keys.length;\n return function next() {\n i++;\n return i < len ? keys[i] : null;\n };\n }\n }\n\n // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html)\n // This accumulates the arguments passed into an array, after a given index.\n // From underscore.js (https://github.com/jashkenas/underscore/pull/2140).\n function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }\n\n function _withoutIndex(iterator) {\n return function (value, index, callback) {\n return iterator(value, callback);\n };\n }\n\n //// exported async module functions ////\n\n //// nextTick implementation with browser-compatible fallback ////\n\n // capture the global reference to guard against fakeTimer mocks\n var _setImmediate = typeof setImmediate === 'function' && setImmediate;\n\n var _delay = _setImmediate ? function(fn) {\n // not a direct alias for IE10 compatibility\n _setImmediate(fn);\n } : function(fn) {\n setTimeout(fn, 0);\n };\n\n if (typeof process === 'object' && typeof process.nextTick === 'function') {\n async.nextTick = process.nextTick;\n } else {\n async.nextTick = _delay;\n }\n async.setImmediate = _setImmediate ? _delay : async.nextTick;\n\n\n async.forEach =\n async.each = function (arr, iterator, callback) {\n return async.eachOf(arr, _withoutIndex(iterator), callback);\n };\n\n async.forEachSeries =\n async.eachSeries = function (arr, iterator, callback) {\n return async.eachOfSeries(arr, _withoutIndex(iterator), callback);\n };\n\n\n async.forEachLimit =\n async.eachLimit = function (arr, limit, iterator, callback) {\n return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback);\n };\n\n async.forEachOf =\n async.eachOf = function (object, iterator, callback) {\n callback = _once(callback || noop);\n object = object || [];\n\n var iter = _keyIterator(object);\n var key, completed = 0;\n\n while ((key = iter()) != null) {\n completed += 1;\n iterator(object[key], key, only_once(done));\n }\n\n if (completed === 0) callback(null);\n\n function done(err) {\n completed--;\n if (err) {\n callback(err);\n }\n // Check key is null in case iterator isn't exhausted\n // and done resolved synchronously.\n else if (key === null && completed <= 0) {\n callback(null);\n }\n }\n };\n\n async.forEachOfSeries =\n async.eachOfSeries = function (obj, iterator, callback) {\n callback = _once(callback || noop);\n obj = obj || [];\n var nextKey = _keyIterator(obj);\n var key = nextKey();\n function iterate() {\n var sync = true;\n if (key === null) {\n return callback(null);\n }\n iterator(obj[key], key, only_once(function (err) {\n if (err) {\n callback(err);\n }\n else {\n key = nextKey();\n if (key === null) {\n return callback(null);\n } else {\n if (sync) {\n async.setImmediate(iterate);\n } else {\n iterate();\n }\n }\n }\n }));\n sync = false;\n }\n iterate();\n };\n\n\n\n async.forEachOfLimit =\n async.eachOfLimit = function (obj, limit, iterator, callback) {\n _eachOfLimit(limit)(obj, iterator, callback);\n };\n\n function _eachOfLimit(limit) {\n\n return function (obj, iterator, callback) {\n callback = _once(callback || noop);\n obj = obj || [];\n var nextKey = _keyIterator(obj);\n if (limit <= 0) {\n return callback(null);\n }\n var done = false;\n var running = 0;\n var errored = false;\n\n (function replenish () {\n if (done && running <= 0) {\n return callback(null);\n }\n\n while (running < limit && !errored) {\n var key = nextKey();\n if (key === null) {\n done = true;\n if (running <= 0) {\n callback(null);\n }\n return;\n }\n running += 1;\n iterator(obj[key], key, only_once(function (err) {\n running -= 1;\n if (err) {\n callback(err);\n errored = true;\n }\n else {\n replenish();\n }\n }));\n }\n })();\n };\n }\n\n\n function doParallel(fn) {\n return function (obj, iterator, callback) {\n return fn(async.eachOf, obj, iterator, callback);\n };\n }\n function doParallelLimit(fn) {\n return function (obj, limit, iterator, callback) {\n return fn(_eachOfLimit(limit), obj, iterator, callback);\n };\n }\n function doSeries(fn) {\n return function (obj, iterator, callback) {\n return fn(async.eachOfSeries, obj, iterator, callback);\n };\n }\n\n function _asyncMap(eachfn, arr, iterator, callback) {\n callback = _once(callback || noop);\n arr = arr || [];\n var results = _isArrayLike(arr) ? [] : {};\n eachfn(arr, function (value, index, callback) {\n iterator(value, function (err, v) {\n results[index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n\n async.map = doParallel(_asyncMap);\n async.mapSeries = doSeries(_asyncMap);\n async.mapLimit = doParallelLimit(_asyncMap);\n\n // reduce only has a series version, as doing reduce in parallel won't\n // work in many situations.\n async.inject =\n async.foldl =\n async.reduce = function (arr, memo, iterator, callback) {\n async.eachOfSeries(arr, function (x, i, callback) {\n iterator(memo, x, function (err, v) {\n memo = v;\n callback(err);\n });\n }, function (err) {\n callback(err, memo);\n });\n };\n\n async.foldr =\n async.reduceRight = function (arr, memo, iterator, callback) {\n var reversed = _map(arr, identity).reverse();\n async.reduce(reversed, memo, iterator, callback);\n };\n\n async.transform = function (arr, memo, iterator, callback) {\n if (arguments.length === 3) {\n callback = iterator;\n iterator = memo;\n memo = _isArray(arr) ? [] : {};\n }\n\n async.eachOf(arr, function(v, k, cb) {\n iterator(memo, v, k, cb);\n }, function(err) {\n callback(err, memo);\n });\n };\n\n function _filter(eachfn, arr, iterator, callback) {\n var results = [];\n eachfn(arr, function (x, index, callback) {\n iterator(x, function (v) {\n if (v) {\n results.push({index: index, value: x});\n }\n callback();\n });\n }, function () {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n }\n\n async.select =\n async.filter = doParallel(_filter);\n\n async.selectLimit =\n async.filterLimit = doParallelLimit(_filter);\n\n async.selectSeries =\n async.filterSeries = doSeries(_filter);\n\n function _reject(eachfn, arr, iterator, callback) {\n _filter(eachfn, arr, function(value, cb) {\n iterator(value, function(v) {\n cb(!v);\n });\n }, callback);\n }\n async.reject = doParallel(_reject);\n async.rejectLimit = doParallelLimit(_reject);\n async.rejectSeries = doSeries(_reject);\n\n function _createTester(eachfn, check, getResult) {\n return function(arr, limit, iterator, cb) {\n function done() {\n if (cb) cb(getResult(false, void 0));\n }\n function iteratee(x, _, callback) {\n if (!cb) return callback();\n iterator(x, function (v) {\n if (cb && check(v)) {\n cb(getResult(true, x));\n cb = iterator = false;\n }\n callback();\n });\n }\n if (arguments.length > 3) {\n eachfn(arr, limit, iteratee, done);\n } else {\n cb = iterator;\n iterator = limit;\n eachfn(arr, iteratee, done);\n }\n };\n }\n\n async.any =\n async.some = _createTester(async.eachOf, toBool, identity);\n\n async.someLimit = _createTester(async.eachOfLimit, toBool, identity);\n\n async.all =\n async.every = _createTester(async.eachOf, notId, notId);\n\n async.everyLimit = _createTester(async.eachOfLimit, notId, notId);\n\n function _findGetResult(v, x) {\n return x;\n }\n async.detect = _createTester(async.eachOf, identity, _findGetResult);\n async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult);\n async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult);\n\n async.sortBy = function (arr, iterator, callback) {\n async.map(arr, function (x, callback) {\n iterator(x, function (err, criteria) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, {value: x, criteria: criteria});\n }\n });\n }, function (err, results) {\n if (err) {\n return callback(err);\n }\n else {\n callback(null, _map(results.sort(comparator), function (x) {\n return x.value;\n }));\n }\n\n });\n\n function comparator(left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n }\n };\n\n async.auto = function (tasks, concurrency, callback) {\n if (typeof arguments[1] === 'function') {\n // concurrency is optional, shift the args.\n callback = concurrency;\n concurrency = null;\n }\n callback = _once(callback || noop);\n var keys = _keys(tasks);\n var remainingTasks = keys.length;\n if (!remainingTasks) {\n return callback(null);\n }\n if (!concurrency) {\n concurrency = remainingTasks;\n }\n\n var results = {};\n var runningTasks = 0;\n\n var hasError = false;\n\n var listeners = [];\n function addListener(fn) {\n listeners.unshift(fn);\n }\n function removeListener(fn) {\n var idx = _indexOf(listeners, fn);\n if (idx >= 0) listeners.splice(idx, 1);\n }\n function taskComplete() {\n remainingTasks--;\n _arrayEach(listeners.slice(0), function (fn) {\n fn();\n });\n }\n\n addListener(function () {\n if (!remainingTasks) {\n callback(null, results);\n }\n });\n\n _arrayEach(keys, function (k) {\n if (hasError) return;\n var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];\n var taskCallback = _restParam(function(err, args) {\n runningTasks--;\n if (args.length <= 1) {\n args = args[0];\n }\n if (err) {\n var safeResults = {};\n _forEachOf(results, function(val, rkey) {\n safeResults[rkey] = val;\n });\n safeResults[k] = args;\n hasError = true;\n\n callback(err, safeResults);\n }\n else {\n results[k] = args;\n async.setImmediate(taskComplete);\n }\n });\n var requires = task.slice(0, task.length - 1);\n // prevent dead-locks\n var len = requires.length;\n var dep;\n while (len--) {\n if (!(dep = tasks[requires[len]])) {\n throw new Error('Has nonexistent dependency in ' + requires.join(', '));\n }\n if (_isArray(dep) && _indexOf(dep, k) >= 0) {\n throw new Error('Has cyclic dependencies');\n }\n }\n function ready() {\n return runningTasks < concurrency && _reduce(requires, function (a, x) {\n return (a && results.hasOwnProperty(x));\n }, true) && !results.hasOwnProperty(k);\n }\n if (ready()) {\n runningTasks++;\n task[task.length - 1](taskCallback, results);\n }\n else {\n addListener(listener);\n }\n function listener() {\n if (ready()) {\n runningTasks++;\n removeListener(listener);\n task[task.length - 1](taskCallback, results);\n }\n }\n });\n };\n\n\n\n async.retry = function(times, task, callback) {\n var DEFAULT_TIMES = 5;\n var DEFAULT_INTERVAL = 0;\n\n var attempts = [];\n\n var opts = {\n times: DEFAULT_TIMES,\n interval: DEFAULT_INTERVAL\n };\n\n function parseTimes(acc, t){\n if(typeof t === 'number'){\n acc.times = parseInt(t, 10) || DEFAULT_TIMES;\n } else if(typeof t === 'object'){\n acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;\n acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;\n } else {\n throw new Error('Unsupported argument type for \\'times\\': ' + typeof t);\n }\n }\n\n var length = arguments.length;\n if (length < 1 || length > 3) {\n throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');\n } else if (length <= 2 && typeof times === 'function') {\n callback = task;\n task = times;\n }\n if (typeof times !== 'function') {\n parseTimes(opts, times);\n }\n opts.callback = callback;\n opts.task = task;\n\n function wrappedTask(wrappedCallback, wrappedResults) {\n function retryAttempt(task, finalAttempt) {\n return function(seriesCallback) {\n task(function(err, result){\n seriesCallback(!err || finalAttempt, {err: err, result: result});\n }, wrappedResults);\n };\n }\n\n function retryInterval(interval){\n return function(seriesCallback){\n setTimeout(function(){\n seriesCallback(null);\n }, interval);\n };\n }\n\n while (opts.times) {\n\n var finalAttempt = !(opts.times-=1);\n attempts.push(retryAttempt(opts.task, finalAttempt));\n if(!finalAttempt && opts.interval > 0){\n attempts.push(retryInterval(opts.interval));\n }\n }\n\n async.series(attempts, function(done, data){\n data = data[data.length - 1];\n (wrappedCallback || opts.callback)(data.err, data.result);\n });\n }\n\n // If a callback is passed, run this as a controll flow\n return opts.callback ? wrappedTask() : wrappedTask;\n };\n\n async.waterfall = function (tasks, callback) {\n callback = _once(callback || noop);\n if (!_isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n function wrapIterator(iterator) {\n return _restParam(function (err, args) {\n if (err) {\n callback.apply(null, [err].concat(args));\n }\n else {\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n ensureAsync(iterator).apply(null, args);\n }\n });\n }\n wrapIterator(async.iterator(tasks))();\n };\n\n function _parallel(eachfn, tasks, callback) {\n callback = callback || noop;\n var results = _isArrayLike(tasks) ? [] : {};\n\n eachfn(tasks, function (task, key, callback) {\n task(_restParam(function (err, args) {\n if (args.length <= 1) {\n args = args[0];\n }\n results[key] = args;\n callback(err);\n }));\n }, function (err) {\n callback(err, results);\n });\n }\n\n async.parallel = function (tasks, callback) {\n _parallel(async.eachOf, tasks, callback);\n };\n\n async.parallelLimit = function(tasks, limit, callback) {\n _parallel(_eachOfLimit(limit), tasks, callback);\n };\n\n async.series = function(tasks, callback) {\n _parallel(async.eachOfSeries, tasks, callback);\n };\n\n async.iterator = function (tasks) {\n function makeCallback(index) {\n function fn() {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n }\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n };\n return fn;\n }\n return makeCallback(0);\n };\n\n async.apply = _restParam(function (fn, args) {\n return _restParam(function (callArgs) {\n return fn.apply(\n null, args.concat(callArgs)\n );\n });\n });\n\n function _concat(eachfn, arr, fn, callback) {\n var result = [];\n eachfn(arr, function (x, index, cb) {\n fn(x, function (err, y) {\n result = result.concat(y || []);\n cb(err);\n });\n }, function (err) {\n callback(err, result);\n });\n }\n async.concat = doParallel(_concat);\n async.concatSeries = doSeries(_concat);\n\n async.whilst = function (test, iterator, callback) {\n callback = callback || noop;\n if (test()) {\n var next = _restParam(function(err, args) {\n if (err) {\n callback(err);\n } else if (test.apply(this, args)) {\n iterator(next);\n } else {\n callback.apply(null, [null].concat(args));\n }\n });\n iterator(next);\n } else {\n callback(null);\n }\n };\n\n async.doWhilst = function (iterator, test, callback) {\n var calls = 0;\n return async.whilst(function() {\n return ++calls <= 1 || test.apply(this, arguments);\n }, iterator, callback);\n };\n\n async.until = function (test, iterator, callback) {\n return async.whilst(function() {\n return !test.apply(this, arguments);\n }, iterator, callback);\n };\n\n async.doUntil = function (iterator, test, callback) {\n return async.doWhilst(iterator, function() {\n return !test.apply(this, arguments);\n }, callback);\n };\n\n async.during = function (test, iterator, callback) {\n callback = callback || noop;\n\n var next = _restParam(function(err, args) {\n if (err) {\n callback(err);\n } else {\n args.push(check);\n test.apply(this, args);\n }\n });\n\n var check = function(err, truth) {\n if (err) {\n callback(err);\n } else if (truth) {\n iterator(next);\n } else {\n callback(null);\n }\n };\n\n test(check);\n };\n\n async.doDuring = function (iterator, test, callback) {\n var calls = 0;\n async.during(function(next) {\n if (calls++ < 1) {\n next(null, true);\n } else {\n test.apply(this, arguments);\n }\n }, iterator, callback);\n };\n\n function _queue(worker, concurrency, payload) {\n if (concurrency == null) {\n concurrency = 1;\n }\n else if(concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n function _insert(q, data, pos, callback) {\n if (callback != null && typeof callback !== \"function\") {\n throw new Error(\"task callback must be a function\");\n }\n q.started = true;\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length === 0 && q.idle()) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n q.drain();\n });\n }\n _arrayEach(data, function(task) {\n var item = {\n data: task,\n callback: callback || noop\n };\n\n if (pos) {\n q.tasks.unshift(item);\n } else {\n q.tasks.push(item);\n }\n\n if (q.tasks.length === q.concurrency) {\n q.saturated();\n }\n });\n async.setImmediate(q.process);\n }\n function _next(q, tasks) {\n return function(){\n workers -= 1;\n\n var removed = false;\n var args = arguments;\n _arrayEach(tasks, function (task) {\n _arrayEach(workersList, function (worker, index) {\n if (worker === task && !removed) {\n workersList.splice(index, 1);\n removed = true;\n }\n });\n\n task.callback.apply(task, args);\n });\n if (q.tasks.length + workers === 0) {\n q.drain();\n }\n q.process();\n };\n }\n\n var workers = 0;\n var workersList = [];\n var q = {\n tasks: [],\n concurrency: concurrency,\n payload: payload,\n saturated: noop,\n empty: noop,\n drain: noop,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(q, data, false, callback);\n },\n kill: function () {\n q.drain = noop;\n q.tasks = [];\n },\n unshift: function (data, callback) {\n _insert(q, data, true, callback);\n },\n process: function () {\n while(!q.paused && workers < q.concurrency && q.tasks.length){\n\n var tasks = q.payload ?\n q.tasks.splice(0, q.payload) :\n q.tasks.splice(0, q.tasks.length);\n\n var data = _map(tasks, function (task) {\n return task.data;\n });\n\n if (q.tasks.length === 0) {\n q.empty();\n }\n workers += 1;\n workersList.push(tasks[0]);\n var cb = only_once(_next(q, tasks));\n worker(data, cb);\n }\n },\n length: function () {\n return q.tasks.length;\n },\n running: function () {\n return workers;\n },\n workersList: function () {\n return workersList;\n },\n idle: function() {\n return q.tasks.length + workers === 0;\n },\n pause: function () {\n q.paused = true;\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n var resumeCount = Math.min(q.concurrency, q.tasks.length);\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (var w = 1; w <= resumeCount; w++) {\n async.setImmediate(q.process);\n }\n }\n };\n return q;\n }\n\n async.queue = function (worker, concurrency) {\n var q = _queue(function (items, cb) {\n worker(items[0], cb);\n }, concurrency, 1);\n\n return q;\n };\n\n async.priorityQueue = function (worker, concurrency) {\n\n function _compareTasks(a, b){\n return a.priority - b.priority;\n }\n\n function _binarySearch(sequence, item, compare) {\n var beg = -1,\n end = sequence.length - 1;\n while (beg < end) {\n var mid = beg + ((end - beg + 1) >>> 1);\n if (compare(item, sequence[mid]) >= 0) {\n beg = mid;\n } else {\n end = mid - 1;\n }\n }\n return beg;\n }\n\n function _insert(q, data, priority, callback) {\n if (callback != null && typeof callback !== \"function\") {\n throw new Error(\"task callback must be a function\");\n }\n q.started = true;\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length === 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n q.drain();\n });\n }\n _arrayEach(data, function(task) {\n var item = {\n data: task,\n priority: priority,\n callback: typeof callback === 'function' ? callback : noop\n };\n\n q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);\n\n if (q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n\n // Start with a normal queue\n var q = async.queue(worker, concurrency);\n\n // Override push to accept second parameter representing priority\n q.push = function (data, priority, callback) {\n _insert(q, data, priority, callback);\n };\n\n // Remove unshift function\n delete q.unshift;\n\n return q;\n };\n\n async.cargo = function (worker, payload) {\n return _queue(worker, 1, payload);\n };\n\n function _console_fn(name) {\n return _restParam(function (fn, args) {\n fn.apply(null, args.concat([_restParam(function (err, args) {\n if (typeof console === 'object') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n }\n else if (console[name]) {\n _arrayEach(args, function (x) {\n console[name](x);\n });\n }\n }\n })]));\n });\n }\n async.log = _console_fn('log');\n async.dir = _console_fn('dir');\n /*async.info = _console_fn('info');\n async.warn = _console_fn('warn');\n async.error = _console_fn('error');*/\n\n async.memoize = function (fn, hasher) {\n var memo = {};\n var queues = {};\n var has = Object.prototype.hasOwnProperty;\n hasher = hasher || identity;\n var memoized = _restParam(function memoized(args) {\n var callback = args.pop();\n var key = hasher.apply(null, args);\n if (has.call(memo, key)) { \n async.setImmediate(function () {\n callback.apply(null, memo[key]);\n });\n }\n else if (has.call(queues, key)) {\n queues[key].push(callback);\n }\n else {\n queues[key] = [callback];\n fn.apply(null, args.concat([_restParam(function (args) {\n memo[key] = args;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, args);\n }\n })]));\n }\n });\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n };\n\n async.unmemoize = function (fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n };\n\n function _times(mapper) {\n return function (count, iterator, callback) {\n mapper(_range(count), iterator, callback);\n };\n }\n\n async.times = _times(async.map);\n async.timesSeries = _times(async.mapSeries);\n async.timesLimit = function (count, limit, iterator, callback) {\n return async.mapLimit(_range(count), limit, iterator, callback);\n };\n\n async.seq = function (/* functions... */) {\n var fns = arguments;\n return _restParam(function (args) {\n var that = this;\n\n var callback = args[args.length - 1];\n if (typeof callback == 'function') {\n args.pop();\n } else {\n callback = noop;\n }\n\n async.reduce(fns, args, function (newargs, fn, cb) {\n fn.apply(that, newargs.concat([_restParam(function (err, nextargs) {\n cb(err, nextargs);\n })]));\n },\n function (err, results) {\n callback.apply(that, [err].concat(results));\n });\n });\n };\n\n async.compose = function (/* functions... */) {\n return async.seq.apply(null, Array.prototype.reverse.call(arguments));\n };\n\n\n function _applyEach(eachfn) {\n return _restParam(function(fns, args) {\n var go = _restParam(function(args) {\n var that = this;\n var callback = args.pop();\n return eachfn(fns, function (fn, _, cb) {\n fn.apply(that, args.concat([cb]));\n },\n callback);\n });\n if (args.length) {\n return go.apply(this, args);\n }\n else {\n return go;\n }\n });\n }\n\n async.applyEach = _applyEach(async.eachOf);\n async.applyEachSeries = _applyEach(async.eachOfSeries);\n\n\n async.forever = function (fn, callback) {\n var done = only_once(callback || noop);\n var task = ensureAsync(fn);\n function next(err) {\n if (err) {\n return done(err);\n }\n task(next);\n }\n next();\n };\n\n function ensureAsync(fn) {\n return _restParam(function (args) {\n var callback = args.pop();\n args.push(function () {\n var innerArgs = arguments;\n if (sync) {\n async.setImmediate(function () {\n callback.apply(null, innerArgs);\n });\n } else {\n callback.apply(null, innerArgs);\n }\n });\n var sync = true;\n fn.apply(this, args);\n sync = false;\n });\n }\n\n async.ensureAsync = ensureAsync;\n\n async.constant = _restParam(function(values) {\n var args = [null].concat(values);\n return function (callback) {\n return callback.apply(this, args);\n };\n });\n\n async.wrapSync =\n async.asyncify = function asyncify(func) {\n return _restParam(function (args) {\n var callback = args.pop();\n var result;\n try {\n result = func.apply(this, args);\n } catch (e) {\n return callback(e);\n }\n // if result is Promise object\n if (_isObject(result) && typeof result.then === \"function\") {\n result.then(function(value) {\n callback(null, value);\n })[\"catch\"](function(err) {\n callback(err.message ? err : new Error(err));\n });\n } else {\n callback(null, result);\n }\n });\n };\n\n // Node.js\n if (typeof module === 'object' && module.exports) {\n module.exports = async;\n }\n // AMD / RequireJS\n else if (typeof define === 'function' && define.amd) {\n define([], function () {\n return async;\n });\n }\n // included directly via <script> tag\n else {\n root.async = async;\n }\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/async/lib/async.js\n// module id = 3\n// module chunks = 0","var Collection, MemoryDb, async, compileSort, processFind, utils, _,\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n_ = require('lodash');\n\nasync = require('async');\n\nutils = require('./utils');\n\nprocessFind = require('./utils').processFind;\n\ncompileSort = require('./selector').compileSort;\n\nmodule.exports = MemoryDb = (function() {\n function MemoryDb(options, success) {\n this.collections = {};\n this.options = _.defaults(options, {\n safety: \"clone\"\n });\n if (success) {\n success(this);\n }\n }\n\n MemoryDb.prototype.addCollection = function(name, success, error) {\n var collection;\n collection = new Collection(name, this.options);\n this[name] = collection;\n this.collections[name] = collection;\n if (success != null) {\n return success();\n }\n };\n\n MemoryDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n if (success != null) {\n return success();\n }\n };\n\n MemoryDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return MemoryDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, options) {\n this._applySafety = __bind(this._applySafety, this);\n this.name = name;\n this.items = {};\n this.upserts = {};\n this.removes = {};\n this.options = options || {};\n }\n\n Collection.prototype.find = function(selector, options) {\n return {\n fetch: (function(_this) {\n return function(success, error) {\n return _this._findFetch(selector, options, success, error);\n };\n })(this)\n };\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n var _ref;\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n return this.find(selector, options).fetch((function(_this) {\n return function(results) {\n if (success != null) {\n return success(_this._applySafety(results.length > 0 ? results[0] : null));\n }\n };\n })(this), error);\n };\n\n Collection.prototype._findFetch = function(selector, options, success, error) {\n return setTimeout((function(_this) {\n return function() {\n var results;\n results = processFind(_.values(_this.items), selector, options);\n if (success != null) {\n return success(_this._applySafety(results));\n }\n };\n })(this), 0);\n };\n\n Collection.prototype._applySafety = function(items) {\n if (!items) {\n return items;\n }\n if (_.isArray(items)) {\n return _.map(items, this._applySafety);\n }\n if (this.options.safety === \"clone\" || !this.options.safety) {\n return JSON.parse(JSON.stringify(items));\n }\n if (this.options.safety === \"freeze\") {\n Object.freeze(items);\n return items;\n }\n throw new Error(\"Unsupported safety \" + this.options.safety);\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var item, items, _i, _len, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n items = JSON.parse(JSON.stringify(items));\n for (_i = 0, _len = items.length; _i < _len; _i++) {\n item = items[_i];\n if (item.base === void 0) {\n if (this.upserts[item.doc._id]) {\n item.base = this.upserts[item.doc._id].base;\n } else {\n item.base = this.items[item.doc._id] || null;\n }\n }\n this.items[item.doc._id] = item.doc;\n this.upserts[item.doc._id] = item;\n }\n if (_.isArray(docs)) {\n if (success) {\n return success(this._applySafety(_.pluck(items, \"doc\")));\n }\n } else {\n if (success) {\n return success(this._applySafety(_.pluck(items, \"doc\")[0]));\n }\n }\n };\n\n Collection.prototype.remove = function(id, success, error) {\n if (_.isObject(id)) {\n this.find(id).fetch((function(_this) {\n return function(rows) {\n return async.each(rows, function(row, cb) {\n return _this.remove(row._id, (function() {\n return cb();\n }), cb);\n }, function() {\n return success();\n });\n };\n })(this), error);\n return;\n }\n if (_.has(this.items, id)) {\n this.removes[id] = this.items[id];\n delete this.items[id];\n delete this.upserts[id];\n } else {\n this.removes[id] = {\n _id: id\n };\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.cache = function(docs, selector, options, success, error) {\n var doc, docsMap, sort, _i, _len;\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n this.cacheOne(doc);\n }\n docsMap = _.object(_.pluck(docs, \"_id\"), docs);\n if (options.sort) {\n sort = compileSort(options.sort);\n }\n return this.find(selector, options).fetch((function(_this) {\n return function(results) {\n var result, _j, _len1;\n for (_j = 0, _len1 = results.length; _j < _len1; _j++) {\n result = results[_j];\n if (!docsMap[result._id] && !_.has(_this.upserts, result._id)) {\n if (options.limit && docs.length === options.limit) {\n if (options.sort && sort(result, _.last(docs)) >= 0) {\n continue;\n }\n if (!options.sort) {\n continue;\n }\n }\n delete _this.items[result._id];\n }\n }\n if (success != null) {\n return success();\n }\n };\n })(this), error);\n };\n\n Collection.prototype.pendingUpserts = function(success) {\n return success(_.values(this.upserts));\n };\n\n Collection.prototype.pendingRemoves = function(success) {\n return success(_.pluck(this.removes, \"_id\"));\n };\n\n Collection.prototype.resolveUpserts = function(upserts, success) {\n var id, upsert, _i, _len;\n for (_i = 0, _len = upserts.length; _i < _len; _i++) {\n upsert = upserts[_i];\n id = upsert.doc._id;\n if (this.upserts[id]) {\n if (_.isEqual(upsert.doc, this.upserts[id].doc)) {\n delete this.upserts[id];\n } else {\n this.upserts[id].base = upsert.doc;\n }\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.resolveRemove = function(id, success) {\n delete this.removes[id];\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.seed = function(docs, success) {\n var doc, _i, _len;\n if (!_.isArray(docs)) {\n docs = [docs];\n }\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n if (!_.has(this.items, doc._id) && !_.has(this.removes, doc._id)) {\n this.items[doc._id] = doc;\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.cacheOne = function(doc, success, error) {\n return this.cacheList([doc], success, error);\n };\n\n Collection.prototype.cacheList = function(docs, success) {\n var doc, existing, _i, _len;\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n if (!_.has(this.upserts, doc._id) && !_.has(this.removes, doc._id)) {\n existing = this.items[doc._id];\n if (!existing || !doc._rev || !existing._rev || doc._rev > existing._rev) {\n this.items[doc._id] = doc;\n }\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.uncache = function(selector, success, error) {\n var compiledSelector, items;\n compiledSelector = utils.compileDocumentSelector(selector);\n items = _.filter(_.values(this.items), (function(_this) {\n return function(item) {\n return (_this.upserts[item._id] != null) || !compiledSelector(item);\n };\n })(this));\n this.items = _.object(_.pluck(items, \"_id\"), items);\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.uncacheList = function(ids, success, error) {\n var idIndex, items;\n idIndex = _.indexBy(ids);\n items = _.filter(_.values(this.items), (function(_this) {\n return function(item) {\n return (_this.upserts[item._id] != null) || !idIndex[item._id];\n };\n })(this));\n this.items = _.object(_.pluck(items, \"_id\"), items);\n if (success != null) {\n return success();\n }\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/MemoryDb.js\n// module id = 4\n// module chunks = 0","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 5\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/process/browser.js\n// module id = 6\n// module chunks = 0","var Collection, IDBStore, IndexedDb, async, compileSort, processFind, utils, _;\n\n_ = require('lodash');\n\nasync = require('async');\n\nIDBStore = require('idb-wrapper');\n\nutils = require('./utils');\n\nprocessFind = require('./utils').processFind;\n\ncompileSort = require('./selector').compileSort;\n\nmodule.exports = IndexedDb = (function() {\n function IndexedDb(options, success, error) {\n var ex;\n this.collections = {};\n try {\n this.store = new IDBStore({\n dbVersion: 1,\n storeName: 'minimongo_' + options.namespace,\n keyPath: ['col', 'doc._id'],\n autoIncrement: false,\n onStoreReady: (function(_this) {\n return function() {\n if (success) {\n return success(_this);\n }\n };\n })(this),\n onError: error,\n indexes: [\n {\n name: 'col',\n keyPath: 'col',\n unique: false,\n multiEntry: false\n }, {\n name: 'col-state',\n keyPath: ['col', 'state'],\n unique: false,\n multiEntry: false\n }\n ]\n });\n } catch (_error) {\n ex = _error;\n if (error) {\n error(ex);\n }\n return;\n }\n }\n\n IndexedDb.prototype.addCollection = function(name, success, error) {\n var collection;\n collection = new Collection(name, this.store);\n this[name] = collection;\n this.collections[name] = collection;\n if (success) {\n return success();\n }\n };\n\n IndexedDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n return this.store.query((function(_this) {\n return function(matches) {\n var keys;\n keys = _.map(matches, function(m) {\n return [m.col, m.doc._id];\n });\n if (keys.length > 0) {\n return _this.store.removeBatch(keys, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n };\n })(this), {\n index: \"col\",\n keyRange: this.store.makeKeyRange({\n only: name\n }),\n onError: error\n });\n };\n\n IndexedDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return IndexedDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, store) {\n this.name = name;\n this.store = store;\n }\n\n Collection.prototype.find = function(selector, options) {\n return {\n fetch: (function(_this) {\n return function(success, error) {\n return _this._findFetch(selector, options, success, error);\n };\n })(this)\n };\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n var _ref;\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n return this.find(selector, options).fetch(function(results) {\n if (success != null) {\n return success(results.length > 0 ? results[0] : null);\n }\n }, error);\n };\n\n Collection.prototype._findFetch = function(selector, options, success, error) {\n return this.store.query(function(matches) {\n matches = _.filter(matches, function(m) {\n return m.state !== \"removed\";\n });\n if (success != null) {\n return success(processFind(_.pluck(matches, \"doc\"), selector, options));\n }\n }, {\n index: \"col\",\n keyRange: this.store.makeKeyRange({\n only: this.name\n }),\n onError: error\n });\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var items, keys, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n keys = _.map(items, (function(_this) {\n return function(item) {\n return [_this.name, item.doc._id];\n };\n })(this));\n return this.store.getBatch(keys, (function(_this) {\n return function(records) {\n var puts;\n puts = _.map(items, function(item, i) {\n var base;\n if (item.base !== void 0) {\n base = item.base;\n } else if (records[i] && records[i].doc && records[i].state === \"cached\") {\n base = records[i].doc;\n } else if (records[i] && records[i].doc && records[i].state === \"upserted\") {\n base = records[i].base;\n } else {\n base = null;\n }\n return {\n col: _this.name,\n state: \"upserted\",\n doc: item.doc,\n base: base\n };\n });\n return _this.store.putBatch(puts, function() {\n if (success) {\n return success(docs);\n }\n }, error);\n };\n })(this), error);\n };\n\n Collection.prototype.remove = function(id, success, error) {\n if (_.isObject(id)) {\n this.find(id).fetch((function(_this) {\n return function(rows) {\n return async.each(rows, function(row, cb) {\n return _this.remove(row._id, (function() {\n return cb();\n }), cb);\n }, function() {\n return success();\n });\n };\n })(this), error);\n return;\n }\n return this.store.get([this.name, id], (function(_this) {\n return function(record) {\n if (record == null) {\n record = {\n col: _this.name,\n doc: {\n _id: id\n }\n };\n }\n record.state = \"removed\";\n return _this.store.put(record, function() {\n if (success) {\n return success(id);\n }\n }, error);\n };\n })(this));\n };\n\n Collection.prototype.cache = function(docs, selector, options, success, error) {\n var keys, puts, step2;\n step2 = (function(_this) {\n return function() {\n var docsMap, sort;\n docsMap = _.object(_.pluck(docs, \"_id\"), docs);\n if (options.sort) {\n sort = compileSort(options.sort);\n }\n return _this.find(selector, options).fetch(function(results) {\n var keys, removes;\n removes = [];\n keys = _.map(results, function(result) {\n return [_this.name, result._id];\n });\n if (keys.length === 0) {\n if (success != null) {\n success();\n }\n return;\n }\n return _this.store.getBatch(keys, function(records) {\n var i, record, result, _i, _ref;\n for (i = _i = 0, _ref = records.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n record = records[i];\n result = results[i];\n if (!docsMap[result._id] && record && record.state === \"cached\") {\n if (options.limit && docs.length === options.limit) {\n if (options.sort && sort(result, _.last(docs)) >= 0) {\n continue;\n }\n if (!options.sort) {\n continue;\n }\n }\n removes.push([_this.name, result._id]);\n }\n }\n if (removes.length > 0) {\n return _this.store.removeBatch(removes, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n }, error);\n }, error);\n };\n })(this);\n if (docs.length === 0) {\n return step2();\n }\n keys = _.map(docs, (function(_this) {\n return function(doc) {\n return [_this.name, doc._id];\n };\n })(this));\n puts = [];\n return this.store.getBatch(keys, (function(_this) {\n return function(records) {\n var doc, i, record, _i, _ref;\n for (i = _i = 0, _ref = records.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n record = records[i];\n doc = docs[i];\n if ((record == null) || record.state === \"cached\") {\n if (!record || !doc._rev || !record.doc._rev || doc._rev > record.doc._rev) {\n puts.push({\n col: _this.name,\n state: \"cached\",\n doc: doc\n });\n }\n }\n }\n if (puts.length > 0) {\n return _this.store.putBatch(puts, step2, error);\n } else {\n return step2();\n }\n };\n })(this), error);\n };\n\n Collection.prototype.pendingUpserts = function(success, error) {\n return this.store.query(function(matches) {\n var upserts;\n upserts = _.map(matches, function(m) {\n return {\n doc: m.doc,\n base: m.base || null\n };\n });\n if (success != null) {\n return success(upserts);\n }\n }, {\n index: \"col-state\",\n keyRange: this.store.makeKeyRange({\n only: [this.name, \"upserted\"]\n }),\n onError: error\n });\n };\n\n Collection.prototype.pendingRemoves = function(success, error) {\n return this.store.query(function(matches) {\n if (success != null) {\n return success(_.pluck(_.pluck(matches, \"doc\"), \"_id\"));\n }\n }, {\n index: \"col-state\",\n keyRange: this.store.makeKeyRange({\n only: [this.name, \"removed\"]\n }),\n onError: error\n });\n };\n\n Collection.prototype.resolveUpserts = function(upserts, success, error) {\n var keys;\n keys = _.map(upserts, (function(_this) {\n return function(upsert) {\n return [_this.name, upsert.doc._id];\n };\n })(this));\n return this.store.getBatch(keys, (function(_this) {\n return function(records) {\n var i, puts, record, _i, _ref;\n puts = [];\n for (i = _i = 0, _ref = upserts.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n record = records[i];\n if (record && record.state === \"upserted\") {\n if (_.isEqual(record.doc, upserts[i].doc)) {\n record.state = \"cached\";\n puts.push(record);\n } else {\n record.base = upserts[i].doc;\n puts.push(record);\n }\n }\n }\n if (puts.length > 0) {\n return _this.store.putBatch(puts, function() {\n if (success) {\n return success();\n }\n }, error);\n } else {\n if (success) {\n return success();\n }\n }\n };\n })(this), error);\n };\n\n Collection.prototype.resolveRemove = function(id, success, error) {\n return this.store.get([this.name, id], (function(_this) {\n return function(record) {\n if (!record) {\n if (success != null) {\n success();\n }\n return;\n }\n if (record.state === \"removed\") {\n return _this.store.remove([_this.name, id], function() {\n if (success != null) {\n return success();\n }\n }, error);\n }\n };\n })(this));\n };\n\n Collection.prototype.seed = function(docs, success, error) {\n var keys, puts;\n if (!_.isArray(docs)) {\n docs = [docs];\n }\n keys = _.map(docs, (function(_this) {\n return function(doc) {\n return [_this.name, doc._id];\n };\n })(this));\n puts = [];\n return this.store.getBatch(keys, (function(_this) {\n return function(records) {\n var doc, i, record, _i, _ref;\n for (i = _i = 0, _ref = records.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n record = records[i];\n doc = docs[i];\n if (record == null) {\n puts.push({\n col: _this.name,\n state: \"cached\",\n doc: doc\n });\n }\n }\n if (puts.length > 0) {\n return _this.store.putBatch(puts, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n };\n })(this), error);\n };\n\n Collection.prototype.cacheOne = function(doc, success, error) {\n return this.cacheList([doc], success, error);\n };\n\n Collection.prototype.cacheList = function(docs, success, error) {\n var keys, puts;\n keys = _.map(docs, (function(_this) {\n return function(doc) {\n return [_this.name, doc._id];\n };\n })(this));\n puts = [];\n return this.store.getBatch(keys, (function(_this) {\n return function(records) {\n var doc, i, record, _i, _ref;\n for (i = _i = 0, _ref = records.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n record = records[i];\n doc = docs[i];\n if (record && doc._rev && record.doc._rev && doc._rev <= record.doc._rev) {\n continue;\n }\n if (record == null) {\n record = {\n col: _this.name,\n state: \"cached\",\n doc: doc\n };\n }\n if (record.state === \"cached\") {\n record.doc = doc;\n puts.push(record);\n }\n }\n if (puts.length > 0) {\n return _this.store.putBatch(puts, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n };\n })(this), error);\n };\n\n Collection.prototype.uncache = function(selector, success, error) {\n var compiledSelector;\n compiledSelector = utils.compileDocumentSelector(selector);\n return this.store.query((function(_this) {\n return function(matches) {\n var keys;\n matches = _.filter(matches, function(m) {\n return m.state === \"cached\" && compiledSelector(m.doc);\n });\n keys = _.map(matches, function(m) {\n return [_this.name, m.doc._id];\n });\n if (keys.length > 0) {\n return _this.store.removeBatch(keys, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n };\n })(this), {\n index: \"col\",\n keyRange: this.store.makeKeyRange({\n only: this.name\n }),\n onError: error\n });\n };\n\n Collection.prototype.uncacheList = function(ids, success, error) {\n var idIndex;\n idIndex = _.indexBy(ids);\n error = error || function() {};\n return this.store.query((function(_this) {\n return function(matches) {\n var keys;\n matches = _.filter(matches, function(m) {\n return m.state === \"cached\" && idIndex[m.doc._id];\n });\n keys = _.map(matches, function(m) {\n return [_this.name, m.doc._id];\n });\n if (keys.length > 0) {\n return _this.store.removeBatch(keys, function() {\n if (success != null) {\n return success();\n }\n }, error);\n } else {\n if (success != null) {\n return success();\n }\n }\n };\n })(this), {\n index: \"col\",\n keyRange: this.store.makeKeyRange({\n only: this.name\n }),\n onError: error\n });\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/IndexedDb.js\n// module id = 7\n// module chunks = 0","var Collection, WebSQLDb, async, compileSort, doNothing, processFind, utils, _;\n\n_ = require('lodash');\n\nasync = require('async');\n\nutils = require('./utils');\n\nprocessFind = require('./utils').processFind;\n\ncompileSort = require('./selector').compileSort;\n\ndoNothing = function() {};\n\nmodule.exports = WebSQLDb = (function() {\n function WebSQLDb(options, success, error) {\n var checkV2, ex, migrateToV1, migrateToV2;\n this.collections = {};\n try {\n this.db = window.openDatabase('minimongo_' + options.namespace, '', 'Minimongo:' + options.namespace, 5 * 1024 * 1024);\n if (!this.db) {\n return error(new Error(\"Failed to create database\"));\n }\n } catch (_error) {\n ex = _error;\n if (error) {\n error(ex);\n }\n return;\n }\n migrateToV1 = function(tx) {\n return tx.executeSql('CREATE TABLE docs (\\n col TEXT NOT NULL,\\n id TEXT NOT NULL,\\n state TEXT NOT NULL,\\n doc TEXT,\\n PRIMARY KEY (col, id));', [], doNothing, (function(tx, err) {\n return error(err);\n }));\n };\n migrateToV2 = function(tx) {\n return tx.executeSql('ALTER TABLE docs ADD COLUMN base TEXT;', [], doNothing, (function(tx, err) {\n return error(err);\n }));\n };\n checkV2 = (function(_this) {\n return function() {\n if (_this.db.version === \"1.0\") {\n return _this.db.changeVersion(\"1.0\", \"2.0\", migrateToV2, error, function() {\n if (success) {\n return success(_this);\n }\n });\n } else if (_this.db.version !== \"2.0\") {\n return error(\"Unknown db version \" + _this.db.version);\n } else {\n if (success) {\n return success(_this);\n }\n }\n };\n })(this);\n if (!this.db.version) {\n this.db.changeVersion(\"\", \"1.0\", migrateToV1, error, checkV2);\n } else {\n checkV2();\n }\n return this.db;\n }\n\n WebSQLDb.prototype.addCollection = function(name, success, error) {\n var collection;\n collection = new Collection(name, this.db);\n this[name] = collection;\n this.collections[name] = collection;\n if (success) {\n return success();\n }\n };\n\n WebSQLDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n return this.db.transaction(function(tx) {\n return tx.executeSql(\"DELETE FROM docs WHERE col = ?\", [name], success, (function(tx, err) {\n return error(err);\n }));\n }, error);\n };\n\n WebSQLDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return WebSQLDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, db) {\n this.name = name;\n this.db = db;\n }\n\n Collection.prototype.find = function(selector, options) {\n return {\n fetch: (function(_this) {\n return function(success, error) {\n return _this._findFetch(selector, options, success, error);\n };\n })(this)\n };\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n var _ref;\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n return this.find(selector, options).fetch(function(results) {\n if (success != null) {\n return success(results.length > 0 ? results[0] : null);\n }\n }, error);\n };\n\n Collection.prototype._findFetch = function(selector, options, success, error) {\n error = error || function() {};\n return this.db.readTransaction((function(_this) {\n return function(tx) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ?\", [_this.name], function(tx, results) {\n var docs, i, row, _i, _ref;\n docs = [];\n for (i = _i = 0, _ref = results.rows.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n row = results.rows.item(i);\n if (row.state !== \"removed\") {\n docs.push(JSON.parse(row.doc));\n }\n }\n if (success != null) {\n return success(processFind(docs, selector, options));\n }\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var items, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n var ids;\n ids = _.map(items, function(item) {\n return item.doc._id;\n });\n bases = {};\n return async.eachSeries(ids, function(id, callback) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, id], function(tx2, results) {\n var row;\n tx = tx2;\n if (results.rows.length > 0) {\n row = results.rows.item(0);\n if (row.state === \"upserted\") {\n bases[row.id] = row.base ? JSON.parse(row.base) : null;\n } else if (row.state === \"cached\") {\n bases[row.id] = JSON.parse(row.doc);\n }\n }\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n }, function() {\n var base, id, item, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = items.length; _i < _len; _i++) {\n item = items[_i];\n id = item.doc._id;\n if (item.base !== void 0) {\n base = item.base;\n } else if (bases[id]) {\n base = bases[id];\n } else {\n base = null;\n }\n _results.push(tx.executeSql(\"INSERT OR REPLACE INTO docs (col, id, state, doc, base) VALUES (?, ?, ?, ?, ?)\", [_this.name, item.doc._id, \"upserted\", JSON.stringify(item.doc), JSON.stringify(base)], doNothing, (function(tx, err) {\n return error(err);\n })));\n }\n return _results;\n });\n };\n })(this), error, function() {\n if (success) {\n return success(docs);\n }\n });\n };\n\n Collection.prototype.remove = function(id, success, error) {\n if (_.isObject(id)) {\n this.find(id).fetch((function(_this) {\n return function(rows) {\n return async.each(rows, function(row, cb) {\n return _this.remove(row._id, (function() {\n return cb();\n }), cb);\n }, function() {\n return success();\n });\n };\n })(this), error);\n return;\n }\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, id], function(tx, results) {\n if (results.rows.length > 0) {\n return tx.executeSql('UPDATE docs SET state=\"removed\" WHERE col = ? AND id = ?', [_this.name, id], function() {\n if (success) {\n return success(id);\n }\n }, (function(tx, err) {\n return error(err);\n }));\n } else {\n return tx.executeSql(\"INSERT INTO docs (col, id, state, doc) VALUES (?, ?, ?, ?)\", [\n _this.name, id, \"removed\", JSON.stringify({\n _id: id\n })\n ], function() {\n if (success) {\n return success(id);\n }\n }, (function(tx, err) {\n return error(err);\n }));\n }\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.cache = function(docs, selector, options, success, error) {\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return async.eachSeries(docs, function(doc, callback) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, doc._id], function(tx, results) {\n var existing;\n if (results.rows.length === 0 || results.rows.item(0).state === \"cached\") {\n existing = results.rows.length > 0 ? JSON.parse(results.rows.item(0).doc) : null;\n if (!existing || !doc._rev || !existing._rev || doc._rev > existing._rev) {\n return tx.executeSql(\"INSERT OR REPLACE INTO docs (col, id, state, doc) VALUES (?, ?, ?, ?)\", [_this.name, doc._id, \"cached\", JSON.stringify(doc)], function() {\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n } else {\n return callback();\n }\n } else {\n return callback();\n }\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n var docsMap, sort;\n if (err) {\n if (error) {\n error(err);\n }\n return;\n }\n docsMap = _.object(_.pluck(docs, \"_id\"), docs);\n if (options.sort) {\n sort = compileSort(options.sort);\n }\n return _this.find(selector, options).fetch(function(results) {\n return _this.db.transaction(function(tx) {\n return async.eachSeries(results, function(result, callback) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, result._id], function(tx, rows) {\n if (!docsMap[result._id] && rows.rows.length > 0 && rows.rows.item(0).state === \"cached\") {\n if (options.limit && docs.length === options.limit) {\n if (options.sort && sort(result, _.last(docs)) >= 0) {\n return callback();\n }\n if (!options.sort) {\n return callback();\n }\n }\n return tx.executeSql(\"DELETE FROM docs WHERE col = ? AND id = ?\", [_this.name, result._id], function() {\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n } else {\n return callback();\n }\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n if (err != null) {\n if (error != null) {\n error(err);\n }\n return;\n }\n if (success != null) {\n return success();\n }\n });\n }, error);\n }, error);\n });\n };\n })(this), error);\n };\n\n Collection.prototype.pendingUpserts = function(success, error) {\n error = error || function() {};\n return this.db.readTransaction((function(_this) {\n return function(tx) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND state = ?\", [_this.name, \"upserted\"], function(tx, results) {\n var docs, i, row, _i, _ref;\n docs = [];\n for (i = _i = 0, _ref = results.rows.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n row = results.rows.item(i);\n docs.push({\n doc: JSON.parse(row.doc),\n base: row.base ? JSON.parse(row.base) : null\n });\n }\n if (success != null) {\n return success(docs);\n }\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.pendingRemoves = function(success, error) {\n error = error || function() {};\n return this.db.readTransaction((function(_this) {\n return function(tx) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND state = ?\", [_this.name, \"removed\"], function(tx, results) {\n var docs, i, row, _i, _ref;\n docs = [];\n for (i = _i = 0, _ref = results.rows.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n row = results.rows.item(i);\n docs.push(JSON.parse(row.doc)._id);\n }\n if (success != null) {\n return success(docs);\n }\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.resolveUpserts = function(upserts, success, error) {\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return async.eachSeries(upserts, function(upsert, cb) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, upsert.doc._id], function(tx, results) {\n if (results.rows.length > 0 && results.rows.item(0).state === \"upserted\") {\n if (_.isEqual(JSON.parse(results.rows.item(0).doc), upsert.doc)) {\n tx.executeSql('UPDATE docs SET state=\"cached\" WHERE col = ? AND id = ?', [_this.name, upsert.doc._id], doNothing, (function(tx, err) {\n return error(err);\n }));\n return cb();\n } else {\n tx.executeSql('UPDATE docs SET base=? WHERE col = ? AND id = ?', [JSON.stringify(upsert.doc), _this.name, upsert.doc._id], doNothing, (function(tx, err) {\n return error(err);\n }));\n return cb();\n }\n } else {\n return cb();\n }\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n if (err) {\n return error(err);\n }\n if (success) {\n return success();\n }\n });\n };\n })(this), error);\n };\n\n Collection.prototype.resolveRemove = function(id, success, error) {\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return tx.executeSql('DELETE FROM docs WHERE state=\"removed\" AND col = ? AND id = ?', [_this.name, id], function() {\n if (success) {\n return success(id);\n }\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.seed = function(docs, success, error) {\n if (!_.isArray(docs)) {\n docs = [docs];\n }\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return async.eachSeries(docs, function(doc, callback) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, doc._id], function(tx, results) {\n if (results.rows.length === 0) {\n return tx.executeSql(\"INSERT OR REPLACE INTO docs (col, id, state, doc) VALUES (?, ?, ?, ?)\", [_this.name, doc._id, \"cached\", JSON.stringify(doc)], function() {\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n } else {\n return callback();\n }\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n if (err) {\n if (error) {\n return error(err);\n }\n } else {\n if (success) {\n return success();\n }\n }\n });\n };\n })(this), error);\n };\n\n Collection.prototype.cacheOne = function(doc, success, error) {\n return this.cacheList([doc], success, error);\n };\n\n Collection.prototype.cacheList = function(docs, success, error) {\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return async.eachSeries(docs, function(doc, callback) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND id = ?\", [_this.name, doc._id], function(tx, results) {\n var existing;\n if (results.rows.length === 0 || results.rows.item(0).state === \"cached\") {\n existing = results.rows.length > 0 ? JSON.parse(results.rows.item(0).doc) : null;\n if (!existing || !doc._rev || !existing._rev || doc._rev > existing._rev) {\n return tx.executeSql(\"INSERT OR REPLACE INTO docs (col, id, state, doc) VALUES (?, ?, ?, ?)\", [_this.name, doc._id, \"cached\", JSON.stringify(doc)], function() {\n return callback();\n }, (function(tx, err) {\n return callback(err);\n }));\n } else {\n return callback();\n }\n } else {\n return callback();\n }\n }, (function(tx, err) {\n return callback(err);\n }));\n }, function(err) {\n if (err) {\n if (error) {\n return error(err);\n }\n } else {\n if (success) {\n return success(docs);\n }\n }\n });\n };\n })(this), error);\n };\n\n Collection.prototype.uncache = function(selector, success, error) {\n var compiledSelector;\n compiledSelector = utils.compileDocumentSelector(selector);\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return tx.executeSql(\"SELECT * FROM docs WHERE col = ? AND state = ?\", [_this.name, \"cached\"], function(tx, results) {\n var doc, i, row, toRemove, _i, _ref;\n toRemove = [];\n for (i = _i = 0, _ref = results.rows.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n row = results.rows.item(i);\n doc = JSON.parse(row.doc);\n if (compiledSelector(doc)) {\n toRemove.push(doc._id);\n }\n }\n return async.eachSeries(toRemove, function(id, callback) {\n return tx.executeSql('DELETE FROM docs WHERE state=\"cached\" AND col = ? AND id = ?', [_this.name, id], function() {\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n if (err) {\n if (error) {\n return error(err);\n }\n } else {\n if (success) {\n return success();\n }\n }\n });\n }, (function(tx, err) {\n return error(err);\n }));\n };\n })(this), error);\n };\n\n Collection.prototype.uncacheList = function(ids, success, error) {\n error = error || function() {};\n return this.db.transaction((function(_this) {\n return function(tx) {\n return async.eachSeries(ids, function(id, callback) {\n return tx.executeSql('DELETE FROM docs WHERE state=\"cached\" AND col = ? AND id = ?', [_this.name, id], function() {\n return callback();\n }, (function(tx, err) {\n return error(err);\n }));\n }, function(err) {\n if (err) {\n if (error) {\n return error(err);\n }\n } else {\n if (success) {\n return success();\n }\n }\n });\n };\n })(this), error);\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/WebSQLDb.js\n// module id = 8\n// module chunks = 0","var Collection, LocalStorageDb, async, compileSort, processFind, utils, _;\n\n_ = require('lodash');\n\nasync = require('async');\n\nutils = require('./utils');\n\nprocessFind = require('./utils').processFind;\n\ncompileSort = require('./selector').compileSort;\n\nmodule.exports = LocalStorageDb = (function() {\n function LocalStorageDb(options, success) {\n this.collections = {};\n if (options && options.namespace && window.localStorage) {\n this.namespace = options.namespace;\n }\n if (success) {\n success(this);\n }\n }\n\n LocalStorageDb.prototype.addCollection = function(name, success, error) {\n var collection, namespace;\n if (this.namespace) {\n namespace = this.namespace + \".\" + name;\n }\n collection = new Collection(name, namespace);\n this[name] = collection;\n this.collections[name] = collection;\n if (success != null) {\n return success();\n }\n };\n\n LocalStorageDb.prototype.removeCollection = function(name, success, error) {\n var i, key, keyToMatch, keys, _i, _j, _len, _ref;\n if (this.namespace && window.localStorage) {\n keys = [];\n for (i = _i = 0, _ref = window.localStorage.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n keys.push(window.localStorage.key(i));\n }\n for (_j = 0, _len = keys.length; _j < _len; _j++) {\n key = keys[_j];\n keyToMatch = this.namespace + '.' + name;\n if (key.substring(0, keyToMatch.length) === keyToMatch) {\n window.localStorage.removeItem(key);\n }\n }\n }\n delete this[name];\n delete this.collections[name];\n if (success != null) {\n return success();\n }\n };\n\n LocalStorageDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return LocalStorageDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, namespace) {\n this.name = name;\n this.namespace = namespace;\n this.items = {};\n this.upserts = {};\n this.removes = {};\n if (window.localStorage && (namespace != null)) {\n this.loadStorage();\n }\n }\n\n Collection.prototype.loadStorage = function() {\n var base, i, item, key, removeItems, upsertKeys, _i, _j, _len, _ref;\n this.itemNamespace = this.namespace + \"_\";\n for (i = _i = 0, _ref = window.localStorage.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n key = window.localStorage.key(i);\n if (key.substring(0, this.itemNamespace.length) === this.itemNamespace) {\n item = JSON.parse(window.localStorage[key]);\n this.items[item._id] = item;\n }\n }\n upsertKeys = window.localStorage[this.namespace + \"upserts\"] ? JSON.parse(window.localStorage[this.namespace + \"upserts\"]) : [];\n for (_j = 0, _len = upsertKeys.length; _j < _len; _j++) {\n key = upsertKeys[_j];\n this.upserts[key] = {\n doc: this.items[key]\n };\n base = window.localStorage[this.namespace + \"upsertbase_\" + key] ? JSON.parse(window.localStorage[this.namespace + \"upsertbase_\" + key]) : null;\n this.upserts[key].base = base;\n }\n removeItems = window.localStorage[this.namespace + \"removes\"] ? JSON.parse(window.localStorage[this.namespace + \"removes\"]) : [];\n return this.removes = _.object(_.pluck(removeItems, \"_id\"), removeItems);\n };\n\n Collection.prototype.find = function(selector, options) {\n return {\n fetch: (function(_this) {\n return function(success, error) {\n return _this._findFetch(selector, options, success, error);\n };\n })(this)\n };\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n var _ref;\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n return this.find(selector, options).fetch(function(results) {\n if (success != null) {\n return success(results.length > 0 ? results[0] : null);\n }\n }, error);\n };\n\n Collection.prototype._findFetch = function(selector, options, success, error) {\n if (success != null) {\n return success(processFind(_.cloneDeep(_.values(this.items)), selector, options));\n }\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var item, items, _i, _len, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n items = JSON.parse(JSON.stringify(items));\n for (_i = 0, _len = items.length; _i < _len; _i++) {\n item = items[_i];\n if (item.base === void 0) {\n if (this.upserts[item.doc._id]) {\n item.base = this.upserts[item.doc._id].base;\n } else {\n item.base = this.items[item.doc._id] || null;\n }\n }\n item = _.cloneDeep(item);\n this._putItem(item.doc);\n this._putUpsert(item);\n }\n if (success) {\n return success(docs);\n }\n };\n\n Collection.prototype.remove = function(id, success, error) {\n if (_.isObject(id)) {\n this.find(id).fetch((function(_this) {\n return function(rows) {\n return async.each(rows, function(row, cb) {\n return _this.remove(row._id, (function() {\n return cb();\n }), cb);\n }, function() {\n return success();\n });\n };\n })(this), error);\n return;\n }\n if (_.has(this.items, id)) {\n this._putRemove(this.items[id]);\n this._deleteItem(id);\n this._deleteUpsert(id);\n } else {\n this._putRemove({\n _id: id\n });\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype._putItem = function(doc) {\n this.items[doc._id] = doc;\n if (this.namespace) {\n return window.localStorage[this.itemNamespace + doc._id] = JSON.stringify(doc);\n }\n };\n\n Collection.prototype._deleteItem = function(id) {\n delete this.items[id];\n if (this.namespace) {\n return window.localStorage.removeItem(this.itemNamespace + id);\n }\n };\n\n Collection.prototype._putUpsert = function(upsert) {\n this.upserts[upsert.doc._id] = upsert;\n if (this.namespace) {\n window.localStorage[this.namespace + \"upserts\"] = JSON.stringify(_.keys(this.upserts));\n return window.localStorage[this.namespace + \"upsertbase_\" + upsert.doc._id] = JSON.stringify(upsert.base);\n }\n };\n\n Collection.prototype._deleteUpsert = function(id) {\n delete this.upserts[id];\n if (this.namespace) {\n return window.localStorage[this.namespace + \"upserts\"] = JSON.stringify(_.keys(this.upserts));\n }\n };\n\n Collection.prototype._putRemove = function(doc) {\n this.removes[doc._id] = doc;\n if (this.namespace) {\n return window.localStorage[this.namespace + \"removes\"] = JSON.stringify(_.values(this.removes));\n }\n };\n\n Collection.prototype._deleteRemove = function(id) {\n delete this.removes[id];\n if (this.namespace) {\n return window.localStorage[this.namespace + \"removes\"] = JSON.stringify(_.values(this.removes));\n }\n };\n\n Collection.prototype.cache = function(docs, selector, options, success, error) {\n var doc, docsMap, sort, _i, _len;\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n this.cacheOne(doc);\n }\n docsMap = _.object(_.pluck(docs, \"_id\"), docs);\n if (options.sort) {\n sort = compileSort(options.sort);\n }\n return this.find(selector, options).fetch((function(_this) {\n return function(results) {\n var result, _j, _len1;\n for (_j = 0, _len1 = results.length; _j < _len1; _j++) {\n result = results[_j];\n if (!docsMap[result._id] && !_.has(_this.upserts, result._id)) {\n if (options.limit && docs.length === options.limit) {\n if (options.sort && sort(result, _.last(docs)) >= 0) {\n continue;\n }\n if (!options.sort) {\n continue;\n }\n }\n _this._deleteItem(result._id);\n }\n }\n if (success != null) {\n return success();\n }\n };\n })(this), error);\n };\n\n Collection.prototype.pendingUpserts = function(success) {\n return success(_.values(this.upserts));\n };\n\n Collection.prototype.pendingRemoves = function(success) {\n return success(_.pluck(this.removes, \"_id\"));\n };\n\n Collection.prototype.resolveUpserts = function(upserts, success) {\n var upsert, _i, _len;\n for (_i = 0, _len = upserts.length; _i < _len; _i++) {\n upsert = upserts[_i];\n if (this.upserts[upsert.doc._id]) {\n if (_.isEqual(upsert.doc, this.upserts[upsert.doc._id].doc)) {\n this._deleteUpsert(upsert.doc._id);\n } else {\n this.upserts[upsert.doc._id].base = upsert.doc;\n this._putUpsert(this.upserts[upsert.doc._id]);\n }\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.resolveRemove = function(id, success) {\n this._deleteRemove(id);\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.seed = function(docs, success) {\n var doc, _i, _len;\n if (!_.isArray(docs)) {\n docs = [docs];\n }\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n if (!_.has(this.items, doc._id) && !_.has(this.removes, doc._id)) {\n this._putItem(doc);\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.cacheOne = function(doc, success, error) {\n return this.cacheList([doc], success, error);\n };\n\n Collection.prototype.cacheList = function(docs, success) {\n var doc, existing, _i, _len;\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n if (!_.has(this.upserts, doc._id) && !_.has(this.removes, doc._id)) {\n existing = this.items[doc._id];\n if (!existing || !doc._rev || !existing._rev || doc._rev > existing._rev) {\n this._putItem(doc);\n }\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.uncache = function(selector, success, error) {\n var compiledSelector, item, _i, _len, _ref;\n compiledSelector = utils.compileDocumentSelector(selector);\n _ref = _.values(this.items);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n item = _ref[_i];\n if ((this.upserts[item._id] == null) && compiledSelector(item)) {\n this._deleteItem(item._id);\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n Collection.prototype.uncacheList = function(ids, success, error) {\n var id, _i, _len;\n for (_i = 0, _len = ids.length; _i < _len; _i++) {\n id = ids[_i];\n if (this.upserts[id] == null) {\n this._deleteItem(id);\n }\n }\n if (success != null) {\n return success();\n }\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/LocalStorageDb.js\n// module id = 9\n// module chunks = 0","\n/*\n\nDatabase which caches locally in a localDb but pulls results\nultimately from a RemoteDb\n */\nvar HybridCollection, HybridDb, processFind, utils, _;\n\n_ = require('lodash');\n\nprocessFind = require('./utils').processFind;\n\nutils = require('./utils');\n\nmodule.exports = HybridDb = (function() {\n function HybridDb(localDb, remoteDb) {\n this.localDb = localDb;\n this.remoteDb = remoteDb;\n this.collections = {};\n }\n\n HybridDb.prototype.addCollection = function(name, options, success, error) {\n var collection, _ref;\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n collection = new HybridCollection(name, this.localDb[name], this.remoteDb[name], options);\n this[name] = collection;\n this.collections[name] = collection;\n if (success != null) {\n return success();\n }\n };\n\n HybridDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n if (success != null) {\n return success();\n }\n };\n\n HybridDb.prototype.upload = function(success, error) {\n var cols, uploadCols;\n cols = _.values(this.collections);\n uploadCols = function(cols, success, error) {\n var col;\n col = _.first(cols);\n if (col) {\n return col.upload(function() {\n return uploadCols(_.rest(cols), success, error);\n }, function(err) {\n return error(err);\n });\n } else {\n return success();\n }\n };\n return uploadCols(cols, success, error);\n };\n\n HybridDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return HybridDb;\n\n})();\n\nHybridCollection = (function() {\n function HybridCollection(name, localCol, remoteCol, options) {\n this.name = name;\n this.localCol = localCol;\n this.remoteCol = remoteCol;\n this.options = options || {};\n _.defaults(this.options, {\n cacheFind: true,\n cacheFindOne: true,\n interim: true,\n useLocalOnRemoteError: true,\n shortcut: false,\n timeout: 0,\n sortUpserts: null\n });\n }\n\n HybridCollection.prototype.find = function(selector, options) {\n if (options == null) {\n options = {};\n }\n return {\n fetch: (function(_this) {\n return function(success, error) {\n return _this._findFetch(selector, options, success, error);\n };\n })(this)\n };\n };\n\n HybridCollection.prototype.findOne = function(selector, options, success, error) {\n var step2, _ref;\n if (options == null) {\n options = {};\n }\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n _.defaults(options, this.options);\n step2 = (function(_this) {\n return function(localDoc) {\n var findOptions;\n findOptions = _.cloneDeep(options);\n findOptions.interim = false;\n findOptions.cacheFind = options.cacheFindOne;\n if (selector._id) {\n findOptions.limit = 1;\n } else {\n delete findOptions.limit;\n }\n return _this.find(selector, findOptions).fetch(function(data) {\n if (data.length > 0) {\n if (!_.isEqual(localDoc, data[0])) {\n return success(data[0]);\n }\n } else {\n return success(null);\n }\n }, error);\n };\n })(this);\n if (options.interim || options.shortcut) {\n return this.localCol.findOne(selector, options, function(localDoc) {\n if (localDoc) {\n success(_.cloneDeep(localDoc));\n if (options.shortcut) {\n return;\n }\n }\n return step2(localDoc);\n }, error);\n } else {\n return step2();\n }\n };\n\n HybridCollection.prototype._findFetch = function(selector, options, success, error) {\n var localSuccess, step2;\n _.defaults(options, this.options);\n step2 = (function(_this) {\n return function(localData) {\n var remoteError, remoteOptions, remoteSuccess, timedOut, timer;\n remoteOptions = _.cloneDeep(options);\n if (options.cacheFind) {\n delete remoteOptions.fields;\n }\n timer = null;\n timedOut = false;\n remoteSuccess = function(remoteData) {\n var cacheSuccess, data;\n if (timer) {\n clearTimeout(timer);\n }\n if (timedOut) {\n if (options.cacheFind) {\n _this.localCol.cache(remoteData, selector, options, (function() {}), error);\n }\n return;\n }\n if (options.cacheFind) {\n cacheSuccess = function() {\n var localSuccess2;\n localSuccess2 = function(localData2) {\n if (!_.isEqual(localData, localData2)) {\n return success(localData2);\n }\n };\n return _this.localCol.find(selector, options).fetch(localSuccess2, error);\n };\n return _this.localCol.cache(remoteData, selector, options, cacheSuccess, error);\n } else {\n data = remoteData;\n return _this.localCol.pendingRemoves(function(removes) {\n var removesMap;\n if (removes.length > 0) {\n removesMap = _.object(_.map(removes, function(id) {\n return [id, id];\n }));\n data = _.filter(remoteData, function(doc) {\n return !_.has(removesMap, doc._id);\n });\n }\n return _this.localCol.pendingUpserts(function(upserts) {\n var upsertsMap;\n if (upserts.length > 0) {\n upsertsMap = _.object(_.map(upserts, function(u) {\n return u.doc._id;\n }), _.map(upserts, function(u) {\n return u.doc._id;\n }));\n data = _.filter(data, function(doc) {\n return !_.has(upsertsMap, doc._id);\n });\n data = data.concat(_.pluck(upserts, \"doc\"));\n data = processFind(data, selector, options);\n }\n if (!_.isEqual(localData, data)) {\n return success(data);\n }\n }, error);\n }, error);\n }\n };\n remoteError = function(err) {\n if (timer) {\n clearTimeout(timer);\n }\n if (timedOut) {\n return;\n }\n if (!options.interim) {\n if (options.useLocalOnRemoteError) {\n return _this.localCol.find(selector, options).fetch(success, error);\n } else {\n if (error) {\n return error(err);\n }\n }\n } else {\n\n }\n };\n if (options.timeout) {\n timer = setTimeout(function() {\n timer = null;\n timedOut = true;\n if (!options.interim) {\n if (options.useLocalOnRemoteError) {\n return _this.localCol.find(selector, options).fetch(success, error);\n } else {\n if (error) {\n return error(new Error(\"Remote timed out\"));\n }\n }\n } else {\n\n }\n }, options.timeout);\n }\n return _this.remoteCol.find(selector, remoteOptions).fetch(remoteSuccess, remoteError);\n };\n })(this);\n if (options.interim) {\n localSuccess = function(localData) {\n success(localData);\n return step2(localData);\n };\n return this.localCol.find(selector, options).fetch(localSuccess, error);\n } else {\n return step2();\n }\n };\n\n HybridCollection.prototype.upsert = function(docs, bases, success, error) {\n return this.localCol.upsert(docs, bases, function(result) {\n if (_.isFunction(bases)) {\n success = bases;\n }\n return typeof success === \"function\" ? success(docs) : void 0;\n }, error);\n };\n\n HybridCollection.prototype.remove = function(id, success, error) {\n return this.localCol.remove(id, function() {\n if (success != null) {\n return success();\n }\n }, error);\n };\n\n HybridCollection.prototype.upload = function(success, error) {\n var uploadRemoves, uploadUpserts;\n uploadUpserts = (function(_this) {\n return function(upserts, success, error) {\n var upsert;\n upsert = _.first(upserts);\n if (upsert) {\n return _this.remoteCol.upsert(upsert.doc, upsert.base, function(remoteDoc) {\n return _this.localCol.resolveUpserts([upsert], function() {\n if (remoteDoc) {\n return _this.localCol.cacheOne(remoteDoc, function() {\n return uploadUpserts(_.rest(upserts), success, error);\n }, error);\n } else {\n return _this.localCol.remove(upsert.doc._id, function() {\n return _this.localCol.resolveRemove(upsert.doc._id, function() {\n return uploadUpserts(_.rest(upserts), success, error);\n }, error);\n }, error);\n }\n }, error);\n }, function(err) {\n if (err.status === 410 || err.status === 403) {\n return _this.localCol.remove(upsert.doc._id, function() {\n return _this.localCol.resolveRemove(upsert.doc._id, function() {\n if (err.status === 410) {\n return uploadUpserts(_.rest(upserts), success, error);\n } else {\n return error(err);\n }\n }, error);\n }, error);\n } else {\n return error(err);\n }\n });\n } else {\n return success();\n }\n };\n })(this);\n uploadRemoves = (function(_this) {\n return function(removes, success, error) {\n var remove;\n remove = _.first(removes);\n if (remove) {\n return _this.remoteCol.remove(remove, function() {\n return _this.localCol.resolveRemove(remove, function() {\n return uploadRemoves(_.rest(removes), success, error);\n }, error);\n }, function(err) {\n if (err.status === 410 || err.status === 403) {\n return _this.localCol.resolveRemove(remove, function() {\n if (err.status === 410) {\n return uploadRemoves(_.rest(removes), success, error);\n } else {\n return error(err);\n }\n }, error);\n } else {\n return error(err);\n }\n }, error);\n } else {\n return success();\n }\n };\n })(this);\n return this.localCol.pendingUpserts((function(_this) {\n return function(upserts) {\n if (_this.options.sortUpserts) {\n upserts.sort(_this.options.sortUpserts);\n }\n return uploadUpserts(upserts, function() {\n return _this.localCol.pendingRemoves(function(removes) {\n return uploadRemoves(removes, success, error);\n }, error);\n }, error);\n };\n })(this), error);\n };\n\n return HybridCollection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/HybridDb.js\n// module id = 10\n// module chunks = 0","exports.MemoryDb = require('./lib/MemoryDb');\nexports.LocalStorageDb = require('./lib/LocalStorageDb');\nexports.IndexedDb = require('./lib/IndexedDb');\nexports.WebSQLDb = require('./lib/WebSQLDb');\nexports.RemoteDb = require('./lib/RemoteDb');\nexports.HybridDb = require('./lib/HybridDb');\nexports.ReplicatingDb = require('./lib/ReplicatingDb');\nexports.utils = require('./lib/utils');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 12\n// module chunks = 0","var apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\nexports.setImmediate = setImmediate;\nexports.clearImmediate = clearImmediate;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/node-libs-browser/node_modules/timers-browserify/main.js\n// module id = 13\n// module chunks = 0","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/setimmediate/setImmediate.js\n// module id = 14\n// module chunks = 0","/*!\n * Bowser - a browser detector\n * https://github.com/ded/bowser\n * MIT License | (c) Dustin Diaz 2014\n */\n\n!function (name, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else this[name] = definition()\n}('bowser', function () {\n /**\n * See useragents.js for examples of navigator.userAgent\n */\n\n var t = true\n\n function detect(ua) {\n\n function getFirstMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[1]) || '';\n }\n\n function getSecondMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[2]) || '';\n }\n\n var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()\n , likeAndroid = /like android/i.test(ua)\n , android = !likeAndroid && /android/i.test(ua)\n , edgeVersion = getFirstMatch(/edge\\/(\\d+(\\.\\d+)?)/i)\n , versionIdentifier = getFirstMatch(/version\\/(\\d+(\\.\\d+)?)/i)\n , tablet = /tablet/i.test(ua)\n , mobile = !tablet && /[^-]mobi/i.test(ua)\n , result\n\n if (/opera|opr/i.test(ua)) {\n result = {\n name: 'Opera'\n , opera: t\n , version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/windows phone/i.test(ua)) {\n result = {\n name: 'Windows Phone'\n , windowsphone: t\n }\n if (edgeVersion) {\n result.msedge = t\n result.version = edgeVersion\n }\n else {\n result.msie = t\n result.version = getFirstMatch(/iemobile\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/msie|trident/i.test(ua)) {\n result = {\n name: 'Internet Explorer'\n , msie: t\n , version: getFirstMatch(/(?:msie |rv:)(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/chrome.+? edge/i.test(ua)) {\n result = {\n name: 'Microsoft Edge'\n , msedge: t\n , version: edgeVersion\n }\n }\n else if (/chrome|crios|crmo/i.test(ua)) {\n result = {\n name: 'Chrome'\n , chrome: t\n , version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (iosdevice) {\n result = {\n name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'\n }\n // WTF: version is not part of user agent in web apps\n if (versionIdentifier) {\n result.version = versionIdentifier\n }\n }\n else if (/sailfish/i.test(ua)) {\n result = {\n name: 'Sailfish'\n , sailfish: t\n , version: getFirstMatch(/sailfish\\s?browser\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/seamonkey\\//i.test(ua)) {\n result = {\n name: 'SeaMonkey'\n , seamonkey: t\n , version: getFirstMatch(/seamonkey\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/firefox|iceweasel/i.test(ua)) {\n result = {\n name: 'Firefox'\n , firefox: t\n , version: getFirstMatch(/(?:firefox|iceweasel)[ \\/](\\d+(\\.\\d+)?)/i)\n }\n if (/\\((mobile|tablet);[^\\)]*rv:[\\d\\.]+\\)/i.test(ua)) {\n result.firefoxos = t\n }\n }\n else if (/silk/i.test(ua)) {\n result = {\n name: 'Amazon Silk'\n , silk: t\n , version : getFirstMatch(/silk\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (android) {\n result = {\n name: 'Android'\n , version: versionIdentifier\n }\n }\n else if (/phantom/i.test(ua)) {\n result = {\n name: 'PhantomJS'\n , phantom: t\n , version: getFirstMatch(/phantomjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/blackberry|\\bbb\\d+/i.test(ua) || /rim\\stablet/i.test(ua)) {\n result = {\n name: 'BlackBerry'\n , blackberry: t\n , version: versionIdentifier || getFirstMatch(/blackberry[\\d]+\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/(web|hpw)os/i.test(ua)) {\n result = {\n name: 'WebOS'\n , webos: t\n , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\\/(\\d+(\\.\\d+)?)/i)\n };\n /touchpad\\//i.test(ua) && (result.touchpad = t)\n }\n else if (/bada/i.test(ua)) {\n result = {\n name: 'Bada'\n , bada: t\n , version: getFirstMatch(/dolfin\\/(\\d+(\\.\\d+)?)/i)\n };\n }\n else if (/tizen/i.test(ua)) {\n result = {\n name: 'Tizen'\n , tizen: t\n , version: getFirstMatch(/(?:tizen\\s?)?browser\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n };\n }\n else if (/safari/i.test(ua)) {\n result = {\n name: 'Safari'\n , safari: t\n , version: versionIdentifier\n }\n }\n else {\n result = {\n name: getFirstMatch(/^(.*)\\/(.*) /),\n version: getSecondMatch(/^(.*)\\/(.*) /)\n };\n }\n\n // set webkit or gecko flag for browsers based on these engines\n if (!result.msedge && /(apple)?webkit/i.test(ua)) {\n result.name = result.name || \"Webkit\"\n result.webkit = t\n if (!result.version && versionIdentifier) {\n result.version = versionIdentifier\n }\n } else if (!result.opera && /gecko\\//i.test(ua)) {\n result.name = result.name || \"Gecko\"\n result.gecko = t\n result.version = result.version || getFirstMatch(/gecko\\/(\\d+(\\.\\d+)?)/i)\n }\n\n // set OS flags for platforms that have multiple browsers\n if (!result.msedge && (android || result.silk)) {\n result.android = t\n } else if (iosdevice) {\n result[iosdevice] = t\n result.ios = t\n }\n\n // OS version extraction\n var osVersion = '';\n if (result.windowsphone) {\n osVersion = getFirstMatch(/windows phone (?:os)?\\s?(\\d+(\\.\\d+)*)/i);\n } else if (iosdevice) {\n osVersion = getFirstMatch(/os (\\d+([_\\s]\\d+)*) like mac os x/i);\n osVersion = osVersion.replace(/[_\\s]/g, '.');\n } else if (android) {\n osVersion = getFirstMatch(/android[ \\/-](\\d+(\\.\\d+)*)/i);\n } else if (result.webos) {\n osVersion = getFirstMatch(/(?:web|hpw)os\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.blackberry) {\n osVersion = getFirstMatch(/rim\\stablet\\sos\\s(\\d+(\\.\\d+)*)/i);\n } else if (result.bada) {\n osVersion = getFirstMatch(/bada\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.tizen) {\n osVersion = getFirstMatch(/tizen[\\/\\s](\\d+(\\.\\d+)*)/i);\n }\n if (osVersion) {\n result.osversion = osVersion;\n }\n\n // device type extraction\n var osMajorVersion = osVersion.split('.')[0];\n if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {\n result.tablet = t\n } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) {\n result.mobile = t\n }\n\n // Graded Browser Support\n // http://developer.yahoo.com/yui/articles/gbs\n if (result.msedge ||\n (result.msie && result.version >= 10) ||\n (result.chrome && result.version >= 20) ||\n (result.firefox && result.version >= 20.0) ||\n (result.safari && result.version >= 6) ||\n (result.opera && result.version >= 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] >= 6) ||\n (result.blackberry && result.version >= 10.1)\n ) {\n result.a = t;\n }\n else if ((result.msie && result.version < 10) ||\n (result.chrome && result.version < 20) ||\n (result.firefox && result.version < 20.0) ||\n (result.safari && result.version < 6) ||\n (result.opera && result.version < 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] < 6)\n ) {\n result.c = t\n } else result.x = t\n\n return result\n }\n\n var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '')\n\n bowser.test = function (browserList) {\n for (var i = 0; i < browserList.length; ++i) {\n var browserItem = browserList[i];\n if (typeof browserItem=== 'string') {\n if (browserItem in bowser) {\n return true;\n }\n }\n }\n return false;\n }\n\n /*\n * Set our detect method to the main bowser object so we can\n * reuse it to test other user agents.\n * This is needed to implement future tests.\n */\n bowser._detect = detect;\n\n return bowser\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/bowser/bowser.js\n// module id = 15\n// module chunks = 0","var _ = require('lodash');\n\nEJSON = {}; // Global!\nvar customTypes = {};\n// Add a custom type, using a method of your choice to get to and\n// from a basic JSON-able representation. The factory argument\n// is a function of JSON-able --> your object\n// The type you add must have:\n// - A clone() method, so that Meteor can deep-copy it when necessary.\n// - A equals() method, so that Meteor can compare it\n// - A toJSONValue() method, so that Meteor can serialize it\n// - a typeName() method, to show how to look it up in our type table.\n// It is okay if these methods are monkey-patched on.\nEJSON.addType = function (name, factory) {\n if (_.has(customTypes, name))\n throw new Error(\"Type \" + name + \" already present\");\n customTypes[name] = factory;\n};\n\nvar builtinConverters = [\n { // Date\n matchJSONValue: function (obj) {\n return _.has(obj, '$date') && _.size(obj) === 1;\n },\n matchObject: function (obj) {\n return obj instanceof Date;\n },\n toJSONValue: function (obj) {\n return {$date: obj.getTime()};\n },\n fromJSONValue: function (obj) {\n return new Date(obj.$date);\n }\n },\n { // Binary\n matchJSONValue: function (obj) {\n return _.has(obj, '$binary') && _.size(obj) === 1;\n },\n matchObject: function (obj) {\n return typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array\n || (obj && _.has(obj, '$Uint8ArrayPolyfill'));\n },\n toJSONValue: function (obj) {\n return {$binary: EJSON._base64Encode(obj)};\n },\n fromJSONValue: function (obj) {\n return EJSON._base64Decode(obj.$binary);\n }\n },\n { // Escaping one level\n matchJSONValue: function (obj) {\n return _.has(obj, '$escape') && _.size(obj) === 1;\n },\n matchObject: function (obj) {\n if (_.isEmpty(obj) || _.size(obj) > 2) {\n return false;\n }\n return _.any(builtinConverters, function (converter) {\n return converter.matchJSONValue(obj);\n });\n },\n toJSONValue: function (obj) {\n var newObj = {};\n _.each(obj, function (value, key) {\n newObj[key] = EJSON.toJSONValue(value);\n });\n return {$escape: newObj};\n },\n fromJSONValue: function (obj) {\n var newObj = {};\n _.each(obj.$escape, function (value, key) {\n newObj[key] = EJSON.fromJSONValue(value);\n });\n return newObj;\n }\n },\n { // Custom\n matchJSONValue: function (obj) {\n return _.has(obj, '$type') && _.has(obj, '$value') && _.size(obj) === 2;\n },\n matchObject: function (obj) {\n return EJSON._isCustomType(obj);\n },\n toJSONValue: function (obj) {\n return {$type: obj.typeName(), $value: obj.toJSONValue()};\n },\n fromJSONValue: function (obj) {\n var typeName = obj.$type;\n var converter = customTypes[typeName];\n return converter(obj.$value);\n }\n }\n];\n\nEJSON._isCustomType = function (obj) {\n return obj &&\n typeof obj.toJSONValue === 'function' &&\n typeof obj.typeName === 'function' &&\n _.has(customTypes, obj.typeName());\n};\n\n\n//for both arrays and objects, in-place modification.\nvar adjustTypesToJSONValue =\nEJSON._adjustTypesToJSONValue = function (obj) {\n if (obj === null)\n return null;\n var maybeChanged = toJSONValueHelper(obj);\n if (maybeChanged !== undefined)\n return maybeChanged;\n _.each(obj, function (value, key) {\n if (typeof value !== 'object' && value !== undefined)\n return; // continue\n var changed = toJSONValueHelper(value);\n if (changed) {\n obj[key] = changed;\n return; // on to the next key\n }\n // if we get here, value is an object but not adjustable\n // at this level. recurse.\n adjustTypesToJSONValue(value);\n });\n return obj;\n};\n\n// Either return the JSON-compatible version of the argument, or undefined (if\n// the item isn't itself replaceable, but maybe some fields in it are)\nvar toJSONValueHelper = function (item) {\n for (var i = 0; i < builtinConverters.length; i++) {\n var converter = builtinConverters[i];\n if (converter.matchObject(item)) {\n return converter.toJSONValue(item);\n }\n }\n return undefined;\n};\n\nEJSON.toJSONValue = function (item) {\n var changed = toJSONValueHelper(item);\n if (changed !== undefined)\n return changed;\n if (typeof item === 'object') {\n item = EJSON.clone(item);\n adjustTypesToJSONValue(item);\n }\n return item;\n};\n\n//for both arrays and objects. Tries its best to just\n// use the object you hand it, but may return something\n// different if the object you hand it itself needs changing.\nvar adjustTypesFromJSONValue =\nEJSON._adjustTypesFromJSONValue = function (obj) {\n if (obj === null)\n return null;\n var maybeChanged = fromJSONValueHelper(obj);\n if (maybeChanged !== obj)\n return maybeChanged;\n _.each(obj, function (value, key) {\n if (typeof value === 'object') {\n var changed = fromJSONValueHelper(value);\n if (value !== changed) {\n obj[key] = changed;\n return;\n }\n // if we get here, value is an object but not adjustable\n // at this level. recurse.\n adjustTypesFromJSONValue(value);\n }\n });\n return obj;\n};\n\n// Either return the argument changed to have the non-json\n// rep of itself (the Object version) or the argument itself.\n\n// DOES NOT RECURSE. For actually getting the fully-changed value, use\n// EJSON.fromJSONValue\nvar fromJSONValueHelper = function (value) {\n if (typeof value === 'object' && value !== null) {\n if (_.size(value) <= 2\n && _.all(value, function (v, k) {\n return typeof k === 'string' && k.substr(0, 1) === '$';\n })) {\n for (var i = 0; i < builtinConverters.length; i++) {\n var converter = builtinConverters[i];\n if (converter.matchJSONValue(value)) {\n return converter.fromJSONValue(value);\n }\n }\n }\n }\n return value;\n};\n\nEJSON.fromJSONValue = function (item) {\n var changed = fromJSONValueHelper(item);\n if (changed === item && typeof item === 'object') {\n item = EJSON.clone(item);\n adjustTypesFromJSONValue(item);\n return item;\n } else {\n return changed;\n }\n};\n\nEJSON.stringify = function (item) {\n return JSON.stringify(EJSON.toJSONValue(item));\n};\n\nEJSON.parse = function (item) {\n return EJSON.fromJSONValue(JSON.parse(item));\n};\n\nEJSON.isBinary = function (obj) {\n return (typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array) ||\n (obj && obj.$Uint8ArrayPolyfill);\n};\n\nEJSON.equals = function (a, b, options) {\n var i;\n var keyOrderSensitive = !!(options && options.keyOrderSensitive);\n if (a === b)\n return true;\n if (!a || !b) // if either one is falsy, they'd have to be === to be equal\n return false;\n if (!(typeof a === 'object' && typeof b === 'object'))\n return false;\n if (a instanceof Date && b instanceof Date)\n return a.valueOf() === b.valueOf();\n if (EJSON.isBinary(a) && EJSON.isBinary(b)) {\n if (a.length !== b.length)\n return false;\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i])\n return false;\n }\n return true;\n }\n if (typeof (a.equals) === 'function')\n return a.equals(b, options);\n if (a instanceof Array) {\n if (!(b instanceof Array))\n return false;\n if (a.length !== b.length)\n return false;\n for (i = 0; i < a.length; i++) {\n if (!EJSON.equals(a[i], b[i], options))\n return false;\n }\n return true;\n }\n // fall back to structural equality of objects\n var ret;\n if (keyOrderSensitive) {\n var bKeys = [];\n _.each(b, function (val, x) {\n bKeys.push(x);\n });\n i = 0;\n ret = _.all(a, function (val, x) {\n if (i >= bKeys.length) {\n return false;\n }\n if (x !== bKeys[i]) {\n return false;\n }\n if (!EJSON.equals(val, b[bKeys[i]], options)) {\n return false;\n }\n i++;\n return true;\n });\n return ret && i === bKeys.length;\n } else {\n i = 0;\n ret = _.all(a, function (val, key) {\n if (!_.has(b, key)) {\n return false;\n }\n if (!EJSON.equals(val, b[key], options)) {\n return false;\n }\n i++;\n return true;\n });\n return ret && _.size(b) === i;\n }\n};\n\nEJSON.clone = function (v) {\n var ret;\n if (typeof v !== \"object\")\n return v;\n if (v === null)\n return null; // null has typeof \"object\"\n if (v instanceof Date)\n return new Date(v.getTime());\n if (EJSON.isBinary(v)) {\n ret = EJSON.newBinary(v.length);\n for (var i = 0; i < v.length; i++) {\n ret[i] = v[i];\n }\n return ret;\n }\n if (_.isArray(v) || _.isArguments(v)) {\n // For some reason, _.map doesn't work in this context on Opera (weird test\n // failures).\n ret = [];\n for (i = 0; i < v.length; i++)\n ret[i] = EJSON.clone(v[i]);\n return ret;\n }\n // handle general user-defined typed Objects if they have a clone method\n if (typeof v.clone === 'function') {\n return v.clone();\n }\n // handle other objects\n ret = {};\n _.each(v, function (value, key) {\n ret[key] = EJSON.clone(value);\n });\n return ret;\n};\n\nmodule.exports = EJSON;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/EJSON.js\n// module id = 16\n// module chunks = 0","/*global window:false, self:false, define:false, module:false */\n\n/**\n * @license IDBWrapper - A cross-browser wrapper for IndexedDB\n * Version 1.7.1\n * Copyright (c) 2011 - 2016 Jens Arps\n * http://jensarps.de/\n *\n * Licensed under the MIT (X11) license\n */\n\n(function (name, definition, global) {\n\n 'use strict';\n\n if (typeof define === 'function') {\n define(definition);\n } else if (typeof module !== 'undefined' && module.exports) {\n module.exports = definition();\n } else {\n global[name] = definition();\n }\n})('IDBStore', function () {\n\n 'use strict';\n\n var defaultErrorHandler = function (error) {\n throw error;\n };\n var defaultSuccessHandler = function () {\n };\n\n var defaults = {\n storeName: 'Store',\n storePrefix: 'IDBWrapper-',\n dbVersion: 1,\n keyPath: 'id',\n autoIncrement: true,\n onStoreReady: function () {\n },\n onError: defaultErrorHandler,\n indexes: [],\n implementationPreference: [\n 'indexedDB',\n 'webkitIndexedDB',\n 'mozIndexedDB',\n 'shimIndexedDB'\n ]\n };\n\n /**\n *\n * The IDBStore constructor\n *\n * @constructor\n * @name IDBStore\n * @version 1.7.1\n *\n * @param {Object} [kwArgs] An options object used to configure the store and\n * set callbacks\n * @param {String} [kwArgs.storeName='Store'] The name of the store\n * @param {String} [kwArgs.storePrefix='IDBWrapper-'] A prefix that is\n * internally used to construct the name of the database, which will be\n * kwArgs.storePrefix + kwArgs.storeName\n * @param {Number} [kwArgs.dbVersion=1] The version of the store\n * @param {String} [kwArgs.keyPath='id'] The key path to use. If you want to\n * setup IDBWrapper to work with out-of-line keys, you need to set this to\n * `null`\n * @param {Boolean} [kwArgs.autoIncrement=true] If set to true, IDBStore will\n * automatically make sure a unique keyPath value is present on each object\n * that is stored.\n * @param {Function} [kwArgs.onStoreReady] A callback to be called when the\n * store is ready to be used.\n * @param {Function} [kwArgs.onError=throw] A callback to be called when an\n * error occurred during instantiation of the store.\n * @param {Array} [kwArgs.indexes=[]] An array of indexData objects\n * defining the indexes to use with the store. For every index to be used\n * one indexData object needs to be passed in the array.\n * An indexData object is defined as follows:\n * @param {Object} [kwArgs.indexes.indexData] An object defining the index to\n * use\n * @param {String} kwArgs.indexes.indexData.name The name of the index\n * @param {String} [kwArgs.indexes.indexData.keyPath] The key path of the index\n * @param {Boolean} [kwArgs.indexes.indexData.unique] Whether the index is unique\n * @param {Boolean} [kwArgs.indexes.indexData.multiEntry] Whether the index is multi entry\n * @param {Array} [kwArgs.implementationPreference=['indexedDB','webkitIndexedDB','mozIndexedDB','shimIndexedDB']] An array of strings naming implementations to be used, in order or preference\n * @param {Function} [onStoreReady] A callback to be called when the store\n * is ready to be used.\n * @example\n // create a store for customers with an additional index over the\n // `lastname` property.\n var myCustomerStore = new IDBStore({\n dbVersion: 1,\n storeName: 'customer-index',\n keyPath: 'customerid',\n autoIncrement: true,\n onStoreReady: populateTable,\n indexes: [\n { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }\n ]\n });\n * @example\n // create a generic store\n var myCustomerStore = new IDBStore({\n storeName: 'my-data-store',\n onStoreReady: function(){\n // start working with the store.\n }\n });\n */\n var IDBStore = function (kwArgs, onStoreReady) {\n\n if (typeof onStoreReady == 'undefined' && typeof kwArgs == 'function') {\n onStoreReady = kwArgs;\n }\n if (Object.prototype.toString.call(kwArgs) != '[object Object]') {\n kwArgs = {};\n }\n\n for (var key in defaults) {\n this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];\n }\n\n this.dbName = this.storePrefix + this.storeName;\n this.dbVersion = parseInt(this.dbVersion, 10) || 1;\n\n onStoreReady && (this.onStoreReady = onStoreReady);\n\n var env = typeof window == 'object' ? window : self;\n var availableImplementations = this.implementationPreference.filter(function (implName) {\n return implName in env;\n });\n this.implementation = availableImplementations[0];\n this.idb = env[this.implementation];\n this.keyRange = env.IDBKeyRange || env.webkitIDBKeyRange || env.mozIDBKeyRange;\n\n this.consts = {\n 'READ_ONLY': 'readonly',\n 'READ_WRITE': 'readwrite',\n 'VERSION_CHANGE': 'versionchange',\n 'NEXT': 'next',\n 'NEXT_NO_DUPLICATE': 'nextunique',\n 'PREV': 'prev',\n 'PREV_NO_DUPLICATE': 'prevunique'\n };\n\n this.openDB();\n };\n\n /** @lends IDBStore.prototype */\n var proto = {\n\n /**\n * A pointer to the IDBStore ctor\n *\n * @private\n * @type {Function}\n * @constructs\n */\n constructor: IDBStore,\n\n /**\n * The version of IDBStore\n *\n * @type {String}\n */\n version: '1.7.1',\n\n /**\n * A reference to the IndexedDB object\n *\n * @type {IDBDatabase}\n */\n db: null,\n\n /**\n * The full name of the IndexedDB used by IDBStore, composed of\n * this.storePrefix + this.storeName\n *\n * @type {String}\n */\n dbName: null,\n\n /**\n * The version of the IndexedDB used by IDBStore\n *\n * @type {Number}\n */\n dbVersion: null,\n\n /**\n * A reference to the objectStore used by IDBStore\n *\n * @type {IDBObjectStore}\n */\n store: null,\n\n /**\n * The store name\n *\n * @type {String}\n */\n storeName: null,\n\n /**\n * The prefix to prepend to the store name\n *\n * @type {String}\n */\n storePrefix: null,\n\n /**\n * The key path\n *\n * @type {String}\n */\n keyPath: null,\n\n /**\n * Whether IDBStore uses autoIncrement\n *\n * @type {Boolean}\n */\n autoIncrement: null,\n\n /**\n * The indexes used by IDBStore\n *\n * @type {Array}\n */\n indexes: null,\n\n /**\n * The implemantations to try to use, in order of preference\n *\n * @type {Array}\n */\n implementationPreference: null,\n\n /**\n * The actual implementation being used\n *\n * @type {String}\n */\n implementation: '',\n\n /**\n * The callback to be called when the store is ready to be used\n *\n * @type {Function}\n */\n onStoreReady: null,\n\n /**\n * The callback to be called if an error occurred during instantiation\n * of the store\n *\n * @type {Function}\n */\n onError: null,\n\n /**\n * The internal insertID counter\n *\n * @type {Number}\n * @private\n */\n _insertIdCount: 0,\n\n /**\n * Opens an IndexedDB; called by the constructor.\n *\n * Will check if versions match and compare provided index configuration\n * with existing ones, and update indexes if necessary.\n *\n * Will call this.onStoreReady() if everything went well and the store\n * is ready to use, and this.onError() is something went wrong.\n *\n * @private\n *\n */\n openDB: function () {\n\n var openRequest = this.idb.open(this.dbName, this.dbVersion);\n var preventSuccessCallback = false;\n\n openRequest.onerror = function (errorEvent) {\n\n if (hasVersionError(errorEvent)) {\n this.onError(new Error('The version number provided is lower than the existing one.'));\n } else {\n var error;\n\n if (errorEvent.target.error) {\n error = errorEvent.target.error;\n } else {\n var errorMessage = 'IndexedDB unknown error occurred when opening DB ' + this.dbName + ' version ' + this.dbVersion;\n if ('errorCode' in errorEvent.target) {\n errorMessage += ' with error code ' + errorEvent.target.errorCode;\n }\n error = new Error(errorMessage);\n }\n\n this.onError(error);\n }\n }.bind(this);\n\n openRequest.onsuccess = function (event) {\n\n if (preventSuccessCallback) {\n return;\n }\n\n if (this.db) {\n this.onStoreReady();\n return;\n }\n\n this.db = event.target.result;\n\n if (typeof this.db.version == 'string') {\n this.onError(new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.'));\n return;\n }\n\n if (!this.db.objectStoreNames.contains(this.storeName)) {\n // We should never ever get here.\n // Lets notify the user anyway.\n this.onError(new Error('Object store couldn\\'t be created.'));\n return;\n }\n\n var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n this.store = emptyTransaction.objectStore(this.storeName);\n\n // check indexes\n var existingIndexes = Array.prototype.slice.call(this.getIndexList());\n this.indexes.forEach(function (indexData) {\n var indexName = indexData.name;\n\n if (!indexName) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create index: No index name given.'));\n return;\n }\n\n this.normalizeIndexData(indexData);\n\n if (this.hasIndex(indexName)) {\n // check if it complies\n var actualIndex = this.store.index(indexName);\n var complies = this.indexComplies(actualIndex, indexData);\n if (!complies) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot modify index \"' + indexName + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n existingIndexes.splice(existingIndexes.indexOf(indexName), 1);\n } else {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create new index \"' + indexName + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n }, this);\n\n if (existingIndexes.length) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot delete index(es) \"' + existingIndexes.toString() + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n preventSuccessCallback || this.onStoreReady();\n }.bind(this);\n\n openRequest.onupgradeneeded = function (/* IDBVersionChangeEvent */ event) {\n\n this.db = event.target.result;\n\n if (this.db.objectStoreNames.contains(this.storeName)) {\n this.store = event.target.transaction.objectStore(this.storeName);\n } else {\n var optionalParameters = {autoIncrement: this.autoIncrement};\n if (this.keyPath !== null) {\n optionalParameters.keyPath = this.keyPath;\n }\n this.store = this.db.createObjectStore(this.storeName, optionalParameters);\n }\n\n var existingIndexes = Array.prototype.slice.call(this.getIndexList());\n this.indexes.forEach(function (indexData) {\n var indexName = indexData.name;\n\n if (!indexName) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create index: No index name given.'));\n }\n\n this.normalizeIndexData(indexData);\n\n if (this.hasIndex(indexName)) {\n // check if it complies\n var actualIndex = this.store.index(indexName);\n var complies = this.indexComplies(actualIndex, indexData);\n if (!complies) {\n // index differs, need to delete and re-create\n this.store.deleteIndex(indexName);\n this.store.createIndex(indexName, indexData.keyPath, {\n unique: indexData.unique,\n multiEntry: indexData.multiEntry\n });\n }\n\n existingIndexes.splice(existingIndexes.indexOf(indexName), 1);\n } else {\n this.store.createIndex(indexName, indexData.keyPath, {\n unique: indexData.unique,\n multiEntry: indexData.multiEntry\n });\n }\n\n }, this);\n\n if (existingIndexes.length) {\n existingIndexes.forEach(function (_indexName) {\n this.store.deleteIndex(_indexName);\n }, this);\n }\n\n }.bind(this);\n },\n\n /**\n * Deletes the database used for this store if the IDB implementations\n * provides that functionality.\n *\n * @param {Function} [onSuccess] A callback that is called if deletion\n * was successful.\n * @param {Function} [onError] A callback that is called if deletion\n * failed.\n */\n deleteDatabase: function (onSuccess, onError) {\n if (this.idb.deleteDatabase) {\n this.db.close();\n var deleteRequest = this.idb.deleteDatabase(this.dbName);\n deleteRequest.onsuccess = onSuccess;\n deleteRequest.onerror = onError;\n } else {\n onError(new Error('Browser does not support IndexedDB deleteDatabase!'));\n }\n },\n\n /*********************\n * data manipulation *\n *********************/\n\n /**\n * Puts an object into the store. If an entry with the given id exists,\n * it will be overwritten. This method has a different signature for inline\n * keys and out-of-line keys; please see the examples below.\n *\n * @param {*} [key] The key to store. This is only needed if IDBWrapper\n * is set to use out-of-line keys. For inline keys - the default scenario -\n * this can be omitted.\n * @param {Object} value The data object to store.\n * @param {Function} [onSuccess] A callback that is called if insertion\n * was successful.\n * @param {Function} [onError] A callback that is called if insertion\n * failed.\n * @returns {IDBTransaction} The transaction used for this operation.\n * @example\n // Storing an object, using inline keys (the default scenario):\n var myCustomer = {\n customerid: 2346223,\n lastname: 'Doe',\n firstname: 'John'\n };\n myCustomerStore.put(myCustomer, mySuccessHandler, myErrorHandler);\n // Note that passing success- and error-handlers is optional.\n * @example\n // Storing an object, using out-of-line keys:\n var myCustomer = {\n lastname: 'Doe',\n firstname: 'John'\n };\n myCustomerStore.put(2346223, myCustomer, mySuccessHandler, myErrorHandler);\n // Note that passing success- and error-handlers is optional.\n */\n put: function (key, value, onSuccess, onError) {\n if (this.keyPath !== null) {\n onError = onSuccess;\n onSuccess = value;\n value = key;\n }\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null,\n putRequest;\n\n var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n putTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n putTransaction.onabort = onError;\n putTransaction.onerror = onError;\n\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(value);\n putRequest = putTransaction.objectStore(this.storeName).put(value);\n } else { // out-of-line keys\n putRequest = putTransaction.objectStore(this.storeName).put(value, key);\n }\n putRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n putRequest.onerror = onError;\n\n return putTransaction;\n },\n\n /**\n * Retrieves an object from the store. If no entry exists with the given id,\n * the success handler will be called with null as first and only argument.\n *\n * @param {*} key The id of the object to fetch.\n * @param {Function} [onSuccess] A callback that is called if fetching\n * was successful. Will receive the object as only argument.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n get: function (key, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n getTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getTransaction.onabort = onError;\n getTransaction.onerror = onError;\n var getRequest = getTransaction.objectStore(this.storeName).get(key);\n getRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n getRequest.onerror = onError;\n\n return getTransaction;\n },\n\n /**\n * Removes an object from the store.\n *\n * @param {*} key The id of the object to remove.\n * @param {Function} [onSuccess] A callback that is called if the removal\n * was successful.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n remove: function (key, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n removeTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n removeTransaction.onabort = onError;\n removeTransaction.onerror = onError;\n\n var deleteRequest = removeTransaction.objectStore(this.storeName)['delete'](key);\n deleteRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n deleteRequest.onerror = onError;\n\n return removeTransaction;\n },\n\n /**\n * Runs a batch of put and/or remove operations on the store.\n *\n * @param {Array} dataArray An array of objects containing the operation to run\n * and the data object (for put operations).\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n batch: function (dataArray, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n if (Object.prototype.toString.call(dataArray) != '[object Array]') {\n onError(new Error('dataArray argument must be of type Array.'));\n } else if (dataArray.length === 0) {\n return onSuccess(true);\n }\n\n var count = dataArray.length;\n var called = false;\n var hasSuccess = false;\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n batchTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(hasSuccess);\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n\n var onItemSuccess = function () {\n count--;\n if (count === 0 && !called) {\n called = true;\n hasSuccess = true;\n }\n };\n\n dataArray.forEach(function (operation) {\n var type = operation.type;\n var key = operation.key;\n var value = operation.value;\n\n var onItemError = function (err) {\n batchTransaction.abort();\n if (!called) {\n called = true;\n onError(err, type, key);\n }\n };\n\n if (type == 'remove') {\n var deleteRequest = batchTransaction.objectStore(this.storeName)['delete'](key);\n deleteRequest.onsuccess = onItemSuccess;\n deleteRequest.onerror = onItemError;\n } else if (type == 'put') {\n var putRequest;\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(value);\n putRequest = batchTransaction.objectStore(this.storeName).put(value);\n } else { // out-of-line keys\n putRequest = batchTransaction.objectStore(this.storeName).put(value, key);\n }\n putRequest.onsuccess = onItemSuccess;\n putRequest.onerror = onItemError;\n }\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Takes an array of objects and stores them in a single transaction.\n *\n * @param {Array} dataArray An array of objects to store\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n putBatch: function (dataArray, onSuccess, onError) {\n var batchData = dataArray.map(function (item) {\n return {type: 'put', value: item};\n });\n\n return this.batch(batchData, onSuccess, onError);\n },\n\n /**\n * Like putBatch, takes an array of objects and stores them in a single\n * transaction, but allows processing of the result values. Returns the\n * processed records containing the key for newly created records to the\n * onSuccess calllback instead of only returning true or false for success.\n * In addition, added the option for the caller to specify a key field that\n * should be set to the newly created key.\n *\n * @param {Array} dataArray An array of objects to store\n * @param {Object} [options] An object containing optional options\n * @param {String} [options.keyField=this.keyPath] Specifies a field in the record to update\n * with the auto-incrementing key. Defaults to the store's keyPath.\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n *\n */\n upsertBatch: function (dataArray, options, onSuccess, onError) {\n // handle `dataArray, onSuccess, onError` signature\n if (typeof options == 'function') {\n onSuccess = options;\n onError = onSuccess;\n options = {};\n }\n\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n options || (options = {});\n\n if (Object.prototype.toString.call(dataArray) != '[object Array]') {\n onError(new Error('dataArray argument must be of type Array.'));\n }\n\n var keyField = options.keyField || this.keyPath;\n var count = dataArray.length;\n var called = false;\n var hasSuccess = false;\n var index = 0; // assume success callbacks are executed in order\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n batchTransaction.oncomplete = function () {\n if (hasSuccess) {\n onSuccess(dataArray);\n } else {\n onError(false);\n }\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n var onItemSuccess = function (event) {\n var record = dataArray[index++];\n record[keyField] = event.target.result;\n\n count--;\n if (count === 0 && !called) {\n called = true;\n hasSuccess = true;\n }\n };\n\n dataArray.forEach(function (record) {\n var key = record.key;\n\n var onItemError = function (err) {\n batchTransaction.abort();\n if (!called) {\n called = true;\n onError(err);\n }\n };\n\n var putRequest;\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(record);\n putRequest = batchTransaction.objectStore(this.storeName).put(record);\n } else { // out-of-line keys\n putRequest = batchTransaction.objectStore(this.storeName).put(record, key);\n }\n putRequest.onsuccess = onItemSuccess;\n putRequest.onerror = onItemError;\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Takes an array of keys and removes matching objects in a single\n * transaction.\n *\n * @param {Array} keyArray An array of keys to remove\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n removeBatch: function (keyArray, onSuccess, onError) {\n var batchData = keyArray.map(function (key) {\n return {type: 'remove', key: key};\n });\n\n return this.batch(batchData, onSuccess, onError);\n },\n\n /**\n * Takes an array of keys and fetches matching objects\n *\n * @param {Array} keyArray An array of keys identifying the objects to fetch\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @param {String} [arrayType='sparse'] The type of array to pass to the\n * success handler. May be one of 'sparse', 'dense' or 'skip'. Defaults to\n * 'sparse'. This parameter specifies how to handle the situation if a get\n * operation did not throw an error, but there was no matching object in\n * the database. In most cases, 'sparse' provides the most desired\n * behavior. See the examples for details.\n * @returns {IDBTransaction} The transaction used for this operation.\n * @example\n // given that there are two objects in the database with the keypath\n // values 1 and 2, and the call looks like this:\n myStore.getBatch([1, 5, 2], onError, function (data) { … }, arrayType);\n\n // this is what the `data` array will be like:\n\n // arrayType == 'sparse':\n // data is a sparse array containing two entries and having a length of 3:\n [Object, 2: Object]\n 0: Object\n 2: Object\n length: 3\n // calling forEach on data will result in the callback being called two\n // times, with the index parameter matching the index of the key in the\n // keyArray.\n\n // arrayType == 'dense':\n // data is a dense array containing three entries and having a length of 3,\n // where data[1] is of type undefined:\n [Object, undefined, Object]\n 0: Object\n 1: undefined\n 2: Object\n length: 3\n // calling forEach on data will result in the callback being called three\n // times, with the index parameter matching the index of the key in the\n // keyArray, but the second call will have undefined as first argument.\n\n // arrayType == 'skip':\n // data is a dense array containing two entries and having a length of 2:\n [Object, Object]\n 0: Object\n 1: Object\n length: 2\n // calling forEach on data will result in the callback being called two\n // times, with the index parameter not matching the index of the key in the\n // keyArray.\n */\n getBatch: function (keyArray, onSuccess, onError, arrayType) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n arrayType || (arrayType = 'sparse');\n\n if (Object.prototype.toString.call(keyArray) != '[object Array]') {\n onError(new Error('keyArray argument must be of type Array.'));\n } else if (keyArray.length === 0) {\n return onSuccess([]);\n }\n\n var data = [];\n var count = keyArray.length;\n var called = false;\n var hasSuccess = false;\n var result = null;\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n batchTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n var onItemSuccess = function (event) {\n if (event.target.result || arrayType == 'dense') {\n data.push(event.target.result);\n } else if (arrayType == 'sparse') {\n data.length++;\n }\n count--;\n if (count === 0) {\n called = true;\n hasSuccess = true;\n result = data;\n }\n };\n\n keyArray.forEach(function (key) {\n\n var onItemError = function (err) {\n called = true;\n result = err;\n onError(err);\n batchTransaction.abort();\n };\n\n var getRequest = batchTransaction.objectStore(this.storeName).get(key);\n getRequest.onsuccess = onItemSuccess;\n getRequest.onerror = onItemError;\n\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Fetches all entries in the store.\n *\n * @param {Function} [onSuccess] A callback that is called if the operation\n * was successful. Will receive an array of objects.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n getAll: function (onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n var store = getAllTransaction.objectStore(this.storeName);\n if (store.getAll) {\n this._getAllNative(getAllTransaction, store, onSuccess, onError);\n } else {\n this._getAllCursor(getAllTransaction, store, onSuccess, onError);\n }\n\n return getAllTransaction;\n },\n\n /**\n * Implements getAll for IDB implementations that have a non-standard\n * getAll() method.\n *\n * @param {IDBTransaction} getAllTransaction An open READ transaction.\n * @param {IDBObjectStore} store A reference to the store.\n * @param {Function} onSuccess A callback that will be called if the\n * operation was successful.\n * @param {Function} onError A callback that will be called if an\n * error occurred during the operation.\n * @private\n */\n _getAllNative: function (getAllTransaction, store, onSuccess, onError) {\n var hasSuccess = false,\n result = null;\n\n getAllTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getAllTransaction.onabort = onError;\n getAllTransaction.onerror = onError;\n\n var getAllRequest = store.getAll();\n getAllRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n getAllRequest.onerror = onError;\n },\n\n /**\n * Implements getAll for IDB implementations that do not have a getAll()\n * method.\n *\n * @param {IDBTransaction} getAllTransaction An open READ transaction.\n * @param {IDBObjectStore} store A reference to the store.\n * @param {Function} onSuccess A callback that will be called if the\n * operation was successful.\n * @param {Function} onError A callback that will be called if an\n * error occurred during the operation.\n * @private\n */\n _getAllCursor: function (getAllTransaction, store, onSuccess, onError) {\n var all = [],\n hasSuccess = false,\n result = null;\n\n getAllTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getAllTransaction.onabort = onError;\n getAllTransaction.onerror = onError;\n\n var cursorRequest = store.openCursor();\n cursorRequest.onsuccess = function (event) {\n var cursor = event.target.result;\n if (cursor) {\n all.push(cursor.value);\n cursor['continue']();\n }\n else {\n hasSuccess = true;\n result = all;\n }\n };\n cursorRequest.onError = onError;\n },\n\n /**\n * Clears the store, i.e. deletes all entries in the store.\n *\n * @param {Function} [onSuccess] A callback that will be called if the\n * operation was successful.\n * @param {Function} [onError] A callback that will be called if an\n * error occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n clear: function (onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n clearTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n clearTransaction.onabort = onError;\n clearTransaction.onerror = onError;\n\n var clearRequest = clearTransaction.objectStore(this.storeName).clear();\n clearRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n clearRequest.onerror = onError;\n\n return clearTransaction;\n },\n\n /**\n * Checks if an id property needs to present on a object and adds one if\n * necessary.\n *\n * @param {Object} dataObj The data object that is about to be stored\n * @private\n */\n _addIdPropertyIfNeeded: function (dataObj) {\n if (typeof dataObj[this.keyPath] == 'undefined') {\n dataObj[this.keyPath] = this._insertIdCount++ + Date.now();\n }\n },\n\n /************\n * indexing *\n ************/\n\n /**\n * Returns a DOMStringList of index names of the store.\n *\n * @return {DOMStringList} The list of index names\n */\n getIndexList: function () {\n return this.store.indexNames;\n },\n\n /**\n * Checks if an index with the given name exists in the store.\n *\n * @param {String} indexName The name of the index to look for\n * @return {Boolean} Whether the store contains an index with the given name\n */\n hasIndex: function (indexName) {\n return this.store.indexNames.contains(indexName);\n },\n\n /**\n * Normalizes an object containing index data and assures that all\n * properties are set.\n *\n * @param {Object} indexData The index data object to normalize\n * @param {String} indexData.name The name of the index\n * @param {String} [indexData.keyPath] The key path of the index\n * @param {Boolean} [indexData.unique] Whether the index is unique\n * @param {Boolean} [indexData.multiEntry] Whether the index is multi entry\n */\n normalizeIndexData: function (indexData) {\n indexData.keyPath = indexData.keyPath || indexData.name;\n indexData.unique = !!indexData.unique;\n indexData.multiEntry = !!indexData.multiEntry;\n },\n\n /**\n * Checks if an actual index complies with an expected index.\n *\n * @param {IDBIndex} actual The actual index found in the store\n * @param {Object} expected An Object describing an expected index\n * @return {Boolean} Whether both index definitions are identical\n */\n indexComplies: function (actual, expected) {\n var complies = ['keyPath', 'unique', 'multiEntry'].every(function (key) {\n // IE10 returns undefined for no multiEntry\n if (key == 'multiEntry' && actual[key] === undefined && expected[key] === false) {\n return true;\n }\n // Compound keys\n if (key == 'keyPath' && Object.prototype.toString.call(expected[key]) == '[object Array]') {\n var exp = expected.keyPath;\n var act = actual.keyPath;\n\n // IE10 can't handle keyPath sequences and stores them as a string.\n // The index will be unusable there, but let's still return true if\n // the keyPath sequence matches.\n if (typeof act == 'string') {\n return exp.toString() == act;\n }\n\n // Chrome/Opera stores keyPath squences as DOMStringList, Firefox\n // as Array\n if (!(typeof act.contains == 'function' || typeof act.indexOf == 'function')) {\n return false;\n }\n\n if (act.length !== exp.length) {\n return false;\n }\n\n for (var i = 0, m = exp.length; i < m; i++) {\n if (!( (act.contains && act.contains(exp[i])) || act.indexOf(exp[i] !== -1) )) {\n return false;\n }\n }\n return true;\n }\n return expected[key] == actual[key];\n });\n return complies;\n },\n\n /**********\n * cursor *\n **********/\n\n /**\n * Iterates over the store using the given options and calling onItem\n * for each entry matching the options.\n *\n * @param {Function} onItem A callback to be called for each match\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {String} [options.order=ASC] The order in which to provide the\n * results, can be 'DESC' or 'ASC'\n * @param {Boolean} [options.autoContinue=true] Whether to automatically\n * iterate the cursor to the next result\n * @param {Boolean} [options.filterDuplicates=false] Whether to exclude\n * duplicate matches\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Boolean} [options.writeAccess=false] Whether grant write access\n * to the store in the onItem callback\n * @param {Function} [options.onEnd=null] A callback to be called after\n * iteration has ended\n * @param {Function} [options.onError=throw] A callback to be called\n * if an error occurred during the operation.\n * @param {Number} [options.limit=Infinity] Limit the number of returned\n * results to this number\n * @param {Number} [options.offset=0] Skip the provided number of results\n * in the resultset\n * @param {Boolean} [options.allowItemRejection=false] Allows the onItem\n * function to return a Boolean to accept or reject the current item\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n iterate: function (onItem, options) {\n options = mixin({\n index: null,\n order: 'ASC',\n autoContinue: true,\n filterDuplicates: false,\n keyRange: null,\n writeAccess: false,\n onEnd: null,\n onError: defaultErrorHandler,\n limit: Infinity,\n offset: 0,\n allowItemRejection: false\n }, options || {});\n\n var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';\n if (options.filterDuplicates) {\n directionType += '_NO_DUPLICATE';\n }\n\n var hasSuccess = false;\n var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);\n var cursorTarget = cursorTransaction.objectStore(this.storeName);\n if (options.index) {\n cursorTarget = cursorTarget.index(options.index);\n }\n var recordCount = 0;\n\n cursorTransaction.oncomplete = function () {\n if (!hasSuccess) {\n options.onError(null);\n return;\n }\n if (options.onEnd) {\n options.onEnd();\n } else {\n onItem(null);\n }\n };\n cursorTransaction.onabort = options.onError;\n cursorTransaction.onerror = options.onError;\n\n var cursorRequest = cursorTarget.openCursor(options.keyRange, this.consts[directionType]);\n cursorRequest.onerror = options.onError;\n cursorRequest.onsuccess = function (event) {\n var cursor = event.target.result;\n if (cursor) {\n if (options.offset) {\n cursor.advance(options.offset);\n options.offset = 0;\n } else {\n var onItemReturn = onItem(cursor.value, cursor, cursorTransaction);\n if (!options.allowItemRejection || onItemReturn !== false) {\n recordCount++;\n }\n if (options.autoContinue) {\n if (recordCount + options.offset < options.limit) {\n cursor['continue']();\n } else {\n hasSuccess = true;\n }\n }\n }\n } else {\n hasSuccess = true;\n }\n };\n\n return cursorTransaction;\n },\n\n /**\n * Runs a query against the store and passes an array containing matched\n * objects to the success handler.\n *\n * @param {Function} onSuccess A callback to be called when the operation\n * was successful.\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {String} [options.order=ASC] The order in which to provide the\n * results, can be 'DESC' or 'ASC'\n * @param {Boolean} [options.filterDuplicates=false] Whether to exclude\n * duplicate matches\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Function} [options.onError=throw] A callback to be called\n * if an error occurred during the operation.\n * @param {Number} [options.limit=Infinity] Limit the number of returned\n * results to this number\n * @param {Number} [options.offset=0] Skip the provided number of results\n * in the resultset\n * @param {Function} [options.filter=null] A custom filter function to\n * apply to query resuts before returning. Must return `false` to reject\n * an item. Can be combined with keyRanges.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n query: function (onSuccess, options) {\n var result = [],\n processedItems = 0;\n options = options || {};\n options.autoContinue = true;\n options.writeAccess = false;\n options.allowItemRejection = !!options.filter;\n options.onEnd = function () {\n onSuccess(result, processedItems);\n };\n return this.iterate(function (item) {\n processedItems++;\n var accept = options.filter ? options.filter(item) : true;\n if (accept !== false) {\n result.push(item);\n }\n return accept;\n }, options);\n },\n\n /**\n *\n * Runs a query against the store, but only returns the number of matches\n * instead of the matches itself.\n *\n * @param {Function} onSuccess A callback to be called if the opration\n * was successful.\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Function} [options.onError=throw] A callback to be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n count: function (onSuccess, options) {\n\n options = mixin({\n index: null,\n keyRange: null\n }, options || {});\n\n var onError = options.onError || defaultErrorHandler;\n\n var hasSuccess = false,\n result = null;\n\n var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n cursorTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n cursorTransaction.onabort = onError;\n cursorTransaction.onerror = onError;\n\n var cursorTarget = cursorTransaction.objectStore(this.storeName);\n if (options.index) {\n cursorTarget = cursorTarget.index(options.index);\n }\n var countRequest = cursorTarget.count(options.keyRange);\n countRequest.onsuccess = function (evt) {\n hasSuccess = true;\n result = evt.target.result;\n };\n countRequest.onError = onError;\n\n return cursorTransaction;\n },\n\n /**************/\n /* key ranges */\n /**************/\n\n /**\n * Creates a key range using specified options. This key range can be\n * handed over to the count() and iterate() methods.\n *\n * Note: You must provide at least one or both of \"lower\" or \"upper\" value.\n *\n * @param {Object} options The options for the key range to create\n * @param {*} [options.lower] The lower bound\n * @param {Boolean} [options.excludeLower] Whether to exclude the lower\n * bound passed in options.lower from the key range\n * @param {*} [options.upper] The upper bound\n * @param {Boolean} [options.excludeUpper] Whether to exclude the upper\n * bound passed in options.upper from the key range\n * @param {*} [options.only] A single key value. Use this if you need a key\n * range that only includes one value for a key. Providing this\n * property invalidates all other properties.\n * @return {IDBKeyRange} The IDBKeyRange representing the specified options\n */\n makeKeyRange: function (options) {\n /*jshint onecase:true */\n var keyRange,\n hasLower = typeof options.lower != 'undefined',\n hasUpper = typeof options.upper != 'undefined',\n isOnly = typeof options.only != 'undefined';\n\n switch (true) {\n case isOnly:\n keyRange = this.keyRange.only(options.only);\n break;\n case hasLower && hasUpper:\n keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);\n break;\n case hasLower:\n keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);\n break;\n case hasUpper:\n keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);\n break;\n default:\n throw new Error('Cannot create KeyRange. Provide one or both of \"lower\" or \"upper\" value, or an \"only\" value.');\n }\n\n return keyRange;\n\n }\n\n };\n\n /** helpers **/\n var empty = {};\n\n function mixin (target, source) {\n var name, s;\n for (name in source) {\n s = source[name];\n if (s !== empty[name] && s !== target[name]) {\n target[name] = s;\n }\n }\n return target;\n }\n\n function hasVersionError(errorEvent) {\n if ('error' in errorEvent.target) {\n return errorEvent.target.error.name == 'VersionError';\n } else if ('errorCode' in errorEvent.target) {\n return errorEvent.target.errorCode == 12;\n }\n return false;\n }\n\n IDBStore.prototype = proto;\n IDBStore.version = proto.version;\n\n return IDBStore;\n\n}, this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/idb-wrapper/idbstore.js\n// module id = 17\n// module chunks = 0","var $, Collection, RemoteDb, async, jQueryHttpClient, utils, _;\n\n_ = require('lodash');\n\n$ = require('jquery');\n\nasync = require('async');\n\nutils = require('./utils');\n\njQueryHttpClient = require('./jQueryHttpClient');\n\nmodule.exports = RemoteDb = (function() {\n function RemoteDb(url, client, httpClient) {\n this.url = url;\n this.client = client;\n this.collections = {};\n this.httpClient = httpClient || jQueryHttpClient;\n }\n\n RemoteDb.prototype.addCollection = function(name, options, success, error) {\n var collection, url, _ref;\n if (options == null) {\n options = {};\n }\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n url = options.url || (this.url + name);\n collection = new Collection(name, url, this.client, this.httpClient);\n this[name] = collection;\n this.collections[name] = collection;\n if (success != null) {\n return success();\n }\n };\n\n RemoteDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n if (success != null) {\n return success();\n }\n };\n\n RemoteDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return RemoteDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, url, client, httpClient) {\n this.name = name;\n this.url = url;\n this.client = client;\n this.httpClient = httpClient;\n }\n\n Collection.prototype.find = function(selector, options) {\n if (options == null) {\n options = {};\n }\n return {\n fetch: (function(_this) {\n return function(success, error) {\n var params;\n params = {};\n if (options.sort) {\n params.sort = JSON.stringify(options.sort);\n }\n if (options.limit) {\n params.limit = options.limit;\n }\n if (options.skip) {\n params.skip = options.skip;\n }\n if (options.fields) {\n params.fields = JSON.stringify(options.fields);\n }\n if (_this.client) {\n params.client = _this.client;\n }\n params.selector = JSON.stringify(selector || {});\n if ((typeof navigator !== \"undefined\" && navigator !== null) && navigator.userAgent.toLowerCase().indexOf('android 2.3') !== -1) {\n params._ = new Date().getTime();\n }\n return _this.httpClient(\"GET\", _this.url, params, null, success, error);\n };\n })(this)\n };\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n var params, _ref;\n if (options == null) {\n options = {};\n }\n if (_.isFunction(options)) {\n _ref = [{}, options, success], options = _ref[0], success = _ref[1], error = _ref[2];\n }\n params = {};\n if (options.sort) {\n params.sort = JSON.stringify(options.sort);\n }\n params.limit = 1;\n if (this.client) {\n params.client = this.client;\n }\n params.selector = JSON.stringify(selector || {});\n if ((typeof navigator !== \"undefined\" && navigator !== null) && navigator.userAgent.toLowerCase().indexOf('android 2.3') !== -1) {\n params._ = new Date().getTime();\n }\n return this.httpClient(\"GET\", this.url, params, null, function(results) {\n if (results && results.length > 0) {\n return success(results[0]);\n } else {\n return success(null);\n }\n }, error);\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var items, results, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n if (!this.client) {\n throw new Error(\"Client required to upsert\");\n }\n results = [];\n return async.eachLimit(items, 8, (function(_this) {\n return function(item, cb) {\n var params;\n if (!item.doc._id) {\n item.doc._id = utils.createUid();\n }\n params = {\n client: _this.client\n };\n if ((typeof navigator !== \"undefined\" && navigator !== null) && navigator.userAgent.toLowerCase().indexOf('android 2.3') !== -1) {\n params._ = new Date().getTime();\n }\n if (item.base) {\n return _this.httpClient(\"PATCH\", _this.url + \"/\" + item.doc._id, params, item, function(result) {\n results.push(result);\n return cb();\n }, function(err) {\n return cb(err);\n });\n } else {\n return _this.httpClient(\"POST\", _this.url, params, item.doc, function(result) {\n results.push(result);\n return cb();\n }, function(err) {\n return cb(err);\n });\n }\n };\n })(this), function(err) {\n if (err) {\n if (error) {\n error(err);\n }\n return;\n }\n if (_.isArray(docs)) {\n if (success) {\n return success(results);\n }\n } else {\n if (success) {\n return success(results[0]);\n }\n }\n });\n };\n\n Collection.prototype.remove = function(id, success, error) {\n var params;\n if (!this.client) {\n throw new Error(\"Client required to remove\");\n }\n params = {\n client: this.client\n };\n return this.httpClient(\"DELETE\", this.url + \"/\" + id, params, null, success, function(err) {\n if (err.status === 410) {\n return success();\n } else {\n return error(err);\n }\n });\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/RemoteDb.js\n// module id = 18\n// module chunks = 0","module.exports = $;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"$\"\n// module id = 19\n// module chunks = 0","module.exports = function(method, url, params, data, success, error) {\n var fullUrl, req;\n fullUrl = url + \"?\" + $.param(params);\n if (method === \"GET\") {\n req = $.ajax(fullUrl, {\n dataType: \"json\",\n timeout: 180000\n });\n } else if (method === \"DELETE\") {\n req = $.ajax(fullUrl, {\n type: 'DELETE',\n timeout: 60000\n });\n } else if (method === \"POST\" || method === \"PATCH\") {\n req = $.ajax(fullUrl, {\n data: JSON.stringify(data),\n contentType: 'application/json',\n timeout: 60000,\n type: method\n });\n } else {\n throw new Error(\"Unknown method \" + method);\n }\n req.done(function(response, textStatus, jqXHR) {\n return success(response || null);\n });\n return req.fail(function(jqXHR, textStatus, errorThrown) {\n if (error) {\n return error(jqXHR);\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/jQueryHttpClient.js\n// module id = 20\n// module chunks = 0","var Collection, ReplicatingDb, compileSort, utils, _;\n\n_ = require('lodash');\n\nutils = require('./utils');\n\ncompileSort = require('./selector').compileSort;\n\nmodule.exports = ReplicatingDb = (function() {\n function ReplicatingDb(masterDb, replicaDb) {\n this.collections = {};\n this.masterDb = masterDb;\n this.replicaDb = replicaDb;\n }\n\n ReplicatingDb.prototype.addCollection = function(name, success, error) {\n var collection;\n collection = new Collection(name, this.masterDb[name], this.replicaDb[name]);\n this[name] = collection;\n this.collections[name] = collection;\n if (success != null) {\n return success();\n }\n };\n\n ReplicatingDb.prototype.removeCollection = function(name, success, error) {\n delete this[name];\n delete this.collections[name];\n if (success != null) {\n return success();\n }\n };\n\n ReplicatingDb.prototype.getCollectionNames = function() {\n return _.keys(this.collections);\n };\n\n return ReplicatingDb;\n\n})();\n\nCollection = (function() {\n function Collection(name, masterCol, replicaCol) {\n this.name = name;\n this.masterCol = masterCol;\n this.replicaCol = replicaCol;\n }\n\n Collection.prototype.find = function(selector, options) {\n return this.masterCol.find(selector, options);\n };\n\n Collection.prototype.findOne = function(selector, options, success, error) {\n return this.masterCol.findOne(selector, options, success, error);\n };\n\n Collection.prototype.upsert = function(docs, bases, success, error) {\n var items, _ref;\n _ref = utils.regularizeUpsert(docs, bases, success, error), items = _ref[0], success = _ref[1], error = _ref[2];\n return this.masterCol.upsert(_.pluck(items, \"doc\"), _.pluck(items, \"base\"), (function(_this) {\n return function() {\n return _this.replicaCol.upsert(_.pluck(items, \"doc\"), _.pluck(items, \"base\"), function(results) {\n return success(docs);\n }, error);\n };\n })(this), error);\n };\n\n Collection.prototype.remove = function(id, success, error) {\n return this.masterCol.remove(id, (function(_this) {\n return function() {\n return _this.replicaCol.remove(id, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.cache = function(docs, selector, options, success, error) {\n var docsMap, sort;\n docsMap = _.indexBy(docs, \"_id\");\n if (options.sort) {\n sort = compileSort(options.sort);\n }\n return this.masterCol.find(selector, options).fetch((function(_this) {\n return function(results) {\n var doc, performCaches, performUncaches, result, resultsMap, toCache, toUncache, _i, _j, _len, _len1;\n resultsMap = _.indexBy(results, \"_id\");\n toCache = [];\n for (_i = 0, _len = docs.length; _i < _len; _i++) {\n doc = docs[_i];\n result = resultsMap[doc._id];\n if (!result) {\n toCache.push(doc);\n continue;\n }\n if (doc._rev && result._rev && doc._rev <= result._rev) {\n continue;\n }\n if (!_.isEqual(doc, result)) {\n toCache.push(doc);\n }\n }\n toUncache = [];\n for (_j = 0, _len1 = results.length; _j < _len1; _j++) {\n result = results[_j];\n if (options.limit && docs.length === options.limit) {\n if (options.sort && sort(result, _.last(docs)) >= 0) {\n continue;\n }\n if (!options.sort) {\n continue;\n }\n }\n if (!docsMap[result._id]) {\n toUncache.push(result._id);\n }\n }\n performCaches = function(next) {\n if (toCache.length > 0) {\n return _this.masterCol.cacheList(toCache, function() {\n return _this.replicaCol.cacheList(toCache, function() {\n return next();\n }, error);\n }, error);\n } else {\n return next();\n }\n };\n performUncaches = function(next) {\n if (toUncache.length > 0) {\n return _this.masterCol.uncacheList(toUncache, function() {\n return _this.replicaCol.uncacheList(toUncache, function() {\n return next();\n }, error);\n }, error);\n } else {\n return next();\n }\n };\n return performCaches(function() {\n return performUncaches(function() {\n if (success != null) {\n success();\n }\n });\n });\n };\n })(this), error);\n };\n\n Collection.prototype.pendingUpserts = function(success, error) {\n return this.masterCol.pendingUpserts(success, error);\n };\n\n Collection.prototype.pendingRemoves = function(success, error) {\n return this.masterCol.pendingRemoves(success, error);\n };\n\n Collection.prototype.resolveUpserts = function(upserts, success, error) {\n return this.masterCol.resolveUpserts(upserts, (function(_this) {\n return function() {\n return _this.replicaCol.resolveUpserts(upserts, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.resolveRemove = function(id, success, error) {\n return this.masterCol.resolveRemove(id, (function(_this) {\n return function() {\n return _this.replicaCol.resolveRemove(id, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.seed = function(docs, success, error) {\n return this.masterCol.seed(docs, (function(_this) {\n return function() {\n return _this.replicaCol.seed(docs, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.cacheOne = function(doc, success, error) {\n return this.masterCol.cacheOne(doc, (function(_this) {\n return function() {\n return _this.replicaCol.cacheOne(doc, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.cacheList = function(docs, success, error) {\n return this.masterCol.cacheList(docs, (function(_this) {\n return function() {\n return _this.replicaCol.cacheList(docs, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.uncache = function(selector, success, error) {\n return this.masterCol.uncache(selector, (function(_this) {\n return function() {\n return _this.replicaCol.uncache(selector, success, error);\n };\n })(this), error);\n };\n\n Collection.prototype.uncacheList = function(ids, success, error) {\n return this.masterCol.uncacheList(ids, (function(_this) {\n return function() {\n return _this.replicaCol.uncacheList(ids, success, error);\n };\n })(this), error);\n };\n\n return Collection;\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/ReplicatingDb.js\n// module id = 21\n// module chunks = 0"],"sourceRoot":""}