// Compiled by ClojureScript 1.9.562 {}
goog.provide('cljs.core.async');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.channels');
goog.require('cljs.core.async.impl.buffers');
goog.require('cljs.core.async.impl.timers');
goog.require('cljs.core.async.impl.dispatch');
goog.require('cljs.core.async.impl.ioc_helpers');
cljs.core.async.fn_handler = (function cljs$core$async$fn_handler(var_args){
var args39106 = [];
var len__24369__auto___39112 = arguments.length;
var i__24370__auto___39113 = (0);
while(true){
if((i__24370__auto___39113 < len__24369__auto___39112)){
args39106.push((arguments[i__24370__auto___39113]));

var G__39114 = (i__24370__auto___39113 + (1));
i__24370__auto___39113 = G__39114;
continue;
} else {
}
break;
}

var G__39108 = args39106.length;
switch (G__39108) {
case 1:
return cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39106.length)].join('')));

}
});

cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$1 = (function (f){
return cljs.core.async.fn_handler.call(null,f,true);
});

cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2 = (function (f,blockable){
if(typeof cljs.core.async.t_cljs$core$async39109 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39109 = (function (f,blockable,meta39110){
this.f = f;
this.blockable = blockable;
this.meta39110 = meta39110;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_39111,meta39110__$1){
var self__ = this;
var _39111__$1 = this;
return (new cljs.core.async.t_cljs$core$async39109(self__.f,self__.blockable,meta39110__$1));
});

cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_39111){
var self__ = this;
var _39111__$1 = this;
return self__.meta39110;
});

cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});

cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.blockable;
});

cljs.core.async.t_cljs$core$async39109.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.f;
});

cljs.core.async.t_cljs$core$async39109.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"blockable","blockable",-28395259,null),new cljs.core.Symbol(null,"meta39110","meta39110",-1951309069,null)], null);
});

cljs.core.async.t_cljs$core$async39109.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39109.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39109";

cljs.core.async.t_cljs$core$async39109.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async39109");
});

cljs.core.async.__GT_t_cljs$core$async39109 = (function cljs$core$async$__GT_t_cljs$core$async39109(f__$1,blockable__$1,meta39110){
return (new cljs.core.async.t_cljs$core$async39109(f__$1,blockable__$1,meta39110));
});

}

return (new cljs.core.async.t_cljs$core$async39109(f,blockable,cljs.core.PersistentArrayMap.EMPTY));
});

cljs.core.async.fn_handler.cljs$lang$maxFixedArity = 2;

/**
 * Returns a fixed buffer of size n. When full, puts will block/park.
 */
cljs.core.async.buffer = (function cljs$core$async$buffer(n){
return cljs.core.async.impl.buffers.fixed_buffer.call(null,n);
});
/**
 * Returns a buffer of size n. When full, puts will complete but
 *   val will be dropped (no transfer).
 */
cljs.core.async.dropping_buffer = (function cljs$core$async$dropping_buffer(n){
return cljs.core.async.impl.buffers.dropping_buffer.call(null,n);
});
/**
 * Returns a buffer of size n. When full, puts will complete, and be
 *   buffered, but oldest elements in buffer will be dropped (not
 *   transferred).
 */
cljs.core.async.sliding_buffer = (function cljs$core$async$sliding_buffer(n){
return cljs.core.async.impl.buffers.sliding_buffer.call(null,n);
});
/**
 * Returns true if a channel created with buff will never block. That is to say,
 * puts into this buffer will never cause the buffer to be full. 
 */
cljs.core.async.unblocking_buffer_QMARK_ = (function cljs$core$async$unblocking_buffer_QMARK_(buff){
if(!((buff == null))){
if((false) || ((cljs.core.PROTOCOL_SENTINEL === buff.cljs$core$async$impl$protocols$UnblockingBuffer$))){
return true;
} else {
if((!buff.cljs$lang$protocol_mask$partition$)){
return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,buff);
} else {
return false;
}
}
} else {
return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,buff);
}
});
/**
 * Creates a channel with an optional buffer, an optional transducer (like (map f),
 *   (filter p) etc or a composition thereof), and an optional exception handler.
 *   If buf-or-n is a number, will create and use a fixed buffer of that size. If a
 *   transducer is supplied a buffer must be specified. ex-handler must be a
 *   fn of one argument - if an exception occurs during transformation it will be called
 *   with the thrown value as an argument, and any non-nil return value will be placed
 *   in the channel.
 */
cljs.core.async.chan = (function cljs$core$async$chan(var_args){
var args39118 = [];
var len__24369__auto___39121 = arguments.length;
var i__24370__auto___39122 = (0);
while(true){
if((i__24370__auto___39122 < len__24369__auto___39121)){
args39118.push((arguments[i__24370__auto___39122]));

var G__39123 = (i__24370__auto___39122 + (1));
i__24370__auto___39122 = G__39123;
continue;
} else {
}
break;
}

var G__39120 = args39118.length;
switch (G__39120) {
case 0:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0();

break;
case 1:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39118.length)].join('')));

}
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.chan.call(null,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf_or_n){
return cljs.core.async.chan.call(null,buf_or_n,null,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf_or_n,xform){
return cljs.core.async.chan.call(null,buf_or_n,xform,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf_or_n,xform,ex_handler){
var buf_or_n__$1 = ((cljs.core._EQ_.call(null,buf_or_n,(0)))?null:buf_or_n);
if(cljs.core.truth_(xform)){
if(cljs.core.truth_(buf_or_n__$1)){
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Assert failed: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("buffer must be supplied when transducer is"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("\n"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("buf-or-n")].join('')));
}
} else {
}

return cljs.core.async.impl.channels.chan.call(null,((typeof buf_or_n__$1 === 'number')?cljs.core.async.buffer.call(null,buf_or_n__$1):buf_or_n__$1),xform,ex_handler);
});

cljs.core.async.chan.cljs$lang$maxFixedArity = 3;

/**
 * Creates a promise channel with an optional transducer, and an optional
 *   exception-handler. A promise channel can take exactly one value that consumers
 *   will receive. Once full, puts complete but val is dropped (no transfer).
 *   Consumers will block until either a value is placed in the channel or the
 *   channel is closed. See chan for the semantics of xform and ex-handler.
 */
cljs.core.async.promise_chan = (function cljs$core$async$promise_chan(var_args){
var args39125 = [];
var len__24369__auto___39128 = arguments.length;
var i__24370__auto___39129 = (0);
while(true){
if((i__24370__auto___39129 < len__24369__auto___39128)){
args39125.push((arguments[i__24370__auto___39129]));

var G__39130 = (i__24370__auto___39129 + (1));
i__24370__auto___39129 = G__39130;
continue;
} else {
}
break;
}

var G__39127 = args39125.length;
switch (G__39127) {
case 0:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$0();

break;
case 1:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39125.length)].join('')));

}
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.promise_chan.call(null,null);
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$1 = (function (xform){
return cljs.core.async.promise_chan.call(null,xform,null);
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2 = (function (xform,ex_handler){
return cljs.core.async.chan.call(null,cljs.core.async.impl.buffers.promise_buffer.call(null),xform,ex_handler);
});

cljs.core.async.promise_chan.cljs$lang$maxFixedArity = 2;

/**
 * Returns a channel that will close after msecs
 */
cljs.core.async.timeout = (function cljs$core$async$timeout(msecs){
return cljs.core.async.impl.timers.timeout.call(null,msecs);
});
/**
 * takes a val from port. Must be called inside a (go ...) block. Will
 *   return nil if closed. Will park if nothing is available.
 *   Returns true unless port is already closed
 */
cljs.core.async._LT__BANG_ = (function cljs$core$async$_LT__BANG_(port){
throw (new Error("<! used not in (go ...) block"));
});
/**
 * Asynchronously takes a val from port, passing to fn1. Will pass nil
 * if closed. If on-caller? (default true) is true, and value is
 * immediately available, will call fn1 on calling thread.
 * Returns nil.
 */
cljs.core.async.take_BANG_ = (function cljs$core$async$take_BANG_(var_args){
var args39132 = [];
var len__24369__auto___39135 = arguments.length;
var i__24370__auto___39136 = (0);
while(true){
if((i__24370__auto___39136 < len__24369__auto___39135)){
args39132.push((arguments[i__24370__auto___39136]));

var G__39137 = (i__24370__auto___39136 + (1));
i__24370__auto___39136 = G__39137;
continue;
} else {
}
break;
}

var G__39134 = args39132.length;
switch (G__39134) {
case 2:
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39132.length)].join('')));

}
});

cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,fn1){
return cljs.core.async.take_BANG_.call(null,port,fn1,true);
});

cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (port,fn1,on_caller_QMARK_){
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.fn_handler.call(null,fn1));
if(cljs.core.truth_(ret)){
var val_39139 = cljs.core.deref.call(null,ret);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,val_39139);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (val_39139,ret){
return (function (){
return fn1.call(null,val_39139);
});})(val_39139,ret))
);
}
} else {
}

return null;
});

cljs.core.async.take_BANG_.cljs$lang$maxFixedArity = 3;

cljs.core.async.nop = (function cljs$core$async$nop(_){
return null;
});
cljs.core.async.fhnop = cljs.core.async.fn_handler.call(null,cljs.core.async.nop);
/**
 * puts a val into port. nil values are not allowed. Must be called
 *   inside a (go ...) block. Will park if no buffer space is available.
 *   Returns true unless port is already closed.
 */
cljs.core.async._GT__BANG_ = (function cljs$core$async$_GT__BANG_(port,val){
throw (new Error(">! used not in (go ...) block"));
});
/**
 * Asynchronously puts a val into port, calling fn0 (if supplied) when
 * complete. nil values are not allowed. Will throw if closed. If
 * on-caller? (default true) is true, and the put is immediately
 * accepted, will call fn0 on calling thread.  Returns nil.
 */
cljs.core.async.put_BANG_ = (function cljs$core$async$put_BANG_(var_args){
var args39140 = [];
var len__24369__auto___39143 = arguments.length;
var i__24370__auto___39144 = (0);
while(true){
if((i__24370__auto___39144 < len__24369__auto___39143)){
args39140.push((arguments[i__24370__auto___39144]));

var G__39145 = (i__24370__auto___39144 + (1));
i__24370__auto___39144 = G__39145;
continue;
} else {
}
break;
}

var G__39142 = args39140.length;
switch (G__39142) {
case 2:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39140.length)].join('')));

}
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,val){
var temp__5276__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5276__auto__)){
var ret = temp__5276__auto__;
return cljs.core.deref.call(null,ret);
} else {
return true;
}
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (port,val,fn1){
return cljs.core.async.put_BANG_.call(null,port,val,fn1,true);
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$4 = (function (port,val,fn1,on_caller_QMARK_){
var temp__5276__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fn_handler.call(null,fn1));
if(cljs.core.truth_(temp__5276__auto__)){
var retb = temp__5276__auto__;
var ret = cljs.core.deref.call(null,retb);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,ret);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (ret,retb,temp__5276__auto__){
return (function (){
return fn1.call(null,ret);
});})(ret,retb,temp__5276__auto__))
);
}

return ret;
} else {
return true;
}
});

cljs.core.async.put_BANG_.cljs$lang$maxFixedArity = 4;

cljs.core.async.close_BANG_ = (function cljs$core$async$close_BANG_(port){
return cljs.core.async.impl.protocols.close_BANG_.call(null,port);
});
cljs.core.async.random_array = (function cljs$core$async$random_array(n){
var a = (new Array(n));
var n__24169__auto___39147 = n;
var x_39148 = (0);
while(true){
if((x_39148 < n__24169__auto___39147)){
(a[x_39148] = (0));

var G__39149 = (x_39148 + (1));
x_39148 = G__39149;
continue;
} else {
}
break;
}

var i = (1);
while(true){
if(cljs.core._EQ_.call(null,i,n)){
return a;
} else {
var j = cljs.core.rand_int.call(null,i);
(a[i] = (a[j]));

(a[j] = i);

var G__39150 = (i + (1));
i = G__39150;
continue;
}
break;
}
});
cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.call(null,true);
if(typeof cljs.core.async.t_cljs$core$async39154 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39154 = (function (flag,meta39155){
this.flag = flag;
this.meta39155 = meta39155;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (flag){
return (function (_39156,meta39155__$1){
var self__ = this;
var _39156__$1 = this;
return (new cljs.core.async.t_cljs$core$async39154(self__.flag,meta39155__$1));
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){
return (function (_39156){
var self__ = this;
var _39156__$1 = this;
return self__.meta39155;
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.deref.call(null,self__.flag);
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
return true;
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.flag,null);

return true;
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.getBasis = ((function (flag){
return (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag","flag",-1565787888,null),new cljs.core.Symbol(null,"meta39155","meta39155",1478796569,null)], null);
});})(flag))
;

cljs.core.async.t_cljs$core$async39154.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39154.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39154";

cljs.core.async.t_cljs$core$async39154.cljs$lang$ctorPrWriter = ((function (flag){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async39154");
});})(flag))
;

cljs.core.async.__GT_t_cljs$core$async39154 = ((function (flag){
return (function cljs$core$async$alt_flag_$___GT_t_cljs$core$async39154(flag__$1,meta39155){
return (new cljs.core.async.t_cljs$core$async39154(flag__$1,meta39155));
});})(flag))
;

}

return (new cljs.core.async.t_cljs$core$async39154(flag,cljs.core.PersistentArrayMap.EMPTY));
});
cljs.core.async.alt_handler = (function cljs$core$async$alt_handler(flag,cb){
if(typeof cljs.core.async.t_cljs$core$async39160 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39160 = (function (flag,cb,meta39161){
this.flag = flag;
this.cb = cb;
this.meta39161 = meta39161;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_39162,meta39161__$1){
var self__ = this;
var _39162__$1 = this;
return (new cljs.core.async.t_cljs$core$async39160(self__.flag,self__.cb,meta39161__$1));
});

cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_39162){
var self__ = this;
var _39162__$1 = this;
return self__.meta39161;
});

cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.flag);
});

cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});

cljs.core.async.t_cljs$core$async39160.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.async.impl.protocols.commit.call(null,self__.flag);

return self__.cb;
});

cljs.core.async.t_cljs$core$async39160.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag","flag",-1565787888,null),new cljs.core.Symbol(null,"cb","cb",-2064487928,null),new cljs.core.Symbol(null,"meta39161","meta39161",651514294,null)], null);
});

cljs.core.async.t_cljs$core$async39160.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39160.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39160";

cljs.core.async.t_cljs$core$async39160.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async39160");
});

cljs.core.async.__GT_t_cljs$core$async39160 = (function cljs$core$async$alt_handler_$___GT_t_cljs$core$async39160(flag__$1,cb__$1,meta39161){
return (new cljs.core.async.t_cljs$core$async39160(flag__$1,cb__$1,meta39161));
});

}

return (new cljs.core.async.t_cljs$core$async39160(flag,cb,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * returns derefable [val port] if immediate, nil if enqueued
 */
cljs.core.async.do_alts = (function cljs$core$async$do_alts(fret,ports,opts){
var flag = cljs.core.async.alt_flag.call(null);
var n = cljs.core.count.call(null,ports);
var idxs = cljs.core.async.random_array.call(null,n);
var priority = new cljs.core.Keyword(null,"priority","priority",1431093715).cljs$core$IFn$_invoke$arity$1(opts);
var ret = (function (){var i = (0);
while(true){
if((i < n)){
var idx = (cljs.core.truth_(priority)?i:(idxs[i]));
var port = cljs.core.nth.call(null,ports,idx);
var wport = ((cljs.core.vector_QMARK_.call(null,port))?port.call(null,(0)):null);
var vbox = (cljs.core.truth_(wport)?(function (){var val = port.call(null,(1));
return cljs.core.async.impl.protocols.put_BANG_.call(null,wport,val,cljs.core.async.alt_handler.call(null,flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){
return (function (p1__39163_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__39163_SHARP_,wport], null));
});})(i,val,idx,port,wport,flag,n,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.alt_handler.call(null,flag,((function (i,idx,port,wport,flag,n,idxs,priority){
return (function (p1__39164_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__39164_SHARP_,port], null));
});})(i,idx,port,wport,flag,n,idxs,priority))
)));
if(cljs.core.truth_(vbox)){
return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref.call(null,vbox),(function (){var or__23148__auto__ = wport;
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
return port;
}
})()], null));
} else {
var G__39165 = (i + (1));
i = G__39165;
continue;
}
} else {
return null;
}
break;
}
})();
var or__23148__auto__ = ret;
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
if(cljs.core.contains_QMARK_.call(null,opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5278__auto__ = (function (){var and__23136__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,flag);
if(cljs.core.truth_(and__23136__auto__)){
return cljs.core.async.impl.protocols.commit.call(null,flag);
} else {
return and__23136__auto__;
}
})();
if(cljs.core.truth_(temp__5278__auto__)){
var got = temp__5278__auto__;
return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"default","default",-1987822328).cljs$core$IFn$_invoke$arity$1(opts),new cljs.core.Keyword(null,"default","default",-1987822328)], null));
} else {
return null;
}
} else {
return null;
}
}
});
/**
 * Completes at most one of several channel operations. Must be called
 * inside a (go ...) block. ports is a vector of channel endpoints,
 * which can be either a channel to take from or a vector of
 *   [channel-to-put-to val-to-put], in any combination. Takes will be
 *   made as if by <!, and puts will be made as if by >!. Unless
 *   the :priority option is true, if more than one port operation is
 *   ready a non-deterministic choice will be made. If no operation is
 *   ready and a :default value is supplied, [default-val :default] will
 *   be returned, otherwise alts! will park until the first operation to
 *   become ready completes. Returns [val port] of the completed
 *   operation, where val is the value taken for takes, and a
 *   boolean (true unless already closed, as per put!) for puts.
 * 
 *   opts are passed as :key val ... Supported options:
 * 
 *   :default val - the value to use if none of the operations are immediately ready
 *   :priority true - (default nil) when true, the operations will be tried in order.
 * 
 *   Note: there is no guarantee that the port exps or val exprs will be
 *   used, nor in what order should they be, so they should not be
 *   depended upon for side effects.
 */
cljs.core.async.alts_BANG_ = (function cljs$core$async$alts_BANG_(var_args){
var args__24376__auto__ = [];
var len__24369__auto___39171 = arguments.length;
var i__24370__auto___39172 = (0);
while(true){
if((i__24370__auto___39172 < len__24369__auto___39171)){
args__24376__auto__.push((arguments[i__24370__auto___39172]));

var G__39173 = (i__24370__auto___39172 + (1));
i__24370__auto___39172 = G__39173;
continue;
} else {
}
break;
}

var argseq__24377__auto__ = ((((1) < args__24376__auto__.length))?(new cljs.core.IndexedSeq(args__24376__auto__.slice((1)),(0),null)):null);
return cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__24377__auto__);
});

cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__39168){
var map__39169 = p__39168;
var map__39169__$1 = ((((!((map__39169 == null)))?((((map__39169.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__39169.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__39169):map__39169);
var opts = map__39169__$1;
throw (new Error("alts! used not in (go ...) block"));
});

cljs.core.async.alts_BANG_.cljs$lang$maxFixedArity = (1);

cljs.core.async.alts_BANG_.cljs$lang$applyTo = (function (seq39166){
var G__39167 = cljs.core.first.call(null,seq39166);
var seq39166__$1 = cljs.core.next.call(null,seq39166);
return cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__39167,seq39166__$1);
});

/**
 * Puts a val into port if it's possible to do so immediately.
 *   nil values are not allowed. Never blocks. Returns true if offer succeeds.
 */
cljs.core.async.offer_BANG_ = (function cljs$core$async$offer_BANG_(port,val){
var ret = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fn_handler.call(null,cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref.call(null,ret);
} else {
return null;
}
});
/**
 * Takes a val from port if it's possible to do so immediately.
 *   Never blocks. Returns value if successful, nil otherwise.
 */
cljs.core.async.poll_BANG_ = (function cljs$core$async$poll_BANG_(port){
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.fn_handler.call(null,cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref.call(null,ret);
} else {
return null;
}
});
/**
 * Takes elements from the from channel and supplies them to the to
 * channel. By default, the to channel will be closed when the from
 * channel closes, but can be determined by the close?  parameter. Will
 * stop consuming the from channel if the to channel closes
 */
cljs.core.async.pipe = (function cljs$core$async$pipe(var_args){
var args39174 = [];
var len__24369__auto___39224 = arguments.length;
var i__24370__auto___39225 = (0);
while(true){
if((i__24370__auto___39225 < len__24369__auto___39224)){
args39174.push((arguments[i__24370__auto___39225]));

var G__39226 = (i__24370__auto___39225 + (1));
i__24370__auto___39225 = G__39226;
continue;
} else {
}
break;
}

var G__39176 = args39174.length;
switch (G__39176) {
case 2:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39174.length)].join('')));

}
});

cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2 = (function (from,to){
return cljs.core.async.pipe.call(null,from,to,true);
});

cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__39047__auto___39228 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___39228){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___39228){
return (function (state_39200){
var state_val_39201 = (state_39200[(1)]);
if((state_val_39201 === (7))){
var inst_39196 = (state_39200[(2)]);
var state_39200__$1 = state_39200;
var statearr_39202_39229 = state_39200__$1;
(statearr_39202_39229[(2)] = inst_39196);

(statearr_39202_39229[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (1))){
var state_39200__$1 = state_39200;
var statearr_39203_39230 = state_39200__$1;
(statearr_39203_39230[(2)] = null);

(statearr_39203_39230[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (4))){
var inst_39179 = (state_39200[(7)]);
var inst_39179__$1 = (state_39200[(2)]);
var inst_39180 = (inst_39179__$1 == null);
var state_39200__$1 = (function (){var statearr_39204 = state_39200;
(statearr_39204[(7)] = inst_39179__$1);

return statearr_39204;
})();
if(cljs.core.truth_(inst_39180)){
var statearr_39205_39231 = state_39200__$1;
(statearr_39205_39231[(1)] = (5));

} else {
var statearr_39206_39232 = state_39200__$1;
(statearr_39206_39232[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (13))){
var state_39200__$1 = state_39200;
var statearr_39207_39233 = state_39200__$1;
(statearr_39207_39233[(2)] = null);

(statearr_39207_39233[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (6))){
var inst_39179 = (state_39200[(7)]);
var state_39200__$1 = state_39200;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39200__$1,(11),to,inst_39179);
} else {
if((state_val_39201 === (3))){
var inst_39198 = (state_39200[(2)]);
var state_39200__$1 = state_39200;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39200__$1,inst_39198);
} else {
if((state_val_39201 === (12))){
var state_39200__$1 = state_39200;
var statearr_39208_39234 = state_39200__$1;
(statearr_39208_39234[(2)] = null);

(statearr_39208_39234[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (2))){
var state_39200__$1 = state_39200;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39200__$1,(4),from);
} else {
if((state_val_39201 === (11))){
var inst_39189 = (state_39200[(2)]);
var state_39200__$1 = state_39200;
if(cljs.core.truth_(inst_39189)){
var statearr_39209_39235 = state_39200__$1;
(statearr_39209_39235[(1)] = (12));

} else {
var statearr_39210_39236 = state_39200__$1;
(statearr_39210_39236[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (9))){
var state_39200__$1 = state_39200;
var statearr_39211_39237 = state_39200__$1;
(statearr_39211_39237[(2)] = null);

(statearr_39211_39237[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (5))){
var state_39200__$1 = state_39200;
if(cljs.core.truth_(close_QMARK_)){
var statearr_39212_39238 = state_39200__$1;
(statearr_39212_39238[(1)] = (8));

} else {
var statearr_39213_39239 = state_39200__$1;
(statearr_39213_39239[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (14))){
var inst_39194 = (state_39200[(2)]);
var state_39200__$1 = state_39200;
var statearr_39214_39240 = state_39200__$1;
(statearr_39214_39240[(2)] = inst_39194);

(statearr_39214_39240[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (10))){
var inst_39186 = (state_39200[(2)]);
var state_39200__$1 = state_39200;
var statearr_39215_39241 = state_39200__$1;
(statearr_39215_39241[(2)] = inst_39186);

(statearr_39215_39241[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39201 === (8))){
var inst_39183 = cljs.core.async.close_BANG_.call(null,to);
var state_39200__$1 = state_39200;
var statearr_39216_39242 = state_39200__$1;
(statearr_39216_39242[(2)] = inst_39183);

(statearr_39216_39242[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___39228))
;
return ((function (switch__38933__auto__,c__39047__auto___39228){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_39220 = [null,null,null,null,null,null,null,null];
(statearr_39220[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_39220[(1)] = (1));

return statearr_39220;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_39200){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39200);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39221){if((e39221 instanceof Object)){
var ex__38937__auto__ = e39221;
var statearr_39222_39243 = state_39200;
(statearr_39222_39243[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39200);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39221;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39244 = state_39200;
state_39200 = G__39244;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_39200){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_39200);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___39228))
})();
var state__39049__auto__ = (function (){var statearr_39223 = f__39048__auto__.call(null);
(statearr_39223[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39228);

return statearr_39223;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___39228))
);


return to;
});

cljs.core.async.pipe.cljs$lang$maxFixedArity = 3;

cljs.core.async.pipeline_STAR_ = (function cljs$core$async$pipeline_STAR_(n,to,xf,from,close_QMARK_,ex_handler,type){
if((n > (0))){
} else {
throw (new Error("Assert failed: (pos? n)"));
}

var jobs = cljs.core.async.chan.call(null,n);
var results = cljs.core.async.chan.call(null,n);
var process = ((function (jobs,results){
return (function (p__39432){
var vec__39433 = p__39432;
var v = cljs.core.nth.call(null,vec__39433,(0),null);
var p = cljs.core.nth.call(null,vec__39433,(1),null);
var job = vec__39433;
if((job == null)){
cljs.core.async.close_BANG_.call(null,results);

return null;
} else {
var res = cljs.core.async.chan.call(null,(1),xf,ex_handler);
var c__39047__auto___39619 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results){
return (function (state_39440){
var state_val_39441 = (state_39440[(1)]);
if((state_val_39441 === (1))){
var state_39440__$1 = state_39440;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39440__$1,(2),res,v);
} else {
if((state_val_39441 === (2))){
var inst_39437 = (state_39440[(2)]);
var inst_39438 = cljs.core.async.close_BANG_.call(null,res);
var state_39440__$1 = (function (){var statearr_39442 = state_39440;
(statearr_39442[(7)] = inst_39437);

return statearr_39442;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39440__$1,inst_39438);
} else {
return null;
}
}
});})(c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results))
;
return ((function (switch__38933__auto__,c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_39446 = [null,null,null,null,null,null,null,null];
(statearr_39446[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__);

(statearr_39446[(1)] = (1));

return statearr_39446;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1 = (function (state_39440){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39440);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39447){if((e39447 instanceof Object)){
var ex__38937__auto__ = e39447;
var statearr_39448_39620 = state_39440;
(statearr_39448_39620[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39440);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39447;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39621 = state_39440;
state_39440 = G__39621;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = function(state_39440){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1.call(this,state_39440);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results))
})();
var state__39049__auto__ = (function (){var statearr_39449 = f__39048__auto__.call(null);
(statearr_39449[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39619);

return statearr_39449;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___39619,res,vec__39433,v,p,job,jobs,results))
);


cljs.core.async.put_BANG_.call(null,p,res);

return true;
}
});})(jobs,results))
;
var async = ((function (jobs,results,process){
return (function (p__39450){
var vec__39451 = p__39450;
var v = cljs.core.nth.call(null,vec__39451,(0),null);
var p = cljs.core.nth.call(null,vec__39451,(1),null);
var job = vec__39451;
if((job == null)){
cljs.core.async.close_BANG_.call(null,results);

return null;
} else {
var res = cljs.core.async.chan.call(null,(1));
xf.call(null,v,res);

cljs.core.async.put_BANG_.call(null,p,res);

return true;
}
});})(jobs,results,process))
;
var n__24169__auto___39622 = n;
var __39623 = (0);
while(true){
if((__39623 < n__24169__auto___39622)){
var G__39454_39624 = type;
var G__39454_39625__$1 = (((G__39454_39624 instanceof cljs.core.Keyword))?G__39454_39624.fqn:null);
switch (G__39454_39625__$1) {
case "compute":
var c__39047__auto___39627 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__39623,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (__39623,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function (state_39467){
var state_val_39468 = (state_39467[(1)]);
if((state_val_39468 === (1))){
var state_39467__$1 = state_39467;
var statearr_39469_39628 = state_39467__$1;
(statearr_39469_39628[(2)] = null);

(statearr_39469_39628[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39468 === (2))){
var state_39467__$1 = state_39467;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39467__$1,(4),jobs);
} else {
if((state_val_39468 === (3))){
var inst_39465 = (state_39467[(2)]);
var state_39467__$1 = state_39467;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39467__$1,inst_39465);
} else {
if((state_val_39468 === (4))){
var inst_39457 = (state_39467[(2)]);
var inst_39458 = process.call(null,inst_39457);
var state_39467__$1 = state_39467;
if(cljs.core.truth_(inst_39458)){
var statearr_39470_39629 = state_39467__$1;
(statearr_39470_39629[(1)] = (5));

} else {
var statearr_39471_39630 = state_39467__$1;
(statearr_39471_39630[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39468 === (5))){
var state_39467__$1 = state_39467;
var statearr_39472_39631 = state_39467__$1;
(statearr_39472_39631[(2)] = null);

(statearr_39472_39631[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39468 === (6))){
var state_39467__$1 = state_39467;
var statearr_39473_39632 = state_39467__$1;
(statearr_39473_39632[(2)] = null);

(statearr_39473_39632[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39468 === (7))){
var inst_39463 = (state_39467[(2)]);
var state_39467__$1 = state_39467;
var statearr_39474_39633 = state_39467__$1;
(statearr_39474_39633[(2)] = inst_39463);

(statearr_39474_39633[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__39623,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
;
return ((function (__39623,switch__38933__auto__,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_39478 = [null,null,null,null,null,null,null];
(statearr_39478[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__);

(statearr_39478[(1)] = (1));

return statearr_39478;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1 = (function (state_39467){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39467);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39479){if((e39479 instanceof Object)){
var ex__38937__auto__ = e39479;
var statearr_39480_39634 = state_39467;
(statearr_39480_39634[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39467);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39479;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39635 = state_39467;
state_39467 = G__39635;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = function(state_39467){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1.call(this,state_39467);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__;
})()
;})(__39623,switch__38933__auto__,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
})();
var state__39049__auto__ = (function (){var statearr_39481 = f__39048__auto__.call(null);
(statearr_39481[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39627);

return statearr_39481;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(__39623,c__39047__auto___39627,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
);


break;
case "async":
var c__39047__auto___39636 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__39623,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (__39623,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function (state_39494){
var state_val_39495 = (state_39494[(1)]);
if((state_val_39495 === (1))){
var state_39494__$1 = state_39494;
var statearr_39496_39637 = state_39494__$1;
(statearr_39496_39637[(2)] = null);

(statearr_39496_39637[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39495 === (2))){
var state_39494__$1 = state_39494;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39494__$1,(4),jobs);
} else {
if((state_val_39495 === (3))){
var inst_39492 = (state_39494[(2)]);
var state_39494__$1 = state_39494;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39494__$1,inst_39492);
} else {
if((state_val_39495 === (4))){
var inst_39484 = (state_39494[(2)]);
var inst_39485 = async.call(null,inst_39484);
var state_39494__$1 = state_39494;
if(cljs.core.truth_(inst_39485)){
var statearr_39497_39638 = state_39494__$1;
(statearr_39497_39638[(1)] = (5));

} else {
var statearr_39498_39639 = state_39494__$1;
(statearr_39498_39639[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39495 === (5))){
var state_39494__$1 = state_39494;
var statearr_39499_39640 = state_39494__$1;
(statearr_39499_39640[(2)] = null);

(statearr_39499_39640[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39495 === (6))){
var state_39494__$1 = state_39494;
var statearr_39500_39641 = state_39494__$1;
(statearr_39500_39641[(2)] = null);

(statearr_39500_39641[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39495 === (7))){
var inst_39490 = (state_39494[(2)]);
var state_39494__$1 = state_39494;
var statearr_39501_39642 = state_39494__$1;
(statearr_39501_39642[(2)] = inst_39490);

(statearr_39501_39642[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__39623,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
;
return ((function (__39623,switch__38933__auto__,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_39505 = [null,null,null,null,null,null,null];
(statearr_39505[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__);

(statearr_39505[(1)] = (1));

return statearr_39505;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1 = (function (state_39494){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39494);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39506){if((e39506 instanceof Object)){
var ex__38937__auto__ = e39506;
var statearr_39507_39643 = state_39494;
(statearr_39507_39643[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39494);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39506;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39644 = state_39494;
state_39494 = G__39644;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = function(state_39494){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1.call(this,state_39494);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__;
})()
;})(__39623,switch__38933__auto__,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
})();
var state__39049__auto__ = (function (){var statearr_39508 = f__39048__auto__.call(null);
(statearr_39508[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39636);

return statearr_39508;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(__39623,c__39047__auto___39636,G__39454_39624,G__39454_39625__$1,n__24169__auto___39622,jobs,results,process,async))
);


break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("No matching clause: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__39454_39625__$1)].join('')));

}

var G__39645 = (__39623 + (1));
__39623 = G__39645;
continue;
} else {
}
break;
}

var c__39047__auto___39646 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___39646,jobs,results,process,async){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___39646,jobs,results,process,async){
return (function (state_39530){
var state_val_39531 = (state_39530[(1)]);
if((state_val_39531 === (1))){
var state_39530__$1 = state_39530;
var statearr_39532_39647 = state_39530__$1;
(statearr_39532_39647[(2)] = null);

(statearr_39532_39647[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39531 === (2))){
var state_39530__$1 = state_39530;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39530__$1,(4),from);
} else {
if((state_val_39531 === (3))){
var inst_39528 = (state_39530[(2)]);
var state_39530__$1 = state_39530;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39530__$1,inst_39528);
} else {
if((state_val_39531 === (4))){
var inst_39511 = (state_39530[(7)]);
var inst_39511__$1 = (state_39530[(2)]);
var inst_39512 = (inst_39511__$1 == null);
var state_39530__$1 = (function (){var statearr_39533 = state_39530;
(statearr_39533[(7)] = inst_39511__$1);

return statearr_39533;
})();
if(cljs.core.truth_(inst_39512)){
var statearr_39534_39648 = state_39530__$1;
(statearr_39534_39648[(1)] = (5));

} else {
var statearr_39535_39649 = state_39530__$1;
(statearr_39535_39649[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39531 === (5))){
var inst_39514 = cljs.core.async.close_BANG_.call(null,jobs);
var state_39530__$1 = state_39530;
var statearr_39536_39650 = state_39530__$1;
(statearr_39536_39650[(2)] = inst_39514);

(statearr_39536_39650[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39531 === (6))){
var inst_39511 = (state_39530[(7)]);
var inst_39516 = (state_39530[(8)]);
var inst_39516__$1 = cljs.core.async.chan.call(null,(1));
var inst_39517 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_39518 = [inst_39511,inst_39516__$1];
var inst_39519 = (new cljs.core.PersistentVector(null,2,(5),inst_39517,inst_39518,null));
var state_39530__$1 = (function (){var statearr_39537 = state_39530;
(statearr_39537[(8)] = inst_39516__$1);

return statearr_39537;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39530__$1,(8),jobs,inst_39519);
} else {
if((state_val_39531 === (7))){
var inst_39526 = (state_39530[(2)]);
var state_39530__$1 = state_39530;
var statearr_39538_39651 = state_39530__$1;
(statearr_39538_39651[(2)] = inst_39526);

(statearr_39538_39651[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39531 === (8))){
var inst_39516 = (state_39530[(8)]);
var inst_39521 = (state_39530[(2)]);
var state_39530__$1 = (function (){var statearr_39539 = state_39530;
(statearr_39539[(9)] = inst_39521);

return statearr_39539;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39530__$1,(9),results,inst_39516);
} else {
if((state_val_39531 === (9))){
var inst_39523 = (state_39530[(2)]);
var state_39530__$1 = (function (){var statearr_39540 = state_39530;
(statearr_39540[(10)] = inst_39523);

return statearr_39540;
})();
var statearr_39541_39652 = state_39530__$1;
(statearr_39541_39652[(2)] = null);

(statearr_39541_39652[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___39646,jobs,results,process,async))
;
return ((function (switch__38933__auto__,c__39047__auto___39646,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_39545 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_39545[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__);

(statearr_39545[(1)] = (1));

return statearr_39545;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1 = (function (state_39530){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39530);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39546){if((e39546 instanceof Object)){
var ex__38937__auto__ = e39546;
var statearr_39547_39653 = state_39530;
(statearr_39547_39653[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39530);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39546;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39654 = state_39530;
state_39530 = G__39654;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = function(state_39530){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1.call(this,state_39530);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___39646,jobs,results,process,async))
})();
var state__39049__auto__ = (function (){var statearr_39548 = f__39048__auto__.call(null);
(statearr_39548[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39646);

return statearr_39548;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___39646,jobs,results,process,async))
);


var c__39047__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto__,jobs,results,process,async){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto__,jobs,results,process,async){
return (function (state_39586){
var state_val_39587 = (state_39586[(1)]);
if((state_val_39587 === (7))){
var inst_39582 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
var statearr_39588_39655 = state_39586__$1;
(statearr_39588_39655[(2)] = inst_39582);

(statearr_39588_39655[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (20))){
var state_39586__$1 = state_39586;
var statearr_39589_39656 = state_39586__$1;
(statearr_39589_39656[(2)] = null);

(statearr_39589_39656[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (1))){
var state_39586__$1 = state_39586;
var statearr_39590_39657 = state_39586__$1;
(statearr_39590_39657[(2)] = null);

(statearr_39590_39657[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (4))){
var inst_39551 = (state_39586[(7)]);
var inst_39551__$1 = (state_39586[(2)]);
var inst_39552 = (inst_39551__$1 == null);
var state_39586__$1 = (function (){var statearr_39591 = state_39586;
(statearr_39591[(7)] = inst_39551__$1);

return statearr_39591;
})();
if(cljs.core.truth_(inst_39552)){
var statearr_39592_39658 = state_39586__$1;
(statearr_39592_39658[(1)] = (5));

} else {
var statearr_39593_39659 = state_39586__$1;
(statearr_39593_39659[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (15))){
var inst_39564 = (state_39586[(8)]);
var state_39586__$1 = state_39586;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39586__$1,(18),to,inst_39564);
} else {
if((state_val_39587 === (21))){
var inst_39577 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
var statearr_39594_39660 = state_39586__$1;
(statearr_39594_39660[(2)] = inst_39577);

(statearr_39594_39660[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (13))){
var inst_39579 = (state_39586[(2)]);
var state_39586__$1 = (function (){var statearr_39595 = state_39586;
(statearr_39595[(9)] = inst_39579);

return statearr_39595;
})();
var statearr_39596_39661 = state_39586__$1;
(statearr_39596_39661[(2)] = null);

(statearr_39596_39661[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (6))){
var inst_39551 = (state_39586[(7)]);
var state_39586__$1 = state_39586;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39586__$1,(11),inst_39551);
} else {
if((state_val_39587 === (17))){
var inst_39572 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
if(cljs.core.truth_(inst_39572)){
var statearr_39597_39662 = state_39586__$1;
(statearr_39597_39662[(1)] = (19));

} else {
var statearr_39598_39663 = state_39586__$1;
(statearr_39598_39663[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (3))){
var inst_39584 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39586__$1,inst_39584);
} else {
if((state_val_39587 === (12))){
var inst_39561 = (state_39586[(10)]);
var state_39586__$1 = state_39586;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39586__$1,(14),inst_39561);
} else {
if((state_val_39587 === (2))){
var state_39586__$1 = state_39586;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39586__$1,(4),results);
} else {
if((state_val_39587 === (19))){
var state_39586__$1 = state_39586;
var statearr_39599_39664 = state_39586__$1;
(statearr_39599_39664[(2)] = null);

(statearr_39599_39664[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (11))){
var inst_39561 = (state_39586[(2)]);
var state_39586__$1 = (function (){var statearr_39600 = state_39586;
(statearr_39600[(10)] = inst_39561);

return statearr_39600;
})();
var statearr_39601_39665 = state_39586__$1;
(statearr_39601_39665[(2)] = null);

(statearr_39601_39665[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (9))){
var state_39586__$1 = state_39586;
var statearr_39602_39666 = state_39586__$1;
(statearr_39602_39666[(2)] = null);

(statearr_39602_39666[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (5))){
var state_39586__$1 = state_39586;
if(cljs.core.truth_(close_QMARK_)){
var statearr_39603_39667 = state_39586__$1;
(statearr_39603_39667[(1)] = (8));

} else {
var statearr_39604_39668 = state_39586__$1;
(statearr_39604_39668[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (14))){
var inst_39566 = (state_39586[(11)]);
var inst_39564 = (state_39586[(8)]);
var inst_39564__$1 = (state_39586[(2)]);
var inst_39565 = (inst_39564__$1 == null);
var inst_39566__$1 = cljs.core.not.call(null,inst_39565);
var state_39586__$1 = (function (){var statearr_39605 = state_39586;
(statearr_39605[(11)] = inst_39566__$1);

(statearr_39605[(8)] = inst_39564__$1);

return statearr_39605;
})();
if(inst_39566__$1){
var statearr_39606_39669 = state_39586__$1;
(statearr_39606_39669[(1)] = (15));

} else {
var statearr_39607_39670 = state_39586__$1;
(statearr_39607_39670[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (16))){
var inst_39566 = (state_39586[(11)]);
var state_39586__$1 = state_39586;
var statearr_39608_39671 = state_39586__$1;
(statearr_39608_39671[(2)] = inst_39566);

(statearr_39608_39671[(1)] = (17));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (10))){
var inst_39558 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
var statearr_39609_39672 = state_39586__$1;
(statearr_39609_39672[(2)] = inst_39558);

(statearr_39609_39672[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (18))){
var inst_39569 = (state_39586[(2)]);
var state_39586__$1 = state_39586;
var statearr_39610_39673 = state_39586__$1;
(statearr_39610_39673[(2)] = inst_39569);

(statearr_39610_39673[(1)] = (17));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39587 === (8))){
var inst_39555 = cljs.core.async.close_BANG_.call(null,to);
var state_39586__$1 = state_39586;
var statearr_39611_39674 = state_39586__$1;
(statearr_39611_39674[(2)] = inst_39555);

(statearr_39611_39674[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto__,jobs,results,process,async))
;
return ((function (switch__38933__auto__,c__39047__auto__,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_39615 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39615[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__);

(statearr_39615[(1)] = (1));

return statearr_39615;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1 = (function (state_39586){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39586);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39616){if((e39616 instanceof Object)){
var ex__38937__auto__ = e39616;
var statearr_39617_39675 = state_39586;
(statearr_39617_39675[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39586);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39616;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39676 = state_39586;
state_39586 = G__39676;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__ = function(state_39586){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1.call(this,state_39586);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto__,jobs,results,process,async))
})();
var state__39049__auto__ = (function (){var statearr_39618 = f__39048__auto__.call(null);
(statearr_39618[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto__);

return statearr_39618;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto__,jobs,results,process,async))
);

return c__39047__auto__;
});
/**
 * Takes elements from the from channel and supplies them to the to
 *   channel, subject to the async function af, with parallelism n. af
 *   must be a function of two arguments, the first an input value and
 *   the second a channel on which to place the result(s). af must close!
 *   the channel before returning.  The presumption is that af will
 *   return immediately, having launched some asynchronous operation
 *   whose completion/callback will manipulate the result channel. Outputs
 *   will be returned in order relative to  the inputs. By default, the to
 *   channel will be closed when the from channel closes, but can be
 *   determined by the close?  parameter. Will stop consuming the from
 *   channel if the to channel closes.
 */
cljs.core.async.pipeline_async = (function cljs$core$async$pipeline_async(var_args){
var args39677 = [];
var len__24369__auto___39680 = arguments.length;
var i__24370__auto___39681 = (0);
while(true){
if((i__24370__auto___39681 < len__24369__auto___39680)){
args39677.push((arguments[i__24370__auto___39681]));

var G__39682 = (i__24370__auto___39681 + (1));
i__24370__auto___39681 = G__39682;
continue;
} else {
}
break;
}

var G__39679 = args39677.length;
switch (G__39679) {
case 4:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
case 5:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39677.length)].join('')));

}
});

cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4 = (function (n,to,af,from){
return cljs.core.async.pipeline_async.call(null,n,to,af,from,true);
});

cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5 = (function (n,to,af,from,close_QMARK_){
return cljs.core.async.pipeline_STAR_.call(null,n,to,af,from,close_QMARK_,null,new cljs.core.Keyword(null,"async","async",1050769601));
});

cljs.core.async.pipeline_async.cljs$lang$maxFixedArity = 5;

/**
 * Takes elements from the from channel and supplies them to the to
 *   channel, subject to the transducer xf, with parallelism n. Because
 *   it is parallel, the transducer will be applied independently to each
 *   element, not across elements, and may produce zero or more outputs
 *   per input.  Outputs will be returned in order relative to the
 *   inputs. By default, the to channel will be closed when the from
 *   channel closes, but can be determined by the close?  parameter. Will
 *   stop consuming the from channel if the to channel closes.
 * 
 *   Note this is supplied for API compatibility with the Clojure version.
 *   Values of N > 1 will not result in actual concurrency in a
 *   single-threaded runtime.
 */
cljs.core.async.pipeline = (function cljs$core$async$pipeline(var_args){
var args39684 = [];
var len__24369__auto___39687 = arguments.length;
var i__24370__auto___39688 = (0);
while(true){
if((i__24370__auto___39688 < len__24369__auto___39687)){
args39684.push((arguments[i__24370__auto___39688]));

var G__39689 = (i__24370__auto___39688 + (1));
i__24370__auto___39688 = G__39689;
continue;
} else {
}
break;
}

var G__39686 = args39684.length;
switch (G__39686) {
case 4:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
case 5:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]));

break;
case 6:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$6((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]),(arguments[(5)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39684.length)].join('')));

}
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4 = (function (n,to,xf,from){
return cljs.core.async.pipeline.call(null,n,to,xf,from,true);
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5 = (function (n,to,xf,from,close_QMARK_){
return cljs.core.async.pipeline.call(null,n,to,xf,from,close_QMARK_,null);
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$6 = (function (n,to,xf,from,close_QMARK_,ex_handler){
return cljs.core.async.pipeline_STAR_.call(null,n,to,xf,from,close_QMARK_,ex_handler,new cljs.core.Keyword(null,"compute","compute",1555393130));
});

cljs.core.async.pipeline.cljs$lang$maxFixedArity = 6;

/**
 * Takes a predicate and a source channel and returns a vector of two
 *   channels, the first of which will contain the values for which the
 *   predicate returned true, the second those for which it returned
 *   false.
 * 
 *   The out channels will be unbuffered by default, or two buf-or-ns can
 *   be supplied. The channels will close after the source channel has
 *   closed.
 */
cljs.core.async.split = (function cljs$core$async$split(var_args){
var args39691 = [];
var len__24369__auto___39744 = arguments.length;
var i__24370__auto___39745 = (0);
while(true){
if((i__24370__auto___39745 < len__24369__auto___39744)){
args39691.push((arguments[i__24370__auto___39745]));

var G__39746 = (i__24370__auto___39745 + (1));
i__24370__auto___39745 = G__39746;
continue;
} else {
}
break;
}

var G__39693 = args39691.length;
switch (G__39693) {
case 2:
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 4:
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39691.length)].join('')));

}
});

cljs.core.async.split.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.split.call(null,p,ch,null,null);
});

cljs.core.async.split.cljs$core$IFn$_invoke$arity$4 = (function (p,ch,t_buf_or_n,f_buf_or_n){
var tc = cljs.core.async.chan.call(null,t_buf_or_n);
var fc = cljs.core.async.chan.call(null,f_buf_or_n);
var c__39047__auto___39748 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___39748,tc,fc){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___39748,tc,fc){
return (function (state_39719){
var state_val_39720 = (state_39719[(1)]);
if((state_val_39720 === (7))){
var inst_39715 = (state_39719[(2)]);
var state_39719__$1 = state_39719;
var statearr_39721_39749 = state_39719__$1;
(statearr_39721_39749[(2)] = inst_39715);

(statearr_39721_39749[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (1))){
var state_39719__$1 = state_39719;
var statearr_39722_39750 = state_39719__$1;
(statearr_39722_39750[(2)] = null);

(statearr_39722_39750[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (4))){
var inst_39696 = (state_39719[(7)]);
var inst_39696__$1 = (state_39719[(2)]);
var inst_39697 = (inst_39696__$1 == null);
var state_39719__$1 = (function (){var statearr_39723 = state_39719;
(statearr_39723[(7)] = inst_39696__$1);

return statearr_39723;
})();
if(cljs.core.truth_(inst_39697)){
var statearr_39724_39751 = state_39719__$1;
(statearr_39724_39751[(1)] = (5));

} else {
var statearr_39725_39752 = state_39719__$1;
(statearr_39725_39752[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (13))){
var state_39719__$1 = state_39719;
var statearr_39726_39753 = state_39719__$1;
(statearr_39726_39753[(2)] = null);

(statearr_39726_39753[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (6))){
var inst_39696 = (state_39719[(7)]);
var inst_39702 = p.call(null,inst_39696);
var state_39719__$1 = state_39719;
if(cljs.core.truth_(inst_39702)){
var statearr_39727_39754 = state_39719__$1;
(statearr_39727_39754[(1)] = (9));

} else {
var statearr_39728_39755 = state_39719__$1;
(statearr_39728_39755[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (3))){
var inst_39717 = (state_39719[(2)]);
var state_39719__$1 = state_39719;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39719__$1,inst_39717);
} else {
if((state_val_39720 === (12))){
var state_39719__$1 = state_39719;
var statearr_39729_39756 = state_39719__$1;
(statearr_39729_39756[(2)] = null);

(statearr_39729_39756[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (2))){
var state_39719__$1 = state_39719;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39719__$1,(4),ch);
} else {
if((state_val_39720 === (11))){
var inst_39696 = (state_39719[(7)]);
var inst_39706 = (state_39719[(2)]);
var state_39719__$1 = state_39719;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39719__$1,(8),inst_39706,inst_39696);
} else {
if((state_val_39720 === (9))){
var state_39719__$1 = state_39719;
var statearr_39730_39757 = state_39719__$1;
(statearr_39730_39757[(2)] = tc);

(statearr_39730_39757[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (5))){
var inst_39699 = cljs.core.async.close_BANG_.call(null,tc);
var inst_39700 = cljs.core.async.close_BANG_.call(null,fc);
var state_39719__$1 = (function (){var statearr_39731 = state_39719;
(statearr_39731[(8)] = inst_39699);

return statearr_39731;
})();
var statearr_39732_39758 = state_39719__$1;
(statearr_39732_39758[(2)] = inst_39700);

(statearr_39732_39758[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (14))){
var inst_39713 = (state_39719[(2)]);
var state_39719__$1 = state_39719;
var statearr_39733_39759 = state_39719__$1;
(statearr_39733_39759[(2)] = inst_39713);

(statearr_39733_39759[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (10))){
var state_39719__$1 = state_39719;
var statearr_39734_39760 = state_39719__$1;
(statearr_39734_39760[(2)] = fc);

(statearr_39734_39760[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39720 === (8))){
var inst_39708 = (state_39719[(2)]);
var state_39719__$1 = state_39719;
if(cljs.core.truth_(inst_39708)){
var statearr_39735_39761 = state_39719__$1;
(statearr_39735_39761[(1)] = (12));

} else {
var statearr_39736_39762 = state_39719__$1;
(statearr_39736_39762[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___39748,tc,fc))
;
return ((function (switch__38933__auto__,c__39047__auto___39748,tc,fc){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_39740 = [null,null,null,null,null,null,null,null,null];
(statearr_39740[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_39740[(1)] = (1));

return statearr_39740;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_39719){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39719);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39741){if((e39741 instanceof Object)){
var ex__38937__auto__ = e39741;
var statearr_39742_39763 = state_39719;
(statearr_39742_39763[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39719);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39741;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39764 = state_39719;
state_39719 = G__39764;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_39719){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_39719);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___39748,tc,fc))
})();
var state__39049__auto__ = (function (){var statearr_39743 = f__39048__auto__.call(null);
(statearr_39743[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___39748);

return statearr_39743;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___39748,tc,fc))
);


return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [tc,fc], null);
});

cljs.core.async.split.cljs$lang$maxFixedArity = 4;

/**
 * f should be a function of 2 arguments. Returns a channel containing
 *   the single result of applying f to init and the first item from the
 *   channel, then applying f to that result and the 2nd item, etc. If
 *   the channel closes without yielding items, returns init and f is not
 *   called. ch must close before reduce produces a result.
 */
cljs.core.async.reduce = (function cljs$core$async$reduce(f,init,ch){
var c__39047__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto__){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto__){
return (function (state_39828){
var state_val_39829 = (state_39828[(1)]);
if((state_val_39829 === (7))){
var inst_39824 = (state_39828[(2)]);
var state_39828__$1 = state_39828;
var statearr_39830_39851 = state_39828__$1;
(statearr_39830_39851[(2)] = inst_39824);

(statearr_39830_39851[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (1))){
var inst_39808 = init;
var state_39828__$1 = (function (){var statearr_39831 = state_39828;
(statearr_39831[(7)] = inst_39808);

return statearr_39831;
})();
var statearr_39832_39852 = state_39828__$1;
(statearr_39832_39852[(2)] = null);

(statearr_39832_39852[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (4))){
var inst_39811 = (state_39828[(8)]);
var inst_39811__$1 = (state_39828[(2)]);
var inst_39812 = (inst_39811__$1 == null);
var state_39828__$1 = (function (){var statearr_39833 = state_39828;
(statearr_39833[(8)] = inst_39811__$1);

return statearr_39833;
})();
if(cljs.core.truth_(inst_39812)){
var statearr_39834_39853 = state_39828__$1;
(statearr_39834_39853[(1)] = (5));

} else {
var statearr_39835_39854 = state_39828__$1;
(statearr_39835_39854[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (6))){
var inst_39808 = (state_39828[(7)]);
var inst_39811 = (state_39828[(8)]);
var inst_39815 = (state_39828[(9)]);
var inst_39815__$1 = f.call(null,inst_39808,inst_39811);
var inst_39816 = cljs.core.reduced_QMARK_.call(null,inst_39815__$1);
var state_39828__$1 = (function (){var statearr_39836 = state_39828;
(statearr_39836[(9)] = inst_39815__$1);

return statearr_39836;
})();
if(inst_39816){
var statearr_39837_39855 = state_39828__$1;
(statearr_39837_39855[(1)] = (8));

} else {
var statearr_39838_39856 = state_39828__$1;
(statearr_39838_39856[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (3))){
var inst_39826 = (state_39828[(2)]);
var state_39828__$1 = state_39828;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39828__$1,inst_39826);
} else {
if((state_val_39829 === (2))){
var state_39828__$1 = state_39828;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39828__$1,(4),ch);
} else {
if((state_val_39829 === (9))){
var inst_39815 = (state_39828[(9)]);
var inst_39808 = inst_39815;
var state_39828__$1 = (function (){var statearr_39839 = state_39828;
(statearr_39839[(7)] = inst_39808);

return statearr_39839;
})();
var statearr_39840_39857 = state_39828__$1;
(statearr_39840_39857[(2)] = null);

(statearr_39840_39857[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (5))){
var inst_39808 = (state_39828[(7)]);
var state_39828__$1 = state_39828;
var statearr_39841_39858 = state_39828__$1;
(statearr_39841_39858[(2)] = inst_39808);

(statearr_39841_39858[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (10))){
var inst_39822 = (state_39828[(2)]);
var state_39828__$1 = state_39828;
var statearr_39842_39859 = state_39828__$1;
(statearr_39842_39859[(2)] = inst_39822);

(statearr_39842_39859[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39829 === (8))){
var inst_39815 = (state_39828[(9)]);
var inst_39818 = cljs.core.deref.call(null,inst_39815);
var state_39828__$1 = state_39828;
var statearr_39843_39860 = state_39828__$1;
(statearr_39843_39860[(2)] = inst_39818);

(statearr_39843_39860[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto__))
;
return ((function (switch__38933__auto__,c__39047__auto__){
return (function() {
var cljs$core$async$reduce_$_state_machine__38934__auto__ = null;
var cljs$core$async$reduce_$_state_machine__38934__auto____0 = (function (){
var statearr_39847 = [null,null,null,null,null,null,null,null,null,null];
(statearr_39847[(0)] = cljs$core$async$reduce_$_state_machine__38934__auto__);

(statearr_39847[(1)] = (1));

return statearr_39847;
});
var cljs$core$async$reduce_$_state_machine__38934__auto____1 = (function (state_39828){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39828);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39848){if((e39848 instanceof Object)){
var ex__38937__auto__ = e39848;
var statearr_39849_39861 = state_39828;
(statearr_39849_39861[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39828);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39848;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39862 = state_39828;
state_39828 = G__39862;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__38934__auto__ = function(state_39828){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__38934__auto____1.call(this,state_39828);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$reduce_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__38934__auto____0;
cljs$core$async$reduce_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__38934__auto____1;
return cljs$core$async$reduce_$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto__))
})();
var state__39049__auto__ = (function (){var statearr_39850 = f__39048__auto__.call(null);
(statearr_39850[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto__);

return statearr_39850;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto__))
);

return c__39047__auto__;
});
/**
 * async/reduces a channel with a transformation (xform f).
 *   Returns a channel containing the result.  ch must close before
 *   transduce produces a result.
 */
cljs.core.async.transduce = (function cljs$core$async$transduce(xform,f,init,ch){
var f__$1 = xform.call(null,f);
var c__39047__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto__,f__$1){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto__,f__$1){
return (function (state_39882){
var state_val_39883 = (state_39882[(1)]);
if((state_val_39883 === (1))){
var inst_39877 = cljs.core.async.reduce.call(null,f__$1,init,ch);
var state_39882__$1 = state_39882;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39882__$1,(2),inst_39877);
} else {
if((state_val_39883 === (2))){
var inst_39879 = (state_39882[(2)]);
var inst_39880 = f__$1.call(null,inst_39879);
var state_39882__$1 = state_39882;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39882__$1,inst_39880);
} else {
return null;
}
}
});})(c__39047__auto__,f__$1))
;
return ((function (switch__38933__auto__,c__39047__auto__,f__$1){
return (function() {
var cljs$core$async$transduce_$_state_machine__38934__auto__ = null;
var cljs$core$async$transduce_$_state_machine__38934__auto____0 = (function (){
var statearr_39887 = [null,null,null,null,null,null,null];
(statearr_39887[(0)] = cljs$core$async$transduce_$_state_machine__38934__auto__);

(statearr_39887[(1)] = (1));

return statearr_39887;
});
var cljs$core$async$transduce_$_state_machine__38934__auto____1 = (function (state_39882){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39882);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39888){if((e39888 instanceof Object)){
var ex__38937__auto__ = e39888;
var statearr_39889_39891 = state_39882;
(statearr_39889_39891[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39882);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39888;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39892 = state_39882;
state_39882 = G__39892;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__38934__auto__ = function(state_39882){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__38934__auto____1.call(this,state_39882);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$transduce_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__38934__auto____0;
cljs$core$async$transduce_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__38934__auto____1;
return cljs$core$async$transduce_$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto__,f__$1))
})();
var state__39049__auto__ = (function (){var statearr_39890 = f__39048__auto__.call(null);
(statearr_39890[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto__);

return statearr_39890;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto__,f__$1))
);

return c__39047__auto__;
});
/**
 * Puts the contents of coll into the supplied channel.
 * 
 *   By default the channel will be closed after the items are copied,
 *   but can be determined by the close? parameter.
 * 
 *   Returns a channel which will close after the items are copied.
 */
cljs.core.async.onto_chan = (function cljs$core$async$onto_chan(var_args){
var args39893 = [];
var len__24369__auto___39945 = arguments.length;
var i__24370__auto___39946 = (0);
while(true){
if((i__24370__auto___39946 < len__24369__auto___39945)){
args39893.push((arguments[i__24370__auto___39946]));

var G__39947 = (i__24370__auto___39946 + (1));
i__24370__auto___39946 = G__39947;
continue;
} else {
}
break;
}

var G__39895 = args39893.length;
switch (G__39895) {
case 2:
return cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args39893.length)].join('')));

}
});

cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2 = (function (ch,coll){
return cljs.core.async.onto_chan.call(null,ch,coll,true);
});

cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__39047__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto__){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto__){
return (function (state_39920){
var state_val_39921 = (state_39920[(1)]);
if((state_val_39921 === (7))){
var inst_39902 = (state_39920[(2)]);
var state_39920__$1 = state_39920;
var statearr_39922_39949 = state_39920__$1;
(statearr_39922_39949[(2)] = inst_39902);

(statearr_39922_39949[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (1))){
var inst_39896 = cljs.core.seq.call(null,coll);
var inst_39897 = inst_39896;
var state_39920__$1 = (function (){var statearr_39923 = state_39920;
(statearr_39923[(7)] = inst_39897);

return statearr_39923;
})();
var statearr_39924_39950 = state_39920__$1;
(statearr_39924_39950[(2)] = null);

(statearr_39924_39950[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (4))){
var inst_39897 = (state_39920[(7)]);
var inst_39900 = cljs.core.first.call(null,inst_39897);
var state_39920__$1 = state_39920;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39920__$1,(7),ch,inst_39900);
} else {
if((state_val_39921 === (13))){
var inst_39914 = (state_39920[(2)]);
var state_39920__$1 = state_39920;
var statearr_39925_39951 = state_39920__$1;
(statearr_39925_39951[(2)] = inst_39914);

(statearr_39925_39951[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (6))){
var inst_39905 = (state_39920[(2)]);
var state_39920__$1 = state_39920;
if(cljs.core.truth_(inst_39905)){
var statearr_39926_39952 = state_39920__$1;
(statearr_39926_39952[(1)] = (8));

} else {
var statearr_39927_39953 = state_39920__$1;
(statearr_39927_39953[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (3))){
var inst_39918 = (state_39920[(2)]);
var state_39920__$1 = state_39920;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39920__$1,inst_39918);
} else {
if((state_val_39921 === (12))){
var state_39920__$1 = state_39920;
var statearr_39928_39954 = state_39920__$1;
(statearr_39928_39954[(2)] = null);

(statearr_39928_39954[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (2))){
var inst_39897 = (state_39920[(7)]);
var state_39920__$1 = state_39920;
if(cljs.core.truth_(inst_39897)){
var statearr_39929_39955 = state_39920__$1;
(statearr_39929_39955[(1)] = (4));

} else {
var statearr_39930_39956 = state_39920__$1;
(statearr_39930_39956[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (11))){
var inst_39911 = cljs.core.async.close_BANG_.call(null,ch);
var state_39920__$1 = state_39920;
var statearr_39931_39957 = state_39920__$1;
(statearr_39931_39957[(2)] = inst_39911);

(statearr_39931_39957[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (9))){
var state_39920__$1 = state_39920;
if(cljs.core.truth_(close_QMARK_)){
var statearr_39932_39958 = state_39920__$1;
(statearr_39932_39958[(1)] = (11));

} else {
var statearr_39933_39959 = state_39920__$1;
(statearr_39933_39959[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (5))){
var inst_39897 = (state_39920[(7)]);
var state_39920__$1 = state_39920;
var statearr_39934_39960 = state_39920__$1;
(statearr_39934_39960[(2)] = inst_39897);

(statearr_39934_39960[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (10))){
var inst_39916 = (state_39920[(2)]);
var state_39920__$1 = state_39920;
var statearr_39935_39961 = state_39920__$1;
(statearr_39935_39961[(2)] = inst_39916);

(statearr_39935_39961[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39921 === (8))){
var inst_39897 = (state_39920[(7)]);
var inst_39907 = cljs.core.next.call(null,inst_39897);
var inst_39897__$1 = inst_39907;
var state_39920__$1 = (function (){var statearr_39936 = state_39920;
(statearr_39936[(7)] = inst_39897__$1);

return statearr_39936;
})();
var statearr_39937_39962 = state_39920__$1;
(statearr_39937_39962[(2)] = null);

(statearr_39937_39962[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto__))
;
return ((function (switch__38933__auto__,c__39047__auto__){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_39941 = [null,null,null,null,null,null,null,null];
(statearr_39941[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_39941[(1)] = (1));

return statearr_39941;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_39920){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_39920);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e39942){if((e39942 instanceof Object)){
var ex__38937__auto__ = e39942;
var statearr_39943_39963 = state_39920;
(statearr_39943_39963[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39920);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39942;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39964 = state_39920;
state_39920 = G__39964;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_39920){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_39920);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto__))
})();
var state__39049__auto__ = (function (){var statearr_39944 = f__39048__auto__.call(null);
(statearr_39944[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto__);

return statearr_39944;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto__))
);

return c__39047__auto__;
});

cljs.core.async.onto_chan.cljs$lang$maxFixedArity = 3;

/**
 * Creates and returns a channel which contains the contents of coll,
 *   closing when exhausted.
 */
cljs.core.async.to_chan = (function cljs$core$async$to_chan(coll){
var ch = cljs.core.async.chan.call(null,cljs.core.bounded_count.call(null,(100),coll));
cljs.core.async.onto_chan.call(null,ch,coll);

return ch;
});

/**
 * @interface
 */
cljs.core.async.Mux = function(){};

cljs.core.async.muxch_STAR_ = (function cljs$core$async$muxch_STAR_(_){
if((!((_ == null))) && (!((_.cljs$core$async$Mux$muxch_STAR_$arity$1 == null)))){
return _.cljs$core$async$Mux$muxch_STAR_$arity$1(_);
} else {
var x__23866__auto__ = (((_ == null))?null:_);
var m__23867__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,_);
} else {
var m__23867__auto____$1 = (cljs.core.async.muxch_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,_);
} else {
throw cljs.core.missing_protocol.call(null,"Mux.muxch*",_);
}
}
}
});


/**
 * @interface
 */
cljs.core.async.Mult = function(){};

cljs.core.async.tap_STAR_ = (function cljs$core$async$tap_STAR_(m,ch,close_QMARK_){
if((!((m == null))) && (!((m.cljs$core$async$Mult$tap_STAR_$arity$3 == null)))){
return m.cljs$core$async$Mult$tap_STAR_$arity$3(m,ch,close_QMARK_);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,ch,close_QMARK_);
} else {
var m__23867__auto____$1 = (cljs.core.async.tap_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,ch,close_QMARK_);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.tap*",m);
}
}
}
});

cljs.core.async.untap_STAR_ = (function cljs$core$async$untap_STAR_(m,ch){
if((!((m == null))) && (!((m.cljs$core$async$Mult$untap_STAR_$arity$2 == null)))){
return m.cljs$core$async$Mult$untap_STAR_$arity$2(m,ch);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,ch);
} else {
var m__23867__auto____$1 = (cljs.core.async.untap_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.untap*",m);
}
}
}
});

cljs.core.async.untap_all_STAR_ = (function cljs$core$async$untap_all_STAR_(m){
if((!((m == null))) && (!((m.cljs$core$async$Mult$untap_all_STAR_$arity$1 == null)))){
return m.cljs$core$async$Mult$untap_all_STAR_$arity$1(m);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m);
} else {
var m__23867__auto____$1 = (cljs.core.async.untap_all_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.untap-all*",m);
}
}
}
});

/**
 * Creates and returns a mult(iple) of the supplied channel. Channels
 *   containing copies of the channel can be created with 'tap', and
 *   detached with 'untap'.
 * 
 *   Each item is distributed to all taps in parallel and synchronously,
 *   i.e. each tap must accept before the next item is distributed. Use
 *   buffering/windowing to prevent slow taps from holding up the mult.
 * 
 *   Items received when there are no taps get dropped.
 * 
 *   If a tap puts to a closed channel, it will be removed from the mult.
 */
cljs.core.async.mult = (function cljs$core$async$mult(ch){
var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var m = (function (){
if(typeof cljs.core.async.t_cljs$core$async40190 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.Mult}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async40190 = (function (ch,cs,meta40191){
this.ch = ch;
this.cs = cs;
this.meta40191 = meta40191;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs){
return (function (_40192,meta40191__$1){
var self__ = this;
var _40192__$1 = this;
return (new cljs.core.async.t_cljs$core$async40190(self__.ch,self__.cs,meta40191__$1));
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){
return (function (_40192){
var self__ = this;
var _40192__$1 = this;
return self__.meta40191;
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.ch;
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mult$tap_STAR_$arity$3 = ((function (cs){
return (function (_,ch__$1,close_QMARK_){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch__$1,close_QMARK_);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mult$untap_STAR_$arity$2 = ((function (cs){
return (function (_,ch__$1){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch__$1);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.prototype.cljs$core$async$Mult$untap_all_STAR_$arity$1 = ((function (cs){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.getBasis = ((function (cs){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"cs","cs",-117024463,null),new cljs.core.Symbol(null,"meta40191","meta40191",-143381341,null)], null);
});})(cs))
;

cljs.core.async.t_cljs$core$async40190.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async40190.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async40190";

cljs.core.async.t_cljs$core$async40190.cljs$lang$ctorPrWriter = ((function (cs){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async40190");
});})(cs))
;

cljs.core.async.__GT_t_cljs$core$async40190 = ((function (cs){
return (function cljs$core$async$mult_$___GT_t_cljs$core$async40190(ch__$1,cs__$1,meta40191){
return (new cljs.core.async.t_cljs$core$async40190(ch__$1,cs__$1,meta40191));
});})(cs))
;

}

return (new cljs.core.async.t_cljs$core$async40190(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var dchan = cljs.core.async.chan.call(null,(1));
var dctr = cljs.core.atom.call(null,null);
var done = ((function (cs,m,dchan,dctr){
return (function (_){
if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,true);
} else {
return null;
}
});})(cs,m,dchan,dctr))
;
var c__39047__auto___40415 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___40415,cs,m,dchan,dctr,done){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___40415,cs,m,dchan,dctr,done){
return (function (state_40327){
var state_val_40328 = (state_40327[(1)]);
if((state_val_40328 === (7))){
var inst_40323 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40329_40416 = state_40327__$1;
(statearr_40329_40416[(2)] = inst_40323);

(statearr_40329_40416[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (20))){
var inst_40226 = (state_40327[(7)]);
var inst_40238 = cljs.core.first.call(null,inst_40226);
var inst_40239 = cljs.core.nth.call(null,inst_40238,(0),null);
var inst_40240 = cljs.core.nth.call(null,inst_40238,(1),null);
var state_40327__$1 = (function (){var statearr_40330 = state_40327;
(statearr_40330[(8)] = inst_40239);

return statearr_40330;
})();
if(cljs.core.truth_(inst_40240)){
var statearr_40331_40417 = state_40327__$1;
(statearr_40331_40417[(1)] = (22));

} else {
var statearr_40332_40418 = state_40327__$1;
(statearr_40332_40418[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (27))){
var inst_40195 = (state_40327[(9)]);
var inst_40275 = (state_40327[(10)]);
var inst_40268 = (state_40327[(11)]);
var inst_40270 = (state_40327[(12)]);
var inst_40275__$1 = cljs.core._nth.call(null,inst_40268,inst_40270);
var inst_40276 = cljs.core.async.put_BANG_.call(null,inst_40275__$1,inst_40195,done);
var state_40327__$1 = (function (){var statearr_40333 = state_40327;
(statearr_40333[(10)] = inst_40275__$1);

return statearr_40333;
})();
if(cljs.core.truth_(inst_40276)){
var statearr_40334_40419 = state_40327__$1;
(statearr_40334_40419[(1)] = (30));

} else {
var statearr_40335_40420 = state_40327__$1;
(statearr_40335_40420[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (1))){
var state_40327__$1 = state_40327;
var statearr_40336_40421 = state_40327__$1;
(statearr_40336_40421[(2)] = null);

(statearr_40336_40421[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (24))){
var inst_40226 = (state_40327[(7)]);
var inst_40245 = (state_40327[(2)]);
var inst_40246 = cljs.core.next.call(null,inst_40226);
var inst_40204 = inst_40246;
var inst_40205 = null;
var inst_40206 = (0);
var inst_40207 = (0);
var state_40327__$1 = (function (){var statearr_40337 = state_40327;
(statearr_40337[(13)] = inst_40245);

(statearr_40337[(14)] = inst_40204);

(statearr_40337[(15)] = inst_40205);

(statearr_40337[(16)] = inst_40207);

(statearr_40337[(17)] = inst_40206);

return statearr_40337;
})();
var statearr_40338_40422 = state_40327__$1;
(statearr_40338_40422[(2)] = null);

(statearr_40338_40422[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (39))){
var state_40327__$1 = state_40327;
var statearr_40342_40423 = state_40327__$1;
(statearr_40342_40423[(2)] = null);

(statearr_40342_40423[(1)] = (41));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (4))){
var inst_40195 = (state_40327[(9)]);
var inst_40195__$1 = (state_40327[(2)]);
var inst_40196 = (inst_40195__$1 == null);
var state_40327__$1 = (function (){var statearr_40343 = state_40327;
(statearr_40343[(9)] = inst_40195__$1);

return statearr_40343;
})();
if(cljs.core.truth_(inst_40196)){
var statearr_40344_40424 = state_40327__$1;
(statearr_40344_40424[(1)] = (5));

} else {
var statearr_40345_40425 = state_40327__$1;
(statearr_40345_40425[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (15))){
var inst_40204 = (state_40327[(14)]);
var inst_40205 = (state_40327[(15)]);
var inst_40207 = (state_40327[(16)]);
var inst_40206 = (state_40327[(17)]);
var inst_40222 = (state_40327[(2)]);
var inst_40223 = (inst_40207 + (1));
var tmp40339 = inst_40204;
var tmp40340 = inst_40205;
var tmp40341 = inst_40206;
var inst_40204__$1 = tmp40339;
var inst_40205__$1 = tmp40340;
var inst_40206__$1 = tmp40341;
var inst_40207__$1 = inst_40223;
var state_40327__$1 = (function (){var statearr_40346 = state_40327;
(statearr_40346[(14)] = inst_40204__$1);

(statearr_40346[(15)] = inst_40205__$1);

(statearr_40346[(16)] = inst_40207__$1);

(statearr_40346[(17)] = inst_40206__$1);

(statearr_40346[(18)] = inst_40222);

return statearr_40346;
})();
var statearr_40347_40426 = state_40327__$1;
(statearr_40347_40426[(2)] = null);

(statearr_40347_40426[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (21))){
var inst_40249 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40351_40427 = state_40327__$1;
(statearr_40351_40427[(2)] = inst_40249);

(statearr_40351_40427[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (31))){
var inst_40275 = (state_40327[(10)]);
var inst_40279 = done.call(null,null);
var inst_40280 = cljs.core.async.untap_STAR_.call(null,m,inst_40275);
var state_40327__$1 = (function (){var statearr_40352 = state_40327;
(statearr_40352[(19)] = inst_40279);

return statearr_40352;
})();
var statearr_40353_40428 = state_40327__$1;
(statearr_40353_40428[(2)] = inst_40280);

(statearr_40353_40428[(1)] = (32));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (32))){
var inst_40267 = (state_40327[(20)]);
var inst_40268 = (state_40327[(11)]);
var inst_40269 = (state_40327[(21)]);
var inst_40270 = (state_40327[(12)]);
var inst_40282 = (state_40327[(2)]);
var inst_40283 = (inst_40270 + (1));
var tmp40348 = inst_40267;
var tmp40349 = inst_40268;
var tmp40350 = inst_40269;
var inst_40267__$1 = tmp40348;
var inst_40268__$1 = tmp40349;
var inst_40269__$1 = tmp40350;
var inst_40270__$1 = inst_40283;
var state_40327__$1 = (function (){var statearr_40354 = state_40327;
(statearr_40354[(22)] = inst_40282);

(statearr_40354[(20)] = inst_40267__$1);

(statearr_40354[(11)] = inst_40268__$1);

(statearr_40354[(21)] = inst_40269__$1);

(statearr_40354[(12)] = inst_40270__$1);

return statearr_40354;
})();
var statearr_40355_40429 = state_40327__$1;
(statearr_40355_40429[(2)] = null);

(statearr_40355_40429[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (40))){
var inst_40295 = (state_40327[(23)]);
var inst_40299 = done.call(null,null);
var inst_40300 = cljs.core.async.untap_STAR_.call(null,m,inst_40295);
var state_40327__$1 = (function (){var statearr_40356 = state_40327;
(statearr_40356[(24)] = inst_40299);

return statearr_40356;
})();
var statearr_40357_40430 = state_40327__$1;
(statearr_40357_40430[(2)] = inst_40300);

(statearr_40357_40430[(1)] = (41));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (33))){
var inst_40286 = (state_40327[(25)]);
var inst_40288 = cljs.core.chunked_seq_QMARK_.call(null,inst_40286);
var state_40327__$1 = state_40327;
if(inst_40288){
var statearr_40358_40431 = state_40327__$1;
(statearr_40358_40431[(1)] = (36));

} else {
var statearr_40359_40432 = state_40327__$1;
(statearr_40359_40432[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (13))){
var inst_40216 = (state_40327[(26)]);
var inst_40219 = cljs.core.async.close_BANG_.call(null,inst_40216);
var state_40327__$1 = state_40327;
var statearr_40360_40433 = state_40327__$1;
(statearr_40360_40433[(2)] = inst_40219);

(statearr_40360_40433[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (22))){
var inst_40239 = (state_40327[(8)]);
var inst_40242 = cljs.core.async.close_BANG_.call(null,inst_40239);
var state_40327__$1 = state_40327;
var statearr_40361_40434 = state_40327__$1;
(statearr_40361_40434[(2)] = inst_40242);

(statearr_40361_40434[(1)] = (24));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (36))){
var inst_40286 = (state_40327[(25)]);
var inst_40290 = cljs.core.chunk_first.call(null,inst_40286);
var inst_40291 = cljs.core.chunk_rest.call(null,inst_40286);
var inst_40292 = cljs.core.count.call(null,inst_40290);
var inst_40267 = inst_40291;
var inst_40268 = inst_40290;
var inst_40269 = inst_40292;
var inst_40270 = (0);
var state_40327__$1 = (function (){var statearr_40362 = state_40327;
(statearr_40362[(20)] = inst_40267);

(statearr_40362[(11)] = inst_40268);

(statearr_40362[(21)] = inst_40269);

(statearr_40362[(12)] = inst_40270);

return statearr_40362;
})();
var statearr_40363_40435 = state_40327__$1;
(statearr_40363_40435[(2)] = null);

(statearr_40363_40435[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (41))){
var inst_40286 = (state_40327[(25)]);
var inst_40302 = (state_40327[(2)]);
var inst_40303 = cljs.core.next.call(null,inst_40286);
var inst_40267 = inst_40303;
var inst_40268 = null;
var inst_40269 = (0);
var inst_40270 = (0);
var state_40327__$1 = (function (){var statearr_40364 = state_40327;
(statearr_40364[(20)] = inst_40267);

(statearr_40364[(11)] = inst_40268);

(statearr_40364[(27)] = inst_40302);

(statearr_40364[(21)] = inst_40269);

(statearr_40364[(12)] = inst_40270);

return statearr_40364;
})();
var statearr_40365_40436 = state_40327__$1;
(statearr_40365_40436[(2)] = null);

(statearr_40365_40436[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (43))){
var state_40327__$1 = state_40327;
var statearr_40366_40437 = state_40327__$1;
(statearr_40366_40437[(2)] = null);

(statearr_40366_40437[(1)] = (44));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (29))){
var inst_40311 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40367_40438 = state_40327__$1;
(statearr_40367_40438[(2)] = inst_40311);

(statearr_40367_40438[(1)] = (26));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (44))){
var inst_40320 = (state_40327[(2)]);
var state_40327__$1 = (function (){var statearr_40368 = state_40327;
(statearr_40368[(28)] = inst_40320);

return statearr_40368;
})();
var statearr_40369_40439 = state_40327__$1;
(statearr_40369_40439[(2)] = null);

(statearr_40369_40439[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (6))){
var inst_40259 = (state_40327[(29)]);
var inst_40258 = cljs.core.deref.call(null,cs);
var inst_40259__$1 = cljs.core.keys.call(null,inst_40258);
var inst_40260 = cljs.core.count.call(null,inst_40259__$1);
var inst_40261 = cljs.core.reset_BANG_.call(null,dctr,inst_40260);
var inst_40266 = cljs.core.seq.call(null,inst_40259__$1);
var inst_40267 = inst_40266;
var inst_40268 = null;
var inst_40269 = (0);
var inst_40270 = (0);
var state_40327__$1 = (function (){var statearr_40370 = state_40327;
(statearr_40370[(20)] = inst_40267);

(statearr_40370[(30)] = inst_40261);

(statearr_40370[(11)] = inst_40268);

(statearr_40370[(29)] = inst_40259__$1);

(statearr_40370[(21)] = inst_40269);

(statearr_40370[(12)] = inst_40270);

return statearr_40370;
})();
var statearr_40371_40440 = state_40327__$1;
(statearr_40371_40440[(2)] = null);

(statearr_40371_40440[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (28))){
var inst_40267 = (state_40327[(20)]);
var inst_40286 = (state_40327[(25)]);
var inst_40286__$1 = cljs.core.seq.call(null,inst_40267);
var state_40327__$1 = (function (){var statearr_40372 = state_40327;
(statearr_40372[(25)] = inst_40286__$1);

return statearr_40372;
})();
if(inst_40286__$1){
var statearr_40373_40441 = state_40327__$1;
(statearr_40373_40441[(1)] = (33));

} else {
var statearr_40374_40442 = state_40327__$1;
(statearr_40374_40442[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (25))){
var inst_40269 = (state_40327[(21)]);
var inst_40270 = (state_40327[(12)]);
var inst_40272 = (inst_40270 < inst_40269);
var inst_40273 = inst_40272;
var state_40327__$1 = state_40327;
if(cljs.core.truth_(inst_40273)){
var statearr_40375_40443 = state_40327__$1;
(statearr_40375_40443[(1)] = (27));

} else {
var statearr_40376_40444 = state_40327__$1;
(statearr_40376_40444[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (34))){
var state_40327__$1 = state_40327;
var statearr_40377_40445 = state_40327__$1;
(statearr_40377_40445[(2)] = null);

(statearr_40377_40445[(1)] = (35));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (17))){
var state_40327__$1 = state_40327;
var statearr_40378_40446 = state_40327__$1;
(statearr_40378_40446[(2)] = null);

(statearr_40378_40446[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (3))){
var inst_40325 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40327__$1,inst_40325);
} else {
if((state_val_40328 === (12))){
var inst_40254 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40379_40447 = state_40327__$1;
(statearr_40379_40447[(2)] = inst_40254);

(statearr_40379_40447[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (2))){
var state_40327__$1 = state_40327;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40327__$1,(4),ch);
} else {
if((state_val_40328 === (23))){
var state_40327__$1 = state_40327;
var statearr_40380_40448 = state_40327__$1;
(statearr_40380_40448[(2)] = null);

(statearr_40380_40448[(1)] = (24));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (35))){
var inst_40309 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40381_40449 = state_40327__$1;
(statearr_40381_40449[(2)] = inst_40309);

(statearr_40381_40449[(1)] = (29));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (19))){
var inst_40226 = (state_40327[(7)]);
var inst_40230 = cljs.core.chunk_first.call(null,inst_40226);
var inst_40231 = cljs.core.chunk_rest.call(null,inst_40226);
var inst_40232 = cljs.core.count.call(null,inst_40230);
var inst_40204 = inst_40231;
var inst_40205 = inst_40230;
var inst_40206 = inst_40232;
var inst_40207 = (0);
var state_40327__$1 = (function (){var statearr_40382 = state_40327;
(statearr_40382[(14)] = inst_40204);

(statearr_40382[(15)] = inst_40205);

(statearr_40382[(16)] = inst_40207);

(statearr_40382[(17)] = inst_40206);

return statearr_40382;
})();
var statearr_40383_40450 = state_40327__$1;
(statearr_40383_40450[(2)] = null);

(statearr_40383_40450[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (11))){
var inst_40204 = (state_40327[(14)]);
var inst_40226 = (state_40327[(7)]);
var inst_40226__$1 = cljs.core.seq.call(null,inst_40204);
var state_40327__$1 = (function (){var statearr_40384 = state_40327;
(statearr_40384[(7)] = inst_40226__$1);

return statearr_40384;
})();
if(inst_40226__$1){
var statearr_40385_40451 = state_40327__$1;
(statearr_40385_40451[(1)] = (16));

} else {
var statearr_40386_40452 = state_40327__$1;
(statearr_40386_40452[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (9))){
var inst_40256 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40387_40453 = state_40327__$1;
(statearr_40387_40453[(2)] = inst_40256);

(statearr_40387_40453[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (5))){
var inst_40202 = cljs.core.deref.call(null,cs);
var inst_40203 = cljs.core.seq.call(null,inst_40202);
var inst_40204 = inst_40203;
var inst_40205 = null;
var inst_40206 = (0);
var inst_40207 = (0);
var state_40327__$1 = (function (){var statearr_40388 = state_40327;
(statearr_40388[(14)] = inst_40204);

(statearr_40388[(15)] = inst_40205);

(statearr_40388[(16)] = inst_40207);

(statearr_40388[(17)] = inst_40206);

return statearr_40388;
})();
var statearr_40389_40454 = state_40327__$1;
(statearr_40389_40454[(2)] = null);

(statearr_40389_40454[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (14))){
var state_40327__$1 = state_40327;
var statearr_40390_40455 = state_40327__$1;
(statearr_40390_40455[(2)] = null);

(statearr_40390_40455[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (45))){
var inst_40317 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40391_40456 = state_40327__$1;
(statearr_40391_40456[(2)] = inst_40317);

(statearr_40391_40456[(1)] = (44));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (26))){
var inst_40259 = (state_40327[(29)]);
var inst_40313 = (state_40327[(2)]);
var inst_40314 = cljs.core.seq.call(null,inst_40259);
var state_40327__$1 = (function (){var statearr_40392 = state_40327;
(statearr_40392[(31)] = inst_40313);

return statearr_40392;
})();
if(inst_40314){
var statearr_40393_40457 = state_40327__$1;
(statearr_40393_40457[(1)] = (42));

} else {
var statearr_40394_40458 = state_40327__$1;
(statearr_40394_40458[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (16))){
var inst_40226 = (state_40327[(7)]);
var inst_40228 = cljs.core.chunked_seq_QMARK_.call(null,inst_40226);
var state_40327__$1 = state_40327;
if(inst_40228){
var statearr_40395_40459 = state_40327__$1;
(statearr_40395_40459[(1)] = (19));

} else {
var statearr_40396_40460 = state_40327__$1;
(statearr_40396_40460[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (38))){
var inst_40306 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40397_40461 = state_40327__$1;
(statearr_40397_40461[(2)] = inst_40306);

(statearr_40397_40461[(1)] = (35));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (30))){
var state_40327__$1 = state_40327;
var statearr_40398_40462 = state_40327__$1;
(statearr_40398_40462[(2)] = null);

(statearr_40398_40462[(1)] = (32));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (10))){
var inst_40205 = (state_40327[(15)]);
var inst_40207 = (state_40327[(16)]);
var inst_40215 = cljs.core._nth.call(null,inst_40205,inst_40207);
var inst_40216 = cljs.core.nth.call(null,inst_40215,(0),null);
var inst_40217 = cljs.core.nth.call(null,inst_40215,(1),null);
var state_40327__$1 = (function (){var statearr_40399 = state_40327;
(statearr_40399[(26)] = inst_40216);

return statearr_40399;
})();
if(cljs.core.truth_(inst_40217)){
var statearr_40400_40463 = state_40327__$1;
(statearr_40400_40463[(1)] = (13));

} else {
var statearr_40401_40464 = state_40327__$1;
(statearr_40401_40464[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (18))){
var inst_40252 = (state_40327[(2)]);
var state_40327__$1 = state_40327;
var statearr_40402_40465 = state_40327__$1;
(statearr_40402_40465[(2)] = inst_40252);

(statearr_40402_40465[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (42))){
var state_40327__$1 = state_40327;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40327__$1,(45),dchan);
} else {
if((state_val_40328 === (37))){
var inst_40295 = (state_40327[(23)]);
var inst_40195 = (state_40327[(9)]);
var inst_40286 = (state_40327[(25)]);
var inst_40295__$1 = cljs.core.first.call(null,inst_40286);
var inst_40296 = cljs.core.async.put_BANG_.call(null,inst_40295__$1,inst_40195,done);
var state_40327__$1 = (function (){var statearr_40403 = state_40327;
(statearr_40403[(23)] = inst_40295__$1);

return statearr_40403;
})();
if(cljs.core.truth_(inst_40296)){
var statearr_40404_40466 = state_40327__$1;
(statearr_40404_40466[(1)] = (39));

} else {
var statearr_40405_40467 = state_40327__$1;
(statearr_40405_40467[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40328 === (8))){
var inst_40207 = (state_40327[(16)]);
var inst_40206 = (state_40327[(17)]);
var inst_40209 = (inst_40207 < inst_40206);
var inst_40210 = inst_40209;
var state_40327__$1 = state_40327;
if(cljs.core.truth_(inst_40210)){
var statearr_40406_40468 = state_40327__$1;
(statearr_40406_40468[(1)] = (10));

} else {
var statearr_40407_40469 = state_40327__$1;
(statearr_40407_40469[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___40415,cs,m,dchan,dctr,done))
;
return ((function (switch__38933__auto__,c__39047__auto___40415,cs,m,dchan,dctr,done){
return (function() {
var cljs$core$async$mult_$_state_machine__38934__auto__ = null;
var cljs$core$async$mult_$_state_machine__38934__auto____0 = (function (){
var statearr_40411 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_40411[(0)] = cljs$core$async$mult_$_state_machine__38934__auto__);

(statearr_40411[(1)] = (1));

return statearr_40411;
});
var cljs$core$async$mult_$_state_machine__38934__auto____1 = (function (state_40327){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_40327);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e40412){if((e40412 instanceof Object)){
var ex__38937__auto__ = e40412;
var statearr_40413_40470 = state_40327;
(statearr_40413_40470[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40327);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40412;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40471 = state_40327;
state_40327 = G__40471;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__38934__auto__ = function(state_40327){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__38934__auto____1.call(this,state_40327);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mult_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__38934__auto____0;
cljs$core$async$mult_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__38934__auto____1;
return cljs$core$async$mult_$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___40415,cs,m,dchan,dctr,done))
})();
var state__39049__auto__ = (function (){var statearr_40414 = f__39048__auto__.call(null);
(statearr_40414[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___40415);

return statearr_40414;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___40415,cs,m,dchan,dctr,done))
);


return m;
});
/**
 * Copies the mult source onto the supplied channel.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.tap = (function cljs$core$async$tap(var_args){
var args40472 = [];
var len__24369__auto___40475 = arguments.length;
var i__24370__auto___40476 = (0);
while(true){
if((i__24370__auto___40476 < len__24369__auto___40475)){
args40472.push((arguments[i__24370__auto___40476]));

var G__40477 = (i__24370__auto___40476 + (1));
i__24370__auto___40476 = G__40477;
continue;
} else {
}
break;
}

var G__40474 = args40472.length;
switch (G__40474) {
case 2:
return cljs.core.async.tap.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40472.length)].join('')));

}
});

cljs.core.async.tap.cljs$core$IFn$_invoke$arity$2 = (function (mult,ch){
return cljs.core.async.tap.call(null,mult,ch,true);
});

cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3 = (function (mult,ch,close_QMARK_){
cljs.core.async.tap_STAR_.call(null,mult,ch,close_QMARK_);

return ch;
});

cljs.core.async.tap.cljs$lang$maxFixedArity = 3;

/**
 * Disconnects a target channel from a mult
 */
cljs.core.async.untap = (function cljs$core$async$untap(mult,ch){
return cljs.core.async.untap_STAR_.call(null,mult,ch);
});
/**
 * Disconnects all target channels from a mult
 */
cljs.core.async.untap_all = (function cljs$core$async$untap_all(mult){
return cljs.core.async.untap_all_STAR_.call(null,mult);
});

/**
 * @interface
 */
cljs.core.async.Mix = function(){};

cljs.core.async.admix_STAR_ = (function cljs$core$async$admix_STAR_(m,ch){
if((!((m == null))) && (!((m.cljs$core$async$Mix$admix_STAR_$arity$2 == null)))){
return m.cljs$core$async$Mix$admix_STAR_$arity$2(m,ch);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,ch);
} else {
var m__23867__auto____$1 = (cljs.core.async.admix_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.admix*",m);
}
}
}
});

cljs.core.async.unmix_STAR_ = (function cljs$core$async$unmix_STAR_(m,ch){
if((!((m == null))) && (!((m.cljs$core$async$Mix$unmix_STAR_$arity$2 == null)))){
return m.cljs$core$async$Mix$unmix_STAR_$arity$2(m,ch);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,ch);
} else {
var m__23867__auto____$1 = (cljs.core.async.unmix_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.unmix*",m);
}
}
}
});

cljs.core.async.unmix_all_STAR_ = (function cljs$core$async$unmix_all_STAR_(m){
if((!((m == null))) && (!((m.cljs$core$async$Mix$unmix_all_STAR_$arity$1 == null)))){
return m.cljs$core$async$Mix$unmix_all_STAR_$arity$1(m);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m);
} else {
var m__23867__auto____$1 = (cljs.core.async.unmix_all_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.unmix-all*",m);
}
}
}
});

cljs.core.async.toggle_STAR_ = (function cljs$core$async$toggle_STAR_(m,state_map){
if((!((m == null))) && (!((m.cljs$core$async$Mix$toggle_STAR_$arity$2 == null)))){
return m.cljs$core$async$Mix$toggle_STAR_$arity$2(m,state_map);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,state_map);
} else {
var m__23867__auto____$1 = (cljs.core.async.toggle_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,state_map);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.toggle*",m);
}
}
}
});

cljs.core.async.solo_mode_STAR_ = (function cljs$core$async$solo_mode_STAR_(m,mode){
if((!((m == null))) && (!((m.cljs$core$async$Mix$solo_mode_STAR_$arity$2 == null)))){
return m.cljs$core$async$Mix$solo_mode_STAR_$arity$2(m,mode);
} else {
var x__23866__auto__ = (((m == null))?null:m);
var m__23867__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,m,mode);
} else {
var m__23867__auto____$1 = (cljs.core.async.solo_mode_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,m,mode);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.solo-mode*",m);
}
}
}
});

cljs.core.async.ioc_alts_BANG_ = (function cljs$core$async$ioc_alts_BANG_(var_args){
var args__24376__auto__ = [];
var len__24369__auto___40489 = arguments.length;
var i__24370__auto___40490 = (0);
while(true){
if((i__24370__auto___40490 < len__24369__auto___40489)){
args__24376__auto__.push((arguments[i__24370__auto___40490]));

var G__40491 = (i__24370__auto___40490 + (1));
i__24370__auto___40490 = G__40491;
continue;
} else {
}
break;
}

var argseq__24377__auto__ = ((((3) < args__24376__auto__.length))?(new cljs.core.IndexedSeq(args__24376__auto__.slice((3)),(0),null)):null);
return cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__24377__auto__);
});

cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__40483){
var map__40484 = p__40483;
var map__40484__$1 = ((((!((map__40484 == null)))?((((map__40484.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__40484.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__40484):map__40484);
var opts = map__40484__$1;
var statearr_40486_40492 = state;
(statearr_40486_40492[cljs.core.async.impl.ioc_helpers.STATE_IDX] = cont_block);


var temp__5278__auto__ = cljs.core.async.do_alts.call(null,((function (map__40484,map__40484__$1,opts){
return (function (val){
var statearr_40487_40493 = state;
(statearr_40487_40493[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
});})(map__40484,map__40484__$1,opts))
,ports,opts);
if(cljs.core.truth_(temp__5278__auto__)){
var cb = temp__5278__auto__;
var statearr_40488_40494 = state;
(statearr_40488_40494[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = cljs.core.deref.call(null,cb));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});

cljs.core.async.ioc_alts_BANG_.cljs$lang$maxFixedArity = (3);

cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq40479){
var G__40480 = cljs.core.first.call(null,seq40479);
var seq40479__$1 = cljs.core.next.call(null,seq40479);
var G__40481 = cljs.core.first.call(null,seq40479__$1);
var seq40479__$2 = cljs.core.next.call(null,seq40479__$1);
var G__40482 = cljs.core.first.call(null,seq40479__$2);
var seq40479__$3 = cljs.core.next.call(null,seq40479__$2);
return cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__40480,G__40481,G__40482,seq40479__$3);
});

/**
 * Creates and returns a mix of one or more input channels which will
 *   be put on the supplied out channel. Input sources can be added to
 *   the mix with 'admix', and removed with 'unmix'. A mix supports
 *   soloing, muting and pausing multiple inputs atomically using
 *   'toggle', and can solo using either muting or pausing as determined
 *   by 'solo-mode'.
 * 
 *   Each channel can have zero or more boolean modes set via 'toggle':
 * 
 *   :solo - when true, only this (ond other soloed) channel(s) will appear
 *        in the mix output channel. :mute and :pause states of soloed
 *        channels are ignored. If solo-mode is :mute, non-soloed
 *        channels are muted, if :pause, non-soloed channels are
 *        paused.
 * 
 *   :mute - muted channels will have their contents consumed but not included in the mix
 *   :pause - paused channels will not have their contents consumed (and thus also not included in the mix)
 */
cljs.core.async.mix = (function cljs$core$async$mix(out){
var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var solo_modes = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"pause","pause",-2095325672),null,new cljs.core.Keyword(null,"mute","mute",1151223646),null], null), null);
var attrs = cljs.core.conj.call(null,solo_modes,new cljs.core.Keyword(null,"solo","solo",-316350075));
var solo_mode = cljs.core.atom.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646));
var change = cljs.core.async.chan.call(null);
var changed = ((function (cs,solo_modes,attrs,solo_mode,change){
return (function (){
return cljs.core.async.put_BANG_.call(null,change,true);
});})(cs,solo_modes,attrs,solo_mode,change))
;
var pick = ((function (cs,solo_modes,attrs,solo_mode,change,changed){
return (function (attr,chs){
return cljs.core.reduce_kv.call(null,((function (cs,solo_modes,attrs,solo_mode,change,changed){
return (function (ret,c,v){
if(cljs.core.truth_(attr.call(null,v))){
return cljs.core.conj.call(null,ret,c);
} else {
return ret;
}
});})(cs,solo_modes,attrs,solo_mode,change,changed))
,cljs.core.PersistentHashSet.EMPTY,chs);
});})(cs,solo_modes,attrs,solo_mode,change,changed))
;
var calc_state = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick){
return (function (){
var chs = cljs.core.deref.call(null,cs);
var mode = cljs.core.deref.call(null,solo_mode);
var solos = pick.call(null,new cljs.core.Keyword(null,"solo","solo",-316350075),chs);
var pauses = pick.call(null,new cljs.core.Keyword(null,"pause","pause",-2095325672),chs);
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"solos","solos",1441458643),solos,new cljs.core.Keyword(null,"mutes","mutes",1068806309),pick.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646),chs),new cljs.core.Keyword(null,"reads","reads",-1215067361),cljs.core.conj.call(null,(((cljs.core._EQ_.call(null,mode,new cljs.core.Keyword(null,"pause","pause",-2095325672))) && (!(cljs.core.empty_QMARK_.call(null,solos))))?cljs.core.vec.call(null,solos):cljs.core.vec.call(null,cljs.core.remove.call(null,pauses,cljs.core.keys.call(null,chs)))),change)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick))
;
var m = (function (){
if(typeof cljs.core.async.t_cljs$core$async40662 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mix}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async40662 = (function (out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,meta40663){
this.out = out;
this.cs = cs;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.solo_mode = solo_mode;
this.change = change;
this.changed = changed;
this.pick = pick;
this.calc_state = calc_state;
this.meta40663 = meta40663;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_40664,meta40663__$1){
var self__ = this;
var _40664__$1 = this;
return (new cljs.core.async.t_cljs$core$async40662(self__.out,self__.cs,self__.solo_modes,self__.attrs,self__.solo_mode,self__.change,self__.changed,self__.pick,self__.calc_state,meta40663__$1));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_40664){
var self__ = this;
var _40664__$1 = this;
return self__.meta40663;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.out;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$admix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch,cljs.core.PersistentArrayMap.EMPTY);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$unmix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$unmix_all_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$toggle_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,state_map){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.partial.call(null,cljs.core.merge_with,cljs.core.merge),state_map);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.prototype.cljs$core$async$Mix$solo_mode_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,mode){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.solo_modes.call(null,mode))){
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Assert failed: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1([cljs.core.str.cljs$core$IFn$_invoke$arity$1("mode must be one of: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.solo_modes)].join('')),cljs.core.str.cljs$core$IFn$_invoke$arity$1("\n"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("(solo-modes mode)")].join('')));
}

cljs.core.reset_BANG_.call(null,self__.solo_mode,mode);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.getBasis = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (){
return new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"out","out",729986010,null),new cljs.core.Symbol(null,"cs","cs",-117024463,null),new cljs.core.Symbol(null,"solo-modes","solo-modes",882180540,null),new cljs.core.Symbol(null,"attrs","attrs",-450137186,null),new cljs.core.Symbol(null,"solo-mode","solo-mode",2031788074,null),new cljs.core.Symbol(null,"change","change",477485025,null),new cljs.core.Symbol(null,"changed","changed",-2083710852,null),new cljs.core.Symbol(null,"pick","pick",1300068175,null),new cljs.core.Symbol(null,"calc-state","calc-state",-349968968,null),new cljs.core.Symbol(null,"meta40663","meta40663",-1268412236,null)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async40662.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async40662.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async40662";

cljs.core.async.t_cljs$core$async40662.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async40662");
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.__GT_t_cljs$core$async40662 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function cljs$core$async$mix_$___GT_t_cljs$core$async40662(out__$1,cs__$1,solo_modes__$1,attrs__$1,solo_mode__$1,change__$1,changed__$1,pick__$1,calc_state__$1,meta40663){
return (new cljs.core.async.t_cljs$core$async40662(out__$1,cs__$1,solo_modes__$1,attrs__$1,solo_mode__$1,change__$1,changed__$1,pick__$1,calc_state__$1,meta40663));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

}

return (new cljs.core.async.t_cljs$core$async40662(out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__39047__auto___40829 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (state_40766){
var state_val_40767 = (state_40766[(1)]);
if((state_val_40767 === (7))){
var inst_40681 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
var statearr_40768_40830 = state_40766__$1;
(statearr_40768_40830[(2)] = inst_40681);

(statearr_40768_40830[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (20))){
var inst_40693 = (state_40766[(7)]);
var state_40766__$1 = state_40766;
var statearr_40769_40831 = state_40766__$1;
(statearr_40769_40831[(2)] = inst_40693);

(statearr_40769_40831[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (27))){
var state_40766__$1 = state_40766;
var statearr_40770_40832 = state_40766__$1;
(statearr_40770_40832[(2)] = null);

(statearr_40770_40832[(1)] = (28));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (1))){
var inst_40668 = (state_40766[(8)]);
var inst_40668__$1 = calc_state.call(null);
var inst_40670 = (inst_40668__$1 == null);
var inst_40671 = cljs.core.not.call(null,inst_40670);
var state_40766__$1 = (function (){var statearr_40771 = state_40766;
(statearr_40771[(8)] = inst_40668__$1);

return statearr_40771;
})();
if(inst_40671){
var statearr_40772_40833 = state_40766__$1;
(statearr_40772_40833[(1)] = (2));

} else {
var statearr_40773_40834 = state_40766__$1;
(statearr_40773_40834[(1)] = (3));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (24))){
var inst_40717 = (state_40766[(9)]);
var inst_40726 = (state_40766[(10)]);
var inst_40740 = (state_40766[(11)]);
var inst_40740__$1 = inst_40717.call(null,inst_40726);
var state_40766__$1 = (function (){var statearr_40774 = state_40766;
(statearr_40774[(11)] = inst_40740__$1);

return statearr_40774;
})();
if(cljs.core.truth_(inst_40740__$1)){
var statearr_40775_40835 = state_40766__$1;
(statearr_40775_40835[(1)] = (29));

} else {
var statearr_40776_40836 = state_40766__$1;
(statearr_40776_40836[(1)] = (30));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (4))){
var inst_40684 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40684)){
var statearr_40777_40837 = state_40766__$1;
(statearr_40777_40837[(1)] = (8));

} else {
var statearr_40778_40838 = state_40766__$1;
(statearr_40778_40838[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (15))){
var inst_40711 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40711)){
var statearr_40779_40839 = state_40766__$1;
(statearr_40779_40839[(1)] = (19));

} else {
var statearr_40780_40840 = state_40766__$1;
(statearr_40780_40840[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (21))){
var inst_40716 = (state_40766[(12)]);
var inst_40716__$1 = (state_40766[(2)]);
var inst_40717 = cljs.core.get.call(null,inst_40716__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_40718 = cljs.core.get.call(null,inst_40716__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_40719 = cljs.core.get.call(null,inst_40716__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_40766__$1 = (function (){var statearr_40781 = state_40766;
(statearr_40781[(12)] = inst_40716__$1);

(statearr_40781[(9)] = inst_40717);

(statearr_40781[(13)] = inst_40718);

return statearr_40781;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_40766__$1,(22),inst_40719);
} else {
if((state_val_40767 === (31))){
var inst_40748 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40748)){
var statearr_40782_40841 = state_40766__$1;
(statearr_40782_40841[(1)] = (32));

} else {
var statearr_40783_40842 = state_40766__$1;
(statearr_40783_40842[(1)] = (33));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (32))){
var inst_40725 = (state_40766[(14)]);
var state_40766__$1 = state_40766;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40766__$1,(35),out,inst_40725);
} else {
if((state_val_40767 === (33))){
var inst_40716 = (state_40766[(12)]);
var inst_40693 = inst_40716;
var state_40766__$1 = (function (){var statearr_40784 = state_40766;
(statearr_40784[(7)] = inst_40693);

return statearr_40784;
})();
var statearr_40785_40843 = state_40766__$1;
(statearr_40785_40843[(2)] = null);

(statearr_40785_40843[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (13))){
var inst_40693 = (state_40766[(7)]);
var inst_40700 = inst_40693.cljs$lang$protocol_mask$partition0$;
var inst_40701 = (inst_40700 & (64));
var inst_40702 = inst_40693.cljs$core$ISeq$;
var inst_40703 = (cljs.core.PROTOCOL_SENTINEL === inst_40702);
var inst_40704 = (inst_40701) || (inst_40703);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40704)){
var statearr_40786_40844 = state_40766__$1;
(statearr_40786_40844[(1)] = (16));

} else {
var statearr_40787_40845 = state_40766__$1;
(statearr_40787_40845[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (22))){
var inst_40726 = (state_40766[(10)]);
var inst_40725 = (state_40766[(14)]);
var inst_40724 = (state_40766[(2)]);
var inst_40725__$1 = cljs.core.nth.call(null,inst_40724,(0),null);
var inst_40726__$1 = cljs.core.nth.call(null,inst_40724,(1),null);
var inst_40727 = (inst_40725__$1 == null);
var inst_40728 = cljs.core._EQ_.call(null,inst_40726__$1,change);
var inst_40729 = (inst_40727) || (inst_40728);
var state_40766__$1 = (function (){var statearr_40788 = state_40766;
(statearr_40788[(10)] = inst_40726__$1);

(statearr_40788[(14)] = inst_40725__$1);

return statearr_40788;
})();
if(cljs.core.truth_(inst_40729)){
var statearr_40789_40846 = state_40766__$1;
(statearr_40789_40846[(1)] = (23));

} else {
var statearr_40790_40847 = state_40766__$1;
(statearr_40790_40847[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (36))){
var inst_40716 = (state_40766[(12)]);
var inst_40693 = inst_40716;
var state_40766__$1 = (function (){var statearr_40791 = state_40766;
(statearr_40791[(7)] = inst_40693);

return statearr_40791;
})();
var statearr_40792_40848 = state_40766__$1;
(statearr_40792_40848[(2)] = null);

(statearr_40792_40848[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (29))){
var inst_40740 = (state_40766[(11)]);
var state_40766__$1 = state_40766;
var statearr_40793_40849 = state_40766__$1;
(statearr_40793_40849[(2)] = inst_40740);

(statearr_40793_40849[(1)] = (31));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (6))){
var state_40766__$1 = state_40766;
var statearr_40794_40850 = state_40766__$1;
(statearr_40794_40850[(2)] = false);

(statearr_40794_40850[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (28))){
var inst_40736 = (state_40766[(2)]);
var inst_40737 = calc_state.call(null);
var inst_40693 = inst_40737;
var state_40766__$1 = (function (){var statearr_40795 = state_40766;
(statearr_40795[(7)] = inst_40693);

(statearr_40795[(15)] = inst_40736);

return statearr_40795;
})();
var statearr_40796_40851 = state_40766__$1;
(statearr_40796_40851[(2)] = null);

(statearr_40796_40851[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (25))){
var inst_40762 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
var statearr_40797_40852 = state_40766__$1;
(statearr_40797_40852[(2)] = inst_40762);

(statearr_40797_40852[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (34))){
var inst_40760 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
var statearr_40798_40853 = state_40766__$1;
(statearr_40798_40853[(2)] = inst_40760);

(statearr_40798_40853[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (17))){
var state_40766__$1 = state_40766;
var statearr_40799_40854 = state_40766__$1;
(statearr_40799_40854[(2)] = false);

(statearr_40799_40854[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (3))){
var state_40766__$1 = state_40766;
var statearr_40800_40855 = state_40766__$1;
(statearr_40800_40855[(2)] = false);

(statearr_40800_40855[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (12))){
var inst_40764 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40766__$1,inst_40764);
} else {
if((state_val_40767 === (2))){
var inst_40668 = (state_40766[(8)]);
var inst_40673 = inst_40668.cljs$lang$protocol_mask$partition0$;
var inst_40674 = (inst_40673 & (64));
var inst_40675 = inst_40668.cljs$core$ISeq$;
var inst_40676 = (cljs.core.PROTOCOL_SENTINEL === inst_40675);
var inst_40677 = (inst_40674) || (inst_40676);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40677)){
var statearr_40801_40856 = state_40766__$1;
(statearr_40801_40856[(1)] = (5));

} else {
var statearr_40802_40857 = state_40766__$1;
(statearr_40802_40857[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (23))){
var inst_40725 = (state_40766[(14)]);
var inst_40731 = (inst_40725 == null);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40731)){
var statearr_40803_40858 = state_40766__$1;
(statearr_40803_40858[(1)] = (26));

} else {
var statearr_40804_40859 = state_40766__$1;
(statearr_40804_40859[(1)] = (27));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (35))){
var inst_40751 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
if(cljs.core.truth_(inst_40751)){
var statearr_40805_40860 = state_40766__$1;
(statearr_40805_40860[(1)] = (36));

} else {
var statearr_40806_40861 = state_40766__$1;
(statearr_40806_40861[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (19))){
var inst_40693 = (state_40766[(7)]);
var inst_40713 = cljs.core.apply.call(null,cljs.core.hash_map,inst_40693);
var state_40766__$1 = state_40766;
var statearr_40807_40862 = state_40766__$1;
(statearr_40807_40862[(2)] = inst_40713);

(statearr_40807_40862[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (11))){
var inst_40693 = (state_40766[(7)]);
var inst_40697 = (inst_40693 == null);
var inst_40698 = cljs.core.not.call(null,inst_40697);
var state_40766__$1 = state_40766;
if(inst_40698){
var statearr_40808_40863 = state_40766__$1;
(statearr_40808_40863[(1)] = (13));

} else {
var statearr_40809_40864 = state_40766__$1;
(statearr_40809_40864[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (9))){
var inst_40668 = (state_40766[(8)]);
var state_40766__$1 = state_40766;
var statearr_40810_40865 = state_40766__$1;
(statearr_40810_40865[(2)] = inst_40668);

(statearr_40810_40865[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (5))){
var state_40766__$1 = state_40766;
var statearr_40811_40866 = state_40766__$1;
(statearr_40811_40866[(2)] = true);

(statearr_40811_40866[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (14))){
var state_40766__$1 = state_40766;
var statearr_40812_40867 = state_40766__$1;
(statearr_40812_40867[(2)] = false);

(statearr_40812_40867[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (26))){
var inst_40726 = (state_40766[(10)]);
var inst_40733 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_40726);
var state_40766__$1 = state_40766;
var statearr_40813_40868 = state_40766__$1;
(statearr_40813_40868[(2)] = inst_40733);

(statearr_40813_40868[(1)] = (28));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (16))){
var state_40766__$1 = state_40766;
var statearr_40814_40869 = state_40766__$1;
(statearr_40814_40869[(2)] = true);

(statearr_40814_40869[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (38))){
var inst_40756 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
var statearr_40815_40870 = state_40766__$1;
(statearr_40815_40870[(2)] = inst_40756);

(statearr_40815_40870[(1)] = (34));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (30))){
var inst_40717 = (state_40766[(9)]);
var inst_40726 = (state_40766[(10)]);
var inst_40718 = (state_40766[(13)]);
var inst_40743 = cljs.core.empty_QMARK_.call(null,inst_40717);
var inst_40744 = inst_40718.call(null,inst_40726);
var inst_40745 = cljs.core.not.call(null,inst_40744);
var inst_40746 = (inst_40743) && (inst_40745);
var state_40766__$1 = state_40766;
var statearr_40816_40871 = state_40766__$1;
(statearr_40816_40871[(2)] = inst_40746);

(statearr_40816_40871[(1)] = (31));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (10))){
var inst_40668 = (state_40766[(8)]);
var inst_40689 = (state_40766[(2)]);
var inst_40690 = cljs.core.get.call(null,inst_40689,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_40691 = cljs.core.get.call(null,inst_40689,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_40692 = cljs.core.get.call(null,inst_40689,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_40693 = inst_40668;
var state_40766__$1 = (function (){var statearr_40817 = state_40766;
(statearr_40817[(16)] = inst_40690);

(statearr_40817[(7)] = inst_40693);

(statearr_40817[(17)] = inst_40692);

(statearr_40817[(18)] = inst_40691);

return statearr_40817;
})();
var statearr_40818_40872 = state_40766__$1;
(statearr_40818_40872[(2)] = null);

(statearr_40818_40872[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (18))){
var inst_40708 = (state_40766[(2)]);
var state_40766__$1 = state_40766;
var statearr_40819_40873 = state_40766__$1;
(statearr_40819_40873[(2)] = inst_40708);

(statearr_40819_40873[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (37))){
var state_40766__$1 = state_40766;
var statearr_40820_40874 = state_40766__$1;
(statearr_40820_40874[(2)] = null);

(statearr_40820_40874[(1)] = (38));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40767 === (8))){
var inst_40668 = (state_40766[(8)]);
var inst_40686 = cljs.core.apply.call(null,cljs.core.hash_map,inst_40668);
var state_40766__$1 = state_40766;
var statearr_40821_40875 = state_40766__$1;
(statearr_40821_40875[(2)] = inst_40686);

(statearr_40821_40875[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
;
return ((function (switch__38933__auto__,c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function() {
var cljs$core$async$mix_$_state_machine__38934__auto__ = null;
var cljs$core$async$mix_$_state_machine__38934__auto____0 = (function (){
var statearr_40825 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_40825[(0)] = cljs$core$async$mix_$_state_machine__38934__auto__);

(statearr_40825[(1)] = (1));

return statearr_40825;
});
var cljs$core$async$mix_$_state_machine__38934__auto____1 = (function (state_40766){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_40766);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e40826){if((e40826 instanceof Object)){
var ex__38937__auto__ = e40826;
var statearr_40827_40876 = state_40766;
(statearr_40827_40876[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40766);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40826;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40877 = state_40766;
state_40766 = G__40877;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__38934__auto__ = function(state_40766){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__38934__auto____1.call(this,state_40766);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mix_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__38934__auto____0;
cljs$core$async$mix_$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__38934__auto____1;
return cljs$core$async$mix_$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
})();
var state__39049__auto__ = (function (){var statearr_40828 = f__39048__auto__.call(null);
(statearr_40828[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___40829);

return statearr_40828;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___40829,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
);


return m;
});
/**
 * Adds ch as an input to the mix
 */
cljs.core.async.admix = (function cljs$core$async$admix(mix,ch){
return cljs.core.async.admix_STAR_.call(null,mix,ch);
});
/**
 * Removes ch as an input to the mix
 */
cljs.core.async.unmix = (function cljs$core$async$unmix(mix,ch){
return cljs.core.async.unmix_STAR_.call(null,mix,ch);
});
/**
 * removes all inputs from the mix
 */
cljs.core.async.unmix_all = (function cljs$core$async$unmix_all(mix){
return cljs.core.async.unmix_all_STAR_.call(null,mix);
});
/**
 * Atomically sets the state(s) of one or more channels in a mix. The
 *   state map is a map of channels -> channel-state-map. A
 *   channel-state-map is a map of attrs -> boolean, where attr is one or
 *   more of :mute, :pause or :solo. Any states supplied are merged with
 *   the current state.
 * 
 *   Note that channels can be added to a mix via toggle, which can be
 *   used to add channels in a particular (e.g. paused) state.
 */
cljs.core.async.toggle = (function cljs$core$async$toggle(mix,state_map){
return cljs.core.async.toggle_STAR_.call(null,mix,state_map);
});
/**
 * Sets the solo mode of the mix. mode must be one of :mute or :pause
 */
cljs.core.async.solo_mode = (function cljs$core$async$solo_mode(mix,mode){
return cljs.core.async.solo_mode_STAR_.call(null,mix,mode);
});

/**
 * @interface
 */
cljs.core.async.Pub = function(){};

cljs.core.async.sub_STAR_ = (function cljs$core$async$sub_STAR_(p,v,ch,close_QMARK_){
if((!((p == null))) && (!((p.cljs$core$async$Pub$sub_STAR_$arity$4 == null)))){
return p.cljs$core$async$Pub$sub_STAR_$arity$4(p,v,ch,close_QMARK_);
} else {
var x__23866__auto__ = (((p == null))?null:p);
var m__23867__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,p,v,ch,close_QMARK_);
} else {
var m__23867__auto____$1 = (cljs.core.async.sub_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,p,v,ch,close_QMARK_);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.sub*",p);
}
}
}
});

cljs.core.async.unsub_STAR_ = (function cljs$core$async$unsub_STAR_(p,v,ch){
if((!((p == null))) && (!((p.cljs$core$async$Pub$unsub_STAR_$arity$3 == null)))){
return p.cljs$core$async$Pub$unsub_STAR_$arity$3(p,v,ch);
} else {
var x__23866__auto__ = (((p == null))?null:p);
var m__23867__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,p,v,ch);
} else {
var m__23867__auto____$1 = (cljs.core.async.unsub_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,p,v,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var args40878 = [];
var len__24369__auto___40881 = arguments.length;
var i__24370__auto___40882 = (0);
while(true){
if((i__24370__auto___40882 < len__24369__auto___40881)){
args40878.push((arguments[i__24370__auto___40882]));

var G__40883 = (i__24370__auto___40882 + (1));
i__24370__auto___40882 = G__40883;
continue;
} else {
}
break;
}

var G__40880 = args40878.length;
switch (G__40880) {
case 1:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40878.length)].join('')));

}
});

cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1 = (function (p){
if((!((p == null))) && (!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$1 == null)))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1(p);
} else {
var x__23866__auto__ = (((p == null))?null:p);
var m__23867__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,p);
} else {
var m__23867__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,p);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2 = (function (p,v){
if((!((p == null))) && (!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$2 == null)))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$2(p,v);
} else {
var x__23866__auto__ = (((p == null))?null:p);
var m__23867__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__23866__auto__)]);
if(!((m__23867__auto__ == null))){
return m__23867__auto__.call(null,p,v);
} else {
var m__23867__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__23867__auto____$1 == null))){
return m__23867__auto____$1.call(null,p,v);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_.cljs$lang$maxFixedArity = 2;


/**
 * Creates and returns a pub(lication) of the supplied channel,
 *   partitioned into topics by the topic-fn. topic-fn will be applied to
 *   each value on the channel and the result will determine the 'topic'
 *   on which that value will be put. Channels can be subscribed to
 *   receive copies of topics using 'sub', and unsubscribed using
 *   'unsub'. Each topic will be handled by an internal mult on a
 *   dedicated channel. By default these internal channels are
 *   unbuffered, but a buf-fn can be supplied which, given a topic,
 *   creates a buffer with desired properties.
 * 
 *   Each item is distributed to all subs in parallel and synchronously,
 *   i.e. each sub must accept before the next item is distributed. Use
 *   buffering/windowing to prevent slow subs from holding up the pub.
 * 
 *   Items received when there are no matching subs get dropped.
 * 
 *   Note that if buf-fns are used then each topic is handled
 *   asynchronously, i.e. if a channel is subscribed to more than one
 *   topic it should not expect them to be interleaved identically with
 *   the source.
 */
cljs.core.async.pub = (function cljs$core$async$pub(var_args){
var args40886 = [];
var len__24369__auto___41011 = arguments.length;
var i__24370__auto___41012 = (0);
while(true){
if((i__24370__auto___41012 < len__24369__auto___41011)){
args40886.push((arguments[i__24370__auto___41012]));

var G__41013 = (i__24370__auto___41012 + (1));
i__24370__auto___41012 = G__41013;
continue;
} else {
}
break;
}

var G__40888 = args40886.length;
switch (G__40888) {
case 2:
return cljs.core.async.pub.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40886.length)].join('')));

}
});

cljs.core.async.pub.cljs$core$IFn$_invoke$arity$2 = (function (ch,topic_fn){
return cljs.core.async.pub.call(null,ch,topic_fn,cljs.core.constantly.call(null,null));
});

cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3 = (function (ch,topic_fn,buf_fn){
var mults = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var ensure_mult = ((function (mults){
return (function (topic){
var or__23148__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,mults),topic);
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
return cljs.core.get.call(null,cljs.core.swap_BANG_.call(null,mults,((function (or__23148__auto__,mults){
return (function (p1__40885_SHARP_){
if(cljs.core.truth_(p1__40885_SHARP_.call(null,topic))){
return p1__40885_SHARP_;
} else {
return cljs.core.assoc.call(null,p1__40885_SHARP_,topic,cljs.core.async.mult.call(null,cljs.core.async.chan.call(null,buf_fn.call(null,topic))));
}
});})(or__23148__auto__,mults))
),topic);
}
});})(mults))
;
var p = (function (){
if(typeof cljs.core.async.t_cljs$core$async40889 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.Pub}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async40889 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta40890){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta40890 = meta40890;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (mults,ensure_mult){
return (function (_40891,meta40890__$1){
var self__ = this;
var _40891__$1 = this;
return (new cljs.core.async.t_cljs$core$async40889(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta40890__$1));
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){
return (function (_40891){
var self__ = this;
var _40891__$1 = this;
return self__.meta40890;
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (mults,ensure_mult){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.ch;
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Pub$sub_STAR_$arity$4 = ((function (mults,ensure_mult){
return (function (p,topic,ch__$1,close_QMARK_){
var self__ = this;
var p__$1 = this;
var m = self__.ensure_mult.call(null,topic);
return cljs.core.async.tap.call(null,m,ch__$1,close_QMARK_);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Pub$unsub_STAR_$arity$3 = ((function (mults,ensure_mult){
return (function (p,topic,ch__$1){
var self__ = this;
var p__$1 = this;
var temp__5278__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,self__.mults),topic);
if(cljs.core.truth_(temp__5278__auto__)){
var m = temp__5278__auto__;
return cljs.core.async.untap.call(null,m,ch__$1);
} else {
return null;
}
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$1 = ((function (mults,ensure_mult){
return (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.reset_BANG_.call(null,self__.mults,cljs.core.PersistentArrayMap.EMPTY);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$2 = ((function (mults,ensure_mult){
return (function (_,topic){
var self__ = this;
var ___$1 = this;
return cljs.core.swap_BANG_.call(null,self__.mults,cljs.core.dissoc,topic);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.getBasis = ((function (mults,ensure_mult){
return (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"topic-fn","topic-fn",-862449736,null),new cljs.core.Symbol(null,"buf-fn","buf-fn",-1200281591,null),new cljs.core.Symbol(null,"mults","mults",-461114485,null),new cljs.core.Symbol(null,"ensure-mult","ensure-mult",1796584816,null),new cljs.core.Symbol(null,"meta40890","meta40890",-590099119,null)], null);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async40889.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async40889.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async40889";

cljs.core.async.t_cljs$core$async40889.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async40889");
});})(mults,ensure_mult))
;

cljs.core.async.__GT_t_cljs$core$async40889 = ((function (mults,ensure_mult){
return (function cljs$core$async$__GT_t_cljs$core$async40889(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta40890){
return (new cljs.core.async.t_cljs$core$async40889(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta40890));
});})(mults,ensure_mult))
;

}

return (new cljs.core.async.t_cljs$core$async40889(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__39047__auto___41015 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41015,mults,ensure_mult,p){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41015,mults,ensure_mult,p){
return (function (state_40963){
var state_val_40964 = (state_40963[(1)]);
if((state_val_40964 === (7))){
var inst_40959 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_40965_41016 = state_40963__$1;
(statearr_40965_41016[(2)] = inst_40959);

(statearr_40965_41016[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (20))){
var state_40963__$1 = state_40963;
var statearr_40966_41017 = state_40963__$1;
(statearr_40966_41017[(2)] = null);

(statearr_40966_41017[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (1))){
var state_40963__$1 = state_40963;
var statearr_40967_41018 = state_40963__$1;
(statearr_40967_41018[(2)] = null);

(statearr_40967_41018[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (24))){
var inst_40942 = (state_40963[(7)]);
var inst_40951 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_40942);
var state_40963__$1 = state_40963;
var statearr_40968_41019 = state_40963__$1;
(statearr_40968_41019[(2)] = inst_40951);

(statearr_40968_41019[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (4))){
var inst_40894 = (state_40963[(8)]);
var inst_40894__$1 = (state_40963[(2)]);
var inst_40895 = (inst_40894__$1 == null);
var state_40963__$1 = (function (){var statearr_40969 = state_40963;
(statearr_40969[(8)] = inst_40894__$1);

return statearr_40969;
})();
if(cljs.core.truth_(inst_40895)){
var statearr_40970_41020 = state_40963__$1;
(statearr_40970_41020[(1)] = (5));

} else {
var statearr_40971_41021 = state_40963__$1;
(statearr_40971_41021[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (15))){
var inst_40936 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_40972_41022 = state_40963__$1;
(statearr_40972_41022[(2)] = inst_40936);

(statearr_40972_41022[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (21))){
var inst_40956 = (state_40963[(2)]);
var state_40963__$1 = (function (){var statearr_40973 = state_40963;
(statearr_40973[(9)] = inst_40956);

return statearr_40973;
})();
var statearr_40974_41023 = state_40963__$1;
(statearr_40974_41023[(2)] = null);

(statearr_40974_41023[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (13))){
var inst_40918 = (state_40963[(10)]);
var inst_40920 = cljs.core.chunked_seq_QMARK_.call(null,inst_40918);
var state_40963__$1 = state_40963;
if(inst_40920){
var statearr_40975_41024 = state_40963__$1;
(statearr_40975_41024[(1)] = (16));

} else {
var statearr_40976_41025 = state_40963__$1;
(statearr_40976_41025[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (22))){
var inst_40948 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
if(cljs.core.truth_(inst_40948)){
var statearr_40977_41026 = state_40963__$1;
(statearr_40977_41026[(1)] = (23));

} else {
var statearr_40978_41027 = state_40963__$1;
(statearr_40978_41027[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (6))){
var inst_40944 = (state_40963[(11)]);
var inst_40942 = (state_40963[(7)]);
var inst_40894 = (state_40963[(8)]);
var inst_40942__$1 = topic_fn.call(null,inst_40894);
var inst_40943 = cljs.core.deref.call(null,mults);
var inst_40944__$1 = cljs.core.get.call(null,inst_40943,inst_40942__$1);
var state_40963__$1 = (function (){var statearr_40979 = state_40963;
(statearr_40979[(11)] = inst_40944__$1);

(statearr_40979[(7)] = inst_40942__$1);

return statearr_40979;
})();
if(cljs.core.truth_(inst_40944__$1)){
var statearr_40980_41028 = state_40963__$1;
(statearr_40980_41028[(1)] = (19));

} else {
var statearr_40981_41029 = state_40963__$1;
(statearr_40981_41029[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (25))){
var inst_40953 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_40982_41030 = state_40963__$1;
(statearr_40982_41030[(2)] = inst_40953);

(statearr_40982_41030[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (17))){
var inst_40918 = (state_40963[(10)]);
var inst_40927 = cljs.core.first.call(null,inst_40918);
var inst_40928 = cljs.core.async.muxch_STAR_.call(null,inst_40927);
var inst_40929 = cljs.core.async.close_BANG_.call(null,inst_40928);
var inst_40930 = cljs.core.next.call(null,inst_40918);
var inst_40904 = inst_40930;
var inst_40905 = null;
var inst_40906 = (0);
var inst_40907 = (0);
var state_40963__$1 = (function (){var statearr_40983 = state_40963;
(statearr_40983[(12)] = inst_40907);

(statearr_40983[(13)] = inst_40929);

(statearr_40983[(14)] = inst_40906);

(statearr_40983[(15)] = inst_40905);

(statearr_40983[(16)] = inst_40904);

return statearr_40983;
})();
var statearr_40984_41031 = state_40963__$1;
(statearr_40984_41031[(2)] = null);

(statearr_40984_41031[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (3))){
var inst_40961 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40963__$1,inst_40961);
} else {
if((state_val_40964 === (12))){
var inst_40938 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_40985_41032 = state_40963__$1;
(statearr_40985_41032[(2)] = inst_40938);

(statearr_40985_41032[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (2))){
var state_40963__$1 = state_40963;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40963__$1,(4),ch);
} else {
if((state_val_40964 === (23))){
var state_40963__$1 = state_40963;
var statearr_40986_41033 = state_40963__$1;
(statearr_40986_41033[(2)] = null);

(statearr_40986_41033[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (19))){
var inst_40944 = (state_40963[(11)]);
var inst_40894 = (state_40963[(8)]);
var inst_40946 = cljs.core.async.muxch_STAR_.call(null,inst_40944);
var state_40963__$1 = state_40963;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40963__$1,(22),inst_40946,inst_40894);
} else {
if((state_val_40964 === (11))){
var inst_40918 = (state_40963[(10)]);
var inst_40904 = (state_40963[(16)]);
var inst_40918__$1 = cljs.core.seq.call(null,inst_40904);
var state_40963__$1 = (function (){var statearr_40987 = state_40963;
(statearr_40987[(10)] = inst_40918__$1);

return statearr_40987;
})();
if(inst_40918__$1){
var statearr_40988_41034 = state_40963__$1;
(statearr_40988_41034[(1)] = (13));

} else {
var statearr_40989_41035 = state_40963__$1;
(statearr_40989_41035[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (9))){
var inst_40940 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_40990_41036 = state_40963__$1;
(statearr_40990_41036[(2)] = inst_40940);

(statearr_40990_41036[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (5))){
var inst_40901 = cljs.core.deref.call(null,mults);
var inst_40902 = cljs.core.vals.call(null,inst_40901);
var inst_40903 = cljs.core.seq.call(null,inst_40902);
var inst_40904 = inst_40903;
var inst_40905 = null;
var inst_40906 = (0);
var inst_40907 = (0);
var state_40963__$1 = (function (){var statearr_40991 = state_40963;
(statearr_40991[(12)] = inst_40907);

(statearr_40991[(14)] = inst_40906);

(statearr_40991[(15)] = inst_40905);

(statearr_40991[(16)] = inst_40904);

return statearr_40991;
})();
var statearr_40992_41037 = state_40963__$1;
(statearr_40992_41037[(2)] = null);

(statearr_40992_41037[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (14))){
var state_40963__$1 = state_40963;
var statearr_40996_41038 = state_40963__$1;
(statearr_40996_41038[(2)] = null);

(statearr_40996_41038[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (16))){
var inst_40918 = (state_40963[(10)]);
var inst_40922 = cljs.core.chunk_first.call(null,inst_40918);
var inst_40923 = cljs.core.chunk_rest.call(null,inst_40918);
var inst_40924 = cljs.core.count.call(null,inst_40922);
var inst_40904 = inst_40923;
var inst_40905 = inst_40922;
var inst_40906 = inst_40924;
var inst_40907 = (0);
var state_40963__$1 = (function (){var statearr_40997 = state_40963;
(statearr_40997[(12)] = inst_40907);

(statearr_40997[(14)] = inst_40906);

(statearr_40997[(15)] = inst_40905);

(statearr_40997[(16)] = inst_40904);

return statearr_40997;
})();
var statearr_40998_41039 = state_40963__$1;
(statearr_40998_41039[(2)] = null);

(statearr_40998_41039[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (10))){
var inst_40907 = (state_40963[(12)]);
var inst_40906 = (state_40963[(14)]);
var inst_40905 = (state_40963[(15)]);
var inst_40904 = (state_40963[(16)]);
var inst_40912 = cljs.core._nth.call(null,inst_40905,inst_40907);
var inst_40913 = cljs.core.async.muxch_STAR_.call(null,inst_40912);
var inst_40914 = cljs.core.async.close_BANG_.call(null,inst_40913);
var inst_40915 = (inst_40907 + (1));
var tmp40993 = inst_40906;
var tmp40994 = inst_40905;
var tmp40995 = inst_40904;
var inst_40904__$1 = tmp40995;
var inst_40905__$1 = tmp40994;
var inst_40906__$1 = tmp40993;
var inst_40907__$1 = inst_40915;
var state_40963__$1 = (function (){var statearr_40999 = state_40963;
(statearr_40999[(12)] = inst_40907__$1);

(statearr_40999[(14)] = inst_40906__$1);

(statearr_40999[(17)] = inst_40914);

(statearr_40999[(15)] = inst_40905__$1);

(statearr_40999[(16)] = inst_40904__$1);

return statearr_40999;
})();
var statearr_41000_41040 = state_40963__$1;
(statearr_41000_41040[(2)] = null);

(statearr_41000_41040[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (18))){
var inst_40933 = (state_40963[(2)]);
var state_40963__$1 = state_40963;
var statearr_41001_41041 = state_40963__$1;
(statearr_41001_41041[(2)] = inst_40933);

(statearr_41001_41041[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40964 === (8))){
var inst_40907 = (state_40963[(12)]);
var inst_40906 = (state_40963[(14)]);
var inst_40909 = (inst_40907 < inst_40906);
var inst_40910 = inst_40909;
var state_40963__$1 = state_40963;
if(cljs.core.truth_(inst_40910)){
var statearr_41002_41042 = state_40963__$1;
(statearr_41002_41042[(1)] = (10));

} else {
var statearr_41003_41043 = state_40963__$1;
(statearr_41003_41043[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41015,mults,ensure_mult,p))
;
return ((function (switch__38933__auto__,c__39047__auto___41015,mults,ensure_mult,p){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41007 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41007[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41007[(1)] = (1));

return statearr_41007;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_40963){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_40963);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41008){if((e41008 instanceof Object)){
var ex__38937__auto__ = e41008;
var statearr_41009_41044 = state_40963;
(statearr_41009_41044[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40963);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41008;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41045 = state_40963;
state_40963 = G__41045;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_40963){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_40963);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41015,mults,ensure_mult,p))
})();
var state__39049__auto__ = (function (){var statearr_41010 = f__39048__auto__.call(null);
(statearr_41010[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41015);

return statearr_41010;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41015,mults,ensure_mult,p))
);


return p;
});

cljs.core.async.pub.cljs$lang$maxFixedArity = 3;

/**
 * Subscribes a channel to a topic of a pub.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.sub = (function cljs$core$async$sub(var_args){
var args41046 = [];
var len__24369__auto___41049 = arguments.length;
var i__24370__auto___41050 = (0);
while(true){
if((i__24370__auto___41050 < len__24369__auto___41049)){
args41046.push((arguments[i__24370__auto___41050]));

var G__41051 = (i__24370__auto___41050 + (1));
i__24370__auto___41050 = G__41051;
continue;
} else {
}
break;
}

var G__41048 = args41046.length;
switch (G__41048) {
case 3:
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41046.length)].join('')));

}
});

cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3 = (function (p,topic,ch){
return cljs.core.async.sub.call(null,p,topic,ch,true);
});

cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4 = (function (p,topic,ch,close_QMARK_){
return cljs.core.async.sub_STAR_.call(null,p,topic,ch,close_QMARK_);
});

cljs.core.async.sub.cljs$lang$maxFixedArity = 4;

/**
 * Unsubscribes a channel from a topic of a pub
 */
cljs.core.async.unsub = (function cljs$core$async$unsub(p,topic,ch){
return cljs.core.async.unsub_STAR_.call(null,p,topic,ch);
});
/**
 * Unsubscribes all channels from a pub, or a topic of a pub
 */
cljs.core.async.unsub_all = (function cljs$core$async$unsub_all(var_args){
var args41053 = [];
var len__24369__auto___41056 = arguments.length;
var i__24370__auto___41057 = (0);
while(true){
if((i__24370__auto___41057 < len__24369__auto___41056)){
args41053.push((arguments[i__24370__auto___41057]));

var G__41058 = (i__24370__auto___41057 + (1));
i__24370__auto___41057 = G__41058;
continue;
} else {
}
break;
}

var G__41055 = args41053.length;
switch (G__41055) {
case 1:
return cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41053.length)].join('')));

}
});

cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$1 = (function (p){
return cljs.core.async.unsub_all_STAR_.call(null,p);
});

cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2 = (function (p,topic){
return cljs.core.async.unsub_all_STAR_.call(null,p,topic);
});

cljs.core.async.unsub_all.cljs$lang$maxFixedArity = 2;

/**
 * Takes a function and a collection of source channels, and returns a
 *   channel which contains the values produced by applying f to the set
 *   of first items taken from each source channel, followed by applying
 *   f to the set of second items from each channel, until any one of the
 *   channels is closed, at which point the output channel will be
 *   closed. The returned channel will be unbuffered by default, or a
 *   buf-or-n can be supplied
 */
cljs.core.async.map = (function cljs$core$async$map(var_args){
var args41060 = [];
var len__24369__auto___41131 = arguments.length;
var i__24370__auto___41132 = (0);
while(true){
if((i__24370__auto___41132 < len__24369__auto___41131)){
args41060.push((arguments[i__24370__auto___41132]));

var G__41133 = (i__24370__auto___41132 + (1));
i__24370__auto___41132 = G__41133;
continue;
} else {
}
break;
}

var G__41062 = args41060.length;
switch (G__41062) {
case 2:
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41060.length)].join('')));

}
});

cljs.core.async.map.cljs$core$IFn$_invoke$arity$2 = (function (f,chs){
return cljs.core.async.map.call(null,f,chs,null);
});

cljs.core.async.map.cljs$core$IFn$_invoke$arity$3 = (function (f,chs,buf_or_n){
var chs__$1 = cljs.core.vec.call(null,chs);
var out = cljs.core.async.chan.call(null,buf_or_n);
var cnt = cljs.core.count.call(null,chs__$1);
var rets = cljs.core.object_array.call(null,cnt);
var dchan = cljs.core.async.chan.call(null,(1));
var dctr = cljs.core.atom.call(null,null);
var done = cljs.core.mapv.call(null,((function (chs__$1,out,cnt,rets,dchan,dctr){
return (function (i){
return ((function (chs__$1,out,cnt,rets,dchan,dctr){
return (function (ret){
(rets[i] = ret);

if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,rets.slice((0)));
} else {
return null;
}
});
;})(chs__$1,out,cnt,rets,dchan,dctr))
});})(chs__$1,out,cnt,rets,dchan,dctr))
,cljs.core.range.call(null,cnt));
var c__39047__auto___41135 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (state_41101){
var state_val_41102 = (state_41101[(1)]);
if((state_val_41102 === (7))){
var state_41101__$1 = state_41101;
var statearr_41103_41136 = state_41101__$1;
(statearr_41103_41136[(2)] = null);

(statearr_41103_41136[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (1))){
var state_41101__$1 = state_41101;
var statearr_41104_41137 = state_41101__$1;
(statearr_41104_41137[(2)] = null);

(statearr_41104_41137[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (4))){
var inst_41065 = (state_41101[(7)]);
var inst_41067 = (inst_41065 < cnt);
var state_41101__$1 = state_41101;
if(cljs.core.truth_(inst_41067)){
var statearr_41105_41138 = state_41101__$1;
(statearr_41105_41138[(1)] = (6));

} else {
var statearr_41106_41139 = state_41101__$1;
(statearr_41106_41139[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (15))){
var inst_41097 = (state_41101[(2)]);
var state_41101__$1 = state_41101;
var statearr_41107_41140 = state_41101__$1;
(statearr_41107_41140[(2)] = inst_41097);

(statearr_41107_41140[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (13))){
var inst_41090 = cljs.core.async.close_BANG_.call(null,out);
var state_41101__$1 = state_41101;
var statearr_41108_41141 = state_41101__$1;
(statearr_41108_41141[(2)] = inst_41090);

(statearr_41108_41141[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (6))){
var state_41101__$1 = state_41101;
var statearr_41109_41142 = state_41101__$1;
(statearr_41109_41142[(2)] = null);

(statearr_41109_41142[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (3))){
var inst_41099 = (state_41101[(2)]);
var state_41101__$1 = state_41101;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41101__$1,inst_41099);
} else {
if((state_val_41102 === (12))){
var inst_41087 = (state_41101[(8)]);
var inst_41087__$1 = (state_41101[(2)]);
var inst_41088 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_41087__$1);
var state_41101__$1 = (function (){var statearr_41110 = state_41101;
(statearr_41110[(8)] = inst_41087__$1);

return statearr_41110;
})();
if(cljs.core.truth_(inst_41088)){
var statearr_41111_41143 = state_41101__$1;
(statearr_41111_41143[(1)] = (13));

} else {
var statearr_41112_41144 = state_41101__$1;
(statearr_41112_41144[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (2))){
var inst_41064 = cljs.core.reset_BANG_.call(null,dctr,cnt);
var inst_41065 = (0);
var state_41101__$1 = (function (){var statearr_41113 = state_41101;
(statearr_41113[(7)] = inst_41065);

(statearr_41113[(9)] = inst_41064);

return statearr_41113;
})();
var statearr_41114_41145 = state_41101__$1;
(statearr_41114_41145[(2)] = null);

(statearr_41114_41145[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (11))){
var inst_41065 = (state_41101[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_41101,(10),Object,null,(9));
var inst_41074 = chs__$1.call(null,inst_41065);
var inst_41075 = done.call(null,inst_41065);
var inst_41076 = cljs.core.async.take_BANG_.call(null,inst_41074,inst_41075);
var state_41101__$1 = state_41101;
var statearr_41115_41146 = state_41101__$1;
(statearr_41115_41146[(2)] = inst_41076);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41101__$1);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (9))){
var inst_41065 = (state_41101[(7)]);
var inst_41078 = (state_41101[(2)]);
var inst_41079 = (inst_41065 + (1));
var inst_41065__$1 = inst_41079;
var state_41101__$1 = (function (){var statearr_41116 = state_41101;
(statearr_41116[(10)] = inst_41078);

(statearr_41116[(7)] = inst_41065__$1);

return statearr_41116;
})();
var statearr_41117_41147 = state_41101__$1;
(statearr_41117_41147[(2)] = null);

(statearr_41117_41147[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (5))){
var inst_41085 = (state_41101[(2)]);
var state_41101__$1 = (function (){var statearr_41118 = state_41101;
(statearr_41118[(11)] = inst_41085);

return statearr_41118;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41101__$1,(12),dchan);
} else {
if((state_val_41102 === (14))){
var inst_41087 = (state_41101[(8)]);
var inst_41092 = cljs.core.apply.call(null,f,inst_41087);
var state_41101__$1 = state_41101;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41101__$1,(16),out,inst_41092);
} else {
if((state_val_41102 === (16))){
var inst_41094 = (state_41101[(2)]);
var state_41101__$1 = (function (){var statearr_41119 = state_41101;
(statearr_41119[(12)] = inst_41094);

return statearr_41119;
})();
var statearr_41120_41148 = state_41101__$1;
(statearr_41120_41148[(2)] = null);

(statearr_41120_41148[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (10))){
var inst_41069 = (state_41101[(2)]);
var inst_41070 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec);
var state_41101__$1 = (function (){var statearr_41121 = state_41101;
(statearr_41121[(13)] = inst_41069);

return statearr_41121;
})();
var statearr_41122_41149 = state_41101__$1;
(statearr_41122_41149[(2)] = inst_41070);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41101__$1);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41102 === (8))){
var inst_41083 = (state_41101[(2)]);
var state_41101__$1 = state_41101;
var statearr_41123_41150 = state_41101__$1;
(statearr_41123_41150[(2)] = inst_41083);

(statearr_41123_41150[(1)] = (5));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done))
;
return ((function (switch__38933__auto__,c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41127 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41127[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41127[(1)] = (1));

return statearr_41127;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41101){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41101);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41128){if((e41128 instanceof Object)){
var ex__38937__auto__ = e41128;
var statearr_41129_41151 = state_41101;
(statearr_41129_41151[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41101);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41128;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41152 = state_41101;
state_41101 = G__41152;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41101){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41101);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done))
})();
var state__39049__auto__ = (function (){var statearr_41130 = f__39048__auto__.call(null);
(statearr_41130[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41135);

return statearr_41130;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41135,chs__$1,out,cnt,rets,dchan,dctr,done))
);


return out;
});

cljs.core.async.map.cljs$lang$maxFixedArity = 3;

/**
 * Takes a collection of source channels and returns a channel which
 *   contains all values taken from them. The returned channel will be
 *   unbuffered by default, or a buf-or-n can be supplied. The channel
 *   will close after all the source channels have closed.
 */
cljs.core.async.merge = (function cljs$core$async$merge(var_args){
var args41154 = [];
var len__24369__auto___41212 = arguments.length;
var i__24370__auto___41213 = (0);
while(true){
if((i__24370__auto___41213 < len__24369__auto___41212)){
args41154.push((arguments[i__24370__auto___41213]));

var G__41214 = (i__24370__auto___41213 + (1));
i__24370__auto___41213 = G__41214;
continue;
} else {
}
break;
}

var G__41156 = args41154.length;
switch (G__41156) {
case 1:
return cljs.core.async.merge.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41154.length)].join('')));

}
});

cljs.core.async.merge.cljs$core$IFn$_invoke$arity$1 = (function (chs){
return cljs.core.async.merge.call(null,chs,null);
});

cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41216 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41216,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41216,out){
return (function (state_41188){
var state_val_41189 = (state_41188[(1)]);
if((state_val_41189 === (7))){
var inst_41168 = (state_41188[(7)]);
var inst_41167 = (state_41188[(8)]);
var inst_41167__$1 = (state_41188[(2)]);
var inst_41168__$1 = cljs.core.nth.call(null,inst_41167__$1,(0),null);
var inst_41169 = cljs.core.nth.call(null,inst_41167__$1,(1),null);
var inst_41170 = (inst_41168__$1 == null);
var state_41188__$1 = (function (){var statearr_41190 = state_41188;
(statearr_41190[(9)] = inst_41169);

(statearr_41190[(7)] = inst_41168__$1);

(statearr_41190[(8)] = inst_41167__$1);

return statearr_41190;
})();
if(cljs.core.truth_(inst_41170)){
var statearr_41191_41217 = state_41188__$1;
(statearr_41191_41217[(1)] = (8));

} else {
var statearr_41192_41218 = state_41188__$1;
(statearr_41192_41218[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (1))){
var inst_41157 = cljs.core.vec.call(null,chs);
var inst_41158 = inst_41157;
var state_41188__$1 = (function (){var statearr_41193 = state_41188;
(statearr_41193[(10)] = inst_41158);

return statearr_41193;
})();
var statearr_41194_41219 = state_41188__$1;
(statearr_41194_41219[(2)] = null);

(statearr_41194_41219[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (4))){
var inst_41158 = (state_41188[(10)]);
var state_41188__$1 = state_41188;
return cljs.core.async.ioc_alts_BANG_.call(null,state_41188__$1,(7),inst_41158);
} else {
if((state_val_41189 === (6))){
var inst_41184 = (state_41188[(2)]);
var state_41188__$1 = state_41188;
var statearr_41195_41220 = state_41188__$1;
(statearr_41195_41220[(2)] = inst_41184);

(statearr_41195_41220[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (3))){
var inst_41186 = (state_41188[(2)]);
var state_41188__$1 = state_41188;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41188__$1,inst_41186);
} else {
if((state_val_41189 === (2))){
var inst_41158 = (state_41188[(10)]);
var inst_41160 = cljs.core.count.call(null,inst_41158);
var inst_41161 = (inst_41160 > (0));
var state_41188__$1 = state_41188;
if(cljs.core.truth_(inst_41161)){
var statearr_41197_41221 = state_41188__$1;
(statearr_41197_41221[(1)] = (4));

} else {
var statearr_41198_41222 = state_41188__$1;
(statearr_41198_41222[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (11))){
var inst_41158 = (state_41188[(10)]);
var inst_41177 = (state_41188[(2)]);
var tmp41196 = inst_41158;
var inst_41158__$1 = tmp41196;
var state_41188__$1 = (function (){var statearr_41199 = state_41188;
(statearr_41199[(10)] = inst_41158__$1);

(statearr_41199[(11)] = inst_41177);

return statearr_41199;
})();
var statearr_41200_41223 = state_41188__$1;
(statearr_41200_41223[(2)] = null);

(statearr_41200_41223[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (9))){
var inst_41168 = (state_41188[(7)]);
var state_41188__$1 = state_41188;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41188__$1,(11),out,inst_41168);
} else {
if((state_val_41189 === (5))){
var inst_41182 = cljs.core.async.close_BANG_.call(null,out);
var state_41188__$1 = state_41188;
var statearr_41201_41224 = state_41188__$1;
(statearr_41201_41224[(2)] = inst_41182);

(statearr_41201_41224[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (10))){
var inst_41180 = (state_41188[(2)]);
var state_41188__$1 = state_41188;
var statearr_41202_41225 = state_41188__$1;
(statearr_41202_41225[(2)] = inst_41180);

(statearr_41202_41225[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41189 === (8))){
var inst_41158 = (state_41188[(10)]);
var inst_41169 = (state_41188[(9)]);
var inst_41168 = (state_41188[(7)]);
var inst_41167 = (state_41188[(8)]);
var inst_41172 = (function (){var cs = inst_41158;
var vec__41163 = inst_41167;
var v = inst_41168;
var c = inst_41169;
return ((function (cs,vec__41163,v,c,inst_41158,inst_41169,inst_41168,inst_41167,state_val_41189,c__39047__auto___41216,out){
return (function (p1__41153_SHARP_){
return cljs.core.not_EQ_.call(null,c,p1__41153_SHARP_);
});
;})(cs,vec__41163,v,c,inst_41158,inst_41169,inst_41168,inst_41167,state_val_41189,c__39047__auto___41216,out))
})();
var inst_41173 = cljs.core.filterv.call(null,inst_41172,inst_41158);
var inst_41158__$1 = inst_41173;
var state_41188__$1 = (function (){var statearr_41203 = state_41188;
(statearr_41203[(10)] = inst_41158__$1);

return statearr_41203;
})();
var statearr_41204_41226 = state_41188__$1;
(statearr_41204_41226[(2)] = null);

(statearr_41204_41226[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41216,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41216,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41208 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41208[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41208[(1)] = (1));

return statearr_41208;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41188){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41188);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41209){if((e41209 instanceof Object)){
var ex__38937__auto__ = e41209;
var statearr_41210_41227 = state_41188;
(statearr_41210_41227[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41188);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41209;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41228 = state_41188;
state_41188 = G__41228;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41188){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41188);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41216,out))
})();
var state__39049__auto__ = (function (){var statearr_41211 = f__39048__auto__.call(null);
(statearr_41211[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41216);

return statearr_41211;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41216,out))
);


return out;
});

cljs.core.async.merge.cljs$lang$maxFixedArity = 2;

/**
 * Returns a channel containing the single (collection) result of the
 *   items taken from the channel conjoined to the supplied
 *   collection. ch must close before into produces a result.
 */
cljs.core.async.into = (function cljs$core$async$into(coll,ch){
return cljs.core.async.reduce.call(null,cljs.core.conj,coll,ch);
});
/**
 * Returns a channel that will return, at most, n items from ch. After n items
 * have been returned, or ch has been closed, the return chanel will close.
 * 
 *   The output channel is unbuffered by default, unless buf-or-n is given.
 */
cljs.core.async.take = (function cljs$core$async$take(var_args){
var args41229 = [];
var len__24369__auto___41278 = arguments.length;
var i__24370__auto___41279 = (0);
while(true){
if((i__24370__auto___41279 < len__24369__auto___41278)){
args41229.push((arguments[i__24370__auto___41279]));

var G__41280 = (i__24370__auto___41279 + (1));
i__24370__auto___41279 = G__41280;
continue;
} else {
}
break;
}

var G__41231 = args41229.length;
switch (G__41231) {
case 2:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41229.length)].join('')));

}
});

cljs.core.async.take.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.take.call(null,n,ch,null);
});

cljs.core.async.take.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41282 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41282,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41282,out){
return (function (state_41255){
var state_val_41256 = (state_41255[(1)]);
if((state_val_41256 === (7))){
var inst_41237 = (state_41255[(7)]);
var inst_41237__$1 = (state_41255[(2)]);
var inst_41238 = (inst_41237__$1 == null);
var inst_41239 = cljs.core.not.call(null,inst_41238);
var state_41255__$1 = (function (){var statearr_41257 = state_41255;
(statearr_41257[(7)] = inst_41237__$1);

return statearr_41257;
})();
if(inst_41239){
var statearr_41258_41283 = state_41255__$1;
(statearr_41258_41283[(1)] = (8));

} else {
var statearr_41259_41284 = state_41255__$1;
(statearr_41259_41284[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (1))){
var inst_41232 = (0);
var state_41255__$1 = (function (){var statearr_41260 = state_41255;
(statearr_41260[(8)] = inst_41232);

return statearr_41260;
})();
var statearr_41261_41285 = state_41255__$1;
(statearr_41261_41285[(2)] = null);

(statearr_41261_41285[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (4))){
var state_41255__$1 = state_41255;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41255__$1,(7),ch);
} else {
if((state_val_41256 === (6))){
var inst_41250 = (state_41255[(2)]);
var state_41255__$1 = state_41255;
var statearr_41262_41286 = state_41255__$1;
(statearr_41262_41286[(2)] = inst_41250);

(statearr_41262_41286[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (3))){
var inst_41252 = (state_41255[(2)]);
var inst_41253 = cljs.core.async.close_BANG_.call(null,out);
var state_41255__$1 = (function (){var statearr_41263 = state_41255;
(statearr_41263[(9)] = inst_41252);

return statearr_41263;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41255__$1,inst_41253);
} else {
if((state_val_41256 === (2))){
var inst_41232 = (state_41255[(8)]);
var inst_41234 = (inst_41232 < n);
var state_41255__$1 = state_41255;
if(cljs.core.truth_(inst_41234)){
var statearr_41264_41287 = state_41255__$1;
(statearr_41264_41287[(1)] = (4));

} else {
var statearr_41265_41288 = state_41255__$1;
(statearr_41265_41288[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (11))){
var inst_41232 = (state_41255[(8)]);
var inst_41242 = (state_41255[(2)]);
var inst_41243 = (inst_41232 + (1));
var inst_41232__$1 = inst_41243;
var state_41255__$1 = (function (){var statearr_41266 = state_41255;
(statearr_41266[(8)] = inst_41232__$1);

(statearr_41266[(10)] = inst_41242);

return statearr_41266;
})();
var statearr_41267_41289 = state_41255__$1;
(statearr_41267_41289[(2)] = null);

(statearr_41267_41289[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (9))){
var state_41255__$1 = state_41255;
var statearr_41268_41290 = state_41255__$1;
(statearr_41268_41290[(2)] = null);

(statearr_41268_41290[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (5))){
var state_41255__$1 = state_41255;
var statearr_41269_41291 = state_41255__$1;
(statearr_41269_41291[(2)] = null);

(statearr_41269_41291[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (10))){
var inst_41247 = (state_41255[(2)]);
var state_41255__$1 = state_41255;
var statearr_41270_41292 = state_41255__$1;
(statearr_41270_41292[(2)] = inst_41247);

(statearr_41270_41292[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41256 === (8))){
var inst_41237 = (state_41255[(7)]);
var state_41255__$1 = state_41255;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41255__$1,(11),out,inst_41237);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41282,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41282,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41274 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_41274[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41274[(1)] = (1));

return statearr_41274;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41255){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41255);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41275){if((e41275 instanceof Object)){
var ex__38937__auto__ = e41275;
var statearr_41276_41293 = state_41255;
(statearr_41276_41293[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41255);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41275;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41294 = state_41255;
state_41255 = G__41294;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41255){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41255);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41282,out))
})();
var state__39049__auto__ = (function (){var statearr_41277 = f__39048__auto__.call(null);
(statearr_41277[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41282);

return statearr_41277;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41282,out))
);


return out;
});

cljs.core.async.take.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_LT_ = (function cljs$core$async$map_LT_(f,ch){
if(typeof cljs.core.async.t_cljs$core$async41302 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async41302 = (function (f,ch,meta41303){
this.f = f;
this.ch = ch;
this.meta41303 = meta41303;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_41304,meta41303__$1){
var self__ = this;
var _41304__$1 = this;
return (new cljs.core.async.t_cljs$core$async41302(self__.f,self__.ch,meta41303__$1));
});

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_41304){
var self__ = this;
var _41304__$1 = this;
return self__.meta41303;
});

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,(function (){
if(typeof cljs.core.async.t_cljs$core$async41305 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async41305 = (function (f,ch,meta41303,_,fn1,meta41306){
this.f = f;
this.ch = ch;
this.meta41303 = meta41303;
this._ = _;
this.fn1 = fn1;
this.meta41306 = meta41306;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){
return (function (_41307,meta41306__$1){
var self__ = this;
var _41307__$1 = this;
return (new cljs.core.async.t_cljs$core$async41305(self__.f,self__.ch,self__.meta41303,self__._,self__.fn1,meta41306__$1));
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){
return (function (_41307){
var self__ = this;
var _41307__$1 = this;
return self__.meta41306;
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.fn1);
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
return true;
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
var f1 = cljs.core.async.impl.protocols.commit.call(null,self__.fn1);
return ((function (f1,___$2,___$1){
return (function (p1__41295_SHARP_){
return f1.call(null,(((p1__41295_SHARP_ == null))?null:self__.f.call(null,p1__41295_SHARP_)));
});
;})(f1,___$2,___$1))
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.getBasis = ((function (___$1){
return (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta41303","meta41303",2006664323,null),cljs.core.with_meta(new cljs.core.Symbol(null,"_","_",-1201019570,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol("cljs.core.async","t_cljs$core$async41302","cljs.core.async/t_cljs$core$async41302",1964324585,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta41306","meta41306",-1198869060,null)], null);
});})(___$1))
;

cljs.core.async.t_cljs$core$async41305.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async41305.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async41305";

cljs.core.async.t_cljs$core$async41305.cljs$lang$ctorPrWriter = ((function (___$1){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async41305");
});})(___$1))
;

cljs.core.async.__GT_t_cljs$core$async41305 = ((function (___$1){
return (function cljs$core$async$map_LT__$___GT_t_cljs$core$async41305(f__$1,ch__$1,meta41303__$1,___$2,fn1__$1,meta41306){
return (new cljs.core.async.t_cljs$core$async41305(f__$1,ch__$1,meta41303__$1,___$2,fn1__$1,meta41306));
});})(___$1))
;

}

return (new cljs.core.async.t_cljs$core$async41305(self__.f,self__.ch,self__.meta41303,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__23136__auto__ = ret;
if(cljs.core.truth_(and__23136__auto__)){
return !((cljs.core.deref.call(null,ret) == null));
} else {
return and__23136__auto__;
}
})())){
return cljs.core.async.impl.channels.box.call(null,self__.f.call(null,cljs.core.deref.call(null,ret)));
} else {
return ret;
}
});

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41302.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
});

cljs.core.async.t_cljs$core$async41302.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta41303","meta41303",2006664323,null)], null);
});

cljs.core.async.t_cljs$core$async41302.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async41302.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async41302";

cljs.core.async.t_cljs$core$async41302.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async41302");
});

cljs.core.async.__GT_t_cljs$core$async41302 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async41302(f__$1,ch__$1,meta41303){
return (new cljs.core.async.t_cljs$core$async41302(f__$1,ch__$1,meta41303));
});

}

return (new cljs.core.async.t_cljs$core$async41302(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_GT_ = (function cljs$core$async$map_GT_(f,ch){
if(typeof cljs.core.async.t_cljs$core$async41311 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async41311 = (function (f,ch,meta41312){
this.f = f;
this.ch = ch;
this.meta41312 = meta41312;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_41313,meta41312__$1){
var self__ = this;
var _41313__$1 = this;
return (new cljs.core.async.t_cljs$core$async41311(self__.f,self__.ch,meta41312__$1));
});

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_41313){
var self__ = this;
var _41313__$1 = this;
return self__.meta41312;
});

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41311.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,self__.f.call(null,val),fn1);
});

cljs.core.async.t_cljs$core$async41311.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta41312","meta41312",363481179,null)], null);
});

cljs.core.async.t_cljs$core$async41311.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async41311.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async41311";

cljs.core.async.t_cljs$core$async41311.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async41311");
});

cljs.core.async.__GT_t_cljs$core$async41311 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async41311(f__$1,ch__$1,meta41312){
return (new cljs.core.async.t_cljs$core$async41311(f__$1,ch__$1,meta41312));
});

}

return (new cljs.core.async.t_cljs$core$async41311(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_GT_ = (function cljs$core$async$filter_GT_(p,ch){
if(typeof cljs.core.async.t_cljs$core$async41317 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async41317 = (function (p,ch,meta41318){
this.p = p;
this.ch = ch;
this.meta41318 = meta41318;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_41319,meta41318__$1){
var self__ = this;
var _41319__$1 = this;
return (new cljs.core.async.t_cljs$core$async41317(self__.p,self__.ch,meta41318__$1));
});

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_41319){
var self__ = this;
var _41319__$1 = this;
return self__.meta41318;
});

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async41317.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.p.call(null,val))){
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box.call(null,cljs.core.not.call(null,cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch)));
}
});

cljs.core.async.t_cljs$core$async41317.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"p","p",1791580836,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta41318","meta41318",-2126907031,null)], null);
});

cljs.core.async.t_cljs$core$async41317.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async41317.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async41317";

cljs.core.async.t_cljs$core$async41317.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"cljs.core.async/t_cljs$core$async41317");
});

cljs.core.async.__GT_t_cljs$core$async41317 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async41317(p__$1,ch__$1,meta41318){
return (new cljs.core.async.t_cljs$core$async41317(p__$1,ch__$1,meta41318));
});

}

return (new cljs.core.async.t_cljs$core$async41317(p,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_GT_ = (function cljs$core$async$remove_GT_(p,ch){
return cljs.core.async.filter_GT_.call(null,cljs.core.complement.call(null,p),ch);
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_LT_ = (function cljs$core$async$filter_LT_(var_args){
var args41320 = [];
var len__24369__auto___41364 = arguments.length;
var i__24370__auto___41365 = (0);
while(true){
if((i__24370__auto___41365 < len__24369__auto___41364)){
args41320.push((arguments[i__24370__auto___41365]));

var G__41366 = (i__24370__auto___41365 + (1));
i__24370__auto___41365 = G__41366;
continue;
} else {
}
break;
}

var G__41322 = args41320.length;
switch (G__41322) {
case 2:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41320.length)].join('')));

}
});

cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.filter_LT_.call(null,p,ch,null);
});

cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41368 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41368,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41368,out){
return (function (state_41343){
var state_val_41344 = (state_41343[(1)]);
if((state_val_41344 === (7))){
var inst_41339 = (state_41343[(2)]);
var state_41343__$1 = state_41343;
var statearr_41345_41369 = state_41343__$1;
(statearr_41345_41369[(2)] = inst_41339);

(statearr_41345_41369[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (1))){
var state_41343__$1 = state_41343;
var statearr_41346_41370 = state_41343__$1;
(statearr_41346_41370[(2)] = null);

(statearr_41346_41370[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (4))){
var inst_41325 = (state_41343[(7)]);
var inst_41325__$1 = (state_41343[(2)]);
var inst_41326 = (inst_41325__$1 == null);
var state_41343__$1 = (function (){var statearr_41347 = state_41343;
(statearr_41347[(7)] = inst_41325__$1);

return statearr_41347;
})();
if(cljs.core.truth_(inst_41326)){
var statearr_41348_41371 = state_41343__$1;
(statearr_41348_41371[(1)] = (5));

} else {
var statearr_41349_41372 = state_41343__$1;
(statearr_41349_41372[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (6))){
var inst_41325 = (state_41343[(7)]);
var inst_41330 = p.call(null,inst_41325);
var state_41343__$1 = state_41343;
if(cljs.core.truth_(inst_41330)){
var statearr_41350_41373 = state_41343__$1;
(statearr_41350_41373[(1)] = (8));

} else {
var statearr_41351_41374 = state_41343__$1;
(statearr_41351_41374[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (3))){
var inst_41341 = (state_41343[(2)]);
var state_41343__$1 = state_41343;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41343__$1,inst_41341);
} else {
if((state_val_41344 === (2))){
var state_41343__$1 = state_41343;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41343__$1,(4),ch);
} else {
if((state_val_41344 === (11))){
var inst_41333 = (state_41343[(2)]);
var state_41343__$1 = state_41343;
var statearr_41352_41375 = state_41343__$1;
(statearr_41352_41375[(2)] = inst_41333);

(statearr_41352_41375[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (9))){
var state_41343__$1 = state_41343;
var statearr_41353_41376 = state_41343__$1;
(statearr_41353_41376[(2)] = null);

(statearr_41353_41376[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (5))){
var inst_41328 = cljs.core.async.close_BANG_.call(null,out);
var state_41343__$1 = state_41343;
var statearr_41354_41377 = state_41343__$1;
(statearr_41354_41377[(2)] = inst_41328);

(statearr_41354_41377[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (10))){
var inst_41336 = (state_41343[(2)]);
var state_41343__$1 = (function (){var statearr_41355 = state_41343;
(statearr_41355[(8)] = inst_41336);

return statearr_41355;
})();
var statearr_41356_41378 = state_41343__$1;
(statearr_41356_41378[(2)] = null);

(statearr_41356_41378[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41344 === (8))){
var inst_41325 = (state_41343[(7)]);
var state_41343__$1 = state_41343;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41343__$1,(11),out,inst_41325);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41368,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41368,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41360 = [null,null,null,null,null,null,null,null,null];
(statearr_41360[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41360[(1)] = (1));

return statearr_41360;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41343){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41343);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41361){if((e41361 instanceof Object)){
var ex__38937__auto__ = e41361;
var statearr_41362_41379 = state_41343;
(statearr_41362_41379[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41343);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41361;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41380 = state_41343;
state_41343 = G__41380;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41343){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41343);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41368,out))
})();
var state__39049__auto__ = (function (){var statearr_41363 = f__39048__auto__.call(null);
(statearr_41363[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41368);

return statearr_41363;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41368,out))
);


return out;
});

cljs.core.async.filter_LT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_LT_ = (function cljs$core$async$remove_LT_(var_args){
var args41381 = [];
var len__24369__auto___41384 = arguments.length;
var i__24370__auto___41385 = (0);
while(true){
if((i__24370__auto___41385 < len__24369__auto___41384)){
args41381.push((arguments[i__24370__auto___41385]));

var G__41386 = (i__24370__auto___41385 + (1));
i__24370__auto___41385 = G__41386;
continue;
} else {
}
break;
}

var G__41383 = args41381.length;
switch (G__41383) {
case 2:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41381.length)].join('')));

}
});

cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.remove_LT_.call(null,p,ch,null);
});

cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
return cljs.core.async.filter_LT_.call(null,cljs.core.complement.call(null,p),ch,buf_or_n);
});

cljs.core.async.remove_LT_.cljs$lang$maxFixedArity = 3;

cljs.core.async.mapcat_STAR_ = (function cljs$core$async$mapcat_STAR_(f,in$,out){
var c__39047__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto__){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto__){
return (function (state_41553){
var state_val_41554 = (state_41553[(1)]);
if((state_val_41554 === (7))){
var inst_41549 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
var statearr_41555_41596 = state_41553__$1;
(statearr_41555_41596[(2)] = inst_41549);

(statearr_41555_41596[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (20))){
var inst_41519 = (state_41553[(7)]);
var inst_41530 = (state_41553[(2)]);
var inst_41531 = cljs.core.next.call(null,inst_41519);
var inst_41505 = inst_41531;
var inst_41506 = null;
var inst_41507 = (0);
var inst_41508 = (0);
var state_41553__$1 = (function (){var statearr_41556 = state_41553;
(statearr_41556[(8)] = inst_41507);

(statearr_41556[(9)] = inst_41530);

(statearr_41556[(10)] = inst_41508);

(statearr_41556[(11)] = inst_41506);

(statearr_41556[(12)] = inst_41505);

return statearr_41556;
})();
var statearr_41557_41597 = state_41553__$1;
(statearr_41557_41597[(2)] = null);

(statearr_41557_41597[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (1))){
var state_41553__$1 = state_41553;
var statearr_41558_41598 = state_41553__$1;
(statearr_41558_41598[(2)] = null);

(statearr_41558_41598[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (4))){
var inst_41494 = (state_41553[(13)]);
var inst_41494__$1 = (state_41553[(2)]);
var inst_41495 = (inst_41494__$1 == null);
var state_41553__$1 = (function (){var statearr_41559 = state_41553;
(statearr_41559[(13)] = inst_41494__$1);

return statearr_41559;
})();
if(cljs.core.truth_(inst_41495)){
var statearr_41560_41599 = state_41553__$1;
(statearr_41560_41599[(1)] = (5));

} else {
var statearr_41561_41600 = state_41553__$1;
(statearr_41561_41600[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (15))){
var state_41553__$1 = state_41553;
var statearr_41565_41601 = state_41553__$1;
(statearr_41565_41601[(2)] = null);

(statearr_41565_41601[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (21))){
var state_41553__$1 = state_41553;
var statearr_41566_41602 = state_41553__$1;
(statearr_41566_41602[(2)] = null);

(statearr_41566_41602[(1)] = (23));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (13))){
var inst_41507 = (state_41553[(8)]);
var inst_41508 = (state_41553[(10)]);
var inst_41506 = (state_41553[(11)]);
var inst_41505 = (state_41553[(12)]);
var inst_41515 = (state_41553[(2)]);
var inst_41516 = (inst_41508 + (1));
var tmp41562 = inst_41507;
var tmp41563 = inst_41506;
var tmp41564 = inst_41505;
var inst_41505__$1 = tmp41564;
var inst_41506__$1 = tmp41563;
var inst_41507__$1 = tmp41562;
var inst_41508__$1 = inst_41516;
var state_41553__$1 = (function (){var statearr_41567 = state_41553;
(statearr_41567[(8)] = inst_41507__$1);

(statearr_41567[(14)] = inst_41515);

(statearr_41567[(10)] = inst_41508__$1);

(statearr_41567[(11)] = inst_41506__$1);

(statearr_41567[(12)] = inst_41505__$1);

return statearr_41567;
})();
var statearr_41568_41603 = state_41553__$1;
(statearr_41568_41603[(2)] = null);

(statearr_41568_41603[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (22))){
var state_41553__$1 = state_41553;
var statearr_41569_41604 = state_41553__$1;
(statearr_41569_41604[(2)] = null);

(statearr_41569_41604[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (6))){
var inst_41494 = (state_41553[(13)]);
var inst_41503 = f.call(null,inst_41494);
var inst_41504 = cljs.core.seq.call(null,inst_41503);
var inst_41505 = inst_41504;
var inst_41506 = null;
var inst_41507 = (0);
var inst_41508 = (0);
var state_41553__$1 = (function (){var statearr_41570 = state_41553;
(statearr_41570[(8)] = inst_41507);

(statearr_41570[(10)] = inst_41508);

(statearr_41570[(11)] = inst_41506);

(statearr_41570[(12)] = inst_41505);

return statearr_41570;
})();
var statearr_41571_41605 = state_41553__$1;
(statearr_41571_41605[(2)] = null);

(statearr_41571_41605[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (17))){
var inst_41519 = (state_41553[(7)]);
var inst_41523 = cljs.core.chunk_first.call(null,inst_41519);
var inst_41524 = cljs.core.chunk_rest.call(null,inst_41519);
var inst_41525 = cljs.core.count.call(null,inst_41523);
var inst_41505 = inst_41524;
var inst_41506 = inst_41523;
var inst_41507 = inst_41525;
var inst_41508 = (0);
var state_41553__$1 = (function (){var statearr_41572 = state_41553;
(statearr_41572[(8)] = inst_41507);

(statearr_41572[(10)] = inst_41508);

(statearr_41572[(11)] = inst_41506);

(statearr_41572[(12)] = inst_41505);

return statearr_41572;
})();
var statearr_41573_41606 = state_41553__$1;
(statearr_41573_41606[(2)] = null);

(statearr_41573_41606[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (3))){
var inst_41551 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41553__$1,inst_41551);
} else {
if((state_val_41554 === (12))){
var inst_41539 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
var statearr_41574_41607 = state_41553__$1;
(statearr_41574_41607[(2)] = inst_41539);

(statearr_41574_41607[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (2))){
var state_41553__$1 = state_41553;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41553__$1,(4),in$);
} else {
if((state_val_41554 === (23))){
var inst_41547 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
var statearr_41575_41608 = state_41553__$1;
(statearr_41575_41608[(2)] = inst_41547);

(statearr_41575_41608[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (19))){
var inst_41534 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
var statearr_41576_41609 = state_41553__$1;
(statearr_41576_41609[(2)] = inst_41534);

(statearr_41576_41609[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (11))){
var inst_41519 = (state_41553[(7)]);
var inst_41505 = (state_41553[(12)]);
var inst_41519__$1 = cljs.core.seq.call(null,inst_41505);
var state_41553__$1 = (function (){var statearr_41577 = state_41553;
(statearr_41577[(7)] = inst_41519__$1);

return statearr_41577;
})();
if(inst_41519__$1){
var statearr_41578_41610 = state_41553__$1;
(statearr_41578_41610[(1)] = (14));

} else {
var statearr_41579_41611 = state_41553__$1;
(statearr_41579_41611[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (9))){
var inst_41541 = (state_41553[(2)]);
var inst_41542 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out);
var state_41553__$1 = (function (){var statearr_41580 = state_41553;
(statearr_41580[(15)] = inst_41541);

return statearr_41580;
})();
if(cljs.core.truth_(inst_41542)){
var statearr_41581_41612 = state_41553__$1;
(statearr_41581_41612[(1)] = (21));

} else {
var statearr_41582_41613 = state_41553__$1;
(statearr_41582_41613[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (5))){
var inst_41497 = cljs.core.async.close_BANG_.call(null,out);
var state_41553__$1 = state_41553;
var statearr_41583_41614 = state_41553__$1;
(statearr_41583_41614[(2)] = inst_41497);

(statearr_41583_41614[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (14))){
var inst_41519 = (state_41553[(7)]);
var inst_41521 = cljs.core.chunked_seq_QMARK_.call(null,inst_41519);
var state_41553__$1 = state_41553;
if(inst_41521){
var statearr_41584_41615 = state_41553__$1;
(statearr_41584_41615[(1)] = (17));

} else {
var statearr_41585_41616 = state_41553__$1;
(statearr_41585_41616[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (16))){
var inst_41537 = (state_41553[(2)]);
var state_41553__$1 = state_41553;
var statearr_41586_41617 = state_41553__$1;
(statearr_41586_41617[(2)] = inst_41537);

(statearr_41586_41617[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41554 === (10))){
var inst_41508 = (state_41553[(10)]);
var inst_41506 = (state_41553[(11)]);
var inst_41513 = cljs.core._nth.call(null,inst_41506,inst_41508);
var state_41553__$1 = state_41553;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41553__$1,(13),out,inst_41513);
} else {
if((state_val_41554 === (18))){
var inst_41519 = (state_41553[(7)]);
var inst_41528 = cljs.core.first.call(null,inst_41519);
var state_41553__$1 = state_41553;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41553__$1,(20),out,inst_41528);
} else {
if((state_val_41554 === (8))){
var inst_41507 = (state_41553[(8)]);
var inst_41508 = (state_41553[(10)]);
var inst_41510 = (inst_41508 < inst_41507);
var inst_41511 = inst_41510;
var state_41553__$1 = state_41553;
if(cljs.core.truth_(inst_41511)){
var statearr_41587_41618 = state_41553__$1;
(statearr_41587_41618[(1)] = (10));

} else {
var statearr_41588_41619 = state_41553__$1;
(statearr_41588_41619[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto__))
;
return ((function (switch__38933__auto__,c__39047__auto__){
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____0 = (function (){
var statearr_41592 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41592[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__);

(statearr_41592[(1)] = (1));

return statearr_41592;
});
var cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____1 = (function (state_41553){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41553);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41593){if((e41593 instanceof Object)){
var ex__38937__auto__ = e41593;
var statearr_41594_41620 = state_41553;
(statearr_41594_41620[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41553);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41593;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41621 = state_41553;
state_41553 = G__41621;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__ = function(state_41553){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____1.call(this,state_41553);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__38934__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto__))
})();
var state__39049__auto__ = (function (){var statearr_41595 = f__39048__auto__.call(null);
(statearr_41595[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto__);

return statearr_41595;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto__))
);

return c__39047__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var args41622 = [];
var len__24369__auto___41625 = arguments.length;
var i__24370__auto___41626 = (0);
while(true){
if((i__24370__auto___41626 < len__24369__auto___41625)){
args41622.push((arguments[i__24370__auto___41626]));

var G__41627 = (i__24370__auto___41626 + (1));
i__24370__auto___41626 = G__41627;
continue;
} else {
}
break;
}

var G__41624 = args41622.length;
switch (G__41624) {
case 2:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41622.length)].join('')));

}
});

cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = (function (f,in$){
return cljs.core.async.mapcat_LT_.call(null,f,in$,null);
});

cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3 = (function (f,in$,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return out;
});

cljs.core.async.mapcat_LT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_GT_ = (function cljs$core$async$mapcat_GT_(var_args){
var args41629 = [];
var len__24369__auto___41632 = arguments.length;
var i__24370__auto___41633 = (0);
while(true){
if((i__24370__auto___41633 < len__24369__auto___41632)){
args41629.push((arguments[i__24370__auto___41633]));

var G__41634 = (i__24370__auto___41633 + (1));
i__24370__auto___41633 = G__41634;
continue;
} else {
}
break;
}

var G__41631 = args41629.length;
switch (G__41631) {
case 2:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41629.length)].join('')));

}
});

cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = (function (f,out){
return cljs.core.async.mapcat_GT_.call(null,f,out,null);
});

cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3 = (function (f,out,buf_or_n){
var in$ = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return in$;
});

cljs.core.async.mapcat_GT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.unique = (function cljs$core$async$unique(var_args){
var args41636 = [];
var len__24369__auto___41687 = arguments.length;
var i__24370__auto___41688 = (0);
while(true){
if((i__24370__auto___41688 < len__24369__auto___41687)){
args41636.push((arguments[i__24370__auto___41688]));

var G__41689 = (i__24370__auto___41688 + (1));
i__24370__auto___41688 = G__41689;
continue;
} else {
}
break;
}

var G__41638 = args41636.length;
switch (G__41638) {
case 1:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41636.length)].join('')));

}
});

cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1 = (function (ch){
return cljs.core.async.unique.call(null,ch,null);
});

cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41691 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41691,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41691,out){
return (function (state_41662){
var state_val_41663 = (state_41662[(1)]);
if((state_val_41663 === (7))){
var inst_41657 = (state_41662[(2)]);
var state_41662__$1 = state_41662;
var statearr_41664_41692 = state_41662__$1;
(statearr_41664_41692[(2)] = inst_41657);

(statearr_41664_41692[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (1))){
var inst_41639 = null;
var state_41662__$1 = (function (){var statearr_41665 = state_41662;
(statearr_41665[(7)] = inst_41639);

return statearr_41665;
})();
var statearr_41666_41693 = state_41662__$1;
(statearr_41666_41693[(2)] = null);

(statearr_41666_41693[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (4))){
var inst_41642 = (state_41662[(8)]);
var inst_41642__$1 = (state_41662[(2)]);
var inst_41643 = (inst_41642__$1 == null);
var inst_41644 = cljs.core.not.call(null,inst_41643);
var state_41662__$1 = (function (){var statearr_41667 = state_41662;
(statearr_41667[(8)] = inst_41642__$1);

return statearr_41667;
})();
if(inst_41644){
var statearr_41668_41694 = state_41662__$1;
(statearr_41668_41694[(1)] = (5));

} else {
var statearr_41669_41695 = state_41662__$1;
(statearr_41669_41695[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (6))){
var state_41662__$1 = state_41662;
var statearr_41670_41696 = state_41662__$1;
(statearr_41670_41696[(2)] = null);

(statearr_41670_41696[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (3))){
var inst_41659 = (state_41662[(2)]);
var inst_41660 = cljs.core.async.close_BANG_.call(null,out);
var state_41662__$1 = (function (){var statearr_41671 = state_41662;
(statearr_41671[(9)] = inst_41659);

return statearr_41671;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41662__$1,inst_41660);
} else {
if((state_val_41663 === (2))){
var state_41662__$1 = state_41662;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41662__$1,(4),ch);
} else {
if((state_val_41663 === (11))){
var inst_41642 = (state_41662[(8)]);
var inst_41651 = (state_41662[(2)]);
var inst_41639 = inst_41642;
var state_41662__$1 = (function (){var statearr_41672 = state_41662;
(statearr_41672[(7)] = inst_41639);

(statearr_41672[(10)] = inst_41651);

return statearr_41672;
})();
var statearr_41673_41697 = state_41662__$1;
(statearr_41673_41697[(2)] = null);

(statearr_41673_41697[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (9))){
var inst_41642 = (state_41662[(8)]);
var state_41662__$1 = state_41662;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41662__$1,(11),out,inst_41642);
} else {
if((state_val_41663 === (5))){
var inst_41639 = (state_41662[(7)]);
var inst_41642 = (state_41662[(8)]);
var inst_41646 = cljs.core._EQ_.call(null,inst_41642,inst_41639);
var state_41662__$1 = state_41662;
if(inst_41646){
var statearr_41675_41698 = state_41662__$1;
(statearr_41675_41698[(1)] = (8));

} else {
var statearr_41676_41699 = state_41662__$1;
(statearr_41676_41699[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (10))){
var inst_41654 = (state_41662[(2)]);
var state_41662__$1 = state_41662;
var statearr_41677_41700 = state_41662__$1;
(statearr_41677_41700[(2)] = inst_41654);

(statearr_41677_41700[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41663 === (8))){
var inst_41639 = (state_41662[(7)]);
var tmp41674 = inst_41639;
var inst_41639__$1 = tmp41674;
var state_41662__$1 = (function (){var statearr_41678 = state_41662;
(statearr_41678[(7)] = inst_41639__$1);

return statearr_41678;
})();
var statearr_41679_41701 = state_41662__$1;
(statearr_41679_41701[(2)] = null);

(statearr_41679_41701[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41691,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41691,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41683 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_41683[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41683[(1)] = (1));

return statearr_41683;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41662){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41662);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41684){if((e41684 instanceof Object)){
var ex__38937__auto__ = e41684;
var statearr_41685_41702 = state_41662;
(statearr_41685_41702[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41662);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41684;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41703 = state_41662;
state_41662 = G__41703;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41662){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41662);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41691,out))
})();
var state__39049__auto__ = (function (){var statearr_41686 = f__39048__auto__.call(null);
(statearr_41686[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41691);

return statearr_41686;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41691,out))
);


return out;
});

cljs.core.async.unique.cljs$lang$maxFixedArity = 2;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition = (function cljs$core$async$partition(var_args){
var args41704 = [];
var len__24369__auto___41774 = arguments.length;
var i__24370__auto___41775 = (0);
while(true){
if((i__24370__auto___41775 < len__24369__auto___41774)){
args41704.push((arguments[i__24370__auto___41775]));

var G__41776 = (i__24370__auto___41775 + (1));
i__24370__auto___41775 = G__41776;
continue;
} else {
}
break;
}

var G__41706 = args41704.length;
switch (G__41706) {
case 2:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41704.length)].join('')));

}
});

cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.partition.call(null,n,ch,null);
});

cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41778 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41778,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41778,out){
return (function (state_41744){
var state_val_41745 = (state_41744[(1)]);
if((state_val_41745 === (7))){
var inst_41740 = (state_41744[(2)]);
var state_41744__$1 = state_41744;
var statearr_41746_41779 = state_41744__$1;
(statearr_41746_41779[(2)] = inst_41740);

(statearr_41746_41779[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (1))){
var inst_41707 = (new Array(n));
var inst_41708 = inst_41707;
var inst_41709 = (0);
var state_41744__$1 = (function (){var statearr_41747 = state_41744;
(statearr_41747[(7)] = inst_41708);

(statearr_41747[(8)] = inst_41709);

return statearr_41747;
})();
var statearr_41748_41780 = state_41744__$1;
(statearr_41748_41780[(2)] = null);

(statearr_41748_41780[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (4))){
var inst_41712 = (state_41744[(9)]);
var inst_41712__$1 = (state_41744[(2)]);
var inst_41713 = (inst_41712__$1 == null);
var inst_41714 = cljs.core.not.call(null,inst_41713);
var state_41744__$1 = (function (){var statearr_41749 = state_41744;
(statearr_41749[(9)] = inst_41712__$1);

return statearr_41749;
})();
if(inst_41714){
var statearr_41750_41781 = state_41744__$1;
(statearr_41750_41781[(1)] = (5));

} else {
var statearr_41751_41782 = state_41744__$1;
(statearr_41751_41782[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (15))){
var inst_41734 = (state_41744[(2)]);
var state_41744__$1 = state_41744;
var statearr_41752_41783 = state_41744__$1;
(statearr_41752_41783[(2)] = inst_41734);

(statearr_41752_41783[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (13))){
var state_41744__$1 = state_41744;
var statearr_41753_41784 = state_41744__$1;
(statearr_41753_41784[(2)] = null);

(statearr_41753_41784[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (6))){
var inst_41709 = (state_41744[(8)]);
var inst_41730 = (inst_41709 > (0));
var state_41744__$1 = state_41744;
if(cljs.core.truth_(inst_41730)){
var statearr_41754_41785 = state_41744__$1;
(statearr_41754_41785[(1)] = (12));

} else {
var statearr_41755_41786 = state_41744__$1;
(statearr_41755_41786[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (3))){
var inst_41742 = (state_41744[(2)]);
var state_41744__$1 = state_41744;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41744__$1,inst_41742);
} else {
if((state_val_41745 === (12))){
var inst_41708 = (state_41744[(7)]);
var inst_41732 = cljs.core.vec.call(null,inst_41708);
var state_41744__$1 = state_41744;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41744__$1,(15),out,inst_41732);
} else {
if((state_val_41745 === (2))){
var state_41744__$1 = state_41744;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41744__$1,(4),ch);
} else {
if((state_val_41745 === (11))){
var inst_41724 = (state_41744[(2)]);
var inst_41725 = (new Array(n));
var inst_41708 = inst_41725;
var inst_41709 = (0);
var state_41744__$1 = (function (){var statearr_41756 = state_41744;
(statearr_41756[(7)] = inst_41708);

(statearr_41756[(10)] = inst_41724);

(statearr_41756[(8)] = inst_41709);

return statearr_41756;
})();
var statearr_41757_41787 = state_41744__$1;
(statearr_41757_41787[(2)] = null);

(statearr_41757_41787[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (9))){
var inst_41708 = (state_41744[(7)]);
var inst_41722 = cljs.core.vec.call(null,inst_41708);
var state_41744__$1 = state_41744;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41744__$1,(11),out,inst_41722);
} else {
if((state_val_41745 === (5))){
var inst_41712 = (state_41744[(9)]);
var inst_41717 = (state_41744[(11)]);
var inst_41708 = (state_41744[(7)]);
var inst_41709 = (state_41744[(8)]);
var inst_41716 = (inst_41708[inst_41709] = inst_41712);
var inst_41717__$1 = (inst_41709 + (1));
var inst_41718 = (inst_41717__$1 < n);
var state_41744__$1 = (function (){var statearr_41758 = state_41744;
(statearr_41758[(11)] = inst_41717__$1);

(statearr_41758[(12)] = inst_41716);

return statearr_41758;
})();
if(cljs.core.truth_(inst_41718)){
var statearr_41759_41788 = state_41744__$1;
(statearr_41759_41788[(1)] = (8));

} else {
var statearr_41760_41789 = state_41744__$1;
(statearr_41760_41789[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (14))){
var inst_41737 = (state_41744[(2)]);
var inst_41738 = cljs.core.async.close_BANG_.call(null,out);
var state_41744__$1 = (function (){var statearr_41762 = state_41744;
(statearr_41762[(13)] = inst_41737);

return statearr_41762;
})();
var statearr_41763_41790 = state_41744__$1;
(statearr_41763_41790[(2)] = inst_41738);

(statearr_41763_41790[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (10))){
var inst_41728 = (state_41744[(2)]);
var state_41744__$1 = state_41744;
var statearr_41764_41791 = state_41744__$1;
(statearr_41764_41791[(2)] = inst_41728);

(statearr_41764_41791[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41745 === (8))){
var inst_41717 = (state_41744[(11)]);
var inst_41708 = (state_41744[(7)]);
var tmp41761 = inst_41708;
var inst_41708__$1 = tmp41761;
var inst_41709 = inst_41717;
var state_41744__$1 = (function (){var statearr_41765 = state_41744;
(statearr_41765[(7)] = inst_41708__$1);

(statearr_41765[(8)] = inst_41709);

return statearr_41765;
})();
var statearr_41766_41792 = state_41744__$1;
(statearr_41766_41792[(2)] = null);

(statearr_41766_41792[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41778,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41778,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41770 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41770[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41770[(1)] = (1));

return statearr_41770;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41744){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41744);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41771){if((e41771 instanceof Object)){
var ex__38937__auto__ = e41771;
var statearr_41772_41793 = state_41744;
(statearr_41772_41793[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41744);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41771;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41794 = state_41744;
state_41744 = G__41794;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41744){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41744);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41778,out))
})();
var state__39049__auto__ = (function (){var statearr_41773 = f__39048__auto__.call(null);
(statearr_41773[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41778);

return statearr_41773;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41778,out))
);


return out;
});

cljs.core.async.partition.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition_by = (function cljs$core$async$partition_by(var_args){
var args41795 = [];
var len__24369__auto___41869 = arguments.length;
var i__24370__auto___41870 = (0);
while(true){
if((i__24370__auto___41870 < len__24369__auto___41869)){
args41795.push((arguments[i__24370__auto___41870]));

var G__41871 = (i__24370__auto___41870 + (1));
i__24370__auto___41870 = G__41871;
continue;
} else {
}
break;
}

var G__41797 = args41795.length;
switch (G__41797) {
case 2:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41795.length)].join('')));

}
});

cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2 = (function (f,ch){
return cljs.core.async.partition_by.call(null,f,ch,null);
});

cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3 = (function (f,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__39047__auto___41873 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__39047__auto___41873,out){
return (function (){
var f__39048__auto__ = (function (){var switch__38933__auto__ = ((function (c__39047__auto___41873,out){
return (function (state_41839){
var state_val_41840 = (state_41839[(1)]);
if((state_val_41840 === (7))){
var inst_41835 = (state_41839[(2)]);
var state_41839__$1 = state_41839;
var statearr_41841_41874 = state_41839__$1;
(statearr_41841_41874[(2)] = inst_41835);

(statearr_41841_41874[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (1))){
var inst_41798 = [];
var inst_41799 = inst_41798;
var inst_41800 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_41839__$1 = (function (){var statearr_41842 = state_41839;
(statearr_41842[(7)] = inst_41800);

(statearr_41842[(8)] = inst_41799);

return statearr_41842;
})();
var statearr_41843_41875 = state_41839__$1;
(statearr_41843_41875[(2)] = null);

(statearr_41843_41875[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (4))){
var inst_41803 = (state_41839[(9)]);
var inst_41803__$1 = (state_41839[(2)]);
var inst_41804 = (inst_41803__$1 == null);
var inst_41805 = cljs.core.not.call(null,inst_41804);
var state_41839__$1 = (function (){var statearr_41844 = state_41839;
(statearr_41844[(9)] = inst_41803__$1);

return statearr_41844;
})();
if(inst_41805){
var statearr_41845_41876 = state_41839__$1;
(statearr_41845_41876[(1)] = (5));

} else {
var statearr_41846_41877 = state_41839__$1;
(statearr_41846_41877[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (15))){
var inst_41829 = (state_41839[(2)]);
var state_41839__$1 = state_41839;
var statearr_41847_41878 = state_41839__$1;
(statearr_41847_41878[(2)] = inst_41829);

(statearr_41847_41878[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (13))){
var state_41839__$1 = state_41839;
var statearr_41848_41879 = state_41839__$1;
(statearr_41848_41879[(2)] = null);

(statearr_41848_41879[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (6))){
var inst_41799 = (state_41839[(8)]);
var inst_41824 = inst_41799.length;
var inst_41825 = (inst_41824 > (0));
var state_41839__$1 = state_41839;
if(cljs.core.truth_(inst_41825)){
var statearr_41849_41880 = state_41839__$1;
(statearr_41849_41880[(1)] = (12));

} else {
var statearr_41850_41881 = state_41839__$1;
(statearr_41850_41881[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (3))){
var inst_41837 = (state_41839[(2)]);
var state_41839__$1 = state_41839;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41839__$1,inst_41837);
} else {
if((state_val_41840 === (12))){
var inst_41799 = (state_41839[(8)]);
var inst_41827 = cljs.core.vec.call(null,inst_41799);
var state_41839__$1 = state_41839;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41839__$1,(15),out,inst_41827);
} else {
if((state_val_41840 === (2))){
var state_41839__$1 = state_41839;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41839__$1,(4),ch);
} else {
if((state_val_41840 === (11))){
var inst_41803 = (state_41839[(9)]);
var inst_41807 = (state_41839[(10)]);
var inst_41817 = (state_41839[(2)]);
var inst_41818 = [];
var inst_41819 = inst_41818.push(inst_41803);
var inst_41799 = inst_41818;
var inst_41800 = inst_41807;
var state_41839__$1 = (function (){var statearr_41851 = state_41839;
(statearr_41851[(11)] = inst_41817);

(statearr_41851[(12)] = inst_41819);

(statearr_41851[(7)] = inst_41800);

(statearr_41851[(8)] = inst_41799);

return statearr_41851;
})();
var statearr_41852_41882 = state_41839__$1;
(statearr_41852_41882[(2)] = null);

(statearr_41852_41882[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (9))){
var inst_41799 = (state_41839[(8)]);
var inst_41815 = cljs.core.vec.call(null,inst_41799);
var state_41839__$1 = state_41839;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41839__$1,(11),out,inst_41815);
} else {
if((state_val_41840 === (5))){
var inst_41803 = (state_41839[(9)]);
var inst_41807 = (state_41839[(10)]);
var inst_41800 = (state_41839[(7)]);
var inst_41807__$1 = f.call(null,inst_41803);
var inst_41808 = cljs.core._EQ_.call(null,inst_41807__$1,inst_41800);
var inst_41809 = cljs.core.keyword_identical_QMARK_.call(null,inst_41800,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var inst_41810 = (inst_41808) || (inst_41809);
var state_41839__$1 = (function (){var statearr_41853 = state_41839;
(statearr_41853[(10)] = inst_41807__$1);

return statearr_41853;
})();
if(cljs.core.truth_(inst_41810)){
var statearr_41854_41883 = state_41839__$1;
(statearr_41854_41883[(1)] = (8));

} else {
var statearr_41855_41884 = state_41839__$1;
(statearr_41855_41884[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (14))){
var inst_41832 = (state_41839[(2)]);
var inst_41833 = cljs.core.async.close_BANG_.call(null,out);
var state_41839__$1 = (function (){var statearr_41857 = state_41839;
(statearr_41857[(13)] = inst_41832);

return statearr_41857;
})();
var statearr_41858_41885 = state_41839__$1;
(statearr_41858_41885[(2)] = inst_41833);

(statearr_41858_41885[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (10))){
var inst_41822 = (state_41839[(2)]);
var state_41839__$1 = state_41839;
var statearr_41859_41886 = state_41839__$1;
(statearr_41859_41886[(2)] = inst_41822);

(statearr_41859_41886[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41840 === (8))){
var inst_41803 = (state_41839[(9)]);
var inst_41807 = (state_41839[(10)]);
var inst_41799 = (state_41839[(8)]);
var inst_41812 = inst_41799.push(inst_41803);
var tmp41856 = inst_41799;
var inst_41799__$1 = tmp41856;
var inst_41800 = inst_41807;
var state_41839__$1 = (function (){var statearr_41860 = state_41839;
(statearr_41860[(14)] = inst_41812);

(statearr_41860[(7)] = inst_41800);

(statearr_41860[(8)] = inst_41799__$1);

return statearr_41860;
})();
var statearr_41861_41887 = state_41839__$1;
(statearr_41861_41887[(2)] = null);

(statearr_41861_41887[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__39047__auto___41873,out))
;
return ((function (switch__38933__auto__,c__39047__auto___41873,out){
return (function() {
var cljs$core$async$state_machine__38934__auto__ = null;
var cljs$core$async$state_machine__38934__auto____0 = (function (){
var statearr_41865 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41865[(0)] = cljs$core$async$state_machine__38934__auto__);

(statearr_41865[(1)] = (1));

return statearr_41865;
});
var cljs$core$async$state_machine__38934__auto____1 = (function (state_41839){
while(true){
var ret_value__38935__auto__ = (function (){try{while(true){
var result__38936__auto__ = switch__38933__auto__.call(null,state_41839);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38936__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38936__auto__;
}
break;
}
}catch (e41866){if((e41866 instanceof Object)){
var ex__38937__auto__ = e41866;
var statearr_41867_41888 = state_41839;
(statearr_41867_41888[(5)] = ex__38937__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_41839);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e41866;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38935__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41889 = state_41839;
state_41839 = G__41889;
continue;
} else {
return ret_value__38935__auto__;
}
break;
}
});
cljs$core$async$state_machine__38934__auto__ = function(state_41839){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38934__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38934__auto____1.call(this,state_41839);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38934__auto____0;
cljs$core$async$state_machine__38934__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38934__auto____1;
return cljs$core$async$state_machine__38934__auto__;
})()
;})(switch__38933__auto__,c__39047__auto___41873,out))
})();
var state__39049__auto__ = (function (){var statearr_41868 = f__39048__auto__.call(null);
(statearr_41868[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__39047__auto___41873);

return statearr_41868;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__39049__auto__);
});})(c__39047__auto___41873,out))
);


return out;
});

cljs.core.async.partition_by.cljs$lang$maxFixedArity = 3;

