var e = { 105 : e => { e . exports = function ( e ) { return function ( ) { var t = arguments . length ; if ( t ) { for ( var n = [ ] , r = - 1 ; ++ r < t ; ) n [ r ] = arguments [ r ] ; return e . call ( this , n ) ; } return e . call ( this , [ ] ) ; } ; } ; } , 187 : e => { var t , n = "object" == typeof Reflect ? Reflect : null , r = n && "function" == typeof n . apply ? n . apply : function ( e , t , n ) { return Function . prototype . apply . call ( e , t , n ) ; } ; t = n && "function" == typeof n . ownKeys ? n . ownKeys : Object . getOwnPropertySymbols ? function ( e ) { return Object . getOwnPropertyNames ( e ) . concat ( Object . getOwnPropertySymbols ( e ) ) ; } : function ( e ) { return Object . getOwnPropertyNames ( e ) ; } ; var o = Number . isNaN || function ( e ) { return e != e ; } ; function i ( ) { i . init . call ( this ) ; } e . exports = i , e . exports . once = function ( e , t ) { return new Promise ( ( function ( n , r ) { function o ( n ) { e . removeListener ( t , i ) , r ( n ) ; } function i ( ) { "function" == typeof e . removeListener && e . removeListener ( "error" , o ) , n ( [ ] . slice . call ( arguments ) ) ; } v ( e , t , i , { once : ! 0 } ) , "error" !== t && function ( e , t , n ) { "function" == typeof e . on && v ( e , "error" , t , { once : ! 0 } ) ; } ( e , o ) ; } ) ) ; } , i . EventEmitter = i , i . prototype . _events = void 0 , i . prototype . _eventsCount = 0 , i . prototype . _maxListeners = void 0 ; var s = 10 ; function a ( e ) { if ( "function" != typeof e ) throw new TypeError ( 'The "listener" argument must be of type Function. Received type ' + typeof e ) ; } function u ( e ) { return void 0 === e . _maxListeners ? i . defaultMaxListeners : e . _maxListeners ; } function c ( e , t , n , r ) { var o , i , s , c ; if ( a ( n ) , void 0 === ( i = e . _events ) ? ( i = e . _events = Object . create ( null ) , e . _eventsCount = 0 ) : ( void 0 !== i . newListener && ( e . emit ( "newListener" , t , n . listener ? n . listener : n ) , i = e . _events ) , s = i [ t ] ) , void 0 === s ) s = i [ t ] = n , ++ e . _eventsCount ; else if ( "function" == typeof s ? s = i [ t ] = r ? [ n , s ] : [ s , n ] : r ? s . unshift ( n ) : s . push ( n ) , ( o = u ( e ) ) > 0 && s . length > o && ! s . warned ) { s . warned = ! 0 ; var f = new Error ( "Possible EventEmitter memory leak detected. " + s . length + " " + String ( t ) + " listeners added. Use emitter.setMaxListeners() to increase limit" ) ; f . name = "MaxListenersExceededWarning" , f . emitter = e , f . type = t , f . count = s . length , c = f , console && console . warn && console . warn ( c ) ; } return e ; } function f ( ) { if ( ! this . fired ) return this . target . removeListener ( this . type , this . wrapFn ) , this . fired = ! 0 , 0 === arguments . length ? this . listener . call ( this . target ) : this . listener . apply ( this . target , arguments ) ; } function l ( e , t , n ) { var r = { fired : ! 1 , wrapFn : void 0 , target : e , type : t , listener : n } , o = f . bind ( r ) ; return o . listener = n , r . wrapFn = o , o ; } function d ( e , t , n ) { var r = e . _events ; if ( void 0 === r ) return [ ] ; var o = r [ t ] ; return void 0 === o ? [ ] : "function" == typeof o ? n ? [ o . listener || o ] : [ o ] : n ? function ( e ) { for ( var t = new Array ( e . length ) , n = 0 ; n < t . length ; ++ n ) t [ n ] = e [ n ] . listener || e [ n ] ; return t ; } ( o ) : p ( o , o . length ) ; } function h ( e ) { var t = this . _events ; if ( void 0 !== t ) { var n = t [ e ] ; if ( "function" == typeof n ) return 1 ; if ( void 0 !== n ) return n . length ; } return 0 ; } function p ( e , t ) { for ( var n = new Array ( t ) , r = 0 ; r < t ; ++ r ) n [ r ] = e [ r ] ; return n ; } function v ( e , t , n , r ) { if ( "function" == typeof e . on ) r . once ? e . once ( t , n ) : e . on ( t , n ) ; else { if ( "function" != typeof e . addEventListener ) throw new TypeError ( 'The "emitter" argument must be of type EventEmitter. Received type ' + typeof e ) ; e . addEventListener ( t , ( function o ( i ) { r . once && e . removeEventListener ( t , o ) , n ( i ) ; } ) ) ; } } Object . defineProperty ( i , "defaultMaxListeners" , { enumerable : ! 0 , get : function ( ) { return s ; } , set : function ( e ) { if ( "number" != typeof e || e < 0 || o ( e ) ) throw new RangeError ( 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + "." ) ; s = e ; } } ) , i . init = function ( ) { void 0 !== this . _events && this . _events !== Object . getPrototypeOf ( this ) . _events || ( this . _events = Object . create ( null ) , this . _eventsCount = 0 ) , this . _maxListeners = this . _maxListeners || void 0 ; } , i . prototype . setMaxListeners = function ( e ) { if ( "number" != typeof e || e < 0 || o ( e ) ) throw new RangeError ( 'The value of "n" is out of range. It must be a non-negative number. Received ' + e + "." ) ; return this . _maxListeners = e , this ; } , i . prototype . getMaxListeners = function ( ) { return u ( this ) ; } , i . prototype . emit = function ( e ) { for ( var t = [ ] , n = 1 ; n < arguments . length ; n ++ ) t . push ( arguments [ n ] ) ; var o = "error" === e , i = this . _events ; if ( void 0 !== i ) o = o && void 0 === i . error ; else if ( ! o ) return ! 1 ; if ( o ) { var s ; if ( t . length > 0 && ( s = t [ 0 ] ) , s instanceof Error ) throw s ; var a = new Error ( "Unhandled error." + ( s ? " (" + s . message + ")" : "" ) ) ; throw a . context = s , a ; } var u = i [ e ] ; if ( void 0 === u ) return ! 1 ; if ( "function" == typeof u ) r ( u , this , t ) ; else { var c = u . length , f = p ( u , c ) ; for ( n = 0 ; n < c ; ++ n ) r ( f [ n ] , this , t ) ; } return ! 0 ; } , i . prototype . addListener = function ( e , t ) { return c ( this , e , t , ! 1 ) ; } , i . prototype . on = i . prototype . addListener , i . prototype . prependListener = function ( e , t ) { return c ( this , e , t , ! 0 ) ; } , i . prototype . once = function ( e , t ) { return a ( t ) , this . on ( e , l ( this , e , t ) ) , this ; } , i . prototype . prependOnceListener = function ( e , t ) { return a ( t ) , this . prependListener ( e , l ( this , e , t ) ) , this ; } , i . prototype . removeListener = function ( e , t ) { var n , r , o , i , s ; if ( a ( t ) , void 0 === ( r = this . _events ) ) return this ; if ( void 0 === ( n = r [ e ] ) ) return this ; if ( n === t || n . listener === t ) 0 == -- this . _eventsCount ? this . _events = Object . create ( null ) : ( delete r [ e ] , r . removeListener && this . emit ( "removeListener" , e , n . listener || t ) ) ; else if ( "function" != typeof n ) { for ( o = - 1 , i = n . length - 1 ; i >= 0 ; i -- ) if ( n [ i ] === t || n [ i ] . listener === t ) { s = n [ i ] . listener , o = i ; break ; } if ( o < 0 ) return this ; 0 === o ? n . shift ( ) : function ( e , t ) { for ( ; t + 1 < e . length ; t ++ ) e [ t ] = e [ t + 1 ] ; e . pop ( ) ; } ( n , o ) , 1 === n . length && ( r [ e ] = n [ 0 ] ) , void 0 !== r . removeListener && this . emit ( "removeListener" , e , s || t ) ; } return this ; } , i . prototype . off = i . prototype . removeListener , i . prototype . removeAllListeners = function ( e ) { var t , n , r ; if ( void 0 === ( n = this . _events ) ) return this ; if ( void 0 === n . removeListener ) return 0 === arguments . length ? ( this . _events = Object . create ( null ) , this . _eventsCount = 0 ) : void 0 !== n [ e ] && ( 0 == -- this . _eventsCount ? this . _events = Object . create ( null ) : delete n [ e ] ) , this ; if ( 0 === arguments . length ) { var o , i = Object . keys ( n ) ; for ( r = 0 ; r < i . length ; ++ r ) "removeListener" !== ( o = i [ r ] ) && this . removeAllListeners ( o ) ; return this . removeAllListeners ( "removeListener" ) , this . _events = Object . create ( null ) , this . _eventsCount = 0 , this ; } if ( "function" == typeof ( t = n [ e ] ) ) this . removeListener ( e , t ) ; else if ( void 0 !== t ) for ( r = t . length - 1 ; r >= 0 ; r -- ) this . removeListener ( e , t [ r ] ) ; return this ; } , i . prototype . listeners = function ( e ) { return d ( this , e , ! 0 ) ; } , i . prototype . rawListeners = function ( e ) { return d ( this , e , ! 1 ) ; } , i . listenerCount = function ( e , t ) { return "function" == typeof e . listenerCount ? e . listenerCount ( t ) : h . call ( e , t ) ; } , i . prototype . listenerCount = h , i . prototype . eventNames = function ( ) { return this . _eventsCount > 0 ? t ( this . _events ) : [ ] ; } ; } , 624 : ( e , t , n ) => { var r , o , i , s = [ n ( 525 ) , n ( 785 ) , n ( 291 ) , n ( 709 ) , n ( 506 ) , n ( 176 ) ] , a = - 1 , u = [ ] , c = ! 1 ; function f ( ) { r && o && ( r = ! 1 , o . length ? u = o . concat ( u ) : a = - 1 , u . length && l ( ) ) ; } function l ( ) { if ( ! r ) { c = ! 1 , r = ! 0 ; for ( var e = u . length , t = setTimeout ( f ) ; e ; ) { for ( o = u , u = [ ] ; o && ++ a < e ; ) o [ a ] . run ( ) ; a = - 1 , e = u . length ; } o = null , a = - 1 , r = ! 1 , clearTimeout ( t ) ; } } for ( var d = - 1 , h = s . length ; ++ d < h ; ) if ( s [ d ] && s [ d ] . test && s [ d ] . test ( ) ) { i = s [ d ] . install ( l ) ; break ; } function p ( e , t ) { this . fun = e , this . array = t ; } p . prototype . run = function ( ) { var e = this . fun , t = this . array ; switch ( t . length ) { case 0 : return e ( ) ; case 1 : return e ( t [ 0 ] ) ; case 2 : return e ( t [ 0 ] , t [ 1 ] ) ; case 3 : return e ( t [ 0 ] , t [ 1 ] , t [ 2 ] ) ; default : return e . apply ( null , t ) ; } } , e . exports = function ( e ) { var t = new Array ( arguments . length - 1 ) ; if ( arguments . length > 1 ) for ( var n = 1 ; n < arguments . length ; n ++ ) t [ n - 1 ] = arguments [ n ] ; u . push ( new p ( e , t ) ) , c || r || ( c = ! 0 , i ( ) ) ; } ; } , 709 : ( e , t , n ) => { t . test = function ( ) { return ! n . g . setImmediate && void 0 !== n . g . MessageChannel ; } , t . install = function ( e ) { var t = new n . g . MessageChannel ; return t . port1 . onmessage = e , function ( ) { t . port2 . postMessage ( 0 ) ; } ; } ; } , 291 : ( e , t , n ) => { var r = n . g . MutationObserver || n . g . WebKitMutationObserver ; t . test = function ( ) { return r ; } , t . install = function ( e ) { var t = 0 , o = new r ( e ) , i = n . g . document . createTextNode ( "" ) ; return o . observe ( i , { characterData : ! 0 } ) , function ( ) { i . data = t = ++ t % 2 ; } ; } ; } , 785 : ( e , t , n ) => { t . test = function ( ) { return "function" == typeof n . g . queueMicrotask ; } , t . install = function ( e ) { return function ( ) { n . g . queueMicrotask ( e ) ; } ; } ; } , 506 : ( e , t , n ) => { t . test = function ( ) { return "document" in n . g && "onreadystatechange" in n . g . document . createElement ( "script" ) ; } , t . install = function ( e ) { return function ( ) { var t = n . g . document . createElement ( "script" ) ; return t . onreadystatechange = function ( ) { e ( ) , t . onreadystatechange = null , t . parentNode . removeChild ( t ) , t = null ; } , n . g . document . documentElement . appendChild ( t ) , e ; } ; } ; } , 176 : ( e , t ) => { t . test = function ( ) { return ! 0 ; } , t . install = function ( e ) { return function ( ) { setTimeout ( e , 0 ) ; } ; } ; } , 717 : e => { "function" == typeof Object . create ? e . exports = function ( e , t ) { t && ( e . super_ = t , e . prototype = Object . create ( t . prototype , { constructor : { value : e , enumerable : ! 1 , writable : ! 0 , configurable : ! 0 } } ) ) ; } : e . exports = function ( e , t ) { if ( t ) { e . super_ = t ; var n = function ( ) { } ; n . prototype = t . prototype , e . prototype = new n , e . prototype . constructor = e ; } } ; } , 322 : e => { e . exports = function ( e ) { var t = [ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "a" , "b" , "c" , "d" , "e" , "f" ] ; function n ( e , t ) { var n = e [ 0 ] , r = e [ 1 ] , o = e [ 2 ] , i = e [ 3 ] ; r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & o | ~ r & i ) + t [ 0 ] - 680876936 | 0 ) << 7 | n >>> 25 ) + r | 0 ) & r | ~ n & o ) + t [ 1 ] - 389564586 | 0 ) << 12 | i >>> 20 ) + n | 0 ) & n | ~ i & r ) + t [ 2 ] + 606105819 | 0 ) << 17 | o >>> 15 ) + i | 0 ) & i | ~ o & n ) + t [ 3 ] - 1044525330 | 0 ) << 22 | r >>> 10 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & o | ~ r & i ) + t [ 4 ] - 176418897 | 0 ) << 7 | n >>> 25 ) + r | 0 ) & r | ~ n & o ) + t [ 5 ] + 1200080426 | 0 ) << 12 | i >>> 20 ) + n | 0 ) & n | ~ i & r ) + t [ 6 ] - 1473231341 | 0 ) << 17 | o >>> 15 ) + i | 0 ) & i | ~ o & n ) + t [ 7 ] - 45705983 | 0 ) << 22 | r >>> 10 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & o | ~ r & i ) + t [ 8 ] + 1770035416 | 0 ) << 7 | n >>> 25 ) + r | 0 ) & r | ~ n & o ) + t [ 9 ] - 1958414417 | 0 ) << 12 | i >>> 20 ) + n | 0 ) & n | ~ i & r ) + t [ 10 ] - 42063 | 0 ) << 17 | o >>> 15 ) + i | 0 ) & i | ~ o & n ) + t [ 11 ] - 1990404162 | 0 ) << 22 | r >>> 10 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & o | ~ r & i ) + t [ 12 ] + 1804603682 | 0 ) << 7 | n >>> 25 ) + r | 0 ) & r | ~ n & o ) + t [ 13 ] - 40341101 | 0 ) << 12 | i >>> 20 ) + n | 0 ) & n | ~ i & r ) + t [ 14 ] - 1502002290 | 0 ) << 17 | o >>> 15 ) + i | 0 ) & i | ~ o & n ) + t [ 15 ] + 1236535329 | 0 ) << 22 | r >>> 10 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & i | o & ~ i ) + t [ 1 ] - 165796510 | 0 ) << 5 | n >>> 27 ) + r | 0 ) & o | r & ~ o ) + t [ 6 ] - 1069501632 | 0 ) << 9 | i >>> 23 ) + n | 0 ) & r | n & ~ r ) + t [ 11 ] + 643717713 | 0 ) << 14 | o >>> 18 ) + i | 0 ) & n | i & ~ n ) + t [ 0 ] - 373897302 | 0 ) << 20 | r >>> 12 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & i | o & ~ i ) + t [ 5 ] - 701558691 | 0 ) << 5 | n >>> 27 ) + r | 0 ) & o | r & ~ o ) + t [ 10 ] + 38016083 | 0 ) << 9 | i >>> 23 ) + n | 0 ) & r | n & ~ r ) + t [ 15 ] - 660478335 | 0 ) << 14 | o >>> 18 ) + i | 0 ) & n | i & ~ n ) + t [ 4 ] - 405537848 | 0 ) << 20 | r >>> 12 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & i | o & ~ i ) + t [ 9 ] + 568446438 | 0 ) << 5 | n >>> 27 ) + r | 0 ) & o | r & ~ o ) + t [ 14 ] - 1019803690 | 0 ) << 9 | i >>> 23 ) + n | 0 ) & r | n & ~ r ) + t [ 3 ] - 187363961 | 0 ) << 14 | o >>> 18 ) + i | 0 ) & n | i & ~ n ) + t [ 8 ] + 1163531501 | 0 ) << 20 | r >>> 12 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r & i | o & ~ i ) + t [ 13 ] - 1444681467 | 0 ) << 5 | n >>> 27 ) + r | 0 ) & o | r & ~ o ) + t [ 2 ] - 51403784 | 0 ) << 9 | i >>> 23 ) + n | 0 ) & r | n & ~ r ) + t [ 7 ] + 1735328473 | 0 ) << 14 | o >>> 18 ) + i | 0 ) & n | i & ~ n ) + t [ 12 ] - 1926607734 | 0 ) << 20 | r >>> 12 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r ^ o ^ i ) + t [ 5 ] - 378558 | 0 ) << 4 | n >>> 28 ) + r | 0 ) ^ r ^ o ) + t [ 8 ] - 2022574463 | 0 ) << 11 | i >>> 21 ) + n | 0 ) ^ n ^ r ) + t [ 11 ] + 1839030562 | 0 ) << 16 | o >>> 16 ) + i | 0 ) ^ i ^ n ) + t [ 14 ] - 35309556 | 0 ) << 23 | r >>> 9 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r ^ o ^ i ) + t [ 1 ] - 1530992060 | 0 ) << 4 | n >>> 28 ) + r | 0 ) ^ r ^ o ) + t [ 4 ] + 1272893353 | 0 ) << 11 | i >>> 21 ) + n | 0 ) ^ n ^ r ) + t [ 7 ] - 155497632 | 0 ) << 16 | o >>> 16 ) + i | 0 ) ^ i ^ n ) + t [ 10 ] - 1094730640 | 0 ) << 23 | r >>> 9 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r ^ o ^ i ) + t [ 13 ] + 681279174 | 0 ) << 4 | n >>> 28 ) + r | 0 ) ^ r ^ o ) + t [ 0 ] - 358537222 | 0 ) << 11 | i >>> 21 ) + n | 0 ) ^ n ^ r ) + t [ 3 ] - 722521979 | 0 ) << 16 | o >>> 16 ) + i | 0 ) ^ i ^ n ) + t [ 6 ] + 76029189 | 0 ) << 23 | r >>> 9 ) + o | 0 , r = ( ( r += ( ( o = ( ( o += ( ( i = ( ( i += ( ( n = ( ( n += ( r ^ o ^ i ) + t [ 9 ] - 640364487 | 0 ) << 4 | n >>> 28 ) + r | 0 ) ^ r ^ o ) + t [ 12 ] - 421815835 | 0 ) << 11 | i >>> 21 ) + n | 0 ) ^ n ^ r ) + t [ 15 ] + 530742520 | 0 ) << 16 | o >>> 16 ) + i | 0 ) ^ i ^ n ) + t [ 2 ] - 995338651 | 0 ) << 23 | r >>> 9 ) + o | 0 , r = ( ( r += ( ( i = ( ( i += ( r ^ ( ( n = ( ( n += ( o ^ ( r | ~ i ) ) + t [ 0 ] - 198630844 | 0 ) << 6 | n >>> 26 ) + r | 0 ) | ~ o ) ) + t [ 7 ] + 1126891415 | 0 ) << 10 | i >>> 22 ) + n | 0 ) ^ ( ( o = ( ( o += ( n ^ ( i | ~ r ) ) + t [ 14 ] - 1416354905 | 0 ) << 15 | o >>> 17 ) + i | 0 ) | ~ n ) ) + t [ 5 ] - 57434055 | 0 ) << 21 | r >>> 11 ) + o | 0 , r = ( ( r += ( ( i = ( ( i += ( r ^ ( ( n = ( ( n += ( o ^ ( r | ~ i ) ) + t [ 12 ] + 1700485571 | 0 ) << 6 | n >>> 26 ) + r | 0 ) | ~ o ) ) + t [ 3 ] - 1894986606 | 0 ) << 10 | i >>> 22 ) + n | 0 ) ^ ( ( o = ( ( o += ( n ^ ( i | ~ r ) ) + t [ 10 ] - 1051523 | 0 ) << 15 | o >>> 17 ) + i | 0 ) | ~ n ) ) + t [ 1 ] - 2054922799 | 0 ) << 21 | r >>> 11 ) + o | 0 , r = ( ( r += ( ( i = ( ( i += ( r ^ ( ( n = ( ( n += ( o ^ ( r | ~ i ) ) + t [ 8 ] + 1873313359 | 0 ) << 6 | n >>> 26 ) + r | 0 ) | ~ o ) ) + t [ 15 ] - 30611744 | 0 ) << 10 | i >>> 22 ) + n | 0 ) ^ ( ( o = ( ( o += ( n ^ ( i | ~ r ) ) + t [ 6 ] - 1560198380 | 0 ) << 15 | o >>> 17 ) + i | 0 ) | ~ n ) ) + t [ 13 ] + 1309151649 | 0 ) << 21 | r >>> 11 ) + o | 0 , r = ( ( r += ( ( i = ( ( i += ( r ^ ( ( n = ( ( n += ( o ^ ( r | ~ i ) ) + t [ 4 ] - 145523070 | 0 ) << 6 | n >>> 26 ) + r | 0 ) | ~ o ) ) + t [ 11 ] - 1120210379 | 0 ) << 10 | i >>> 22 ) + n | 0 ) ^ ( ( o = ( ( o += ( n ^ ( i | ~ r ) ) + t [ 2 ] + 718787259 | 0 ) << 15 | o >>> 17 ) + i | 0 ) | ~ n ) ) + t [ 9 ] - 343485551 | 0 ) << 21 | r >>> 11 ) + o | 0 , e [ 0 ] = n + e [ 0 ] | 0 , e [ 1 ] = r + e [ 1 ] | 0 , e [ 2 ] = o + e [ 2 ] | 0 , e [ 3 ] = i + e [ 3 ] | 0 ; } function r ( e ) { var t , n = [ ] ; for ( t = 0 ; t < 64 ; t += 4 ) n [ t >> 2 ] = e . charCodeAt ( t ) + ( e . charCodeAt ( t + 1 ) << 8 ) + ( e . charCodeAt ( t + 2 ) << 16 ) + ( e . charCodeAt ( t + 3 ) << 24 ) ; return n ; } function o ( e ) { var t , n = [ ] ; for ( t = 0 ; t < 64 ; t += 4 ) n [ t >> 2 ] = e [ t ] + ( e [ t + 1 ] << 8 ) + ( e [ t + 2 ] << 16 ) + ( e [ t + 3 ] << 24 ) ; return n ; } function i ( e ) { var t , o , i , s , a , u , c = e . length , f = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] ; for ( t = 64 ; t <= c ; t += 64 ) n ( f , r ( e . substring ( t - 64 , t ) ) ) ; for ( o = ( e = e . substring ( t - 64 ) ) . length , i = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , t = 0 ; t < o ; t += 1 ) i [ t >> 2 ] |= e . charCodeAt ( t ) << ( t % 4 << 3 ) ; if ( i [ t >> 2 ] |= 128 << ( t % 4 << 3 ) , t > 55 ) for ( n ( f , i ) , t = 0 ; t < 16 ; t += 1 ) i [ t ] = 0 ; return s = ( s = 8 * c ) . toString ( 16 ) . match ( /(.*?)(.{0,8})$/ ) , a = parseInt ( s [ 2 ] , 16 ) , u = parseInt ( s [ 1 ] , 16 ) || 0 , i [ 14 ] = a , i [ 15 ] = u , n ( f , i ) , f ; } function s ( e ) { var n , r = "" ; for ( n = 0 ; n < 4 ; n += 1 ) r += t [ e >> 8 * n + 4 & 15 ] + t [ e >> 8 * n & 15 ] ; return r ; } function a ( e ) { var t ; for ( t = 0 ; t < e . length ; t += 1 ) e [ t ] = s ( e [ t ] ) ; return e . join ( "" ) ; } function u ( e ) { return /[\u0080-\uFFFF]/ . test ( e ) && ( e = unescape ( encodeURIComponent ( e ) ) ) , e ; } function c ( e ) { var t , n = [ ] , r = e . length ; for ( t = 0 ; t < r - 1 ; t += 2 ) n . push ( parseInt ( e . substr ( t , 2 ) , 16 ) ) ; return String . fromCharCode . apply ( String , n ) ; } function f ( ) { this . reset ( ) ; } return a ( i ( "hello" ) ) , "undefined" == typeof ArrayBuffer || ArrayBuffer . prototype . slice || function ( ) { function e ( e , t ) { return ( e = 0 | e || 0 ) < 0 ? Math . max ( e + t , 0 ) : Math . min ( e , t ) ; } ArrayBuffer . prototype . slice = function ( t , n ) { var r , o , i , s , a = this . byteLength , u = e ( t , a ) , c = a ; return undefined !== n && ( c = e ( n , a ) ) , u > c ? new ArrayBuffer ( 0 ) : ( r = c - u , o = new ArrayBuffer ( r ) , i = new Uint8Array ( o ) , s = new Uint8Array ( this , u , r ) , i . set ( s ) , o ) ; } ; } ( ) , f . prototype . append = function ( e ) { return this . appendBinary ( u ( e ) ) , this ; } , f . prototype . appendBinary = function ( e ) { this . _buff += e , this . _length += e . length ; var t , o = this . _buff . length ; for ( t = 64 ; t <= o ; t += 64 ) n ( this . _hash , r ( this . _buff . substring ( t - 64 , t ) ) ) ; return this . _buff = this . _buff . substring ( t - 64 ) , this ; } , f . prototype . end = function ( e ) { var t , n , r = this . _buff , o = r . length , i = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ; for ( t = 0 ; t < o ; t += 1 ) i [ t >> 2 ] |= r . charCodeAt ( t ) << ( t % 4 << 3 ) ; return this . _finish ( i , o ) , n = a ( this . _hash ) , e && ( n = c ( n ) ) , this . reset ( ) , n ; } , f . prototype . reset = function ( ) { return this . _buff = "" , this . _length = 0 , this . _hash = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] , this ; } , f . prototype . getState = function ( ) { return { buff : this . _buff , length : this . _length , hash : this . _hash . slice ( ) } ; } , f . prototype . setState = function ( e ) { return this . _buff = e . buff , this . _length = e . length , this . _hash = e . hash , this ; } , f . prototype . destroy = function ( ) { delete this . _hash , delete this . _buff , delete this . _length ; } , f . prototype . _finish = function ( e , t ) { var r , o , i , s = t ; if ( e [ s >> 2 ] |= 128 << ( s % 4 << 3 ) , s > 55 ) for ( n ( this . _hash , e ) , s = 0 ; s < 16 ; s += 1 ) e [ s ] = 0 ; r = ( r = 8 * this . _length ) . toString ( 16 ) . match ( /(.*?)(.{0,8})$/ ) , o = parseInt ( r [ 2 ] , 16 ) , i = parseInt ( r [ 1 ] , 16 ) || 0 , e [ 14 ] = o , e [ 15 ] = i , n ( this . _hash , e ) ; } , f . hash = function ( e , t ) { return f . hashBinary ( u ( e ) , t ) ; } , f . hashBinary = function ( e , t ) { var n = a ( i ( e ) ) ; return t ? c ( n ) : n ; } , f . ArrayBuffer = function ( ) { this . reset ( ) ; } , f . ArrayBuffer . prototype . append = function ( e ) { var t , r , i , s , a , u = ( r = this . _buff . buffer , i = e , s = ! 0 , ( a = new Uint8Array ( r . byteLength + i . byteLength ) ) . set ( new Uint8Array ( r ) ) , a . set ( new Uint8Array ( i ) , r . byteLength ) , s ? a : a . buffer ) , c = u . length ; for ( this . _length += e . byteLength , t = 64 ; t <= c ; t += 64 ) n ( this . _hash , o ( u . subarray ( t - 64 , t ) ) ) ; return this . _buff = t - 64 < c ? new Uint8Array ( u . buffer . slice ( t - 64 ) ) : new Uint8Array ( 0 ) , this ; } , f . ArrayBuffer . prototype . end = function ( e ) { var t , n , r = this . _buff , o = r . length , i = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ; for ( t = 0 ; t < o ; t += 1 ) i [ t >> 2 ] |= r [ t ] << ( t % 4 << 3 ) ; return this . _finish ( i , o ) , n = a ( this . _hash ) , e && ( n = c ( n ) ) , this . reset ( ) , n ; } , f . ArrayBuffer . prototype . reset = function ( ) { return this . _buff = new Uint8Array ( 0 ) , this . _length = 0 , this . _hash = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] , this ; } , f . ArrayBuffer . prototype . getState = function ( ) { var e , t = f . prototype . getState . call ( this ) ; return t . buff = ( e = t . buff , String . fromCharCode . apply ( null , new Uint8Array ( e ) ) ) , t ; } , f . ArrayBuffer . prototype . setState = function ( e ) { return e . buff = function ( e , t ) { var n , r = e . length , o = new ArrayBuffer ( r ) , i = new Uint8Array ( o ) ; for ( n = 0 ; n < r ; n += 1 ) i [ n ] = e . charCodeAt ( n ) ; return t ? i : o ; } ( e . buff , ! 0 ) , f . prototype . setState . call ( this , e ) ; } , f . ArrayBuffer . prototype . destroy = f . prototype . destroy , f . ArrayBuffer . prototype . _finish = f . prototype . _finish , f . ArrayBuffer . hash = function ( e , t ) { var r = a ( function ( e ) { var t , r , i , s , a , u , c = e . length , f = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] ; for ( t = 64 ; t <= c ; t += 64 ) n ( f , o ( e . subarray ( t - 64 , t ) ) ) ; for ( r = ( e = t - 64 < c ? e . subarray ( t - 64 ) : new Uint8Array ( 0 ) ) . length , i = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , t = 0 ; t < r ; t += 1 ) i [ t >> 2 ] |= e [ t ] << ( t % 4 << 3 ) ; if ( i [ t >> 2 ] |= 128 << ( t % 4 << 3 ) , t > 55 ) for ( n ( f , i ) , t = 0 ; t < 16 ; t += 1 ) i [ t ] = 0 ; return s = ( s = 8 * c ) . toString ( 16 ) . match ( /(.*?)(.{0,8})$/ ) , a = parseInt ( s [ 2 ] , 16 ) , u = parseInt ( s [ 1 ] , 16 ) || 0 , i [ 14 ] = a , i [ 15 ] = u , n ( f , i ) , f ; } ( new Uint8Array ( e ) ) ) ; return t ? c ( r ) : r ; } , f ; } ( ) ; } , 825 : ( e , t ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; const n = [ ] ; for ( let e = 0 ; e < 256 ; ++ e ) n . push ( ( e + 256 ) . toString ( 16 ) . substr ( 1 ) ) ; t . default = function ( e , t ) { const r = t || 0 , o = n ; return ( o [ e [ r + 0 ] ] + o [ e [ r + 1 ] ] + o [ e [ r + 2 ] ] + o [ e [ r + 3 ] ] + "-" + o [ e [ r + 4 ] ] + o [ e [ r + 5 ] ] + "-" + o [ e [ r + 6 ] ] + o [ e [ r + 7 ] ] + "-" + o [ e [ r + 8 ] ] + o [ e [ r + 9 ] ] + "-" + o [ e [ r + 10 ] ] + o [ e [ r + 11 ] ] + o [ e [ r + 12 ] ] + o [ e [ r + 13 ] ] + o [ e [ r + 14 ] ] + o [ e [ r + 15 ] ] ) . toLowerCase ( ) ; } ; } , 593 : ( e , t , n ) => { Object . defineProperty ( t , "v1" , { enumerable : ! 0 , get : function ( ) { return r . default ; } } ) , Object . defineProperty ( t , "v3" , { enumerable : ! 0 , get : function ( ) { return o . default ; } } ) , Object . defineProperty ( t , "v4" , { enumerable : ! 0 , get : function ( ) { return i . default ; } } ) , Object . defineProperty ( t , "v5" , { enumerable : ! 0 , get : function ( ) { return s . default ; } } ) ; var r = a ( n ( 922 ) ) , o = a ( n ( 964 ) ) , i = a ( n ( 509 ) ) , s = a ( n ( 669 ) ) ; function a ( e ) { return e && e . __esModule ? e : { default : e } ; } } , 489 : ( e , t ) => { function n ( e ) { return 14 + ( e + 64 >>> 9 << 4 ) + 1 ; } function r ( e , t ) { const n = ( 65535 & e ) + ( 65535 & t ) ; return ( e >> 16 ) + ( t >> 16 ) + ( n >> 16 ) << 16 | 65535 & n ; } function o ( e , t , n , o , i , s ) { return r ( ( a = r ( r ( t , e ) , r ( o , s ) ) ) << ( u = i ) | a >>> 32 - u , n ) ; var a , u ; } function i ( e , t , n , r , i , s , a ) { return o ( t & n | ~ t & r , e , t , i , s , a ) ; } function s ( e , t , n , r , i , s , a ) { return o ( t & r | n & ~ r , e , t , i , s , a ) ; } function a ( e , t , n , r , i , s , a ) { return o ( t ^ n ^ r , e , t , i , s , a ) ; } function u ( e , t , n , r , i , s , a ) { return o ( n ^ ( t | ~ r ) , e , t , i , s , a ) ; } Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; t . default = function ( e ) { if ( "string" == typeof e ) { const t = unescape ( encodeURIComponent ( e ) ) ; e = new Uint8Array ( t . length ) ; for ( let n = 0 ; n < t . length ; ++ n ) e [ n ] = t . charCodeAt ( n ) ; } return function ( e ) { const t = [ ] , n = 32 * e . length , r = "0123456789abcdef" ; for ( let o = 0 ; o < n ; o += 8 ) { const n = e [ o >> 5 ] >>> o % 32 & 255 , i = parseInt ( r . charAt ( n >>> 4 & 15 ) + r . charAt ( 15 & n ) , 16 ) ; t . push ( i ) ; } return t ; } ( function ( e , t ) { e [ t >> 5 ] |= 128 << t % 32 , e [ n ( t ) - 1 ] = t ; let o = 1732584193 , c = - 271733879 , f = - 1732584194 , l = 271733878 ; for ( let t = 0 ; t < e . length ; t += 16 ) { const n = o , d = c , h = f , p = l ; o = i ( o , c , f , l , e [ t ] , 7 , - 680876936 ) , l = i ( l , o , c , f , e [ t + 1 ] , 12 , - 389564586 ) , f = i ( f , l , o , c , e [ t + 2 ] , 17 , 606105819 ) , c = i ( c , f , l , o , e [ t + 3 ] , 22 , - 1044525330 ) , o = i ( o , c , f , l , e [ t + 4 ] , 7 , - 176418897 ) , l = i ( l , o , c , f , e [ t + 5 ] , 12 , 1200080426 ) , f = i ( f , l , o , c , e [ t + 6 ] , 17 , - 1473231341 ) , c = i ( c , f , l , o , e [ t + 7 ] , 22 , - 45705983 ) , o = i ( o , c , f , l , e [ t + 8 ] , 7 , 1770035416 ) , l = i ( l , o , c , f , e [ t + 9 ] , 12 , - 1958414417 ) , f = i ( f , l , o , c , e [ t + 10 ] , 17 , - 42063 ) , c = i ( c , f , l , o , e [ t + 11 ] , 22 , - 1990404162 ) , o = i ( o , c , f , l , e [ t + 12 ] , 7 , 1804603682 ) , l = i ( l , o , c , f , e [ t + 13 ] , 12 , - 40341101 ) , f = i ( f , l , o , c , e [ t + 14 ] , 17 , - 1502002290 ) , c = i ( c , f , l , o , e [ t + 15 ] , 22 , 1236535329 ) , o = s ( o , c , f , l , e [ t + 1 ] , 5 , - 165796510 ) , l = s ( l , o , c , f , e [ t + 6 ] , 9 , - 1069501632 ) , f = s ( f , l , o , c , e [ t + 11 ] , 14 , 643717713 ) , c = s ( c , f , l , o , e [ t ] , 20 , - 373897302 ) , o = s ( o , c , f , l , e [ t + 5 ] , 5 , - 701558691 ) , l = s ( l , o , c , f , e [ t + 10 ] , 9 , 38016083 ) , f = s ( f , l , o , c , e [ t + 15 ] , 14 , - 660478335 ) , c = s ( c , f , l , o , e [ t + 4 ] , 20 , - 405537848 ) , o = s ( o , c , f , l , e [ t + 9 ] , 5 , 568446438 ) , l = s ( l , o , c , f , e [ t + 14 ] , 9 , - 1019803690 ) , f = s ( f , l , o , c , e [ t + 3 ] , 14 , - 187363961 ) , c = s ( c , f , l , o , e [ t + 8 ] , 20 , 1163531501 ) , o = s ( o , c , f , l , e [ t + 13 ] , 5 , - 1444681467 ) , l = s ( l , o , c , f , e [ t + 2 ] , 9 , - 51403784 ) , f = s ( f , l , o , c , e [ t + 7 ] , 14 , 1735328473 ) , c = s ( c , f , l , o , e [ t + 12 ] , 20 , - 1926607734 ) , o = a ( o , c , f , l , e [ t + 5 ] , 4 , - 378558 ) , l = a ( l , o , c , f , e [ t + 8 ] , 11 , - 2022574463 ) , f = a ( f , l , o , c , e [ t + 11 ] , 16 , 1839030562 ) , c = a ( c , f , l , o , e [ t + 14 ] , 23 , - 35309556 ) , o = a ( o , c , f , l , e [ t + 1 ] , 4 , - 1530992060 ) , l = a ( l , o , c , f , e [ t + 4 ] , 11 , 1272893353 ) , f = a ( f , l , o , c , e [ t + 7 ] , 16 , - 155497632 ) , c = a ( c , f , l , o , e [ t + 10 ] , 23 , - 1094730640 ) , o = a ( o , c , f , l , e [ t + 13 ] , 4 , 681279174 ) , l = a ( l , o , c , f , e [ t ] , 11 , - 358537222 ) , f = a ( f , l , o , c , e [ t + 3 ] , 16 , - 722521979 ) , c = a ( c , f , l , o , e [ t + 6 ] , 23 , 76029189 ) , o = a ( o , c , f , l , e [ t + 9 ] , 4 , - 640364487 ) , l = a ( l , o , c , f , e [ t + 12 ] , 11 , - 421815835 ) , f = a ( f , l , o , c , e [ t + 15 ] , 16 , 530742520 ) , c = a ( c , f , l , o , e [ t + 2 ] , 23 , - 995338651 ) , o = u ( o , c , f , l , e [ t ] , 6 , - 198630844 ) , l = u ( l , o , c , f , e [ t + 7 ] , 10 , 1126891415 ) , f = u ( f , l , o , c , e [ t + 14 ] , 15 , - 1416354905 ) , c = u ( c , f , l , o , e [ t + 5 ] , 21 , - 57434055 ) , o = u ( o , c , f , l , e [ t + 12 ] , 6 , 1700485571 ) , l = u ( l , o , c , f , e [ t + 3 ] , 10 , - 1894986606 ) , f = u ( f , l , o , c , e [ t + 10 ] , 15 , - 1051523 ) , c = u ( c , f , l , o , e [ t + 1 ] , 21 , - 2054922799 ) , o = u ( o , c , f , l , e [ t + 8 ] , 6 , 1873313359 ) , l = u ( l , o , c , f , e [ t + 15 ] , 10 , - 30611744 ) , f = u ( f , l , o , c , e [ t + 6 ] , 15 , - 1560198380 ) , c = u ( c , f , l , o , e [ t + 13 ] , 21 , 1309151649 ) , o = u ( o , c , f , l , e [ t + 4 ] , 6 , - 145523070 ) , l = u ( l , o , c , f , e [ t + 11 ] , 10 , - 1120210379 ) , f = u ( f , l , o , c , e [ t + 2 ] , 15 , 718787259 ) , c = u ( c , f , l , o , e [ t + 9 ] , 21 , - 343485551 ) , o = r ( o , n ) , c = r ( c , d ) , f = r ( f , h ) , l = r ( l , p ) ; } return [ o , c , f , l ] ; } ( function ( e ) { if ( 0 === e . length ) return [ ] ; const t = 8 * e . length , r = new Uint32Array ( n ( t ) ) ; for ( let n = 0 ; n < t ; n += 8 ) r [ n >> 5 ] |= ( 255 & e [ n / 8 ] ) << n % 32 ; return r ; } ( e ) , 8 * e . length ) ) ; } ; } , 827 : ( e , t ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = function ( ) { if ( ! n ) throw new Error ( "crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported" ) ; return n ( r ) ; } ; const n = "undefined" != typeof crypto && crypto . getRandomValues && crypto . getRandomValues . bind ( crypto ) || "undefined" != typeof msCrypto && "function" == typeof msCrypto . getRandomValues && msCrypto . getRandomValues . bind ( msCrypto ) , r = new Uint8Array ( 16 ) ; } , 558 : ( e , t ) => { function n ( e , t , n , r ) { switch ( e ) { case 0 : return t & n ^ ~ t & r ; case 1 : case 3 : return t ^ n ^ r ; case 2 : return t & n ^ t & r ^ n & r ; } } function r ( e , t ) { return e << t | e >>> 32 - t ; } Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; t . default = function ( e ) { const t = [ 1518500249 , 1859775393 , 2400959708 , 3395469782 ] , o = [ 1732584193 , 4023233417 , 2562383102 , 271733878 , 3285377520 ] ; if ( "string" == typeof e ) { const t = unescape ( encodeURIComponent ( e ) ) ; e = [ ] ; for ( let n = 0 ; n < t . length ; ++ n ) e . push ( t . charCodeAt ( n ) ) ; } e . push ( 128 ) ; const i = e . length / 4 + 2 , s = Math . ceil ( i / 16 ) , a = new Array ( s ) ; for ( let t = 0 ; t < s ; ++ t ) { const n = new Uint32Array ( 16 ) ; for ( let r = 0 ; r < 16 ; ++ r ) n [ r ] = e [ 64 * t + 4 * r ] << 24 | e [ 64 * t + 4 * r + 1 ] << 16 | e [ 64 * t + 4 * r + 2 ] << 8 | e [ 64 * t + 4 * r + 3 ] ; a [ t ] = n ; } a [ s - 1 ] [ 14 ] = 8 * ( e . length - 1 ) / Math . pow ( 2 , 32 ) , a [ s - 1 ] [ 14 ] = Math . floor ( a [ s - 1 ] [ 14 ] ) , a [ s - 1 ] [ 15 ] = 8 * ( e . length - 1 ) & 4294967295 ; for ( let e = 0 ; e < s ; ++ e ) { const i = new Uint32Array ( 80 ) ; for ( let t = 0 ; t < 16 ; ++ t ) i [ t ] = a [ e ] [ t ] ; for ( let e = 16 ; e < 80 ; ++ e ) i [ e ] = r ( i [ e - 3 ] ^ i [ e - 8 ] ^ i [ e - 14 ] ^ i [ e - 16 ] , 1 ) ; let s = o [ 0 ] , u = o [ 1 ] , c = o [ 2 ] , f = o [ 3 ] , l = o [ 4 ] ; for ( let e = 0 ; e < 80 ; ++ e ) { const o = Math . floor ( e / 20 ) , a = r ( s , 5 ) + n ( o , u , c , f ) + l + t [ o ] + i [ e ] >>> 0 ; l = f , f = c , c = r ( u , 30 ) >>> 0 , u = s , s = a ; } o [ 0 ] = o [ 0 ] + s >>> 0 , o [ 1 ] = o [ 1 ] + u >>> 0 , o [ 2 ] = o [ 2 ] + c >>> 0 , o [ 3 ] = o [ 3 ] + f >>> 0 , o [ 4 ] = o [ 4 ] + l >>> 0 ; } return [ o [ 0 ] >> 24 & 255 , o [ 0 ] >> 16 & 255 , o [ 0 ] >> 8 & 255 , 255 & o [ 0 ] , o [ 1 ] >> 24 & 255 , o [ 1 ] >> 16 & 255 , o [ 1 ] >> 8 & 255 , 255 & o [ 1 ] , o [ 2 ] >> 24 & 255 , o [ 2 ] >> 16 & 255 , o [ 2 ] >> 8 & 255 , 255 & o [ 2 ] , o [ 3 ] >> 24 & 255 , o [ 3 ] >> 16 & 255 , o [ 3 ] >> 8 & 255 , 255 & o [ 3 ] , o [ 4 ] >> 24 & 255 , o [ 4 ] >> 16 & 255 , o [ 4 ] >> 8 & 255 , 255 & o [ 4 ] ] ; } ; } , 922 : ( e , t , n ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; var r = i ( n ( 827 ) ) , o = i ( n ( 825 ) ) ; function i ( e ) { return e && e . __esModule ? e : { default : e } ; } let s , a , u = 0 , c = 0 ; t . default = function ( e , t , n ) { let i = t && n || 0 ; const f = t || [ ] ; let l = ( e = e || { } ) . node || s , d = void 0 !== e . clockseq ? e . clockseq : a ; if ( null == l || null == d ) { const t = e . random || ( e . rng || r . default ) ( ) ; null == l && ( l = s = [ 1 | t [ 0 ] , t [ 1 ] , t [ 2 ] , t [ 3 ] , t [ 4 ] , t [ 5 ] ] ) , null == d && ( d = a = 16383 & ( t [ 6 ] << 8 | t [ 7 ] ) ) ; } let h = void 0 !== e . msecs ? e . msecs : Date . now ( ) , p = void 0 !== e . nsecs ? e . nsecs : c + 1 ; const v = h - u + ( p - c ) / 1e4 ; if ( v < 0 && void 0 === e . clockseq && ( d = d + 1 & 16383 ) , ( v < 0 || h > u ) && void 0 === e . nsecs && ( p = 0 ) , p >= 1e4 ) throw new Error ( "uuid.v1(): Can't create more than 10M uuids/sec" ) ; u = h , c = p , a = d , h += 122192928e5 ; const y = ( 1e4 * ( 268435455 & h ) + p ) % 4294967296 ; f [ i ++ ] = y >>> 24 & 255 , f [ i ++ ] = y >>> 16 & 255 , f [ i ++ ] = y >>> 8 & 255 , f [ i ++ ] = 255 & y ; const _ = h / 4294967296 * 1e4 & 268435455 ; f [ i ++ ] = _ >>> 8 & 255 , f [ i ++ ] = 255 & _ , f [ i ++ ] = _ >>> 24 & 15 | 16 , f [ i ++ ] = _ >>> 16 & 255 , f [ i ++ ] = d >>> 8 | 128 , f [ i ++ ] = 255 & d ; for ( let e = 0 ; e < 6 ; ++ e ) f [ i + e ] = l [ e ] ; return t || ( 0 , o . default ) ( f ) ; } ; } , 964 : ( e , t , n ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; var r = i ( n ( 137 ) ) , o = i ( n ( 489 ) ) ; function i ( e ) { return e && e . __esModule ? e : { default : e } ; } var s = ( 0 , r . default ) ( "v3" , 48 , o . default ) ; t . default = s ; } , 137 : ( e , t , n ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = function ( e , t , n ) { function r ( e , r , i , s ) { const a = i && s || 0 ; if ( "string" == typeof e && ( e = function ( e ) { e = unescape ( encodeURIComponent ( e ) ) ; const t = [ ] ; for ( let n = 0 ; n < e . length ; ++ n ) t . push ( e . charCodeAt ( n ) ) ; return t ; } ( e ) ) , "string" == typeof r && ( r = function ( e ) { const t = [ ] ; return e . replace ( /[a-fA-F0-9]{2}/g , ( function ( e ) { t . push ( parseInt ( e , 16 ) ) ; } ) ) , t ; } ( r ) ) , ! Array . isArray ( e ) ) throw TypeError ( "value must be an array of bytes" ) ; if ( ! Array . isArray ( r ) || 16 !== r . length ) throw TypeError ( "namespace must be uuid string or an Array of 16 byte values" ) ; const u = n ( r . concat ( e ) ) ; if ( u [ 6 ] = 15 & u [ 6 ] | t , u [ 8 ] = 63 & u [ 8 ] | 128 , i ) for ( let e = 0 ; e < 16 ; ++ e ) i [ a + e ] = u [ e ] ; return i || ( 0 , o . default ) ( u ) ; } try { r . name = e ; } catch ( e ) { } return r . DNS = i , r . URL = s , r ; } , t . URL = t . DNS = void 0 ; var r , o = ( r = n ( 825 ) ) && r . __esModule ? r : { default : r } ; const i = "6ba7b810-9dad-11d1-80b4-00c04fd430c8" ; t . DNS = i ; const s = "6ba7b811-9dad-11d1-80b4-00c04fd430c8" ; t . URL = s ; } , 509 : ( e , t , n ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; var r = i ( n ( 827 ) ) , o = i ( n ( 825 ) ) ; function i ( e ) { return e && e . __esModule ? e : { default : e } ; } t . default = function ( e , t , n ) { "string" == typeof e && ( t = "binary" === e ? new Uint8Array ( 16 ) : null , e = null ) ; const i = ( e = e || { } ) . random || ( e . rng || r . default ) ( ) ; if ( i [ 6 ] = 15 & i [ 6 ] | 64 , i [ 8 ] = 63 & i [ 8 ] | 128 , t ) { const e = n || 0 ; for ( let n = 0 ; n < 16 ; ++ n ) t [ e + n ] = i [ n ] ; return t ; } return ( 0 , o . default ) ( i ) ; } ; } , 669 : ( e , t , n ) => { Object . defineProperty ( t , "__esModule" , { value : ! 0 } ) , t . default = void 0 ; var r = i ( n ( 137 ) ) , o = i ( n ( 558 ) ) ; function i ( e ) { return e && e . __esModule ? e : { default : e } ; } var s = ( 0 , r . default ) ( "v5" , 80 , o . default ) ; t . default = s ; } , 684 : ( e , t ) => { function n ( e , t , n ) { var r = n [ n . length - 1 ] ; e === r . element && ( n . pop ( ) , r = n [ n . length - 1 ] ) ; var o = r . element , i = r . index ; Array . isArray ( o ) ? o . push ( e ) : i === t . length - 2 ? o [ t . pop ( ) ] = e : t . push ( e ) ; } t . stringify = function ( e ) { var t = [ ] ; t . push ( { obj : e } ) ; for ( var n , r , o , i , s , a , u , c , f , l , d = "" ; n = t . pop ( ) ; ) if ( r = n . obj , d += n . prefix || "" , o = n . val || "" ) d += o ; else if ( "object" != typeof r ) d += void 0 === r ? null : JSON . stringify ( r ) ; else if ( null === r ) d += "null" ; else if ( Array . isArray ( r ) ) { for ( t . push ( { val : "]" } ) , i = r . length - 1 ; i >= 0 ; i -- ) s = 0 === i ? "" : "," , t . push ( { obj : r [ i ] , prefix : s } ) ; t . push ( { val : "[" } ) ; } else { for ( u in a = [ ] , r ) r . hasOwnProperty ( u ) && a . push ( u ) ; for ( t . push ( { val : "}" } ) , i = a . length - 1 ; i >= 0 ; i -- ) f = r [ c = a [ i ] ] , l = i > 0 ? "," : "" , l += JSON . stringify ( c ) + ":" , t . push ( { obj : f , prefix : l } ) ; t . push ( { val : "{" } ) ; } return d ; } , t . parse = function ( e ) { for ( var t , r , o , i , s , a , u , c , f , l = [ ] , d = [ ] , h = 0 ; ; ) if ( "}" !== ( t = e [ h ++ ] ) && "]" !== t && void 0 !== t ) switch ( t ) { case " " : case "\t" : case "\n" : case ":" : case "," : break ; case "n" : h += 3 , n ( null , l , d ) ; break ; case "t" : h += 3 , n ( ! 0 , l , d ) ; break ; case "f" : h += 4 , n ( ! 1 , l , d ) ; break ; case "0" : case "1" : case "2" : case "3" : case "4" : case "5" : case "6" : case "7" : case "8" : case "9" : case "-" : for ( r = "" , h -- ; ; ) { if ( o = e [ h ++ ] , ! /[\d\.\-e\+]/ . test ( o ) ) { h -- ; break ; } r += o ; } n ( parseFloat ( r ) , l , d ) ; break ; case '"' : for ( i = "" , s = void 0 , a = 0 ; '"' !== ( u = e [ h ++ ] ) || "\\" === s && a % 2 == 1 ; ) i += u , "\\" === ( s = u ) ? a ++ : a = 0 ; n ( JSON . parse ( '"' + i + '"' ) , l , d ) ; break ; case "[" : c = { element : [ ] , index : l . length } , l . push ( c . element ) , d . push ( c ) ; break ; case "{" : f = { element : { } , index : l . length } , l . push ( f . element ) , d . push ( f ) ; break ; default : throw new Error ( "unexpectedly reached end of input: " + t ) ; } else { if ( 1 === l . length ) return l . pop ( ) ; n ( l . pop ( ) , l , d ) ; } } ; } , 525 : ( ) => { } } , t = { } ; function n ( r ) { var o = t [ r ] ; if ( void 0 !== o ) return o . exports ; var i = t [ r ] = { exports : { } } ; return e [ r ] ( i , i . exports , n ) , i . exports ; } n . n = e => { var t = e && e . __esModule ? ( ) => e . default : ( ) => e ; return n . d ( t , { a : t } ) , t ; } , n . d = ( e , t ) => { for ( var r in t ) n . o ( t , r ) && ! n . o ( e , r ) && Object . defineProperty ( e , r , { enumerable : ! 0 , get : t [ r ] } ) ; } , n . g = function ( ) { if ( "object" == typeof globalThis ) return globalThis ; try { return this || new Function ( "return this" ) ( ) ; } catch ( e ) { if ( "object" == typeof window ) return window ; } } ( ) , n . o = ( e , t ) => Object . prototype . hasOwnProperty . call ( e , t ) ; var r = { } ; ( ( ) => { n . d ( r , { o : ( ) => cr } ) ; var e = n ( 624 ) , t = n . n ( e ) , o = n ( 593 ) ; o . v1 , o . v3 ; const i = o . v4 ; o . v5 ; var s , a , u = n ( 322 ) , c = n . n ( u ) , f = n ( 684 ) , l = n ( 105 ) , d = n . n ( l ) , h = n ( 717 ) , p = n . n ( h ) , v = n ( 187 ) , y = n . n ( v ) ; function _ ( e ) { return "$" + e ; } function g ( e ) { return e . substring ( 1 ) ; } function m ( ) { this . _store = { } ; } function b ( e ) { if ( this . _store = new m , e && Array . isArray ( e ) ) for ( var t = 0 , n = e . length ; t < n ; t ++ ) this . add ( e [ t ] ) ; } m . prototype . get = function ( e ) { var t = _ ( e ) ; return this . _store [ t ] ; } , m . prototype . set = function ( e , t ) { var n = _ ( e ) ; return this . _store [ n ] = t , ! 0 ; } , m . prototype . has = function ( e ) { return _ ( e ) in this . _store ; } , m . prototype . delete = function ( e ) { var t = _ ( e ) , n = t in this . _store ; return delete this . _store [ t ] , n ; } , m . prototype . forEach = function ( e ) { for ( var t = Object . keys ( this . _store ) , n = 0 , r = t . length ; n < r ; n ++ ) { var o = t [ n ] ; e ( this . _store [ o ] , o = g ( o ) ) ; } } , Object . defineProperty ( m . prototype , "size" , { get : function ( ) { return Object . keys ( this . _store ) . length ; } } ) , b . prototype . add = function ( e ) { return this . _store . set ( e , ! 0 ) ; } , b . prototype . has = function ( e ) { return this . _store . has ( e ) ; } , b . prototype . forEach = function ( e ) { this . _store . forEach ( ( function ( t , n ) { e ( n ) ; } ) ) ; } , Object . defineProperty ( b . prototype , "size" , { get : function ( ) { return this . _store . size ; } } ) , function ( ) { if ( "undefined" == typeof Symbol || "undefined" == typeof Map || "undefined" == typeof Set ) return ! 1 ; var e = Object . getOwnPropertyDescriptor ( Map , Symbol . species ) ; return e && "get" in e && Map [ Symbol . species ] === Map ; } ( ) ? ( s = Set , a = Map ) : ( s = b , a = m ) ; var w , k = Function . prototype . toString , j = k . call ( Object ) ; function O ( e ) { var t , n , r ; if ( ! e || "object" != typeof e ) return e ; if ( Array . isArray ( e ) ) { for ( t = [ ] , n = 0 , r = e . length ; n < r ; n ++ ) t [ n ] = O ( e [ n ] ) ; return t ; } if ( e instanceof Date ) return e . toISOString ( ) ; if ( function ( e ) { return "undefined" != typeof ArrayBuffer && e instanceof ArrayBuffer || "undefined" != typeof Blob && e instanceof Blob ; } ( e ) ) return function ( e ) { if ( e instanceof ArrayBuffer ) return function ( e ) { if ( "function" == typeof e . slice ) return e . slice ( 0 ) ; var t = new ArrayBuffer ( e . byteLength ) , n = new Uint8Array ( t ) , r = new Uint8Array ( e ) ; return n . set ( r ) , t ; } ( e ) ; var t = e . size , n = e . type ; return "function" == typeof e . slice ? e . slice ( 0 , t , n ) : e . webkitSlice ( 0 , t , n ) ; } ( e ) ; if ( ! function ( e ) { var t = Object . getPrototypeOf ( e ) ; if ( null === t ) return ! 0 ; var n = t . constructor ; return "function" == typeof n && n instanceof n && k . call ( n ) == j ; } ( e ) ) return e ; for ( n in t = { } , e ) if ( Object . prototype . hasOwnProperty . call ( e , n ) ) { var o = O ( e [ n ] ) ; void 0 !== o && ( t [ n ] = o ) ; } return t ; } function A ( e ) { var t = ! 1 ; return d ( ) ( ( function ( n ) { if ( t ) throw new Error ( "once called more than once" ) ; t = ! 0 , e . apply ( this , n ) ; } ) ) ; } function q ( e ) { return d ( ) ( ( function ( t ) { t = O ( t ) ; var n = this , r = "function" == typeof t [ t . length - 1 ] && t . pop ( ) , o = new Promise ( ( function ( r , o ) { var i ; try { var s = A ( ( function ( e , t ) { e ? o ( e ) : r ( t ) ; } ) ) ; t . push ( s ) , ( i = e . apply ( n , t ) ) && "function" == typeof i . then && r ( i ) ; } catch ( e ) { o ( e ) ; } } ) ) ; return r && o . then ( ( function ( e ) { r ( null , e ) ; } ) , r ) , o ; } ) ) ; } function S ( e , t ) { return q ( d ( ) ( ( function ( n ) { if ( this . _closed ) return Promise . reject ( new Error ( "database is closed" ) ) ; if ( this . _destroyed ) return Promise . reject ( new Error ( "database is destroyed" ) ) ; var r = this ; return function ( e , t , n ) { if ( e . constructor . listeners ( "debug" ) . length ) { for ( var r = [ "api" , e . name , t ] , o = 0 ; o < n . length - 1 ; o ++ ) r . push ( n [ o ] ) ; e . constructor . emit ( "debug" , r ) ; var i = n [ n . length - 1 ] ; n [ n . length - 1 ] = function ( n , r ) { var o = [ "api" , e . name , t ] ; o = o . concat ( n ? [ "error" , n ] : [ "success" , r ] ) , e . constructor . emit ( "debug" , o ) , i ( n , r ) ; } ; } } ( r , e , n ) , this . taskqueue . isReady ? t . apply ( this , n ) : new Promise ( ( function ( t , o ) { r . taskqueue . addTask ( ( function ( i ) { i ? o ( i ) : t ( r [ e ] . apply ( r , n ) ) ; } ) ) ; } ) ) ; } ) ) ) ; } function x ( e , t ) { for ( var n = { } , r = 0 , o = t . length ; r < o ; r ++ ) { var i = t [ r ] ; i in e && ( n [ i ] = e [ i ] ) ; } return n ; } function E ( e ) { return e ; } function C ( e ) { return [ { ok : e } ] ; } function P ( e , t , n ) { var r = t . docs , o = new a ; r . forEach ( ( function ( e ) { o . has ( e . id ) ? o . get ( e . id ) . push ( e ) : o . set ( e . id , [ e ] ) ; } ) ) ; var i = o . size , s = 0 , u = new Array ( i ) ; var c = [ ] ; o . forEach ( ( function ( e , t ) { c . push ( t ) ; } ) ) ; var f = 0 ; ! function r ( ) { if ( ! ( f >= c . length ) ) { var a = Math . min ( f + 6 , c . length ) , l = c . slice ( f , a ) ; ! function ( a , c ) { a . forEach ( ( function ( a , f ) { var l = c + f , d = o . get ( a ) , h = x ( d [ 0 ] , [ "atts_since" , "attachments" ] ) ; h . open_revs = d . map ( ( function ( e ) { return e . rev ; } ) ) , h . open_revs = h . open_revs . filter ( E ) ; var p = E ; 0 === h . open_revs . length && ( delete h . open_revs , p = C ) , [ "revs" , "attachments" , "binary" , "ajax" , "latest" ] . forEach ( ( function ( e ) { e in t && ( h [ e ] = t [ e ] ) ; } ) ) , e . get ( a , h , ( function ( e , t ) { var o , c , f , d ; o = e ? [ { error : e } ] : p ( t ) , c = a , f = o , u [ l ] = { id : c , docs : f } , ++ s === i && ( d = [ ] , u . forEach ( ( function ( e ) { e . docs . forEach ( ( function ( t ) { d . push ( { id : e . id , docs : [ t ] } ) ; } ) ) ; } ) ) , n ( null , { results : d } ) ) , r ( ) ; } ) ) ; } ) ) ; } ( l , f ) , f += l . length ; } } ( ) ; } try { localStorage . setItem ( "_pouch_check_localstorage" , 1 ) , w = ! ! localStorage . getItem ( "_pouch_check_localstorage" ) ; } catch ( e ) { w = ! 1 ; } function L ( ) { return w ; } function D ( ) { y ( ) . call ( this ) , this . _listeners = { } , function ( e ) { L ( ) && addEventListener ( "storage" , ( function ( t ) { e . emit ( t . key ) ; } ) ) ; } ( this ) ; } function $ ( e ) { if ( "undefined" != typeof console && "function" == typeof console [ e ] ) { var t = Array . prototype . slice . call ( arguments , 1 ) ; console [ e ] . apply ( console , t ) ; } } function I ( e ) { var t = 0 ; return e || ( t = 2e3 ) , function ( e , t ) { var n = 6e5 ; return e = parseInt ( e , 10 ) || 0 , ( t = parseInt ( t , 10 ) ) != t || t <= e ? t = ( e || 1 ) << 1 : t += 1 , t > n && ( e = 3e5 , t = n ) , ~ ~ ( ( t - e ) * Math . random ( ) + e ) ; } ( e , t ) ; } function B ( e , t ) { $ ( "info" , "The above " + e + " is totally normal. " + t ) ; } p ( ) ( D , y ( ) ) , D . prototype . addListener = function ( e , n , r , o ) { if ( ! this . _listeners [ n ] ) { var i = this , s = ! 1 ; this . _listeners [ n ] = a , this . on ( e , a ) ; } function a ( ) { if ( i . _listeners [ n ] ) if ( s ) s = "waiting" ; else { s = ! 0 ; var e = x ( o , [ "style" , "include_docs" , "attachments" , "conflicts" , "filter" , "doc_ids" , "view" , "since" , "query_params" , "binary" , "return_docs" ] ) ; r . changes ( e ) . on ( "change" , ( function ( e ) { e . seq > o . since && ! o . cancelled && ( o . since = e . seq , o . onChange ( e ) ) ; } ) ) . on ( "complete" , ( function ( ) { "waiting" === s && t ( ) ( a ) , s = ! 1 ; } ) ) . on ( "error" , ( function ( ) { s = ! 1 ; } ) ) ; } } } , D . prototype . removeListener = function ( e , t ) { t in this . _listeners && ( y ( ) . prototype . removeListener . call ( this , e , this . _listeners [ t ] ) , delete this . _listeners [ t ] ) ; } , D . prototype . notifyLocalWindows = function ( e ) { L ( ) && ( localStorage [ e ] = "a" === localStorage [ e ] ? "b" : "a" ) ; } , D . prototype . notify = function ( e ) { this . emit ( e ) , this . notifyLocalWindows ( e ) ; } ; var R = "function" == typeof Object . assign ? Object . assign : function ( e ) { for ( var t = Object ( e ) , n = 1 ; n < arguments . length ; n ++ ) { var r = arguments [ n ] ; if ( null != r ) for ( var o in r ) Object . prototype . hasOwnProperty . call ( r , o ) && ( t [ o ] = r [ o ] ) ; } return t ; } ; function T ( e , t , n ) { Error . call ( this , n ) , this . status = e , this . name = t , this . message = n , this . error = ! 0 ; } p ( ) ( T , Error ) , T . prototype . toString = function ( ) { return JSON . stringify ( { status : this . status , name : this . name , message : this . message , reason : this . reason } ) ; } , new T ( 401 , "unauthorized" , "Name or password is incorrect." ) ; var M = new T ( 400 , "bad_request" , "Missing JSON list of 'docs'" ) , N = new T ( 404 , "not_found" , "missing" ) , U = new T ( 409 , "conflict" , "Document update conflict" ) , F = new T ( 400 , "bad_request" , "_id field must contain a string" ) , K = new T ( 412 , "missing_id" , "_id is required for puts" ) , J = new T ( 400 , "bad_request" , "Only reserved document ids may start with underscore." ) , z = ( new T ( 412 , "precondition_failed" , "Database not open" ) , new T ( 500 , "unknown_error" , "Database encountered an unknown error" ) ) , V = new T ( 500 , "badarg" , "Some query argument is invalid" ) , G = ( new T ( 400 , "invalid_request" , "Request was invalid" ) , new T ( 400 , "query_parse_error" , "Some query parameter is invalid" ) ) , Q = new T ( 500 , "doc_validation" , "Bad special document member" ) , W = new T ( 400 , "bad_request" , "Something wrong with the request" ) , Y = new T ( 400 , "bad_request" , "Document must be a JSON object" ) , H = ( new T ( 404 , "not_found" , "Database not found" ) , new T ( 500 , "indexed_db_went_bad" , "unknown" ) ) , X = ( new T ( 500 , "web_sql_went_bad" , "unknown" ) , new T ( 500 , "levelDB_went_went_bad" , "unknown" ) , new T ( 403 , "forbidden" , "Forbidden by design doc validate_doc_update function" ) , new T ( 400 , "bad_request" , "Invalid rev format" ) ) , Z = ( new T ( 412 , "file_exists" , "The database could not be created, the file already exists." ) , new T ( 412 , "missing_stub" , "A pre-existing attachment stub wasn't found" ) ) ; function ee ( e , t ) { function n ( t ) { for ( var n = Object . getOwnPropertyNames ( e ) , r = 0 , o = n . length ; r < o ; r ++ ) "function" != typeof e [ n [ r ] ] && ( this [ n [ r ] ] = e [ n [ r ] ] ) ; void 0 !== t && ( this . reason = t ) ; } return n . prototype = T . prototype , new n ( t ) ; } function te ( e ) { if ( "object" != typeof e ) { var t = e ; ( e = z ) . data = t ; } return "error" in e && "conflict" === e . error && ( e . name = "conflict" , e . status = 409 ) , "name" in e || ( e . name = e . error || "unknown" ) , "status" in e || ( e . status = 500 ) , "message" in e || ( e . message = e . message || e . reason ) , e ; } function ne ( e ) { var t = { } , n = e . filter && "function" == typeof e . filter ; return t . query = e . query_params , function ( r ) { r . doc || ( r . doc = { } ) ; var o = n && function ( e , t , n ) { try { return ! e ( t , n ) ; } catch ( e ) { var r = "Filter function threw: " + e . toString ( ) ; return ee ( W , r ) ; } } ( e . filter , r . doc , t ) ; if ( "object" == typeof o ) return o ; if ( o ) return ! 1 ; if ( e . include_docs ) { if ( ! e . attachments ) for ( var i in r . doc . _attachments ) r . doc . _attachments . hasOwnProperty ( i ) && ( r . doc . _attachments [ i ] . stub = ! 0 ) ; } else delete r . doc ; return ! 0 ; } ; } function re ( e ) { for ( var t = [ ] , n = 0 , r = e . length ; n < r ; n ++ ) t = t . concat ( e [ n ] ) ; return t ; } function oe ( e ) { var t ; if ( e ? "string" != typeof e ? t = ee ( F ) : /^_/ . test ( e ) && ! /^_(design|local)/ . test ( e ) && ( t = ee ( J ) ) : t = ee ( K ) , t ) throw t ; } function ie ( e ) { return "boolean" == typeof e . _remote ? e . _remote : "function" == typeof e . type && ( $ ( "warn" , "db.type() is deprecated and will be removed in a future version of PouchDB" ) , "http" === e . type ( ) ) ; } function se ( e ) { if ( ! e ) return null ; var t = e . split ( "/" ) ; return 2 === t . length ? t : 1 === t . length ? [ e , e ] : null ; } function ae ( e ) { var t = se ( e ) ; return t ? t . join ( "/" ) : null ; } new T ( 413 , "invalid_url" , "Provided URL is invalid" ) ; var ue = [ "source" , "protocol" , "authority" , "userInfo" , "user" , "password" , "host" , "port" , "relative" , "path" , "directory" , "file" , "query" , "anchor" ] , ce = "queryKey" , fe = /(?:^|&)([^&=]*)=?([^&]*)/g , le = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ ; function de ( e ) { for ( var t = le . exec ( e ) , n = { } , r = 14 ; r -- ; ) { var o = ue [ r ] , i = t [ r ] || "" , s = - 1 !== [ "user" , "password" ] . indexOf ( o ) ; n [ o ] = s ? decodeURIComponent ( i ) : i ; } return n [ ce ] = { } , n [ ue [ 12 ] ] . replace ( fe , ( function ( e , t , r ) { t && ( n [ ce ] [ t ] = r ) ; } ) ) , n ; } function he ( e , t ) { var n = [ ] , r = [ ] ; for ( var o in t ) t . hasOwnProperty ( o ) && ( n . push ( o ) , r . push ( t [ o ] ) ) ; return n . push ( e ) , Function . apply ( null , n ) . apply ( null , r ) ; } function pe ( e , t , n ) { return new Promise ( ( function ( r , o ) { e . get ( t , ( function ( i , s ) { if ( i ) { if ( 404 !== i . status ) return o ( i ) ; s = { } ; } var a = s . _rev , u = n ( s ) ; if ( ! u ) return r ( { updated : ! 1 , rev : a } ) ; u . _id = t , u . _rev = a , r ( function ( e , t , n ) { return e . put ( t ) . then ( ( function ( e ) { return { updated : ! 0 , rev : e . rev } ; } ) , ( function ( r ) { if ( 409 !== r . status ) throw r ; return pe ( e , t . _id , n ) ; } ) ) ; } ( e , u , n ) ) ; } ) ) ; } ) ) ; } var ve = function ( e ) { return atob ( e ) ; } , ye = function ( e ) { return btoa ( e ) ; } ; function _e ( e , t ) { e = e || [ ] , t = t || { } ; try { return new Blob ( e , t ) ; } catch ( o ) { if ( "TypeError" !== o . name ) throw o ; for ( var n = new ( "undefined" != typeof BlobBuilder ? BlobBuilder : "undefined" != typeof MSBlobBuilder ? MSBlobBuilder : "undefined" != typeof MozBlobBuilder ? MozBlobBuilder : WebKitBlobBuilder ) , r = 0 ; r < e . length ; r += 1 ) n . append ( e [ r ] ) ; return n . getBlob ( t . type ) ; } } function ge ( e ) { for ( var t = e . length , n = new ArrayBuffer ( t ) , r = new Uint8Array ( n ) , o = 0 ; o < t ; o ++ ) r [ o ] = e . charCodeAt ( o ) ; return n ; } function me ( e , t ) { return _e ( [ ge ( e ) ] , { type : t } ) ; } function be ( e , t ) { return me ( ve ( e ) , t ) ; } function we ( e , t ) { var n = new FileReader , r = "function" == typeof n . readAsBinaryString ; n . onloadend = function ( e ) { var n = e . target . result || "" ; if ( r ) return t ( n ) ; t ( function ( e ) { for ( var t = "" , n = new Uint8Array ( e ) , r = n . byteLength , o = 0 ; o < r ; o ++ ) t += String . fromCharCode ( n [ o ] ) ; return t ; } ( n ) ) ; } , r ? n . readAsBinaryString ( e ) : n . readAsArrayBuffer ( e ) ; } function ke ( e , t ) { we ( e , ( function ( e ) { t ( e ) ; } ) ) ; } function je ( e , t ) { ke ( e , ( function ( e ) { t ( ye ( e ) ) ; } ) ) ; } var Oe = self . setImmediate || self . setTimeout ; function Ae ( e , t , n , r , o ) { ( n > 0 || r < t . size ) && ( t = function ( e , t , n ) { return e . webkitSlice ? e . webkitSlice ( t , n ) : e . slice ( t , n ) ; } ( t , n , r ) ) , function ( e , t ) { var n = new FileReader ; n . onloadend = function ( e ) { var n = e . target . result || new ArrayBuffer ( 0 ) ; t ( n ) ; } , n . readAsArrayBuffer ( e ) ; } ( t , ( function ( t ) { e . append ( t ) , o ( ) ; } ) ) ; } function qe ( e , t , n , r , o ) { ( n > 0 || r < t . length ) && ( t = t . substring ( n , r ) ) , e . appendBinary ( t ) , o ( ) ; } function Se ( e , t ) { var n = "string" == typeof e , r = n ? e . length : e . size , o = Math . min ( 32768 , r ) , i = Math . ceil ( r / o ) , s = 0 , a = n ? new ( c ( ) ) : new ( c ( ) . ArrayBuffer ) , u = n ? qe : Ae ; function f ( ) { Oe ( d ) ; } function l ( ) { var e , n = ( e = a . end ( ! 0 ) , ye ( e ) ) ; t ( n ) , a . destroy ( ) ; } function d ( ) { var t = s * o ; s ++ , u ( a , e , t , t + o , s < i ? f : l ) ; } d ( ) ; } function xe ( e ) { return c ( ) . hash ( e ) ; } function Ee ( e , t ) { var n = O ( e ) ; return t ? ( delete n . _rev_tree , xe ( JSON . stringify ( n ) ) ) : i ( ) . replace ( /-/g , "" ) . toLowerCase ( ) ; } var Ce = i ; function Pe ( e ) { for ( var t , n , r , o , i = e . rev_tree . slice ( ) ; o = i . pop ( ) ; ) { var s = o . ids , a = s [ 2 ] , u = o . pos ; if ( a . length ) for ( var c = 0 , f = a . length ; c < f ; c ++ ) i . push ( { pos : u + 1 , ids : a [ c ] } ) ; else { var l = ! ! s [ 1 ] . deleted , d = s [ 0 ] ; t && ! ( r !== l ? r : n !== u ? n < u : t < d ) || ( t = d , n = u , r = l ) ; } } return n + "-" + t ; } function Le ( e , t ) { for ( var n , r = e . slice ( ) ; n = r . pop ( ) ; ) for ( var o = n . pos , i = n . ids , s = i [ 2 ] , a = t ( 0 === s . length , o , i [ 0 ] , n . ctx , i [ 1 ] ) , u = 0 , c = s . length ; u < c ; u ++ ) r . push ( { pos : o + 1 , ids : s [ u ] , ctx : a } ) ; } function De ( e , t ) { return e . pos - t . pos ; } function $e ( e ) { var t = [ ] ; Le ( e , ( function ( e , n , r , o , i ) { e && t . push ( { rev : n + "-" + r , pos : n , opts : i } ) ; } ) ) , t . sort ( De ) . reverse ( ) ; for ( var n = 0 , r = t . length ; n < r ; n ++ ) delete t [ n ] . pos ; return t ; } function Ie ( e ) { for ( var t = Pe ( e ) , n = $e ( e . rev_tree ) , r = [ ] , o = 0 , i = n . length ; o < i ; o ++ ) { var s = n [ o ] ; s . rev === t || s . opts . deleted || r . push ( s . rev ) ; } return r ; } function Be ( e ) { for ( var t , n = [ ] , r = e . slice ( ) ; t = r . pop ( ) ; ) { var o = t . pos , i = t . ids , s = i [ 0 ] , a = i [ 1 ] , u = i [ 2 ] , c = 0 === u . length , f = t . history ? t . history . slice ( ) : [ ] ; f . push ( { id : s , opts : a } ) , c && n . push ( { pos : o + 1 - f . length , ids : f } ) ; for ( var l = 0 , d = u . length ; l < d ; l ++ ) r . push ( { pos : o + 1 , ids : u [ l ] , history : f } ) ; } return n . reverse ( ) ; } function Re ( e , t ) { return e . pos - t . pos ; } function Te ( e , t , n ) { var r = function ( e , t , n ) { for ( var r , o = 0 , i = e . length ; o < i ; ) n ( e [ r = o + i >>> 1 ] , t ) < 0 ? o = r + 1 : i = r ; return o ; } ( e , t , n ) ; e . splice ( r , 0 , t ) ; } function Me ( e , t ) { for ( var n , r , o = t , i = e . length ; o < i ; o ++ ) { var s = e [ o ] , a = [ s . id , s . opts , [ ] ] ; r ? ( r [ 2 ] . push ( a ) , r = a ) : n = r = a ; } return n ; } function Ne ( e , t ) { return e [ 0 ] < t [ 0 ] ? - 1 : 1 ; } function Ue ( e , t ) { for ( var n = [ { tree1 : e , tree2 : t } ] , r = ! 1 ; n . length > 0 ; ) { var o = n . pop ( ) , i = o . tree1 , s = o . tree2 ; ( i [ 1 ] . status || s [ 1 ] . status ) && ( i [ 1 ] . status = "available" === i [ 1 ] . status || "available" === s [ 1 ] . status ? "available" : "missing" ) ; for ( var a = 0 ; a < s [ 2 ] . length ; a ++ ) if ( i [ 2 ] [ 0 ] ) { for ( var u = ! 1 , c = 0 ; c < i [ 2 ] . length ; c ++ ) i [ 2 ] [ c ] [ 0 ] === s [ 2 ] [ a ] [ 0 ] && ( n . push ( { tree1 : i [ 2 ] [ c ] , tree2 : s [ 2 ] [ a ] } ) , u = ! 0 ) ; u || ( r = "new_branch" , Te ( i [ 2 ] , s [ 2 ] [ a ] , Ne ) ) ; } else r = "new_leaf" , i [ 2 ] [ 0 ] = s [ 2 ] [ a ] ; } return { conflicts : r , tree : e } ; } function Fe ( e , t , n ) { var r , o = [ ] , i = ! 1 , s = ! 1 ; if ( ! e . length ) return { tree : [ t ] , conflicts : "new_leaf" } ; for ( var a = 0 , u = e . length ; a < u ; a ++ ) { var c = e [ a ] ; if ( c . pos === t . pos && c . ids [ 0 ] === t . ids [ 0 ] ) r = Ue ( c . ids , t . ids ) , o . push ( { pos : c . pos , ids : r . tree } ) , i = i || r . conflicts , s = ! 0 ; else if ( ! 0 !== n ) { var f = c . pos < t . pos ? c : t , l = c . pos < t . pos ? t : c , d = l . pos - f . pos , h = [ ] , p = [ ] ; for ( p . push ( { ids : f . ids , diff : d , parent : null , parentIdx : null } ) ; p . length > 0 ; ) { var v = p . pop ( ) ; if ( 0 !== v . diff ) for ( var y = v . ids [ 2 ] , _ = 0 , g = y . length ; _ < g ; _ ++ ) p . push ( { ids : y [ _ ] , diff : v . diff - 1 , parent : v . ids , parentIdx : _ } ) ; else v . ids [ 0 ] === l . ids [ 0 ] && h . push ( v ) ; } var m = h [ 0 ] ; m ? ( r = Ue ( m . ids , l . ids ) , m . parent [ 2 ] [ m . parentIdx ] = r . tree , o . push ( { pos : f . pos , ids : f . ids } ) , i = i || r . conflicts , s = ! 0 ) : o . push ( c ) ; } else o . push ( c ) ; } return s || o . push ( t ) , o . sort ( Re ) , { tree : o , conflicts : i || "internal_node" } ; } function Ke ( e , t , n ) { var r = Fe ( e , t ) , o = function ( e , t ) { for ( var n , r , o = Be ( e ) , i = 0 , s = o . length ; i < s ; i ++ ) { var a , u = o [ i ] , c = u . ids ; if ( c . length > t ) { n || ( n = { } ) ; var f = c . length - t ; a = { pos : u . pos + f , ids : Me ( c , f ) } ; for ( var l = 0 ; l < f ; l ++ ) { var d = u . pos + l + "-" + c [ l ] . id ; n [ d ] = ! 0 ; } } else a = { pos : u . pos , ids : Me ( c , 0 ) } ; r = r ? Fe ( r , a , ! 0 ) . tree : [ a ] ; } return n && Le ( r , ( function ( e , t , r ) { delete n [ t + "-" + r ] ; } ) ) , { tree : r , revs : n ? Object . keys ( n ) : [ ] } ; } ( r . tree , n ) ; return { tree : o . tree , stemmedRevs : o . revs , conflicts : r . conflicts } ; } function Je ( e ) { return e . ids ; } function ze ( e , t ) { t || ( t = Pe ( e ) ) ; for ( var n , r = t . substring ( t . indexOf ( "-" ) + 1 ) , o = e . rev_tree . map ( Je ) ; n = o . pop ( ) ; ) { if ( n [ 0 ] === r ) return ! ! n [ 1 ] . deleted ; o = o . concat ( n [ 2 ] ) ; } } function Ve ( e ) { return /^_local/ . test ( e ) ; } function Ge ( e , t , n ) { y ( ) . call ( this ) ; var r = this ; this . db = e ; var o = ( t = t ? O ( t ) : { } ) . complete = A ( ( function ( t , n ) { var o , s ; t ? ( s = "error" , ( "listenerCount" in ( o = r ) ? o . listenerCount ( s ) : y ( ) . listenerCount ( o , s ) ) > 0 && r . emit ( "error" , t ) ) : r . emit ( "complete" , n ) , r . removeAllListeners ( ) , e . removeListener ( "destroyed" , i ) ; } ) ) ; function i ( ) { r . cancel ( ) ; } n && ( r . on ( "complete" , ( function ( e ) { n ( null , e ) ; } ) ) , r . on ( "error" , n ) ) , e . once ( "destroyed" , i ) , t . onChange = function ( e , t , n ) { r . isCancelled || function ( e , t , n , r ) { try { e . emit ( "change" , t , n , r ) ; } catch ( e ) { $ ( "error" , 'Error in .on("change", function):' , e ) ; } } ( r , e , t , n ) ; } ; var s = new Promise ( ( function ( e , n ) { t . complete = function ( t , r ) { t ? n ( t ) : e ( r ) ; } ; } ) ) ; r . once ( "cancel" , ( function ( ) { e . removeListener ( "destroyed" , i ) , t . complete ( null , { status : "cancelled" } ) ; } ) ) , this . then = s . then . bind ( s ) , this . catch = s . catch . bind ( s ) , this . then ( ( function ( e ) { o ( null , e ) ; } ) , o ) , e . taskqueue . isReady ? r . validateChanges ( t ) : e . taskqueue . addTask ( ( function ( e ) { e ? t . complete ( e ) : r . isCancelled ? r . emit ( "cancel" ) : r . validateChanges ( t ) ; } ) ) ; } function Qe ( e , t , n ) { var r = [ { rev : e . _rev } ] ; "all_docs" === n . style && ( r = $e ( t . rev_tree ) . map ( ( function ( e ) { return { rev : e . rev } ; } ) ) ) ; var o = { id : t . id , changes : r , doc : e } ; return ze ( t , e . _rev ) && ( o . deleted = ! 0 ) , n . conflicts && ( o . doc . _conflicts = Ie ( t ) , o . doc . _conflicts . length || delete o . doc . _conflicts ) , o ; } function We ( e , t ) { return e < t ? - 1 : e > t ? 1 : 0 ; } function Ye ( e , t ) { return function ( n , r ) { n || r [ 0 ] && r [ 0 ] . error ? ( ( n = n || r [ 0 ] ) . docId = t , e ( n ) ) : e ( null , r . length ? r [ 0 ] : r ) ; } ; } function He ( e , t ) { var n = We ( e . _id , t . _id ) ; return 0 !== n ? n : We ( e . _revisions ? e . _revisions . start : 0 , t . _revisions ? t . _revisions . start : 0 ) ; } function Xe ( e ) { var n = e . _compactionQueue [ 0 ] , r = n . opts , o = n . callback ; e . get ( "_local/compaction" ) . catch ( ( function ( ) { return ! 1 ; } ) ) . then ( ( function ( n ) { n && n . last_seq && ( r . last_seq = n . last_seq ) , e . _compact ( r , ( function ( n , r ) { n ? o ( n ) : o ( null , r ) , t ( ) ( ( function ( ) { e . _compactionQueue . shift ( ) , e . _compactionQueue . length && Xe ( e ) ; } ) ) ; } ) ) ; } ) ) ; } function Ze ( ) { for ( var e in y ( ) . call ( this ) , Ze . prototype ) "function" == typeof this [ e ] && ( this [ e ] = this [ e ] . bind ( this ) ) ; } function et ( ) { this . isReady = ! 1 , this . failed = ! 1 , this . queue = [ ] ; } function tt ( e , t ) { if ( ! ( this instanceof tt ) ) return new tt ( e , t ) ; var n = this ; if ( t = t || { } , e && "object" == typeof e && ( e = ( t = e ) . name , delete t . name ) , void 0 === t . deterministic_revs && ( t . deterministic_revs = ! 0 ) , this . __opts = t = O ( t ) , n . auto_compaction = t . auto_compaction , n . prefix = tt . prefix , "string" != typeof e ) throw new Error ( "Missing/invalid DB name" ) ; var r = function ( e , t ) { var n = e . match ( /([a-z-]*):\/\/(.*)/ ) ; if ( n ) return { name : /https?/ . test ( n [ 1 ] ) ? n [ 1 ] + "://" + n [ 2 ] : n [ 2 ] , adapter : n [ 1 ] } ; var r = tt . adapters , o = tt . preferredAdapters , i = tt . prefix , s = t . adapter ; if ( ! s ) for ( var a = 0 ; a < o . length && "idb" === ( s = o [ a ] ) && "websql" in r && L ( ) && localStorage [ "_pouch__websqldb_" + i + e ] ; ++ a ) $ ( "log" , 'PouchDB is downgrading "' + e + '" to WebSQL to avoid data loss, because it was already opened with WebSQL.' ) ; var u = r [ s ] ; return { name : u && "use_prefix" in u && ! u . use_prefix ? e : i + e , adapter : s } ; } ( ( t . prefix || "" ) + e , t ) ; if ( t . name = r . name , t . adapter = t . adapter || r . adapter , n . name = e , n . _adapter = t . adapter , tt . emit ( "debug" , [ "adapter" , "Picked adapter: " , t . adapter ] ) , ! tt . adapters [ t . adapter ] || ! tt . adapters [ t . adapter ] . valid ( ) ) throw new Error ( "Invalid Adapter: " + t . adapter ) ; Ze . call ( n ) , n . taskqueue = new et , n . adapter = t . adapter , tt . adapters [ t . adapter ] . call ( n , t , ( function ( e ) { if ( e ) return n . taskqueue . fail ( e ) ; ! function ( e ) { function t ( t ) { e . removeListener ( "closed" , n ) , t || e . constructor . emit ( "destroyed" , e . name ) ; } function n ( ) { e . removeListener ( "destroyed" , t ) , e . constructor . emit ( "unref" , e ) ; } e . once ( "destroyed" , t ) , e . once ( "closed" , n ) , e . constructor . emit ( "ref" , e ) ; } ( n ) , n . emit ( "created" , n ) , tt . emit ( "created" , n . name ) , n . taskqueue . ready ( n ) ; } ) ) ; } p ( ) ( Ge , y ( ) ) , Ge . prototype . cancel = function ( ) { this . isCancelled = ! 0 , this . db . taskqueue . isReady && this . emit ( "cancel" ) ; } , Ge . prototype . validateChanges = function ( e ) { var t = e . complete , n = this ; tt . _changesFilterPlugin ? tt . _changesFilterPlugin . validate ( e , ( function ( r ) { if ( r ) return t ( r ) ; n . doChanges ( e ) ; } ) ) : n . doChanges ( e ) ; } , Ge . prototype . doChanges = function ( e ) { var t = this , n = e . complete ; if ( "live" in ( e = O ( e ) ) && ! ( "continuous" in e ) && ( e . continuous = e . live ) , e . processChange = Qe , "latest" === e . since && ( e . since = "now" ) , e . since || ( e . since = 0 ) , "now" !== e . since ) { if ( tt . _changesFilterPlugin ) { if ( tt . _changesFilterPlugin . normalize ( e ) , tt . _changesFilterPlugin . shouldFilter ( this , e ) ) return tt . _changesFilterPlugin . filter ( this , e ) ; } else [ "doc_ids" , "filter" , "selector" , "view" ] . forEach ( ( function ( t ) { t in e && $ ( "warn" , 'The "' + t + '" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.' ) ; } ) ) ; "descending" in e || ( e . descending = ! 1 ) , e . limit = 0 === e . limit ? 1 : e . limit , e . complete = n ; var r = this . db . _changes ( e ) ; if ( r && "function" == typeof r . cancel ) { var o = t . cancel ; t . cancel = d ( ) ( ( function ( e ) { r . cancel ( ) , o . apply ( this , e ) ; } ) ) ; } } else this . db . info ( ) . then ( ( function ( r ) { t . isCancelled ? n ( null , { status : "cancelled" } ) : ( e . since = r . update_seq , t . doChanges ( e ) ) ; } ) , n ) ; } , p ( ) ( Ze , y ( ) ) , Ze . prototype . post = S ( "post" , ( function ( e , t , n ) { if ( "function" == typeof t && ( n = t , t = { } ) , "object" != typeof e || Array . isArray ( e ) ) return n ( ee ( Y ) ) ; this . bulkDocs ( { docs : [ e ] } , t , Ye ( n , e . _id ) ) ; } ) ) , Ze . prototype . put = S ( "put" , ( function ( e , t , n ) { if ( "function" == typeof t && ( n = t , t = { } ) , "object" != typeof e || Array . isArray ( e ) ) return n ( ee ( Y ) ) ; if ( oe ( e . _id ) , Ve ( e . _id ) && "function" == typeof this . _putLocal ) return e . _deleted ? this . _removeLocal ( e , n ) : this . _putLocal ( e , n ) ; var r , o , i , s , a = this ; function u ( n ) { "function" == typeof a . _put && ! 1 !== t . new_edits ? a . _put ( e , t , n ) : a . bulkDocs ( { docs : [ e ] } , t , Ye ( n , e . _id ) ) ; } t . force && e . _rev ? ( o = ( r = e . _rev . split ( "-" ) ) [ 1 ] , i = parseInt ( r [ 0 ] , 10 ) + 1 , s = Ee ( ) , e . _revisions = { start : i , ids : [ s , o ] } , e . _rev = i + "-" + s , t . new_edits = ! 1 , u ( ( function ( t ) { var r = t ? null : { ok : ! 0 , id : e . _id , rev : e . _rev } ; n ( t , r ) ; } ) ) ) : u ( n ) ; } ) ) , Ze . prototype . putAttachment = S ( "putAttachment" , ( function ( e , t , n , r , o ) { var i = this ; function s ( e ) { var n = "_rev" in e ? parseInt ( e . _rev , 10 ) : 0 ; return e . _attachments = e . _attachments || { } , e . _attachments [ t ] = { content_type : o , data : r , revpos : ++ n } , i . put ( e ) ; } return "function" == typeof o && ( o = r , r = n , n = null ) , void 0 === o && ( o = r , r = n , n = null ) , o || $ ( "warn" , "Attachment" , t , "on document" , e , "is missing content_type" ) , i . get ( e ) . then ( ( function ( e ) { if ( e . _rev !== n ) throw ee ( U ) ; return s ( e ) ; } ) , ( function ( t ) { if ( t . reason === N . message ) return s ( { _id : e } ) ; throw t ; } ) ) ; } ) ) , Ze . prototype . removeAttachment = S ( "removeAttachment" , ( function ( e , t , n , r ) { var o = this ; o . get ( e , ( function ( e , i ) { if ( e ) r ( e ) ; else if ( i . _rev === n ) { if ( ! i . _attachments ) return r ( ) ; delete i . _attachments [ t ] , 0 === Object . keys ( i . _attachments ) . length && delete i . _attachments , o . put ( i , r ) ; } else r ( ee ( U ) ) ; } ) ) ; } ) ) , Ze . prototype . remove = S ( "remove" , ( function ( e , t , n , r ) { var o ; "string" == typeof t ? ( o = { _id : e , _rev : t } , "function" == typeof n && ( r = n , n = { } ) ) : ( o = e , "function" == typeof t ? ( r = t , n = { } ) : ( r = n , n = t ) ) , ( n = n || { } ) . was_delete = ! 0 ; var i = { _id : o . _id , _rev : o . _rev || n . rev , _deleted : ! 0 } ; if ( Ve ( i . _id ) && "function" == typeof this . _removeLocal ) return this . _removeLocal ( o , r ) ; this . bulkDocs ( { docs : [ i ] } , n , Ye ( r , i . _id ) ) ; } ) ) , Ze . prototype . revsDiff = S ( "revsDiff" , ( function ( e , t , n ) { "function" == typeof t && ( n = t , t = { } ) ; var r = Object . keys ( e ) ; if ( ! r . length ) return n ( null , { } ) ; var o = 0 , i = new a ; function s ( e , t ) { i . has ( e ) || i . set ( e , { missing : [ ] } ) , i . get ( e ) . missing . push ( t ) ; } r . map ( ( function ( t ) { this . _getRevisionTree ( t , ( function ( a , u ) { if ( a && 404 === a . status && "missing" === a . message ) i . set ( t , { missing : e [ t ] } ) ; else { if ( a ) return n ( a ) ; ! function ( t , n ) { var r = e [ t ] . slice ( 0 ) ; Le ( n , ( function ( e , n , o , i , a ) { var u = n + "-" + o , c = r . indexOf ( u ) ; - 1 !== c && ( r . splice ( c , 1 ) , "available" !== a . status && s ( t , u ) ) ; } ) ) , r . forEach ( ( function ( e ) { s ( t , e ) ; } ) ) ; } ( t , u ) ; } if ( ++ o === r . length ) { var c = { } ; return i . forEach ( ( function ( e , t ) { c [ t ] = e ; } ) ) , n ( null , c ) ; } } ) ) ; } ) , this ) ; } ) ) , Ze . prototype . bulkGet = S ( "bulkGet" , ( function ( e , t ) { P ( this , e , t ) ; } ) ) , Ze . prototype . compactDocument = S ( "compactDocument" , ( function ( e , t , n ) { var r = this ; this . _getRevisionTree ( e , ( function ( o , i ) { if ( o ) return n ( o ) ; var s = function ( e ) { var t = { } , n = [ ] ; return Le ( e , ( function ( e , r , o , i ) { var s = r + "-" + o ; return e && ( t [ s ] = 0 ) , void 0 !== i && n . push ( { from : i , to : s } ) , s ; } ) ) , n . reverse ( ) , n . forEach ( ( function ( e ) { void 0 === t [ e . from ] ? t [ e . from ] = 1 + t [ e . to ] : t [ e . from ] = Math . min ( t [ e . from ] , 1 + t [ e . to ] ) ; } ) ) , t ; } ( i ) , a = [ ] , u = [ ] ; Object . keys ( s ) . forEach ( ( function ( e ) { s [ e ] > t && a . push ( e ) ; } ) ) , Le ( i , ( function ( e , t , n , r , o ) { var i = t + "-" + n ; "available" === o . status && - 1 !== a . indexOf ( i ) && u . push ( i ) ; } ) ) , r . _doCompaction ( e , u , n ) ; } ) ) ; } ) ) , Ze . prototype . compact = S ( "compact" , ( function ( e , t ) { "function" == typeof e && ( t = e , e = { } ) ; var n = this ; e = e || { } , n . _compactionQueue = n . _compactionQueue || [ ] , n . _compactionQueue . push ( { opts : e , callback : t } ) , 1 === n . _compactionQueue . length && Xe ( n ) ; } ) ) , Ze . prototype . _compact = function ( e , t ) { var n = this , r = { return_docs : ! 1 , last_seq : e . last_seq || 0 } , o = [ ] ; n . changes ( r ) . on ( "change" , ( function ( e ) { o . push ( n . compactDocument ( e . id , 0 ) ) ; } ) ) . on ( "complete" , ( function ( e ) { var r = e . last_seq ; Promise . all ( o ) . then ( ( function ( ) { return pe ( n , "_local/compaction" , ( function ( e ) { return ( ! e . last_seq || e . last_seq < r ) && ( e . last_seq = r , e ) ; } ) ) ; } ) ) . then ( ( function ( ) { t ( null , { ok : ! 0 } ) ; } ) ) . catch ( t ) ; } ) ) . on ( "error" , t ) ; } , Ze . prototype . get = S ( "get" , ( function ( e , t , n ) { if ( "function" == typeof t && ( n = t , t = { } ) , "string" != typeof e ) return n ( ee ( F ) ) ; if ( Ve ( e ) && "function" == typeof this . _getLocal ) return this . _getLocal ( e , n ) ; var r = [ ] , o = this ; function i ( ) { var i = [ ] , s = r . length ; if ( ! s ) return n ( null , i ) ; r . forEach ( ( function ( r ) { o . get ( e , { rev : r , revs : t . revs , latest : t . latest , attachments : t . attachments , binary : t . binary } , ( function ( e , t ) { if ( e ) i . push ( { missing : r } ) ; else { for ( var o , a = 0 , u = i . length ; a < u ; a ++ ) if ( i [ a ] . ok && i [ a ] . ok . _rev === t . _rev ) { o = ! 0 ; break ; } o || i . push ( { ok : t } ) ; } -- s || n ( null , i ) ; } ) ) ; } ) ) ; } if ( ! t . open_revs ) return this . _get ( e , t , ( function ( r , i ) { if ( r ) return r . docId = e , n ( r ) ; var s = i . doc , a = i . metadata , u = i . ctx ; if ( t . conflicts ) { var c = Ie ( a ) ; c . length && ( s . _conflicts = c ) ; } if ( ze ( a , s . _rev ) && ( s . _deleted = ! 0 ) , t . revs || t . revs_info ) { for ( var f = s . _rev . split ( "-" ) , l = parseInt ( f [ 0 ] , 10 ) , d = f [ 1 ] , h = Be ( a . rev_tree ) , p = null , v = 0 ; v < h . length ; v ++ ) { var y = h [ v ] , _ = y . ids . map ( ( function ( e ) { return e . id ; } ) ) . indexOf ( d ) ; ( _ === l - 1 || ! p && - 1 !== _ ) && ( p = y ) ; } if ( ! p ) return ( r = new Error ( "invalid rev tree" ) ) . docId = e , n ( r ) ; var g = p . ids . map ( ( function ( e ) { return e . id ; } ) ) . indexOf ( s . _rev . split ( "-" ) [ 1 ] ) + 1 , m = p . ids . length - g ; if ( p . ids . splice ( g , m ) , p . ids . reverse ( ) , t . revs && ( s . _revisions = { start : p . pos + p . ids . length - 1 , ids : p . ids . map ( ( function ( e ) { return e . id ; } ) ) } ) , t . revs_info ) { var b = p . pos + p . ids . length ; s . _revs_info = p . ids . map ( ( function ( e ) { return { rev : -- b + "-" + e . id , status : e . opts . status } ; } ) ) ; } } if ( t . attachments && s . _attachments ) { var w = s . _attachments , k = Object . keys ( w ) . length ; if ( 0 === k ) return n ( null , s ) ; Object . keys ( w ) . forEach ( ( function ( e ) { this . _getAttachment ( s . _id , e , w [ e ] , { rev : s . _rev , binary : t . binary , ctx : u } , ( function ( t , r ) { var o = s . _attachments [ e ] ; o . data = r , delete o . stub , delete o . length , -- k || n ( null , s ) ; } ) ) ; } ) , o ) ; } else { if ( s . _attachments ) for ( var j in s . _attachments ) s . _attachments . hasOwnProperty ( j ) && ( s . _attachments [ j ] . stub = ! 0 ) ; n ( null , s ) ; } } ) ) ; if ( "all" === t . open_revs ) this . _getRevisionTree ( e , ( function ( e , t ) { if ( e ) return n ( e ) ; r = $e ( t ) . map ( ( function ( e ) { return e . rev ; } ) ) , i ( ) ; } ) ) ; else { if ( ! Array . isArray ( t . open_revs ) ) return n ( ee ( z , "function_clause" ) ) ; r = t . open_revs ; for ( var s = 0 ; s < r . length ; s ++ ) { var a = r [ s ] ; if ( "string" != typeof a || ! /^\d+-/ . test ( a ) ) return n ( ee ( X ) ) ; } i ( ) ; } } ) ) , Ze . prototype . getAttachment = S ( "getAttachment" , ( function ( e , t , n , r ) { var o = this ; n instanceof Function && ( r = n , n = { } ) , this . _get ( e , n , ( function ( i , s ) { return i ? r ( i ) : s . doc . _attachments && s . doc . _attachments [ t ] ? ( n . ctx = s . ctx , n . binary = ! 0 , void o . _getAttachment ( e , t , s . doc . _attachments [ t ] , n , r ) ) : r ( ee ( N ) ) ; } ) ) ; } ) ) , Ze . prototype . allDocs = S ( "allDocs" , ( function ( e , t ) { if ( "function" == typeof e && ( t = e , e = { } ) , e . skip = void 0 !== e . skip ? e . skip : 0 , e . start_key && ( e . startkey = e . start_key ) , e . end_key && ( e . endkey = e . end_key ) , "keys" in e ) { if ( ! Array . isArray ( e . keys ) ) return t ( new TypeError ( "options.keys must be an array" ) ) ; var n = [ "startkey" , "endkey" , "key" ] . filter ( ( function ( t ) { return t in e ; } ) ) [ 0 ] ; if ( n ) return void t ( ee ( G , "Query parameter `" + n + "` is not compatible with multi-get" ) ) ; if ( ! ie ( this ) && ( function ( e ) { var t = "limit" in e ? e . keys . slice ( e . skip , e . limit + e . skip ) : e . skip > 0 ? e . keys . slice ( e . skip ) : e . keys ; e . keys = t , e . skip = 0 , delete e . limit , e . descending && ( t . reverse ( ) , e . descending = ! 1 ) ; } ( e ) , 0 === e . keys . length ) ) return this . _allDocs ( { limit : 0 } , t ) ; } return this . _allDocs ( e , t ) ; } ) ) , Ze . prototype . changes = function ( e , t ) { return "function" == typeof e && ( t = e , e = { } ) , ( e = e || { } ) . return_docs = "return_docs" in e ? e . return_docs : ! e . live , new Ge ( this , e , t ) ; } , Ze . prototype . close = S ( "close" , ( function ( e ) { return this . _closed = ! 0 , this . emit ( "closed" ) , this . _close ( e ) ; } ) ) , Ze . prototype . info = S ( "info" , ( function ( e ) { var t = this ; this . _info ( ( function ( n , r ) { if ( n ) return e ( n ) ; r . db_name = r . db_name || t . name , r . auto_compaction = ! ( ! t . auto_compaction || ie ( t ) ) , r . adapter = t . adapter , e ( null , r ) ; } ) ) ; } ) ) , Ze . prototype . id = S ( "id" , ( function ( e ) { return this . _id ( e ) ; } ) ) , Ze . prototype . type = function ( ) { return "function" == typeof this . _type ? this . _type ( ) : this . adapter ; } , Ze . prototype . bulkDocs = S ( "bulkDocs" , ( function ( e , t , n ) { if ( "function" == typeof t && ( n = t , t = { } ) , t = t || { } , Array . isArray ( e ) && ( e = { docs : e } ) , ! e || ! e . docs || ! Array . isArray ( e . docs ) ) return n ( ee ( M ) ) ; for ( var r = 0 ; r < e . docs . length ; ++ r ) if ( "object" != typeof e . docs [ r ] || Array . isArray ( e . docs [ r ] ) ) return n ( ee ( Y ) ) ; var o ; if ( e . docs . forEach ( ( function ( e ) { e . _attachments && Object . keys ( e . _attachments ) . forEach ( ( function ( t ) { o = o || function ( e ) { return "_" === e . charAt ( 0 ) && e + " is not a valid attachment name, attachment names cannot start with '_'" ; } ( t ) , e . _attachments [ t ] . content_type || $ ( "warn" , "Attachment" , t , "on document" , e . _id , "is missing content_type" ) ; } ) ) ; } ) ) , o ) return n ( ee ( W , o ) ) ; "new_edits" in t || ( t . new_edits = ! ( "new_edits" in e ) || e . new_edits ) ; var i = this ; t . new_edits || ie ( i ) || e . docs . sort ( He ) , function ( e ) { for ( var t = 0 ; t < e . length ; t ++ ) { var n = e [ t ] ; if ( n . _deleted ) delete n . _attachments ; else if ( n . _attachments ) for ( var r = Object . keys ( n . _attachments ) , o = 0 ; o < r . length ; o ++ ) { var i = r [ o ] ; n . _attachments [ i ] = x ( n . _attachments [ i ] , [ "data" , "digest" , "content_type" , "length" , "revpos" , "stub" ] ) ; } } } ( e . docs ) ; var s = e . docs . map ( ( function ( e ) { return e . _id ; } ) ) ; return this . _bulkDocs ( e , t , ( function ( e , r ) { if ( e ) return n ( e ) ; if ( t . new_edits || ( r = r . filter ( ( function ( e ) { return e . error ; } ) ) ) , ! ie ( i ) ) for ( var o = 0 , a = r . length ; o < a ; o ++ ) r [ o ] . id = r [ o ] . id || s [ o ] ; n ( null , r ) ; } ) ) ; } ) ) , Ze . prototype . registerDependentDatabase = S ( "registerDependentDatabase" , ( function ( e , t ) { var n = new this . constructor ( e , this . __opts ) ; pe ( this , "_local/_pouch_dependentDbs" , ( function ( t ) { return t . dependentDbs = t . dependentDbs || { } , ! t . dependentDbs [ e ] && ( t . dependentDbs [ e ] = ! 0 , t ) ; } ) ) . then ( ( function ( ) { t ( null , { db : n } ) ; } ) ) . catch ( t ) ; } ) ) , Ze . prototype . destroy = S ( "destroy" , ( function ( e , t ) { "function" == typeof e && ( t = e , e = { } ) ; var n = this , r = ! ( "use_prefix" in n ) || n . use_prefix ; function o ( ) { n . _destroy ( e , ( function ( e , r ) { if ( e ) return t ( e ) ; n . _destroyed = ! 0 , n . emit ( "destroyed" ) , t ( null , r || { ok : ! 0 } ) ; } ) ) ; } if ( ie ( n ) ) return o ( ) ; n . get ( "_local/_pouch_dependentDbs" , ( function ( e , i ) { if ( e ) return 404 !== e . status ? t ( e ) : o ( ) ; var s = i . dependentDbs , a = n . constructor , u = Object . keys ( s ) . map ( ( function ( e ) { var t = r ? e . replace ( new RegExp ( "^" + a . prefix ) , "" ) : e ; return new a ( t , n . __opts ) . destroy ( ) ; } ) ) ; Promise . all ( u ) . then ( o , t ) ; } ) ) ; } ) ) , et . prototype . execute = function ( ) { var e ; if ( this . failed ) for ( ; e = this . queue . shift ( ) ; ) e ( this . failed ) ; else for ( ; e = this . queue . shift ( ) ; ) e ( ) ; } , et . prototype . fail = function ( e ) { this . failed = e , this . execute ( ) ; } , et . prototype . ready = function ( e ) { this . isReady = ! 0 , this . db = e , this . execute ( ) ; } , et . prototype . addTask = function ( e ) { this . queue . push ( e ) , this . failed && this . execute ( ) ; } , p ( ) ( tt , Ze ) ; var nt = "undefined" != typeof AbortController ? AbortController : function ( ) { return { abort : function ( ) { } } ; } , rt = fetch , ot = Headers ; tt . adapters = { } , tt . preferredAdapters = [ ] , tt . prefix = "_pouch_" ; var it = new ( y ( ) ) ; function st ( e , t ) { for ( var n = e , r = 0 , o = t . length ; r < o && ( n = n [ t [ r ] ] ) ; r ++ ) ; return n ; } function at ( e ) { for ( var t = [ ] , n = "" , r = 0 , o = e . length ; r < o ; r ++ ) { var i = e [ r ] ; "." === i ? r > 0 && "\\" === e [ r - 1 ] ? n = n . substring ( 0 , n . length - 1 ) + "." : ( t . push ( n ) , n = "" ) : n += i ; } return t . push ( n ) , t ; } ! function ( e ) { Object . keys ( y ( ) . prototype ) . forEach ( ( function ( t ) { "function" == typeof y ( ) . prototype [ t ] && ( e [ t ] = it [ t ] . bind ( it ) ) ; } ) ) ; var t = e . _destructionListeners = new a ; e . on ( "ref" , ( function ( e ) { t . has ( e . name ) || t . set ( e . name , [ ] ) , t . get ( e . name ) . push ( e ) ; } ) ) , e . on ( "unref" , ( function ( e ) { if ( t . has ( e . name ) ) { var n = t . get ( e . name ) , r = n . indexOf ( e ) ; r < 0 || ( n . splice ( r , 1 ) , n . length > 1 ? t . set ( e . name , n ) : t . delete ( e . name ) ) ; } } ) ) , e . on ( "destroyed" , ( function ( e ) { if ( t . has ( e ) ) { var n = t . get ( e ) ; t . delete ( e ) , n . forEach ( ( function ( e ) { e . emit ( "destroyed" , ! 0 ) ; } ) ) ; } } ) ) ; } ( tt ) , tt . adapter = function ( e , t , n ) { t . valid ( ) && ( tt . adapters [ e ] = t , n && tt . preferredAdapters . push ( e ) ) ; } , tt . plugin = function ( e ) { if ( "function" == typeof e ) e ( tt ) ; else { if ( "object" != typeof e || 0 === Object . keys ( e ) . length ) throw new Error ( 'Invalid plugin: got "' + e + '", expected an object or a function' ) ; Object . keys ( e ) . forEach ( ( function ( t ) { tt . prototype [ t ] = e [ t ] ; } ) ) ; } return this . __defaults && ( tt . __defaults = R ( { } , this . __defaults ) ) , tt ; } , tt . defaults = function ( e ) { function t ( e , n ) { if ( ! ( this instanceof t ) ) return new t ( e , n ) ; n = n || { } , e && "object" == typeof e && ( e = ( n = e ) . name , delete n . name ) , n = R ( { } , t . __defaults , n ) , tt . call ( this , e , n ) ; } return p ( ) ( t , tt ) , t . preferredAdapters = tt . preferredAdapters . slice ( ) , Object . keys ( tt ) . forEach ( ( function ( e ) { e in t || ( t [ e ] = tt [ e ] ) ; } ) ) , t . __defaults = R ( { } , this . __defaults , e ) , t ; } , tt . fetch = function ( e , t ) { return rt ( e , t ) ; } ; var ut = [ "$or" , "$nor" , "$not" ] ; function ct ( e ) { return ut . indexOf ( e ) > - 1 ; } function ft ( e ) { return Object . keys ( e ) [ 0 ] ; } function lt ( e ) { var t = { } ; return e . forEach ( ( function ( e ) { Object . keys ( e ) . forEach ( ( function ( n ) { var r = e [ n ] ; if ( "object" != typeof r && ( r = { $eq : r } ) , ct ( n ) ) t [ n ] = r instanceof Array ? r . map ( ( function ( e ) { return lt ( [ e ] ) ; } ) ) : lt ( [ r ] ) ; else { var o = t [ n ] = t [ n ] || { } ; Object . keys ( r ) . forEach ( ( function ( e ) { var t = r [ e ] ; return "$gt" === e || "$gte" === e ? function ( e , t , n ) { void 0 === n . $eq && ( void 0 !== n . $gte ? "$gte" === e ? t > n . $gte && ( n . $gte = t ) : t >= n . $gte && ( delete n . $gte , n . $gt = t ) : void 0 !== n . $gt ? "$gte" === e ? t > n . $gt && ( delete n . $gt , n . $gte = t ) : t > n . $gt && ( n . $gt = t ) : n [ e ] = t ) ; } ( e , t , o ) : "$lt" === e || "$lte" === e ? function ( e , t , n ) { void 0 === n . $eq && ( void 0 !== n . $lte ? "$lte" === e ? t < n . $lte && ( n . $lte = t ) : t <= n . $lte && ( delete n . $lte , n . $lt = t ) : void 0 !== n . $lt ? "$lte" === e ? t < n . $lt && ( delete n . $lt , n . $lte = t ) : t < n . $lt && ( n . $lt = t ) : n [ e ] = t ) ; } ( e , t , o ) : "$ne" === e ? function ( e , t ) { "$ne" in t ? t . $ne . push ( e ) : t . $ne = [ e ] ; } ( t , o ) : "$eq" === e ? function ( e , t ) { delete t . $gt , delete t . $gte , delete t . $lt , delete t . $lte , delete t . $ne , t . $eq = e ; } ( t , o ) : void ( o [ e ] = t ) ; } ) ) ; } } ) ) ; } ) ) , t ; } function dt ( e ) { for ( var t in e ) { if ( Array . isArray ( e ) ) for ( var n in e ) e [ n ] . $and && ( e [ n ] = lt ( e [ n ] . $and ) ) ; var r = e [ t ] ; "object" == typeof r && dt ( r ) ; } return e ; } function ht ( e , t ) { for ( var n in e ) { "$and" === n && ( t = ! 0 ) ; var r = e [ n ] ; "object" == typeof r && ( t = ht ( r , t ) ) ; } return t ; } function pt ( e ) { var t = O ( e ) , n = ! 1 ; ht ( t , ! 1 ) && ( "$and" in ( t = dt ( t ) ) && ( t = lt ( t . $and ) ) , n = ! 0 ) , [ "$or" , "$nor" ] . forEach ( ( function ( e ) { e in t && t [ e ] . forEach ( ( function ( e ) { for ( var t = Object . keys ( e ) , n = 0 ; n < t . length ; n ++ ) { var r = t [ n ] , o = e [ r ] ; "object" == typeof o && null !== o || ( e [ r ] = { $eq : o } ) ; } } ) ) ; } ) ) , "$not" in t && ( t . $not = lt ( [ t . $not ] ) ) ; for ( var r = Object . keys ( t ) , o = 0 ; o < r . length ; o ++ ) { var i = r [ o ] , s = t [ i ] ; "object" != typeof s || null === s ? s = { $eq : s } : "$ne" in s && ! n && ( s . $ne = [ s . $ne ] ) , t [ i ] = s ; } return t ; } function vt ( e , t ) { if ( e === t ) return 0 ; e = yt ( e ) , t = yt ( t ) ; var n = bt ( e ) , r = bt ( t ) ; if ( n - r != 0 ) return n - r ; switch ( typeof e ) { case "number" : return e - t ; case "boolean" : return e < t ? - 1 : 1 ; case "string" : return function ( e , t ) { return e === t ? 0 : e > t ? 1 : - 1 ; } ( e , t ) ; } return Array . isArray ( e ) ? function ( e , t ) { for ( var n = Math . min ( e . length , t . length ) , r = 0 ; r < n ; r ++ ) { var o = vt ( e [ r ] , t [ r ] ) ; if ( 0 !== o ) return o ; } return e . length === t . length ? 0 : e . length > t . length ? 1 : - 1 ; } ( e , t ) : function ( e , t ) { for ( var n = Object . keys ( e ) , r = Object . keys ( t ) , o = Math . min ( n . length , r . length ) , i = 0 ; i < o ; i ++ ) { var s = vt ( n [ i ] , r [ i ] ) ; if ( 0 !== s ) return s ; if ( 0 !== ( s = vt ( e [ n [ i ] ] , t [ r [ i ] ] ) ) ) return s ; } return n . length === r . length ? 0 : n . length > r . length ? 1 : - 1 ; } ( e , t ) ; } function yt ( e ) { switch ( typeof e ) { case "undefined" : return null ; case "number" : return e === 1 / 0 || e === - 1 / 0 || isNaN ( e ) ? null : e ; case "object" : var t = e ; if ( Array . isArray ( e ) ) { var n = e . length ; e = new Array ( n ) ; for ( var r = 0 ; r < n ; r ++ ) e [ r ] = yt ( t [ r ] ) ; } else { if ( e instanceof Date ) return e . toJSON ( ) ; if ( null !== e ) for ( var o in e = { } , t ) if ( t . hasOwnProperty ( o ) ) { var i = t [ o ] ; void 0 !== i && ( e [ o ] = yt ( i ) ) ; } } } return e ; } function _t ( e ) { return bt ( e = yt ( e ) ) + "" + function ( e ) { if ( null !== e ) switch ( typeof e ) { case "boolean" : return e ? 1 : 0 ; case "number" : return function ( e ) { if ( 0 === e ) return "1" ; var t , n = e . toExponential ( ) . split ( /e\+?/ ) , r = parseInt ( n [ 1 ] , 10 ) , o = e < 0 , i = o ? "0" : "2" ; i += "" + ( function ( e , t , n ) { for ( var r = "" , o = 3 - e . length ; r . length < o ; ) r += "0" ; return r ; } ( t = ( ( o ? - r : r ) - - 324 ) . toString ( ) ) + t ) ; var s = Math . abs ( parseFloat ( n [ 0 ] ) ) ; o && ( s = 10 - s ) ; var a = s . toFixed ( 20 ) ; return i + "" + a . replace ( /\.?0+$/ , "" ) ; } ( e ) ; case "string" : return e . replace ( /\u0002/g , "" ) . replace ( /\u0001/g , "" ) . replace ( /\u0000/g , "" ) ; case "object" : var t = Array . isArray ( e ) , n = t ? e : Object . keys ( e ) , r = - 1 , o = n . length , i = "" ; if ( t ) for ( ; ++ r < o ; ) i += _t ( n [ r ] ) ; else for ( ; ++ r < o ; ) { var s = n [ r ] ; i += _t ( s ) + _t ( e [ s ] ) ; } return i ; } return "" ; } ( e ) + "\0" ; } function gt ( e , t ) { var n , r = t ; if ( "1" === e [ t ] ) n = 0 , t ++ ; else { var o = "0" === e [ t ] ; t ++ ; var i = "" , s = e . substring ( t , t + 3 ) , a = parseInt ( s , 10 ) + - 324 ; for ( o && ( a = - a ) , t += 3 ; ; ) { var u = e [ t ] ; if ( "\0" === u ) break ; i += u , t ++ ; } n = 1 === ( i = i . split ( "." ) ) . length ? parseInt ( i , 10 ) : parseFloat ( i [ 0 ] + "." + i [ 1 ] ) , o && ( n -= 10 ) , 0 !== a && ( n = parseFloat ( n + "e" + a ) ) ; } return { num : n , length : t - r } ; } function mt ( e , t ) { var n = e . pop ( ) ; if ( t . length ) { var r = t [ t . length - 1 ] ; n === r . element && ( t . pop ( ) , r = t [ t . length - 1 ] ) ; var o = r . element , i = r . index ; Array . isArray ( o ) ? o . push ( n ) : i === e . length - 2 ? o [ e . pop ( ) ] = n : e . push ( n ) ; } } function bt ( e ) { var t = [ "boolean" , "number" , "string" , "object" ] . indexOf ( typeof e ) ; return ~ t ? null === e ? 1 : Array . isArray ( e ) ? 5 : t < 3 ? t + 2 : t + 3 : Array . isArray ( e ) ? 5 : void 0 ; } function wt ( e , t , n ) { return n . every ( ( function ( n ) { var r = t [ n ] , o = at ( n ) , i = st ( e , o ) ; return ct ( n ) ? function ( e , t , n ) { return "$or" === e ? t . some ( ( function ( e ) { return wt ( n , e , Object . keys ( e ) ) ; } ) ) : "$not" === e ? ! wt ( n , t , Object . keys ( t ) ) : ! t . find ( ( function ( e ) { return wt ( n , e , Object . keys ( e ) ) ; } ) ) ; } ( n , r , e ) : kt ( r , e , o , i ) ; } ) ) ; } function kt ( e , t , n , r ) { return ! e || ( "object" == typeof e ? Object . keys ( e ) . every ( ( function ( o ) { var i = e [ o ] ; return function ( e , t , n , r , o ) { if ( ! qt [ e ] ) throw new Error ( 'unknown operator "' + e + '" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all' ) ; return qt [ e ] ( t , n , r , o ) ; } ( o , t , i , n , r ) ; } ) ) : e === r ) ; } function jt ( e ) { return null != e ; } function Ot ( e ) { return void 0 !== e ; } function At ( e , t ) { return t . some ( ( function ( t ) { return e instanceof Array ? e . indexOf ( t ) > - 1 : e === t ; } ) ) ; } var qt = { $elemMatch : function ( e , t , n , r ) { return ! ! Array . isArray ( r ) && 0 !== r . length && ( "object" == typeof r [ 0 ] ? r . some ( ( function ( e ) { return wt ( e , t , Object . keys ( t ) ) ; } ) ) : r . some ( ( function ( r ) { return kt ( t , e , n , r ) ; } ) ) ) ; } , $allMatch : function ( e , t , n , r ) { return ! ! Array . isArray ( r ) && 0 !== r . length && ( "object" == typeof r [ 0 ] ? r . every ( ( function ( e ) { return wt ( e , t , Object . keys ( t ) ) ; } ) ) : r . every ( ( function ( r ) { return kt ( t , e , n , r ) ; } ) ) ) ; } , $eq : function ( e , t , n , r ) { return Ot ( r ) && 0 === vt ( r , t ) ; } , $gte : function ( e , t , n , r ) { return Ot ( r ) && vt ( r , t ) >= 0 ; } , $gt : function ( e , t , n , r ) { return Ot ( r ) && vt ( r , t ) > 0 ; } , $lte : function ( e , t , n , r ) { return Ot ( r ) && vt ( r , t ) <= 0 ; } , $lt : function ( e , t , n , r ) { return Ot ( r ) && vt ( r , t ) < 0 ; } , $exists : function ( e , t , n , r ) { return t ? Ot ( r ) : ! Ot ( r ) ; } , $mod : function ( e , t , n , r ) { return jt ( r ) && function ( e , t ) { var n = t [ 0 ] , r = t [ 1 ] ; if ( 0 === n ) throw new Error ( "Bad divisor, cannot divide by zero" ) ; if ( parseInt ( n , 10 ) !== n ) throw new Error ( "Divisor is not an integer" ) ; if ( parseInt ( r , 10 ) !== r ) throw new Error ( "Modulus is not an integer" ) ; return parseInt ( e , 10 ) === e && e % n === r ; } ( r , t ) ; } , $ne : function ( e , t , n , r ) { return t . every ( ( function ( e ) { return 0 !== vt ( r , e ) ; } ) ) ; } , $in : function ( e , t , n , r ) { return jt ( r ) && At ( r , t ) ; } , $nin : function ( e , t , n , r ) { return jt ( r ) && ! At ( r , t ) ; } , $size : function ( e , t , n , r ) { return jt ( r ) && function ( e , t ) { return e . length === t ; } ( r , t ) ; } , $all : function ( e , t , n , r ) { return Array . isArray ( r ) && function ( e , t ) { return t . every ( ( function ( t ) { return e . indexOf ( t ) > - 1 ; } ) ) ; } ( r , t ) ; } , $regex : function ( e , t , n , r ) { return jt ( r ) && function ( e , t ) { return new RegExp ( t ) . test ( e ) ; } ( r , t ) ; } , $type : function ( e , t , n , r ) { return function ( e , t ) { switch ( t ) { case "null" : return null === e ; case "boolean" : return "boolean" == typeof e ; case "number" : return "number" == typeof e ; case "string" : return "string" == typeof e ; case "array" : return e instanceof Array ; case "object" : return "[object Object]" === { } . toString . call ( e ) ; } throw new Error ( t + " not supported as a type.Please use one of object, string, array, number, boolean or null." ) ; } ( r , t ) ; } } ; function St ( e , t ) { if ( e . selector && e . filter && "_selector" !== e . filter ) { var n = "string" == typeof e . filter ? e . filter : "function" ; return t ( new Error ( 'selector invalid for filter "' + n + '"' ) ) ; } t ( ) ; } function xt ( e ) { e . view && ! e . filter && ( e . filter = "_view" ) , e . selector && ! e . filter && ( e . filter = "_selector" ) , e . filter && "string" == typeof e . filter && ( "_view" === e . filter ? e . view = ae ( e . view ) : e . filter = ae ( e . filter ) ) ; } function Et ( e , t ) { return t . filter && "string" == typeof t . filter && ! t . doc_ids && ! ie ( e . db ) ; } function Ct ( e , t ) { var n = t . complete ; if ( "_view" === t . filter ) { if ( ! t . view || "string" != typeof t . view ) { var r = ee ( W , "`view` filter parameter not found or invalid." ) ; return n ( r ) ; } var o = se ( t . view ) ; e . db . get ( "_design/" + o [ 0 ] , ( function ( r , i ) { if ( e . isCancelled ) return n ( null , { status : "cancelled" } ) ; if ( r ) return n ( te ( r ) ) ; var s = i && i . views && i . views [ o [ 1 ] ] && i . views [ o [ 1 ] ] . map ; if ( ! s ) return n ( ee ( N , i . views ? "missing json key: " + o [ 1 ] : "missing json key: views" ) ) ; t . filter = he ( [ "return function(doc) {" , '  "use strict";' , "  var emitted = false;" , "  var emit = function (a, b) {" , "    emitted = true;" , "  };" , "  var view = " + s + ";" , "  view(doc);" , "  if (emitted) {" , "    return true;" , "  }" , "};" ] . join ( "\n" ) , { } ) , e . doChanges ( t ) ; } ) ) ; } else if ( t . selector ) t . filter = function ( e ) { return function ( e , t ) { if ( "object" != typeof t ) throw new Error ( "Selector error: expected a JSON object" ) ; var n = function ( e , t , n ) { if ( e = e . filter ( ( function ( e ) { return wt ( e . doc , t . selector , n ) ; } ) ) , t . sort ) { var r = function ( e ) { function t ( t ) { return e . map ( ( function ( e ) { var n = at ( ft ( e ) ) ; return st ( t , n ) ; } ) ) ; } return function ( e , n ) { var r , o , i = vt ( t ( e . doc ) , t ( n . doc ) ) ; return 0 !== i ? i : ( r = e . doc . _id ) < ( o = n . doc . _id ) ? - 1 : r > o ? 1 : 0 ; } ; } ( t . sort ) ; e = e . sort ( r ) , "string" != typeof t . sort [ 0 ] && "desc" === ( o = t . sort [ 0 ] ) [ ft ( o ) ] && ( e = e . reverse ( ) ) ; } var o ; if ( "limit" in t || "skip" in t ) { var i = t . skip || 0 , s = ( "limit" in t ? t . limit : e . length ) + i ; e = e . slice ( i , s ) ; } return e ; } ( [ { doc : e } ] , { selector : t = pt ( t ) } , Object . keys ( t ) ) ; return n && 1 === n . length ; } ( e , t . selector ) ; } , e . doChanges ( t ) ; else { var i = se ( t . filter ) ; e . db . get ( "_design/" + i [ 0 ] , ( function ( r , o ) { if ( e . isCancelled ) return n ( null , { status : "cancelled" } ) ; if ( r ) return n ( te ( r ) ) ; var s = o && o . filters && o . filters [ i [ 1 ] ] ; if ( ! s ) return n ( ee ( N , o && o . filters ? "missing json key: " + i [ 1 ] : "missing json key: filters" ) ) ; t . filter = he ( '"use strict";\nreturn ' + s + ";" , { } ) , e . doChanges ( t ) ; } ) ) ; } } function Pt ( e ) { return e . reduce ( ( function ( e , t ) { return e [ t ] = ! 0 , e ; } ) , { } ) ; } tt . plugin ( ( function ( e ) { e . _changesFilterPlugin = { validate : St , normalize : xt , shouldFilter : Et , filter : Ct } ; } ) ) , tt . version = "7.2.2" ; var Lt = Pt ( [ "_id" , "_rev" , "_attachments" , "_deleted" , "_revisions" , "_revs_info" , "_conflicts" , "_deleted_conflicts" , "_local_seq" , "_rev_tree" , "_replication_id" , "_replication_state" , "_replication_state_time" , "_replication_state_reason" , "_replication_stats" , "_removed" ] ) , Dt = Pt ( [ "_attachments" , "_replication_id" , "_replication_state" , "_replication_state_time" , "_replication_state_reason" , "_replication_stats" ] ) ; function $t ( e ) { if ( ! /^\d+-/ . test ( e ) ) return ee ( X ) ; var t = e . indexOf ( "-" ) , n = e . substring ( 0 , t ) , r = e . substring ( t + 1 ) ; return { prefix : parseInt ( n , 10 ) , id : r } ; } function It ( e , t , n ) { var r , o , i ; n || ( n = { deterministic_revs : ! 0 } ) ; var s = { status : "available" } ; if ( e . _deleted && ( s . deleted = ! 0 ) , t ) if ( e . _id || ( e . _id = Ce ( ) ) , o = Ee ( e , n . deterministic_revs ) , e . _rev ) { if ( ( i = $t ( e . _rev ) ) . error ) return i ; e . _rev_tree = [ { pos : i . prefix , ids : [ i . id , { status : "missing" } , [ [ o , s , [ ] ] ] ] } ] , r = i . prefix + 1 ; } else e . _rev_tree = [ { pos : 1 , ids : [ o , s , [ ] ] } ] , r = 1 ; else if ( e . _revisions && ( e . _rev_tree = function ( e , t ) { for ( var n = e . start - e . ids . length + 1 , r = e . ids , o = [ r [ 0 ] , t , [ ] ] , i = 1 , s = r . length ; i < s ; i ++ ) o = [ r [ i ] , { status : "missing" } , [ o ] ] ; return [ { pos : n , ids : o } ] ; } ( e . _revisions , s ) , r = e . _revisions . start , o = e . _revisions . ids [ 0 ] ) , ! e . _rev_tree ) { if ( ( i = $t ( e . _rev ) ) . error ) return i ; r = i . prefix , o = i . id , e . _rev_tree = [ { pos : r , ids : [ o , s , [ ] ] } ] ; } oe ( e . _id ) , e . _rev = r + "-" + o ; var a = { metadata : { } , data : { } } ; for ( var u in e ) if ( Object . prototype . hasOwnProperty . call ( e , u ) ) { var c = "_" === u [ 0 ] ; if ( c && ! Lt [ u ] ) { var f = ee ( Q , u ) ; throw f . message = Q . message + ": " + u , f ; } c && ! Dt [ u ] ? a . metadata [ u . slice ( 1 ) ] = e [ u ] : a . data [ u ] = e [ u ] ; } return a ; } function Bt ( e , t , n ) { if ( e . stub ) return n ( ) ; "string" == typeof e . data ? function ( e , t , n ) { var r = function ( e ) { try { return ve ( e ) ; } catch ( e ) { return { error : ee ( V , "Attachment is not a valid base64 string" ) } ; } } ( e . data ) ; if ( r . error ) return n ( r . error ) ; e . length = r . length , e . data = "blob" === t ? me ( r , e . content_type ) : "base64" === t ? ye ( r ) : r , Se ( r , ( function ( t ) { e . digest = "md5-" + t , n ( ) ; } ) ) ; } ( e , t , n ) : function ( e , t , n ) { Se ( e . data , ( function ( r ) { e . digest = "md5-" + r , e . length = e . data . size || e . data . length || 0 , "binary" === t ? ke ( e . data , ( function ( t ) { e . data = t , n ( ) ; } ) ) : "base64" === t ? je ( e . data , ( function ( t ) { e . data = t , n ( ) ; } ) ) : n ( ) ; } ) ) ; } ( e , t , n ) ; } function Rt ( e , t , n , r , o , i , s , u , c ) { e = e || 1e3 ; var f = u . new_edits , l = new a , d = 0 , h = t . length ; function p ( ) { ++ d === h && c && c ( ) ; } t . forEach ( ( function ( e , t ) { if ( e . _id && Ve ( e . _id ) ) { var r = e . _deleted ? "_removeLocal" : "_putLocal" ; n [ r ] ( e , { ctx : o } , ( function ( e , n ) { i [ t ] = e || n , p ( ) ; } ) ) ; } else { var s = e . metadata . id ; l . has ( s ) ? ( h -- , l . get ( s ) . push ( [ e , t ] ) ) : l . set ( s , [ [ e , t ] ] ) ; } } ) ) , l . forEach ( ( function ( t , n ) { var o = 0 ; function a ( ) { ++ o < t . length ? c ( ) : p ( ) ; } function c ( ) { var c = t [ o ] , l = c [ 0 ] , d = c [ 1 ] ; if ( r . has ( n ) ) ! function ( e , t , n , r , o , i , s , a ) { if ( function ( e , t ) { for ( var n , r = e . slice ( ) , o = t . split ( "-" ) , i = parseInt ( o [ 0 ] , 10 ) , s = o [ 1 ] ; n = r . pop ( ) ; ) { if ( n . pos === i && n . ids [ 0 ] === s ) return ! 0 ; for ( var a = n . ids [ 2 ] , u = 0 , c = a . length ; u < c ; u ++ ) r . push ( { pos : n . pos + 1 , ids : a [ u ] } ) ; } return ! 1 ; } ( t . rev_tree , n . metadata . rev ) && ! a ) return r [ o ] = n , i ( ) ; var u = t . winningRev || Pe ( t ) , c = "deleted" in t ? t . deleted : ze ( t , u ) , f = "deleted" in n . metadata ? n . metadata . deleted : ze ( n . metadata ) , l = /^1-/ . test ( n . metadata . rev ) ; if ( c && ! f && a && l ) { var d = n . data ; d . _rev = u , d . _id = n . metadata . id , n = It ( d , a ) ; } var h = Ke ( t . rev_tree , n . metadata . rev_tree [ 0 ] , e ) ; if ( a && ( c && f && "new_leaf" !== h . conflicts || ! c && "new_leaf" !== h . conflicts || c && ! f && "new_branch" === h . conflicts ) ) { var p = ee ( U ) ; return r [ o ] = p , i ( ) ; } var v = n . metadata . rev ; n . metadata . rev_tree = h . tree , n . stemmedRevs = h . stemmedRevs || [ ] , t . rev_map && ( n . metadata . rev_map = t . rev_map ) ; var y = Pe ( n . metadata ) , _ = ze ( n . metadata , y ) , g = c === _ ? 0 : c < _ ? - 1 : 1 ; s ( n , y , _ , v === y ? _ : ze ( n . metadata , v ) , ! 0 , g , o , i ) ; } ( e , r . get ( n ) , l , i , d , a , s , f ) ; else { var h = Ke ( [ ] , l . metadata . rev_tree [ 0 ] , e ) ; l . metadata . rev_tree = h . tree , l . stemmedRevs = h . stemmedRevs || [ ] , function ( e , t , n ) { var r = Pe ( e . metadata ) , o = ze ( e . metadata , r ) ; if ( "was_delete" in u && o ) return i [ t ] = ee ( N , "deleted" ) , n ( ) ; var a = f && function ( e ) { return "missing" === e . metadata . rev_tree [ 0 ] . ids [ 1 ] . status ; } ( e ) ; if ( a ) { var c = ee ( U ) ; return i [ t ] = c , n ( ) ; } s ( e , r , o , o , ! 1 , o ? 0 : 1 , t , n ) ; } ( l , d , a ) ; } } c ( ) ; } ) ) ; } var Tt = "document-store" , Mt = "by-sequence" , Nt = "attach-store" , Ut = "attach-seq-store" , Ft = "meta-store" , Kt = "local-store" , Jt = "detect-blob-support" ; function zt ( e ) { try { return JSON . stringify ( e ) ; } catch ( t ) { return f . stringify ( e ) ; } } function Vt ( e ) { return function ( t ) { var n = "unknown_error" ; t . target && t . target . error && ( n = t . target . error . name || t . target . error . message ) , e ( ee ( H , n , t . type ) ) ; } ; } function Gt ( e , t , n ) { return { data : zt ( e ) , winningRev : t , deletedOrLocal : n ? "1" : "0" , seq : e . seq , id : e . id } ; } function Qt ( e ) { if ( ! e ) return null ; var t = function ( e ) { try { return JSON . parse ( e ) ; } catch ( t ) { return f . parse ( e ) ; } } ( e . data ) ; return t . winningRev = e . winningRev , t . deleted = "1" === e . deletedOrLocal , t . seq = e . seq , t ; } function Wt ( e ) { if ( ! e ) return e ; var t = e . _doc_id_rev . lastIndexOf ( ":" ) ; return e . _id = e . _doc_id_rev . substring ( 0 , t - 1 ) , e . _rev = e . _doc_id_rev . substring ( t + 1 ) , delete e . _doc_id_rev , e ; } function Yt ( e , t , n , r ) { n ? r ( e ? "string" != typeof e ? e : be ( e , t ) : _e ( [ "" ] , { type : t } ) ) : e ? "string" != typeof e ? we ( e , ( function ( e ) { r ( ye ( e ) ) ; } ) ) : r ( e ) : r ( "" ) ; } function Ht ( e , t , n , r ) { var o = Object . keys ( e . _attachments || { } ) ; if ( ! o . length ) return r && r ( ) ; var i = 0 ; function s ( ) { ++ i === o . length && r && r ( ) ; } o . forEach ( ( function ( r ) { t . attachments && t . include_docs ? function ( e , t ) { var r = e . _attachments [ t ] , o = r . digest ; n . objectStore ( Nt ) . get ( o ) . onsuccess = function ( e ) { r . body = e . target . result . body , s ( ) ; } ; } ( e , r ) : ( e . _attachments [ r ] . stub = ! 0 , s ( ) ) ; } ) ) ; } function Xt ( e , t ) { return Promise . all ( e . map ( ( function ( e ) { if ( e . doc && e . doc . _attachments ) { var n = Object . keys ( e . doc . _attachments ) ; return Promise . all ( n . map ( ( function ( n ) { var r = e . doc . _attachments [ n ] ; if ( "body" in r ) { var o = r . body , i = r . content_type ; return new Promise ( ( function ( s ) { Yt ( o , i , t , ( function ( t ) { e . doc . _attachments [ n ] = R ( x ( r , [ "digest" , "content_type" ] ) , { data : t } ) , s ( ) ; } ) ) ; } ) ) ; } } ) ) ) ; } } ) ) ) ; } function Zt ( e , t , n ) { var r = [ ] , o = n . objectStore ( Mt ) , i = n . objectStore ( Nt ) , s = n . objectStore ( Ut ) , a = e . length ; function u ( ) { -- a || r . length && r . forEach ( ( function ( e ) { s . index ( "digestSeq" ) . count ( IDBKeyRange . bound ( e + "::" , e + "::" , ! 1 , ! 1 ) ) . onsuccess = function ( t ) { t . target . result || i . delete ( e ) ; } ; } ) ) ; } e . forEach ( ( function ( e ) { var n = o . index ( "_doc_id_rev" ) , i = t + "::" + e ; n . getKey ( i ) . onsuccess = function ( e ) { var t = e . target . result ; if ( "number" != typeof t ) return u ( ) ; o . delete ( t ) , s . index ( "seq" ) . openCursor ( IDBKeyRange . only ( t ) ) . onsuccess = function ( e ) { var t = e . target . result ; if ( t ) { var n = t . value . digestSeq . split ( "::" ) [ 0 ] ; r . push ( n ) , s . delete ( t . primaryKey ) , t . continue ( ) ; } else u ( ) ; } ; } ; } ) ) ; } function en ( e , t , n ) { try { return { txn : e . transaction ( t , n ) } ; } catch ( e ) { return { error : e } ; } } var tn = new D ; function nn ( e , t , n , r , o , i ) { for ( var s , u , c , f , l , d , h , p , v = t . docs , y = 0 , _ = v . length ; y < _ ; y ++ ) { var g = v [ y ] ; g . _id && Ve ( g . _id ) || ( g = v [ y ] = It ( g , n . new_edits , e ) ) . error && ! h && ( h = g ) ; } if ( h ) return i ( h ) ; var m = ! 1 , b = 0 , w = new Array ( v . length ) , k = new a , j = ! 1 , O = r . _meta . blobSupport ? "blob" : "base64" ; function A ( ) { m = ! 0 , q ( ) ; } function q ( ) { p && m && ( p . docCount += b , d . put ( p ) ) ; } function S ( ) { j || ( tn . notify ( r . _meta . name ) , i ( null , w ) ) ; } function x ( e , t , n , r , o , i , s , a ) { e . metadata . winningRev = t , e . metadata . deleted = n ; var u = e . data ; if ( u . _id = e . metadata . id , u . _rev = e . metadata . rev , r && ( u . _deleted = ! 0 ) , u . _attachments && Object . keys ( u . _attachments ) . length ) return function ( e , t , n , r , o , i ) { var s = e . data , a = 0 , u = Object . keys ( s . _attachments ) ; function c ( ) { a === u . length && E ( e , t , n , r , o , i ) ; } function l ( ) { a ++ , c ( ) ; } u . forEach ( ( function ( n ) { var r = e . data . _attachments [ n ] ; if ( r . stub ) a ++ , c ( ) ; else { var o = r . data ; delete r . data , r . revpos = parseInt ( t , 10 ) , function ( e , t , n ) { f . count ( e ) . onsuccess = function ( r ) { if ( r . target . result ) return n ( ) ; var o = { digest : e , body : t } ; f . put ( o ) . onsuccess = n ; } ; } ( r . digest , o , l ) ; } } ) ) ; } ( e , t , n , o , s , a ) ; b += i , q ( ) , E ( e , t , n , o , s , a ) ; } function E ( e , t , n , o , i , a ) { var f = e . data , d = e . metadata ; function h ( i ) { var a = e . stemmedRevs || [ ] ; o && r . auto_compaction && ( a = a . concat ( function ( e ) { var t = [ ] ; return Le ( e . rev_tree , ( function ( e , n , r , o , i ) { "available" !== i . status || e || ( t . push ( n + "-" + r ) , i . status = "missing" ) ; } ) ) , t ; } ( e . metadata ) ) ) , a && a . length && Zt ( a , e . metadata . id , s ) , d . seq = i . target . result ; var c = Gt ( d , t , n ) ; u . put ( c ) . onsuccess = p ; } function p ( ) { w [ i ] = { ok : ! 0 , id : d . id , rev : d . rev } , k . set ( e . metadata . id , e . metadata ) , function ( e , t , n ) { var r = 0 , o = Object . keys ( e . data . _attachments || { } ) ; if ( ! o . length ) return n ( ) ; function i ( ) { ++ r === o . length && n ( ) ; } function s ( n ) { var r = e . data . _attachments [ n ] . digest , o = l . put ( { seq : t , digestSeq : r + "::" + t } ) ; o . onsuccess = i , o . onerror = function ( e ) { e . preventDefault ( ) , e . stopPropagation ( ) , i ( ) ; } ; } for ( var a = 0 ; a < o . length ; a ++ ) s ( o [ a ] ) ; } ( e , d . seq , a ) ; } f . _doc_id_rev = d . id + "::" + d . rev , delete f . _id , delete f . _rev ; var v = c . put ( f ) ; v . onsuccess = h , v . onerror = function ( e ) { e . preventDefault ( ) , e . stopPropagation ( ) , c . index ( "_doc_id_rev" ) . getKey ( f . _doc_id_rev ) . onsuccess = function ( e ) { c . put ( f , e . target . result ) . onsuccess = h ; } ; } ; } ! function ( e , t , n ) { if ( ! e . length ) return n ( ) ; var r , o = 0 ; function i ( ) { o ++ , e . length === o && ( r ? n ( r ) : n ( ) ) ; } e . forEach ( ( function ( e ) { var n = e . data && e . data . _attachments ? Object . keys ( e . data . _attachments ) : [ ] , o = 0 ; if ( ! n . length ) return i ( ) ; function s ( e ) { r = e , ++ o === n . length && i ( ) ; } for ( var a in e . data . _attachments ) e . data . _attachments . hasOwnProperty ( a ) && Bt ( e . data . _attachments [ a ] , t , s ) ; } ) ) ; } ( v , O , ( function ( t ) { if ( t ) return i ( t ) ; ! function ( ) { var t = en ( o , [ Tt , Mt , Nt , Kt , Ut , Ft ] , "readwrite" ) ; if ( t . error ) return i ( t . error ) ; ( s = t . txn ) . onabort = Vt ( i ) , s . ontimeout = Vt ( i ) , s . oncomplete = S , u = s . objectStore ( Tt ) , c = s . objectStore ( Mt ) , f = s . objectStore ( Nt ) , l = s . objectStore ( Ut ) , ( d = s . objectStore ( Ft ) ) . get ( Ft ) . onsuccess = function ( e ) { p = e . target . result , q ( ) ; } , function ( e ) { var t = [ ] ; if ( v . forEach ( ( function ( e ) { e . data && e . data . _attachments && Object . keys ( e . data . _attachments ) . forEach ( ( function ( n ) { var r = e . data . _attachments [ n ] ; r . stub && t . push ( r . digest ) ; } ) ) ; } ) ) , ! t . length ) return e ( ) ; var n , r = 0 ; t . forEach ( ( function ( o ) { ! function ( e , t ) { f . get ( e ) . onsuccess = function ( n ) { if ( n . target . result ) t ( ) ; else { var r = ee ( Z , "unknown stub attachment with digest " + e ) ; r . status = 412 , t ( r ) ; } } ; } ( o , ( function ( o ) { o && ! n && ( n = o ) , ++ r === t . length && e ( n ) ; } ) ) ; } ) ) ; } ( ( function ( t ) { if ( t ) return j = ! 0 , i ( t ) ; ! function ( ) { if ( v . length ) for ( var t = 0 , o = 0 , i = v . length ; o < i ; o ++ ) { var a = v [ o ] ; a . _id && Ve ( a . _id ) ? c ( ) : u . get ( a . metadata . id ) . onsuccess = f ; } function c ( ) { ++ t === v . length && Rt ( e . revs_limit , v , r , k , s , w , x , n , A ) ; } function f ( e ) { var t = Qt ( e . target . result ) ; t && k . set ( t . id , t ) , c ( ) ; } } ( ) ; } ) ) ; } ( ) ; } ) ) ; } function rn ( e , t , n , r , o ) { var i , s , a ; function u ( e ) { s = e . target . result , i && o ( i , s , a ) ; } function c ( e ) { i = e . target . result , s && o ( i , s , a ) ; } function f ( e ) { var t = e . target . result ; if ( ! t ) return o ( ) ; o ( [ t . key ] , [ t . value ] , t ) ; } - 1 === r && ( r = 1e3 ) , "function" == typeof e . getAll && "function" == typeof e . getAllKeys && r > 1 && ! n ? ( a = { continue : function ( ) { if ( ! i . length ) return o ( ) ; var n , a = i [ i . length - 1 ] ; if ( t && t . upper ) try { n = IDBKeyRange . bound ( a , t . upper , ! 0 , t . upperOpen ) ; } catch ( e ) { if ( "DataError" === e . name && 0 === e . code ) return o ( ) ; } else n = IDBKeyRange . lowerBound ( a , ! 0 ) ; t = n , i = null , s = null , e . getAll ( t , r ) . onsuccess = u , e . getAllKeys ( t , r ) . onsuccess = c ; } } , e . getAll ( t , r ) . onsuccess = u , e . getAllKeys ( t , r ) . onsuccess = c ) : n ? e . openCursor ( t , "prev" ) . onsuccess = f : e . openCursor ( t ) . onsuccess = f ; } function on ( e , t , n ) { var r , o , i = "startkey" in e && e . startkey , s = "endkey" in e && e . endkey , a = "key" in e && e . key , u = "keys" in e && e . keys , c = e . skip || 0 , f = "number" == typeof e . limit ? e . limit : - 1 , l = ! 1 !== e . inclusive_end ; if ( ! u && ( r = function ( e , t , n , r , o ) { try { if ( e && t ) return o ? IDBKeyRange . bound ( t , e , ! n , ! 1 ) : IDBKeyRange . bound ( e , t , ! 1 , ! n ) ; if ( e ) return o ? IDBKeyRange . upperBound ( e ) : IDBKeyRange . lowerBound ( e ) ; if ( t ) return o ? IDBKeyRange . lowerBound ( t , ! n ) : IDBKeyRange . upperBound ( t , ! n ) ; if ( r ) return IDBKeyRange . only ( r ) ; } catch ( e ) { return { error : e } ; } return null ; } ( i , s , l , a , e . descending ) , ( o = r && r . error ) && ( "DataError" !== o . name || 0 !== o . code ) ) ) return n ( ee ( H , o . name , o . message ) ) ; var d = [ Tt , Mt , Ft ] ; e . attachments && d . push ( Nt ) ; var h = en ( t , d , "readonly" ) ; if ( h . error ) return n ( h . error ) ; var p = h . txn ; p . oncomplete = function ( ) { e . attachments ? Xt ( w , e . binary ) . then ( A ) : A ( ) ; } , p . onabort = Vt ( n ) ; var v , y , _ = p . objectStore ( Tt ) , g = p . objectStore ( Mt ) , m = p . objectStore ( Ft ) , b = g . index ( "_doc_id_rev" ) , w = [ ] ; function k ( t , n ) { var r = { id : n . id , key : n . id , value : { rev : t } } ; n . deleted ? u && ( w . push ( r ) , r . value . deleted = ! 0 , r . doc = null ) : c -- <= 0 && ( w . push ( r ) , e . include_docs && function ( t , n , r ) { var o = t . id + "::" + r ; b . get ( o ) . onsuccess = function ( r ) { if ( n . doc = Wt ( r . target . result ) || { } , e . conflicts ) { var o = Ie ( t ) ; o . length && ( n . doc . _conflicts = o ) ; } Ht ( n . doc , e , p ) ; } ; } ( n , r , t ) ) ; } function j ( e ) { for ( var t = 0 , n = e . length ; t < n && w . length !== f ; t ++ ) { var r = e [ t ] ; if ( r . error && u ) w . push ( r ) ; else { var o = Qt ( r ) ; k ( o . winningRev , o ) ; } } } function O ( e , t , n ) { n && ( j ( t ) , w . length < f && n . continue ( ) ) ; } function A ( ) { var t = { total_rows : v , offset : e . skip , rows : w } ; e . update_seq && void 0 !== y && ( t . update_seq = y ) , n ( null , t ) ; } return m . get ( Ft ) . onsuccess = function ( e ) { v = e . target . result . docCount ; } , e . update_seq && ( g . openCursor ( null , "prev" ) . onsuccess = function ( e ) { var t = e . target . result , n = void 0 ; return t && t . key && ( n = t . key ) , function ( e ) { e . target . result && e . target . result . length > 0 && ( y = e . target . result [ 0 ] ) ; } ( { target : { result : [ n ] } } ) ; } ) , o || 0 === f ? void 0 : u ? function ( e , t , n ) { var r = new Array ( e . length ) , o = 0 ; e . forEach ( ( function ( i , s ) { t . get ( i ) . onsuccess = function ( t ) { t . target . result ? r [ s ] = t . target . result : r [ s ] = { key : i , error : "not_found" } , ++ o === e . length && n ( e , r , { } ) ; } ; } ) ) ; } ( e . keys , _ , O ) : - 1 === f ? function ( e , t , n ) { if ( "function" != typeof e . getAll ) { var r = [ ] ; e . openCursor ( t ) . onsuccess = function ( e ) { var t = e . target . result ; t ? ( r . push ( t . value ) , t . continue ( ) ) : n ( { target : { result : r } } ) ; } ; } else e . getAll ( t ) . onsuccess = n ; } ( _ , r , ( function ( t ) { var n = t . target . result ; e . descending && ( n = n . reverse ( ) ) , j ( n ) ; } ) ) : void rn ( _ , r , e . descending , f + c , O ) ; } var sn = ! 1 , an = [ ] ; function un ( ) { ! sn && an . length && ( sn = ! 0 , an . shift ( ) ( ) ) ; } var cn , fn = new a , ln = new a ; function dn ( e , n ) { var r = this ; ! function ( n , o , i ) { an . push ( ( function ( ) { var n ; n = function ( e , n ) { ! function ( e , t , n , r ) { try { e ( t , n ) ; } catch ( t ) { r . emit ( "error" , t ) ; } } ( o , e , n , i ) , sn = ! 1 , t ( ) ( ( function ( ) { un ( ) ; } ) ) ; } , function ( e , n , r ) { var o = n . name , i = null ; function u ( e ) { var t = e . createObjectStore ( Tt , { keyPath : "id" } ) ; e . createObjectStore ( Mt , { autoIncrement : ! 0 } ) . createIndex ( "_doc_id_rev" , "_doc_id_rev" , { unique : ! 0 } ) , e . createObjectStore ( Nt , { keyPath : "digest" } ) , e . createObjectStore ( Ft , { keyPath : "id" , autoIncrement : ! 1 } ) , e . createObjectStore ( Jt ) , t . createIndex ( "deletedOrLocal" , "deletedOrLocal" , { unique : ! 1 } ) , e . createObjectStore ( Kt , { keyPath : "_id" } ) ; var n = e . createObjectStore ( Ut , { autoIncrement : ! 0 } ) ; n . createIndex ( "seq" , "seq" ) , n . createIndex ( "digestSeq" , "digestSeq" , { unique : ! 0 } ) ; } function c ( e , t ) { var n = e . objectStore ( Tt ) ; n . createIndex ( "deletedOrLocal" , "deletedOrLocal" , { unique : ! 1 } ) , n . openCursor ( ) . onsuccess = function ( e ) { var r = e . target . result ; if ( r ) { var o = r . value , i = ze ( o ) ; o . deletedOrLocal = i ? "1" : "0" , n . put ( o ) , r . continue ( ) ; } else t ( ) ; } ; } function f ( e ) { e . createObjectStore ( Kt , { keyPath : "_id" } ) . createIndex ( "_doc_id_rev" , "_doc_id_rev" , { unique : ! 0 } ) ; } function l ( e , t ) { var n = e . objectStore ( Kt ) , r = e . objectStore ( Tt ) , o = e . objectStore ( Mt ) ; r . openCursor ( ) . onsuccess = function ( e ) { var i = e . target . result ; if ( i ) { var s = i . value , a = s . id , u = Ve ( a ) , c = Pe ( s ) ; if ( u ) { var f = a + "::" + c , l = a + "::" , d = a + "::~" , h = o . index ( "_doc_id_rev" ) , p = IDBKeyRange . bound ( l , d , ! 1 , ! 1 ) , v = h . openCursor ( p ) ; v . onsuccess = function ( e ) { if ( v = e . target . result ) { var t = v . value ; t . _doc_id_rev === f && n . put ( t ) , o . delete ( v . primaryKey ) , v . continue ( ) ; } else r . delete ( i . primaryKey ) , i . continue ( ) ; } ; } else i . continue ( ) ; } else t && t ( ) ; } ; } function d ( e ) { var t = e . createObjectStore ( Ut , { autoIncrement : ! 0 } ) ; t . createIndex ( "seq" , "seq" ) , t . createIndex ( "digestSeq" , "digestSeq" , { unique : ! 0 } ) ; } function h ( e , t ) { var n = e . objectStore ( Mt ) , r = e . objectStore ( Nt ) , o = e . objectStore ( Ut ) ; r . count ( ) . onsuccess = function ( e ) { if ( ! e . target . result ) return t ( ) ; n . openCursor ( ) . onsuccess = function ( e ) { var n = e . target . result ; if ( ! n ) return t ( ) ; for ( var r = n . value , i = n . primaryKey , s = Object . keys ( r . _attachments || { } ) , a = { } , u = 0 ; u < s . length ; u ++ ) a [ r . _attachments [ s [ u ] ] . digest ] = ! 0 ; var c = Object . keys ( a ) ; for ( u = 0 ; u < c . length ; u ++ ) { var f = c [ u ] ; o . put ( { seq : i , digestSeq : f + "::" + i } ) ; } n . continue ( ) ; } ; } ; } function p ( e ) { function t ( e ) { return e . data ? Qt ( e ) : ( e . deleted = "1" === e . deletedOrLocal , e ) ; } var n = e . objectStore ( Mt ) , r = e . objectStore ( Tt ) ; r . openCursor ( ) . onsuccess = function ( e ) { var o = e . target . result ; if ( o ) { var i = t ( o . value ) ; if ( i . winningRev = i . winningRev || Pe ( i ) , i . seq ) return a ( ) ; s ( ) ; } function s ( ) { var e = i . id + "::" , t = i . id + "::" , r = n . index ( "_doc_id_rev" ) . openCursor ( IDBKeyRange . bound ( e , t ) ) , o = 0 ; r . onsuccess = function ( e ) { var t = e . target . result ; if ( ! t ) return i . seq = o , a ( ) ; var n = t . primaryKey ; n > o && ( o = n ) , t . continue ( ) ; } ; } function a ( ) { var e = Gt ( i , i . winningRev , i . deleted ) ; r . put ( e ) . onsuccess = function ( ) { o . continue ( ) ; } ; } } ; } e . _meta = null , e . _remote = ! 1 , e . type = function ( ) { return "idb" ; } , e . _id = q ( ( function ( t ) { t ( null , e . _meta . instanceId ) ; } ) ) , e . _bulkDocs = function ( t , r , o ) { nn ( n , t , r , e , i , o ) ; } , e . _get = function ( e , t , n ) { var r , o , s , a = t . ctx ; if ( ! a ) { var u = en ( i , [ Tt , Mt , Nt ] , "readonly" ) ; if ( u . error ) return n ( u . error ) ; a = u . txn ; } function c ( ) { n ( s , { doc : r , metadata : o , ctx : a } ) ; } a . objectStore ( Tt ) . get ( e ) . onsuccess = function ( e ) { if ( ! ( o = Qt ( e . target . result ) ) ) return s = ee ( N , "missing" ) , c ( ) ; var n ; if ( t . rev ) n = t . latest ? function ( e , t ) { for ( var n , r = t . rev_tree . slice ( ) ; n = r . pop ( ) ; ) { var o = n . pos , i = n . ids , s = i [ 0 ] , a = i [ 1 ] , u = i [ 2 ] , c = 0 === u . length , f = n . history ? n . history . slice ( ) : [ ] ; if ( f . push ( { id : s , pos : o , opts : a } ) , c ) for ( var l = 0 , d = f . length ; l < d ; l ++ ) { var h = f [ l ] ; if ( h . pos + "-" + h . id === e ) return o + "-" + s ; } for ( var p = 0 , v = u . length ; p < v ; p ++ ) r . push ( { pos : o + 1 , ids : u [ p ] , history : f } ) ; } throw new Error ( "Unable to resolve latest revision for id " + t . id + ", rev " + e ) ; } ( t . rev , o ) : t . rev ; else if ( n = o . winningRev , ze ( o ) ) return s = ee ( N , "deleted" ) , c ( ) ; var i = a . objectStore ( Mt ) , u = o . id + "::" + n ; i . index ( "_doc_id_rev" ) . get ( u ) . onsuccess = function ( e ) { if ( ( r = e . target . result ) && ( r = Wt ( r ) ) , ! r ) return s = ee ( N , "missing" ) , c ( ) ; c ( ) ; } ; } ; } , e . _getAttachment = function ( e , t , n , r , o ) { var s ; if ( r . ctx ) s = r . ctx ; else { var a = en ( i , [ Tt , Mt , Nt ] , "readonly" ) ; if ( a . error ) return o ( a . error ) ; s = a . txn ; } var u = n . digest , c = n . content_type ; s . objectStore ( Nt ) . get ( u ) . onsuccess = function ( e ) { Yt ( e . target . result . body , c , r . binary , ( function ( e ) { o ( null , e ) ; } ) ) ; } ; } , e . _info = function ( t ) { var n , r , o = en ( i , [ Ft , Mt ] , "readonly" ) ; if ( o . error ) return t ( o . error ) ; var s = o . txn ; s . objectStore ( Ft ) . get ( Ft ) . onsuccess = function ( e ) { r = e . target . result . docCount ; } , s . objectStore ( Mt ) . openCursor ( null , "prev" ) . onsuccess = function ( e ) { var t = e . target . result ; n = t ? t . key : 0 ; } , s . oncomplete = function ( ) { t ( null , { doc_count : r , update_seq : n , idb_attachment_format : e . _meta . blobSupport ? "binary" : "base64" } ) ; } ; } , e . _allDocs = function ( e , t ) { on ( e , i , t ) ; } , e . _changes = function ( t ) { return function ( e , t , n , r ) { if ( ( e = O ( e ) ) . continuous ) { var o = n + ":" + Ce ( ) ; return tn . addListener ( n , o , t , e ) , tn . notify ( n ) , { cancel : function ( ) { tn . removeListener ( n , o ) ; } } ; } var i = e . doc_ids && new s ( e . doc_ids ) ; e . since = e . since || 0 ; var u = e . since , c = "limit" in e ? e . limit : - 1 ; 0 === c && ( c = 1 ) ; var f , l , d , h , p = [ ] , v = 0 , y = ne ( e ) , _ = new a ; function g ( e , t , n , r ) { if ( n . seq !== t ) return r ( ) ; if ( n . winningRev === e . _rev ) return r ( n , e ) ; var o = e . _id + "::" + n . winningRev ; h . get ( o ) . onsuccess = function ( e ) { r ( n , Wt ( e . target . result ) ) ; } ; } function m ( ) { e . complete ( null , { results : p , last_seq : u } ) ; } var b = [ Tt , Mt ] ; e . attachments && b . push ( Nt ) ; var w = en ( r , b , "readonly" ) ; if ( w . error ) return e . complete ( w . error ) ; ( f = w . txn ) . onabort = Vt ( e . complete ) , f . oncomplete = function ( ) { ! e . continuous && e . attachments ? Xt ( p ) . then ( m ) : m ( ) ; } , l = f . objectStore ( Mt ) , d = f . objectStore ( Tt ) , h = l . index ( "_doc_id_rev" ) , rn ( l , e . since && ! e . descending ? IDBKeyRange . lowerBound ( e . since , ! 0 ) : null , e . descending , c , ( function ( t , n , r ) { if ( r && t . length ) { var o = new Array ( t . length ) , s = new Array ( t . length ) , a = 0 ; n . forEach ( ( function ( n , u ) { ! function ( e , t , n ) { if ( i && ! i . has ( e . _id ) ) return n ( ) ; var r = _ . get ( e . _id ) ; if ( r ) return g ( e , t , r , n ) ; d . get ( e . _id ) . onsuccess = function ( o ) { r = Qt ( o . target . result ) , _ . set ( e . _id , r ) , g ( e , t , r , n ) ; } ; } ( Wt ( n ) , t [ u ] , ( function ( n , i ) { s [ u ] = n , o [ u ] = i , ++ a === t . length && function ( ) { for ( var t = [ ] , n = 0 , i = o . length ; n < i && v !== c ; n ++ ) { var a = o [ n ] ; if ( a ) { var u = s [ n ] ; t . push ( l ( u , a ) ) ; } } Promise . all ( t ) . then ( ( function ( t ) { for ( var n = 0 , r = t . length ; n < r ; n ++ ) t [ n ] && e . onChange ( t [ n ] ) ; } ) ) . catch ( e . complete ) , v !== c && r . continue ( ) ; } ( ) ; } ) ) ; } ) ) ; } function l ( t , n ) { var r = e . processChange ( n , t , e ) ; u = r . seq = t . seq ; var o = y ( r ) ; return "object" == typeof o ? Promise . reject ( o ) : o ? ( v ++ , e . return_docs && p . push ( r ) , e . attachments && e . include_docs ? new Promise ( ( function ( t ) { Ht ( n , e , f , ( function ( ) { Xt ( [ r ] , e . binary ) . then ( ( function ( ) { t ( r ) ; } ) ) ; } ) ) ; } ) ) : Promise . resolve ( r ) ) : Promise . resolve ( ) ; } } ) ) ; } ( t , e , o , i ) ; } , e . _close = function ( e ) { i . close ( ) , fn . delete ( o ) , e ( ) ; } , e . _getRevisionTree = function ( e , t ) { var n = en ( i , [ Tt ] , "readonly" ) ; if ( n . error ) return t ( n . error ) ; n . txn . objectStore ( Tt ) . get ( e ) . onsuccess = function ( e ) { var n = Qt ( e . target . result ) ; n ? t ( null , n . rev_tree ) : t ( ee ( N ) ) ; } ; } , e . _doCompaction = function ( e , t , n ) { var r = en ( i , [ Tt , Mt , Nt , Ut ] , "readwrite" ) ; if ( r . error ) return n ( r . error ) ; var o = r . txn ; o . objectStore ( Tt ) . get ( e ) . onsuccess = function ( n ) { var r = Qt ( n . target . result ) ; Le ( r . rev_tree , ( function ( e , n , r , o , i ) { var s = n + "-" + r ; - 1 !== t . indexOf ( s ) && ( i . status = "missing" ) ; } ) ) , Zt ( t , e , o ) ; var i = r . winningRev , s = r . deleted ; o . objectStore ( Tt ) . put ( Gt ( r , i , s ) ) ; } , o . onabort = Vt ( n ) , o . oncomplete = function ( ) { n ( ) ; } ; } , e . _getLocal = function ( e , t ) { var n = en ( i , [ Kt ] , "readonly" ) ; if ( n . error ) return t ( n . error ) ; var r = n . txn . objectStore ( Kt ) . get ( e ) ; r . onerror = Vt ( t ) , r . onsuccess = function ( e ) { var n = e . target . result ; n ? ( delete n . _doc_id_rev , t ( null , n ) ) : t ( ee ( N ) ) ; } ; } , e . _putLocal = function ( e , t , n ) { "function" == typeof t && ( n = t , t = { } ) , delete e . _revisions ; var r = e . _rev , o = e . _id ; e . _rev = r ? "0-" + ( parseInt ( r . split ( "-" ) [ 1 ] , 10 ) + 1 ) : "0-1" ; var s , a = t . ctx ; if ( ! a ) { var u = en ( i , [ Kt ] , "readwrite" ) ; if ( u . error ) return n ( u . error ) ; ( a = u . txn ) . onerror = Vt ( n ) , a . oncomplete = function ( ) { s && n ( null , s ) ; } ; } var c , f = a . objectStore ( Kt ) ; r ? ( c = f . get ( o ) ) . onsuccess = function ( o ) { var i = o . target . result ; i && i . _rev === r ? f . put ( e ) . onsuccess = function ( ) { s = { ok : ! 0 , id : e . _id , rev : e . _rev } , t . ctx && n ( null , s ) ; } : n ( ee ( U ) ) ; } : ( ( c = f . add ( e ) ) . onerror = function ( e ) { n ( ee ( U ) ) , e . preventDefault ( ) , e . stopPropagation ( ) ; } , c . onsuccess = function ( ) { s = { ok : ! 0 , id : e . _id , rev : e . _rev } , t . ctx && n ( null , s ) ; } ) ; } , e . _removeLocal = function ( e , t , n ) { "function" == typeof t && ( n = t , t = { } ) ; var r , o = t . ctx ; if ( ! o ) { var s = en ( i , [ Kt ] , "readwrite" ) ; if ( s . error ) return n ( s . error ) ; ( o = s . txn ) . oncomplete = function ( ) { r && n ( null , r ) ; } ; } var a = e . _id , u = o . objectStore ( Kt ) , c = u . get ( a ) ; c . onerror = Vt ( n ) , c . onsuccess = function ( o ) { var i = o . target . result ; i && i . _rev === e . _rev ? ( u . delete ( a ) , r = { ok : ! 0 , id : a , rev : "0-0" } , t . ctx && n ( null , r ) ) : n ( ee ( N ) ) ; } ; } , e . _destroy = function ( e , t ) { tn . removeAllListeners ( o ) ; var n = ln . get ( o ) ; n && n . result && ( n . result . close ( ) , fn . delete ( o ) ) ; var r = indexedDB . deleteDatabase ( o ) ; r . onsuccess = function ( ) { ln . delete ( o ) , L ( ) && o in localStorage && delete localStorage [ o ] , t ( null , { ok : ! 0 } ) ; } , r . onerror = Vt ( t ) ; } ; var v = fn . get ( o ) ; if ( v ) return i = v . idb , e . _meta = v . global , t ( ) ( ( function ( ) { r ( null , e ) ; } ) ) ; var y = indexedDB . open ( o , 5 ) ; ln . set ( o , y ) , y . onupgradeneeded = function ( e ) { var t = e . target . result ; if ( e . oldVersion < 1 ) return u ( t ) ; var n = e . currentTarget . transaction ; e . oldVersion < 3 && f ( t ) , e . oldVersion < 4 && d ( t ) ; var r = [ c , l , h , p ] , o = e . oldVersion ; function i ( ) { var e = r [ o - 1 ] ; o ++ , e && e ( n , i ) ; } i ( ) ; } , y . onsuccess = function ( t ) { ( i = t . target . result ) . onversionchange = function ( ) { i . close ( ) , fn . delete ( o ) ; } , i . onabort = function ( e ) { $ ( "error" , "Database has a global failure" , e . target . error ) , i . close ( ) , fn . delete ( o ) ; } ; var n , s , a , u , c = i . transaction ( [ Ft , Jt , Tt ] , "readwrite" ) , f = ! 1 ; function l ( ) { void 0 !== a && f && ( e . _meta = { name : o , instanceId : u , blobSupport : a } , fn . set ( o , { idb : i , global : e . _meta } ) , r ( null , e ) ) ; } function d ( ) { if ( void 0 !== s && void 0 !== n ) { var e = o + "_id" ; e in n ? u = n [ e ] : n [ e ] = u = Ce ( ) , n . docCount = s , c . objectStore ( Ft ) . put ( n ) ; } } c . objectStore ( Ft ) . get ( Ft ) . onsuccess = function ( e ) { n = e . target . result || { id : Ft } , d ( ) ; } , function ( e , t ) { e . objectStore ( Tt ) . index ( "deletedOrLocal" ) . count ( IDBKeyRange . only ( "0" ) ) . onsuccess = function ( e ) { t ( e . target . result ) ; } ; } ( c , ( function ( e ) { s = e , d ( ) ; } ) ) , cn || ( cn = function ( e ) { return new Promise ( ( function ( t ) { var n = _e ( [ "" ] ) , r = e . objectStore ( Jt ) . put ( n , "key" ) ; r . onsuccess = function ( ) { var e = navigator . userAgent . match ( /Chrome\/(\d+)/ ) , n = navigator . userAgent . match ( /Edge\// ) ; t ( n || ! e || parseInt ( e [ 1 ] , 10 ) >= 43 ) ; } , r . onerror = e . onabort = function ( e ) { e . preventDefault ( ) , e . stopPropagation ( ) , t ( ! 1 ) ; } ; } ) ) . catch ( ( function ( ) { return ! 1 ; } ) ) ; } ( c ) ) , cn . then ( ( function ( e ) { a = e , l ( ) ; } ) ) , c . oncomplete = function ( ) { f = ! 0 , l ( ) ; } , c . onabort = Vt ( r ) ; } , y . onerror = function ( e ) { var t = e . target . error && e . target . error . message ; t ? - 1 !== t . indexOf ( "stored database is a higher version" ) && ( t = new Error ( 'This DB was created with the newer "indexeddb" adapter, but you are trying to open it with the older "idb" adapter' ) ) : t = "Failed to open indexedDB, are you in private browsing mode?" , $ ( "error" , t ) , r ( ee ( H , t ) ) ; } ; } ( r , e , n ) ; } ) ) , un ( ) ; } ( 0 , n , r . constructor ) ; } dn . valid = function ( ) { try { return "undefined" != typeof indexedDB && "undefined" != typeof IDBKeyRange ; } catch ( e ) { return ! 1 ; } } ; var hn = 5e3 , pn = { } ; function vn ( e ) { var t = e . doc || e . ok , n = t && t . _attachments ; n && Object . keys ( n ) . forEach ( ( function ( e ) { var t = n [ e ] ; t . data = be ( t . data , t . content_type ) ; } ) ) ; } function yn ( e ) { return /^_design/ . test ( e ) ? "_design/" + encodeURIComponent ( e . slice ( 8 ) ) : /^_local/ . test ( e ) ? "_local/" + encodeURIComponent ( e . slice ( 7 ) ) : encodeURIComponent ( e ) ; } function _n ( e ) { return e . _attachments && Object . keys ( e . _attachments ) ? Promise . all ( Object . keys ( e . _attachments ) . map ( ( function ( t ) { var n = e . _attachments [ t ] ; if ( n . data && "string" != typeof n . data ) return new Promise ( ( function ( e ) { je ( n . data , e ) ; } ) ) . then ( ( function ( e ) { n . data = e ; } ) ) ; } ) ) ) : Promise . resolve ( ) ; } function gn ( e , t ) { return mn ( e , e . db + "/" + t ) ; } function mn ( e , t ) { var n = e . path ? "/" : "" ; return e . protocol + "://" + e . host + ( e . port ? ":" + e . port : "" ) + "/" + e . path + n + t ; } function bn ( e ) { return "?" + Object . keys ( e ) . map ( ( function ( t ) { return t + "=" + encodeURIComponent ( e [ t ] ) ; } ) ) . join ( "&" ) ; } function wn ( e , n ) { var r = this , o = function ( e , t ) { if ( function ( e ) { if ( ! e . prefix ) return ! 1 ; var t = de ( e . prefix ) . protocol ; return "http" === t || "https" === t ; } ( t ) ) { var n = t . name . substr ( t . prefix . length ) ; e = t . prefix . replace ( /\/?$/ , "/" ) + encodeURIComponent ( n ) ; } var r = de ( e ) ; ( r . user || r . password ) && ( r . auth = { username : r . user , password : r . password } ) ; var o = r . path . replace ( /(^\/|\/$)/g , "" ) . split ( "/" ) ; return r . db = o . pop ( ) , - 1 === r . db . indexOf ( "%" ) && ( r . db = encodeURIComponent ( r . db ) ) , r . path = o . join ( "/" ) , r ; } ( e . name , e ) , i = gn ( o , "" ) ; e = O ( e ) ; var s , a = function ( t , n ) { if ( ( n = n || { } ) . headers = n . headers || new ot , n . credentials = "include" , e . auth || o . auth ) { var r = e . auth || o . auth , i = r . username + ":" + r . password , s = ye ( unescape ( encodeURIComponent ( i ) ) ) ; n . headers . set ( "Authorization" , "Basic " + s ) ; } var a = e . headers || { } ; return Object . keys ( a ) . forEach ( ( function ( e ) { n . headers . append ( e , a [ e ] ) ; } ) ) , function ( e ) { var t = "undefined" != typeof navigator && navigator . userAgent ? navigator . userAgent . toLowerCase ( ) : "" , n = - 1 !== t . indexOf ( "msie" ) , r = - 1 !== t . indexOf ( "trident" ) , o = - 1 !== t . indexOf ( "edge" ) , i = ! ( "method" in e ) || "GET" === e . method ; return ( n || r || o ) && i ; } ( n ) && ( t += ( - 1 === t . indexOf ( "?" ) ? "?" : "&" ) + "_nonce=" + Date . now ( ) ) , ( e . fetch || rt ) ( t , n ) ; } ; function u ( e , t ) { return S ( e , d ( ) ( ( function ( e ) { f ( ) . then ( ( function ( ) { return t . apply ( this , e ) ; } ) ) . catch ( ( function ( t ) { e . pop ( ) ( t ) ; } ) ) ; } ) ) ) . bind ( r ) ; } function c ( e , t , n ) { var r = { } ; return ( t = t || { } ) . headers = t . headers || new ot , t . headers . get ( "Content-Type" ) || t . headers . set ( "Content-Type" , "application/json" ) , t . headers . get ( "Accept" ) || t . headers . set ( "Accept" , "application/json" ) , a ( e , t ) . then ( ( function ( e ) { return r . ok = e . ok , r . status = e . status , e . json ( ) ; } ) ) . then ( ( function ( e ) { if ( r . data = e , ! r . ok ) { r . data . status = r . status ; var t = te ( r . data ) ; if ( n ) return n ( t ) ; throw t ; } if ( Array . isArray ( r . data ) && ( r . data = r . data . map ( ( function ( e ) { return e . error || e . missing ? te ( e ) : e ; } ) ) ) , ! n ) return r ; n ( null , r . data ) ; } ) ) ; } function f ( ) { return e . skip_setup ? Promise . resolve ( ) : s || ( ( s = c ( i ) . catch ( ( function ( e ) { return e && e . status && 404 === e . status ? ( B ( 404 , "PouchDB is just detecting if the remote exists." ) , c ( i , { method : "PUT" } ) ) : Promise . reject ( e ) ; } ) ) . catch ( ( function ( e ) { return ! ( ! e || ! e . status || 412 !== e . status ) || Promise . reject ( e ) ; } ) ) ) . catch ( ( function ( ) { s = null ; } ) ) , s ) ; } function l ( e ) { return e . split ( "/" ) . map ( encodeURIComponent ) . join ( "/" ) ; } t ( ) ( ( function ( ) { n ( null , r ) ; } ) ) , r . _remote = ! 0 , r . type = function ( ) { return "http" ; } , r . id = u ( "id" , ( function ( e ) { a ( mn ( o , "" ) ) . then ( ( function ( e ) { return e . json ( ) ; } ) ) . catch ( ( function ( ) { return { } ; } ) ) . then ( ( function ( t ) { var n = t && t . uuid ? t . uuid + o . db : gn ( o , "" ) ; e ( null , n ) ; } ) ) ; } ) ) , r . compact = u ( "compact" , ( function ( e , t ) { "function" == typeof e && ( t = e , e = { } ) , e = O ( e ) , c ( gn ( o , "_compact" ) , { method : "POST" } ) . then ( ( function ( ) { ! function n ( ) { r . info ( ( function ( r , o ) { o && ! o . compact_running ? t ( null , { ok : ! 0 } ) : setTimeout ( n , e . interval || 200 ) ; } ) ) ; } ( ) ; } ) ) ; } ) ) , r . bulkGet = S ( "bulkGet" , ( function ( e , t ) { var n = this ; function r ( t ) { var n = { } ; e . revs && ( n . revs = ! 0 ) , e . attachments && ( n . attachments = ! 0 ) , e . latest && ( n . latest = ! 0 ) , c ( gn ( o , "_bulk_get" + bn ( n ) ) , { method : "POST" , body : JSON . stringify ( { docs : e . docs } ) } ) . then ( ( function ( n ) { e . attachments && e . binary && n . data . results . forEach ( ( function ( e ) { e . docs . forEach ( vn ) ; } ) ) , t ( null , n . data ) ; } ) ) . catch ( t ) ; } function i ( ) { var r = Math . ceil ( e . docs . length / 50 ) , o = 0 , i = new Array ( r ) ; function s ( e ) { return function ( n , s ) { i [ e ] = s . results , ++ o === r && t ( null , { results : re ( i ) } ) ; } ; } for ( var a = 0 ; a < r ; a ++ ) { var u = x ( e , [ "revs" , "attachments" , "binary" , "latest" ] ) ; u . docs = e . docs . slice ( 50 * a , Math . min ( e . docs . length , 50 * ( a + 1 ) ) ) , P ( n , u , s ( a ) ) ; } } var s = mn ( o , "" ) , a = pn [ s ] ; "boolean" != typeof a ? r ( ( function ( e , n ) { e ? ( pn [ s ] = ! 1 , B ( e . status , "PouchDB is just detecting if the remote supports the _bulk_get API." ) , i ( ) ) : ( pn [ s ] = ! 0 , t ( null , n ) ) ; } ) ) : a ? r ( t ) : i ( ) ; } ) ) , r . _info = function ( e ) { f ( ) . then ( ( function ( ) { return a ( gn ( o , "" ) ) ; } ) ) . then ( ( function ( e ) { return e . json ( ) ; } ) ) . then ( ( function ( t ) { t . host = gn ( o , "" ) , e ( null , t ) ; } ) ) . catch ( e ) ; } , r . fetch = function ( e , t ) { return f ( ) . then ( ( function ( ) { var n = "/" === e . substring ( 0 , 1 ) ? mn ( o , e . substring ( 1 ) ) : gn ( o , e ) ; return a ( n , t ) ; } ) ) ; } , r . get = u ( "get" , ( function ( e , t , n ) { "function" == typeof t && ( n = t , t = { } ) ; var r = { } ; function i ( e ) { var n , r = e . _attachments , i = r && Object . keys ( r ) ; if ( r && i . length ) return n = i . map ( ( function ( n ) { return function ( ) { return function ( n ) { var i = r [ n ] , s = yn ( e . _id ) + "/" + l ( n ) + "?rev=" + e . _rev ; return a ( gn ( o , s ) ) . then ( ( function ( e ) { return "buffer" in e ? e . buffer ( ) : e . blob ( ) ; } ) ) . then ( ( function ( e ) { if ( t . binary ) { var n = Object . getOwnPropertyDescriptor ( e . __proto__ , "type" ) ; return n && ! n . set || ( e . type = i . content_type ) , e ; } return new Promise ( ( function ( t ) { je ( e , t ) ; } ) ) ; } ) ) . then ( ( function ( e ) { delete i . stub , delete i . length , i . data = e ; } ) ) ; } ( n ) ; } ; } ) ) , new Promise ( ( function ( e , t ) { var r , o = 0 , i = 0 , s = 0 , a = n . length ; function u ( ) { ++ s === a ? r ? t ( r ) : e ( ) : l ( ) ; } function c ( ) { o -- , u ( ) ; } function f ( e ) { o -- , r = r || e , u ( ) ; } function l ( ) { for ( ; o < 5 && i < a ; ) o ++ , n [ i ++ ] ( ) . then ( c , f ) ; } l ( ) ; } ) ) ; } ( t = O ( t ) ) . revs && ( r . revs = ! 0 ) , t . revs_info && ( r . revs_info = ! 0 ) , t . latest && ( r . latest = ! 0 ) , t . open_revs && ( "all" !== t . open_revs && ( t . open_revs = JSON . stringify ( t . open_revs ) ) , r . open_revs = t . open_revs ) , t . rev && ( r . rev = t . rev ) , t . conflicts && ( r . conflicts = t . conflicts ) , t . update_seq && ( r . update_seq = t . update_seq ) , e = yn ( e ) , c ( gn ( o , e + bn ( r ) ) ) . then ( ( function ( e ) { return Promise . resolve ( ) . then ( ( function ( ) { if ( t . attachments ) return n = e . data , Array . isArray ( n ) ? Promise . all ( n . map ( ( function ( e ) { if ( e . ok ) return i ( e . ok ) ; } ) ) ) : i ( n ) ; var n ; } ) ) . then ( ( function ( ) { n ( null , e . data ) ; } ) ) ; } ) ) . catch ( ( function ( t ) { t . docId = e , n ( t ) ; } ) ) ; } ) ) , r . remove = u ( "remove" , ( function ( e , t , n , r ) { var i ; "string" == typeof t ? ( i = { _id : e , _rev : t } , "function" == typeof n && ( r = n , n = { } ) ) : ( i = e , "function" == typeof t ? ( r = t , n = { } ) : ( r = n , n = t ) ) ; var s = i . _rev || n . rev ; c ( gn ( o , yn ( i . _id ) ) + "?rev=" + s , { method : "DELETE" } , r ) . catch ( r ) ; } ) ) , r . getAttachment = u ( "getAttachment" , ( function ( e , t , n , r ) { "function" == typeof n && ( r = n , n = { } ) ; var i , s = n . rev ? "?rev=" + n . rev : "" , u = gn ( o , yn ( e ) ) + "/" + l ( t ) + s ; a ( u , { method : "GET" } ) . then ( ( function ( e ) { if ( i = e . headers . get ( "content-type" ) , e . ok ) return "undefined" == typeof process || process . browser || "function" != typeof e . buffer ? e . blob ( ) : e . buffer ( ) ; throw e ; } ) ) . then ( ( function ( e ) { "undefined" == typeof process || process . browser || ( e . type = i ) , r ( null , e ) ; } ) ) . catch ( ( function ( e ) { r ( e ) ; } ) ) ; } ) ) , r . removeAttachment = u ( "removeAttachment" , ( function ( e , t , n , r ) { c ( gn ( o , yn ( e ) + "/" + l ( t ) ) + "?rev=" + n , { method : "DELETE" } , r ) . catch ( r ) ; } ) ) , r . putAttachment = u ( "putAttachment" , ( function ( e , t , n , r , i , s ) { "function" == typeof i && ( s = i , i = r , r = n , n = null ) ; var a = yn ( e ) + "/" + l ( t ) , u = gn ( o , a ) ; if ( n && ( u += "?rev=" + n ) , "string" == typeof r ) { var f ; try { f = ve ( r ) ; } catch ( e ) { return s ( ee ( V , "Attachment is not a valid base64 string" ) ) ; } r = f ? me ( f , i ) : "" ; } c ( u , { headers : new ot ( { "Content-Type" : i } ) , method : "PUT" , body : r } , s ) . catch ( s ) ; } ) ) , r . _bulkDocs = function ( e , t , n ) { e . new_edits = t . new_edits , f ( ) . then ( ( function ( ) { return Promise . all ( e . docs . map ( _n ) ) ; } ) ) . then ( ( function ( ) { return c ( gn ( o , "_bulk_docs" ) , { method : "POST" , body : JSON . stringify ( e ) } , n ) ; } ) ) . catch ( n ) ; } , r . _put = function ( e , t , n ) { f ( ) . then ( ( function ( ) { return _n ( e ) ; } ) ) . then ( ( function ( ) { return c ( gn ( o , yn ( e . _id ) ) , { method : "PUT" , body : JSON . stringify ( e ) } ) ; } ) ) . then ( ( function ( e ) { n ( null , e . data ) ; } ) ) . catch ( ( function ( t ) { t . docId = e && e . _id , n ( t ) ; } ) ) ; } , r . allDocs = u ( "allDocs" , ( function ( e , t ) { "function" == typeof e && ( t = e , e = { } ) ; var n , r = { } , i = "GET" ; ( e = O ( e ) ) . conflicts && ( r . conflicts = ! 0 ) , e . update_seq && ( r . update_seq = ! 0 ) , e . descending && ( r . descending = ! 0 ) , e . include_docs && ( r . include_docs = ! 0 ) , e . attachments && ( r . attachments = ! 0 ) , e . key && ( r . key = JSON . stringify ( e . key ) ) , e . start_key && ( e . startkey = e . start_key ) , e . startkey && ( r . startkey = JSON . stringify ( e . startkey ) ) , e . end_key && ( e . endkey = e . end_key ) , e . endkey && ( r . endkey = JSON . stringify ( e . endkey ) ) , void 0 !== e . inclusive_end && ( r . inclusive_end = ! ! e . inclusive_end ) , void 0 !== e . limit && ( r . limit = e . limit ) , void 0 !== e . skip && ( r . skip = e . skip ) ; var s = bn ( r ) ; void 0 !== e . keys && ( i = "POST" , n = { keys : e . keys } ) , c ( gn ( o , "_all_docs" + s ) , { method : i , body : JSON . stringify ( n ) } ) . then ( ( function ( n ) { e . include_docs && e . attachments && e . binary && n . data . rows . forEach ( vn ) , t ( null , n . data ) ; } ) ) . catch ( t ) ; } ) ) , r . _changes = function ( e ) { var n = "batch_size" in e ? e . batch_size : 25 ; ( e = O ( e ) ) . continuous && ! ( "heartbeat" in e ) && ( e . heartbeat = 1e4 ) ; var r = "timeout" in e ? e . timeout : 3e4 ; "timeout" in e && e . timeout && r - e . timeout < hn && ( r = e . timeout + hn ) , "heartbeat" in e && e . heartbeat && r - e . heartbeat < hn && ( r = e . heartbeat + hn ) ; var i = { } ; "timeout" in e && e . timeout && ( i . timeout = e . timeout ) ; var s = void 0 !== e . limit && e . limit , a = s ; if ( e . style && ( i . style = e . style ) , ( e . include_docs || e . filter && "function" == typeof e . filter ) && ( i . include_docs = ! 0 ) , e . attachments && ( i . attachments = ! 0 ) , e . continuous && ( i . feed = "longpoll" ) , e . seq_interval && ( i . seq_interval = e . seq_interval ) , e . conflicts && ( i . conflicts = ! 0 ) , e . descending && ( i . descending = ! 0 ) , e . update_seq && ( i . update_seq = ! 0 ) , "heartbeat" in e && e . heartbeat && ( i . heartbeat = e . heartbeat ) , e . filter && "string" == typeof e . filter && ( i . filter = e . filter ) , e . view && "string" == typeof e . view && ( i . filter = "_view" , i . view = e . view ) , e . query_params && "object" == typeof e . query_params ) for ( var u in e . query_params ) e . query_params . hasOwnProperty ( u ) && ( i [ u ] = e . query_params [ u ] ) ; var l , d = "GET" ; e . doc_ids ? ( i . filter = "_doc_ids" , d = "POST" , l = { doc_ids : e . doc_ids } ) : e . selector && ( i . filter = "_selector" , d = "POST" , l = { selector : e . selector } ) ; var h , p = new nt , v = function ( t , r ) { if ( ! e . aborted ) { i . since = t , "object" == typeof i . since && ( i . since = JSON . stringify ( i . since ) ) , e . descending ? s && ( i . limit = a ) : i . limit = ! s || a > n ? n : a ; var u = gn ( o , "_changes" + bn ( i ) ) , v = { signal : p . signal , method : d , body : JSON . stringify ( l ) } ; h = t , e . aborted || f ( ) . then ( ( function ( ) { return c ( u , v , r ) ; } ) ) . catch ( r ) ; } } , y = { results : [ ] } , _ = function ( r , o ) { if ( ! e . aborted ) { var i = 0 ; if ( o && o . results ) { i = o . results . length , y . last_seq = o . last_seq ; var u = null , c = null ; "number" == typeof o . pending && ( u = o . pending ) , "string" != typeof y . last_seq && "number" != typeof y . last_seq || ( c = y . last_seq ) , e . query_params , o . results = o . results . filter ( ( function ( t ) { a -- ; var n = ne ( e ) ( t ) ; return n && ( e . include_docs && e . attachments && e . binary && vn ( t ) , e . return_docs && y . results . push ( t ) , e . onChange ( t , u , c ) ) , n ; } ) ) ; } else if ( r ) return e . aborted = ! 0 , void e . complete ( r ) ; o && o . last_seq && ( h = o . last_seq ) ; var f = s && a <= 0 || o && i < n || e . descending ; ( ! e . continuous || s && a <= 0 ) && f ? e . complete ( null , y ) : t ( ) ( ( function ( ) { v ( h , _ ) ; } ) ) ; } } ; return v ( e . since || 0 , _ ) , { cancel : function ( ) { e . aborted = ! 0 , p . abort ( ) ; } } ; } , r . revsDiff = u ( "revsDiff" , ( function ( e , t , n ) { "function" == typeof t && ( n = t , t = { } ) , c ( gn ( o , "_revs_diff" ) , { method : "POST" , body : JSON . stringify ( e ) } , n ) . catch ( n ) ; } ) ) , r . _close = function ( e ) { e ( ) ; } , r . _destroy = function ( e , t ) { c ( gn ( o , "" ) , { method : "DELETE" } ) . then ( ( function ( e ) { t ( null , e ) ; } ) ) . catch ( ( function ( e ) { 404 === e . status ? t ( null , { ok : ! 0 } ) : t ( e ) ; } ) ) ; } ; } function kn ( e ) { this . status = 400 , this . name = "query_parse_error" , this . message = e , this . error = ! 0 ; try { Error . captureStackTrace ( this , kn ) ; } catch ( e ) { } } function jn ( e ) { this . status = 404 , this . name = "not_found" , this . message = e , this . error = ! 0 ; try { Error . captureStackTrace ( this , jn ) ; } catch ( e ) { } } function On ( e ) { this . status = 500 , this . name = "invalid_value" , this . message = e , this . error = ! 0 ; try { Error . captureStackTrace ( this , On ) ; } catch ( e ) { } } function An ( e , n ) { return n && e . then ( ( function ( e ) { t ( ) ( ( function ( ) { n ( null , e ) ; } ) ) ; } ) , ( function ( e ) { t ( ) ( ( function ( ) { n ( e ) ; } ) ) ; } ) ) , e ; } function qn ( e , t ) { return function ( ) { var n = arguments , r = this ; return e . add ( ( function ( ) { return t . apply ( r , n ) ; } ) ) ; } ; } function Sn ( e ) { var t = new s ( e ) , n = new Array ( t . size ) , r = - 1 ; return t . forEach ( ( function ( e ) { n [ ++ r ] = e ; } ) ) , n ; } function xn ( e ) { var t = new Array ( e . size ) , n = - 1 ; return e . forEach ( ( function ( e , r ) { t [ ++ n ] = r ; } ) ) , t ; } function En ( e ) { return new On ( "builtin " + e + " function requires map values to be numbers or number arrays" ) ; } function Cn ( e ) { for ( var t = 0 , n = 0 , r = e . length ; n < r ; n ++ ) { var o = e [ n ] ; if ( "number" != typeof o ) { if ( ! Array . isArray ( o ) ) throw En ( "_sum" ) ; t = "number" == typeof t ? [ t ] : t ; for ( var i = 0 , s = o . length ; i < s ; i ++ ) { var a = o [ i ] ; if ( "number" != typeof a ) throw En ( "_sum" ) ; void 0 === t [ i ] ? t . push ( a ) : t [ i ] += a ; } } else "number" == typeof t ? t += o : t [ 0 ] += o ; } return t ; } wn . valid = function ( ) { return ! 0 ; } , p ( ) ( kn , Error ) , p ( ) ( jn , Error ) , p ( ) ( On , Error ) ; var Pn = $ . bind ( null , "log" ) , Ln = Array . isArray , Dn = JSON . parse ; function $n ( e , t ) { return he ( "return (" + e . replace ( /;\s*$/ , "" ) + ");" , { emit : t , sum : Cn , log : Pn , isArray : Ln , toJSON : Dn } ) ; } function In ( ) { this . promise = new Promise ( ( function ( e ) { e ( ) ; } ) ) ; } function Bn ( e ) { if ( ! e ) return "undefined" ; switch ( typeof e ) { case "function" : case "string" : return e . toString ( ) ; default : return JSON . stringify ( e ) ; } } function Rn ( e , t , n , r , o , i ) { var s , a = function ( e , t ) { return Bn ( e ) + Bn ( t ) + "undefined" ; } ( n , r ) ; if ( ! o && ( s = e . _cachedViews = e . _cachedViews || { } ) [ a ] ) return s [ a ] ; var u = e . info ( ) . then ( ( function ( u ) { var c = u . db_name + "-mrview-" + ( o ? "temp" : xe ( a ) ) ; return pe ( e , "_local/" + i , ( function ( e ) { e . views = e . views || { } ; var n = t ; - 1 === n . indexOf ( "/" ) && ( n = t + "/" + t ) ; var r = e . views [ n ] = e . views [ n ] || { } ; if ( ! r [ c ] ) return r [ c ] = ! 0 , e ; } ) ) . then ( ( function ( ) { return e . registerDependentDatabase ( c ) . then ( ( function ( t ) { var o = t . db ; o . auto_compaction = ! 0 ; var i = { name : c , db : o , sourceDB : e , adapter : e . adapter , mapFun : n , reduceFun : r } ; return i . db . get ( "_local/lastSeq" ) . catch ( ( function ( e ) { if ( 404 !== e . status ) throw e ; } ) ) . then ( ( function ( e ) { return i . seq = e ? e . seq : 0 , s && i . db . once ( "destroyed" , ( function ( ) { delete s [ a ] ; } ) ) , i ; } ) ) ; } ) ) ; } ) ) ; } ) ) ; return s && ( s [ a ] = u ) , u ; } In . prototype . add = function ( e ) { return this . promise = this . promise . catch ( ( function ( ) { } ) ) . then ( ( function ( ) { return e ( ) ; } ) ) , this . promise ; } , In . prototype . finish = function ( ) { return this . promise ; } ; var Tn = { } , Mn = new In ; function Nn ( e ) { return - 1 === e . indexOf ( "/" ) ? [ e , e ] : e . split ( "/" ) ; } function Un ( e , t ) { try { e . emit ( "error" , t ) ; } catch ( e ) { $ ( "error" , "The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function." ) , $ ( "error" , t ) ; } } var Fn = function ( e , t ) { return Cn ( t ) ; } , Kn = function ( e , t ) { return t . length ; } , Jn = function ( e , t ) { return { sum : Cn ( t ) , min : Math . min . apply ( null , t ) , max : Math . max . apply ( null , t ) , count : t . length , sumsqr : function ( e ) { for ( var t = 0 , n = 0 , r = e . length ; n < r ; n ++ ) { var o = e [ n ] ; t += o * o ; } return t ; } ( t ) } ; } , zn = function ( e , n , r , o ) { function i ( e , t , n ) { try { t ( n ) ; } catch ( t ) { Un ( e , t ) ; } } function u ( e , t , n , r , o ) { try { return { output : t ( n , r , o ) } ; } catch ( t ) { return Un ( e , t ) , { error : t } ; } } function c ( e , t ) { var n = vt ( e . key , t . key ) ; return 0 !== n ? n : vt ( e . value , t . value ) ; } function f ( e , t , n ) { return n = n || 0 , "number" == typeof t ? e . slice ( n , t + n ) : n > 0 ? e . slice ( n ) : e ; } function l ( e ) { var t = e . value ; return t && "object" == typeof t && t . _id || e . id ; } function h ( e ) { return function ( t ) { return e . include_docs && e . attachments && e . binary && function ( e ) { e . rows . forEach ( ( function ( e ) { var t = e . doc && e . doc . _attachments ; t && Object . keys ( t ) . forEach ( ( function ( e ) { var n = t [ e ] ; t [ e ] . data = be ( n . data , n . content_type ) ; } ) ) ; } ) ) ; } ( t ) , t ; } ; } function p ( e , t , n , r ) { var o = t [ e ] ; void 0 !== o && ( r && ( o = encodeURIComponent ( JSON . stringify ( o ) ) ) , n . push ( e + "=" + o ) ) ; } function v ( e ) { if ( void 0 !== e ) { var t = Number ( e ) ; return isNaN ( t ) || t !== parseInt ( e , 10 ) ? e : t ; } } function y ( e , t ) { var n = e . descending ? "endkey" : "startkey" , r = e . descending ? "startkey" : "endkey" ; if ( void 0 !== e [ n ] && void 0 !== e [ r ] && vt ( e [ n ] , e [ r ] ) > 0 ) throw new kn ( "No rows can match your key range, reverse your start_key and end_key or set {descending : true}" ) ; if ( t . reduce && ! 1 !== e . reduce ) { if ( e . include_docs ) throw new kn ( "{include_docs:true} is invalid for reduce" ) ; if ( e . keys && e . keys . length > 1 && ! e . group && ! e . group_level ) throw new kn ( "Multi-key fetches for reduce views must use {group: true}" ) ; } [ "group_level" , "limit" , "skip" ] . forEach ( ( function ( t ) { var n = function ( e ) { if ( e ) { if ( "number" != typeof e ) return new kn ( 'Invalid value for integer: "' + e + '"' ) ; if ( e < 0 ) return new kn ( 'Invalid value for positive integer: "' + e + '"' ) ; } } ( e [ t ] ) ; if ( n ) throw n ; } ) ) ; } function _ ( e ) { return function ( t ) { if ( 404 === t . status ) return e ; throw t ; } ; } function g ( e ) { var t = "string" == typeof e ? e : e . name , n = Tn [ t ] ; return n || ( n = Tn [ t ] = new In ) , n ; } function m ( e ) { return qn ( g ( e ) , ( function ( ) { return function ( e ) { var t , n ; var r = function ( e , t ) { if ( "function" == typeof e && 2 === e . length ) { var n = e ; return function ( e ) { return n ( e , t ) ; } ; } return $n ( e . toString ( ) , t ) ; } ( e . mapFun , ( function ( e , r ) { var o = { id : n . _id , key : yt ( e ) } ; null != r && ( o . value = yt ( r ) ) , t . push ( o ) ; } ) ) , o = e . seq || 0 ; function u ( t , n ) { return function ( ) { return function ( e , t , n ) { var r = "_local/lastSeq" ; return e . db . get ( r ) . catch ( _ ( { _id : r , seq : 0 } ) ) . then ( ( function ( r ) { var o = xn ( t ) ; return Promise . all ( o . map ( ( function ( n ) { return function ( e , t , n ) { var r = "_local/doc_" + e , o = { _id : r , keys : [ ] } , i = n . get ( e ) , a = i [ 0 ] ; return ( function ( e ) { return 1 === e . length && /^1-/ . test ( e [ 0 ] . rev ) ; } ( i [ 1 ] ) ? Promise . resolve ( o ) : t . db . get ( r ) . catch ( _ ( o ) ) ) . then ( ( function ( e ) { return function ( e ) { return e . keys . length ? t . db . allDocs ( { keys : e . keys , include_docs : ! 0 } ) : Promise . resolve ( { rows : [ ] } ) ; } ( e ) . then ( ( function ( t ) { return function ( e , t ) { for ( var n = [ ] , r = new s , o = 0 , i = t . rows . length ; o < i ; o ++ ) { var u = t . rows [ o ] . doc ; if ( u && ( n . push ( u ) , r . add ( u . _id ) , u . _deleted = ! a . has ( u . _id ) , ! u . _deleted ) ) { var c = a . get ( u . _id ) ; "value" in c && ( u . value = c . value ) ; } } var f = xn ( a ) ; return f . forEach ( ( function ( e ) { if ( ! r . has ( e ) ) { var t = { _id : e } , o = a . get ( e ) ; "value" in o && ( t . value = o . value ) , n . push ( t ) ; } } ) ) , e . keys = Sn ( f . concat ( e . keys ) ) , n . push ( e ) , n ; } ( e , t ) ; } ) ) ; } ) ) ; } ( n , e , t ) ; } ) ) ) . then ( ( function ( t ) { var o = re ( t ) ; return r . seq = n , o . push ( r ) , e . db . bulkDocs ( { docs : o } ) ; } ) ) ; } ) ) ; } ( e , t , n ) ; } ; } var f = new In ; function l ( ) { return e . sourceDB . changes ( { return_docs : ! 0 , conflicts : ! 0 , include_docs : ! 0 , style : "all_docs" , since : o , limit : 50 } ) . then ( d ) ; } function d ( s ) { var d = s . results ; if ( d . length ) { var p = function ( s ) { for ( var u = new a , f = 0 , l = s . length ; f < l ; f ++ ) { var d = s [ f ] ; if ( "_" !== d . doc . _id [ 0 ] ) { t = [ ] , ( n = d . doc ) . _deleted || i ( e . sourceDB , r , n ) , t . sort ( c ) ; var p = h ( t ) ; u . set ( d . doc . _id , [ p , d . changes ] ) ; } o = d . seq ; } return u ; } ( d ) ; if ( f . add ( u ( p , o ) ) , ! ( d . length < 50 ) ) return l ( ) ; } } function h ( e ) { for ( var t , n = new a , r = 0 , o = e . length ; r < o ; r ++ ) { var i = e [ r ] , s = [ i . key , i . id ] ; r > 0 && 0 === vt ( i . key , t ) && s . push ( r ) , n . set ( _t ( s ) , i ) , t = i . key ; } return n ; } return l ( ) . then ( ( function ( ) { return f . finish ( ) ; } ) ) . then ( ( function ( ) { e . seq = o ; } ) ) ; } ( e ) ; } ) ) ( ) ; } function b ( e , t ) { return qn ( g ( e ) , ( function ( ) { return function ( e , t ) { var n , r = e . reduceFun && ! 1 !== t . reduce , o = t . skip || 0 ; function i ( t ) { return t . include_docs = ! 0 , e . db . allDocs ( t ) . then ( ( function ( e ) { return n = e . total_rows , e . rows . map ( ( function ( e ) { if ( "value" in e . doc && "object" == typeof e . doc . value && null !== e . doc . value ) { var t = Object . keys ( e . doc . value ) . sort ( ) , n = [ "id" , "key" , "value" ] ; if ( ! ( t < n || t > n ) ) return e . doc . value ; } var r = function ( e ) { for ( var t = [ ] , n = [ ] , r = 0 ; ; ) { var o = e [ r ++ ] ; if ( "\0" !== o ) switch ( o ) { case "1" : t . push ( null ) ; break ; case "2" : t . push ( "1" === e [ r ] ) , r ++ ; break ; case "3" : var i = gt ( e , r ) ; t . push ( i . num ) , r += i . length ; break ; case "4" : for ( var s = "" ; ; ) { var a = e [ r ] ; if ( "\0" === a ) break ; s += a , r ++ ; } s = s . replace ( /\u0001\u0001/g , "\0" ) . replace ( /\u0001\u0002/g , "" ) . replace ( /\u0002\u0002/g , "" ) , t . push ( s ) ; break ; case "5" : var u = { element : [ ] , index : t . length } ; t . push ( u . element ) , n . push ( u ) ; break ; case "6" : var c = { element : { } , index : t . length } ; t . push ( c . element ) , n . push ( c ) ; break ; default : throw new Error ( "bad collationIndex or unexpectedly reached end of input: " + o ) ; } else { if ( 1 === t . length ) return t . pop ( ) ; mt ( t , n ) ; } } } ( e . doc . _id ) ; return { key : r [ 0 ] , id : r [ 1 ] , value : "value" in e . doc ? e . doc . value : null } ; } ) ) ; } ) ) ; } function s ( i ) { var s ; if ( s = r ? function ( e , t , n ) { 0 === n . group_level && delete n . group_level ; var r = n . group || n . group_level , o = function ( e ) { var t = e . toString ( ) , n = function ( e ) { if ( /^_sum/ . test ( e ) ) return Fn ; if ( /^_count/ . test ( e ) ) return Kn ; if ( /^_stats/ . test ( e ) ) return Jn ; if ( /^_/ . test ( e ) ) throw new Error ( e + " is not a supported reduce function." ) ; } ( t ) ; return n || $n ( t ) ; } ( e . reduceFun ) , i = [ ] , s = isNaN ( n . group_level ) ? Number . POSITIVE_INFINITY : n . group_level ; t . forEach ( ( function ( e ) { var t = i [ i . length - 1 ] , n = r ? e . key : null ; if ( r && Array . isArray ( n ) && ( n = n . slice ( 0 , s ) ) , t && 0 === vt ( t . groupKey , n ) ) return t . keys . push ( [ e . key , e . id ] ) , void t . values . push ( e . value ) ; i . push ( { keys : [ [ e . key , e . id ] ] , values : [ e . value ] , groupKey : n } ) ; } ) ) , t = [ ] ; for ( var a = 0 , c = i . length ; a < c ; a ++ ) { var l = i [ a ] , d = u ( e . sourceDB , o , l . keys , l . values , ! 1 ) ; if ( d . error && d . error instanceof On ) throw d . error ; t . push ( { value : d . error ? null : d . output , key : l . groupKey } ) ; } return { rows : f ( t , n . limit , n . skip ) } ; } ( e , i , t ) : { total_rows : n , offset : o , rows : i } , t . update_seq && ( s . update_seq = e . seq ) , t . include_docs ) { var c = Sn ( i . map ( l ) ) ; return e . sourceDB . allDocs ( { keys : c , include_docs : ! 0 , conflicts : t . conflicts , attachments : t . attachments , binary : t . binary } ) . then ( ( function ( e ) { var t = new a ; return e . rows . forEach ( ( function ( e ) { t . set ( e . id , e . doc ) ; } ) ) , i . forEach ( ( function ( e ) { var n = l ( e ) , r = t . get ( n ) ; r && ( e . doc = r ) ; } ) ) , s ; } ) ) ; } return s ; } if ( void 0 === t . keys || t . keys . length || ( t . limit = 0 , delete t . keys ) , void 0 !== t . keys ) { var c = t . keys . map ( ( function ( e ) { var n = { startkey : _t ( [ e ] ) , endkey : _t ( [ e , { } ] ) } ; return t . update_seq && ( n . update_seq = ! 0 ) , i ( n ) ; } ) ) ; return Promise . all ( c ) . then ( re ) . then ( s ) ; } var d , h , p = { descending : t . descending } ; if ( t . update_seq && ( p . update_seq = ! 0 ) , "start_key" in t && ( d = t . start_key ) , "startkey" in t && ( d = t . startkey ) , "end_key" in t && ( h = t . end_key ) , "endkey" in t && ( h = t . endkey ) , void 0 !== d && ( p . startkey = t . descending ? _t ( [ d , { } ] ) : _t ( [ d ] ) ) , void 0 !== h ) { var v = ! 1 !== t . inclusive_end ; t . descending && ( v = ! v ) , p . endkey = _t ( v ? [ h , { } ] : [ h ] ) ; } if ( void 0 !== t . key ) { var y = _t ( [ t . key ] ) , _ = _t ( [ t . key , { } ] ) ; p . descending ? ( p . endkey = y , p . startkey = _ ) : ( p . startkey = y , p . endkey = _ ) ; } return r || ( "number" == typeof t . limit && ( p . limit = t . limit ) , p . skip = o ) , i ( p ) . then ( s ) ; } ( e , t ) ; } ) ) ( ) ; } function w ( n , r , o ) { if ( "function" == typeof n . _query ) return function ( e , t , n ) { return new Promise ( ( function ( r , o ) { e . _query ( t , n , ( function ( e , t ) { if ( e ) return o ( e ) ; r ( t ) ; } ) ) ; } ) ) ; } ( n , r , o ) ; if ( ie ( n ) ) return function ( e , t , n ) { var r , o , i , s = [ ] , a = "GET" ; if ( p ( "reduce" , n , s ) , p ( "include_docs" , n , s ) , p ( "attachments" , n , s ) , p ( "limit" , n , s ) , p ( "descending" , n , s ) , p ( "group" , n , s ) , p ( "group_level" , n , s ) , p ( "skip" , n , s ) , p ( "stale" , n , s ) , p ( "conflicts" , n , s ) , p ( "startkey" , n , s , ! 0 ) , p ( "start_key" , n , s , ! 0 ) , p ( "endkey" , n , s , ! 0 ) , p ( "end_key" , n , s , ! 0 ) , p ( "inclusive_end" , n , s ) , p ( "key" , n , s , ! 0 ) , p ( "update_seq" , n , s ) , s = "" === ( s = s . join ( "&" ) ) ? "" : "?" + s , void 0 !== n . keys ) { var u = "keys=" + encodeURIComponent ( JSON . stringify ( n . keys ) ) ; u . length + s . length + 1 <= 2e3 ? s += ( "?" === s [ 0 ] ? "&" : "?" ) + u : ( a = "POST" , "string" == typeof t ? r = { keys : n . keys } : t . keys = n . keys ) ; } if ( "string" == typeof t ) { var c = Nn ( t ) ; return e . fetch ( "_design/" + c [ 0 ] + "/_view/" + c [ 1 ] + s , { headers : new ot ( { "Content-Type" : "application/json" } ) , method : a , body : JSON . stringify ( r ) } ) . then ( ( function ( e ) { return o = e . ok , i = e . status , e . json ( ) ; } ) ) . then ( ( function ( e ) { if ( ! o ) throw e . status = i , te ( e ) ; return e . rows . forEach ( ( function ( e ) { if ( e . value && e . value . error && "builtin_reduce_error" === e . value . error ) throw new Error ( e . reason ) ; } ) ) , e ; } ) ) . then ( h ( n ) ) ; } return r = r || { } , Object . keys ( t ) . forEach ( ( function ( e ) { Array . isArray ( t [ e ] ) ? r [ e ] = t [ e ] : r [ e ] = t [ e ] . toString ( ) ; } ) ) , e . fetch ( "_temp_view" + s , { headers : new ot ( { "Content-Type" : "application/json" } ) , method : "POST" , body : JSON . stringify ( r ) } ) . then ( ( function ( e ) { return o = e . ok , i = e . status , e . json ( ) ; } ) ) . then ( ( function ( e ) { if ( ! o ) throw e . status = i , te ( e ) ; return e ; } ) ) . then ( h ( n ) ) ; } ( n , r , o ) ; if ( "string" != typeof r ) return y ( o , r ) , Mn . add ( ( function ( ) { return Rn ( n , "temp_view/temp_view" , r . map , r . reduce , ! 0 , e ) . then ( ( function ( e ) { return t = m ( e ) . then ( ( function ( ) { return b ( e , o ) ; } ) ) , n = function ( ) { return e . db . destroy ( ) ; } , t . then ( ( function ( e ) { return n ( ) . then ( ( function ( ) { return e ; } ) ) ; } ) , ( function ( e ) { return n ( ) . then ( ( function ( ) { throw e ; } ) ) ; } ) ) ; var t , n ; } ) ) ; } ) ) , Mn . finish ( ) ; var i = r , s = Nn ( i ) , a = s [ 0 ] , u = s [ 1 ] ; return n . get ( "_design/" + a ) . then ( ( function ( r ) { var s = r . views && r . views [ u ] ; if ( ! s ) throw new jn ( "ddoc " + r . _id + " has no view named " + u ) ; return function ( e , t ) { var n = e . views && e . views [ t ] ; if ( "string" != typeof n . map ) throw new jn ( "ddoc " + e . _id + " has no string view named " + t + ", instead found object of type: " + typeof n . map ) ; } ( r , u ) , y ( o , s ) , Rn ( n , i , s . map , s . reduce , ! 1 , e ) . then ( ( function ( e ) { return "ok" === o . stale || "update_after" === o . stale ? ( "update_after" === o . stale && t ( ) ( ( function ( ) { m ( e ) ; } ) ) , b ( e , o ) ) : m ( e ) . then ( ( function ( ) { return b ( e , o ) ; } ) ) ; } ) ) ; } ) ) ; } var k ; return { query : function ( e , t , n ) { var r = this ; "function" == typeof t && ( n = t , t = { } ) , t = t ? function ( e ) { return e . group_level = v ( e . group_level ) , e . limit = v ( e . limit ) , e . skip = v ( e . skip ) , e ; } ( t ) : { } , "function" == typeof e && ( e = { map : e } ) ; var o = Promise . resolve ( ) . then ( ( function ( ) { return w ( r , e , t ) ; } ) ) ; return An ( o , n ) , o ; } , viewCleanup : ( k = function ( ) { var e = this ; return "function" == typeof e . _viewCleanup ? function ( e ) { return new Promise ( ( function ( t , n ) { e . _viewCleanup ( ( function ( e , r ) { if ( e ) return n ( e ) ; t ( r ) ; } ) ) ; } ) ) ; } ( e ) : ie ( e ) ? function ( e ) { return e . fetch ( "_view_cleanup" , { headers : new ot ( { "Content-Type" : "application/json" } ) , method : "POST" } ) . then ( ( function ( e ) { return e . json ( ) ; } ) ) ; } ( e ) : function ( e ) { return e . get ( "_local/mrviews" ) . then ( ( function ( t ) { var n = new a ; Object . keys ( t . views ) . forEach ( ( function ( e ) { var t = Nn ( e ) , r = "_design/" + t [ 0 ] , o = t [ 1 ] , i = n . get ( r ) ; i || ( i = new s , n . set ( r , i ) ) , i . add ( o ) ; } ) ) ; var r = { keys : xn ( n ) , include_docs : ! 0 } ; return e . allDocs ( r ) . then ( ( function ( r ) { var o = { } ; r . rows . forEach ( ( function ( e ) { var r = e . key . substring ( 8 ) ; n . get ( e . key ) . forEach ( ( function ( n ) { var i = r + "/" + n ; t . views [ i ] || ( i = n ) ; var s = Object . keys ( t . views [ i ] ) , a = e . doc && e . doc . views && e . doc . views [ n ] ; s . forEach ( ( function ( e ) { o [ e ] = o [ e ] || a ; } ) ) ; } ) ) ; } ) ) ; var i = Object . keys ( o ) . filter ( ( function ( e ) { return ! o [ e ] ; } ) ) . map ( ( function ( t ) { return qn ( g ( t ) , ( function ( ) { return new e . constructor ( t , e . __opts ) . destroy ( ) ; } ) ) ( ) ; } ) ) ; return Promise . all ( i ) . then ( ( function ( ) { return { ok : ! 0 } ; } ) ) ; } ) ) ; } ) , _ ( { ok : ! 0 } ) ) ; } ( e ) ; } , d ( ) ( ( function ( e ) { var t = e . pop ( ) , n = k . apply ( this , e ) ; return "function" == typeof t && An ( n , t ) , n ; } ) ) ) } ; } ( "mrviews" ) , Vn = { query : function ( e , t , n ) { return zn . query . call ( this , e , t , n ) ; } , viewCleanup : function ( e ) { return zn . viewCleanup . call ( this , e ) ; } } ; function Gn ( e ) { return /^1-/ . test ( e ) ; } function Qn ( e , t ) { var n = Object . keys ( t . _attachments ) ; return Promise . all ( n . map ( ( function ( n ) { return e . getAttachment ( t . _id , n , { rev : t . _rev } ) ; } ) ) ) ; } function Wn ( e , t , n , r ) { n = O ( n ) ; var o = [ ] , i = ! 0 ; return Promise . resolve ( ) . then ( ( function ( ) { var t = Object . keys ( n ) . filter ( ( function ( e ) { var t = n [ e ] . missing ; return 1 === t . length && Gn ( t [ 0 ] ) ; } ) ) ; if ( t . length > 0 ) return function ( t ) { return e . allDocs ( { keys : t , include_docs : ! 0 , conflicts : ! 0 } ) . then ( ( function ( e ) { if ( r . cancelled ) throw new Error ( "cancelled" ) ; e . rows . forEach ( ( function ( e ) { var t ; e . deleted || ! e . doc || ! Gn ( e . value . rev ) || ( t = e . doc ) . _attachments && Object . keys ( t . _attachments ) . length > 0 || function ( e ) { return e . _conflicts && e . _conflicts . length > 0 ; } ( e . doc ) || ( e . doc . _conflicts && delete e . doc . _conflicts , o . push ( e . doc ) , delete n [ e . id ] ) ; } ) ) ; } ) ) ; } ( t ) ; } ) ) . then ( ( function ( ) { var s = function ( e ) { var t = [ ] ; return Object . keys ( e ) . forEach ( ( function ( n ) { e [ n ] . missing . forEach ( ( function ( e ) { t . push ( { id : n , rev : e } ) ; } ) ) ; } ) ) , { docs : t , revs : ! 0 , latest : ! 0 } ; } ( n ) ; if ( s . docs . length ) return e . bulkGet ( s ) . then ( ( function ( n ) { if ( r . cancelled ) throw new Error ( "cancelled" ) ; return Promise . all ( n . results . map ( ( function ( n ) { return Promise . all ( n . docs . map ( ( function ( n ) { var r = n . ok ; return n . error && ( i = ! 1 ) , r && r . _attachments ? function ( e , t , n ) { var r = ie ( t ) && ! ie ( e ) , o = Object . keys ( n . _attachments ) ; return r ? e . get ( n . _id ) . then ( ( function ( r ) { return Promise . all ( o . map ( ( function ( o ) { return function ( e , t , n ) { return ! e . _attachments || ! e . _attachments [ n ] || e . _attachments [ n ] . digest !== t . _attachments [ n ] . digest ; } ( r , n , o ) ? t . getAttachment ( n . _id , o ) : e . getAttachment ( r . _id , o ) ; } ) ) ) ; } ) ) . catch ( ( function ( e ) { if ( 404 !== e . status ) throw e ; return Qn ( t , n ) ; } ) ) : Qn ( t , n ) ; } ( t , e , r ) . then ( ( function ( e ) { var t = Object . keys ( r . _attachments ) ; return e . forEach ( ( function ( e , n ) { var o = r . _attachments [ t [ n ] ] ; delete o . stub , delete o . length , o . data = e ; } ) ) , r ; } ) ) : r ; } ) ) ) ; } ) ) ) . then ( ( function ( e ) { o = o . concat ( re ( e ) . filter ( Boolean ) ) ; } ) ) ; } ) ) ; } ) ) . then ( ( function ( ) { return { ok : i , docs : o } ; } ) ) ; } var Yn = "pouchdb" ; function Hn ( e , t , n , r , o ) { return e . get ( t ) . catch ( ( function ( n ) { if ( 404 === n . status ) return "http" !== e . adapter && "https" !== e . adapter || B ( 404 , "PouchDB is just checking if a remote checkpoint exists." ) , { session_id : r , _id : t , history : [ ] , replicator : Yn , version : 1 } ; throw n ; } ) ) . then ( ( function ( i ) { if ( ! o . cancelled && i . last_seq !== n ) return i . history = ( i . history || [ ] ) . filter ( ( function ( e ) { return e . session_id !== r ; } ) ) , i . history . unshift ( { last_seq : n , session_id : r } ) , i . history = i . history . slice ( 0 , 5 ) , i . version = 1 , i . replicator = Yn , i . session_id = r , i . last_seq = n , e . put ( i ) . catch ( ( function ( i ) { if ( 409 === i . status ) return Hn ( e , t , n , r , o ) ; throw i ; } ) ) ; } ) ) ; } function Xn ( e , t , n , r , o ) { this . src = e , this . target = t , this . id = n , this . returnValue = r , this . opts = o || { } ; } Xn . prototype . writeCheckpoint = function ( e , t ) { var n = this ; return this . updateTarget ( e , t ) . then ( ( function ( ) { return n . updateSource ( e , t ) ; } ) ) ; } , Xn . prototype . updateTarget = function ( e , t ) { return this . opts . writeTargetCheckpoint ? Hn ( this . target , this . id , e , t , this . returnValue ) : Promise . resolve ( ! 0 ) ; } , Xn . prototype . updateSource = function ( e , t ) { if ( this . opts . writeSourceCheckpoint ) { var n = this ; return Hn ( this . src , this . id , e , t , this . returnValue ) . catch ( ( function ( e ) { if ( nr ( e ) ) return n . opts . writeSourceCheckpoint = ! 1 , ! 0 ; throw e ; } ) ) ; } return Promise . resolve ( ! 0 ) ; } ; var Zn = { undefined : function ( e , t ) { return 0 === vt ( e . last_seq , t . last_seq ) ? t . last_seq : 0 ; } , 1 : function ( e , t ) { return ( n = t , r = e , n . session_id === r . session_id ? { last_seq : n . last_seq , history : n . history } : er ( n . history , r . history ) ) . last_seq ; var n , r ; } } ; function er ( e , t ) { var n = e [ 0 ] , r = e . slice ( 1 ) , o = t [ 0 ] , i = t . slice ( 1 ) ; return n && 0 !== t . length ? tr ( n . session_id , t ) ? { last_seq : n . last_seq , history : e } : tr ( o . session_id , r ) ? { last_seq : o . last_seq , history : i } : er ( r , i ) : { last_seq : 0 , history : [ ] } ; } function tr ( e , t ) { var n = t [ 0 ] , r = t . slice ( 1 ) ; return ! ( ! e || 0 === t . length ) && ( e === n . session_id || tr ( e , r ) ) ; } function nr ( e ) { return "number" == typeof e . status && 4 === Math . floor ( e . status / 100 ) ; } function rr ( e , n , r , o , i ) { var s , a , u , c = [ ] , f = { seq : 0 , changes : [ ] , docs : [ ] } , l = ! 1 , d = ! 1 , h = ! 1 , p = 0 , v = r . continuous || r . live || ! 1 , y = r . batch_size || 100 , _ = r . batches_limit || 10 , g = ! 1 , m = r . doc_ids , b = r . selector , w = [ ] , k = Ce ( ) ; i = i || { ok : ! 0 , start_time : ( new Date ) . toISOString ( ) , docs_read : 0 , docs_written : 0 , doc_write_failures : 0 , errors : [ ] } ; var j = { } ; function A ( ) { return u ? Promise . resolve ( ) : function ( e , t , n ) { var r = n . doc_ids ? n . doc_ids . sort ( vt ) : "" , o = n . filter ? n . filter . toString ( ) : "" , i = "" , s = "" , a = "" ; return n . selector && ( a = JSON . stringify ( n . selector ) ) , n . filter && n . query_params && ( i = JSON . stringify ( function ( e ) { return Object . keys ( e ) . sort ( vt ) . reduce ( ( function ( t , n ) { return t [ n ] = e [ n ] , t ; } ) , { } ) ; } ( n . query_params ) ) ) , n . filter && "_view" === n . filter && ( s = n . view . toString ( ) ) , Promise . all ( [ e . id ( ) , t . id ( ) ] ) . then ( ( function ( e ) { var t = e [ 0 ] + e [ 1 ] + o + s + i + r + a ; return new Promise ( ( function ( e ) { Se ( t , e ) ; } ) ) ; } ) ) . then ( ( function ( e ) { return "_local/" + e . replace ( /\//g , "." ) . replace ( /\+/g , "_" ) ; } ) ) ; } ( e , n , r ) . then ( ( function ( t ) { a = t ; var i ; i = ! 1 === r . checkpoint ? { writeSourceCheckpoint : ! 1 , writeTargetCheckpoint : ! 1 } : "source" === r . checkpoint ? { writeSourceCheckpoint : ! 0 , writeTargetCheckpoint : ! 1 } : "target" === r . checkpoint ? { writeSourceCheckpoint : ! 1 , writeTargetCheckpoint : ! 0 } : { writeSourceCheckpoint : ! 0 , writeTargetCheckpoint : ! 0 } , u = new Xn ( e , n , a , o , i ) ; } ) ) ; } function q ( ) { if ( w = [ ] , 0 !== s . docs . length ) { var e = s . docs , t = { timeout : r . timeout } ; return n . bulkDocs ( { docs : e , new_edits : ! 1 } , t ) . then ( ( function ( t ) { if ( o . cancelled ) throw L ( ) , new Error ( "cancelled" ) ; var n = Object . create ( null ) ; t . forEach ( ( function ( e ) { e . error && ( n [ e . id ] = e ) ; } ) ) ; var r = Object . keys ( n ) . length ; i . doc_write_failures += r , i . docs_written += e . length - r , e . forEach ( ( function ( e ) { var t = n [ e . _id ] ; if ( t ) { i . errors . push ( t ) ; var r = ( t . name || "" ) . toLowerCase ( ) ; if ( "unauthorized" !== r && "forbidden" !== r ) throw t ; o . emit ( "denied" , O ( t ) ) ; } else w . push ( e ) ; } ) ) ; } ) , ( function ( t ) { throw i . doc_write_failures += e . length , t ; } ) ) ; } } function S ( ) { if ( s . error ) throw new Error ( "There was a problem getting docs." ) ; i . last_seq = p = s . seq ; var e = O ( i ) ; return w . length && ( e . docs = w , "number" == typeof s . pending && ( e . pending = s . pending , delete s . pending ) , o . emit ( "change" , e ) ) , l = ! 0 , u . writeCheckpoint ( s . seq , k ) . then ( ( function ( ) { if ( l = ! 1 , o . cancelled ) throw L ( ) , new Error ( "cancelled" ) ; s = void 0 , R ( ) ; } ) ) . catch ( ( function ( e ) { throw M ( e ) , e ; } ) ) ; } function x ( ) { return Wn ( e , n , s . diffs , o ) . then ( ( function ( e ) { s . error = ! e . ok , e . docs . forEach ( ( function ( e ) { delete s . diffs [ e . _id ] , i . docs_read ++ , s . docs . push ( e ) ; } ) ) ; } ) ) ; } function E ( ) { var e ; o . cancelled || s || ( 0 !== c . length ? ( s = c . shift ( ) , ( e = { } , s . changes . forEach ( ( function ( t ) { "_user/" !== t . id && ( e [ t . id ] = t . changes . map ( ( function ( e ) { return e . rev ; } ) ) ) ; } ) ) , n . revsDiff ( e ) . then ( ( function ( e ) { if ( o . cancelled ) throw L ( ) , new Error ( "cancelled" ) ; s . diffs = e ; } ) ) ) . then ( x ) . then ( q ) . then ( S ) . then ( E ) . catch ( ( function ( e ) { P ( "batch processing terminated with error" , e ) ; } ) ) ) : C ( ! 0 ) ) ; } function C ( e ) { 0 !== f . changes . length ? ( e || d || f . changes . length >= y ) && ( c . push ( f ) , f = { seq : 0 , changes : [ ] , docs : [ ] } , "pending" !== o . state && "stopped" !== o . state || ( o . state = "active" , o . emit ( "active" ) ) , E ( ) ) : 0 !== c . length || s || ( ( v && j . live || d ) && ( o . state = "pending" , o . emit ( "paused" ) ) , d && L ( ) ) ; } function P ( e , t ) { h || ( t . message || ( t . message = e ) , i . ok = ! 1 , i . status = "aborting" , c = [ ] , f = { seq : 0 , changes : [ ] , docs : [ ] } , L ( t ) ) ; } function L ( t ) { if ( ! ( h || o . cancelled && ( i . status = "cancelled" , l ) ) ) if ( i . status = i . status || "complete" , i . end_time = ( new Date ) . toISOString ( ) , i . last_seq = p , h = ! 0 , t ) { ( t = ee ( t ) ) . result = i ; var s = ( t . name || "" ) . toLowerCase ( ) ; "unauthorized" === s || "forbidden" === s ? ( o . emit ( "error" , t ) , o . removeAllListeners ( ) ) : function ( e , t , n , r ) { if ( ! 1 === e . retry ) return t . emit ( "error" , n ) , void t . removeAllListeners ( ) ; if ( "function" != typeof e . back_off_function && ( e . back_off_function = I ) , t . emit ( "requestError" , n ) , "active" === t . state || "pending" === t . state ) { t . emit ( "paused" , n ) , t . state = "stopped" ; var o = function ( ) { e . current_back_off = 0 ; } ; t . once ( "paused" , ( function ( ) { t . removeListener ( "active" , o ) ; } ) ) , t . once ( "active" , o ) ; } e . current_back_off = e . current_back_off || 0 , e . current_back_off = e . back_off_function ( e . current_back_off ) , setTimeout ( r , e . current_back_off ) ; } ( r , o , t , ( function ( ) { rr ( e , n , r , o ) ; } ) ) ; } else o . emit ( "complete" , i ) , o . removeAllListeners ( ) ; } function D ( e , n , i ) { if ( o . cancelled ) return L ( ) ; "number" == typeof n && ( f . pending = n ) , ne ( r ) ( e ) && ( f . seq = e . seq || i , f . changes . push ( e ) , t ( ) ( ( function ( ) { C ( 0 === c . length && j . live ) ; } ) ) ) ; } function $ ( e ) { if ( g = ! 1 , o . cancelled ) return L ( ) ; if ( e . results . length > 0 ) j . since = e . results [ e . results . length - 1 ] . seq , R ( ) , C ( ! 0 ) ; else { var t = function ( ) { v ? ( j . live = ! 0 , R ( ) ) : d = ! 0 , C ( ! 0 ) ; } ; s || 0 !== e . results . length ? t ( ) : ( l = ! 0 , u . writeCheckpoint ( e . last_seq , k ) . then ( ( function ( ) { l = ! 1 , i . last_seq = p = e . last_seq , t ( ) ; } ) ) . catch ( M ) ) ; } } function B ( e ) { if ( g = ! 1 , o . cancelled ) return L ( ) ; P ( "changes rejected" , e ) ; } function R ( ) { if ( ! g && ! d && c . length < _ ) { g = ! 0 , o . _changes && ( o . removeListener ( "cancel" , o . _abortChanges ) , o . _changes . cancel ( ) ) , o . once ( "cancel" , n ) ; var t = e . changes ( j ) . on ( "change" , D ) ; t . then ( i , i ) , t . then ( $ ) . catch ( B ) , r . retry && ( o . _changes = t , o . _abortChanges = n ) ; } function n ( ) { t . cancel ( ) ; } function i ( ) { o . removeListener ( "cancel" , n ) ; } } function T ( ) { A ( ) . then ( ( function ( ) { if ( ! o . cancelled ) return u . getCheckpoint ( ) . then ( ( function ( e ) { j = { since : p = e , limit : y , batch_size : y , style : "all_docs" , doc_ids : m , selector : b , return_docs : ! 0 } , r . filter && ( "string" != typeof r . filter ? j . include_docs = ! 0 : j . filter = r . filter ) , "heartbeat" in r && ( j . heartbeat = r . heartbeat ) , "timeout" in r && ( j . timeout = r . timeout ) , r . query_params && ( j . query_params = r . query_params ) , r . view && ( j . view = r . view ) , R ( ) ; } ) ) ; L ( ) ; } ) ) . catch ( ( function ( e ) { P ( "getCheckpoint rejected with " , e ) ; } ) ) ; } function M ( e ) { l = ! 1 , P ( "writeCheckpoint completed with error" , e ) ; } o . ready ( e , n ) , o . cancelled ? L ( ) : ( o . _addedListeners || ( o . once ( "cancel" , L ) , "function" == typeof r . complete && ( o . once ( "error" , r . complete ) , o . once ( "complete" , ( function ( e ) { r . complete ( null , e ) ; } ) ) ) , o . _addedListeners = ! 0 ) , void 0 === r . since ? T ( ) : A ( ) . then ( ( function ( ) { return l = ! 0 , u . writeCheckpoint ( r . since , k ) ; } ) ) . then ( ( function ( ) { l = ! 1 , o . cancelled ? L ( ) : ( p = r . since , T ( ) ) ; } ) ) . catch ( M ) ) ; } function or ( ) { y ( ) . call ( this ) , this . cancelled = ! 1 , this . state = "pending" ; var e = this , t = new Promise ( ( function ( t , n ) { e . once ( "complete" , t ) , e . once ( "error" , n ) ; } ) ) ; e . then = function ( e , n ) { return t . then ( e , n ) ; } , e . catch = function ( e ) { return t . catch ( e ) ; } , e . catch ( ( function ( ) { } ) ) ; } function ir ( e , t ) { var n = t . PouchConstructor ; return "string" == typeof e ? new n ( e , t ) : e ; } function sr ( e , t , n , r ) { if ( "function" == typeof n && ( r = n , n = { } ) , void 0 === n && ( n = { } ) , n . doc_ids && ! Array . isArray ( n . doc_ids ) ) throw ee ( W , "`doc_ids` filter parameter is not a list." ) ; n . complete = r , ( n = O ( n ) ) . continuous = n . continuous || n . live , n . retry = "retry" in n && n . retry , n . PouchConstructor = n . PouchConstructor || this ; var o = new or ( n ) ; return rr ( ir ( e , n ) , ir ( t , n ) , n , o ) , o ; } function ar ( e , t , n , r ) { return "function" == typeof n && ( r = n , n = { } ) , void 0 === n && ( n = { } ) , ( n = O ( n ) ) . PouchConstructor = n . PouchConstructor || this , new ur ( e = ir ( e , n ) , t = ir ( t , n ) , n , r ) ; } function ur ( e , t , n , r ) { var o = this ; this . canceled = ! 1 ; var i = n . push ? R ( { } , n , n . push ) : n , s = n . pull ? R ( { } , n , n . pull ) : n ; function a ( e ) { o . emit ( "change" , { direction : "pull" , change : e } ) ; } function u ( e ) { o . emit ( "change" , { direction : "push" , change : e } ) ; } function c ( e ) { o . emit ( "denied" , { direction : "push" , doc : e } ) ; } function f ( e ) { o . emit ( "denied" , { direction : "pull" , doc : e } ) ; } function l ( ) { o . pushPaused = ! 0 , o . pullPaused && o . emit ( "paused" ) ; } function d ( ) { o . pullPaused = ! 0 , o . pushPaused && o . emit ( "paused" ) ; } function h ( ) { o . pushPaused = ! 1 , o . pullPaused && o . emit ( "active" , { direction : "push" } ) ; } function p ( ) { o . pullPaused = ! 1 , o . pushPaused && o . emit ( "active" , { direction : "pull" } ) ; } this . push = sr ( e , t , i ) , this . pull = sr ( t , e , s ) , this . pushPaused = ! 0 , this . pullPaused = ! 0 ; var v = { } ; function y ( e ) { return function ( t , n ) { ( "change" === t && ( n === a || n === u ) || "denied" === t && ( n === f || n === c ) || "paused" === t && ( n === d || n === l ) || "active" === t && ( n === p || n === h ) ) && ( t in v || ( v [ t ] = { } ) , v [ t ] [ e ] = ! 0 , 2 === Object . keys ( v [ t ] ) . length && o . removeAllListeners ( t ) ) ; } ; } function _ ( e , t , n ) { - 1 == e . listeners ( t ) . indexOf ( n ) && e . on ( t , n ) ; } n . live && ( this . push . on ( "complete" , o . pull . cancel . bind ( o . pull ) ) , this . pull . on ( "complete" , o . push . cancel . bind ( o . push ) ) ) , this . on ( "newListener" , ( function ( e ) { "change" === e ? ( _ ( o . pull , "change" , a ) , _ ( o . push , "change" , u ) ) : "denied" === e ? ( _ ( o . pull , "denied" , f ) , _ ( o . push , "denied" , c ) ) : "active" === e ? ( _ ( o . pull , "active" , p ) , _ ( o . push , "active" , h ) ) : "paused" === e && ( _ ( o . pull , "paused" , d ) , _ ( o . push , "paused" , l ) ) ; } ) ) , this . on ( "removeListener" , ( function ( e ) { "change" === e ? ( o . pull . removeListener ( "change" , a ) , o . push . removeListener ( "change" , u ) ) : "denied" === e ? ( o . pull . removeListener ( "denied" , f ) , o . push . removeListener ( "denied" , c ) ) : "active" === e ? ( o . pull . removeListener ( "active" , p ) , o . push . removeListener ( "active" , h ) ) : "paused" === e && ( o . pull . removeListener ( "paused" , d ) , o . push . removeListener ( "paused" , l ) ) ; } ) ) , this . pull . on ( "removeListener" , y ( "pull" ) ) , this . push . on ( "removeListener" , y ( "push" ) ) ; var g = Promise . all ( [ this . push , this . pull ] ) . then ( ( function ( e ) { var t = { push : e [ 0 ] , pull : e [ 1 ] } ; return o . emit ( "complete" , t ) , r && r ( null , t ) , o . removeAllListeners ( ) , t ; } ) , ( function ( e ) { if ( o . cancel ( ) , r ? r ( e ) : o . emit ( "error" , e ) , o . removeAllListeners ( ) , r ) throw e ; } ) ) ; this . then = function ( e , t ) { return g . then ( e , t ) ; } , this . catch = function ( e ) { return g . catch ( e ) ; } ; } Xn . prototype . getCheckpoint = function ( ) { var e = this ; return e . opts && e . opts . writeSourceCheckpoint && ! e . opts . writeTargetCheckpoint ? e . src . get ( e . id ) . then ( ( function ( e ) { return e . last_seq || 0 ; } ) ) . catch ( ( function ( e ) { if ( 404 !== e . status ) throw e ; return 0 ; } ) ) : e . target . get ( e . id ) . then ( ( function ( t ) { return e . opts && e . opts . writeTargetCheckpoint && ! e . opts . writeSourceCheckpoint ? t . last_seq || 0 : e . src . get ( e . id ) . then ( ( function ( e ) { return t . version !== e . version ? 0 : ( n = t . version ? t . version . toString ( ) : "undefined" ) in Zn ? Zn [ n ] ( t , e ) : 0 ; var n ; } ) , ( function ( n ) { if ( 404 === n . status && t . last_seq ) return e . src . put ( { _id : e . id , last_seq : 0 } ) . then ( ( function ( ) { return 0 ; } ) , ( function ( n ) { return nr ( n ) ? ( e . opts . writeSourceCheckpoint = ! 1 , t . last_seq ) : 0 ; } ) ) ; throw n ; } ) ) ; } ) ) . catch ( ( function ( e ) { if ( 404 !== e . status ) throw e ; return 0 ; } ) ) ; } , p ( ) ( or , y ( ) ) , or . prototype . cancel = function ( ) { this . cancelled = ! 0 , this . state = "cancelled" , this . emit ( "cancel" ) ; } , or . prototype . ready = function ( e , t ) { var n = this ; function r ( ) { n . cancel ( ) ; } n . _readyCalled || ( n . _readyCalled = ! 0 , e . once ( "destroyed" , r ) , t . once ( "destroyed" , r ) , n . once ( "complete" , ( function ( ) { e . removeListener ( "destroyed" , r ) , t . removeListener ( "destroyed" , r ) ; } ) ) ) ; } , p ( ) ( ur , y ( ) ) , ur . prototype . cancel = function ( ) { this . canceled || ( this . canceled = ! 0 , this . push . cancel ( ) , this . pull . cancel ( ) ) ; } , tt . plugin ( ( function ( e ) { e . adapter ( "idb" , dn , ! 0 ) ; } ) ) . plugin ( ( function ( e ) { e . adapter ( "http" , wn , ! 1 ) , e . adapter ( "https" , wn , ! 1 ) ; } ) ) . plugin ( Vn ) . plugin ( ( function ( e ) { e . replicate = sr , e . sync = ar , Object . defineProperty ( e . prototype , "replicate" , { get : function ( ) { var e = this ; return void 0 === this . replicateMethods && ( this . replicateMethods = { from : function ( t , n , r ) { return e . constructor . replicate ( t , e , n , r ) ; } , to : function ( t , n , r ) { return e . constructor . replicate ( e , t , n , r ) ; } } ) , this . replicateMethods ; } } ) , e . prototype . sync = function ( e , t , n ) { return this . constructor . sync ( this , e , t , n ) ; } ; } ) ) ; const cr = tt ; } ) ( ) ; var o = r . o ; export { o as PouchDB } ;