{"version":3,"file":"vendors-536eaa00.981ca8458d389c9a476a.bundle.js","mappings":";;;;;;;;;AAAA;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;;;;;;;;;;;;;;;;;;;;AC7CA;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://latinera/./node_modules/fast-deep-equal/index.js","webpack://latinera/./node_modules/dexie/dist/modern/dexie.mjs"],"sourcesContent":["'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/*\n * Dexie.js - a minimalistic wrapper for IndexedDB\n * ===============================================\n *\n * By David Fahlander, david.fahlander@gmail.com\n *\n * Version 3.2.7, Wed Mar 20 2024\n *\n * https://dexie.org\n *\n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/\n */\n \nconst _global = typeof globalThis !== 'undefined' ? globalThis :\n typeof self !== 'undefined' ? self :\n typeof window !== 'undefined' ? window :\n global;\n\nconst keys = Object.keys;\nconst isArray = Array.isArray;\nif (typeof Promise !== 'undefined' && !_global.Promise) {\n _global.Promise = Promise;\n}\nfunction extend(obj, extension) {\n if (typeof extension !== 'object')\n return obj;\n keys(extension).forEach(function (key) {\n obj[key] = extension[key];\n });\n return obj;\n}\nconst getProto = Object.getPrototypeOf;\nconst _hasOwn = {}.hasOwnProperty;\nfunction hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\nfunction props(proto, extension) {\n if (typeof extension === 'function')\n extension = extension(getProto(proto));\n (typeof Reflect === \"undefined\" ? keys : Reflect.ownKeys)(extension).forEach(key => {\n setProp(proto, key, extension[key]);\n });\n}\nconst defineProperty = Object.defineProperty;\nfunction setProp(obj, prop, functionOrGetSet, options) {\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ?\n { get: functionOrGetSet.get, set: functionOrGetSet.set, configurable: true } :\n { value: functionOrGetSet, configurable: true, writable: true }, options));\n}\nfunction derive(Child) {\n return {\n from: function (Parent) {\n Child.prototype = Object.create(Parent.prototype);\n setProp(Child.prototype, \"constructor\", Child);\n return {\n extend: props.bind(null, Child.prototype)\n };\n }\n };\n}\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nfunction getPropertyDescriptor(obj, prop) {\n const pd = getOwnPropertyDescriptor(obj, prop);\n let proto;\n return pd || (proto = getProto(obj)) && getPropertyDescriptor(proto, prop);\n}\nconst _slice = [].slice;\nfunction slice(args, start, end) {\n return _slice.call(args, start, end);\n}\nfunction override(origFunc, overridedFactory) {\n return overridedFactory(origFunc);\n}\nfunction assert(b) {\n if (!b)\n throw new Error(\"Assertion Failed\");\n}\nfunction asap$1(fn) {\n if (_global.setImmediate)\n setImmediate(fn);\n else\n setTimeout(fn, 0);\n}\nfunction arrayToObject(array, extractor) {\n return array.reduce((result, item, i) => {\n var nameAndValue = extractor(item, i);\n if (nameAndValue)\n result[nameAndValue[0]] = nameAndValue[1];\n return result;\n }, {});\n}\nfunction tryCatch(fn, onerror, args) {\n try {\n fn.apply(null, args);\n }\n catch (ex) {\n onerror && onerror(ex);\n }\n}\nfunction getByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string' && hasOwn(obj, keyPath))\n return obj[keyPath];\n if (!keyPath)\n return obj;\n if (typeof keyPath !== 'string') {\n var rv = [];\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n var val = getByKeyPath(obj, keyPath[i]);\n rv.push(val);\n }\n return rv;\n }\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var innerObj = obj[keyPath.substr(0, period)];\n return innerObj == null ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));\n }\n return undefined;\n}\nfunction setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined)\n return;\n if ('isFrozen' in Object && Object.isFrozen(obj))\n return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n }\n else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === \"\")\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(currentKeyPath)))\n obj.splice(currentKeyPath, 1);\n else\n delete obj[currentKeyPath];\n }\n else\n obj[currentKeyPath] = value;\n else {\n var innerObj = obj[currentKeyPath];\n if (!innerObj || !hasOwn(obj, currentKeyPath))\n innerObj = (obj[currentKeyPath] = {});\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n }\n else {\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(keyPath)))\n obj.splice(keyPath, 1);\n else\n delete obj[keyPath];\n }\n else\n obj[keyPath] = value;\n }\n }\n}\nfunction delByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string')\n setByKeyPath(obj, keyPath, undefined);\n else if ('length' in keyPath)\n [].map.call(keyPath, function (kp) {\n setByKeyPath(obj, kp, undefined);\n });\n}\nfunction shallowClone(obj) {\n var rv = {};\n for (var m in obj) {\n if (hasOwn(obj, m))\n rv[m] = obj[m];\n }\n return rv;\n}\nconst concat = [].concat;\nfunction flatten(a) {\n return concat.apply([], a);\n}\nconst intrinsicTypeNames = \"BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey\"\n .split(',').concat(flatten([8, 16, 32, 64].map(num => [\"Int\", \"Uint\", \"Float\"].map(t => t + num + \"Array\")))).filter(t => _global[t]);\nconst intrinsicTypes = intrinsicTypeNames.map(t => _global[t]);\narrayToObject(intrinsicTypeNames, x => [x, true]);\nlet circularRefs = null;\nfunction deepClone(any) {\n circularRefs = typeof WeakMap !== 'undefined' && new WeakMap();\n const rv = innerDeepClone(any);\n circularRefs = null;\n return rv;\n}\nfunction innerDeepClone(any) {\n if (!any || typeof any !== 'object')\n return any;\n let rv = circularRefs && circularRefs.get(any);\n if (rv)\n return rv;\n if (isArray(any)) {\n rv = [];\n circularRefs && circularRefs.set(any, rv);\n for (var i = 0, l = any.length; i < l; ++i) {\n rv.push(innerDeepClone(any[i]));\n }\n }\n else if (intrinsicTypes.indexOf(any.constructor) >= 0) {\n rv = any;\n }\n else {\n const proto = getProto(any);\n rv = proto === Object.prototype ? {} : Object.create(proto);\n circularRefs && circularRefs.set(any, rv);\n for (var prop in any) {\n if (hasOwn(any, prop)) {\n rv[prop] = innerDeepClone(any[prop]);\n }\n }\n }\n return rv;\n}\nconst { toString } = {};\nfunction toStringTag(o) {\n return toString.call(o).slice(8, -1);\n}\nconst iteratorSymbol = typeof Symbol !== 'undefined' ?\n Symbol.iterator :\n '@@iterator';\nconst getIteratorOf = typeof iteratorSymbol === \"symbol\" ? function (x) {\n var i;\n return x != null && (i = x[iteratorSymbol]) && i.apply(x);\n} : function () { return null; };\nconst NO_CHAR_ARRAY = {};\nfunction getArrayOf(arrayLike) {\n var i, a, x, it;\n if (arguments.length === 1) {\n if (isArray(arrayLike))\n return arrayLike.slice();\n if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string')\n return [arrayLike];\n if ((it = getIteratorOf(arrayLike))) {\n a = [];\n while ((x = it.next()), !x.done)\n a.push(x.value);\n return a;\n }\n if (arrayLike == null)\n return [arrayLike];\n i = arrayLike.length;\n if (typeof i === 'number') {\n a = new Array(i);\n while (i--)\n a[i] = arrayLike[i];\n return a;\n }\n return [arrayLike];\n }\n i = arguments.length;\n a = new Array(i);\n while (i--)\n a[i] = arguments[i];\n return a;\n}\nconst isAsyncFunction = typeof Symbol !== 'undefined'\n ? (fn) => fn[Symbol.toStringTag] === 'AsyncFunction'\n : () => false;\n\nvar debug = typeof location !== 'undefined' &&\n /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\nfunction setDebug(value, filter) {\n debug = value;\n libraryFilter = filter;\n}\nvar libraryFilter = () => true;\nconst NEEDS_THROW_FOR_STACK = !new Error(\"\").stack;\nfunction getErrorWithStack() {\n if (NEEDS_THROW_FOR_STACK)\n try {\n getErrorWithStack.arguments;\n throw new Error();\n }\n catch (e) {\n return e;\n }\n return new Error();\n}\nfunction prettyStack(exception, numIgnoredFrames) {\n var stack = exception.stack;\n if (!stack)\n return \"\";\n numIgnoredFrames = (numIgnoredFrames || 0);\n if (stack.indexOf(exception.name) === 0)\n numIgnoredFrames += (exception.name + exception.message).split('\\n').length;\n return stack.split('\\n')\n .slice(numIgnoredFrames)\n .filter(libraryFilter)\n .map(frame => \"\\n\" + frame)\n .join('');\n}\n\nvar dexieErrorNames = [\n 'Modify',\n 'Bulk',\n 'OpenFailed',\n 'VersionChange',\n 'Schema',\n 'Upgrade',\n 'InvalidTable',\n 'MissingAPI',\n 'NoSuchDatabase',\n 'InvalidArgument',\n 'SubTransaction',\n 'Unsupported',\n 'Internal',\n 'DatabaseClosed',\n 'PrematureCommit',\n 'ForeignAwait'\n];\nvar idbDomErrorNames = [\n 'Unknown',\n 'Constraint',\n 'Data',\n 'TransactionInactive',\n 'ReadOnly',\n 'Version',\n 'NotFound',\n 'InvalidState',\n 'InvalidAccess',\n 'Abort',\n 'Timeout',\n 'QuotaExceeded',\n 'Syntax',\n 'DataClone'\n];\nvar errorList = dexieErrorNames.concat(idbDomErrorNames);\nvar defaultTexts = {\n VersionChanged: \"Database version changed by other database connection\",\n DatabaseClosed: \"Database has been closed\",\n Abort: \"Transaction aborted\",\n TransactionInactive: \"Transaction has already completed or failed\",\n MissingAPI: \"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb\"\n};\nfunction DexieError(name, msg) {\n this._e = getErrorWithStack();\n this.name = name;\n this.message = msg;\n}\nderive(DexieError).from(Error).extend({\n stack: {\n get: function () {\n return this._stack ||\n (this._stack = this.name + \": \" + this.message + prettyStack(this._e, 2));\n }\n },\n toString: function () { return this.name + \": \" + this.message; }\n});\nfunction getMultiErrorMessage(msg, failures) {\n return msg + \". Errors: \" + Object.keys(failures)\n .map(key => failures[key].toString())\n .filter((v, i, s) => s.indexOf(v) === i)\n .join('\\n');\n}\nfunction ModifyError(msg, failures, successCount, failedKeys) {\n this._e = getErrorWithStack();\n this.failures = failures;\n this.failedKeys = failedKeys;\n this.successCount = successCount;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(ModifyError).from(DexieError);\nfunction BulkError(msg, failures) {\n this._e = getErrorWithStack();\n this.name = \"BulkError\";\n this.failures = Object.keys(failures).map(pos => failures[pos]);\n this.failuresByPos = failures;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(BulkError).from(DexieError);\nvar errnames = errorList.reduce((obj, name) => (obj[name] = name + \"Error\", obj), {});\nconst BaseException = DexieError;\nvar exceptions = errorList.reduce((obj, name) => {\n var fullName = name + \"Error\";\n function DexieError(msgOrInner, inner) {\n this._e = getErrorWithStack();\n this.name = fullName;\n if (!msgOrInner) {\n this.message = defaultTexts[name] || fullName;\n this.inner = null;\n }\n else if (typeof msgOrInner === 'string') {\n this.message = `${msgOrInner}${!inner ? '' : '\\n ' + inner}`;\n this.inner = inner || null;\n }\n else if (typeof msgOrInner === 'object') {\n this.message = `${msgOrInner.name} ${msgOrInner.message}`;\n this.inner = msgOrInner;\n }\n }\n derive(DexieError).from(BaseException);\n obj[name] = DexieError;\n return obj;\n}, {});\nexceptions.Syntax = SyntaxError;\nexceptions.Type = TypeError;\nexceptions.Range = RangeError;\nvar exceptionMap = idbDomErrorNames.reduce((obj, name) => {\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\nfunction mapError(domError, message) {\n if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name])\n return domError;\n var rv = new exceptionMap[domError.name](message || domError.message, domError);\n if (\"stack\" in domError) {\n setProp(rv, \"stack\", { get: function () {\n return this.inner.stack;\n } });\n }\n return rv;\n}\nvar fullNameExceptions = errorList.reduce((obj, name) => {\n if ([\"Syntax\", \"Type\", \"Range\"].indexOf(name) === -1)\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\nfullNameExceptions.ModifyError = ModifyError;\nfullNameExceptions.DexieError = DexieError;\nfullNameExceptions.BulkError = BulkError;\n\nfunction nop() { }\nfunction mirror(val) { return val; }\nfunction pureFunctionChain(f1, f2) {\n if (f1 == null || f1 === mirror)\n return f2;\n return function (val) {\n return f2(f1(val));\n };\n}\nfunction callBoth(on1, on2) {\n return function () {\n on1.apply(this, arguments);\n on2.apply(this, arguments);\n };\n}\nfunction hookCreatingChain(f1, f2) {\n if (f1 === nop)\n return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res !== undefined)\n arguments[0] = res;\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess)\n this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror)\n this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res2 !== undefined ? res2 : res;\n };\n}\nfunction hookDeletingChain(f1, f2) {\n if (f1 === nop)\n return f2;\n return function () {\n f1.apply(this, arguments);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = this.onerror = null;\n f2.apply(this, arguments);\n if (onsuccess)\n this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror)\n this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n };\n}\nfunction hookUpdatingChain(f1, f2) {\n if (f1 === nop)\n return f2;\n return function (modifications) {\n var res = f1.apply(this, arguments);\n extend(modifications, res);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess)\n this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror)\n this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res === undefined ?\n (res2 === undefined ? undefined : res2) :\n (extend(res, res2));\n };\n}\nfunction reverseStoppableEventChain(f1, f2) {\n if (f1 === nop)\n return f2;\n return function () {\n if (f2.apply(this, arguments) === false)\n return false;\n return f1.apply(this, arguments);\n };\n}\nfunction promisableChain(f1, f2) {\n if (f1 === nop)\n return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res && typeof res.then === 'function') {\n var thiz = this, i = arguments.length, args = new Array(i);\n while (i--)\n args[i] = arguments[i];\n return res.then(function () {\n return f2.apply(thiz, args);\n });\n }\n return f2.apply(this, arguments);\n };\n}\n\nvar INTERNAL = {};\nconst LONG_STACKS_CLIP_LIMIT = 100,\nMAX_LONG_STACKS = 20, ZONE_ECHO_LIMIT = 100, [resolvedNativePromise, nativePromiseProto, resolvedGlobalPromise] = typeof Promise === 'undefined' ?\n [] :\n (() => {\n let globalP = Promise.resolve();\n if (typeof crypto === 'undefined' || !crypto.subtle)\n return [globalP, getProto(globalP), globalP];\n const nativeP = crypto.subtle.digest(\"SHA-512\", new Uint8Array([0]));\n return [\n nativeP,\n getProto(nativeP),\n globalP\n ];\n })(), nativePromiseThen = nativePromiseProto && nativePromiseProto.then;\nconst NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;\nconst patchGlobalPromise = !!resolvedGlobalPromise;\nvar stack_being_generated = false;\nvar schedulePhysicalTick = resolvedGlobalPromise ?\n () => { resolvedGlobalPromise.then(physicalTick); }\n :\n _global.setImmediate ?\n setImmediate.bind(null, physicalTick) :\n _global.MutationObserver ?\n () => {\n var hiddenDiv = document.createElement(\"div\");\n (new MutationObserver(() => {\n physicalTick();\n hiddenDiv = null;\n })).observe(hiddenDiv, { attributes: true });\n hiddenDiv.setAttribute('i', '1');\n } :\n () => { setTimeout(physicalTick, 0); };\nvar asap = function (callback, args) {\n microtickQueue.push([callback, args]);\n if (needsNewPhysicalTick) {\n schedulePhysicalTick();\n needsNewPhysicalTick = false;\n }\n};\nvar isOutsideMicroTick = true,\nneedsNewPhysicalTick = true,\nunhandledErrors = [],\nrejectingErrors = [],\ncurrentFulfiller = null, rejectionMapper = mirror;\nvar globalPSD = {\n id: 'global',\n global: true,\n ref: 0,\n unhandleds: [],\n onunhandled: globalError,\n pgp: false,\n env: {},\n finalize: function () {\n this.unhandleds.forEach(uh => {\n try {\n globalError(uh[0], uh[1]);\n }\n catch (e) { }\n });\n }\n};\nvar PSD = globalPSD;\nvar microtickQueue = [];\nvar numScheduledCalls = 0;\nvar tickFinalizers = [];\nfunction DexiePromise(fn) {\n if (typeof this !== 'object')\n throw new TypeError('Promises must be constructed via new');\n this._listeners = [];\n this.onuncatched = nop;\n this._lib = false;\n var psd = (this._PSD = PSD);\n if (debug) {\n this._stackHolder = getErrorWithStack();\n this._prev = null;\n this._numPrev = 0;\n }\n if (typeof fn !== 'function') {\n if (fn !== INTERNAL)\n throw new TypeError('Not a function');\n this._state = arguments[1];\n this._value = arguments[2];\n if (this._state === false)\n handleRejection(this, this._value);\n return;\n }\n this._state = null;\n this._value = null;\n ++psd.ref;\n executePromiseTask(this, fn);\n}\nconst thenProp = {\n get: function () {\n var psd = PSD, microTaskId = totalEchoes;\n function then(onFulfilled, onRejected) {\n var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);\n const cleanup = possibleAwait && !decrementExpectedAwaits();\n var rv = new DexiePromise((resolve, reject) => {\n propagateToListener(this, new Listener(nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait, cleanup), nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait, cleanup), resolve, reject, psd));\n });\n debug && linkToPreviousPromise(rv, this);\n return rv;\n }\n then.prototype = INTERNAL;\n return then;\n },\n set: function (value) {\n setProp(this, 'then', value && value.prototype === INTERNAL ?\n thenProp :\n {\n get: function () {\n return value;\n },\n set: thenProp.set\n });\n }\n};\nprops(DexiePromise.prototype, {\n then: thenProp,\n _then: function (onFulfilled, onRejected) {\n propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD));\n },\n catch: function (onRejected) {\n if (arguments.length === 1)\n return this.then(null, onRejected);\n var type = arguments[0], handler = arguments[1];\n return typeof type === 'function' ? this.then(null, err =>\n err instanceof type ? handler(err) : PromiseReject(err))\n : this.then(null, err =>\n err && err.name === type ? handler(err) : PromiseReject(err));\n },\n finally: function (onFinally) {\n return this.then(value => {\n onFinally();\n return value;\n }, err => {\n onFinally();\n return PromiseReject(err);\n });\n },\n stack: {\n get: function () {\n if (this._stack)\n return this._stack;\n try {\n stack_being_generated = true;\n var stacks = getStack(this, [], MAX_LONG_STACKS);\n var stack = stacks.join(\"\\nFrom previous: \");\n if (this._state !== null)\n this._stack = stack;\n return stack;\n }\n finally {\n stack_being_generated = false;\n }\n }\n },\n timeout: function (ms, msg) {\n return ms < Infinity ?\n new DexiePromise((resolve, reject) => {\n var handle = setTimeout(() => reject(new exceptions.Timeout(msg)), ms);\n this.then(resolve, reject).finally(clearTimeout.bind(null, handle));\n }) : this;\n }\n});\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag)\n setProp(DexiePromise.prototype, Symbol.toStringTag, 'Dexie.Promise');\nglobalPSD.env = snapShot();\nfunction Listener(onFulfilled, onRejected, resolve, reject, zone) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n this.psd = zone;\n}\nprops(DexiePromise, {\n all: function () {\n var values = getArrayOf.apply(null, arguments)\n .map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve, reject) {\n if (values.length === 0)\n resolve([]);\n var remaining = values.length;\n values.forEach((a, i) => DexiePromise.resolve(a).then(x => {\n values[i] = x;\n if (!--remaining)\n resolve(values);\n }, reject));\n });\n },\n resolve: value => {\n if (value instanceof DexiePromise)\n return value;\n if (value && typeof value.then === 'function')\n return new DexiePromise((resolve, reject) => {\n value.then(resolve, reject);\n });\n var rv = new DexiePromise(INTERNAL, true, value);\n linkToPreviousPromise(rv, currentFulfiller);\n return rv;\n },\n reject: PromiseReject,\n race: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise((resolve, reject) => {\n values.map(value => DexiePromise.resolve(value).then(resolve, reject));\n });\n },\n PSD: {\n get: () => PSD,\n set: value => PSD = value\n },\n totalEchoes: { get: () => totalEchoes },\n newPSD: newScope,\n usePSD: usePSD,\n scheduler: {\n get: () => asap,\n set: value => { asap = value; }\n },\n rejectionMapper: {\n get: () => rejectionMapper,\n set: value => { rejectionMapper = value; }\n },\n follow: (fn, zoneProps) => {\n return new DexiePromise((resolve, reject) => {\n return newScope((resolve, reject) => {\n var psd = PSD;\n psd.unhandleds = [];\n psd.onunhandled = reject;\n psd.finalize = callBoth(function () {\n run_at_end_of_this_or_next_physical_tick(() => {\n this.unhandleds.length === 0 ? resolve() : reject(this.unhandleds[0]);\n });\n }, psd.finalize);\n fn();\n }, zoneProps, resolve, reject);\n });\n }\n});\nif (NativePromise) {\n if (NativePromise.allSettled)\n setProp(DexiePromise, \"allSettled\", function () {\n const possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(resolve => {\n if (possiblePromises.length === 0)\n resolve([]);\n let remaining = possiblePromises.length;\n const results = new Array(remaining);\n possiblePromises.forEach((p, i) => DexiePromise.resolve(p).then(value => results[i] = { status: \"fulfilled\", value }, reason => results[i] = { status: \"rejected\", reason })\n .then(() => --remaining || resolve(results)));\n });\n });\n if (NativePromise.any && typeof AggregateError !== 'undefined')\n setProp(DexiePromise, \"any\", function () {\n const possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise((resolve, reject) => {\n if (possiblePromises.length === 0)\n reject(new AggregateError([]));\n let remaining = possiblePromises.length;\n const failures = new Array(remaining);\n possiblePromises.forEach((p, i) => DexiePromise.resolve(p).then(value => resolve(value), failure => {\n failures[i] = failure;\n if (!--remaining)\n reject(new AggregateError(failures));\n }));\n });\n });\n}\nfunction executePromiseTask(promise, fn) {\n try {\n fn(value => {\n if (promise._state !== null)\n return;\n if (value === promise)\n throw new TypeError('A promise cannot be resolved with itself.');\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n if (value && typeof value.then === 'function') {\n executePromiseTask(promise, (resolve, reject) => {\n value instanceof DexiePromise ?\n value._then(resolve, reject) :\n value.then(resolve, reject);\n });\n }\n else {\n promise._state = true;\n promise._value = value;\n propagateAllListeners(promise);\n }\n if (shouldExecuteTick)\n endMicroTickScope();\n }, handleRejection.bind(null, promise));\n }\n catch (ex) {\n handleRejection(promise, ex);\n }\n}\nfunction handleRejection(promise, reason) {\n rejectingErrors.push(reason);\n if (promise._state !== null)\n return;\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n reason = rejectionMapper(reason);\n promise._state = false;\n promise._value = reason;\n debug && reason !== null && typeof reason === 'object' && !reason._promise && tryCatch(() => {\n var origProp = getPropertyDescriptor(reason, \"stack\");\n reason._promise = promise;\n setProp(reason, \"stack\", {\n get: () => stack_being_generated ?\n origProp && (origProp.get ?\n origProp.get.apply(reason) :\n origProp.value) :\n promise.stack\n });\n });\n addPossiblyUnhandledError(promise);\n propagateAllListeners(promise);\n if (shouldExecuteTick)\n endMicroTickScope();\n}\nfunction propagateAllListeners(promise) {\n var listeners = promise._listeners;\n promise._listeners = [];\n for (var i = 0, len = listeners.length; i < len; ++i) {\n propagateToListener(promise, listeners[i]);\n }\n var psd = promise._PSD;\n --psd.ref || psd.finalize();\n if (numScheduledCalls === 0) {\n ++numScheduledCalls;\n asap(() => {\n if (--numScheduledCalls === 0)\n finalizePhysicalTick();\n }, []);\n }\n}\nfunction propagateToListener(promise, listener) {\n if (promise._state === null) {\n promise._listeners.push(listener);\n return;\n }\n var cb = promise._state ? listener.onFulfilled : listener.onRejected;\n if (cb === null) {\n return (promise._state ? listener.resolve : listener.reject)(promise._value);\n }\n ++listener.psd.ref;\n ++numScheduledCalls;\n asap(callListener, [cb, promise, listener]);\n}\nfunction callListener(cb, promise, listener) {\n try {\n currentFulfiller = promise;\n var ret, value = promise._value;\n if (promise._state) {\n ret = cb(value);\n }\n else {\n if (rejectingErrors.length)\n rejectingErrors = [];\n ret = cb(value);\n if (rejectingErrors.indexOf(value) === -1)\n markErrorAsHandled(promise);\n }\n listener.resolve(ret);\n }\n catch (e) {\n listener.reject(e);\n }\n finally {\n currentFulfiller = null;\n if (--numScheduledCalls === 0)\n finalizePhysicalTick();\n --listener.psd.ref || listener.psd.finalize();\n }\n}\nfunction getStack(promise, stacks, limit) {\n if (stacks.length === limit)\n return stacks;\n var stack = \"\";\n if (promise._state === false) {\n var failure = promise._value, errorName, message;\n if (failure != null) {\n errorName = failure.name || \"Error\";\n message = failure.message || failure;\n stack = prettyStack(failure, 0);\n }\n else {\n errorName = failure;\n message = \"\";\n }\n stacks.push(errorName + (message ? \": \" + message : \"\") + stack);\n }\n if (debug) {\n stack = prettyStack(promise._stackHolder, 2);\n if (stack && stacks.indexOf(stack) === -1)\n stacks.push(stack);\n if (promise._prev)\n getStack(promise._prev, stacks, limit);\n }\n return stacks;\n}\nfunction linkToPreviousPromise(promise, prev) {\n var numPrev = prev ? prev._numPrev + 1 : 0;\n if (numPrev < LONG_STACKS_CLIP_LIMIT) {\n promise._prev = prev;\n promise._numPrev = numPrev;\n }\n}\nfunction physicalTick() {\n beginMicroTickScope() && endMicroTickScope();\n}\nfunction beginMicroTickScope() {\n var wasRootExec = isOutsideMicroTick;\n isOutsideMicroTick = false;\n needsNewPhysicalTick = false;\n return wasRootExec;\n}\nfunction endMicroTickScope() {\n var callbacks, i, l;\n do {\n while (microtickQueue.length > 0) {\n callbacks = microtickQueue;\n microtickQueue = [];\n l = callbacks.length;\n for (i = 0; i < l; ++i) {\n var item = callbacks[i];\n item[0].apply(null, item[1]);\n }\n }\n } while (microtickQueue.length > 0);\n isOutsideMicroTick = true;\n needsNewPhysicalTick = true;\n}\nfunction finalizePhysicalTick() {\n var unhandledErrs = unhandledErrors;\n unhandledErrors = [];\n unhandledErrs.forEach(p => {\n p._PSD.onunhandled.call(null, p._value, p);\n });\n var finalizers = tickFinalizers.slice(0);\n var i = finalizers.length;\n while (i)\n finalizers[--i]();\n}\nfunction run_at_end_of_this_or_next_physical_tick(fn) {\n function finalizer() {\n fn();\n tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);\n }\n tickFinalizers.push(finalizer);\n ++numScheduledCalls;\n asap(() => {\n if (--numScheduledCalls === 0)\n finalizePhysicalTick();\n }, []);\n}\nfunction addPossiblyUnhandledError(promise) {\n if (!unhandledErrors.some(p => p._value === promise._value))\n unhandledErrors.push(promise);\n}\nfunction markErrorAsHandled(promise) {\n var i = unhandledErrors.length;\n while (i)\n if (unhandledErrors[--i]._value === promise._value) {\n unhandledErrors.splice(i, 1);\n return;\n }\n}\nfunction PromiseReject(reason) {\n return new DexiePromise(INTERNAL, false, reason);\n}\nfunction wrap(fn, errorCatcher) {\n var psd = PSD;\n return function () {\n var wasRootExec = beginMicroTickScope(), outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn.apply(this, arguments);\n }\n catch (e) {\n errorCatcher && errorCatcher(e);\n }\n finally {\n switchToZone(outerScope, false);\n if (wasRootExec)\n endMicroTickScope();\n }\n };\n}\nconst task = { awaits: 0, echoes: 0, id: 0 };\nvar taskCounter = 0;\nvar zoneStack = [];\nvar zoneEchoes = 0;\nvar totalEchoes = 0;\nvar zone_id_counter = 0;\nfunction newScope(fn, props, a1, a2) {\n var parent = PSD, psd = Object.create(parent);\n psd.parent = parent;\n psd.ref = 0;\n psd.global = false;\n psd.id = ++zone_id_counter;\n var globalEnv = globalPSD.env;\n psd.env = patchGlobalPromise ? {\n Promise: DexiePromise,\n PromiseProp: { value: DexiePromise, configurable: true, writable: true },\n all: DexiePromise.all,\n race: DexiePromise.race,\n allSettled: DexiePromise.allSettled,\n any: DexiePromise.any,\n resolve: DexiePromise.resolve,\n reject: DexiePromise.reject,\n nthen: getPatchedPromiseThen(globalEnv.nthen, psd),\n gthen: getPatchedPromiseThen(globalEnv.gthen, psd)\n } : {};\n if (props)\n extend(psd, props);\n ++parent.ref;\n psd.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n };\n var rv = usePSD(psd, fn, a1, a2);\n if (psd.ref === 0)\n psd.finalize();\n return rv;\n}\nfunction incrementExpectedAwaits() {\n if (!task.id)\n task.id = ++taskCounter;\n ++task.awaits;\n task.echoes += ZONE_ECHO_LIMIT;\n return task.id;\n}\nfunction decrementExpectedAwaits() {\n if (!task.awaits)\n return false;\n if (--task.awaits === 0)\n task.id = 0;\n task.echoes = task.awaits * ZONE_ECHO_LIMIT;\n return true;\n}\nif (('' + nativePromiseThen).indexOf('[native code]') === -1) {\n incrementExpectedAwaits = decrementExpectedAwaits = nop;\n}\nfunction onPossibleParallellAsync(possiblePromise) {\n if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {\n incrementExpectedAwaits();\n return possiblePromise.then(x => {\n decrementExpectedAwaits();\n return x;\n }, e => {\n decrementExpectedAwaits();\n return rejection(e);\n });\n }\n return possiblePromise;\n}\nfunction zoneEnterEcho(targetZone) {\n ++totalEchoes;\n if (!task.echoes || --task.echoes === 0) {\n task.echoes = task.id = 0;\n }\n zoneStack.push(PSD);\n switchToZone(targetZone, true);\n}\nfunction zoneLeaveEcho() {\n var zone = zoneStack[zoneStack.length - 1];\n zoneStack.pop();\n switchToZone(zone, false);\n}\nfunction switchToZone(targetZone, bEnteringZone) {\n var currentZone = PSD;\n if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {\n enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);\n }\n if (targetZone === PSD)\n return;\n PSD = targetZone;\n if (currentZone === globalPSD)\n globalPSD.env = snapShot();\n if (patchGlobalPromise) {\n var GlobalPromise = globalPSD.env.Promise;\n var targetEnv = targetZone.env;\n nativePromiseProto.then = targetEnv.nthen;\n GlobalPromise.prototype.then = targetEnv.gthen;\n if (currentZone.global || targetZone.global) {\n Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);\n GlobalPromise.all = targetEnv.all;\n GlobalPromise.race = targetEnv.race;\n GlobalPromise.resolve = targetEnv.resolve;\n GlobalPromise.reject = targetEnv.reject;\n if (targetEnv.allSettled)\n GlobalPromise.allSettled = targetEnv.allSettled;\n if (targetEnv.any)\n GlobalPromise.any = targetEnv.any;\n }\n }\n}\nfunction snapShot() {\n var GlobalPromise = _global.Promise;\n return patchGlobalPromise ? {\n Promise: GlobalPromise,\n PromiseProp: Object.getOwnPropertyDescriptor(_global, \"Promise\"),\n all: GlobalPromise.all,\n race: GlobalPromise.race,\n allSettled: GlobalPromise.allSettled,\n any: GlobalPromise.any,\n resolve: GlobalPromise.resolve,\n reject: GlobalPromise.reject,\n nthen: nativePromiseProto.then,\n gthen: GlobalPromise.prototype.then\n } : {};\n}\nfunction usePSD(psd, fn, a1, a2, a3) {\n var outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn(a1, a2, a3);\n }\n finally {\n switchToZone(outerScope, false);\n }\n}\nfunction enqueueNativeMicroTask(job) {\n nativePromiseThen.call(resolvedNativePromise, job);\n}\nfunction nativeAwaitCompatibleWrap(fn, zone, possibleAwait, cleanup) {\n return typeof fn !== 'function' ? fn : function () {\n var outerZone = PSD;\n if (possibleAwait)\n incrementExpectedAwaits();\n switchToZone(zone, true);\n try {\n return fn.apply(this, arguments);\n }\n finally {\n switchToZone(outerZone, false);\n if (cleanup)\n enqueueNativeMicroTask(decrementExpectedAwaits);\n }\n };\n}\nfunction getPatchedPromiseThen(origThen, zone) {\n return function (onResolved, onRejected) {\n return origThen.call(this, nativeAwaitCompatibleWrap(onResolved, zone), nativeAwaitCompatibleWrap(onRejected, zone));\n };\n}\nconst UNHANDLEDREJECTION = \"unhandledrejection\";\nfunction globalError(err, promise) {\n var rv;\n try {\n rv = promise.onuncatched(err);\n }\n catch (e) { }\n if (rv !== false)\n try {\n var event, eventData = { promise: promise, reason: err };\n if (_global.document && document.createEvent) {\n event = document.createEvent('Event');\n event.initEvent(UNHANDLEDREJECTION, true, true);\n extend(event, eventData);\n }\n else if (_global.CustomEvent) {\n event = new CustomEvent(UNHANDLEDREJECTION, { detail: eventData });\n extend(event, eventData);\n }\n if (event && _global.dispatchEvent) {\n dispatchEvent(event);\n if (!_global.PromiseRejectionEvent && _global.onunhandledrejection)\n try {\n _global.onunhandledrejection(event);\n }\n catch (_) { }\n }\n if (debug && event && !event.defaultPrevented) {\n console.warn(`Unhandled rejection: ${err.stack || err}`);\n }\n }\n catch (e) { }\n}\nvar rejection = DexiePromise.reject;\n\nfunction tempTransaction(db, mode, storeNames, fn) {\n if (!db.idbdb || (!db._state.openComplete && (!PSD.letThrough && !db._vip))) {\n if (db._state.openComplete) {\n return rejection(new exceptions.DatabaseClosed(db._state.dbOpenError));\n }\n if (!db._state.isBeingOpened) {\n if (!db._options.autoOpen)\n return rejection(new exceptions.DatabaseClosed());\n db.open().catch(nop);\n }\n return db._state.dbReadyPromise.then(() => tempTransaction(db, mode, storeNames, fn));\n }\n else {\n var trans = db._createTransaction(mode, storeNames, db._dbSchema);\n try {\n trans.create();\n db._state.PR1398_maxLoop = 3;\n }\n catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db._close();\n return db.open().then(() => tempTransaction(db, mode, storeNames, fn));\n }\n return rejection(ex);\n }\n return trans._promise(mode, (resolve, reject) => {\n return newScope(() => {\n PSD.trans = trans;\n return fn(resolve, reject, trans);\n });\n }).then(result => {\n return trans._completion.then(() => result);\n });\n }\n}\n\nconst DEXIE_VERSION = '3.2.7';\nconst maxString = String.fromCharCode(65535);\nconst minKey = -Infinity;\nconst INVALID_KEY_ARGUMENT = \"Invalid key provided. Keys must be of type string, number, Date or Array.\";\nconst STRING_EXPECTED = \"String expected.\";\nconst connections = [];\nconst isIEOrEdge = typeof navigator !== 'undefined' && /(MSIE|Trident|Edge)/.test(navigator.userAgent);\nconst hasIEDeleteObjectStoreBug = isIEOrEdge;\nconst hangsOnDeleteLargeKeyRange = isIEOrEdge;\nconst dexieStackFrameFilter = frame => !/(dexie\\.js|dexie\\.min\\.js)/.test(frame);\nconst DBNAMES_DB = '__dbnames';\nconst READONLY = 'readonly';\nconst READWRITE = 'readwrite';\n\nfunction combine(filter1, filter2) {\n return filter1 ?\n filter2 ?\n function () { return filter1.apply(this, arguments) && filter2.apply(this, arguments); } :\n filter1 :\n filter2;\n}\n\nconst AnyRange = {\n type: 3 ,\n lower: -Infinity,\n lowerOpen: false,\n upper: [[]],\n upperOpen: false\n};\n\nfunction workaroundForUndefinedPrimKey(keyPath) {\n return typeof keyPath === \"string\" && !/\\./.test(keyPath)\n ? (obj) => {\n if (obj[keyPath] === undefined && (keyPath in obj)) {\n obj = deepClone(obj);\n delete obj[keyPath];\n }\n return obj;\n }\n : (obj) => obj;\n}\n\nclass Table {\n _trans(mode, fn, writeLocked) {\n const trans = this._tx || PSD.trans;\n const tableName = this.name;\n function checkTableInTransaction(resolve, reject, trans) {\n if (!trans.schema[tableName])\n throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n return fn(trans.idbtrans, trans);\n }\n const wasRootExec = beginMicroTickScope();\n try {\n return trans && trans.db === this.db ?\n trans === PSD.trans ?\n trans._promise(mode, checkTableInTransaction, writeLocked) :\n newScope(() => trans._promise(mode, checkTableInTransaction, writeLocked), { trans: trans, transless: PSD.transless || PSD }) :\n tempTransaction(this.db, mode, [this.name], checkTableInTransaction);\n }\n finally {\n if (wasRootExec)\n endMicroTickScope();\n }\n }\n get(keyOrCrit, cb) {\n if (keyOrCrit && keyOrCrit.constructor === Object)\n return this.where(keyOrCrit).first(cb);\n return this._trans('readonly', (trans) => {\n return this.core.get({ trans, key: keyOrCrit })\n .then(res => this.hook.reading.fire(res));\n }).then(cb);\n }\n where(indexOrCrit) {\n if (typeof indexOrCrit === 'string')\n return new this.db.WhereClause(this, indexOrCrit);\n if (isArray(indexOrCrit))\n return new this.db.WhereClause(this, `[${indexOrCrit.join('+')}]`);\n const keyPaths = keys(indexOrCrit);\n if (keyPaths.length === 1)\n return this\n .where(keyPaths[0])\n .equals(indexOrCrit[keyPaths[0]]);\n const compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix => {\n if (ix.compound &&\n keyPaths.every(keyPath => ix.keyPath.indexOf(keyPath) >= 0)) {\n for (let i = 0; i < keyPaths.length; ++i) {\n if (keyPaths.indexOf(ix.keyPath[i]) === -1)\n return false;\n }\n return true;\n }\n return false;\n }).sort((a, b) => a.keyPath.length - b.keyPath.length)[0];\n if (compoundIndex && this.db._maxKey !== maxString) {\n const keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);\n return this\n .where(keyPathsInValidOrder)\n .equals(keyPathsInValidOrder.map(kp => indexOrCrit[kp]));\n }\n if (!compoundIndex && debug)\n console.warn(`The query ${JSON.stringify(indexOrCrit)} on ${this.name} would benefit of a ` +\n `compound index [${keyPaths.join('+')}]`);\n const { idxByName } = this.schema;\n const idb = this.db._deps.indexedDB;\n function equals(a, b) {\n try {\n return idb.cmp(a, b) === 0;\n }\n catch (e) {\n return false;\n }\n }\n const [idx, filterFunction] = keyPaths.reduce(([prevIndex, prevFilterFn], keyPath) => {\n const index = idxByName[keyPath];\n const value = indexOrCrit[keyPath];\n return [\n prevIndex || index,\n prevIndex || !index ?\n combine(prevFilterFn, index && index.multi ?\n x => {\n const prop = getByKeyPath(x, keyPath);\n return isArray(prop) && prop.some(item => equals(value, item));\n } : x => equals(value, getByKeyPath(x, keyPath)))\n : prevFilterFn\n ];\n }, [null, null]);\n return idx ?\n this.where(idx.name).equals(indexOrCrit[idx.keyPath])\n .filter(filterFunction) :\n compoundIndex ?\n this.filter(filterFunction) :\n this.where(keyPaths).equals('');\n }\n filter(filterFunction) {\n return this.toCollection().and(filterFunction);\n }\n count(thenShortcut) {\n return this.toCollection().count(thenShortcut);\n }\n offset(offset) {\n return this.toCollection().offset(offset);\n }\n limit(numRows) {\n return this.toCollection().limit(numRows);\n }\n each(callback) {\n return this.toCollection().each(callback);\n }\n toArray(thenShortcut) {\n return this.toCollection().toArray(thenShortcut);\n }\n toCollection() {\n return new this.db.Collection(new this.db.WhereClause(this));\n }\n orderBy(index) {\n return new this.db.Collection(new this.db.WhereClause(this, isArray(index) ?\n `[${index.join('+')}]` :\n index));\n }\n reverse() {\n return this.toCollection().reverse();\n }\n mapToClass(constructor) {\n this.schema.mappedClass = constructor;\n const readHook = obj => {\n if (!obj)\n return obj;\n const res = Object.create(constructor.prototype);\n for (var m in obj)\n if (hasOwn(obj, m))\n try {\n res[m] = obj[m];\n }\n catch (_) { }\n return res;\n };\n if (this.schema.readHook) {\n this.hook.reading.unsubscribe(this.schema.readHook);\n }\n this.schema.readHook = readHook;\n this.hook(\"reading\", readHook);\n return constructor;\n }\n defineClass() {\n function Class(content) {\n extend(this, content);\n }\n return this.mapToClass(Class);\n }\n add(obj, key) {\n const { auto, keyPath } = this.schema.primKey;\n let objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', trans => {\n return this.core.mutate({ trans, type: 'add', keys: key != null ? [key] : null, values: [objToAdd] });\n }).then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult)\n .then(lastResult => {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n }\n catch (_) { }\n }\n return lastResult;\n });\n }\n update(keyOrObject, modifications) {\n if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {\n const key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);\n if (key === undefined)\n return rejection(new exceptions.InvalidArgument(\"Given object does not contain its primary key\"));\n try {\n if (typeof modifications !== \"function\") {\n keys(modifications).forEach(keyPath => {\n setByKeyPath(keyOrObject, keyPath, modifications[keyPath]);\n });\n }\n else {\n modifications(keyOrObject, { value: keyOrObject, primKey: key });\n }\n }\n catch (_a) {\n }\n return this.where(\":id\").equals(key).modify(modifications);\n }\n else {\n return this.where(\":id\").equals(keyOrObject).modify(modifications);\n }\n }\n put(obj, key) {\n const { auto, keyPath } = this.schema.primKey;\n let objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', trans => this.core.mutate({ trans, type: 'put', values: [objToAdd], keys: key != null ? [key] : null }))\n .then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult)\n .then(lastResult => {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n }\n catch (_) { }\n }\n return lastResult;\n });\n }\n delete(key) {\n return this._trans('readwrite', trans => this.core.mutate({ trans, type: 'delete', keys: [key] }))\n .then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined);\n }\n clear() {\n return this._trans('readwrite', trans => this.core.mutate({ trans, type: 'deleteRange', range: AnyRange }))\n .then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined);\n }\n bulkGet(keys) {\n return this._trans('readonly', trans => {\n return this.core.getMany({\n keys,\n trans\n }).then(result => result.map(res => this.hook.reading.fire(res)));\n });\n }\n bulkAdd(objects, keysOrOptions, options) {\n const keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n const wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', trans => {\n const { auto, keyPath } = this.schema.primKey;\n if (keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const numObjects = objects.length;\n let objectsToAdd = keyPath && auto ?\n objects.map(workaroundForUndefinedPrimKey(keyPath)) :\n objects;\n return this.core.mutate({ trans, type: 'add', keys: keys, values: objectsToAdd, wantResults })\n .then(({ numFailures, results, lastResult, failures }) => {\n const result = wantResults ? results : lastResult;\n if (numFailures === 0)\n return result;\n throw new BulkError(`${this.name}.bulkAdd(): ${numFailures} of ${numObjects} operations failed`, failures);\n });\n });\n }\n bulkPut(objects, keysOrOptions, options) {\n const keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n const wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', trans => {\n const { auto, keyPath } = this.schema.primKey;\n if (keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const numObjects = objects.length;\n let objectsToPut = keyPath && auto ?\n objects.map(workaroundForUndefinedPrimKey(keyPath)) :\n objects;\n return this.core.mutate({ trans, type: 'put', keys: keys, values: objectsToPut, wantResults })\n .then(({ numFailures, results, lastResult, failures }) => {\n const result = wantResults ? results : lastResult;\n if (numFailures === 0)\n return result;\n throw new BulkError(`${this.name}.bulkPut(): ${numFailures} of ${numObjects} operations failed`, failures);\n });\n });\n }\n bulkDelete(keys) {\n const numKeys = keys.length;\n return this._trans('readwrite', trans => {\n return this.core.mutate({ trans, type: 'delete', keys: keys });\n }).then(({ numFailures, lastResult, failures }) => {\n if (numFailures === 0)\n return lastResult;\n throw new BulkError(`${this.name}.bulkDelete(): ${numFailures} of ${numKeys} operations failed`, failures);\n });\n }\n}\n\nfunction Events(ctx) {\n var evs = {};\n var rv = function (eventName, subscriber) {\n if (subscriber) {\n var i = arguments.length, args = new Array(i - 1);\n while (--i)\n args[i - 1] = arguments[i];\n evs[eventName].subscribe.apply(null, args);\n return ctx;\n }\n else if (typeof (eventName) === 'string') {\n return evs[eventName];\n }\n };\n rv.addEventType = add;\n for (var i = 1, l = arguments.length; i < l; ++i) {\n add(arguments[i]);\n }\n return rv;\n function add(eventName, chainFunction, defaultFunction) {\n if (typeof eventName === 'object')\n return addConfiguredEvents(eventName);\n if (!chainFunction)\n chainFunction = reverseStoppableEventChain;\n if (!defaultFunction)\n defaultFunction = nop;\n var context = {\n subscribers: [],\n fire: defaultFunction,\n subscribe: function (cb) {\n if (context.subscribers.indexOf(cb) === -1) {\n context.subscribers.push(cb);\n context.fire = chainFunction(context.fire, cb);\n }\n },\n unsubscribe: function (cb) {\n context.subscribers = context.subscribers.filter(function (fn) { return fn !== cb; });\n context.fire = context.subscribers.reduce(chainFunction, defaultFunction);\n }\n };\n evs[eventName] = rv[eventName] = context;\n return context;\n }\n function addConfiguredEvents(cfg) {\n keys(cfg).forEach(function (eventName) {\n var args = cfg[eventName];\n if (isArray(args)) {\n add(eventName, cfg[eventName][0], cfg[eventName][1]);\n }\n else if (args === 'asap') {\n var context = add(eventName, mirror, function fire() {\n var i = arguments.length, args = new Array(i);\n while (i--)\n args[i] = arguments[i];\n context.subscribers.forEach(function (fn) {\n asap$1(function fireEvent() {\n fn.apply(null, args);\n });\n });\n });\n }\n else\n throw new exceptions.InvalidArgument(\"Invalid event config\");\n });\n }\n}\n\nfunction makeClassConstructor(prototype, constructor) {\n derive(constructor).from({ prototype });\n return constructor;\n}\n\nfunction createTableConstructor(db) {\n return makeClassConstructor(Table.prototype, function Table(name, tableSchema, trans) {\n this.db = db;\n this._tx = trans;\n this.name = name;\n this.schema = tableSchema;\n this.hook = db._allTables[name] ? db._allTables[name].hook : Events(null, {\n \"creating\": [hookCreatingChain, nop],\n \"reading\": [pureFunctionChain, mirror],\n \"updating\": [hookUpdatingChain, nop],\n \"deleting\": [hookDeletingChain, nop]\n });\n });\n}\n\nfunction isPlainKeyRange(ctx, ignoreLimitFilter) {\n return !(ctx.filter || ctx.algorithm || ctx.or) &&\n (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);\n}\nfunction addFilter(ctx, fn) {\n ctx.filter = combine(ctx.filter, fn);\n}\nfunction addReplayFilter(ctx, factory, isLimitFilter) {\n var curr = ctx.replayFilter;\n ctx.replayFilter = curr ? () => combine(curr(), factory()) : factory;\n ctx.justLimit = isLimitFilter && !curr;\n}\nfunction addMatchFilter(ctx, fn) {\n ctx.isMatch = combine(ctx.isMatch, fn);\n}\nfunction getIndexOrStore(ctx, coreSchema) {\n if (ctx.isPrimKey)\n return coreSchema.primaryKey;\n const index = coreSchema.getIndexByKeyPath(ctx.index);\n if (!index)\n throw new exceptions.Schema(\"KeyPath \" + ctx.index + \" on object store \" + coreSchema.name + \" is not indexed\");\n return index;\n}\nfunction openCursor(ctx, coreTable, trans) {\n const index = getIndexOrStore(ctx, coreTable.schema);\n return coreTable.openCursor({\n trans,\n values: !ctx.keysOnly,\n reverse: ctx.dir === 'prev',\n unique: !!ctx.unique,\n query: {\n index,\n range: ctx.range\n }\n });\n}\nfunction iter(ctx, fn, coreTrans, coreTable) {\n const filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;\n if (!ctx.or) {\n return iterate(openCursor(ctx, coreTable, coreTrans), combine(ctx.algorithm, filter), fn, !ctx.keysOnly && ctx.valueMapper);\n }\n else {\n const set = {};\n const union = (item, cursor, advance) => {\n if (!filter || filter(cursor, advance, result => cursor.stop(result), err => cursor.fail(err))) {\n var primaryKey = cursor.primaryKey;\n var key = '' + primaryKey;\n if (key === '[object ArrayBuffer]')\n key = '' + new Uint8Array(primaryKey);\n if (!hasOwn(set, key)) {\n set[key] = true;\n fn(item, cursor, advance);\n }\n }\n };\n return Promise.all([\n ctx.or._iterate(union, coreTrans),\n iterate(openCursor(ctx, coreTable, coreTrans), ctx.algorithm, union, !ctx.keysOnly && ctx.valueMapper)\n ]);\n }\n}\nfunction iterate(cursorPromise, filter, fn, valueMapper) {\n var mappedFn = valueMapper ? (x, c, a) => fn(valueMapper(x), c, a) : fn;\n var wrappedFn = wrap(mappedFn);\n return cursorPromise.then(cursor => {\n if (cursor) {\n return cursor.start(() => {\n var c = () => cursor.continue();\n if (!filter || filter(cursor, advancer => c = advancer, val => { cursor.stop(val); c = nop; }, e => { cursor.fail(e); c = nop; }))\n wrappedFn(cursor.value, cursor, advancer => c = advancer);\n c();\n });\n }\n });\n}\n\nfunction cmp(a, b) {\n try {\n const ta = type(a);\n const tb = type(b);\n if (ta !== tb) {\n if (ta === 'Array')\n return 1;\n if (tb === 'Array')\n return -1;\n if (ta === 'binary')\n return 1;\n if (tb === 'binary')\n return -1;\n if (ta === 'string')\n return 1;\n if (tb === 'string')\n return -1;\n if (ta === 'Date')\n return 1;\n if (tb !== 'Date')\n return NaN;\n return -1;\n }\n switch (ta) {\n case 'number':\n case 'Date':\n case 'string':\n return a > b ? 1 : a < b ? -1 : 0;\n case 'binary': {\n return compareUint8Arrays(getUint8Array(a), getUint8Array(b));\n }\n case 'Array':\n return compareArrays(a, b);\n }\n }\n catch (_a) { }\n return NaN;\n}\nfunction compareArrays(a, b) {\n const al = a.length;\n const bl = b.length;\n const l = al < bl ? al : bl;\n for (let i = 0; i < l; ++i) {\n const res = cmp(a[i], b[i]);\n if (res !== 0)\n return res;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n}\nfunction compareUint8Arrays(a, b) {\n const al = a.length;\n const bl = b.length;\n const l = al < bl ? al : bl;\n for (let i = 0; i < l; ++i) {\n if (a[i] !== b[i])\n return a[i] < b[i] ? -1 : 1;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n}\nfunction type(x) {\n const t = typeof x;\n if (t !== 'object')\n return t;\n if (ArrayBuffer.isView(x))\n return 'binary';\n const tsTag = toStringTag(x);\n return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;\n}\nfunction getUint8Array(a) {\n if (a instanceof Uint8Array)\n return a;\n if (ArrayBuffer.isView(a))\n return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n return new Uint8Array(a);\n}\n\nclass Collection {\n _read(fn, cb) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._trans('readonly', fn).then(cb);\n }\n _write(fn) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._trans('readwrite', fn, \"locked\");\n }\n _addAlgorithm(fn) {\n var ctx = this._ctx;\n ctx.algorithm = combine(ctx.algorithm, fn);\n }\n _iterate(fn, coreTrans) {\n return iter(this._ctx, fn, coreTrans, this._ctx.table.core);\n }\n clone(props) {\n var rv = Object.create(this.constructor.prototype), ctx = Object.create(this._ctx);\n if (props)\n extend(ctx, props);\n rv._ctx = ctx;\n return rv;\n }\n raw() {\n this._ctx.valueMapper = null;\n return this;\n }\n each(fn) {\n var ctx = this._ctx;\n return this._read(trans => iter(ctx, fn, trans, ctx.table.core));\n }\n count(cb) {\n return this._read(trans => {\n const ctx = this._ctx;\n const coreTable = ctx.table.core;\n if (isPlainKeyRange(ctx, true)) {\n return coreTable.count({\n trans,\n query: {\n index: getIndexOrStore(ctx, coreTable.schema),\n range: ctx.range\n }\n }).then(count => Math.min(count, ctx.limit));\n }\n else {\n var count = 0;\n return iter(ctx, () => { ++count; return false; }, trans, coreTable)\n .then(() => count);\n }\n }).then(cb);\n }\n sortBy(keyPath, cb) {\n const parts = keyPath.split('.').reverse(), lastPart = parts[0], lastIndex = parts.length - 1;\n function getval(obj, i) {\n if (i)\n return getval(obj[parts[i]], i - 1);\n return obj[lastPart];\n }\n var order = this._ctx.dir === \"next\" ? 1 : -1;\n function sorter(a, b) {\n var aVal = getval(a, lastIndex), bVal = getval(b, lastIndex);\n return aVal < bVal ? -order : aVal > bVal ? order : 0;\n }\n return this.toArray(function (a) {\n return a.sort(sorter);\n }).then(cb);\n }\n toArray(cb) {\n return this._read(trans => {\n var ctx = this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n const { valueMapper } = ctx;\n const index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans,\n limit: ctx.limit,\n values: true,\n query: {\n index,\n range: ctx.range\n }\n }).then(({ result }) => valueMapper ? result.map(valueMapper) : result);\n }\n else {\n const a = [];\n return iter(ctx, item => a.push(item), trans, ctx.table.core).then(() => a);\n }\n }, cb);\n }\n offset(offset) {\n var ctx = this._ctx;\n if (offset <= 0)\n return this;\n ctx.offset += offset;\n if (isPlainKeyRange(ctx)) {\n addReplayFilter(ctx, () => {\n var offsetLeft = offset;\n return (cursor, advance) => {\n if (offsetLeft === 0)\n return true;\n if (offsetLeft === 1) {\n --offsetLeft;\n return false;\n }\n advance(() => {\n cursor.advance(offsetLeft);\n offsetLeft = 0;\n });\n return false;\n };\n });\n }\n else {\n addReplayFilter(ctx, () => {\n var offsetLeft = offset;\n return () => (--offsetLeft < 0);\n });\n }\n return this;\n }\n limit(numRows) {\n this._ctx.limit = Math.min(this._ctx.limit, numRows);\n addReplayFilter(this._ctx, () => {\n var rowsLeft = numRows;\n return function (cursor, advance, resolve) {\n if (--rowsLeft <= 0)\n advance(resolve);\n return rowsLeft >= 0;\n };\n }, true);\n return this;\n }\n until(filterFunction, bIncludeStopEntry) {\n addFilter(this._ctx, function (cursor, advance, resolve) {\n if (filterFunction(cursor.value)) {\n advance(resolve);\n return bIncludeStopEntry;\n }\n else {\n return true;\n }\n });\n return this;\n }\n first(cb) {\n return this.limit(1).toArray(function (a) { return a[0]; }).then(cb);\n }\n last(cb) {\n return this.reverse().first(cb);\n }\n filter(filterFunction) {\n addFilter(this._ctx, function (cursor) {\n return filterFunction(cursor.value);\n });\n addMatchFilter(this._ctx, filterFunction);\n return this;\n }\n and(filter) {\n return this.filter(filter);\n }\n or(indexName) {\n return new this.db.WhereClause(this._ctx.table, indexName, this);\n }\n reverse() {\n this._ctx.dir = (this._ctx.dir === \"prev\" ? \"next\" : \"prev\");\n if (this._ondirectionchange)\n this._ondirectionchange(this._ctx.dir);\n return this;\n }\n desc() {\n return this.reverse();\n }\n eachKey(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.key, cursor); });\n }\n eachUniqueKey(cb) {\n this._ctx.unique = \"unique\";\n return this.eachKey(cb);\n }\n eachPrimaryKey(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.primaryKey, cursor); });\n }\n keys(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.key);\n }).then(function () {\n return a;\n }).then(cb);\n }\n primaryKeys(cb) {\n var ctx = this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n return this._read(trans => {\n var index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans,\n values: false,\n limit: ctx.limit,\n query: {\n index,\n range: ctx.range\n }\n });\n }).then(({ result }) => result).then(cb);\n }\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.primaryKey);\n }).then(function () {\n return a;\n }).then(cb);\n }\n uniqueKeys(cb) {\n this._ctx.unique = \"unique\";\n return this.keys(cb);\n }\n firstKey(cb) {\n return this.limit(1).keys(function (a) { return a[0]; }).then(cb);\n }\n lastKey(cb) {\n return this.reverse().firstKey(cb);\n }\n distinct() {\n var ctx = this._ctx, idx = ctx.index && ctx.table.schema.idxByName[ctx.index];\n if (!idx || !idx.multi)\n return this;\n var set = {};\n addFilter(this._ctx, function (cursor) {\n var strKey = cursor.primaryKey.toString();\n var found = hasOwn(set, strKey);\n set[strKey] = true;\n return !found;\n });\n return this;\n }\n modify(changes) {\n var ctx = this._ctx;\n return this._write(trans => {\n var modifyer;\n if (typeof changes === 'function') {\n modifyer = changes;\n }\n else {\n var keyPaths = keys(changes);\n var numKeys = keyPaths.length;\n modifyer = function (item) {\n var anythingModified = false;\n for (var i = 0; i < numKeys; ++i) {\n var keyPath = keyPaths[i], val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val);\n anythingModified = true;\n }\n }\n return anythingModified;\n };\n }\n const coreTable = ctx.table.core;\n const { outbound, extractKey } = coreTable.schema.primaryKey;\n const limit = this.db._options.modifyChunkSize || 200;\n const totalFailures = [];\n let successCount = 0;\n const failedKeys = [];\n const applyMutateResult = (expectedCount, res) => {\n const { failures, numFailures } = res;\n successCount += expectedCount - numFailures;\n for (let pos of keys(failures)) {\n totalFailures.push(failures[pos]);\n }\n };\n return this.clone().primaryKeys().then(keys => {\n const nextChunk = (offset) => {\n const count = Math.min(limit, keys.length - offset);\n return coreTable.getMany({\n trans,\n keys: keys.slice(offset, offset + count),\n cache: \"immutable\"\n }).then(values => {\n const addValues = [];\n const putValues = [];\n const putKeys = outbound ? [] : null;\n const deleteKeys = [];\n for (let i = 0; i < count; ++i) {\n const origValue = values[i];\n const ctx = {\n value: deepClone(origValue),\n primKey: keys[offset + i]\n };\n if (modifyer.call(ctx, ctx.value, ctx) !== false) {\n if (ctx.value == null) {\n deleteKeys.push(keys[offset + i]);\n }\n else if (!outbound && cmp(extractKey(origValue), extractKey(ctx.value)) !== 0) {\n deleteKeys.push(keys[offset + i]);\n addValues.push(ctx.value);\n }\n else {\n putValues.push(ctx.value);\n if (outbound)\n putKeys.push(keys[offset + i]);\n }\n }\n }\n const criteria = isPlainKeyRange(ctx) &&\n ctx.limit === Infinity &&\n (typeof changes !== 'function' || changes === deleteCallback) && {\n index: ctx.index,\n range: ctx.range\n };\n return Promise.resolve(addValues.length > 0 &&\n coreTable.mutate({ trans, type: 'add', values: addValues })\n .then(res => {\n for (let pos in res.failures) {\n deleteKeys.splice(parseInt(pos), 1);\n }\n applyMutateResult(addValues.length, res);\n })).then(() => (putValues.length > 0 || (criteria && typeof changes === 'object')) &&\n coreTable.mutate({\n trans,\n type: 'put',\n keys: putKeys,\n values: putValues,\n criteria,\n changeSpec: typeof changes !== 'function'\n && changes\n }).then(res => applyMutateResult(putValues.length, res))).then(() => (deleteKeys.length > 0 || (criteria && changes === deleteCallback)) &&\n coreTable.mutate({\n trans,\n type: 'delete',\n keys: deleteKeys,\n criteria\n }).then(res => applyMutateResult(deleteKeys.length, res))).then(() => {\n return keys.length > offset + count && nextChunk(offset + limit);\n });\n });\n };\n return nextChunk(0).then(() => {\n if (totalFailures.length > 0)\n throw new ModifyError(\"Error modifying one or more objects\", totalFailures, successCount, failedKeys);\n return keys.length;\n });\n });\n });\n }\n delete() {\n var ctx = this._ctx, range = ctx.range;\n if (isPlainKeyRange(ctx) &&\n ((ctx.isPrimKey && !hangsOnDeleteLargeKeyRange) || range.type === 3 ))\n {\n return this._write(trans => {\n const { primaryKey } = ctx.table.core.schema;\n const coreRange = range;\n return ctx.table.core.count({ trans, query: { index: primaryKey, range: coreRange } }).then(count => {\n return ctx.table.core.mutate({ trans, type: 'deleteRange', range: coreRange })\n .then(({ failures, lastResult, results, numFailures }) => {\n if (numFailures)\n throw new ModifyError(\"Could not delete some values\", Object.keys(failures).map(pos => failures[pos]), count - numFailures);\n return count - numFailures;\n });\n });\n });\n }\n return this.modify(deleteCallback);\n }\n}\nconst deleteCallback = (value, ctx) => ctx.value = null;\n\nfunction createCollectionConstructor(db) {\n return makeClassConstructor(Collection.prototype, function Collection(whereClause, keyRangeGenerator) {\n this.db = db;\n let keyRange = AnyRange, error = null;\n if (keyRangeGenerator)\n try {\n keyRange = keyRangeGenerator();\n }\n catch (ex) {\n error = ex;\n }\n const whereCtx = whereClause._ctx;\n const table = whereCtx.table;\n const readingHook = table.hook.reading.fire;\n this._ctx = {\n table: table,\n index: whereCtx.index,\n isPrimKey: (!whereCtx.index || (table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name)),\n range: keyRange,\n keysOnly: false,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: true,\n isMatch: null,\n offset: 0,\n limit: Infinity,\n error: error,\n or: whereCtx.or,\n valueMapper: readingHook !== mirror ? readingHook : null\n };\n });\n}\n\nfunction simpleCompare(a, b) {\n return a < b ? -1 : a === b ? 0 : 1;\n}\nfunction simpleCompareReverse(a, b) {\n return a > b ? -1 : a === b ? 0 : 1;\n}\n\nfunction fail(collectionOrWhereClause, err, T) {\n var collection = collectionOrWhereClause instanceof WhereClause ?\n new collectionOrWhereClause.Collection(collectionOrWhereClause) :\n collectionOrWhereClause;\n collection._ctx.error = T ? new T(err) : new TypeError(err);\n return collection;\n}\nfunction emptyCollection(whereClause) {\n return new whereClause.Collection(whereClause, () => rangeEqual(\"\")).limit(0);\n}\nfunction upperFactory(dir) {\n return dir === \"next\" ?\n (s) => s.toUpperCase() :\n (s) => s.toLowerCase();\n}\nfunction lowerFactory(dir) {\n return dir === \"next\" ?\n (s) => s.toLowerCase() :\n (s) => s.toUpperCase();\n}\nfunction nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {\n var length = Math.min(key.length, lowerNeedle.length);\n var llp = -1;\n for (var i = 0; i < length; ++i) {\n var lwrKeyChar = lowerKey[i];\n if (lwrKeyChar !== lowerNeedle[i]) {\n if (cmp(key[i], upperNeedle[i]) < 0)\n return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);\n if (cmp(key[i], lowerNeedle[i]) < 0)\n return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);\n if (llp >= 0)\n return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);\n return null;\n }\n if (cmp(key[i], lwrKeyChar) < 0)\n llp = i;\n }\n if (length < lowerNeedle.length && dir === \"next\")\n return key + upperNeedle.substr(key.length);\n if (length < key.length && dir === \"prev\")\n return key.substr(0, upperNeedle.length);\n return (llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1));\n}\nfunction addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {\n var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix, needlesLen = needles.length;\n if (!needles.every(s => typeof s === 'string')) {\n return fail(whereClause, STRING_EXPECTED);\n }\n function initDirection(dir) {\n upper = upperFactory(dir);\n lower = lowerFactory(dir);\n compare = (dir === \"next\" ? simpleCompare : simpleCompareReverse);\n var needleBounds = needles.map(function (needle) {\n return { lower: lower(needle), upper: upper(needle) };\n }).sort(function (a, b) {\n return compare(a.lower, b.lower);\n });\n upperNeedles = needleBounds.map(function (nb) { return nb.upper; });\n lowerNeedles = needleBounds.map(function (nb) { return nb.lower; });\n direction = dir;\n nextKeySuffix = (dir === \"next\" ? \"\" : suffix);\n }\n initDirection(\"next\");\n var c = new whereClause.Collection(whereClause, () => createRange(upperNeedles[0], lowerNeedles[needlesLen - 1] + suffix));\n c._ondirectionchange = function (direction) {\n initDirection(direction);\n };\n var firstPossibleNeedle = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n if (typeof key !== 'string')\n return false;\n var lowerKey = lower(key);\n if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {\n return true;\n }\n else {\n var lowestPossibleCasing = null;\n for (var i = firstPossibleNeedle; i < needlesLen; ++i) {\n var casing = nextCasing(key, lowerKey, upperNeedles[i], lowerNeedles[i], compare, direction);\n if (casing === null && lowestPossibleCasing === null)\n firstPossibleNeedle = i + 1;\n else if (lowestPossibleCasing === null || compare(lowestPossibleCasing, casing) > 0) {\n lowestPossibleCasing = casing;\n }\n }\n if (lowestPossibleCasing !== null) {\n advance(function () { cursor.continue(lowestPossibleCasing + nextKeySuffix); });\n }\n else {\n advance(resolve);\n }\n return false;\n }\n });\n return c;\n}\nfunction createRange(lower, upper, lowerOpen, upperOpen) {\n return {\n type: 2 ,\n lower,\n upper,\n lowerOpen,\n upperOpen\n };\n}\nfunction rangeEqual(value) {\n return {\n type: 1 ,\n lower: value,\n upper: value\n };\n}\n\nclass WhereClause {\n get Collection() {\n return this._ctx.table.db.Collection;\n }\n between(lower, upper, includeLower, includeUpper) {\n includeLower = includeLower !== false;\n includeUpper = includeUpper === true;\n try {\n if ((this._cmp(lower, upper) > 0) ||\n (this._cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)))\n return emptyCollection(this);\n return new this.Collection(this, () => createRange(lower, upper, !includeLower, !includeUpper));\n }\n catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n }\n equals(value) {\n if (value == null)\n return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => rangeEqual(value));\n }\n above(value) {\n if (value == null)\n return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(value, undefined, true));\n }\n aboveOrEqual(value) {\n if (value == null)\n return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(value, undefined, false));\n }\n below(value) {\n if (value == null)\n return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(undefined, value, false, true));\n }\n belowOrEqual(value) {\n if (value == null)\n return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(undefined, value));\n }\n startsWith(str) {\n if (typeof str !== 'string')\n return fail(this, STRING_EXPECTED);\n return this.between(str, str + maxString, true, true);\n }\n startsWithIgnoreCase(str) {\n if (str === \"\")\n return this.startsWith(str);\n return addIgnoreCaseAlgorithm(this, (x, a) => x.indexOf(a[0]) === 0, [str], maxString);\n }\n equalsIgnoreCase(str) {\n return addIgnoreCaseAlgorithm(this, (x, a) => x === a[0], [str], \"\");\n }\n anyOfIgnoreCase() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0)\n return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, (x, a) => a.indexOf(x) !== -1, set, \"\");\n }\n startsWithAnyOfIgnoreCase() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0)\n return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, (x, a) => a.some(n => x.indexOf(n) === 0), set, maxString);\n }\n anyOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n let compare = this._cmp;\n try {\n set.sort(compare);\n }\n catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n if (set.length === 0)\n return emptyCollection(this);\n const c = new this.Collection(this, () => createRange(set[0], set[set.length - 1]));\n c._ondirectionchange = direction => {\n compare = (direction === \"next\" ?\n this._ascending :\n this._descending);\n set.sort(compare);\n };\n let i = 0;\n c._addAlgorithm((cursor, advance, resolve) => {\n const key = cursor.key;\n while (compare(key, set[i]) > 0) {\n ++i;\n if (i === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (compare(key, set[i]) === 0) {\n return true;\n }\n else {\n advance(() => { cursor.continue(set[i]); });\n return false;\n }\n });\n return c;\n }\n notEqual(value) {\n return this.inAnyRange([[minKey, value], [value, this.db._maxKey]], { includeLowers: false, includeUppers: false });\n }\n noneOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0)\n return new this.Collection(this);\n try {\n set.sort(this._ascending);\n }\n catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n const ranges = set.reduce((res, val) => res ?\n res.concat([[res[res.length - 1][1], val]]) :\n [[minKey, val]], null);\n ranges.push([set[set.length - 1], this.db._maxKey]);\n return this.inAnyRange(ranges, { includeLowers: false, includeUppers: false });\n }\n inAnyRange(ranges, options) {\n const cmp = this._cmp, ascending = this._ascending, descending = this._descending, min = this._min, max = this._max;\n if (ranges.length === 0)\n return emptyCollection(this);\n if (!ranges.every(range => range[0] !== undefined &&\n range[1] !== undefined &&\n ascending(range[0], range[1]) <= 0)) {\n return fail(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", exceptions.InvalidArgument);\n }\n const includeLowers = !options || options.includeLowers !== false;\n const includeUppers = options && options.includeUppers === true;\n function addRange(ranges, newRange) {\n let i = 0, l = ranges.length;\n for (; i < l; ++i) {\n const range = ranges[i];\n if (cmp(newRange[0], range[1]) < 0 && cmp(newRange[1], range[0]) > 0) {\n range[0] = min(range[0], newRange[0]);\n range[1] = max(range[1], newRange[1]);\n break;\n }\n }\n if (i === l)\n ranges.push(newRange);\n return ranges;\n }\n let sortDirection = ascending;\n function rangeSorter(a, b) { return sortDirection(a[0], b[0]); }\n let set;\n try {\n set = ranges.reduce(addRange, []);\n set.sort(rangeSorter);\n }\n catch (ex) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n let rangePos = 0;\n const keyIsBeyondCurrentEntry = includeUppers ?\n key => ascending(key, set[rangePos][1]) > 0 :\n key => ascending(key, set[rangePos][1]) >= 0;\n const keyIsBeforeCurrentEntry = includeLowers ?\n key => descending(key, set[rangePos][0]) > 0 :\n key => descending(key, set[rangePos][0]) >= 0;\n function keyWithinCurrentRange(key) {\n return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);\n }\n let checkKey = keyIsBeyondCurrentEntry;\n const c = new this.Collection(this, () => createRange(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers));\n c._ondirectionchange = direction => {\n if (direction === \"next\") {\n checkKey = keyIsBeyondCurrentEntry;\n sortDirection = ascending;\n }\n else {\n checkKey = keyIsBeforeCurrentEntry;\n sortDirection = descending;\n }\n set.sort(rangeSorter);\n };\n c._addAlgorithm((cursor, advance, resolve) => {\n var key = cursor.key;\n while (checkKey(key)) {\n ++rangePos;\n if (rangePos === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (keyWithinCurrentRange(key)) {\n return true;\n }\n else if (this._cmp(key, set[rangePos][1]) === 0 || this._cmp(key, set[rangePos][0]) === 0) {\n return false;\n }\n else {\n advance(() => {\n if (sortDirection === ascending)\n cursor.continue(set[rangePos][0]);\n else\n cursor.continue(set[rangePos][1]);\n });\n return false;\n }\n });\n return c;\n }\n startsWithAnyOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (!set.every(s => typeof s === 'string')) {\n return fail(this, \"startsWithAnyOf() only works with strings\");\n }\n if (set.length === 0)\n return emptyCollection(this);\n return this.inAnyRange(set.map((str) => [str, str + maxString]));\n }\n}\n\nfunction createWhereClauseConstructor(db) {\n return makeClassConstructor(WhereClause.prototype, function WhereClause(table, index, orCollection) {\n this.db = db;\n this._ctx = {\n table: table,\n index: index === \":id\" ? null : index,\n or: orCollection\n };\n const indexedDB = db._deps.indexedDB;\n if (!indexedDB)\n throw new exceptions.MissingAPI();\n this._cmp = this._ascending = indexedDB.cmp.bind(indexedDB);\n this._descending = (a, b) => indexedDB.cmp(b, a);\n this._max = (a, b) => indexedDB.cmp(a, b) > 0 ? a : b;\n this._min = (a, b) => indexedDB.cmp(a, b) < 0 ? a : b;\n this._IDBKeyRange = db._deps.IDBKeyRange;\n });\n}\n\nfunction eventRejectHandler(reject) {\n return wrap(function (event) {\n preventDefault(event);\n reject(event.target.error);\n return false;\n });\n}\nfunction preventDefault(event) {\n if (event.stopPropagation)\n event.stopPropagation();\n if (event.preventDefault)\n event.preventDefault();\n}\n\nconst DEXIE_STORAGE_MUTATED_EVENT_NAME = 'storagemutated';\nconst STORAGE_MUTATED_DOM_EVENT_NAME = 'x-storagemutated-1';\nconst globalEvents = Events(null, DEXIE_STORAGE_MUTATED_EVENT_NAME);\n\nclass Transaction {\n _lock() {\n assert(!PSD.global);\n ++this._reculock;\n if (this._reculock === 1 && !PSD.global)\n PSD.lockOwnerFor = this;\n return this;\n }\n _unlock() {\n assert(!PSD.global);\n if (--this._reculock === 0) {\n if (!PSD.global)\n PSD.lockOwnerFor = null;\n while (this._blockedFuncs.length > 0 && !this._locked()) {\n var fnAndPSD = this._blockedFuncs.shift();\n try {\n usePSD(fnAndPSD[1], fnAndPSD[0]);\n }\n catch (e) { }\n }\n }\n return this;\n }\n _locked() {\n return this._reculock && PSD.lockOwnerFor !== this;\n }\n create(idbtrans) {\n if (!this.mode)\n return this;\n const idbdb = this.db.idbdb;\n const dbOpenError = this.db._state.dbOpenError;\n assert(!this.idbtrans);\n if (!idbtrans && !idbdb) {\n switch (dbOpenError && dbOpenError.name) {\n case \"DatabaseClosedError\":\n throw new exceptions.DatabaseClosed(dbOpenError);\n case \"MissingAPIError\":\n throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);\n default:\n throw new exceptions.OpenFailed(dbOpenError);\n }\n }\n if (!this.active)\n throw new exceptions.TransactionInactive();\n assert(this._completion._state === null);\n idbtrans = this.idbtrans = idbtrans ||\n (this.db.core\n ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })\n : idbdb.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }));\n idbtrans.onerror = wrap(ev => {\n preventDefault(ev);\n this._reject(idbtrans.error);\n });\n idbtrans.onabort = wrap(ev => {\n preventDefault(ev);\n this.active && this._reject(new exceptions.Abort(idbtrans.error));\n this.active = false;\n this.on(\"abort\").fire(ev);\n });\n idbtrans.oncomplete = wrap(() => {\n this.active = false;\n this._resolve();\n if ('mutatedParts' in idbtrans) {\n globalEvents.storagemutated.fire(idbtrans[\"mutatedParts\"]);\n }\n });\n return this;\n }\n _promise(mode, fn, bWriteLock) {\n if (mode === 'readwrite' && this.mode !== 'readwrite')\n return rejection(new exceptions.ReadOnly(\"Transaction is readonly\"));\n if (!this.active)\n return rejection(new exceptions.TransactionInactive());\n if (this._locked()) {\n return new DexiePromise((resolve, reject) => {\n this._blockedFuncs.push([() => {\n this._promise(mode, fn, bWriteLock).then(resolve, reject);\n }, PSD]);\n });\n }\n else if (bWriteLock) {\n return newScope(() => {\n var p = new DexiePromise((resolve, reject) => {\n this._lock();\n const rv = fn(resolve, reject, this);\n if (rv && rv.then)\n rv.then(resolve, reject);\n });\n p.finally(() => this._unlock());\n p._lib = true;\n return p;\n });\n }\n else {\n var p = new DexiePromise((resolve, reject) => {\n var rv = fn(resolve, reject, this);\n if (rv && rv.then)\n rv.then(resolve, reject);\n });\n p._lib = true;\n return p;\n }\n }\n _root() {\n return this.parent ? this.parent._root() : this;\n }\n waitFor(promiseLike) {\n var root = this._root();\n const promise = DexiePromise.resolve(promiseLike);\n if (root._waitingFor) {\n root._waitingFor = root._waitingFor.then(() => promise);\n }\n else {\n root._waitingFor = promise;\n root._waitingQueue = [];\n var store = root.idbtrans.objectStore(root.storeNames[0]);\n (function spin() {\n ++root._spinCount;\n while (root._waitingQueue.length)\n (root._waitingQueue.shift())();\n if (root._waitingFor)\n store.get(-Infinity).onsuccess = spin;\n }());\n }\n var currentWaitPromise = root._waitingFor;\n return new DexiePromise((resolve, reject) => {\n promise.then(res => root._waitingQueue.push(wrap(resolve.bind(null, res))), err => root._waitingQueue.push(wrap(reject.bind(null, err)))).finally(() => {\n if (root._waitingFor === currentWaitPromise) {\n root._waitingFor = null;\n }\n });\n });\n }\n abort() {\n if (this.active) {\n this.active = false;\n if (this.idbtrans)\n this.idbtrans.abort();\n this._reject(new exceptions.Abort());\n }\n }\n table(tableName) {\n const memoizedTables = (this._memoizedTables || (this._memoizedTables = {}));\n if (hasOwn(memoizedTables, tableName))\n return memoizedTables[tableName];\n const tableSchema = this.schema[tableName];\n if (!tableSchema) {\n throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n }\n const transactionBoundTable = new this.db.Table(tableName, tableSchema, this);\n transactionBoundTable.core = this.db.core.table(tableName);\n memoizedTables[tableName] = transactionBoundTable;\n return transactionBoundTable;\n }\n}\n\nfunction createTransactionConstructor(db) {\n return makeClassConstructor(Transaction.prototype, function Transaction(mode, storeNames, dbschema, chromeTransactionDurability, parent) {\n this.db = db;\n this.mode = mode;\n this.storeNames = storeNames;\n this.schema = dbschema;\n this.chromeTransactionDurability = chromeTransactionDurability;\n this.idbtrans = null;\n this.on = Events(this, \"complete\", \"error\", \"abort\");\n this.parent = parent || null;\n this.active = true;\n this._reculock = 0;\n this._blockedFuncs = [];\n this._resolve = null;\n this._reject = null;\n this._waitingFor = null;\n this._waitingQueue = null;\n this._spinCount = 0;\n this._completion = new DexiePromise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n this._completion.then(() => {\n this.active = false;\n this.on.complete.fire();\n }, e => {\n var wasActive = this.active;\n this.active = false;\n this.on.error.fire(e);\n this.parent ?\n this.parent._reject(e) :\n wasActive && this.idbtrans && this.idbtrans.abort();\n return rejection(e);\n });\n });\n}\n\nfunction createIndexSpec(name, keyPath, unique, multi, auto, compound, isPrimKey) {\n return {\n name,\n keyPath,\n unique,\n multi,\n auto,\n compound,\n src: (unique && !isPrimKey ? '&' : '') + (multi ? '*' : '') + (auto ? \"++\" : \"\") + nameFromKeyPath(keyPath)\n };\n}\nfunction nameFromKeyPath(keyPath) {\n return typeof keyPath === 'string' ?\n keyPath :\n keyPath ? ('[' + [].join.call(keyPath, '+') + ']') : \"\";\n}\n\nfunction createTableSchema(name, primKey, indexes) {\n return {\n name,\n primKey,\n indexes,\n mappedClass: null,\n idxByName: arrayToObject(indexes, index => [index.name, index])\n };\n}\n\nfunction safariMultiStoreFix(storeNames) {\n return storeNames.length === 1 ? storeNames[0] : storeNames;\n}\nlet getMaxKey = (IdbKeyRange) => {\n try {\n IdbKeyRange.only([[]]);\n getMaxKey = () => [[]];\n return [[]];\n }\n catch (e) {\n getMaxKey = () => maxString;\n return maxString;\n }\n};\n\nfunction getKeyExtractor(keyPath) {\n if (keyPath == null) {\n return () => undefined;\n }\n else if (typeof keyPath === 'string') {\n return getSinglePathKeyExtractor(keyPath);\n }\n else {\n return obj => getByKeyPath(obj, keyPath);\n }\n}\nfunction getSinglePathKeyExtractor(keyPath) {\n const split = keyPath.split('.');\n if (split.length === 1) {\n return obj => obj[keyPath];\n }\n else {\n return obj => getByKeyPath(obj, keyPath);\n }\n}\n\nfunction arrayify(arrayLike) {\n return [].slice.call(arrayLike);\n}\nlet _id_counter = 0;\nfunction getKeyPathAlias(keyPath) {\n return keyPath == null ?\n \":id\" :\n typeof keyPath === 'string' ?\n keyPath :\n `[${keyPath.join('+')}]`;\n}\nfunction createDBCore(db, IdbKeyRange, tmpTrans) {\n function extractSchema(db, trans) {\n const tables = arrayify(db.objectStoreNames);\n return {\n schema: {\n name: db.name,\n tables: tables.map(table => trans.objectStore(table)).map(store => {\n const { keyPath, autoIncrement } = store;\n const compound = isArray(keyPath);\n const outbound = keyPath == null;\n const indexByKeyPath = {};\n const result = {\n name: store.name,\n primaryKey: {\n name: null,\n isPrimaryKey: true,\n outbound,\n compound,\n keyPath,\n autoIncrement,\n unique: true,\n extractKey: getKeyExtractor(keyPath)\n },\n indexes: arrayify(store.indexNames).map(indexName => store.index(indexName))\n .map(index => {\n const { name, unique, multiEntry, keyPath } = index;\n const compound = isArray(keyPath);\n const result = {\n name,\n compound,\n keyPath,\n unique,\n multiEntry,\n extractKey: getKeyExtractor(keyPath)\n };\n indexByKeyPath[getKeyPathAlias(keyPath)] = result;\n return result;\n }),\n getIndexByKeyPath: (keyPath) => indexByKeyPath[getKeyPathAlias(keyPath)]\n };\n indexByKeyPath[\":id\"] = result.primaryKey;\n if (keyPath != null) {\n indexByKeyPath[getKeyPathAlias(keyPath)] = result.primaryKey;\n }\n return result;\n })\n },\n hasGetAll: tables.length > 0 && ('getAll' in trans.objectStore(tables[0])) &&\n !(typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) &&\n !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) &&\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n };\n }\n function makeIDBKeyRange(range) {\n if (range.type === 3 )\n return null;\n if (range.type === 4 )\n throw new Error(\"Cannot convert never type to IDBKeyRange\");\n const { lower, upper, lowerOpen, upperOpen } = range;\n const idbRange = lower === undefined ?\n upper === undefined ?\n null :\n IdbKeyRange.upperBound(upper, !!upperOpen) :\n upper === undefined ?\n IdbKeyRange.lowerBound(lower, !!lowerOpen) :\n IdbKeyRange.bound(lower, upper, !!lowerOpen, !!upperOpen);\n return idbRange;\n }\n function createDbCoreTable(tableSchema) {\n const tableName = tableSchema.name;\n function mutate({ trans, type, keys, values, range }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const outbound = store.keyPath == null;\n const isAddOrPut = type === \"put\" || type === \"add\";\n if (!isAddOrPut && type !== 'delete' && type !== 'deleteRange')\n throw new Error(\"Invalid operation type: \" + type);\n const { length } = keys || values || { length: 1 };\n if (keys && values && keys.length !== values.length) {\n throw new Error(\"Given keys array must have same length as given values array.\");\n }\n if (length === 0)\n return resolve({ numFailures: 0, failures: {}, results: [], lastResult: undefined });\n let req;\n const reqs = [];\n const failures = [];\n let numFailures = 0;\n const errorHandler = event => {\n ++numFailures;\n preventDefault(event);\n };\n if (type === 'deleteRange') {\n if (range.type === 4 )\n return resolve({ numFailures, failures, results: [], lastResult: undefined });\n if (range.type === 3 )\n reqs.push(req = store.clear());\n else\n reqs.push(req = store.delete(makeIDBKeyRange(range)));\n }\n else {\n const [args1, args2] = isAddOrPut ?\n outbound ?\n [values, keys] :\n [values, null] :\n [keys, null];\n if (isAddOrPut) {\n for (let i = 0; i < length; ++i) {\n reqs.push(req = (args2 && args2[i] !== undefined ?\n store[type](args1[i], args2[i]) :\n store[type](args1[i])));\n req.onerror = errorHandler;\n }\n }\n else {\n for (let i = 0; i < length; ++i) {\n reqs.push(req = store[type](args1[i]));\n req.onerror = errorHandler;\n }\n }\n }\n const done = event => {\n const lastResult = event.target.result;\n reqs.forEach((req, i) => req.error != null && (failures[i] = req.error));\n resolve({\n numFailures,\n failures,\n results: type === \"delete\" ? keys : reqs.map(req => req.result),\n lastResult\n });\n };\n req.onerror = event => {\n errorHandler(event);\n done(event);\n };\n req.onsuccess = done;\n });\n }\n function openCursor({ trans, values, query, reverse, unique }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const { index, range } = query;\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ?\n store :\n store.index(index.name);\n const direction = reverse ?\n unique ?\n \"prevunique\" :\n \"prev\" :\n unique ?\n \"nextunique\" :\n \"next\";\n const req = values || !('openKeyCursor' in source) ?\n source.openCursor(makeIDBKeyRange(range), direction) :\n source.openKeyCursor(makeIDBKeyRange(range), direction);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(ev => {\n const cursor = req.result;\n if (!cursor) {\n resolve(null);\n return;\n }\n cursor.___id = ++_id_counter;\n cursor.done = false;\n const _cursorContinue = cursor.continue.bind(cursor);\n let _cursorContinuePrimaryKey = cursor.continuePrimaryKey;\n if (_cursorContinuePrimaryKey)\n _cursorContinuePrimaryKey = _cursorContinuePrimaryKey.bind(cursor);\n const _cursorAdvance = cursor.advance.bind(cursor);\n const doThrowCursorIsNotStarted = () => { throw new Error(\"Cursor not started\"); };\n const doThrowCursorIsStopped = () => { throw new Error(\"Cursor not stopped\"); };\n cursor.trans = trans;\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsNotStarted;\n cursor.fail = wrap(reject);\n cursor.next = function () {\n let gotOne = 1;\n return this.start(() => gotOne-- ? this.continue() : this.stop()).then(() => this);\n };\n cursor.start = (callback) => {\n const iterationPromise = new Promise((resolveIteration, rejectIteration) => {\n resolveIteration = wrap(resolveIteration);\n req.onerror = eventRejectHandler(rejectIteration);\n cursor.fail = rejectIteration;\n cursor.stop = value => {\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsStopped;\n resolveIteration(value);\n };\n });\n const guardedCallback = () => {\n if (req.result) {\n try {\n callback();\n }\n catch (err) {\n cursor.fail(err);\n }\n }\n else {\n cursor.done = true;\n cursor.start = () => { throw new Error(\"Cursor behind last entry\"); };\n cursor.stop();\n }\n };\n req.onsuccess = wrap(ev => {\n req.onsuccess = guardedCallback;\n guardedCallback();\n });\n cursor.continue = _cursorContinue;\n cursor.continuePrimaryKey = _cursorContinuePrimaryKey;\n cursor.advance = _cursorAdvance;\n guardedCallback();\n return iterationPromise;\n };\n resolve(cursor);\n }, reject);\n });\n }\n function query(hasGetAll) {\n return (request) => {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const { trans, values, limit, query } = request;\n const nonInfinitLimit = limit === Infinity ? undefined : limit;\n const { index, range } = query;\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ? store : store.index(index.name);\n const idbKeyRange = makeIDBKeyRange(range);\n if (limit === 0)\n return resolve({ result: [] });\n if (hasGetAll) {\n const req = values ?\n source.getAll(idbKeyRange, nonInfinitLimit) :\n source.getAllKeys(idbKeyRange, nonInfinitLimit);\n req.onsuccess = event => resolve({ result: event.target.result });\n req.onerror = eventRejectHandler(reject);\n }\n else {\n let count = 0;\n const req = values || !('openKeyCursor' in source) ?\n source.openCursor(idbKeyRange) :\n source.openKeyCursor(idbKeyRange);\n const result = [];\n req.onsuccess = event => {\n const cursor = req.result;\n if (!cursor)\n return resolve({ result });\n result.push(values ? cursor.value : cursor.primaryKey);\n if (++count === limit)\n return resolve({ result });\n cursor.continue();\n };\n req.onerror = eventRejectHandler(reject);\n }\n });\n };\n }\n return {\n name: tableName,\n schema: tableSchema,\n mutate,\n getMany({ trans, keys }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const length = keys.length;\n const result = new Array(length);\n let keyCount = 0;\n let callbackCount = 0;\n let req;\n const successHandler = event => {\n const req = event.target;\n if ((result[req._pos] = req.result) != null)\n ;\n if (++callbackCount === keyCount)\n resolve(result);\n };\n const errorHandler = eventRejectHandler(reject);\n for (let i = 0; i < length; ++i) {\n const key = keys[i];\n if (key != null) {\n req = store.get(keys[i]);\n req._pos = i;\n req.onsuccess = successHandler;\n req.onerror = errorHandler;\n ++keyCount;\n }\n }\n if (keyCount === 0)\n resolve(result);\n });\n },\n get({ trans, key }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const req = store.get(key);\n req.onsuccess = event => resolve(event.target.result);\n req.onerror = eventRejectHandler(reject);\n });\n },\n query: query(hasGetAll),\n openCursor,\n count({ query, trans }) {\n const { index, range } = query;\n return new Promise((resolve, reject) => {\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ? store : store.index(index.name);\n const idbKeyRange = makeIDBKeyRange(range);\n const req = idbKeyRange ? source.count(idbKeyRange) : source.count();\n req.onsuccess = wrap(ev => resolve(ev.target.result));\n req.onerror = eventRejectHandler(reject);\n });\n }\n };\n }\n const { schema, hasGetAll } = extractSchema(db, tmpTrans);\n const tables = schema.tables.map(tableSchema => createDbCoreTable(tableSchema));\n const tableMap = {};\n tables.forEach(table => tableMap[table.name] = table);\n return {\n stack: \"dbcore\",\n transaction: db.transaction.bind(db),\n table(name) {\n const result = tableMap[name];\n if (!result)\n throw new Error(`Table '${name}' not found`);\n return tableMap[name];\n },\n MIN_KEY: -Infinity,\n MAX_KEY: getMaxKey(IdbKeyRange),\n schema\n };\n}\n\nfunction createMiddlewareStack(stackImpl, middlewares) {\n return middlewares.reduce((down, { create }) => ({ ...down, ...create(down) }), stackImpl);\n}\nfunction createMiddlewareStacks(middlewares, idbdb, { IDBKeyRange, indexedDB }, tmpTrans) {\n const dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);\n return {\n dbcore\n };\n}\nfunction generateMiddlewareStacks({ _novip: db }, tmpTrans) {\n const idbdb = tmpTrans.db;\n const stacks = createMiddlewareStacks(db._middlewares, idbdb, db._deps, tmpTrans);\n db.core = stacks.dbcore;\n db.tables.forEach(table => {\n const tableName = table.name;\n if (db.core.schema.tables.some(tbl => tbl.name === tableName)) {\n table.core = db.core.table(tableName);\n if (db[tableName] instanceof db.Table) {\n db[tableName].core = table.core;\n }\n }\n });\n}\n\nfunction setApiOnPlace({ _novip: db }, objs, tableNames, dbschema) {\n tableNames.forEach(tableName => {\n const schema = dbschema[tableName];\n objs.forEach(obj => {\n const propDesc = getPropertyDescriptor(obj, tableName);\n if (!propDesc || (\"value\" in propDesc && propDesc.value === undefined)) {\n if (obj === db.Transaction.prototype || obj instanceof db.Transaction) {\n setProp(obj, tableName, {\n get() { return this.table(tableName); },\n set(value) {\n defineProperty(this, tableName, { value, writable: true, configurable: true, enumerable: true });\n }\n });\n }\n else {\n obj[tableName] = new db.Table(tableName, schema);\n }\n }\n });\n });\n}\nfunction removeTablesApi({ _novip: db }, objs) {\n objs.forEach(obj => {\n for (let key in obj) {\n if (obj[key] instanceof db.Table)\n delete obj[key];\n }\n });\n}\nfunction lowerVersionFirst(a, b) {\n return a._cfg.version - b._cfg.version;\n}\nfunction runUpgraders(db, oldVersion, idbUpgradeTrans, reject) {\n const globalSchema = db._dbSchema;\n const trans = db._createTransaction('readwrite', db._storeNames, globalSchema);\n trans.create(idbUpgradeTrans);\n trans._completion.catch(reject);\n const rejectTransaction = trans._reject.bind(trans);\n const transless = PSD.transless || PSD;\n newScope(() => {\n PSD.trans = trans;\n PSD.transless = transless;\n if (oldVersion === 0) {\n keys(globalSchema).forEach(tableName => {\n createTable(idbUpgradeTrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);\n });\n generateMiddlewareStacks(db, idbUpgradeTrans);\n DexiePromise.follow(() => db.on.populate.fire(trans)).catch(rejectTransaction);\n }\n else\n updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans).catch(rejectTransaction);\n });\n}\nfunction updateTablesAndIndexes({ _novip: db }, oldVersion, trans, idbUpgradeTrans) {\n const queue = [];\n const versions = db._versions;\n let globalSchema = db._dbSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);\n let anyContentUpgraderHasRun = false;\n const versToRun = versions.filter(v => v._cfg.version >= oldVersion);\n versToRun.forEach(version => {\n queue.push(() => {\n const oldSchema = globalSchema;\n const newSchema = version._cfg.dbschema;\n adjustToExistingIndexNames(db, oldSchema, idbUpgradeTrans);\n adjustToExistingIndexNames(db, newSchema, idbUpgradeTrans);\n globalSchema = db._dbSchema = newSchema;\n const diff = getSchemaDiff(oldSchema, newSchema);\n diff.add.forEach(tuple => {\n createTable(idbUpgradeTrans, tuple[0], tuple[1].primKey, tuple[1].indexes);\n });\n diff.change.forEach(change => {\n if (change.recreate) {\n throw new exceptions.Upgrade(\"Not yet support for changing primary key\");\n }\n else {\n const store = idbUpgradeTrans.objectStore(change.name);\n change.add.forEach(idx => addIndex(store, idx));\n change.change.forEach(idx => {\n store.deleteIndex(idx.name);\n addIndex(store, idx);\n });\n change.del.forEach(idxName => store.deleteIndex(idxName));\n }\n });\n const contentUpgrade = version._cfg.contentUpgrade;\n if (contentUpgrade && version._cfg.version > oldVersion) {\n generateMiddlewareStacks(db, idbUpgradeTrans);\n trans._memoizedTables = {};\n anyContentUpgraderHasRun = true;\n let upgradeSchema = shallowClone(newSchema);\n diff.del.forEach(table => {\n upgradeSchema[table] = oldSchema[table];\n });\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], keys(upgradeSchema), upgradeSchema);\n trans.schema = upgradeSchema;\n const contentUpgradeIsAsync = isAsyncFunction(contentUpgrade);\n if (contentUpgradeIsAsync) {\n incrementExpectedAwaits();\n }\n let returnValue;\n const promiseFollowed = DexiePromise.follow(() => {\n returnValue = contentUpgrade(trans);\n if (returnValue) {\n if (contentUpgradeIsAsync) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n }\n }\n });\n return (returnValue && typeof returnValue.then === 'function' ?\n DexiePromise.resolve(returnValue) : promiseFollowed.then(() => returnValue));\n }\n });\n queue.push(idbtrans => {\n if (!anyContentUpgraderHasRun || !hasIEDeleteObjectStoreBug) {\n const newSchema = version._cfg.dbschema;\n deleteRemovedTables(newSchema, idbtrans);\n }\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], db._storeNames, db._dbSchema);\n trans.schema = db._dbSchema;\n });\n });\n function runQueue() {\n return queue.length ? DexiePromise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) :\n DexiePromise.resolve();\n }\n return runQueue().then(() => {\n createMissingTables(globalSchema, idbUpgradeTrans);\n });\n}\nfunction getSchemaDiff(oldSchema, newSchema) {\n const diff = {\n del: [],\n add: [],\n change: []\n };\n let table;\n for (table in oldSchema) {\n if (!newSchema[table])\n diff.del.push(table);\n }\n for (table in newSchema) {\n const oldDef = oldSchema[table], newDef = newSchema[table];\n if (!oldDef) {\n diff.add.push([table, newDef]);\n }\n else {\n const change = {\n name: table,\n def: newDef,\n recreate: false,\n del: [],\n add: [],\n change: []\n };\n if ((\n '' + (oldDef.primKey.keyPath || '')) !== ('' + (newDef.primKey.keyPath || '')) ||\n (oldDef.primKey.auto !== newDef.primKey.auto && !isIEOrEdge))\n {\n change.recreate = true;\n diff.change.push(change);\n }\n else {\n const oldIndexes = oldDef.idxByName;\n const newIndexes = newDef.idxByName;\n let idxName;\n for (idxName in oldIndexes) {\n if (!newIndexes[idxName])\n change.del.push(idxName);\n }\n for (idxName in newIndexes) {\n const oldIdx = oldIndexes[idxName], newIdx = newIndexes[idxName];\n if (!oldIdx)\n change.add.push(newIdx);\n else if (oldIdx.src !== newIdx.src)\n change.change.push(newIdx);\n }\n if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {\n diff.change.push(change);\n }\n }\n }\n }\n return diff;\n}\nfunction createTable(idbtrans, tableName, primKey, indexes) {\n const store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ?\n { keyPath: primKey.keyPath, autoIncrement: primKey.auto } :\n { autoIncrement: primKey.auto });\n indexes.forEach(idx => addIndex(store, idx));\n return store;\n}\nfunction createMissingTables(newSchema, idbtrans) {\n keys(newSchema).forEach(tableName => {\n if (!idbtrans.db.objectStoreNames.contains(tableName)) {\n createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);\n }\n });\n}\nfunction deleteRemovedTables(newSchema, idbtrans) {\n [].slice.call(idbtrans.db.objectStoreNames).forEach(storeName => newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName));\n}\nfunction addIndex(store, idx) {\n store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });\n}\nfunction buildGlobalSchema(db, idbdb, tmpTrans) {\n const globalSchema = {};\n const dbStoreNames = slice(idbdb.objectStoreNames, 0);\n dbStoreNames.forEach(storeName => {\n const store = tmpTrans.objectStore(storeName);\n let keyPath = store.keyPath;\n const primKey = createIndexSpec(nameFromKeyPath(keyPath), keyPath || \"\", false, false, !!store.autoIncrement, keyPath && typeof keyPath !== \"string\", true);\n const indexes = [];\n for (let j = 0; j < store.indexNames.length; ++j) {\n const idbindex = store.index(store.indexNames[j]);\n keyPath = idbindex.keyPath;\n var index = createIndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== \"string\", false);\n indexes.push(index);\n }\n globalSchema[storeName] = createTableSchema(storeName, primKey, indexes);\n });\n return globalSchema;\n}\nfunction readGlobalSchema({ _novip: db }, idbdb, tmpTrans) {\n db.verno = idbdb.version / 10;\n const globalSchema = db._dbSchema = buildGlobalSchema(db, idbdb, tmpTrans);\n db._storeNames = slice(idbdb.objectStoreNames, 0);\n setApiOnPlace(db, [db._allTables], keys(globalSchema), globalSchema);\n}\nfunction verifyInstalledSchema(db, tmpTrans) {\n const installedSchema = buildGlobalSchema(db, db.idbdb, tmpTrans);\n const diff = getSchemaDiff(installedSchema, db._dbSchema);\n return !(diff.add.length || diff.change.some(ch => ch.add.length || ch.change.length));\n}\nfunction adjustToExistingIndexNames({ _novip: db }, schema, idbtrans) {\n const storeNames = idbtrans.db.objectStoreNames;\n for (let i = 0; i < storeNames.length; ++i) {\n const storeName = storeNames[i];\n const store = idbtrans.objectStore(storeName);\n db._hasGetAll = 'getAll' in store;\n for (let j = 0; j < store.indexNames.length; ++j) {\n const indexName = store.indexNames[j];\n const keyPath = store.index(indexName).keyPath;\n const dexieName = typeof keyPath === 'string' ? keyPath : \"[\" + slice(keyPath).join('+') + \"]\";\n if (schema[storeName]) {\n const indexSpec = schema[storeName].idxByName[dexieName];\n if (indexSpec) {\n indexSpec.name = indexName;\n delete schema[storeName].idxByName[dexieName];\n schema[storeName].idxByName[indexName] = indexSpec;\n }\n }\n }\n }\n if (typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) &&\n !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) &&\n _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope &&\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604) {\n db._hasGetAll = false;\n }\n}\nfunction parseIndexSyntax(primKeyAndIndexes) {\n return primKeyAndIndexes.split(',').map((index, indexNum) => {\n index = index.trim();\n const name = index.replace(/([&*]|\\+\\+)/g, \"\");\n const keyPath = /^\\[/.test(name) ? name.match(/^\\[(.*)\\]$/)[1].split('+') : name;\n return createIndexSpec(name, keyPath || null, /\\&/.test(index), /\\*/.test(index), /\\+\\+/.test(index), isArray(keyPath), indexNum === 0);\n });\n}\n\nclass Version {\n _parseStoresSpec(stores, outSchema) {\n keys(stores).forEach(tableName => {\n if (stores[tableName] !== null) {\n var indexes = parseIndexSyntax(stores[tableName]);\n var primKey = indexes.shift();\n if (primKey.multi)\n throw new exceptions.Schema(\"Primary key cannot be multi-valued\");\n indexes.forEach(idx => {\n if (idx.auto)\n throw new exceptions.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!idx.keyPath)\n throw new exceptions.Schema(\"Index must have a name and cannot be an empty string\");\n });\n outSchema[tableName] = createTableSchema(tableName, primKey, indexes);\n }\n });\n }\n stores(stores) {\n const db = this.db;\n this._cfg.storesSource = this._cfg.storesSource ?\n extend(this._cfg.storesSource, stores) :\n stores;\n const versions = db._versions;\n const storesSpec = {};\n let dbschema = {};\n versions.forEach(version => {\n extend(storesSpec, version._cfg.storesSource);\n dbschema = (version._cfg.dbschema = {});\n version._parseStoresSpec(storesSpec, dbschema);\n });\n db._dbSchema = dbschema;\n removeTablesApi(db, [db._allTables, db, db.Transaction.prototype]);\n setApiOnPlace(db, [db._allTables, db, db.Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);\n db._storeNames = keys(dbschema);\n return this;\n }\n upgrade(upgradeFunction) {\n this._cfg.contentUpgrade = promisableChain(this._cfg.contentUpgrade || nop, upgradeFunction);\n return this;\n }\n}\n\nfunction createVersionConstructor(db) {\n return makeClassConstructor(Version.prototype, function Version(versionNumber) {\n this.db = db;\n this._cfg = {\n version: versionNumber,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n });\n}\n\nfunction getDbNamesTable(indexedDB, IDBKeyRange) {\n let dbNamesDB = indexedDB[\"_dbNamesDB\"];\n if (!dbNamesDB) {\n dbNamesDB = indexedDB[\"_dbNamesDB\"] = new Dexie$1(DBNAMES_DB, {\n addons: [],\n indexedDB,\n IDBKeyRange,\n });\n dbNamesDB.version(1).stores({ dbnames: \"name\" });\n }\n return dbNamesDB.table(\"dbnames\");\n}\nfunction hasDatabasesNative(indexedDB) {\n return indexedDB && typeof indexedDB.databases === \"function\";\n}\nfunction getDatabaseNames({ indexedDB, IDBKeyRange, }) {\n return hasDatabasesNative(indexedDB)\n ? Promise.resolve(indexedDB.databases()).then((infos) => infos\n .map((info) => info.name)\n .filter((name) => name !== DBNAMES_DB))\n : getDbNamesTable(indexedDB, IDBKeyRange).toCollection().primaryKeys();\n}\nfunction _onDatabaseCreated({ indexedDB, IDBKeyRange }, name) {\n !hasDatabasesNative(indexedDB) &&\n name !== DBNAMES_DB &&\n getDbNamesTable(indexedDB, IDBKeyRange).put({ name }).catch(nop);\n}\nfunction _onDatabaseDeleted({ indexedDB, IDBKeyRange }, name) {\n !hasDatabasesNative(indexedDB) &&\n name !== DBNAMES_DB &&\n getDbNamesTable(indexedDB, IDBKeyRange).delete(name).catch(nop);\n}\n\nfunction vip(fn) {\n return newScope(function () {\n PSD.letThrough = true;\n return fn();\n });\n}\n\nfunction idbReady() {\n var isSafari = !navigator.userAgentData &&\n /Safari\\//.test(navigator.userAgent) &&\n !/Chrom(e|ium)\\//.test(navigator.userAgent);\n if (!isSafari || !indexedDB.databases)\n return Promise.resolve();\n var intervalId;\n return new Promise(function (resolve) {\n var tryIdb = function () { return indexedDB.databases().finally(resolve); };\n intervalId = setInterval(tryIdb, 100);\n tryIdb();\n }).finally(function () { return clearInterval(intervalId); });\n}\n\nfunction dexieOpen(db) {\n const state = db._state;\n const { indexedDB } = db._deps;\n if (state.isBeingOpened || db.idbdb)\n return state.dbReadyPromise.then(() => state.dbOpenError ?\n rejection(state.dbOpenError) :\n db);\n debug && (state.openCanceller._stackHolder = getErrorWithStack());\n state.isBeingOpened = true;\n state.dbOpenError = null;\n state.openComplete = false;\n const openCanceller = state.openCanceller;\n function throwIfCancelled() {\n if (state.openCanceller !== openCanceller)\n throw new exceptions.DatabaseClosed('db.open() was cancelled');\n }\n let resolveDbReady = state.dbReadyResolve,\n upgradeTransaction = null, wasCreated = false;\n const tryOpenDB = () => new DexiePromise((resolve, reject) => {\n throwIfCancelled();\n if (!indexedDB)\n throw new exceptions.MissingAPI();\n const dbName = db.name;\n const req = state.autoSchema ?\n indexedDB.open(dbName) :\n indexedDB.open(dbName, Math.round(db.verno * 10));\n if (!req)\n throw new exceptions.MissingAPI();\n req.onerror = eventRejectHandler(reject);\n req.onblocked = wrap(db._fireOnBlocked);\n req.onupgradeneeded = wrap(e => {\n upgradeTransaction = req.transaction;\n if (state.autoSchema && !db._options.allowEmptyDB) {\n req.onerror = preventDefault;\n upgradeTransaction.abort();\n req.result.close();\n const delreq = indexedDB.deleteDatabase(dbName);\n delreq.onsuccess = delreq.onerror = wrap(() => {\n reject(new exceptions.NoSuchDatabase(`Database ${dbName} doesnt exist`));\n });\n }\n else {\n upgradeTransaction.onerror = eventRejectHandler(reject);\n var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;\n wasCreated = oldVer < 1;\n db._novip.idbdb = req.result;\n runUpgraders(db, oldVer / 10, upgradeTransaction, reject);\n }\n }, reject);\n req.onsuccess = wrap(() => {\n upgradeTransaction = null;\n const idbdb = db._novip.idbdb = req.result;\n const objectStoreNames = slice(idbdb.objectStoreNames);\n if (objectStoreNames.length > 0)\n try {\n const tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');\n if (state.autoSchema)\n readGlobalSchema(db, idbdb, tmpTrans);\n else {\n adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);\n if (!verifyInstalledSchema(db, tmpTrans)) {\n console.warn(`Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.`);\n }\n }\n generateMiddlewareStacks(db, tmpTrans);\n }\n catch (e) {\n }\n connections.push(db);\n idbdb.onversionchange = wrap(ev => {\n state.vcFired = true;\n db.on(\"versionchange\").fire(ev);\n });\n idbdb.onclose = wrap(ev => {\n db.on(\"close\").fire(ev);\n });\n if (wasCreated)\n _onDatabaseCreated(db._deps, dbName);\n resolve();\n }, reject);\n }).catch(err => {\n if (err && err.name === 'UnknownError' && state.PR1398_maxLoop > 0) {\n state.PR1398_maxLoop--;\n console.warn('Dexie: Workaround for Chrome UnknownError on open()');\n return tryOpenDB();\n }\n else {\n return DexiePromise.reject(err);\n }\n });\n return DexiePromise.race([\n openCanceller,\n (typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)\n ]).then(() => {\n throwIfCancelled();\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(() => db.on.ready.fire(db.vip))).then(function fireRemainders() {\n if (state.onReadyBeingFired.length > 0) {\n let remainders = state.onReadyBeingFired.reduce(promisableChain, nop);\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(() => remainders(db.vip))).then(fireRemainders);\n }\n });\n }).finally(() => {\n state.onReadyBeingFired = null;\n state.isBeingOpened = false;\n }).then(() => {\n return db;\n }).catch(err => {\n state.dbOpenError = err;\n try {\n upgradeTransaction && upgradeTransaction.abort();\n }\n catch (_a) { }\n if (openCanceller === state.openCanceller) {\n db._close();\n }\n return rejection(err);\n }).finally(() => {\n state.openComplete = true;\n resolveDbReady();\n });\n}\n\nfunction awaitIterator(iterator) {\n var callNext = result => iterator.next(result), doThrow = error => iterator.throw(error), onSuccess = step(callNext), onError = step(doThrow);\n function step(getNext) {\n return (val) => {\n var next = getNext(val), value = next.value;\n return next.done ? value :\n (!value || typeof value.then !== 'function' ?\n isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) :\n value.then(onSuccess, onError));\n };\n }\n return step(callNext)();\n}\n\nfunction extractTransactionArgs(mode, _tableArgs_, scopeFunc) {\n var i = arguments.length;\n if (i < 2)\n throw new exceptions.InvalidArgument(\"Too few arguments\");\n var args = new Array(i - 1);\n while (--i)\n args[i - 1] = arguments[i];\n scopeFunc = args.pop();\n var tables = flatten(args);\n return [mode, tables, scopeFunc];\n}\nfunction enterTransactionScope(db, mode, storeNames, parentTransaction, scopeFunc) {\n return DexiePromise.resolve().then(() => {\n const transless = PSD.transless || PSD;\n const trans = db._createTransaction(mode, storeNames, db._dbSchema, parentTransaction);\n const zoneProps = {\n trans: trans,\n transless: transless\n };\n if (parentTransaction) {\n trans.idbtrans = parentTransaction.idbtrans;\n }\n else {\n try {\n trans.create();\n db._state.PR1398_maxLoop = 3;\n }\n catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db._close();\n return db.open().then(() => enterTransactionScope(db, mode, storeNames, null, scopeFunc));\n }\n return rejection(ex);\n }\n }\n const scopeFuncIsAsync = isAsyncFunction(scopeFunc);\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n let returnValue;\n const promiseFollowed = DexiePromise.follow(() => {\n returnValue = scopeFunc.call(trans, trans);\n if (returnValue) {\n if (scopeFuncIsAsync) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n }\n else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {\n returnValue = awaitIterator(returnValue);\n }\n }\n }, zoneProps);\n return (returnValue && typeof returnValue.then === 'function' ?\n DexiePromise.resolve(returnValue).then(x => trans.active ?\n x\n : rejection(new exceptions.PrematureCommit(\"Transaction committed too early. See http://bit.ly/2kdckMn\")))\n : promiseFollowed.then(() => returnValue)).then(x => {\n if (parentTransaction)\n trans._resolve();\n return trans._completion.then(() => x);\n }).catch(e => {\n trans._reject(e);\n return rejection(e);\n });\n });\n}\n\nfunction pad(a, value, count) {\n const result = isArray(a) ? a.slice() : [a];\n for (let i = 0; i < count; ++i)\n result.push(value);\n return result;\n}\nfunction createVirtualIndexMiddleware(down) {\n return {\n ...down,\n table(tableName) {\n const table = down.table(tableName);\n const { schema } = table;\n const indexLookup = {};\n const allVirtualIndexes = [];\n function addVirtualIndexes(keyPath, keyTail, lowLevelIndex) {\n const keyPathAlias = getKeyPathAlias(keyPath);\n const indexList = (indexLookup[keyPathAlias] = indexLookup[keyPathAlias] || []);\n const keyLength = keyPath == null ? 0 : typeof keyPath === 'string' ? 1 : keyPath.length;\n const isVirtual = keyTail > 0;\n const virtualIndex = {\n ...lowLevelIndex,\n isVirtual,\n keyTail,\n keyLength,\n extractKey: getKeyExtractor(keyPath),\n unique: !isVirtual && lowLevelIndex.unique\n };\n indexList.push(virtualIndex);\n if (!virtualIndex.isPrimaryKey) {\n allVirtualIndexes.push(virtualIndex);\n }\n if (keyLength > 1) {\n const virtualKeyPath = keyLength === 2 ?\n keyPath[0] :\n keyPath.slice(0, keyLength - 1);\n addVirtualIndexes(virtualKeyPath, keyTail + 1, lowLevelIndex);\n }\n indexList.sort((a, b) => a.keyTail - b.keyTail);\n return virtualIndex;\n }\n const primaryKey = addVirtualIndexes(schema.primaryKey.keyPath, 0, schema.primaryKey);\n indexLookup[\":id\"] = [primaryKey];\n for (const index of schema.indexes) {\n addVirtualIndexes(index.keyPath, 0, index);\n }\n function findBestIndex(keyPath) {\n const result = indexLookup[getKeyPathAlias(keyPath)];\n return result && result[0];\n }\n function translateRange(range, keyTail) {\n return {\n type: range.type === 1 ?\n 2 :\n range.type,\n lower: pad(range.lower, range.lowerOpen ? down.MAX_KEY : down.MIN_KEY, keyTail),\n lowerOpen: true,\n upper: pad(range.upper, range.upperOpen ? down.MIN_KEY : down.MAX_KEY, keyTail),\n upperOpen: true\n };\n }\n function translateRequest(req) {\n const index = req.query.index;\n return index.isVirtual ? {\n ...req,\n query: {\n index,\n range: translateRange(req.query.range, index.keyTail)\n }\n } : req;\n }\n const result = {\n ...table,\n schema: {\n ...schema,\n primaryKey,\n indexes: allVirtualIndexes,\n getIndexByKeyPath: findBestIndex\n },\n count(req) {\n return table.count(translateRequest(req));\n },\n query(req) {\n return table.query(translateRequest(req));\n },\n openCursor(req) {\n const { keyTail, isVirtual, keyLength } = req.query.index;\n if (!isVirtual)\n return table.openCursor(req);\n function createVirtualCursor(cursor) {\n function _continue(key) {\n key != null ?\n cursor.continue(pad(key, req.reverse ? down.MAX_KEY : down.MIN_KEY, keyTail)) :\n req.unique ?\n cursor.continue(cursor.key.slice(0, keyLength)\n .concat(req.reverse\n ? down.MIN_KEY\n : down.MAX_KEY, keyTail)) :\n cursor.continue();\n }\n const virtualCursor = Object.create(cursor, {\n continue: { value: _continue },\n continuePrimaryKey: {\n value(key, primaryKey) {\n cursor.continuePrimaryKey(pad(key, down.MAX_KEY, keyTail), primaryKey);\n }\n },\n primaryKey: {\n get() {\n return cursor.primaryKey;\n }\n },\n key: {\n get() {\n const key = cursor.key;\n return keyLength === 1 ?\n key[0] :\n key.slice(0, keyLength);\n }\n },\n value: {\n get() {\n return cursor.value;\n }\n }\n });\n return virtualCursor;\n }\n return table.openCursor(translateRequest(req))\n .then(cursor => cursor && createVirtualCursor(cursor));\n }\n };\n return result;\n }\n };\n}\nconst virtualIndexMiddleware = {\n stack: \"dbcore\",\n name: \"VirtualIndexMiddleware\",\n level: 1,\n create: createVirtualIndexMiddleware\n};\n\nfunction getObjectDiff(a, b, rv, prfx) {\n rv = rv || {};\n prfx = prfx || '';\n keys(a).forEach((prop) => {\n if (!hasOwn(b, prop)) {\n rv[prfx + prop] = undefined;\n }\n else {\n var ap = a[prop], bp = b[prop];\n if (typeof ap === 'object' && typeof bp === 'object' && ap && bp) {\n const apTypeName = toStringTag(ap);\n const bpTypeName = toStringTag(bp);\n if (apTypeName !== bpTypeName) {\n rv[prfx + prop] = b[prop];\n }\n else if (apTypeName === 'Object') {\n getObjectDiff(ap, bp, rv, prfx + prop + '.');\n }\n else if (ap !== bp) {\n rv[prfx + prop] = b[prop];\n }\n }\n else if (ap !== bp)\n rv[prfx + prop] = b[prop];\n }\n });\n keys(b).forEach((prop) => {\n if (!hasOwn(a, prop)) {\n rv[prfx + prop] = b[prop];\n }\n });\n return rv;\n}\n\nfunction getEffectiveKeys(primaryKey, req) {\n if (req.type === 'delete')\n return req.keys;\n return req.keys || req.values.map(primaryKey.extractKey);\n}\n\nconst hooksMiddleware = {\n stack: \"dbcore\",\n name: \"HooksMiddleware\",\n level: 2,\n create: (downCore) => ({\n ...downCore,\n table(tableName) {\n const downTable = downCore.table(tableName);\n const { primaryKey } = downTable.schema;\n const tableMiddleware = {\n ...downTable,\n mutate(req) {\n const dxTrans = PSD.trans;\n const { deleting, creating, updating } = dxTrans.table(tableName).hook;\n switch (req.type) {\n case 'add':\n if (creating.fire === nop)\n break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'put':\n if (creating.fire === nop && updating.fire === nop)\n break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'delete':\n if (deleting.fire === nop)\n break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'deleteRange':\n if (deleting.fire === nop)\n break;\n return dxTrans._promise('readwrite', () => deleteRange(req), true);\n }\n return downTable.mutate(req);\n function addPutOrDelete(req) {\n const dxTrans = PSD.trans;\n const keys = req.keys || getEffectiveKeys(primaryKey, req);\n if (!keys)\n throw new Error(\"Keys missing\");\n req = req.type === 'add' || req.type === 'put' ?\n { ...req, keys } :\n { ...req };\n if (req.type !== 'delete')\n req.values = [...req.values];\n if (req.keys)\n req.keys = [...req.keys];\n return getExistingValues(downTable, req, keys).then(existingValues => {\n const contexts = keys.map((key, i) => {\n const existingValue = existingValues[i];\n const ctx = { onerror: null, onsuccess: null };\n if (req.type === 'delete') {\n deleting.fire.call(ctx, key, existingValue, dxTrans);\n }\n else if (req.type === 'add' || existingValue === undefined) {\n const generatedPrimaryKey = creating.fire.call(ctx, key, req.values[i], dxTrans);\n if (key == null && generatedPrimaryKey != null) {\n key = generatedPrimaryKey;\n req.keys[i] = key;\n if (!primaryKey.outbound) {\n setByKeyPath(req.values[i], primaryKey.keyPath, key);\n }\n }\n }\n else {\n const objectDiff = getObjectDiff(existingValue, req.values[i]);\n const additionalChanges = updating.fire.call(ctx, objectDiff, key, existingValue, dxTrans);\n if (additionalChanges) {\n const requestedValue = req.values[i];\n Object.keys(additionalChanges).forEach(keyPath => {\n if (hasOwn(requestedValue, keyPath)) {\n requestedValue[keyPath] = additionalChanges[keyPath];\n }\n else {\n setByKeyPath(requestedValue, keyPath, additionalChanges[keyPath]);\n }\n });\n }\n }\n return ctx;\n });\n return downTable.mutate(req).then(({ failures, results, numFailures, lastResult }) => {\n for (let i = 0; i < keys.length; ++i) {\n const primKey = results ? results[i] : keys[i];\n const ctx = contexts[i];\n if (primKey == null) {\n ctx.onerror && ctx.onerror(failures[i]);\n }\n else {\n ctx.onsuccess && ctx.onsuccess(req.type === 'put' && existingValues[i] ?\n req.values[i] :\n primKey\n );\n }\n }\n return { failures, results, numFailures, lastResult };\n }).catch(error => {\n contexts.forEach(ctx => ctx.onerror && ctx.onerror(error));\n return Promise.reject(error);\n });\n });\n }\n function deleteRange(req) {\n return deleteNextChunk(req.trans, req.range, 10000);\n }\n function deleteNextChunk(trans, range, limit) {\n return downTable.query({ trans, values: false, query: { index: primaryKey, range }, limit })\n .then(({ result }) => {\n return addPutOrDelete({ type: 'delete', keys: result, trans }).then(res => {\n if (res.numFailures > 0)\n return Promise.reject(res.failures[0]);\n if (result.length < limit) {\n return { failures: [], numFailures: 0, lastResult: undefined };\n }\n else {\n return deleteNextChunk(trans, { ...range, lower: result[result.length - 1], lowerOpen: true }, limit);\n }\n });\n });\n }\n }\n };\n return tableMiddleware;\n },\n })\n};\nfunction getExistingValues(table, req, effectiveKeys) {\n return req.type === \"add\"\n ? Promise.resolve([])\n : table.getMany({ trans: req.trans, keys: effectiveKeys, cache: \"immutable\" });\n}\n\nfunction getFromTransactionCache(keys, cache, clone) {\n try {\n if (!cache)\n return null;\n if (cache.keys.length < keys.length)\n return null;\n const result = [];\n for (let i = 0, j = 0; i < cache.keys.length && j < keys.length; ++i) {\n if (cmp(cache.keys[i], keys[j]) !== 0)\n continue;\n result.push(clone ? deepClone(cache.values[i]) : cache.values[i]);\n ++j;\n }\n return result.length === keys.length ? result : null;\n }\n catch (_a) {\n return null;\n }\n}\nconst cacheExistingValuesMiddleware = {\n stack: \"dbcore\",\n level: -1,\n create: (core) => {\n return {\n table: (tableName) => {\n const table = core.table(tableName);\n return {\n ...table,\n getMany: (req) => {\n if (!req.cache) {\n return table.getMany(req);\n }\n const cachedResult = getFromTransactionCache(req.keys, req.trans[\"_cache\"], req.cache === \"clone\");\n if (cachedResult) {\n return DexiePromise.resolve(cachedResult);\n }\n return table.getMany(req).then((res) => {\n req.trans[\"_cache\"] = {\n keys: req.keys,\n values: req.cache === \"clone\" ? deepClone(res) : res,\n };\n return res;\n });\n },\n mutate: (req) => {\n if (req.type !== \"add\")\n req.trans[\"_cache\"] = null;\n return table.mutate(req);\n },\n };\n },\n };\n },\n};\n\nfunction isEmptyRange(node) {\n return !(\"from\" in node);\n}\nconst RangeSet = function (fromOrTree, to) {\n if (this) {\n extend(this, arguments.length ? { d: 1, from: fromOrTree, to: arguments.length > 1 ? to : fromOrTree } : { d: 0 });\n }\n else {\n const rv = new RangeSet();\n if (fromOrTree && (\"d\" in fromOrTree)) {\n extend(rv, fromOrTree);\n }\n return rv;\n }\n};\nprops(RangeSet.prototype, {\n add(rangeSet) {\n mergeRanges(this, rangeSet);\n return this;\n },\n addKey(key) {\n addRange(this, key, key);\n return this;\n },\n addKeys(keys) {\n keys.forEach(key => addRange(this, key, key));\n return this;\n },\n [iteratorSymbol]() {\n return getRangeSetIterator(this);\n }\n});\nfunction addRange(target, from, to) {\n const diff = cmp(from, to);\n if (isNaN(diff))\n return;\n if (diff > 0)\n throw RangeError();\n if (isEmptyRange(target))\n return extend(target, { from, to, d: 1 });\n const left = target.l;\n const right = target.r;\n if (cmp(to, target.from) < 0) {\n left\n ? addRange(left, from, to)\n : (target.l = { from, to, d: 1, l: null, r: null });\n return rebalance(target);\n }\n if (cmp(from, target.to) > 0) {\n right\n ? addRange(right, from, to)\n : (target.r = { from, to, d: 1, l: null, r: null });\n return rebalance(target);\n }\n if (cmp(from, target.from) < 0) {\n target.from = from;\n target.l = null;\n target.d = right ? right.d + 1 : 1;\n }\n if (cmp(to, target.to) > 0) {\n target.to = to;\n target.r = null;\n target.d = target.l ? target.l.d + 1 : 1;\n }\n const rightWasCutOff = !target.r;\n if (left && !target.l) {\n mergeRanges(target, left);\n }\n if (right && rightWasCutOff) {\n mergeRanges(target, right);\n }\n}\nfunction mergeRanges(target, newSet) {\n function _addRangeSet(target, { from, to, l, r }) {\n addRange(target, from, to);\n if (l)\n _addRangeSet(target, l);\n if (r)\n _addRangeSet(target, r);\n }\n if (!isEmptyRange(newSet))\n _addRangeSet(target, newSet);\n}\nfunction rangesOverlap(rangeSet1, rangeSet2) {\n const i1 = getRangeSetIterator(rangeSet2);\n let nextResult1 = i1.next();\n if (nextResult1.done)\n return false;\n let a = nextResult1.value;\n const i2 = getRangeSetIterator(rangeSet1);\n let nextResult2 = i2.next(a.from);\n let b = nextResult2.value;\n while (!nextResult1.done && !nextResult2.done) {\n if (cmp(b.from, a.to) <= 0 && cmp(b.to, a.from) >= 0)\n return true;\n cmp(a.from, b.from) < 0\n ? (a = (nextResult1 = i1.next(b.from)).value)\n : (b = (nextResult2 = i2.next(a.from)).value);\n }\n return false;\n}\nfunction getRangeSetIterator(node) {\n let state = isEmptyRange(node) ? null : { s: 0, n: node };\n return {\n next(key) {\n const keyProvided = arguments.length > 0;\n while (state) {\n switch (state.s) {\n case 0:\n state.s = 1;\n if (keyProvided) {\n while (state.n.l && cmp(key, state.n.from) < 0)\n state = { up: state, n: state.n.l, s: 1 };\n }\n else {\n while (state.n.l)\n state = { up: state, n: state.n.l, s: 1 };\n }\n case 1:\n state.s = 2;\n if (!keyProvided || cmp(key, state.n.to) <= 0)\n return { value: state.n, done: false };\n case 2:\n if (state.n.r) {\n state.s = 3;\n state = { up: state, n: state.n.r, s: 0 };\n continue;\n }\n case 3:\n state = state.up;\n }\n }\n return { done: true };\n },\n };\n}\nfunction rebalance(target) {\n var _a, _b;\n const diff = (((_a = target.r) === null || _a === void 0 ? void 0 : _a.d) || 0) - (((_b = target.l) === null || _b === void 0 ? void 0 : _b.d) || 0);\n const r = diff > 1 ? \"r\" : diff < -1 ? \"l\" : \"\";\n if (r) {\n const l = r === \"r\" ? \"l\" : \"r\";\n const rootClone = { ...target };\n const oldRootRight = target[r];\n target.from = oldRootRight.from;\n target.to = oldRootRight.to;\n target[r] = oldRootRight[r];\n rootClone[r] = oldRootRight[l];\n target[l] = rootClone;\n rootClone.d = computeDepth(rootClone);\n }\n target.d = computeDepth(target);\n}\nfunction computeDepth({ r, l }) {\n return (r ? (l ? Math.max(r.d, l.d) : r.d) : l ? l.d : 0) + 1;\n}\n\nconst observabilityMiddleware = {\n stack: \"dbcore\",\n level: 0,\n create: (core) => {\n const dbName = core.schema.name;\n const FULL_RANGE = new RangeSet(core.MIN_KEY, core.MAX_KEY);\n return {\n ...core,\n table: (tableName) => {\n const table = core.table(tableName);\n const { schema } = table;\n const { primaryKey } = schema;\n const { extractKey, outbound } = primaryKey;\n const tableClone = {\n ...table,\n mutate: (req) => {\n const trans = req.trans;\n const mutatedParts = trans.mutatedParts || (trans.mutatedParts = {});\n const getRangeSet = (indexName) => {\n const part = `idb://${dbName}/${tableName}/${indexName}`;\n return (mutatedParts[part] ||\n (mutatedParts[part] = new RangeSet()));\n };\n const pkRangeSet = getRangeSet(\"\");\n const delsRangeSet = getRangeSet(\":dels\");\n const { type } = req;\n let [keys, newObjs] = req.type === \"deleteRange\"\n ? [req.range]\n : req.type === \"delete\"\n ? [req.keys]\n : req.values.length < 50\n ? [[], req.values]\n : [];\n const oldCache = req.trans[\"_cache\"];\n return table.mutate(req).then((res) => {\n if (isArray(keys)) {\n if (type !== \"delete\")\n keys = res.results;\n pkRangeSet.addKeys(keys);\n const oldObjs = getFromTransactionCache(keys, oldCache);\n if (!oldObjs && type !== \"add\") {\n delsRangeSet.addKeys(keys);\n }\n if (oldObjs || newObjs) {\n trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs);\n }\n }\n else if (keys) {\n const range = { from: keys.lower, to: keys.upper };\n delsRangeSet.add(range);\n pkRangeSet.add(range);\n }\n else {\n pkRangeSet.add(FULL_RANGE);\n delsRangeSet.add(FULL_RANGE);\n schema.indexes.forEach(idx => getRangeSet(idx.name).add(FULL_RANGE));\n }\n return res;\n });\n },\n };\n const getRange = ({ query: { index, range }, }) => {\n var _a, _b;\n return [\n index,\n new RangeSet((_a = range.lower) !== null && _a !== void 0 ? _a : core.MIN_KEY, (_b = range.upper) !== null && _b !== void 0 ? _b : core.MAX_KEY),\n ];\n };\n const readSubscribers = {\n get: (req) => [primaryKey, new RangeSet(req.key)],\n getMany: (req) => [primaryKey, new RangeSet().addKeys(req.keys)],\n count: getRange,\n query: getRange,\n openCursor: getRange,\n };\n keys(readSubscribers).forEach(method => {\n tableClone[method] = function (req) {\n const { subscr } = PSD;\n if (subscr) {\n const getRangeSet = (indexName) => {\n const part = `idb://${dbName}/${tableName}/${indexName}`;\n return (subscr[part] ||\n (subscr[part] = new RangeSet()));\n };\n const pkRangeSet = getRangeSet(\"\");\n const delsRangeSet = getRangeSet(\":dels\");\n const [queriedIndex, queriedRanges] = readSubscribers[method](req);\n getRangeSet(queriedIndex.name || \"\").add(queriedRanges);\n if (!queriedIndex.isPrimaryKey) {\n if (method === \"count\") {\n delsRangeSet.add(FULL_RANGE);\n }\n else {\n const keysPromise = method === \"query\" &&\n outbound &&\n req.values &&\n table.query({\n ...req,\n values: false,\n });\n return table[method].apply(this, arguments).then((res) => {\n if (method === \"query\") {\n if (outbound && req.values) {\n return keysPromise.then(({ result: resultingKeys }) => {\n pkRangeSet.addKeys(resultingKeys);\n return res;\n });\n }\n const pKeys = req.values\n ? res.result.map(extractKey)\n : res.result;\n if (req.values) {\n pkRangeSet.addKeys(pKeys);\n }\n else {\n delsRangeSet.addKeys(pKeys);\n }\n }\n else if (method === \"openCursor\") {\n const cursor = res;\n const wantValues = req.values;\n return (cursor &&\n Object.create(cursor, {\n key: {\n get() {\n delsRangeSet.addKey(cursor.primaryKey);\n return cursor.key;\n },\n },\n primaryKey: {\n get() {\n const pkey = cursor.primaryKey;\n delsRangeSet.addKey(pkey);\n return pkey;\n },\n },\n value: {\n get() {\n wantValues && pkRangeSet.addKey(cursor.primaryKey);\n return cursor.value;\n },\n },\n }));\n }\n return res;\n });\n }\n }\n }\n return table[method].apply(this, arguments);\n };\n });\n return tableClone;\n },\n };\n },\n};\nfunction trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs) {\n function addAffectedIndex(ix) {\n const rangeSet = getRangeSet(ix.name || \"\");\n function extractKey(obj) {\n return obj != null ? ix.extractKey(obj) : null;\n }\n const addKeyOrKeys = (key) => ix.multiEntry && isArray(key)\n ? key.forEach(key => rangeSet.addKey(key))\n : rangeSet.addKey(key);\n (oldObjs || newObjs).forEach((_, i) => {\n const oldKey = oldObjs && extractKey(oldObjs[i]);\n const newKey = newObjs && extractKey(newObjs[i]);\n if (cmp(oldKey, newKey) !== 0) {\n if (oldKey != null)\n addKeyOrKeys(oldKey);\n if (newKey != null)\n addKeyOrKeys(newKey);\n }\n });\n }\n schema.indexes.forEach(addAffectedIndex);\n}\n\nclass Dexie$1 {\n constructor(name, options) {\n this._middlewares = {};\n this.verno = 0;\n const deps = Dexie$1.dependencies;\n this._options = options = {\n addons: Dexie$1.addons,\n autoOpen: true,\n indexedDB: deps.indexedDB,\n IDBKeyRange: deps.IDBKeyRange,\n ...options\n };\n this._deps = {\n indexedDB: options.indexedDB,\n IDBKeyRange: options.IDBKeyRange\n };\n const { addons, } = options;\n this._dbSchema = {};\n this._versions = [];\n this._storeNames = [];\n this._allTables = {};\n this.idbdb = null;\n this._novip = this;\n const state = {\n dbOpenError: null,\n isBeingOpened: false,\n onReadyBeingFired: null,\n openComplete: false,\n dbReadyResolve: nop,\n dbReadyPromise: null,\n cancelOpen: nop,\n openCanceller: null,\n autoSchema: true,\n PR1398_maxLoop: 3\n };\n state.dbReadyPromise = new DexiePromise(resolve => {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise((_, reject) => {\n state.cancelOpen = reject;\n });\n this._state = state;\n this.name = name;\n this.on = Events(this, \"populate\", \"blocked\", \"versionchange\", \"close\", { ready: [promisableChain, nop] });\n this.on.ready.subscribe = override(this.on.ready.subscribe, subscribe => {\n return (subscriber, bSticky) => {\n Dexie$1.vip(() => {\n const state = this._state;\n if (state.openComplete) {\n if (!state.dbOpenError)\n DexiePromise.resolve().then(subscriber);\n if (bSticky)\n subscribe(subscriber);\n }\n else if (state.onReadyBeingFired) {\n state.onReadyBeingFired.push(subscriber);\n if (bSticky)\n subscribe(subscriber);\n }\n else {\n subscribe(subscriber);\n const db = this;\n if (!bSticky)\n subscribe(function unsubscribe() {\n db.on.ready.unsubscribe(subscriber);\n db.on.ready.unsubscribe(unsubscribe);\n });\n }\n });\n };\n });\n this.Collection = createCollectionConstructor(this);\n this.Table = createTableConstructor(this);\n this.Transaction = createTransactionConstructor(this);\n this.Version = createVersionConstructor(this);\n this.WhereClause = createWhereClauseConstructor(this);\n this.on(\"versionchange\", ev => {\n if (ev.newVersion > 0)\n console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`);\n else\n console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`);\n this.close();\n });\n this.on(\"blocked\", ev => {\n if (!ev.newVersion || ev.newVersion < ev.oldVersion)\n console.warn(`Dexie.delete('${this.name}') was blocked`);\n else\n console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${ev.oldVersion / 10}`);\n });\n this._maxKey = getMaxKey(options.IDBKeyRange);\n this._createTransaction = (mode, storeNames, dbschema, parentTransaction) => new this.Transaction(mode, storeNames, dbschema, this._options.chromeTransactionDurability, parentTransaction);\n this._fireOnBlocked = ev => {\n this.on(\"blocked\").fire(ev);\n connections\n .filter(c => c.name === this.name && c !== this && !c._state.vcFired)\n .map(c => c.on(\"versionchange\").fire(ev));\n };\n this.use(virtualIndexMiddleware);\n this.use(hooksMiddleware);\n this.use(observabilityMiddleware);\n this.use(cacheExistingValuesMiddleware);\n this.vip = Object.create(this, { _vip: { value: true } });\n addons.forEach(addon => addon(this));\n }\n version(versionNumber) {\n if (isNaN(versionNumber) || versionNumber < 0.1)\n throw new exceptions.Type(`Given version is not a positive number`);\n versionNumber = Math.round(versionNumber * 10) / 10;\n if (this.idbdb || this._state.isBeingOpened)\n throw new exceptions.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, versionNumber);\n const versions = this._versions;\n var versionInstance = versions.filter(v => v._cfg.version === versionNumber)[0];\n if (versionInstance)\n return versionInstance;\n versionInstance = new this.Version(versionNumber);\n versions.push(versionInstance);\n versions.sort(lowerVersionFirst);\n versionInstance.stores({});\n this._state.autoSchema = false;\n return versionInstance;\n }\n _whenReady(fn) {\n return (this.idbdb && (this._state.openComplete || PSD.letThrough || this._vip)) ? fn() : new DexiePromise((resolve, reject) => {\n if (this._state.openComplete) {\n return reject(new exceptions.DatabaseClosed(this._state.dbOpenError));\n }\n if (!this._state.isBeingOpened) {\n if (!this._options.autoOpen) {\n reject(new exceptions.DatabaseClosed());\n return;\n }\n this.open().catch(nop);\n }\n this._state.dbReadyPromise.then(resolve, reject);\n }).then(fn);\n }\n use({ stack, create, level, name }) {\n if (name)\n this.unuse({ stack, name });\n const middlewares = this._middlewares[stack] || (this._middlewares[stack] = []);\n middlewares.push({ stack, create, level: level == null ? 10 : level, name });\n middlewares.sort((a, b) => a.level - b.level);\n return this;\n }\n unuse({ stack, name, create }) {\n if (stack && this._middlewares[stack]) {\n this._middlewares[stack] = this._middlewares[stack].filter(mw => create ? mw.create !== create :\n name ? mw.name !== name :\n false);\n }\n return this;\n }\n open() {\n return dexieOpen(this);\n }\n _close() {\n const state = this._state;\n const idx = connections.indexOf(this);\n if (idx >= 0)\n connections.splice(idx, 1);\n if (this.idbdb) {\n try {\n this.idbdb.close();\n }\n catch (e) { }\n this._novip.idbdb = null;\n }\n state.dbReadyPromise = new DexiePromise(resolve => {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise((_, reject) => {\n state.cancelOpen = reject;\n });\n }\n close() {\n this._close();\n const state = this._state;\n this._options.autoOpen = false;\n state.dbOpenError = new exceptions.DatabaseClosed();\n if (state.isBeingOpened)\n state.cancelOpen(state.dbOpenError);\n }\n delete() {\n const hasArguments = arguments.length > 0;\n const state = this._state;\n return new DexiePromise((resolve, reject) => {\n const doDelete = () => {\n this.close();\n var req = this._deps.indexedDB.deleteDatabase(this.name);\n req.onsuccess = wrap(() => {\n _onDatabaseDeleted(this._deps, this.name);\n resolve();\n });\n req.onerror = eventRejectHandler(reject);\n req.onblocked = this._fireOnBlocked;\n };\n if (hasArguments)\n throw new exceptions.InvalidArgument(\"Arguments not allowed in db.delete()\");\n if (state.isBeingOpened) {\n state.dbReadyPromise.then(doDelete);\n }\n else {\n doDelete();\n }\n });\n }\n backendDB() {\n return this.idbdb;\n }\n isOpen() {\n return this.idbdb !== null;\n }\n hasBeenClosed() {\n const dbOpenError = this._state.dbOpenError;\n return dbOpenError && (dbOpenError.name === 'DatabaseClosed');\n }\n hasFailed() {\n return this._state.dbOpenError !== null;\n }\n dynamicallyOpened() {\n return this._state.autoSchema;\n }\n get tables() {\n return keys(this._allTables).map(name => this._allTables[name]);\n }\n transaction() {\n const args = extractTransactionArgs.apply(this, arguments);\n return this._transaction.apply(this, args);\n }\n _transaction(mode, tables, scopeFunc) {\n let parentTransaction = PSD.trans;\n if (!parentTransaction || parentTransaction.db !== this || mode.indexOf('!') !== -1)\n parentTransaction = null;\n const onlyIfCompatible = mode.indexOf('?') !== -1;\n mode = mode.replace('!', '').replace('?', '');\n let idbMode, storeNames;\n try {\n storeNames = tables.map(table => {\n var storeName = table instanceof this.Table ? table.name : table;\n if (typeof storeName !== 'string')\n throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return storeName;\n });\n if (mode == \"r\" || mode === READONLY)\n idbMode = READONLY;\n else if (mode == \"rw\" || mode == READWRITE)\n idbMode = READWRITE;\n else\n throw new exceptions.InvalidArgument(\"Invalid transaction mode: \" + mode);\n if (parentTransaction) {\n if (parentTransaction.mode === READONLY && idbMode === READWRITE) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n }\n else\n throw new exceptions.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n }\n if (parentTransaction) {\n storeNames.forEach(storeName => {\n if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n }\n else\n throw new exceptions.SubTransaction(\"Table \" + storeName +\n \" not included in parent transaction.\");\n }\n });\n }\n if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {\n parentTransaction = null;\n }\n }\n }\n catch (e) {\n return parentTransaction ?\n parentTransaction._promise(null, (_, reject) => { reject(e); }) :\n rejection(e);\n }\n const enterTransaction = enterTransactionScope.bind(null, this, idbMode, storeNames, parentTransaction, scopeFunc);\n return (parentTransaction ?\n parentTransaction._promise(idbMode, enterTransaction, \"lock\") :\n PSD.trans ?\n usePSD(PSD.transless, () => this._whenReady(enterTransaction)) :\n this._whenReady(enterTransaction));\n }\n table(tableName) {\n if (!hasOwn(this._allTables, tableName)) {\n throw new exceptions.InvalidTable(`Table ${tableName} does not exist`);\n }\n return this._allTables[tableName];\n }\n}\n\nconst symbolObservable = typeof Symbol !== \"undefined\" && \"observable\" in Symbol\n ? Symbol.observable\n : \"@@observable\";\nclass Observable {\n constructor(subscribe) {\n this._subscribe = subscribe;\n }\n subscribe(x, error, complete) {\n return this._subscribe(!x || typeof x === \"function\" ? { next: x, error, complete } : x);\n }\n [symbolObservable]() {\n return this;\n }\n}\n\nfunction extendObservabilitySet(target, newSet) {\n keys(newSet).forEach(part => {\n const rangeSet = target[part] || (target[part] = new RangeSet());\n mergeRanges(rangeSet, newSet[part]);\n });\n return target;\n}\n\nfunction liveQuery(querier) {\n let hasValue = false;\n let currentValue = undefined;\n const observable = new Observable((observer) => {\n const scopeFuncIsAsync = isAsyncFunction(querier);\n function execute(subscr) {\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n const exec = () => newScope(querier, { subscr, trans: null });\n const rv = PSD.trans\n ?\n usePSD(PSD.transless, exec)\n : exec();\n if (scopeFuncIsAsync) {\n rv.then(decrementExpectedAwaits, decrementExpectedAwaits);\n }\n return rv;\n }\n let closed = false;\n let accumMuts = {};\n let currentObs = {};\n const subscription = {\n get closed() {\n return closed;\n },\n unsubscribe: () => {\n closed = true;\n globalEvents.storagemutated.unsubscribe(mutationListener);\n },\n };\n observer.start && observer.start(subscription);\n let querying = false, startedListening = false;\n function shouldNotify() {\n return keys(currentObs).some((key) => accumMuts[key] && rangesOverlap(accumMuts[key], currentObs[key]));\n }\n const mutationListener = (parts) => {\n extendObservabilitySet(accumMuts, parts);\n if (shouldNotify()) {\n doQuery();\n }\n };\n const doQuery = () => {\n if (querying || closed)\n return;\n accumMuts = {};\n const subscr = {};\n const ret = execute(subscr);\n if (!startedListening) {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, mutationListener);\n startedListening = true;\n }\n querying = true;\n Promise.resolve(ret).then((result) => {\n hasValue = true;\n currentValue = result;\n querying = false;\n if (closed)\n return;\n if (shouldNotify()) {\n doQuery();\n }\n else {\n accumMuts = {};\n currentObs = subscr;\n observer.next && observer.next(result);\n }\n }, (err) => {\n querying = false;\n hasValue = false;\n observer.error && observer.error(err);\n subscription.unsubscribe();\n });\n };\n doQuery();\n return subscription;\n });\n observable.hasValue = () => hasValue;\n observable.getValue = () => currentValue;\n return observable;\n}\n\nlet domDeps;\ntry {\n domDeps = {\n indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,\n IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange\n };\n}\ncatch (e) {\n domDeps = { indexedDB: null, IDBKeyRange: null };\n}\n\nconst Dexie = Dexie$1;\nprops(Dexie, {\n ...fullNameExceptions,\n delete(databaseName) {\n const db = new Dexie(databaseName, { addons: [] });\n return db.delete();\n },\n exists(name) {\n return new Dexie(name, { addons: [] }).open().then(db => {\n db.close();\n return true;\n }).catch('NoSuchDatabaseError', () => false);\n },\n getDatabaseNames(cb) {\n try {\n return getDatabaseNames(Dexie.dependencies).then(cb);\n }\n catch (_a) {\n return rejection(new exceptions.MissingAPI());\n }\n },\n defineClass() {\n function Class(content) {\n extend(this, content);\n }\n return Class;\n },\n ignoreTransaction(scopeFunc) {\n return PSD.trans ?\n usePSD(PSD.transless, scopeFunc) :\n scopeFunc();\n },\n vip,\n async: function (generatorFn) {\n return function () {\n try {\n var rv = awaitIterator(generatorFn.apply(this, arguments));\n if (!rv || typeof rv.then !== 'function')\n return DexiePromise.resolve(rv);\n return rv;\n }\n catch (e) {\n return rejection(e);\n }\n };\n },\n spawn: function (generatorFn, args, thiz) {\n try {\n var rv = awaitIterator(generatorFn.apply(thiz, args || []));\n if (!rv || typeof rv.then !== 'function')\n return DexiePromise.resolve(rv);\n return rv;\n }\n catch (e) {\n return rejection(e);\n }\n },\n currentTransaction: {\n get: () => PSD.trans || null\n },\n waitFor: function (promiseOrFunction, optionalTimeout) {\n const promise = DexiePromise.resolve(typeof promiseOrFunction === 'function' ?\n Dexie.ignoreTransaction(promiseOrFunction) :\n promiseOrFunction)\n .timeout(optionalTimeout || 60000);\n return PSD.trans ?\n PSD.trans.waitFor(promise) :\n promise;\n },\n Promise: DexiePromise,\n debug: {\n get: () => debug,\n set: value => {\n setDebug(value, value === 'dexie' ? () => true : dexieStackFrameFilter);\n }\n },\n derive: derive,\n extend: extend,\n props: props,\n override: override,\n Events: Events,\n on: globalEvents,\n liveQuery,\n extendObservabilitySet,\n getByKeyPath: getByKeyPath,\n setByKeyPath: setByKeyPath,\n delByKeyPath: delByKeyPath,\n shallowClone: shallowClone,\n deepClone: deepClone,\n getObjectDiff: getObjectDiff,\n cmp,\n asap: asap$1,\n minKey: minKey,\n addons: [],\n connections: connections,\n errnames: errnames,\n dependencies: domDeps,\n semVer: DEXIE_VERSION,\n version: DEXIE_VERSION.split('.')\n .map(n => parseInt(n))\n .reduce((p, c, i) => p + (c / Math.pow(10, i * 2))),\n});\nDexie.maxKey = getMaxKey(Dexie.dependencies.IDBKeyRange);\n\nif (typeof dispatchEvent !== 'undefined' && typeof addEventListener !== 'undefined') {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, updatedParts => {\n if (!propagatingLocally) {\n let event;\n if (isIEOrEdge) {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, true, true, updatedParts);\n }\n else {\n event = new CustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, {\n detail: updatedParts\n });\n }\n propagatingLocally = true;\n dispatchEvent(event);\n propagatingLocally = false;\n }\n });\n addEventListener(STORAGE_MUTATED_DOM_EVENT_NAME, ({ detail }) => {\n if (!propagatingLocally) {\n propagateLocally(detail);\n }\n });\n}\nfunction propagateLocally(updateParts) {\n let wasMe = propagatingLocally;\n try {\n propagatingLocally = true;\n globalEvents.storagemutated.fire(updateParts);\n }\n finally {\n propagatingLocally = wasMe;\n }\n}\nlet propagatingLocally = false;\n\nif (typeof BroadcastChannel !== 'undefined') {\n const bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);\n if (typeof bc.unref === 'function') {\n bc.unref();\n }\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, (changedParts) => {\n if (!propagatingLocally) {\n bc.postMessage(changedParts);\n }\n });\n bc.onmessage = (ev) => {\n if (ev.data)\n propagateLocally(ev.data);\n };\n}\nelse if (typeof self !== 'undefined' && typeof navigator !== 'undefined') {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, (changedParts) => {\n try {\n if (!propagatingLocally) {\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem(STORAGE_MUTATED_DOM_EVENT_NAME, JSON.stringify({\n trig: Math.random(),\n changedParts,\n }));\n }\n if (typeof self['clients'] === 'object') {\n [...self['clients'].matchAll({ includeUncontrolled: true })].forEach((client) => client.postMessage({\n type: STORAGE_MUTATED_DOM_EVENT_NAME,\n changedParts,\n }));\n }\n }\n }\n catch (_a) { }\n });\n if (typeof addEventListener !== 'undefined') {\n addEventListener('storage', (ev) => {\n if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {\n const data = JSON.parse(ev.newValue);\n if (data)\n propagateLocally(data.changedParts);\n }\n });\n }\n const swContainer = self.document && navigator.serviceWorker;\n if (swContainer) {\n swContainer.addEventListener('message', propagateMessageLocally);\n }\n}\nfunction propagateMessageLocally({ data }) {\n if (data && data.type === STORAGE_MUTATED_DOM_EVENT_NAME) {\n propagateLocally(data.changedParts);\n }\n}\n\nDexiePromise.rejectionMapper = mapError;\nsetDebug(debug, dexieStackFrameFilter);\n\nexport { Dexie$1 as Dexie, RangeSet, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap };\n//# sourceMappingURL=dexie.mjs.map\n"],"names":[],"sourceRoot":""}