// 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 args30659 = [];
var len__24559__auto___30665 = arguments.length;
var i__24560__auto___30666 = (0);
while(true){
if((i__24560__auto___30666 < len__24559__auto___30665)){
args30659.push((arguments[i__24560__auto___30666]));

var G__30667 = (i__24560__auto___30666 + (1));
i__24560__auto___30666 = G__30667;
continue;
} else {
}
break;
}

var G__30661 = args30659.length;
switch (G__30661) {
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(args30659.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$async30662 !== 'undefined'){
} else {

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

cljs.core.async.t_cljs$core$async30662.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_30664){
var self__ = this;
var _30664__$1 = this;
return self__.meta30663;
});

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

cljs.core.async.t_cljs$core$async30662.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$async30662.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$async30662.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$async30662.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,"meta30663","meta30663",-1002559602,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async30662.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async30662");
});

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

}

return (new cljs.core.async.t_cljs$core$async30662(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 args30671 = [];
var len__24559__auto___30674 = arguments.length;
var i__24560__auto___30675 = (0);
while(true){
if((i__24560__auto___30675 < len__24559__auto___30674)){
args30671.push((arguments[i__24560__auto___30675]));

var G__30676 = (i__24560__auto___30675 + (1));
i__24560__auto___30675 = G__30676;
continue;
} else {
}
break;
}

var G__30673 = args30671.length;
switch (G__30673) {
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(args30671.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 args30678 = [];
var len__24559__auto___30681 = arguments.length;
var i__24560__auto___30682 = (0);
while(true){
if((i__24560__auto___30682 < len__24559__auto___30681)){
args30678.push((arguments[i__24560__auto___30682]));

var G__30683 = (i__24560__auto___30682 + (1));
i__24560__auto___30682 = G__30683;
continue;
} else {
}
break;
}

var G__30680 = args30678.length;
switch (G__30680) {
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(args30678.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 args30685 = [];
var len__24559__auto___30688 = arguments.length;
var i__24560__auto___30689 = (0);
while(true){
if((i__24560__auto___30689 < len__24559__auto___30688)){
args30685.push((arguments[i__24560__auto___30689]));

var G__30690 = (i__24560__auto___30689 + (1));
i__24560__auto___30689 = G__30690;
continue;
} else {
}
break;
}

var G__30687 = args30685.length;
switch (G__30687) {
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(args30685.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_30692 = cljs.core.deref.call(null,ret);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,val_30692);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (val_30692,ret){
return (function (){
return fn1.call(null,val_30692);
});})(val_30692,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 args30693 = [];
var len__24559__auto___30696 = arguments.length;
var i__24560__auto___30697 = (0);
while(true){
if((i__24560__auto___30697 < len__24559__auto___30696)){
args30693.push((arguments[i__24560__auto___30697]));

var G__30698 = (i__24560__auto___30697 + (1));
i__24560__auto___30697 = G__30698;
continue;
} else {
}
break;
}

var G__30695 = args30693.length;
switch (G__30695) {
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(args30693.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__24359__auto___30700 = n;
var x_30701 = (0);
while(true){
if((x_30701 < n__24359__auto___30700)){
(a[x_30701] = (0));

var G__30702 = (x_30701 + (1));
x_30701 = G__30702;
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__30703 = (i + (1));
i = G__30703;
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$async30707 !== 'undefined'){
} else {

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

cljs.core.async.t_cljs$core$async30707.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){
return (function (_30709){
var self__ = this;
var _30709__$1 = this;
return self__.meta30708;
});})(flag))
;

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

cljs.core.async.t_cljs$core$async30707.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$async30707.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$async30707.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$async30707.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,"meta30708","meta30708",1804482368,null)], null);
});})(flag))
;

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

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

cljs.core.async.t_cljs$core$async30707.cljs$lang$ctorPrWriter = ((function (flag){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async30707");
});})(flag))
;

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

}

return (new cljs.core.async.t_cljs$core$async30707(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$async30713 !== 'undefined'){
} else {

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

cljs.core.async.t_cljs$core$async30713.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_30715){
var self__ = this;
var _30715__$1 = this;
return self__.meta30714;
});

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

cljs.core.async.t_cljs$core$async30713.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$async30713.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$async30713.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$async30713.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,"meta30714","meta30714",216375716,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async30713.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async30713");
});

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

}

return (new cljs.core.async.t_cljs$core$async30713(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__30716_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__30716_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__30717_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__30717_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__23338__auto__ = wport;
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
return port;
}
})()], null));
} else {
var G__30718 = (i + (1));
i = G__30718;
continue;
}
} else {
return null;
}
break;
}
})();
var or__23338__auto__ = ret;
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__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__23326__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,flag);
if(cljs.core.truth_(and__23326__auto__)){
return cljs.core.async.impl.protocols.commit.call(null,flag);
} else {
return and__23326__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__24566__auto__ = [];
var len__24559__auto___30724 = arguments.length;
var i__24560__auto___30725 = (0);
while(true){
if((i__24560__auto___30725 < len__24559__auto___30724)){
args__24566__auto__.push((arguments[i__24560__auto___30725]));

var G__30726 = (i__24560__auto___30725 + (1));
i__24560__auto___30725 = G__30726;
continue;
} else {
}
break;
}

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

cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__30721){
var map__30722 = p__30721;
var map__30722__$1 = ((((!((map__30722 == null)))?((((map__30722.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__30722.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__30722):map__30722);
var opts = map__30722__$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 (seq30719){
var G__30720 = cljs.core.first.call(null,seq30719);
var seq30719__$1 = cljs.core.next.call(null,seq30719);
return cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__30720,seq30719__$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 args30727 = [];
var len__24559__auto___30777 = arguments.length;
var i__24560__auto___30778 = (0);
while(true){
if((i__24560__auto___30778 < len__24559__auto___30777)){
args30727.push((arguments[i__24560__auto___30778]));

var G__30779 = (i__24560__auto___30778 + (1));
i__24560__auto___30778 = G__30779;
continue;
} else {
}
break;
}

var G__30729 = args30727.length;
switch (G__30729) {
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(args30727.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__30600__auto___30781 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___30781){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___30781){
return (function (state_30753){
var state_val_30754 = (state_30753[(1)]);
if((state_val_30754 === (7))){
var inst_30749 = (state_30753[(2)]);
var state_30753__$1 = state_30753;
var statearr_30755_30782 = state_30753__$1;
(statearr_30755_30782[(2)] = inst_30749);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (1))){
var state_30753__$1 = state_30753;
var statearr_30756_30783 = state_30753__$1;
(statearr_30756_30783[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (4))){
var inst_30732 = (state_30753[(7)]);
var inst_30732__$1 = (state_30753[(2)]);
var inst_30733 = (inst_30732__$1 == null);
var state_30753__$1 = (function (){var statearr_30757 = state_30753;
(statearr_30757[(7)] = inst_30732__$1);

return statearr_30757;
})();
if(cljs.core.truth_(inst_30733)){
var statearr_30758_30784 = state_30753__$1;
(statearr_30758_30784[(1)] = (5));

} else {
var statearr_30759_30785 = state_30753__$1;
(statearr_30759_30785[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (13))){
var state_30753__$1 = state_30753;
var statearr_30760_30786 = state_30753__$1;
(statearr_30760_30786[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (6))){
var inst_30732 = (state_30753[(7)]);
var state_30753__$1 = state_30753;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_30753__$1,(11),to,inst_30732);
} else {
if((state_val_30754 === (3))){
var inst_30751 = (state_30753[(2)]);
var state_30753__$1 = state_30753;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_30753__$1,inst_30751);
} else {
if((state_val_30754 === (12))){
var state_30753__$1 = state_30753;
var statearr_30761_30787 = state_30753__$1;
(statearr_30761_30787[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (2))){
var state_30753__$1 = state_30753;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_30753__$1,(4),from);
} else {
if((state_val_30754 === (11))){
var inst_30742 = (state_30753[(2)]);
var state_30753__$1 = state_30753;
if(cljs.core.truth_(inst_30742)){
var statearr_30762_30788 = state_30753__$1;
(statearr_30762_30788[(1)] = (12));

} else {
var statearr_30763_30789 = state_30753__$1;
(statearr_30763_30789[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (9))){
var state_30753__$1 = state_30753;
var statearr_30764_30790 = state_30753__$1;
(statearr_30764_30790[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (5))){
var state_30753__$1 = state_30753;
if(cljs.core.truth_(close_QMARK_)){
var statearr_30765_30791 = state_30753__$1;
(statearr_30765_30791[(1)] = (8));

} else {
var statearr_30766_30792 = state_30753__$1;
(statearr_30766_30792[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (14))){
var inst_30747 = (state_30753[(2)]);
var state_30753__$1 = state_30753;
var statearr_30767_30793 = state_30753__$1;
(statearr_30767_30793[(2)] = inst_30747);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (10))){
var inst_30739 = (state_30753[(2)]);
var state_30753__$1 = state_30753;
var statearr_30768_30794 = state_30753__$1;
(statearr_30768_30794[(2)] = inst_30739);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_30754 === (8))){
var inst_30736 = cljs.core.async.close_BANG_.call(null,to);
var state_30753__$1 = state_30753;
var statearr_30769_30795 = state_30753__$1;
(statearr_30769_30795[(2)] = inst_30736);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___30781))
;
return ((function (switch__30486__auto__,c__30600__auto___30781){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_30773 = [null,null,null,null,null,null,null,null];
(statearr_30773[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_30773[(1)] = (1));

return statearr_30773;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_30753){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_30753);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e30774){if((e30774 instanceof Object)){
var ex__30490__auto__ = e30774;
var statearr_30775_30796 = state_30753;
(statearr_30775_30796[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__30797 = state_30753;
state_30753 = G__30797;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_30753){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_30753);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___30781))
})();
var state__30602__auto__ = (function (){var statearr_30776 = f__30601__auto__.call(null);
(statearr_30776[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___30781);

return statearr_30776;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___30781))
);


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__30985){
var vec__30986 = p__30985;
var v = cljs.core.nth.call(null,vec__30986,(0),null);
var p = cljs.core.nth.call(null,vec__30986,(1),null);
var job = vec__30986;
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__30600__auto___31172 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___31172,res,vec__30986,v,p,job,jobs,results){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___31172,res,vec__30986,v,p,job,jobs,results){
return (function (state_30993){
var state_val_30994 = (state_30993[(1)]);
if((state_val_30994 === (1))){
var state_30993__$1 = state_30993;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_30993__$1,(2),res,v);
} else {
if((state_val_30994 === (2))){
var inst_30990 = (state_30993[(2)]);
var inst_30991 = cljs.core.async.close_BANG_.call(null,res);
var state_30993__$1 = (function (){var statearr_30995 = state_30993;
(statearr_30995[(7)] = inst_30990);

return statearr_30995;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_30993__$1,inst_30991);
} else {
return null;
}
}
});})(c__30600__auto___31172,res,vec__30986,v,p,job,jobs,results))
;
return ((function (switch__30486__auto__,c__30600__auto___31172,res,vec__30986,v,p,job,jobs,results){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_30999 = [null,null,null,null,null,null,null,null];
(statearr_30999[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__);

(statearr_30999[(1)] = (1));

return statearr_30999;
});
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1 = (function (state_30993){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_30993);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31000){if((e31000 instanceof Object)){
var ex__30490__auto__ = e31000;
var statearr_31001_31173 = state_30993;
(statearr_31001_31173[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31174 = state_30993;
state_30993 = G__31174;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = function(state_30993){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1.call(this,state_30993);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___31172,res,vec__30986,v,p,job,jobs,results))
})();
var state__30602__auto__ = (function (){var statearr_31002 = f__30601__auto__.call(null);
(statearr_31002[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31172);

return statearr_31002;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___31172,res,vec__30986,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__31003){
var vec__31004 = p__31003;
var v = cljs.core.nth.call(null,vec__31004,(0),null);
var p = cljs.core.nth.call(null,vec__31004,(1),null);
var job = vec__31004;
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__24359__auto___31175 = n;
var __31176 = (0);
while(true){
if((__31176 < n__24359__auto___31175)){
var G__31007_31177 = type;
var G__31007_31178__$1 = (((G__31007_31177 instanceof cljs.core.Keyword))?G__31007_31177.fqn:null);
switch (G__31007_31178__$1) {
case "compute":
var c__30600__auto___31180 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__31176,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (__31176,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function (state_31020){
var state_val_31021 = (state_31020[(1)]);
if((state_val_31021 === (1))){
var state_31020__$1 = state_31020;
var statearr_31022_31181 = state_31020__$1;
(statearr_31022_31181[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31021 === (2))){
var state_31020__$1 = state_31020;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31020__$1,(4),jobs);
} else {
if((state_val_31021 === (3))){
var inst_31018 = (state_31020[(2)]);
var state_31020__$1 = state_31020;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31020__$1,inst_31018);
} else {
if((state_val_31021 === (4))){
var inst_31010 = (state_31020[(2)]);
var inst_31011 = process.call(null,inst_31010);
var state_31020__$1 = state_31020;
if(cljs.core.truth_(inst_31011)){
var statearr_31023_31182 = state_31020__$1;
(statearr_31023_31182[(1)] = (5));

} else {
var statearr_31024_31183 = state_31020__$1;
(statearr_31024_31183[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31021 === (5))){
var state_31020__$1 = state_31020;
var statearr_31025_31184 = state_31020__$1;
(statearr_31025_31184[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31021 === (6))){
var state_31020__$1 = state_31020;
var statearr_31026_31185 = state_31020__$1;
(statearr_31026_31185[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31021 === (7))){
var inst_31016 = (state_31020[(2)]);
var state_31020__$1 = state_31020;
var statearr_31027_31186 = state_31020__$1;
(statearr_31027_31186[(2)] = inst_31016);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__31176,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async))
;
return ((function (__31176,switch__30486__auto__,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_31031 = [null,null,null,null,null,null,null];
(statearr_31031[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__);

(statearr_31031[(1)] = (1));

return statearr_31031;
});
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1 = (function (state_31020){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31020);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31032){if((e31032 instanceof Object)){
var ex__30490__auto__ = e31032;
var statearr_31033_31187 = state_31020;
(statearr_31033_31187[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31188 = state_31020;
state_31020 = G__31188;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = function(state_31020){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1.call(this,state_31020);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__;
})()
;})(__31176,switch__30486__auto__,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async))
})();
var state__30602__auto__ = (function (){var statearr_31034 = f__30601__auto__.call(null);
(statearr_31034[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31180);

return statearr_31034;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(__31176,c__30600__auto___31180,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async))
);


break;
case "async":
var c__30600__auto___31189 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__31176,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (__31176,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function (state_31047){
var state_val_31048 = (state_31047[(1)]);
if((state_val_31048 === (1))){
var state_31047__$1 = state_31047;
var statearr_31049_31190 = state_31047__$1;
(statearr_31049_31190[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31048 === (2))){
var state_31047__$1 = state_31047;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31047__$1,(4),jobs);
} else {
if((state_val_31048 === (3))){
var inst_31045 = (state_31047[(2)]);
var state_31047__$1 = state_31047;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31047__$1,inst_31045);
} else {
if((state_val_31048 === (4))){
var inst_31037 = (state_31047[(2)]);
var inst_31038 = async.call(null,inst_31037);
var state_31047__$1 = state_31047;
if(cljs.core.truth_(inst_31038)){
var statearr_31050_31191 = state_31047__$1;
(statearr_31050_31191[(1)] = (5));

} else {
var statearr_31051_31192 = state_31047__$1;
(statearr_31051_31192[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31048 === (5))){
var state_31047__$1 = state_31047;
var statearr_31052_31193 = state_31047__$1;
(statearr_31052_31193[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31048 === (6))){
var state_31047__$1 = state_31047;
var statearr_31053_31194 = state_31047__$1;
(statearr_31053_31194[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31048 === (7))){
var inst_31043 = (state_31047[(2)]);
var state_31047__$1 = state_31047;
var statearr_31054_31195 = state_31047__$1;
(statearr_31054_31195[(2)] = inst_31043);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__31176,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async))
;
return ((function (__31176,switch__30486__auto__,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_31058 = [null,null,null,null,null,null,null];
(statearr_31058[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__);

(statearr_31058[(1)] = (1));

return statearr_31058;
});
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1 = (function (state_31047){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31047);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31059){if((e31059 instanceof Object)){
var ex__30490__auto__ = e31059;
var statearr_31060_31196 = state_31047;
(statearr_31060_31196[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31197 = state_31047;
state_31047 = G__31197;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = function(state_31047){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1.call(this,state_31047);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__;
})()
;})(__31176,switch__30486__auto__,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,jobs,results,process,async))
})();
var state__30602__auto__ = (function (){var statearr_31061 = f__30601__auto__.call(null);
(statearr_31061[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31189);

return statearr_31061;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(__31176,c__30600__auto___31189,G__31007_31177,G__31007_31178__$1,n__24359__auto___31175,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__31007_31178__$1)].join('')));

}

var G__31198 = (__31176 + (1));
__31176 = G__31198;
continue;
} else {
}
break;
}

var c__30600__auto___31199 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___31199,jobs,results,process,async){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___31199,jobs,results,process,async){
return (function (state_31083){
var state_val_31084 = (state_31083[(1)]);
if((state_val_31084 === (1))){
var state_31083__$1 = state_31083;
var statearr_31085_31200 = state_31083__$1;
(statearr_31085_31200[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31084 === (2))){
var state_31083__$1 = state_31083;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31083__$1,(4),from);
} else {
if((state_val_31084 === (3))){
var inst_31081 = (state_31083[(2)]);
var state_31083__$1 = state_31083;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31083__$1,inst_31081);
} else {
if((state_val_31084 === (4))){
var inst_31064 = (state_31083[(7)]);
var inst_31064__$1 = (state_31083[(2)]);
var inst_31065 = (inst_31064__$1 == null);
var state_31083__$1 = (function (){var statearr_31086 = state_31083;
(statearr_31086[(7)] = inst_31064__$1);

return statearr_31086;
})();
if(cljs.core.truth_(inst_31065)){
var statearr_31087_31201 = state_31083__$1;
(statearr_31087_31201[(1)] = (5));

} else {
var statearr_31088_31202 = state_31083__$1;
(statearr_31088_31202[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31084 === (5))){
var inst_31067 = cljs.core.async.close_BANG_.call(null,jobs);
var state_31083__$1 = state_31083;
var statearr_31089_31203 = state_31083__$1;
(statearr_31089_31203[(2)] = inst_31067);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31084 === (6))){
var inst_31069 = (state_31083[(8)]);
var inst_31064 = (state_31083[(7)]);
var inst_31069__$1 = cljs.core.async.chan.call(null,(1));
var inst_31070 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_31071 = [inst_31064,inst_31069__$1];
var inst_31072 = (new cljs.core.PersistentVector(null,2,(5),inst_31070,inst_31071,null));
var state_31083__$1 = (function (){var statearr_31090 = state_31083;
(statearr_31090[(8)] = inst_31069__$1);

return statearr_31090;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31083__$1,(8),jobs,inst_31072);
} else {
if((state_val_31084 === (7))){
var inst_31079 = (state_31083[(2)]);
var state_31083__$1 = state_31083;
var statearr_31091_31204 = state_31083__$1;
(statearr_31091_31204[(2)] = inst_31079);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31084 === (8))){
var inst_31069 = (state_31083[(8)]);
var inst_31074 = (state_31083[(2)]);
var state_31083__$1 = (function (){var statearr_31092 = state_31083;
(statearr_31092[(9)] = inst_31074);

return statearr_31092;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31083__$1,(9),results,inst_31069);
} else {
if((state_val_31084 === (9))){
var inst_31076 = (state_31083[(2)]);
var state_31083__$1 = (function (){var statearr_31093 = state_31083;
(statearr_31093[(10)] = inst_31076);

return statearr_31093;
})();
var statearr_31094_31205 = state_31083__$1;
(statearr_31094_31205[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___31199,jobs,results,process,async))
;
return ((function (switch__30486__auto__,c__30600__auto___31199,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_31098 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_31098[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__);

(statearr_31098[(1)] = (1));

return statearr_31098;
});
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1 = (function (state_31083){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31083);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31099){if((e31099 instanceof Object)){
var ex__30490__auto__ = e31099;
var statearr_31100_31206 = state_31083;
(statearr_31100_31206[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31207 = state_31083;
state_31083 = G__31207;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = function(state_31083){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1.call(this,state_31083);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___31199,jobs,results,process,async))
})();
var state__30602__auto__ = (function (){var statearr_31101 = f__30601__auto__.call(null);
(statearr_31101[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31199);

return statearr_31101;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___31199,jobs,results,process,async))
);


var c__30600__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto__,jobs,results,process,async){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto__,jobs,results,process,async){
return (function (state_31139){
var state_val_31140 = (state_31139[(1)]);
if((state_val_31140 === (7))){
var inst_31135 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
var statearr_31141_31208 = state_31139__$1;
(statearr_31141_31208[(2)] = inst_31135);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (20))){
var state_31139__$1 = state_31139;
var statearr_31142_31209 = state_31139__$1;
(statearr_31142_31209[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (1))){
var state_31139__$1 = state_31139;
var statearr_31143_31210 = state_31139__$1;
(statearr_31143_31210[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (4))){
var inst_31104 = (state_31139[(7)]);
var inst_31104__$1 = (state_31139[(2)]);
var inst_31105 = (inst_31104__$1 == null);
var state_31139__$1 = (function (){var statearr_31144 = state_31139;
(statearr_31144[(7)] = inst_31104__$1);

return statearr_31144;
})();
if(cljs.core.truth_(inst_31105)){
var statearr_31145_31211 = state_31139__$1;
(statearr_31145_31211[(1)] = (5));

} else {
var statearr_31146_31212 = state_31139__$1;
(statearr_31146_31212[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (15))){
var inst_31117 = (state_31139[(8)]);
var state_31139__$1 = state_31139;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31139__$1,(18),to,inst_31117);
} else {
if((state_val_31140 === (21))){
var inst_31130 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
var statearr_31147_31213 = state_31139__$1;
(statearr_31147_31213[(2)] = inst_31130);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (13))){
var inst_31132 = (state_31139[(2)]);
var state_31139__$1 = (function (){var statearr_31148 = state_31139;
(statearr_31148[(9)] = inst_31132);

return statearr_31148;
})();
var statearr_31149_31214 = state_31139__$1;
(statearr_31149_31214[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (6))){
var inst_31104 = (state_31139[(7)]);
var state_31139__$1 = state_31139;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31139__$1,(11),inst_31104);
} else {
if((state_val_31140 === (17))){
var inst_31125 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
if(cljs.core.truth_(inst_31125)){
var statearr_31150_31215 = state_31139__$1;
(statearr_31150_31215[(1)] = (19));

} else {
var statearr_31151_31216 = state_31139__$1;
(statearr_31151_31216[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (3))){
var inst_31137 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31139__$1,inst_31137);
} else {
if((state_val_31140 === (12))){
var inst_31114 = (state_31139[(10)]);
var state_31139__$1 = state_31139;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31139__$1,(14),inst_31114);
} else {
if((state_val_31140 === (2))){
var state_31139__$1 = state_31139;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31139__$1,(4),results);
} else {
if((state_val_31140 === (19))){
var state_31139__$1 = state_31139;
var statearr_31152_31217 = state_31139__$1;
(statearr_31152_31217[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (11))){
var inst_31114 = (state_31139[(2)]);
var state_31139__$1 = (function (){var statearr_31153 = state_31139;
(statearr_31153[(10)] = inst_31114);

return statearr_31153;
})();
var statearr_31154_31218 = state_31139__$1;
(statearr_31154_31218[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (9))){
var state_31139__$1 = state_31139;
var statearr_31155_31219 = state_31139__$1;
(statearr_31155_31219[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (5))){
var state_31139__$1 = state_31139;
if(cljs.core.truth_(close_QMARK_)){
var statearr_31156_31220 = state_31139__$1;
(statearr_31156_31220[(1)] = (8));

} else {
var statearr_31157_31221 = state_31139__$1;
(statearr_31157_31221[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (14))){
var inst_31119 = (state_31139[(11)]);
var inst_31117 = (state_31139[(8)]);
var inst_31117__$1 = (state_31139[(2)]);
var inst_31118 = (inst_31117__$1 == null);
var inst_31119__$1 = cljs.core.not.call(null,inst_31118);
var state_31139__$1 = (function (){var statearr_31158 = state_31139;
(statearr_31158[(11)] = inst_31119__$1);

(statearr_31158[(8)] = inst_31117__$1);

return statearr_31158;
})();
if(inst_31119__$1){
var statearr_31159_31222 = state_31139__$1;
(statearr_31159_31222[(1)] = (15));

} else {
var statearr_31160_31223 = state_31139__$1;
(statearr_31160_31223[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (16))){
var inst_31119 = (state_31139[(11)]);
var state_31139__$1 = state_31139;
var statearr_31161_31224 = state_31139__$1;
(statearr_31161_31224[(2)] = inst_31119);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (10))){
var inst_31111 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
var statearr_31162_31225 = state_31139__$1;
(statearr_31162_31225[(2)] = inst_31111);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (18))){
var inst_31122 = (state_31139[(2)]);
var state_31139__$1 = state_31139;
var statearr_31163_31226 = state_31139__$1;
(statearr_31163_31226[(2)] = inst_31122);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31140 === (8))){
var inst_31108 = cljs.core.async.close_BANG_.call(null,to);
var state_31139__$1 = state_31139;
var statearr_31164_31227 = state_31139__$1;
(statearr_31164_31227[(2)] = inst_31108);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto__,jobs,results,process,async))
;
return ((function (switch__30486__auto__,c__30600__auto__,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_31168 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_31168[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__);

(statearr_31168[(1)] = (1));

return statearr_31168;
});
var cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1 = (function (state_31139){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31139);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31169){if((e31169 instanceof Object)){
var ex__30490__auto__ = e31169;
var statearr_31170_31228 = state_31139;
(statearr_31170_31228[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31229 = state_31139;
state_31139 = G__31229;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__ = function(state_31139){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1.call(this,state_31139);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto__,jobs,results,process,async))
})();
var state__30602__auto__ = (function (){var statearr_31171 = f__30601__auto__.call(null);
(statearr_31171[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto__);

return statearr_31171;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto__,jobs,results,process,async))
);

return c__30600__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 args31230 = [];
var len__24559__auto___31233 = arguments.length;
var i__24560__auto___31234 = (0);
while(true){
if((i__24560__auto___31234 < len__24559__auto___31233)){
args31230.push((arguments[i__24560__auto___31234]));

var G__31235 = (i__24560__auto___31234 + (1));
i__24560__auto___31234 = G__31235;
continue;
} else {
}
break;
}

var G__31232 = args31230.length;
switch (G__31232) {
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(args31230.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 args31237 = [];
var len__24559__auto___31240 = arguments.length;
var i__24560__auto___31241 = (0);
while(true){
if((i__24560__auto___31241 < len__24559__auto___31240)){
args31237.push((arguments[i__24560__auto___31241]));

var G__31242 = (i__24560__auto___31241 + (1));
i__24560__auto___31241 = G__31242;
continue;
} else {
}
break;
}

var G__31239 = args31237.length;
switch (G__31239) {
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(args31237.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 args31244 = [];
var len__24559__auto___31297 = arguments.length;
var i__24560__auto___31298 = (0);
while(true){
if((i__24560__auto___31298 < len__24559__auto___31297)){
args31244.push((arguments[i__24560__auto___31298]));

var G__31299 = (i__24560__auto___31298 + (1));
i__24560__auto___31298 = G__31299;
continue;
} else {
}
break;
}

var G__31246 = args31244.length;
switch (G__31246) {
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(args31244.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__30600__auto___31301 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___31301,tc,fc){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___31301,tc,fc){
return (function (state_31272){
var state_val_31273 = (state_31272[(1)]);
if((state_val_31273 === (7))){
var inst_31268 = (state_31272[(2)]);
var state_31272__$1 = state_31272;
var statearr_31274_31302 = state_31272__$1;
(statearr_31274_31302[(2)] = inst_31268);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (1))){
var state_31272__$1 = state_31272;
var statearr_31275_31303 = state_31272__$1;
(statearr_31275_31303[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (4))){
var inst_31249 = (state_31272[(7)]);
var inst_31249__$1 = (state_31272[(2)]);
var inst_31250 = (inst_31249__$1 == null);
var state_31272__$1 = (function (){var statearr_31276 = state_31272;
(statearr_31276[(7)] = inst_31249__$1);

return statearr_31276;
})();
if(cljs.core.truth_(inst_31250)){
var statearr_31277_31304 = state_31272__$1;
(statearr_31277_31304[(1)] = (5));

} else {
var statearr_31278_31305 = state_31272__$1;
(statearr_31278_31305[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (13))){
var state_31272__$1 = state_31272;
var statearr_31279_31306 = state_31272__$1;
(statearr_31279_31306[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (6))){
var inst_31249 = (state_31272[(7)]);
var inst_31255 = p.call(null,inst_31249);
var state_31272__$1 = state_31272;
if(cljs.core.truth_(inst_31255)){
var statearr_31280_31307 = state_31272__$1;
(statearr_31280_31307[(1)] = (9));

} else {
var statearr_31281_31308 = state_31272__$1;
(statearr_31281_31308[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (3))){
var inst_31270 = (state_31272[(2)]);
var state_31272__$1 = state_31272;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31272__$1,inst_31270);
} else {
if((state_val_31273 === (12))){
var state_31272__$1 = state_31272;
var statearr_31282_31309 = state_31272__$1;
(statearr_31282_31309[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (2))){
var state_31272__$1 = state_31272;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31272__$1,(4),ch);
} else {
if((state_val_31273 === (11))){
var inst_31249 = (state_31272[(7)]);
var inst_31259 = (state_31272[(2)]);
var state_31272__$1 = state_31272;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31272__$1,(8),inst_31259,inst_31249);
} else {
if((state_val_31273 === (9))){
var state_31272__$1 = state_31272;
var statearr_31283_31310 = state_31272__$1;
(statearr_31283_31310[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (5))){
var inst_31252 = cljs.core.async.close_BANG_.call(null,tc);
var inst_31253 = cljs.core.async.close_BANG_.call(null,fc);
var state_31272__$1 = (function (){var statearr_31284 = state_31272;
(statearr_31284[(8)] = inst_31252);

return statearr_31284;
})();
var statearr_31285_31311 = state_31272__$1;
(statearr_31285_31311[(2)] = inst_31253);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (14))){
var inst_31266 = (state_31272[(2)]);
var state_31272__$1 = state_31272;
var statearr_31286_31312 = state_31272__$1;
(statearr_31286_31312[(2)] = inst_31266);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (10))){
var state_31272__$1 = state_31272;
var statearr_31287_31313 = state_31272__$1;
(statearr_31287_31313[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31273 === (8))){
var inst_31261 = (state_31272[(2)]);
var state_31272__$1 = state_31272;
if(cljs.core.truth_(inst_31261)){
var statearr_31288_31314 = state_31272__$1;
(statearr_31288_31314[(1)] = (12));

} else {
var statearr_31289_31315 = state_31272__$1;
(statearr_31289_31315[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___31301,tc,fc))
;
return ((function (switch__30486__auto__,c__30600__auto___31301,tc,fc){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_31293 = [null,null,null,null,null,null,null,null,null];
(statearr_31293[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_31293[(1)] = (1));

return statearr_31293;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_31272){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31272);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31294){if((e31294 instanceof Object)){
var ex__30490__auto__ = e31294;
var statearr_31295_31316 = state_31272;
(statearr_31295_31316[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31317 = state_31272;
state_31272 = G__31317;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_31272){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_31272);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___31301,tc,fc))
})();
var state__30602__auto__ = (function (){var statearr_31296 = f__30601__auto__.call(null);
(statearr_31296[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31301);

return statearr_31296;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___31301,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__30600__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto__){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto__){
return (function (state_31381){
var state_val_31382 = (state_31381[(1)]);
if((state_val_31382 === (7))){
var inst_31377 = (state_31381[(2)]);
var state_31381__$1 = state_31381;
var statearr_31383_31404 = state_31381__$1;
(statearr_31383_31404[(2)] = inst_31377);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (1))){
var inst_31361 = init;
var state_31381__$1 = (function (){var statearr_31384 = state_31381;
(statearr_31384[(7)] = inst_31361);

return statearr_31384;
})();
var statearr_31385_31405 = state_31381__$1;
(statearr_31385_31405[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (4))){
var inst_31364 = (state_31381[(8)]);
var inst_31364__$1 = (state_31381[(2)]);
var inst_31365 = (inst_31364__$1 == null);
var state_31381__$1 = (function (){var statearr_31386 = state_31381;
(statearr_31386[(8)] = inst_31364__$1);

return statearr_31386;
})();
if(cljs.core.truth_(inst_31365)){
var statearr_31387_31406 = state_31381__$1;
(statearr_31387_31406[(1)] = (5));

} else {
var statearr_31388_31407 = state_31381__$1;
(statearr_31388_31407[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (6))){
var inst_31364 = (state_31381[(8)]);
var inst_31361 = (state_31381[(7)]);
var inst_31368 = (state_31381[(9)]);
var inst_31368__$1 = f.call(null,inst_31361,inst_31364);
var inst_31369 = cljs.core.reduced_QMARK_.call(null,inst_31368__$1);
var state_31381__$1 = (function (){var statearr_31389 = state_31381;
(statearr_31389[(9)] = inst_31368__$1);

return statearr_31389;
})();
if(inst_31369){
var statearr_31390_31408 = state_31381__$1;
(statearr_31390_31408[(1)] = (8));

} else {
var statearr_31391_31409 = state_31381__$1;
(statearr_31391_31409[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (3))){
var inst_31379 = (state_31381[(2)]);
var state_31381__$1 = state_31381;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31381__$1,inst_31379);
} else {
if((state_val_31382 === (2))){
var state_31381__$1 = state_31381;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31381__$1,(4),ch);
} else {
if((state_val_31382 === (9))){
var inst_31368 = (state_31381[(9)]);
var inst_31361 = inst_31368;
var state_31381__$1 = (function (){var statearr_31392 = state_31381;
(statearr_31392[(7)] = inst_31361);

return statearr_31392;
})();
var statearr_31393_31410 = state_31381__$1;
(statearr_31393_31410[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (5))){
var inst_31361 = (state_31381[(7)]);
var state_31381__$1 = state_31381;
var statearr_31394_31411 = state_31381__$1;
(statearr_31394_31411[(2)] = inst_31361);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (10))){
var inst_31375 = (state_31381[(2)]);
var state_31381__$1 = state_31381;
var statearr_31395_31412 = state_31381__$1;
(statearr_31395_31412[(2)] = inst_31375);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31382 === (8))){
var inst_31368 = (state_31381[(9)]);
var inst_31371 = cljs.core.deref.call(null,inst_31368);
var state_31381__$1 = state_31381;
var statearr_31396_31413 = state_31381__$1;
(statearr_31396_31413[(2)] = inst_31371);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto__))
;
return ((function (switch__30486__auto__,c__30600__auto__){
return (function() {
var cljs$core$async$reduce_$_state_machine__30487__auto__ = null;
var cljs$core$async$reduce_$_state_machine__30487__auto____0 = (function (){
var statearr_31400 = [null,null,null,null,null,null,null,null,null,null];
(statearr_31400[(0)] = cljs$core$async$reduce_$_state_machine__30487__auto__);

(statearr_31400[(1)] = (1));

return statearr_31400;
});
var cljs$core$async$reduce_$_state_machine__30487__auto____1 = (function (state_31381){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31381);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31401){if((e31401 instanceof Object)){
var ex__30490__auto__ = e31401;
var statearr_31402_31414 = state_31381;
(statearr_31402_31414[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31415 = state_31381;
state_31381 = G__31415;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__30487__auto__ = function(state_31381){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__30487__auto____1.call(this,state_31381);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$reduce_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__30487__auto____0;
cljs$core$async$reduce_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__30487__auto____1;
return cljs$core$async$reduce_$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto__))
})();
var state__30602__auto__ = (function (){var statearr_31403 = f__30601__auto__.call(null);
(statearr_31403[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto__);

return statearr_31403;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto__))
);

return c__30600__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__30600__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto__,f__$1){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto__,f__$1){
return (function (state_31435){
var state_val_31436 = (state_31435[(1)]);
if((state_val_31436 === (1))){
var inst_31430 = cljs.core.async.reduce.call(null,f__$1,init,ch);
var state_31435__$1 = state_31435;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31435__$1,(2),inst_31430);
} else {
if((state_val_31436 === (2))){
var inst_31432 = (state_31435[(2)]);
var inst_31433 = f__$1.call(null,inst_31432);
var state_31435__$1 = state_31435;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31435__$1,inst_31433);
} else {
return null;
}
}
});})(c__30600__auto__,f__$1))
;
return ((function (switch__30486__auto__,c__30600__auto__,f__$1){
return (function() {
var cljs$core$async$transduce_$_state_machine__30487__auto__ = null;
var cljs$core$async$transduce_$_state_machine__30487__auto____0 = (function (){
var statearr_31440 = [null,null,null,null,null,null,null];
(statearr_31440[(0)] = cljs$core$async$transduce_$_state_machine__30487__auto__);

(statearr_31440[(1)] = (1));

return statearr_31440;
});
var cljs$core$async$transduce_$_state_machine__30487__auto____1 = (function (state_31435){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31435);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31441){if((e31441 instanceof Object)){
var ex__30490__auto__ = e31441;
var statearr_31442_31444 = state_31435;
(statearr_31442_31444[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31445 = state_31435;
state_31435 = G__31445;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__30487__auto__ = function(state_31435){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__30487__auto____1.call(this,state_31435);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$transduce_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__30487__auto____0;
cljs$core$async$transduce_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__30487__auto____1;
return cljs$core$async$transduce_$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto__,f__$1))
})();
var state__30602__auto__ = (function (){var statearr_31443 = f__30601__auto__.call(null);
(statearr_31443[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto__);

return statearr_31443;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto__,f__$1))
);

return c__30600__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 args31446 = [];
var len__24559__auto___31498 = arguments.length;
var i__24560__auto___31499 = (0);
while(true){
if((i__24560__auto___31499 < len__24559__auto___31498)){
args31446.push((arguments[i__24560__auto___31499]));

var G__31500 = (i__24560__auto___31499 + (1));
i__24560__auto___31499 = G__31500;
continue;
} else {
}
break;
}

var G__31448 = args31446.length;
switch (G__31448) {
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(args31446.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__30600__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto__){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto__){
return (function (state_31473){
var state_val_31474 = (state_31473[(1)]);
if((state_val_31474 === (7))){
var inst_31455 = (state_31473[(2)]);
var state_31473__$1 = state_31473;
var statearr_31475_31502 = state_31473__$1;
(statearr_31475_31502[(2)] = inst_31455);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (1))){
var inst_31449 = cljs.core.seq.call(null,coll);
var inst_31450 = inst_31449;
var state_31473__$1 = (function (){var statearr_31476 = state_31473;
(statearr_31476[(7)] = inst_31450);

return statearr_31476;
})();
var statearr_31477_31503 = state_31473__$1;
(statearr_31477_31503[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (4))){
var inst_31450 = (state_31473[(7)]);
var inst_31453 = cljs.core.first.call(null,inst_31450);
var state_31473__$1 = state_31473;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31473__$1,(7),ch,inst_31453);
} else {
if((state_val_31474 === (13))){
var inst_31467 = (state_31473[(2)]);
var state_31473__$1 = state_31473;
var statearr_31478_31504 = state_31473__$1;
(statearr_31478_31504[(2)] = inst_31467);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (6))){
var inst_31458 = (state_31473[(2)]);
var state_31473__$1 = state_31473;
if(cljs.core.truth_(inst_31458)){
var statearr_31479_31505 = state_31473__$1;
(statearr_31479_31505[(1)] = (8));

} else {
var statearr_31480_31506 = state_31473__$1;
(statearr_31480_31506[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (3))){
var inst_31471 = (state_31473[(2)]);
var state_31473__$1 = state_31473;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31473__$1,inst_31471);
} else {
if((state_val_31474 === (12))){
var state_31473__$1 = state_31473;
var statearr_31481_31507 = state_31473__$1;
(statearr_31481_31507[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (2))){
var inst_31450 = (state_31473[(7)]);
var state_31473__$1 = state_31473;
if(cljs.core.truth_(inst_31450)){
var statearr_31482_31508 = state_31473__$1;
(statearr_31482_31508[(1)] = (4));

} else {
var statearr_31483_31509 = state_31473__$1;
(statearr_31483_31509[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (11))){
var inst_31464 = cljs.core.async.close_BANG_.call(null,ch);
var state_31473__$1 = state_31473;
var statearr_31484_31510 = state_31473__$1;
(statearr_31484_31510[(2)] = inst_31464);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (9))){
var state_31473__$1 = state_31473;
if(cljs.core.truth_(close_QMARK_)){
var statearr_31485_31511 = state_31473__$1;
(statearr_31485_31511[(1)] = (11));

} else {
var statearr_31486_31512 = state_31473__$1;
(statearr_31486_31512[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (5))){
var inst_31450 = (state_31473[(7)]);
var state_31473__$1 = state_31473;
var statearr_31487_31513 = state_31473__$1;
(statearr_31487_31513[(2)] = inst_31450);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (10))){
var inst_31469 = (state_31473[(2)]);
var state_31473__$1 = state_31473;
var statearr_31488_31514 = state_31473__$1;
(statearr_31488_31514[(2)] = inst_31469);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31474 === (8))){
var inst_31450 = (state_31473[(7)]);
var inst_31460 = cljs.core.next.call(null,inst_31450);
var inst_31450__$1 = inst_31460;
var state_31473__$1 = (function (){var statearr_31489 = state_31473;
(statearr_31489[(7)] = inst_31450__$1);

return statearr_31489;
})();
var statearr_31490_31515 = state_31473__$1;
(statearr_31490_31515[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto__))
;
return ((function (switch__30486__auto__,c__30600__auto__){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_31494 = [null,null,null,null,null,null,null,null];
(statearr_31494[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_31494[(1)] = (1));

return statearr_31494;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_31473){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31473);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31495){if((e31495 instanceof Object)){
var ex__30490__auto__ = e31495;
var statearr_31496_31516 = state_31473;
(statearr_31496_31516[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31517 = state_31473;
state_31473 = G__31517;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_31473){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_31473);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto__))
})();
var state__30602__auto__ = (function (){var statearr_31497 = f__30601__auto__.call(null);
(statearr_31497[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto__);

return statearr_31497;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto__))
);

return c__30600__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__24056__auto__ = (((_ == null))?null:_);
var m__24057__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,_);
} else {
var m__24057__auto____$1 = (cljs.core.async.muxch_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch,close_QMARK_);
} else {
var m__24057__auto____$1 = (cljs.core.async.tap_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.untap_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m);
} else {
var m__24057__auto____$1 = (cljs.core.async.untap_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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$async31743 !== '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$async31743 = (function (ch,cs,meta31744){
this.ch = ch;
this.cs = cs;
this.meta31744 = meta31744;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async31743.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs){
return (function (_31745,meta31744__$1){
var self__ = this;
var _31745__$1 = this;
return (new cljs.core.async.t_cljs$core$async31743(self__.ch,self__.cs,meta31744__$1));
});})(cs))
;

cljs.core.async.t_cljs$core$async31743.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){
return (function (_31745){
var self__ = this;
var _31745__$1 = this;
return self__.meta31744;
});})(cs))
;

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

cljs.core.async.t_cljs$core$async31743.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$async31743.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async31743.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$async31743.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$async31743.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$async31743.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,"meta31744","meta31744",-383511337,null)], null);
});})(cs))
;

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

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

cljs.core.async.t_cljs$core$async31743.cljs$lang$ctorPrWriter = ((function (cs){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async31743");
});})(cs))
;

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

}

return (new cljs.core.async.t_cljs$core$async31743(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__30600__auto___31968 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___31968,cs,m,dchan,dctr,done){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___31968,cs,m,dchan,dctr,done){
return (function (state_31880){
var state_val_31881 = (state_31880[(1)]);
if((state_val_31881 === (7))){
var inst_31876 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31882_31969 = state_31880__$1;
(statearr_31882_31969[(2)] = inst_31876);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (20))){
var inst_31779 = (state_31880[(7)]);
var inst_31791 = cljs.core.first.call(null,inst_31779);
var inst_31792 = cljs.core.nth.call(null,inst_31791,(0),null);
var inst_31793 = cljs.core.nth.call(null,inst_31791,(1),null);
var state_31880__$1 = (function (){var statearr_31883 = state_31880;
(statearr_31883[(8)] = inst_31792);

return statearr_31883;
})();
if(cljs.core.truth_(inst_31793)){
var statearr_31884_31970 = state_31880__$1;
(statearr_31884_31970[(1)] = (22));

} else {
var statearr_31885_31971 = state_31880__$1;
(statearr_31885_31971[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (27))){
var inst_31828 = (state_31880[(9)]);
var inst_31823 = (state_31880[(10)]);
var inst_31748 = (state_31880[(11)]);
var inst_31821 = (state_31880[(12)]);
var inst_31828__$1 = cljs.core._nth.call(null,inst_31821,inst_31823);
var inst_31829 = cljs.core.async.put_BANG_.call(null,inst_31828__$1,inst_31748,done);
var state_31880__$1 = (function (){var statearr_31886 = state_31880;
(statearr_31886[(9)] = inst_31828__$1);

return statearr_31886;
})();
if(cljs.core.truth_(inst_31829)){
var statearr_31887_31972 = state_31880__$1;
(statearr_31887_31972[(1)] = (30));

} else {
var statearr_31888_31973 = state_31880__$1;
(statearr_31888_31973[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (1))){
var state_31880__$1 = state_31880;
var statearr_31889_31974 = state_31880__$1;
(statearr_31889_31974[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (24))){
var inst_31779 = (state_31880[(7)]);
var inst_31798 = (state_31880[(2)]);
var inst_31799 = cljs.core.next.call(null,inst_31779);
var inst_31757 = inst_31799;
var inst_31758 = null;
var inst_31759 = (0);
var inst_31760 = (0);
var state_31880__$1 = (function (){var statearr_31890 = state_31880;
(statearr_31890[(13)] = inst_31760);

(statearr_31890[(14)] = inst_31758);

(statearr_31890[(15)] = inst_31759);

(statearr_31890[(16)] = inst_31798);

(statearr_31890[(17)] = inst_31757);

return statearr_31890;
})();
var statearr_31891_31975 = state_31880__$1;
(statearr_31891_31975[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (39))){
var state_31880__$1 = state_31880;
var statearr_31895_31976 = state_31880__$1;
(statearr_31895_31976[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (4))){
var inst_31748 = (state_31880[(11)]);
var inst_31748__$1 = (state_31880[(2)]);
var inst_31749 = (inst_31748__$1 == null);
var state_31880__$1 = (function (){var statearr_31896 = state_31880;
(statearr_31896[(11)] = inst_31748__$1);

return statearr_31896;
})();
if(cljs.core.truth_(inst_31749)){
var statearr_31897_31977 = state_31880__$1;
(statearr_31897_31977[(1)] = (5));

} else {
var statearr_31898_31978 = state_31880__$1;
(statearr_31898_31978[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (15))){
var inst_31760 = (state_31880[(13)]);
var inst_31758 = (state_31880[(14)]);
var inst_31759 = (state_31880[(15)]);
var inst_31757 = (state_31880[(17)]);
var inst_31775 = (state_31880[(2)]);
var inst_31776 = (inst_31760 + (1));
var tmp31892 = inst_31758;
var tmp31893 = inst_31759;
var tmp31894 = inst_31757;
var inst_31757__$1 = tmp31894;
var inst_31758__$1 = tmp31892;
var inst_31759__$1 = tmp31893;
var inst_31760__$1 = inst_31776;
var state_31880__$1 = (function (){var statearr_31899 = state_31880;
(statearr_31899[(13)] = inst_31760__$1);

(statearr_31899[(14)] = inst_31758__$1);

(statearr_31899[(15)] = inst_31759__$1);

(statearr_31899[(18)] = inst_31775);

(statearr_31899[(17)] = inst_31757__$1);

return statearr_31899;
})();
var statearr_31900_31979 = state_31880__$1;
(statearr_31900_31979[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (21))){
var inst_31802 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31904_31980 = state_31880__$1;
(statearr_31904_31980[(2)] = inst_31802);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (31))){
var inst_31828 = (state_31880[(9)]);
var inst_31832 = done.call(null,null);
var inst_31833 = cljs.core.async.untap_STAR_.call(null,m,inst_31828);
var state_31880__$1 = (function (){var statearr_31905 = state_31880;
(statearr_31905[(19)] = inst_31832);

return statearr_31905;
})();
var statearr_31906_31981 = state_31880__$1;
(statearr_31906_31981[(2)] = inst_31833);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (32))){
var inst_31823 = (state_31880[(10)]);
var inst_31822 = (state_31880[(20)]);
var inst_31820 = (state_31880[(21)]);
var inst_31821 = (state_31880[(12)]);
var inst_31835 = (state_31880[(2)]);
var inst_31836 = (inst_31823 + (1));
var tmp31901 = inst_31822;
var tmp31902 = inst_31820;
var tmp31903 = inst_31821;
var inst_31820__$1 = tmp31902;
var inst_31821__$1 = tmp31903;
var inst_31822__$1 = tmp31901;
var inst_31823__$1 = inst_31836;
var state_31880__$1 = (function (){var statearr_31907 = state_31880;
(statearr_31907[(10)] = inst_31823__$1);

(statearr_31907[(20)] = inst_31822__$1);

(statearr_31907[(21)] = inst_31820__$1);

(statearr_31907[(12)] = inst_31821__$1);

(statearr_31907[(22)] = inst_31835);

return statearr_31907;
})();
var statearr_31908_31982 = state_31880__$1;
(statearr_31908_31982[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (40))){
var inst_31848 = (state_31880[(23)]);
var inst_31852 = done.call(null,null);
var inst_31853 = cljs.core.async.untap_STAR_.call(null,m,inst_31848);
var state_31880__$1 = (function (){var statearr_31909 = state_31880;
(statearr_31909[(24)] = inst_31852);

return statearr_31909;
})();
var statearr_31910_31983 = state_31880__$1;
(statearr_31910_31983[(2)] = inst_31853);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (33))){
var inst_31839 = (state_31880[(25)]);
var inst_31841 = cljs.core.chunked_seq_QMARK_.call(null,inst_31839);
var state_31880__$1 = state_31880;
if(inst_31841){
var statearr_31911_31984 = state_31880__$1;
(statearr_31911_31984[(1)] = (36));

} else {
var statearr_31912_31985 = state_31880__$1;
(statearr_31912_31985[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (13))){
var inst_31769 = (state_31880[(26)]);
var inst_31772 = cljs.core.async.close_BANG_.call(null,inst_31769);
var state_31880__$1 = state_31880;
var statearr_31913_31986 = state_31880__$1;
(statearr_31913_31986[(2)] = inst_31772);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (22))){
var inst_31792 = (state_31880[(8)]);
var inst_31795 = cljs.core.async.close_BANG_.call(null,inst_31792);
var state_31880__$1 = state_31880;
var statearr_31914_31987 = state_31880__$1;
(statearr_31914_31987[(2)] = inst_31795);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (36))){
var inst_31839 = (state_31880[(25)]);
var inst_31843 = cljs.core.chunk_first.call(null,inst_31839);
var inst_31844 = cljs.core.chunk_rest.call(null,inst_31839);
var inst_31845 = cljs.core.count.call(null,inst_31843);
var inst_31820 = inst_31844;
var inst_31821 = inst_31843;
var inst_31822 = inst_31845;
var inst_31823 = (0);
var state_31880__$1 = (function (){var statearr_31915 = state_31880;
(statearr_31915[(10)] = inst_31823);

(statearr_31915[(20)] = inst_31822);

(statearr_31915[(21)] = inst_31820);

(statearr_31915[(12)] = inst_31821);

return statearr_31915;
})();
var statearr_31916_31988 = state_31880__$1;
(statearr_31916_31988[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (41))){
var inst_31839 = (state_31880[(25)]);
var inst_31855 = (state_31880[(2)]);
var inst_31856 = cljs.core.next.call(null,inst_31839);
var inst_31820 = inst_31856;
var inst_31821 = null;
var inst_31822 = (0);
var inst_31823 = (0);
var state_31880__$1 = (function (){var statearr_31917 = state_31880;
(statearr_31917[(10)] = inst_31823);

(statearr_31917[(20)] = inst_31822);

(statearr_31917[(27)] = inst_31855);

(statearr_31917[(21)] = inst_31820);

(statearr_31917[(12)] = inst_31821);

return statearr_31917;
})();
var statearr_31918_31989 = state_31880__$1;
(statearr_31918_31989[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (43))){
var state_31880__$1 = state_31880;
var statearr_31919_31990 = state_31880__$1;
(statearr_31919_31990[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (29))){
var inst_31864 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31920_31991 = state_31880__$1;
(statearr_31920_31991[(2)] = inst_31864);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (44))){
var inst_31873 = (state_31880[(2)]);
var state_31880__$1 = (function (){var statearr_31921 = state_31880;
(statearr_31921[(28)] = inst_31873);

return statearr_31921;
})();
var statearr_31922_31992 = state_31880__$1;
(statearr_31922_31992[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (6))){
var inst_31812 = (state_31880[(29)]);
var inst_31811 = cljs.core.deref.call(null,cs);
var inst_31812__$1 = cljs.core.keys.call(null,inst_31811);
var inst_31813 = cljs.core.count.call(null,inst_31812__$1);
var inst_31814 = cljs.core.reset_BANG_.call(null,dctr,inst_31813);
var inst_31819 = cljs.core.seq.call(null,inst_31812__$1);
var inst_31820 = inst_31819;
var inst_31821 = null;
var inst_31822 = (0);
var inst_31823 = (0);
var state_31880__$1 = (function (){var statearr_31923 = state_31880;
(statearr_31923[(10)] = inst_31823);

(statearr_31923[(20)] = inst_31822);

(statearr_31923[(30)] = inst_31814);

(statearr_31923[(21)] = inst_31820);

(statearr_31923[(29)] = inst_31812__$1);

(statearr_31923[(12)] = inst_31821);

return statearr_31923;
})();
var statearr_31924_31993 = state_31880__$1;
(statearr_31924_31993[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (28))){
var inst_31820 = (state_31880[(21)]);
var inst_31839 = (state_31880[(25)]);
var inst_31839__$1 = cljs.core.seq.call(null,inst_31820);
var state_31880__$1 = (function (){var statearr_31925 = state_31880;
(statearr_31925[(25)] = inst_31839__$1);

return statearr_31925;
})();
if(inst_31839__$1){
var statearr_31926_31994 = state_31880__$1;
(statearr_31926_31994[(1)] = (33));

} else {
var statearr_31927_31995 = state_31880__$1;
(statearr_31927_31995[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (25))){
var inst_31823 = (state_31880[(10)]);
var inst_31822 = (state_31880[(20)]);
var inst_31825 = (inst_31823 < inst_31822);
var inst_31826 = inst_31825;
var state_31880__$1 = state_31880;
if(cljs.core.truth_(inst_31826)){
var statearr_31928_31996 = state_31880__$1;
(statearr_31928_31996[(1)] = (27));

} else {
var statearr_31929_31997 = state_31880__$1;
(statearr_31929_31997[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (34))){
var state_31880__$1 = state_31880;
var statearr_31930_31998 = state_31880__$1;
(statearr_31930_31998[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (17))){
var state_31880__$1 = state_31880;
var statearr_31931_31999 = state_31880__$1;
(statearr_31931_31999[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (3))){
var inst_31878 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31880__$1,inst_31878);
} else {
if((state_val_31881 === (12))){
var inst_31807 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31932_32000 = state_31880__$1;
(statearr_31932_32000[(2)] = inst_31807);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (35))){
var inst_31862 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31934_32002 = state_31880__$1;
(statearr_31934_32002[(2)] = inst_31862);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (19))){
var inst_31779 = (state_31880[(7)]);
var inst_31783 = cljs.core.chunk_first.call(null,inst_31779);
var inst_31784 = cljs.core.chunk_rest.call(null,inst_31779);
var inst_31785 = cljs.core.count.call(null,inst_31783);
var inst_31757 = inst_31784;
var inst_31758 = inst_31783;
var inst_31759 = inst_31785;
var inst_31760 = (0);
var state_31880__$1 = (function (){var statearr_31935 = state_31880;
(statearr_31935[(13)] = inst_31760);

(statearr_31935[(14)] = inst_31758);

(statearr_31935[(15)] = inst_31759);

(statearr_31935[(17)] = inst_31757);

return statearr_31935;
})();
var statearr_31936_32003 = state_31880__$1;
(statearr_31936_32003[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (11))){
var inst_31779 = (state_31880[(7)]);
var inst_31757 = (state_31880[(17)]);
var inst_31779__$1 = cljs.core.seq.call(null,inst_31757);
var state_31880__$1 = (function (){var statearr_31937 = state_31880;
(statearr_31937[(7)] = inst_31779__$1);

return statearr_31937;
})();
if(inst_31779__$1){
var statearr_31938_32004 = state_31880__$1;
(statearr_31938_32004[(1)] = (16));

} else {
var statearr_31939_32005 = state_31880__$1;
(statearr_31939_32005[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (9))){
var inst_31809 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31940_32006 = state_31880__$1;
(statearr_31940_32006[(2)] = inst_31809);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (5))){
var inst_31755 = cljs.core.deref.call(null,cs);
var inst_31756 = cljs.core.seq.call(null,inst_31755);
var inst_31757 = inst_31756;
var inst_31758 = null;
var inst_31759 = (0);
var inst_31760 = (0);
var state_31880__$1 = (function (){var statearr_31941 = state_31880;
(statearr_31941[(13)] = inst_31760);

(statearr_31941[(14)] = inst_31758);

(statearr_31941[(15)] = inst_31759);

(statearr_31941[(17)] = inst_31757);

return statearr_31941;
})();
var statearr_31942_32007 = state_31880__$1;
(statearr_31942_32007[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (14))){
var state_31880__$1 = state_31880;
var statearr_31943_32008 = state_31880__$1;
(statearr_31943_32008[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (45))){
var inst_31870 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31944_32009 = state_31880__$1;
(statearr_31944_32009[(2)] = inst_31870);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (26))){
var inst_31812 = (state_31880[(29)]);
var inst_31866 = (state_31880[(2)]);
var inst_31867 = cljs.core.seq.call(null,inst_31812);
var state_31880__$1 = (function (){var statearr_31945 = state_31880;
(statearr_31945[(31)] = inst_31866);

return statearr_31945;
})();
if(inst_31867){
var statearr_31946_32010 = state_31880__$1;
(statearr_31946_32010[(1)] = (42));

} else {
var statearr_31947_32011 = state_31880__$1;
(statearr_31947_32011[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (16))){
var inst_31779 = (state_31880[(7)]);
var inst_31781 = cljs.core.chunked_seq_QMARK_.call(null,inst_31779);
var state_31880__$1 = state_31880;
if(inst_31781){
var statearr_31948_32012 = state_31880__$1;
(statearr_31948_32012[(1)] = (19));

} else {
var statearr_31949_32013 = state_31880__$1;
(statearr_31949_32013[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (38))){
var inst_31859 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31950_32014 = state_31880__$1;
(statearr_31950_32014[(2)] = inst_31859);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (30))){
var state_31880__$1 = state_31880;
var statearr_31951_32015 = state_31880__$1;
(statearr_31951_32015[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (10))){
var inst_31760 = (state_31880[(13)]);
var inst_31758 = (state_31880[(14)]);
var inst_31768 = cljs.core._nth.call(null,inst_31758,inst_31760);
var inst_31769 = cljs.core.nth.call(null,inst_31768,(0),null);
var inst_31770 = cljs.core.nth.call(null,inst_31768,(1),null);
var state_31880__$1 = (function (){var statearr_31952 = state_31880;
(statearr_31952[(26)] = inst_31769);

return statearr_31952;
})();
if(cljs.core.truth_(inst_31770)){
var statearr_31953_32016 = state_31880__$1;
(statearr_31953_32016[(1)] = (13));

} else {
var statearr_31954_32017 = state_31880__$1;
(statearr_31954_32017[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (18))){
var inst_31805 = (state_31880[(2)]);
var state_31880__$1 = state_31880;
var statearr_31955_32018 = state_31880__$1;
(statearr_31955_32018[(2)] = inst_31805);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (42))){
var state_31880__$1 = state_31880;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31880__$1,(45),dchan);
} else {
if((state_val_31881 === (37))){
var inst_31839 = (state_31880[(25)]);
var inst_31748 = (state_31880[(11)]);
var inst_31848 = (state_31880[(23)]);
var inst_31848__$1 = cljs.core.first.call(null,inst_31839);
var inst_31849 = cljs.core.async.put_BANG_.call(null,inst_31848__$1,inst_31748,done);
var state_31880__$1 = (function (){var statearr_31956 = state_31880;
(statearr_31956[(23)] = inst_31848__$1);

return statearr_31956;
})();
if(cljs.core.truth_(inst_31849)){
var statearr_31957_32019 = state_31880__$1;
(statearr_31957_32019[(1)] = (39));

} else {
var statearr_31958_32020 = state_31880__$1;
(statearr_31958_32020[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31881 === (8))){
var inst_31760 = (state_31880[(13)]);
var inst_31759 = (state_31880[(15)]);
var inst_31762 = (inst_31760 < inst_31759);
var inst_31763 = inst_31762;
var state_31880__$1 = state_31880;
if(cljs.core.truth_(inst_31763)){
var statearr_31959_32021 = state_31880__$1;
(statearr_31959_32021[(1)] = (10));

} else {
var statearr_31960_32022 = state_31880__$1;
(statearr_31960_32022[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___31968,cs,m,dchan,dctr,done))
;
return ((function (switch__30486__auto__,c__30600__auto___31968,cs,m,dchan,dctr,done){
return (function() {
var cljs$core$async$mult_$_state_machine__30487__auto__ = null;
var cljs$core$async$mult_$_state_machine__30487__auto____0 = (function (){
var statearr_31964 = [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_31964[(0)] = cljs$core$async$mult_$_state_machine__30487__auto__);

(statearr_31964[(1)] = (1));

return statearr_31964;
});
var cljs$core$async$mult_$_state_machine__30487__auto____1 = (function (state_31880){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_31880);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e31965){if((e31965 instanceof Object)){
var ex__30490__auto__ = e31965;
var statearr_31966_32023 = state_31880;
(statearr_31966_32023[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32024 = state_31880;
state_31880 = G__32024;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__30487__auto__ = function(state_31880){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__30487__auto____1.call(this,state_31880);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mult_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__30487__auto____0;
cljs$core$async$mult_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__30487__auto____1;
return cljs$core$async$mult_$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___31968,cs,m,dchan,dctr,done))
})();
var state__30602__auto__ = (function (){var statearr_31967 = f__30601__auto__.call(null);
(statearr_31967[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___31968);

return statearr_31967;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___31968,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 args32025 = [];
var len__24559__auto___32028 = arguments.length;
var i__24560__auto___32029 = (0);
while(true){
if((i__24560__auto___32029 < len__24559__auto___32028)){
args32025.push((arguments[i__24560__auto___32029]));

var G__32030 = (i__24560__auto___32029 + (1));
i__24560__auto___32029 = G__32030;
continue;
} else {
}
break;
}

var G__32027 = args32025.length;
switch (G__32027) {
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(args32025.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.admix_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.unmix_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m);
} else {
var m__24057__auto____$1 = (cljs.core.async.unmix_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,state_map);
} else {
var m__24057__auto____$1 = (cljs.core.async.toggle_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,mode);
} else {
var m__24057__auto____$1 = (cljs.core.async.solo_mode_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24566__auto__ = [];
var len__24559__auto___32042 = arguments.length;
var i__24560__auto___32043 = (0);
while(true){
if((i__24560__auto___32043 < len__24559__auto___32042)){
args__24566__auto__.push((arguments[i__24560__auto___32043]));

var G__32044 = (i__24560__auto___32043 + (1));
i__24560__auto___32043 = G__32044;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((3) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__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__24567__auto__);
});

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


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


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
});})(map__32037,map__32037__$1,opts))
,ports,opts);
if(cljs.core.truth_(temp__5278__auto__)){
var cb = temp__5278__auto__;
var statearr_32041_32047 = state;
(statearr_32041_32047[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 (seq32032){
var G__32033 = cljs.core.first.call(null,seq32032);
var seq32032__$1 = cljs.core.next.call(null,seq32032);
var G__32034 = cljs.core.first.call(null,seq32032__$1);
var seq32032__$2 = cljs.core.next.call(null,seq32032__$1);
var G__32035 = cljs.core.first.call(null,seq32032__$2);
var seq32032__$3 = cljs.core.next.call(null,seq32032__$2);
return cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__32033,G__32034,G__32035,seq32032__$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$async32215 !== '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$async32215 = (function (out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,meta32216){
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.meta32216 = meta32216;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32215.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_32217,meta32216__$1){
var self__ = this;
var _32217__$1 = this;
return (new cljs.core.async.t_cljs$core$async32215(self__.out,self__.cs,self__.solo_modes,self__.attrs,self__.solo_mode,self__.change,self__.changed,self__.pick,self__.calc_state,meta32216__$1));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async32215.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_32217){
var self__ = this;
var _32217__$1 = this;
return self__.meta32216;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

cljs.core.async.t_cljs$core$async32215.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$async32215.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32215.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$async32215.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$async32215.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$async32215.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$async32215.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$async32215.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,"meta32216","meta32216",-1757355173,null)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

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

cljs.core.async.t_cljs$core$async32215.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32215");
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

}

return (new cljs.core.async.t_cljs$core$async32215(out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__30600__auto___32382 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32382,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32382,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (state_32319){
var state_val_32320 = (state_32319[(1)]);
if((state_val_32320 === (7))){
var inst_32234 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
var statearr_32321_32383 = state_32319__$1;
(statearr_32321_32383[(2)] = inst_32234);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (20))){
var inst_32246 = (state_32319[(7)]);
var state_32319__$1 = state_32319;
var statearr_32322_32384 = state_32319__$1;
(statearr_32322_32384[(2)] = inst_32246);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (27))){
var state_32319__$1 = state_32319;
var statearr_32323_32385 = state_32319__$1;
(statearr_32323_32385[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (1))){
var inst_32221 = (state_32319[(8)]);
var inst_32221__$1 = calc_state.call(null);
var inst_32223 = (inst_32221__$1 == null);
var inst_32224 = cljs.core.not.call(null,inst_32223);
var state_32319__$1 = (function (){var statearr_32324 = state_32319;
(statearr_32324[(8)] = inst_32221__$1);

return statearr_32324;
})();
if(inst_32224){
var statearr_32325_32386 = state_32319__$1;
(statearr_32325_32386[(1)] = (2));

} else {
var statearr_32326_32387 = state_32319__$1;
(statearr_32326_32387[(1)] = (3));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (24))){
var inst_32270 = (state_32319[(9)]);
var inst_32293 = (state_32319[(10)]);
var inst_32279 = (state_32319[(11)]);
var inst_32293__$1 = inst_32270.call(null,inst_32279);
var state_32319__$1 = (function (){var statearr_32327 = state_32319;
(statearr_32327[(10)] = inst_32293__$1);

return statearr_32327;
})();
if(cljs.core.truth_(inst_32293__$1)){
var statearr_32328_32388 = state_32319__$1;
(statearr_32328_32388[(1)] = (29));

} else {
var statearr_32329_32389 = state_32319__$1;
(statearr_32329_32389[(1)] = (30));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (4))){
var inst_32237 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32237)){
var statearr_32330_32390 = state_32319__$1;
(statearr_32330_32390[(1)] = (8));

} else {
var statearr_32331_32391 = state_32319__$1;
(statearr_32331_32391[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (15))){
var inst_32264 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32264)){
var statearr_32332_32392 = state_32319__$1;
(statearr_32332_32392[(1)] = (19));

} else {
var statearr_32333_32393 = state_32319__$1;
(statearr_32333_32393[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (21))){
var inst_32269 = (state_32319[(12)]);
var inst_32269__$1 = (state_32319[(2)]);
var inst_32270 = cljs.core.get.call(null,inst_32269__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_32271 = cljs.core.get.call(null,inst_32269__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_32272 = cljs.core.get.call(null,inst_32269__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_32319__$1 = (function (){var statearr_32334 = state_32319;
(statearr_32334[(12)] = inst_32269__$1);

(statearr_32334[(13)] = inst_32271);

(statearr_32334[(9)] = inst_32270);

return statearr_32334;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_32319__$1,(22),inst_32272);
} else {
if((state_val_32320 === (31))){
var inst_32301 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32301)){
var statearr_32335_32394 = state_32319__$1;
(statearr_32335_32394[(1)] = (32));

} else {
var statearr_32336_32395 = state_32319__$1;
(statearr_32336_32395[(1)] = (33));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (32))){
var inst_32278 = (state_32319[(14)]);
var state_32319__$1 = state_32319;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32319__$1,(35),out,inst_32278);
} else {
if((state_val_32320 === (33))){
var inst_32269 = (state_32319[(12)]);
var inst_32246 = inst_32269;
var state_32319__$1 = (function (){var statearr_32337 = state_32319;
(statearr_32337[(7)] = inst_32246);

return statearr_32337;
})();
var statearr_32338_32396 = state_32319__$1;
(statearr_32338_32396[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (13))){
var inst_32246 = (state_32319[(7)]);
var inst_32253 = inst_32246.cljs$lang$protocol_mask$partition0$;
var inst_32254 = (inst_32253 & (64));
var inst_32255 = inst_32246.cljs$core$ISeq$;
var inst_32256 = (cljs.core.PROTOCOL_SENTINEL === inst_32255);
var inst_32257 = (inst_32254) || (inst_32256);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32257)){
var statearr_32339_32397 = state_32319__$1;
(statearr_32339_32397[(1)] = (16));

} else {
var statearr_32340_32398 = state_32319__$1;
(statearr_32340_32398[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (22))){
var inst_32278 = (state_32319[(14)]);
var inst_32279 = (state_32319[(11)]);
var inst_32277 = (state_32319[(2)]);
var inst_32278__$1 = cljs.core.nth.call(null,inst_32277,(0),null);
var inst_32279__$1 = cljs.core.nth.call(null,inst_32277,(1),null);
var inst_32280 = (inst_32278__$1 == null);
var inst_32281 = cljs.core._EQ_.call(null,inst_32279__$1,change);
var inst_32282 = (inst_32280) || (inst_32281);
var state_32319__$1 = (function (){var statearr_32341 = state_32319;
(statearr_32341[(14)] = inst_32278__$1);

(statearr_32341[(11)] = inst_32279__$1);

return statearr_32341;
})();
if(cljs.core.truth_(inst_32282)){
var statearr_32342_32399 = state_32319__$1;
(statearr_32342_32399[(1)] = (23));

} else {
var statearr_32343_32400 = state_32319__$1;
(statearr_32343_32400[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (36))){
var inst_32269 = (state_32319[(12)]);
var inst_32246 = inst_32269;
var state_32319__$1 = (function (){var statearr_32344 = state_32319;
(statearr_32344[(7)] = inst_32246);

return statearr_32344;
})();
var statearr_32345_32401 = state_32319__$1;
(statearr_32345_32401[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (29))){
var inst_32293 = (state_32319[(10)]);
var state_32319__$1 = state_32319;
var statearr_32346_32402 = state_32319__$1;
(statearr_32346_32402[(2)] = inst_32293);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (6))){
var state_32319__$1 = state_32319;
var statearr_32347_32403 = state_32319__$1;
(statearr_32347_32403[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (28))){
var inst_32289 = (state_32319[(2)]);
var inst_32290 = calc_state.call(null);
var inst_32246 = inst_32290;
var state_32319__$1 = (function (){var statearr_32348 = state_32319;
(statearr_32348[(7)] = inst_32246);

(statearr_32348[(15)] = inst_32289);

return statearr_32348;
})();
var statearr_32349_32404 = state_32319__$1;
(statearr_32349_32404[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (25))){
var inst_32315 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
var statearr_32350_32405 = state_32319__$1;
(statearr_32350_32405[(2)] = inst_32315);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (34))){
var inst_32313 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
var statearr_32351_32406 = state_32319__$1;
(statearr_32351_32406[(2)] = inst_32313);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (17))){
var state_32319__$1 = state_32319;
var statearr_32352_32407 = state_32319__$1;
(statearr_32352_32407[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (3))){
var state_32319__$1 = state_32319;
var statearr_32353_32408 = state_32319__$1;
(statearr_32353_32408[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (12))){
var inst_32317 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32319__$1,inst_32317);
} else {
if((state_val_32320 === (2))){
var inst_32221 = (state_32319[(8)]);
var inst_32226 = inst_32221.cljs$lang$protocol_mask$partition0$;
var inst_32227 = (inst_32226 & (64));
var inst_32228 = inst_32221.cljs$core$ISeq$;
var inst_32229 = (cljs.core.PROTOCOL_SENTINEL === inst_32228);
var inst_32230 = (inst_32227) || (inst_32229);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32230)){
var statearr_32354_32409 = state_32319__$1;
(statearr_32354_32409[(1)] = (5));

} else {
var statearr_32355_32410 = state_32319__$1;
(statearr_32355_32410[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (23))){
var inst_32278 = (state_32319[(14)]);
var inst_32284 = (inst_32278 == null);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32284)){
var statearr_32356_32411 = state_32319__$1;
(statearr_32356_32411[(1)] = (26));

} else {
var statearr_32357_32412 = state_32319__$1;
(statearr_32357_32412[(1)] = (27));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (35))){
var inst_32304 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
if(cljs.core.truth_(inst_32304)){
var statearr_32358_32413 = state_32319__$1;
(statearr_32358_32413[(1)] = (36));

} else {
var statearr_32359_32414 = state_32319__$1;
(statearr_32359_32414[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (19))){
var inst_32246 = (state_32319[(7)]);
var inst_32266 = cljs.core.apply.call(null,cljs.core.hash_map,inst_32246);
var state_32319__$1 = state_32319;
var statearr_32360_32415 = state_32319__$1;
(statearr_32360_32415[(2)] = inst_32266);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (11))){
var inst_32246 = (state_32319[(7)]);
var inst_32250 = (inst_32246 == null);
var inst_32251 = cljs.core.not.call(null,inst_32250);
var state_32319__$1 = state_32319;
if(inst_32251){
var statearr_32361_32416 = state_32319__$1;
(statearr_32361_32416[(1)] = (13));

} else {
var statearr_32362_32417 = state_32319__$1;
(statearr_32362_32417[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (9))){
var inst_32221 = (state_32319[(8)]);
var state_32319__$1 = state_32319;
var statearr_32363_32418 = state_32319__$1;
(statearr_32363_32418[(2)] = inst_32221);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (5))){
var state_32319__$1 = state_32319;
var statearr_32364_32419 = state_32319__$1;
(statearr_32364_32419[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (14))){
var state_32319__$1 = state_32319;
var statearr_32365_32420 = state_32319__$1;
(statearr_32365_32420[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (26))){
var inst_32279 = (state_32319[(11)]);
var inst_32286 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_32279);
var state_32319__$1 = state_32319;
var statearr_32366_32421 = state_32319__$1;
(statearr_32366_32421[(2)] = inst_32286);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (16))){
var state_32319__$1 = state_32319;
var statearr_32367_32422 = state_32319__$1;
(statearr_32367_32422[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (38))){
var inst_32309 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
var statearr_32368_32423 = state_32319__$1;
(statearr_32368_32423[(2)] = inst_32309);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (30))){
var inst_32271 = (state_32319[(13)]);
var inst_32270 = (state_32319[(9)]);
var inst_32279 = (state_32319[(11)]);
var inst_32296 = cljs.core.empty_QMARK_.call(null,inst_32270);
var inst_32297 = inst_32271.call(null,inst_32279);
var inst_32298 = cljs.core.not.call(null,inst_32297);
var inst_32299 = (inst_32296) && (inst_32298);
var state_32319__$1 = state_32319;
var statearr_32369_32424 = state_32319__$1;
(statearr_32369_32424[(2)] = inst_32299);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (10))){
var inst_32221 = (state_32319[(8)]);
var inst_32242 = (state_32319[(2)]);
var inst_32243 = cljs.core.get.call(null,inst_32242,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_32244 = cljs.core.get.call(null,inst_32242,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_32245 = cljs.core.get.call(null,inst_32242,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_32246 = inst_32221;
var state_32319__$1 = (function (){var statearr_32370 = state_32319;
(statearr_32370[(16)] = inst_32244);

(statearr_32370[(7)] = inst_32246);

(statearr_32370[(17)] = inst_32243);

(statearr_32370[(18)] = inst_32245);

return statearr_32370;
})();
var statearr_32371_32425 = state_32319__$1;
(statearr_32371_32425[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (18))){
var inst_32261 = (state_32319[(2)]);
var state_32319__$1 = state_32319;
var statearr_32372_32426 = state_32319__$1;
(statearr_32372_32426[(2)] = inst_32261);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (37))){
var state_32319__$1 = state_32319;
var statearr_32373_32427 = state_32319__$1;
(statearr_32373_32427[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32320 === (8))){
var inst_32221 = (state_32319[(8)]);
var inst_32239 = cljs.core.apply.call(null,cljs.core.hash_map,inst_32221);
var state_32319__$1 = state_32319;
var statearr_32374_32428 = state_32319__$1;
(statearr_32374_32428[(2)] = inst_32239);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32382,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
;
return ((function (switch__30486__auto__,c__30600__auto___32382,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function() {
var cljs$core$async$mix_$_state_machine__30487__auto__ = null;
var cljs$core$async$mix_$_state_machine__30487__auto____0 = (function (){
var statearr_32378 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_32378[(0)] = cljs$core$async$mix_$_state_machine__30487__auto__);

(statearr_32378[(1)] = (1));

return statearr_32378;
});
var cljs$core$async$mix_$_state_machine__30487__auto____1 = (function (state_32319){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32319);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32379){if((e32379 instanceof Object)){
var ex__30490__auto__ = e32379;
var statearr_32380_32429 = state_32319;
(statearr_32380_32429[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32430 = state_32319;
state_32319 = G__32430;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__30487__auto__ = function(state_32319){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__30487__auto____1.call(this,state_32319);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mix_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__30487__auto____0;
cljs$core$async$mix_$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__30487__auto____1;
return cljs$core$async$mix_$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32382,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
})();
var state__30602__auto__ = (function (){var statearr_32381 = f__30601__auto__.call(null);
(statearr_32381[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32382);

return statearr_32381;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32382,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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v,ch,close_QMARK_);
} else {
var m__24057__auto____$1 = (cljs.core.async.sub_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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 args32431 = [];
var len__24559__auto___32434 = arguments.length;
var i__24560__auto___32435 = (0);
while(true){
if((i__24560__auto___32435 < len__24559__auto___32434)){
args32431.push((arguments[i__24560__auto___32435]));

var G__32436 = (i__24560__auto___32435 + (1));
i__24560__auto___32435 = G__32436;
continue;
} else {
}
break;
}

var G__32433 = args32431.length;
switch (G__32433) {
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(args32431.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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__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 args32439 = [];
var len__24559__auto___32564 = arguments.length;
var i__24560__auto___32565 = (0);
while(true){
if((i__24560__auto___32565 < len__24559__auto___32564)){
args32439.push((arguments[i__24560__auto___32565]));

var G__32566 = (i__24560__auto___32565 + (1));
i__24560__auto___32565 = G__32566;
continue;
} else {
}
break;
}

var G__32441 = args32439.length;
switch (G__32441) {
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(args32439.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__23338__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,mults),topic);
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
return cljs.core.get.call(null,cljs.core.swap_BANG_.call(null,mults,((function (or__23338__auto__,mults){
return (function (p1__32438_SHARP_){
if(cljs.core.truth_(p1__32438_SHARP_.call(null,topic))){
return p1__32438_SHARP_;
} else {
return cljs.core.assoc.call(null,p1__32438_SHARP_,topic,cljs.core.async.mult.call(null,cljs.core.async.chan.call(null,buf_fn.call(null,topic))));
}
});})(or__23338__auto__,mults))
),topic);
}
});})(mults))
;
var p = (function (){
if(typeof cljs.core.async.t_cljs$core$async32442 !== '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$async32442 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta32443){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta32443 = meta32443;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32442.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (mults,ensure_mult){
return (function (_32444,meta32443__$1){
var self__ = this;
var _32444__$1 = this;
return (new cljs.core.async.t_cljs$core$async32442(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta32443__$1));
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async32442.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){
return (function (_32444){
var self__ = this;
var _32444__$1 = this;
return self__.meta32443;
});})(mults,ensure_mult))
;

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

cljs.core.async.t_cljs$core$async32442.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$async32442.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32442.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$async32442.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$async32442.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$async32442.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$async32442.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,"meta32443","meta32443",-510484461,null)], null);
});})(mults,ensure_mult))
;

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

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

cljs.core.async.t_cljs$core$async32442.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32442");
});})(mults,ensure_mult))
;

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

}

return (new cljs.core.async.t_cljs$core$async32442(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__30600__auto___32568 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32568,mults,ensure_mult,p){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32568,mults,ensure_mult,p){
return (function (state_32516){
var state_val_32517 = (state_32516[(1)]);
if((state_val_32517 === (7))){
var inst_32512 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32518_32569 = state_32516__$1;
(statearr_32518_32569[(2)] = inst_32512);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (20))){
var state_32516__$1 = state_32516;
var statearr_32519_32570 = state_32516__$1;
(statearr_32519_32570[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (1))){
var state_32516__$1 = state_32516;
var statearr_32520_32571 = state_32516__$1;
(statearr_32520_32571[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (24))){
var inst_32495 = (state_32516[(7)]);
var inst_32504 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_32495);
var state_32516__$1 = state_32516;
var statearr_32521_32572 = state_32516__$1;
(statearr_32521_32572[(2)] = inst_32504);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (4))){
var inst_32447 = (state_32516[(8)]);
var inst_32447__$1 = (state_32516[(2)]);
var inst_32448 = (inst_32447__$1 == null);
var state_32516__$1 = (function (){var statearr_32522 = state_32516;
(statearr_32522[(8)] = inst_32447__$1);

return statearr_32522;
})();
if(cljs.core.truth_(inst_32448)){
var statearr_32523_32573 = state_32516__$1;
(statearr_32523_32573[(1)] = (5));

} else {
var statearr_32524_32574 = state_32516__$1;
(statearr_32524_32574[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (15))){
var inst_32489 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32525_32575 = state_32516__$1;
(statearr_32525_32575[(2)] = inst_32489);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (21))){
var inst_32509 = (state_32516[(2)]);
var state_32516__$1 = (function (){var statearr_32526 = state_32516;
(statearr_32526[(9)] = inst_32509);

return statearr_32526;
})();
var statearr_32527_32576 = state_32516__$1;
(statearr_32527_32576[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (13))){
var inst_32471 = (state_32516[(10)]);
var inst_32473 = cljs.core.chunked_seq_QMARK_.call(null,inst_32471);
var state_32516__$1 = state_32516;
if(inst_32473){
var statearr_32528_32577 = state_32516__$1;
(statearr_32528_32577[(1)] = (16));

} else {
var statearr_32529_32578 = state_32516__$1;
(statearr_32529_32578[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (22))){
var inst_32501 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
if(cljs.core.truth_(inst_32501)){
var statearr_32530_32579 = state_32516__$1;
(statearr_32530_32579[(1)] = (23));

} else {
var statearr_32531_32580 = state_32516__$1;
(statearr_32531_32580[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (6))){
var inst_32447 = (state_32516[(8)]);
var inst_32495 = (state_32516[(7)]);
var inst_32497 = (state_32516[(11)]);
var inst_32495__$1 = topic_fn.call(null,inst_32447);
var inst_32496 = cljs.core.deref.call(null,mults);
var inst_32497__$1 = cljs.core.get.call(null,inst_32496,inst_32495__$1);
var state_32516__$1 = (function (){var statearr_32532 = state_32516;
(statearr_32532[(7)] = inst_32495__$1);

(statearr_32532[(11)] = inst_32497__$1);

return statearr_32532;
})();
if(cljs.core.truth_(inst_32497__$1)){
var statearr_32533_32581 = state_32516__$1;
(statearr_32533_32581[(1)] = (19));

} else {
var statearr_32534_32582 = state_32516__$1;
(statearr_32534_32582[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (25))){
var inst_32506 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32535_32583 = state_32516__$1;
(statearr_32535_32583[(2)] = inst_32506);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (17))){
var inst_32471 = (state_32516[(10)]);
var inst_32480 = cljs.core.first.call(null,inst_32471);
var inst_32481 = cljs.core.async.muxch_STAR_.call(null,inst_32480);
var inst_32482 = cljs.core.async.close_BANG_.call(null,inst_32481);
var inst_32483 = cljs.core.next.call(null,inst_32471);
var inst_32457 = inst_32483;
var inst_32458 = null;
var inst_32459 = (0);
var inst_32460 = (0);
var state_32516__$1 = (function (){var statearr_32536 = state_32516;
(statearr_32536[(12)] = inst_32458);

(statearr_32536[(13)] = inst_32460);

(statearr_32536[(14)] = inst_32459);

(statearr_32536[(15)] = inst_32457);

(statearr_32536[(16)] = inst_32482);

return statearr_32536;
})();
var statearr_32537_32584 = state_32516__$1;
(statearr_32537_32584[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (3))){
var inst_32514 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32516__$1,inst_32514);
} else {
if((state_val_32517 === (12))){
var inst_32491 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32538_32585 = state_32516__$1;
(statearr_32538_32585[(2)] = inst_32491);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (19))){
var inst_32447 = (state_32516[(8)]);
var inst_32497 = (state_32516[(11)]);
var inst_32499 = cljs.core.async.muxch_STAR_.call(null,inst_32497);
var state_32516__$1 = state_32516;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32516__$1,(22),inst_32499,inst_32447);
} else {
if((state_val_32517 === (11))){
var inst_32457 = (state_32516[(15)]);
var inst_32471 = (state_32516[(10)]);
var inst_32471__$1 = cljs.core.seq.call(null,inst_32457);
var state_32516__$1 = (function (){var statearr_32540 = state_32516;
(statearr_32540[(10)] = inst_32471__$1);

return statearr_32540;
})();
if(inst_32471__$1){
var statearr_32541_32587 = state_32516__$1;
(statearr_32541_32587[(1)] = (13));

} else {
var statearr_32542_32588 = state_32516__$1;
(statearr_32542_32588[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (9))){
var inst_32493 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32543_32589 = state_32516__$1;
(statearr_32543_32589[(2)] = inst_32493);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (5))){
var inst_32454 = cljs.core.deref.call(null,mults);
var inst_32455 = cljs.core.vals.call(null,inst_32454);
var inst_32456 = cljs.core.seq.call(null,inst_32455);
var inst_32457 = inst_32456;
var inst_32458 = null;
var inst_32459 = (0);
var inst_32460 = (0);
var state_32516__$1 = (function (){var statearr_32544 = state_32516;
(statearr_32544[(12)] = inst_32458);

(statearr_32544[(13)] = inst_32460);

(statearr_32544[(14)] = inst_32459);

(statearr_32544[(15)] = inst_32457);

return statearr_32544;
})();
var statearr_32545_32590 = state_32516__$1;
(statearr_32545_32590[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (14))){
var state_32516__$1 = state_32516;
var statearr_32549_32591 = state_32516__$1;
(statearr_32549_32591[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (16))){
var inst_32471 = (state_32516[(10)]);
var inst_32475 = cljs.core.chunk_first.call(null,inst_32471);
var inst_32476 = cljs.core.chunk_rest.call(null,inst_32471);
var inst_32477 = cljs.core.count.call(null,inst_32475);
var inst_32457 = inst_32476;
var inst_32458 = inst_32475;
var inst_32459 = inst_32477;
var inst_32460 = (0);
var state_32516__$1 = (function (){var statearr_32550 = state_32516;
(statearr_32550[(12)] = inst_32458);

(statearr_32550[(13)] = inst_32460);

(statearr_32550[(14)] = inst_32459);

(statearr_32550[(15)] = inst_32457);

return statearr_32550;
})();
var statearr_32551_32592 = state_32516__$1;
(statearr_32551_32592[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (10))){
var inst_32458 = (state_32516[(12)]);
var inst_32460 = (state_32516[(13)]);
var inst_32459 = (state_32516[(14)]);
var inst_32457 = (state_32516[(15)]);
var inst_32465 = cljs.core._nth.call(null,inst_32458,inst_32460);
var inst_32466 = cljs.core.async.muxch_STAR_.call(null,inst_32465);
var inst_32467 = cljs.core.async.close_BANG_.call(null,inst_32466);
var inst_32468 = (inst_32460 + (1));
var tmp32546 = inst_32458;
var tmp32547 = inst_32459;
var tmp32548 = inst_32457;
var inst_32457__$1 = tmp32548;
var inst_32458__$1 = tmp32546;
var inst_32459__$1 = tmp32547;
var inst_32460__$1 = inst_32468;
var state_32516__$1 = (function (){var statearr_32552 = state_32516;
(statearr_32552[(12)] = inst_32458__$1);

(statearr_32552[(13)] = inst_32460__$1);

(statearr_32552[(14)] = inst_32459__$1);

(statearr_32552[(15)] = inst_32457__$1);

(statearr_32552[(17)] = inst_32467);

return statearr_32552;
})();
var statearr_32553_32593 = state_32516__$1;
(statearr_32553_32593[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (18))){
var inst_32486 = (state_32516[(2)]);
var state_32516__$1 = state_32516;
var statearr_32554_32594 = state_32516__$1;
(statearr_32554_32594[(2)] = inst_32486);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32517 === (8))){
var inst_32460 = (state_32516[(13)]);
var inst_32459 = (state_32516[(14)]);
var inst_32462 = (inst_32460 < inst_32459);
var inst_32463 = inst_32462;
var state_32516__$1 = state_32516;
if(cljs.core.truth_(inst_32463)){
var statearr_32555_32595 = state_32516__$1;
(statearr_32555_32595[(1)] = (10));

} else {
var statearr_32556_32596 = state_32516__$1;
(statearr_32556_32596[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32568,mults,ensure_mult,p))
;
return ((function (switch__30486__auto__,c__30600__auto___32568,mults,ensure_mult,p){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_32560 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_32560[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_32560[(1)] = (1));

return statearr_32560;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_32516){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32516);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32561){if((e32561 instanceof Object)){
var ex__30490__auto__ = e32561;
var statearr_32562_32597 = state_32516;
(statearr_32562_32597[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32598 = state_32516;
state_32516 = G__32598;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_32516){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_32516);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32568,mults,ensure_mult,p))
})();
var state__30602__auto__ = (function (){var statearr_32563 = f__30601__auto__.call(null);
(statearr_32563[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32568);

return statearr_32563;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32568,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 args32599 = [];
var len__24559__auto___32602 = arguments.length;
var i__24560__auto___32603 = (0);
while(true){
if((i__24560__auto___32603 < len__24559__auto___32602)){
args32599.push((arguments[i__24560__auto___32603]));

var G__32604 = (i__24560__auto___32603 + (1));
i__24560__auto___32603 = G__32604;
continue;
} else {
}
break;
}

var G__32601 = args32599.length;
switch (G__32601) {
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(args32599.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 args32606 = [];
var len__24559__auto___32609 = arguments.length;
var i__24560__auto___32610 = (0);
while(true){
if((i__24560__auto___32610 < len__24559__auto___32609)){
args32606.push((arguments[i__24560__auto___32610]));

var G__32611 = (i__24560__auto___32610 + (1));
i__24560__auto___32610 = G__32611;
continue;
} else {
}
break;
}

var G__32608 = args32606.length;
switch (G__32608) {
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(args32606.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 args32613 = [];
var len__24559__auto___32684 = arguments.length;
var i__24560__auto___32685 = (0);
while(true){
if((i__24560__auto___32685 < len__24559__auto___32684)){
args32613.push((arguments[i__24560__auto___32685]));

var G__32686 = (i__24560__auto___32685 + (1));
i__24560__auto___32685 = G__32686;
continue;
} else {
}
break;
}

var G__32615 = args32613.length;
switch (G__32615) {
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(args32613.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__30600__auto___32688 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32688,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32688,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (state_32654){
var state_val_32655 = (state_32654[(1)]);
if((state_val_32655 === (7))){
var state_32654__$1 = state_32654;
var statearr_32656_32689 = state_32654__$1;
(statearr_32656_32689[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (1))){
var state_32654__$1 = state_32654;
var statearr_32657_32690 = state_32654__$1;
(statearr_32657_32690[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (4))){
var inst_32618 = (state_32654[(7)]);
var inst_32620 = (inst_32618 < cnt);
var state_32654__$1 = state_32654;
if(cljs.core.truth_(inst_32620)){
var statearr_32658_32691 = state_32654__$1;
(statearr_32658_32691[(1)] = (6));

} else {
var statearr_32659_32692 = state_32654__$1;
(statearr_32659_32692[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (15))){
var inst_32650 = (state_32654[(2)]);
var state_32654__$1 = state_32654;
var statearr_32660_32693 = state_32654__$1;
(statearr_32660_32693[(2)] = inst_32650);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (13))){
var inst_32643 = cljs.core.async.close_BANG_.call(null,out);
var state_32654__$1 = state_32654;
var statearr_32661_32694 = state_32654__$1;
(statearr_32661_32694[(2)] = inst_32643);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (6))){
var state_32654__$1 = state_32654;
var statearr_32662_32695 = state_32654__$1;
(statearr_32662_32695[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (3))){
var inst_32652 = (state_32654[(2)]);
var state_32654__$1 = state_32654;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32654__$1,inst_32652);
} else {
if((state_val_32655 === (12))){
var inst_32640 = (state_32654[(8)]);
var inst_32640__$1 = (state_32654[(2)]);
var inst_32641 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_32640__$1);
var state_32654__$1 = (function (){var statearr_32663 = state_32654;
(statearr_32663[(8)] = inst_32640__$1);

return statearr_32663;
})();
if(cljs.core.truth_(inst_32641)){
var statearr_32664_32696 = state_32654__$1;
(statearr_32664_32696[(1)] = (13));

} else {
var statearr_32665_32697 = state_32654__$1;
(statearr_32665_32697[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (2))){
var inst_32617 = cljs.core.reset_BANG_.call(null,dctr,cnt);
var inst_32618 = (0);
var state_32654__$1 = (function (){var statearr_32666 = state_32654;
(statearr_32666[(7)] = inst_32618);

(statearr_32666[(9)] = inst_32617);

return statearr_32666;
})();
var statearr_32667_32698 = state_32654__$1;
(statearr_32667_32698[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (11))){
var inst_32618 = (state_32654[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_32654,(10),Object,null,(9));
var inst_32627 = chs__$1.call(null,inst_32618);
var inst_32628 = done.call(null,inst_32618);
var inst_32629 = cljs.core.async.take_BANG_.call(null,inst_32627,inst_32628);
var state_32654__$1 = state_32654;
var statearr_32668_32699 = state_32654__$1;
(statearr_32668_32699[(2)] = inst_32629);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (9))){
var inst_32618 = (state_32654[(7)]);
var inst_32631 = (state_32654[(2)]);
var inst_32632 = (inst_32618 + (1));
var inst_32618__$1 = inst_32632;
var state_32654__$1 = (function (){var statearr_32669 = state_32654;
(statearr_32669[(10)] = inst_32631);

(statearr_32669[(7)] = inst_32618__$1);

return statearr_32669;
})();
var statearr_32670_32700 = state_32654__$1;
(statearr_32670_32700[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (5))){
var inst_32638 = (state_32654[(2)]);
var state_32654__$1 = (function (){var statearr_32671 = state_32654;
(statearr_32671[(11)] = inst_32638);

return statearr_32671;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_32654__$1,(12),dchan);
} else {
if((state_val_32655 === (14))){
var inst_32640 = (state_32654[(8)]);
var inst_32645 = cljs.core.apply.call(null,f,inst_32640);
var state_32654__$1 = state_32654;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32654__$1,(16),out,inst_32645);
} else {
if((state_val_32655 === (16))){
var inst_32647 = (state_32654[(2)]);
var state_32654__$1 = (function (){var statearr_32672 = state_32654;
(statearr_32672[(12)] = inst_32647);

return statearr_32672;
})();
var statearr_32673_32701 = state_32654__$1;
(statearr_32673_32701[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (10))){
var inst_32622 = (state_32654[(2)]);
var inst_32623 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec);
var state_32654__$1 = (function (){var statearr_32674 = state_32654;
(statearr_32674[(13)] = inst_32622);

return statearr_32674;
})();
var statearr_32675_32702 = state_32654__$1;
(statearr_32675_32702[(2)] = inst_32623);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32655 === (8))){
var inst_32636 = (state_32654[(2)]);
var state_32654__$1 = state_32654;
var statearr_32676_32703 = state_32654__$1;
(statearr_32676_32703[(2)] = inst_32636);

(statearr_32676_32703[(1)] = (5));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32688,chs__$1,out,cnt,rets,dchan,dctr,done))
;
return ((function (switch__30486__auto__,c__30600__auto___32688,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_32680 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_32680[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_32680[(1)] = (1));

return statearr_32680;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_32654){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32654);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32681){if((e32681 instanceof Object)){
var ex__30490__auto__ = e32681;
var statearr_32682_32704 = state_32654;
(statearr_32682_32704[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32705 = state_32654;
state_32654 = G__32705;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_32654){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_32654);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32688,chs__$1,out,cnt,rets,dchan,dctr,done))
})();
var state__30602__auto__ = (function (){var statearr_32683 = f__30601__auto__.call(null);
(statearr_32683[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32688);

return statearr_32683;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32688,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 args32707 = [];
var len__24559__auto___32765 = arguments.length;
var i__24560__auto___32766 = (0);
while(true){
if((i__24560__auto___32766 < len__24559__auto___32765)){
args32707.push((arguments[i__24560__auto___32766]));

var G__32767 = (i__24560__auto___32766 + (1));
i__24560__auto___32766 = G__32767;
continue;
} else {
}
break;
}

var G__32709 = args32707.length;
switch (G__32709) {
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(args32707.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__30600__auto___32769 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32769,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32769,out){
return (function (state_32741){
var state_val_32742 = (state_32741[(1)]);
if((state_val_32742 === (7))){
var inst_32720 = (state_32741[(7)]);
var inst_32721 = (state_32741[(8)]);
var inst_32720__$1 = (state_32741[(2)]);
var inst_32721__$1 = cljs.core.nth.call(null,inst_32720__$1,(0),null);
var inst_32722 = cljs.core.nth.call(null,inst_32720__$1,(1),null);
var inst_32723 = (inst_32721__$1 == null);
var state_32741__$1 = (function (){var statearr_32743 = state_32741;
(statearr_32743[(9)] = inst_32722);

(statearr_32743[(7)] = inst_32720__$1);

(statearr_32743[(8)] = inst_32721__$1);

return statearr_32743;
})();
if(cljs.core.truth_(inst_32723)){
var statearr_32744_32770 = state_32741__$1;
(statearr_32744_32770[(1)] = (8));

} else {
var statearr_32745_32771 = state_32741__$1;
(statearr_32745_32771[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (1))){
var inst_32710 = cljs.core.vec.call(null,chs);
var inst_32711 = inst_32710;
var state_32741__$1 = (function (){var statearr_32746 = state_32741;
(statearr_32746[(10)] = inst_32711);

return statearr_32746;
})();
var statearr_32747_32772 = state_32741__$1;
(statearr_32747_32772[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (4))){
var inst_32711 = (state_32741[(10)]);
var state_32741__$1 = state_32741;
return cljs.core.async.ioc_alts_BANG_.call(null,state_32741__$1,(7),inst_32711);
} else {
if((state_val_32742 === (6))){
var inst_32737 = (state_32741[(2)]);
var state_32741__$1 = state_32741;
var statearr_32748_32773 = state_32741__$1;
(statearr_32748_32773[(2)] = inst_32737);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (3))){
var inst_32739 = (state_32741[(2)]);
var state_32741__$1 = state_32741;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32741__$1,inst_32739);
} else {
if((state_val_32742 === (2))){
var inst_32711 = (state_32741[(10)]);
var inst_32713 = cljs.core.count.call(null,inst_32711);
var inst_32714 = (inst_32713 > (0));
var state_32741__$1 = state_32741;
if(cljs.core.truth_(inst_32714)){
var statearr_32750_32774 = state_32741__$1;
(statearr_32750_32774[(1)] = (4));

} else {
var statearr_32751_32775 = state_32741__$1;
(statearr_32751_32775[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (11))){
var inst_32711 = (state_32741[(10)]);
var inst_32730 = (state_32741[(2)]);
var tmp32749 = inst_32711;
var inst_32711__$1 = tmp32749;
var state_32741__$1 = (function (){var statearr_32752 = state_32741;
(statearr_32752[(10)] = inst_32711__$1);

(statearr_32752[(11)] = inst_32730);

return statearr_32752;
})();
var statearr_32753_32776 = state_32741__$1;
(statearr_32753_32776[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (9))){
var inst_32721 = (state_32741[(8)]);
var state_32741__$1 = state_32741;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32741__$1,(11),out,inst_32721);
} else {
if((state_val_32742 === (5))){
var inst_32735 = cljs.core.async.close_BANG_.call(null,out);
var state_32741__$1 = state_32741;
var statearr_32754_32777 = state_32741__$1;
(statearr_32754_32777[(2)] = inst_32735);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (10))){
var inst_32733 = (state_32741[(2)]);
var state_32741__$1 = state_32741;
var statearr_32755_32778 = state_32741__$1;
(statearr_32755_32778[(2)] = inst_32733);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32742 === (8))){
var inst_32722 = (state_32741[(9)]);
var inst_32720 = (state_32741[(7)]);
var inst_32711 = (state_32741[(10)]);
var inst_32721 = (state_32741[(8)]);
var inst_32725 = (function (){var cs = inst_32711;
var vec__32716 = inst_32720;
var v = inst_32721;
var c = inst_32722;
return ((function (cs,vec__32716,v,c,inst_32722,inst_32720,inst_32711,inst_32721,state_val_32742,c__30600__auto___32769,out){
return (function (p1__32706_SHARP_){
return cljs.core.not_EQ_.call(null,c,p1__32706_SHARP_);
});
;})(cs,vec__32716,v,c,inst_32722,inst_32720,inst_32711,inst_32721,state_val_32742,c__30600__auto___32769,out))
})();
var inst_32726 = cljs.core.filterv.call(null,inst_32725,inst_32711);
var inst_32711__$1 = inst_32726;
var state_32741__$1 = (function (){var statearr_32756 = state_32741;
(statearr_32756[(10)] = inst_32711__$1);

return statearr_32756;
})();
var statearr_32757_32779 = state_32741__$1;
(statearr_32757_32779[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32769,out))
;
return ((function (switch__30486__auto__,c__30600__auto___32769,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_32761 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_32761[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_32761[(1)] = (1));

return statearr_32761;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_32741){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32741);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32762){if((e32762 instanceof Object)){
var ex__30490__auto__ = e32762;
var statearr_32763_32780 = state_32741;
(statearr_32763_32780[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32781 = state_32741;
state_32741 = G__32781;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_32741){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_32741);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32769,out))
})();
var state__30602__auto__ = (function (){var statearr_32764 = f__30601__auto__.call(null);
(statearr_32764[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32769);

return statearr_32764;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32769,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 args32782 = [];
var len__24559__auto___32831 = arguments.length;
var i__24560__auto___32832 = (0);
while(true){
if((i__24560__auto___32832 < len__24559__auto___32831)){
args32782.push((arguments[i__24560__auto___32832]));

var G__32833 = (i__24560__auto___32832 + (1));
i__24560__auto___32832 = G__32833;
continue;
} else {
}
break;
}

var G__32784 = args32782.length;
switch (G__32784) {
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(args32782.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__30600__auto___32835 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32835,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32835,out){
return (function (state_32808){
var state_val_32809 = (state_32808[(1)]);
if((state_val_32809 === (7))){
var inst_32790 = (state_32808[(7)]);
var inst_32790__$1 = (state_32808[(2)]);
var inst_32791 = (inst_32790__$1 == null);
var inst_32792 = cljs.core.not.call(null,inst_32791);
var state_32808__$1 = (function (){var statearr_32810 = state_32808;
(statearr_32810[(7)] = inst_32790__$1);

return statearr_32810;
})();
if(inst_32792){
var statearr_32811_32836 = state_32808__$1;
(statearr_32811_32836[(1)] = (8));

} else {
var statearr_32812_32837 = state_32808__$1;
(statearr_32812_32837[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (1))){
var inst_32785 = (0);
var state_32808__$1 = (function (){var statearr_32813 = state_32808;
(statearr_32813[(8)] = inst_32785);

return statearr_32813;
})();
var statearr_32814_32838 = state_32808__$1;
(statearr_32814_32838[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (4))){
var state_32808__$1 = state_32808;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_32808__$1,(7),ch);
} else {
if((state_val_32809 === (6))){
var inst_32803 = (state_32808[(2)]);
var state_32808__$1 = state_32808;
var statearr_32815_32839 = state_32808__$1;
(statearr_32815_32839[(2)] = inst_32803);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (3))){
var inst_32805 = (state_32808[(2)]);
var inst_32806 = cljs.core.async.close_BANG_.call(null,out);
var state_32808__$1 = (function (){var statearr_32816 = state_32808;
(statearr_32816[(9)] = inst_32805);

return statearr_32816;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32808__$1,inst_32806);
} else {
if((state_val_32809 === (2))){
var inst_32785 = (state_32808[(8)]);
var inst_32787 = (inst_32785 < n);
var state_32808__$1 = state_32808;
if(cljs.core.truth_(inst_32787)){
var statearr_32817_32840 = state_32808__$1;
(statearr_32817_32840[(1)] = (4));

} else {
var statearr_32818_32841 = state_32808__$1;
(statearr_32818_32841[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (11))){
var inst_32785 = (state_32808[(8)]);
var inst_32795 = (state_32808[(2)]);
var inst_32796 = (inst_32785 + (1));
var inst_32785__$1 = inst_32796;
var state_32808__$1 = (function (){var statearr_32819 = state_32808;
(statearr_32819[(8)] = inst_32785__$1);

(statearr_32819[(10)] = inst_32795);

return statearr_32819;
})();
var statearr_32820_32842 = state_32808__$1;
(statearr_32820_32842[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (9))){
var state_32808__$1 = state_32808;
var statearr_32821_32843 = state_32808__$1;
(statearr_32821_32843[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (5))){
var state_32808__$1 = state_32808;
var statearr_32822_32844 = state_32808__$1;
(statearr_32822_32844[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (10))){
var inst_32800 = (state_32808[(2)]);
var state_32808__$1 = state_32808;
var statearr_32823_32845 = state_32808__$1;
(statearr_32823_32845[(2)] = inst_32800);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32809 === (8))){
var inst_32790 = (state_32808[(7)]);
var state_32808__$1 = state_32808;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32808__$1,(11),out,inst_32790);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32835,out))
;
return ((function (switch__30486__auto__,c__30600__auto___32835,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_32827 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_32827[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_32827[(1)] = (1));

return statearr_32827;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_32808){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32808);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32828){if((e32828 instanceof Object)){
var ex__30490__auto__ = e32828;
var statearr_32829_32846 = state_32808;
(statearr_32829_32846[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32847 = state_32808;
state_32808 = G__32847;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_32808){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_32808);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32835,out))
})();
var state__30602__auto__ = (function (){var statearr_32830 = f__30601__auto__.call(null);
(statearr_32830[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32835);

return statearr_32830;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32835,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$async32855 !== '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$async32855 = (function (f,ch,meta32856){
this.f = f;
this.ch = ch;
this.meta32856 = meta32856;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32855.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_32857,meta32856__$1){
var self__ = this;
var _32857__$1 = this;
return (new cljs.core.async.t_cljs$core$async32855(self__.f,self__.ch,meta32856__$1));
});

cljs.core.async.t_cljs$core$async32855.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_32857){
var self__ = this;
var _32857__$1 = this;
return self__.meta32856;
});

cljs.core.async.t_cljs$core$async32855.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32855.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$async32855.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$async32855.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32855.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$async32858 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async32858 = (function (f,ch,meta32856,_,fn1,meta32859){
this.f = f;
this.ch = ch;
this.meta32856 = meta32856;
this._ = _;
this.fn1 = fn1;
this.meta32859 = meta32859;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32858.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){
return (function (_32860,meta32859__$1){
var self__ = this;
var _32860__$1 = this;
return (new cljs.core.async.t_cljs$core$async32858(self__.f,self__.ch,self__.meta32856,self__._,self__.fn1,meta32859__$1));
});})(___$1))
;

cljs.core.async.t_cljs$core$async32858.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){
return (function (_32860){
var self__ = this;
var _32860__$1 = this;
return self__.meta32859;
});})(___$1))
;

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

cljs.core.async.t_cljs$core$async32858.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$async32858.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$async32858.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__32848_SHARP_){
return f1.call(null,(((p1__32848_SHARP_ == null))?null:self__.f.call(null,p1__32848_SHARP_)));
});
;})(f1,___$2,___$1))
});})(___$1))
;

cljs.core.async.t_cljs$core$async32858.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,"meta32856","meta32856",-1582388899,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$async32855","cljs.core.async/t_cljs$core$async32855",1325700227,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta32859","meta32859",-534813370,null)], null);
});})(___$1))
;

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

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

cljs.core.async.t_cljs$core$async32858.cljs$lang$ctorPrWriter = ((function (___$1){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32858");
});})(___$1))
;

cljs.core.async.__GT_t_cljs$core$async32858 = ((function (___$1){
return (function cljs$core$async$map_LT__$___GT_t_cljs$core$async32858(f__$1,ch__$1,meta32856__$1,___$2,fn1__$1,meta32859){
return (new cljs.core.async.t_cljs$core$async32858(f__$1,ch__$1,meta32856__$1,___$2,fn1__$1,meta32859));
});})(___$1))
;

}

return (new cljs.core.async.t_cljs$core$async32858(self__.f,self__.ch,self__.meta32856,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__23326__auto__ = ret;
if(cljs.core.truth_(and__23326__auto__)){
return !((cljs.core.deref.call(null,ret) == null));
} else {
return and__23326__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$async32855.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32855.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$async32855.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,"meta32856","meta32856",-1582388899,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async32855.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32855");
});

cljs.core.async.__GT_t_cljs$core$async32855 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async32855(f__$1,ch__$1,meta32856){
return (new cljs.core.async.t_cljs$core$async32855(f__$1,ch__$1,meta32856));
});

}

return (new cljs.core.async.t_cljs$core$async32855(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$async32864 !== '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$async32864 = (function (f,ch,meta32865){
this.f = f;
this.ch = ch;
this.meta32865 = meta32865;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32864.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_32866,meta32865__$1){
var self__ = this;
var _32866__$1 = this;
return (new cljs.core.async.t_cljs$core$async32864(self__.f,self__.ch,meta32865__$1));
});

cljs.core.async.t_cljs$core$async32864.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_32866){
var self__ = this;
var _32866__$1 = this;
return self__.meta32865;
});

cljs.core.async.t_cljs$core$async32864.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32864.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$async32864.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32864.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$async32864.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32864.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$async32864.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,"meta32865","meta32865",721459185,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async32864.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32864");
});

cljs.core.async.__GT_t_cljs$core$async32864 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async32864(f__$1,ch__$1,meta32865){
return (new cljs.core.async.t_cljs$core$async32864(f__$1,ch__$1,meta32865));
});

}

return (new cljs.core.async.t_cljs$core$async32864(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$async32870 !== '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$async32870 = (function (p,ch,meta32871){
this.p = p;
this.ch = ch;
this.meta32871 = meta32871;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async32870.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_32872,meta32871__$1){
var self__ = this;
var _32872__$1 = this;
return (new cljs.core.async.t_cljs$core$async32870(self__.p,self__.ch,meta32871__$1));
});

cljs.core.async.t_cljs$core$async32870.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_32872){
var self__ = this;
var _32872__$1 = this;
return self__.meta32871;
});

cljs.core.async.t_cljs$core$async32870.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32870.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$async32870.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$async32870.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32870.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$async32870.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async32870.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$async32870.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,"meta32871","meta32871",116728758,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async32870.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async32870");
});

cljs.core.async.__GT_t_cljs$core$async32870 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async32870(p__$1,ch__$1,meta32871){
return (new cljs.core.async.t_cljs$core$async32870(p__$1,ch__$1,meta32871));
});

}

return (new cljs.core.async.t_cljs$core$async32870(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 args32873 = [];
var len__24559__auto___32917 = arguments.length;
var i__24560__auto___32918 = (0);
while(true){
if((i__24560__auto___32918 < len__24559__auto___32917)){
args32873.push((arguments[i__24560__auto___32918]));

var G__32919 = (i__24560__auto___32918 + (1));
i__24560__auto___32918 = G__32919;
continue;
} else {
}
break;
}

var G__32875 = args32873.length;
switch (G__32875) {
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(args32873.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__30600__auto___32921 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___32921,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___32921,out){
return (function (state_32896){
var state_val_32897 = (state_32896[(1)]);
if((state_val_32897 === (7))){
var inst_32892 = (state_32896[(2)]);
var state_32896__$1 = state_32896;
var statearr_32898_32922 = state_32896__$1;
(statearr_32898_32922[(2)] = inst_32892);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (1))){
var state_32896__$1 = state_32896;
var statearr_32899_32923 = state_32896__$1;
(statearr_32899_32923[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (4))){
var inst_32878 = (state_32896[(7)]);
var inst_32878__$1 = (state_32896[(2)]);
var inst_32879 = (inst_32878__$1 == null);
var state_32896__$1 = (function (){var statearr_32900 = state_32896;
(statearr_32900[(7)] = inst_32878__$1);

return statearr_32900;
})();
if(cljs.core.truth_(inst_32879)){
var statearr_32901_32924 = state_32896__$1;
(statearr_32901_32924[(1)] = (5));

} else {
var statearr_32902_32925 = state_32896__$1;
(statearr_32902_32925[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (6))){
var inst_32878 = (state_32896[(7)]);
var inst_32883 = p.call(null,inst_32878);
var state_32896__$1 = state_32896;
if(cljs.core.truth_(inst_32883)){
var statearr_32903_32926 = state_32896__$1;
(statearr_32903_32926[(1)] = (8));

} else {
var statearr_32904_32927 = state_32896__$1;
(statearr_32904_32927[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (3))){
var inst_32894 = (state_32896[(2)]);
var state_32896__$1 = state_32896;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_32896__$1,inst_32894);
} else {
if((state_val_32897 === (2))){
var state_32896__$1 = state_32896;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_32896__$1,(4),ch);
} else {
if((state_val_32897 === (11))){
var inst_32886 = (state_32896[(2)]);
var state_32896__$1 = state_32896;
var statearr_32905_32928 = state_32896__$1;
(statearr_32905_32928[(2)] = inst_32886);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (9))){
var state_32896__$1 = state_32896;
var statearr_32906_32929 = state_32896__$1;
(statearr_32906_32929[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (5))){
var inst_32881 = cljs.core.async.close_BANG_.call(null,out);
var state_32896__$1 = state_32896;
var statearr_32907_32930 = state_32896__$1;
(statearr_32907_32930[(2)] = inst_32881);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (10))){
var inst_32889 = (state_32896[(2)]);
var state_32896__$1 = (function (){var statearr_32908 = state_32896;
(statearr_32908[(8)] = inst_32889);

return statearr_32908;
})();
var statearr_32909_32931 = state_32896__$1;
(statearr_32909_32931[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_32897 === (8))){
var inst_32878 = (state_32896[(7)]);
var state_32896__$1 = state_32896;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_32896__$1,(11),out,inst_32878);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___32921,out))
;
return ((function (switch__30486__auto__,c__30600__auto___32921,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_32913 = [null,null,null,null,null,null,null,null,null];
(statearr_32913[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_32913[(1)] = (1));

return statearr_32913;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_32896){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_32896);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e32914){if((e32914 instanceof Object)){
var ex__30490__auto__ = e32914;
var statearr_32915_32932 = state_32896;
(statearr_32915_32932[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__32933 = state_32896;
state_32896 = G__32933;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_32896){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_32896);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___32921,out))
})();
var state__30602__auto__ = (function (){var statearr_32916 = f__30601__auto__.call(null);
(statearr_32916[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___32921);

return statearr_32916;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___32921,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 args32934 = [];
var len__24559__auto___32937 = arguments.length;
var i__24560__auto___32938 = (0);
while(true){
if((i__24560__auto___32938 < len__24559__auto___32937)){
args32934.push((arguments[i__24560__auto___32938]));

var G__32939 = (i__24560__auto___32938 + (1));
i__24560__auto___32938 = G__32939;
continue;
} else {
}
break;
}

var G__32936 = args32934.length;
switch (G__32936) {
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(args32934.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__30600__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto__){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto__){
return (function (state_33106){
var state_val_33107 = (state_33106[(1)]);
if((state_val_33107 === (7))){
var inst_33102 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
var statearr_33108_33149 = state_33106__$1;
(statearr_33108_33149[(2)] = inst_33102);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (20))){
var inst_33072 = (state_33106[(7)]);
var inst_33083 = (state_33106[(2)]);
var inst_33084 = cljs.core.next.call(null,inst_33072);
var inst_33058 = inst_33084;
var inst_33059 = null;
var inst_33060 = (0);
var inst_33061 = (0);
var state_33106__$1 = (function (){var statearr_33109 = state_33106;
(statearr_33109[(8)] = inst_33061);

(statearr_33109[(9)] = inst_33083);

(statearr_33109[(10)] = inst_33060);

(statearr_33109[(11)] = inst_33059);

(statearr_33109[(12)] = inst_33058);

return statearr_33109;
})();
var statearr_33110_33150 = state_33106__$1;
(statearr_33110_33150[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (1))){
var state_33106__$1 = state_33106;
var statearr_33111_33151 = state_33106__$1;
(statearr_33111_33151[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (4))){
var inst_33047 = (state_33106[(13)]);
var inst_33047__$1 = (state_33106[(2)]);
var inst_33048 = (inst_33047__$1 == null);
var state_33106__$1 = (function (){var statearr_33112 = state_33106;
(statearr_33112[(13)] = inst_33047__$1);

return statearr_33112;
})();
if(cljs.core.truth_(inst_33048)){
var statearr_33113_33152 = state_33106__$1;
(statearr_33113_33152[(1)] = (5));

} else {
var statearr_33114_33153 = state_33106__$1;
(statearr_33114_33153[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (15))){
var state_33106__$1 = state_33106;
var statearr_33118_33154 = state_33106__$1;
(statearr_33118_33154[(2)] = null);

(statearr_33118_33154[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (21))){
var state_33106__$1 = state_33106;
var statearr_33119_33155 = state_33106__$1;
(statearr_33119_33155[(2)] = null);

(statearr_33119_33155[(1)] = (23));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (13))){
var inst_33061 = (state_33106[(8)]);
var inst_33060 = (state_33106[(10)]);
var inst_33059 = (state_33106[(11)]);
var inst_33058 = (state_33106[(12)]);
var inst_33068 = (state_33106[(2)]);
var inst_33069 = (inst_33061 + (1));
var tmp33115 = inst_33060;
var tmp33116 = inst_33059;
var tmp33117 = inst_33058;
var inst_33058__$1 = tmp33117;
var inst_33059__$1 = tmp33116;
var inst_33060__$1 = tmp33115;
var inst_33061__$1 = inst_33069;
var state_33106__$1 = (function (){var statearr_33120 = state_33106;
(statearr_33120[(8)] = inst_33061__$1);

(statearr_33120[(14)] = inst_33068);

(statearr_33120[(10)] = inst_33060__$1);

(statearr_33120[(11)] = inst_33059__$1);

(statearr_33120[(12)] = inst_33058__$1);

return statearr_33120;
})();
var statearr_33121_33156 = state_33106__$1;
(statearr_33121_33156[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (22))){
var state_33106__$1 = state_33106;
var statearr_33122_33157 = state_33106__$1;
(statearr_33122_33157[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (6))){
var inst_33047 = (state_33106[(13)]);
var inst_33056 = f.call(null,inst_33047);
var inst_33057 = cljs.core.seq.call(null,inst_33056);
var inst_33058 = inst_33057;
var inst_33059 = null;
var inst_33060 = (0);
var inst_33061 = (0);
var state_33106__$1 = (function (){var statearr_33123 = state_33106;
(statearr_33123[(8)] = inst_33061);

(statearr_33123[(10)] = inst_33060);

(statearr_33123[(11)] = inst_33059);

(statearr_33123[(12)] = inst_33058);

return statearr_33123;
})();
var statearr_33124_33158 = state_33106__$1;
(statearr_33124_33158[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (17))){
var inst_33072 = (state_33106[(7)]);
var inst_33076 = cljs.core.chunk_first.call(null,inst_33072);
var inst_33077 = cljs.core.chunk_rest.call(null,inst_33072);
var inst_33078 = cljs.core.count.call(null,inst_33076);
var inst_33058 = inst_33077;
var inst_33059 = inst_33076;
var inst_33060 = inst_33078;
var inst_33061 = (0);
var state_33106__$1 = (function (){var statearr_33125 = state_33106;
(statearr_33125[(8)] = inst_33061);

(statearr_33125[(10)] = inst_33060);

(statearr_33125[(11)] = inst_33059);

(statearr_33125[(12)] = inst_33058);

return statearr_33125;
})();
var statearr_33126_33159 = state_33106__$1;
(statearr_33126_33159[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (3))){
var inst_33104 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_33106__$1,inst_33104);
} else {
if((state_val_33107 === (12))){
var inst_33092 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
var statearr_33127_33160 = state_33106__$1;
(statearr_33127_33160[(2)] = inst_33092);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (2))){
var state_33106__$1 = state_33106;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_33106__$1,(4),in$);
} else {
if((state_val_33107 === (23))){
var inst_33100 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
var statearr_33128_33161 = state_33106__$1;
(statearr_33128_33161[(2)] = inst_33100);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (19))){
var inst_33087 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
var statearr_33129_33162 = state_33106__$1;
(statearr_33129_33162[(2)] = inst_33087);

(statearr_33129_33162[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (11))){
var inst_33058 = (state_33106[(12)]);
var inst_33072 = (state_33106[(7)]);
var inst_33072__$1 = cljs.core.seq.call(null,inst_33058);
var state_33106__$1 = (function (){var statearr_33130 = state_33106;
(statearr_33130[(7)] = inst_33072__$1);

return statearr_33130;
})();
if(inst_33072__$1){
var statearr_33131_33163 = state_33106__$1;
(statearr_33131_33163[(1)] = (14));

} else {
var statearr_33132_33164 = state_33106__$1;
(statearr_33132_33164[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (9))){
var inst_33094 = (state_33106[(2)]);
var inst_33095 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out);
var state_33106__$1 = (function (){var statearr_33133 = state_33106;
(statearr_33133[(15)] = inst_33094);

return statearr_33133;
})();
if(cljs.core.truth_(inst_33095)){
var statearr_33134_33165 = state_33106__$1;
(statearr_33134_33165[(1)] = (21));

} else {
var statearr_33135_33166 = state_33106__$1;
(statearr_33135_33166[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (5))){
var inst_33050 = cljs.core.async.close_BANG_.call(null,out);
var state_33106__$1 = state_33106;
var statearr_33136_33167 = state_33106__$1;
(statearr_33136_33167[(2)] = inst_33050);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (14))){
var inst_33072 = (state_33106[(7)]);
var inst_33074 = cljs.core.chunked_seq_QMARK_.call(null,inst_33072);
var state_33106__$1 = state_33106;
if(inst_33074){
var statearr_33137_33168 = state_33106__$1;
(statearr_33137_33168[(1)] = (17));

} else {
var statearr_33138_33169 = state_33106__$1;
(statearr_33138_33169[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (16))){
var inst_33090 = (state_33106[(2)]);
var state_33106__$1 = state_33106;
var statearr_33139_33170 = state_33106__$1;
(statearr_33139_33170[(2)] = inst_33090);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33107 === (10))){
var inst_33061 = (state_33106[(8)]);
var inst_33059 = (state_33106[(11)]);
var inst_33066 = cljs.core._nth.call(null,inst_33059,inst_33061);
var state_33106__$1 = state_33106;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33106__$1,(13),out,inst_33066);
} else {
if((state_val_33107 === (18))){
var inst_33072 = (state_33106[(7)]);
var inst_33081 = cljs.core.first.call(null,inst_33072);
var state_33106__$1 = state_33106;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33106__$1,(20),out,inst_33081);
} else {
if((state_val_33107 === (8))){
var inst_33061 = (state_33106[(8)]);
var inst_33060 = (state_33106[(10)]);
var inst_33063 = (inst_33061 < inst_33060);
var inst_33064 = inst_33063;
var state_33106__$1 = state_33106;
if(cljs.core.truth_(inst_33064)){
var statearr_33140_33171 = state_33106__$1;
(statearr_33140_33171[(1)] = (10));

} else {
var statearr_33141_33172 = state_33106__$1;
(statearr_33141_33172[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto__))
;
return ((function (switch__30486__auto__,c__30600__auto__){
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____0 = (function (){
var statearr_33145 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_33145[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__);

(statearr_33145[(1)] = (1));

return statearr_33145;
});
var cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____1 = (function (state_33106){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_33106);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e33146){if((e33146 instanceof Object)){
var ex__30490__auto__ = e33146;
var statearr_33147_33173 = state_33106;
(statearr_33147_33173[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__33174 = state_33106;
state_33106 = G__33174;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__ = function(state_33106){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____1.call(this,state_33106);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__30487__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto__))
})();
var state__30602__auto__ = (function (){var statearr_33148 = f__30601__auto__.call(null);
(statearr_33148[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto__);

return statearr_33148;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto__))
);

return c__30600__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var args33175 = [];
var len__24559__auto___33178 = arguments.length;
var i__24560__auto___33179 = (0);
while(true){
if((i__24560__auto___33179 < len__24559__auto___33178)){
args33175.push((arguments[i__24560__auto___33179]));

var G__33180 = (i__24560__auto___33179 + (1));
i__24560__auto___33179 = G__33180;
continue;
} else {
}
break;
}

var G__33177 = args33175.length;
switch (G__33177) {
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(args33175.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 args33182 = [];
var len__24559__auto___33185 = arguments.length;
var i__24560__auto___33186 = (0);
while(true){
if((i__24560__auto___33186 < len__24559__auto___33185)){
args33182.push((arguments[i__24560__auto___33186]));

var G__33187 = (i__24560__auto___33186 + (1));
i__24560__auto___33186 = G__33187;
continue;
} else {
}
break;
}

var G__33184 = args33182.length;
switch (G__33184) {
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(args33182.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 args33189 = [];
var len__24559__auto___33240 = arguments.length;
var i__24560__auto___33241 = (0);
while(true){
if((i__24560__auto___33241 < len__24559__auto___33240)){
args33189.push((arguments[i__24560__auto___33241]));

var G__33242 = (i__24560__auto___33241 + (1));
i__24560__auto___33241 = G__33242;
continue;
} else {
}
break;
}

var G__33191 = args33189.length;
switch (G__33191) {
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(args33189.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__30600__auto___33244 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___33244,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___33244,out){
return (function (state_33215){
var state_val_33216 = (state_33215[(1)]);
if((state_val_33216 === (7))){
var inst_33210 = (state_33215[(2)]);
var state_33215__$1 = state_33215;
var statearr_33217_33245 = state_33215__$1;
(statearr_33217_33245[(2)] = inst_33210);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (1))){
var inst_33192 = null;
var state_33215__$1 = (function (){var statearr_33218 = state_33215;
(statearr_33218[(7)] = inst_33192);

return statearr_33218;
})();
var statearr_33219_33246 = state_33215__$1;
(statearr_33219_33246[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (4))){
var inst_33195 = (state_33215[(8)]);
var inst_33195__$1 = (state_33215[(2)]);
var inst_33196 = (inst_33195__$1 == null);
var inst_33197 = cljs.core.not.call(null,inst_33196);
var state_33215__$1 = (function (){var statearr_33220 = state_33215;
(statearr_33220[(8)] = inst_33195__$1);

return statearr_33220;
})();
if(inst_33197){
var statearr_33221_33247 = state_33215__$1;
(statearr_33221_33247[(1)] = (5));

} else {
var statearr_33222_33248 = state_33215__$1;
(statearr_33222_33248[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (6))){
var state_33215__$1 = state_33215;
var statearr_33223_33249 = state_33215__$1;
(statearr_33223_33249[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (3))){
var inst_33212 = (state_33215[(2)]);
var inst_33213 = cljs.core.async.close_BANG_.call(null,out);
var state_33215__$1 = (function (){var statearr_33224 = state_33215;
(statearr_33224[(9)] = inst_33212);

return statearr_33224;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_33215__$1,inst_33213);
} else {
if((state_val_33216 === (2))){
var state_33215__$1 = state_33215;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_33215__$1,(4),ch);
} else {
if((state_val_33216 === (11))){
var inst_33195 = (state_33215[(8)]);
var inst_33204 = (state_33215[(2)]);
var inst_33192 = inst_33195;
var state_33215__$1 = (function (){var statearr_33225 = state_33215;
(statearr_33225[(7)] = inst_33192);

(statearr_33225[(10)] = inst_33204);

return statearr_33225;
})();
var statearr_33226_33250 = state_33215__$1;
(statearr_33226_33250[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (9))){
var inst_33195 = (state_33215[(8)]);
var state_33215__$1 = state_33215;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33215__$1,(11),out,inst_33195);
} else {
if((state_val_33216 === (5))){
var inst_33192 = (state_33215[(7)]);
var inst_33195 = (state_33215[(8)]);
var inst_33199 = cljs.core._EQ_.call(null,inst_33195,inst_33192);
var state_33215__$1 = state_33215;
if(inst_33199){
var statearr_33228_33251 = state_33215__$1;
(statearr_33228_33251[(1)] = (8));

} else {
var statearr_33229_33252 = state_33215__$1;
(statearr_33229_33252[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (10))){
var inst_33207 = (state_33215[(2)]);
var state_33215__$1 = state_33215;
var statearr_33230_33253 = state_33215__$1;
(statearr_33230_33253[(2)] = inst_33207);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33216 === (8))){
var inst_33192 = (state_33215[(7)]);
var tmp33227 = inst_33192;
var inst_33192__$1 = tmp33227;
var state_33215__$1 = (function (){var statearr_33231 = state_33215;
(statearr_33231[(7)] = inst_33192__$1);

return statearr_33231;
})();
var statearr_33232_33254 = state_33215__$1;
(statearr_33232_33254[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___33244,out))
;
return ((function (switch__30486__auto__,c__30600__auto___33244,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_33236 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_33236[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_33236[(1)] = (1));

return statearr_33236;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_33215){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_33215);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e33237){if((e33237 instanceof Object)){
var ex__30490__auto__ = e33237;
var statearr_33238_33255 = state_33215;
(statearr_33238_33255[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__33256 = state_33215;
state_33215 = G__33256;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_33215){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_33215);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___33244,out))
})();
var state__30602__auto__ = (function (){var statearr_33239 = f__30601__auto__.call(null);
(statearr_33239[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___33244);

return statearr_33239;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___33244,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 args33257 = [];
var len__24559__auto___33327 = arguments.length;
var i__24560__auto___33328 = (0);
while(true){
if((i__24560__auto___33328 < len__24559__auto___33327)){
args33257.push((arguments[i__24560__auto___33328]));

var G__33329 = (i__24560__auto___33328 + (1));
i__24560__auto___33328 = G__33329;
continue;
} else {
}
break;
}

var G__33259 = args33257.length;
switch (G__33259) {
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(args33257.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__30600__auto___33331 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___33331,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___33331,out){
return (function (state_33297){
var state_val_33298 = (state_33297[(1)]);
if((state_val_33298 === (7))){
var inst_33293 = (state_33297[(2)]);
var state_33297__$1 = state_33297;
var statearr_33299_33332 = state_33297__$1;
(statearr_33299_33332[(2)] = inst_33293);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (1))){
var inst_33260 = (new Array(n));
var inst_33261 = inst_33260;
var inst_33262 = (0);
var state_33297__$1 = (function (){var statearr_33300 = state_33297;
(statearr_33300[(7)] = inst_33262);

(statearr_33300[(8)] = inst_33261);

return statearr_33300;
})();
var statearr_33301_33333 = state_33297__$1;
(statearr_33301_33333[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (4))){
var inst_33265 = (state_33297[(9)]);
var inst_33265__$1 = (state_33297[(2)]);
var inst_33266 = (inst_33265__$1 == null);
var inst_33267 = cljs.core.not.call(null,inst_33266);
var state_33297__$1 = (function (){var statearr_33302 = state_33297;
(statearr_33302[(9)] = inst_33265__$1);

return statearr_33302;
})();
if(inst_33267){
var statearr_33303_33334 = state_33297__$1;
(statearr_33303_33334[(1)] = (5));

} else {
var statearr_33304_33335 = state_33297__$1;
(statearr_33304_33335[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (15))){
var inst_33287 = (state_33297[(2)]);
var state_33297__$1 = state_33297;
var statearr_33305_33336 = state_33297__$1;
(statearr_33305_33336[(2)] = inst_33287);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (13))){
var state_33297__$1 = state_33297;
var statearr_33306_33337 = state_33297__$1;
(statearr_33306_33337[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (6))){
var inst_33262 = (state_33297[(7)]);
var inst_33283 = (inst_33262 > (0));
var state_33297__$1 = state_33297;
if(cljs.core.truth_(inst_33283)){
var statearr_33307_33338 = state_33297__$1;
(statearr_33307_33338[(1)] = (12));

} else {
var statearr_33308_33339 = state_33297__$1;
(statearr_33308_33339[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (3))){
var inst_33295 = (state_33297[(2)]);
var state_33297__$1 = state_33297;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_33297__$1,inst_33295);
} else {
if((state_val_33298 === (12))){
var inst_33261 = (state_33297[(8)]);
var inst_33285 = cljs.core.vec.call(null,inst_33261);
var state_33297__$1 = state_33297;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33297__$1,(15),out,inst_33285);
} else {
if((state_val_33298 === (2))){
var state_33297__$1 = state_33297;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_33297__$1,(4),ch);
} else {
if((state_val_33298 === (11))){
var inst_33277 = (state_33297[(2)]);
var inst_33278 = (new Array(n));
var inst_33261 = inst_33278;
var inst_33262 = (0);
var state_33297__$1 = (function (){var statearr_33309 = state_33297;
(statearr_33309[(10)] = inst_33277);

(statearr_33309[(7)] = inst_33262);

(statearr_33309[(8)] = inst_33261);

return statearr_33309;
})();
var statearr_33310_33340 = state_33297__$1;
(statearr_33310_33340[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (9))){
var inst_33261 = (state_33297[(8)]);
var inst_33275 = cljs.core.vec.call(null,inst_33261);
var state_33297__$1 = state_33297;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33297__$1,(11),out,inst_33275);
} else {
if((state_val_33298 === (5))){
var inst_33270 = (state_33297[(11)]);
var inst_33262 = (state_33297[(7)]);
var inst_33265 = (state_33297[(9)]);
var inst_33261 = (state_33297[(8)]);
var inst_33269 = (inst_33261[inst_33262] = inst_33265);
var inst_33270__$1 = (inst_33262 + (1));
var inst_33271 = (inst_33270__$1 < n);
var state_33297__$1 = (function (){var statearr_33311 = state_33297;
(statearr_33311[(12)] = inst_33269);

(statearr_33311[(11)] = inst_33270__$1);

return statearr_33311;
})();
if(cljs.core.truth_(inst_33271)){
var statearr_33312_33341 = state_33297__$1;
(statearr_33312_33341[(1)] = (8));

} else {
var statearr_33313_33342 = state_33297__$1;
(statearr_33313_33342[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (14))){
var inst_33290 = (state_33297[(2)]);
var inst_33291 = cljs.core.async.close_BANG_.call(null,out);
var state_33297__$1 = (function (){var statearr_33315 = state_33297;
(statearr_33315[(13)] = inst_33290);

return statearr_33315;
})();
var statearr_33316_33343 = state_33297__$1;
(statearr_33316_33343[(2)] = inst_33291);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (10))){
var inst_33281 = (state_33297[(2)]);
var state_33297__$1 = state_33297;
var statearr_33317_33344 = state_33297__$1;
(statearr_33317_33344[(2)] = inst_33281);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33298 === (8))){
var inst_33270 = (state_33297[(11)]);
var inst_33261 = (state_33297[(8)]);
var tmp33314 = inst_33261;
var inst_33261__$1 = tmp33314;
var inst_33262 = inst_33270;
var state_33297__$1 = (function (){var statearr_33318 = state_33297;
(statearr_33318[(7)] = inst_33262);

(statearr_33318[(8)] = inst_33261__$1);

return statearr_33318;
})();
var statearr_33319_33345 = state_33297__$1;
(statearr_33319_33345[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___33331,out))
;
return ((function (switch__30486__auto__,c__30600__auto___33331,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_33323 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_33323[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_33323[(1)] = (1));

return statearr_33323;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_33297){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_33297);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e33324){if((e33324 instanceof Object)){
var ex__30490__auto__ = e33324;
var statearr_33325_33346 = state_33297;
(statearr_33325_33346[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__33347 = state_33297;
state_33297 = G__33347;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_33297){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_33297);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___33331,out))
})();
var state__30602__auto__ = (function (){var statearr_33326 = f__30601__auto__.call(null);
(statearr_33326[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___33331);

return statearr_33326;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___33331,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 args33348 = [];
var len__24559__auto___33422 = arguments.length;
var i__24560__auto___33423 = (0);
while(true){
if((i__24560__auto___33423 < len__24559__auto___33422)){
args33348.push((arguments[i__24560__auto___33423]));

var G__33424 = (i__24560__auto___33423 + (1));
i__24560__auto___33423 = G__33424;
continue;
} else {
}
break;
}

var G__33350 = args33348.length;
switch (G__33350) {
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(args33348.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__30600__auto___33426 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__30600__auto___33426,out){
return (function (){
var f__30601__auto__ = (function (){var switch__30486__auto__ = ((function (c__30600__auto___33426,out){
return (function (state_33392){
var state_val_33393 = (state_33392[(1)]);
if((state_val_33393 === (7))){
var inst_33388 = (state_33392[(2)]);
var state_33392__$1 = state_33392;
var statearr_33394_33427 = state_33392__$1;
(statearr_33394_33427[(2)] = inst_33388);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (1))){
var inst_33351 = [];
var inst_33352 = inst_33351;
var inst_33353 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_33392__$1 = (function (){var statearr_33395 = state_33392;
(statearr_33395[(7)] = inst_33353);

(statearr_33395[(8)] = inst_33352);

return statearr_33395;
})();
var statearr_33396_33428 = state_33392__$1;
(statearr_33396_33428[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (4))){
var inst_33356 = (state_33392[(9)]);
var inst_33356__$1 = (state_33392[(2)]);
var inst_33357 = (inst_33356__$1 == null);
var inst_33358 = cljs.core.not.call(null,inst_33357);
var state_33392__$1 = (function (){var statearr_33397 = state_33392;
(statearr_33397[(9)] = inst_33356__$1);

return statearr_33397;
})();
if(inst_33358){
var statearr_33398_33429 = state_33392__$1;
(statearr_33398_33429[(1)] = (5));

} else {
var statearr_33399_33430 = state_33392__$1;
(statearr_33399_33430[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (15))){
var inst_33382 = (state_33392[(2)]);
var state_33392__$1 = state_33392;
var statearr_33400_33431 = state_33392__$1;
(statearr_33400_33431[(2)] = inst_33382);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (13))){
var state_33392__$1 = state_33392;
var statearr_33401_33432 = state_33392__$1;
(statearr_33401_33432[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (6))){
var inst_33352 = (state_33392[(8)]);
var inst_33377 = inst_33352.length;
var inst_33378 = (inst_33377 > (0));
var state_33392__$1 = state_33392;
if(cljs.core.truth_(inst_33378)){
var statearr_33402_33433 = state_33392__$1;
(statearr_33402_33433[(1)] = (12));

} else {
var statearr_33403_33434 = state_33392__$1;
(statearr_33403_33434[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (3))){
var inst_33390 = (state_33392[(2)]);
var state_33392__$1 = state_33392;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_33392__$1,inst_33390);
} else {
if((state_val_33393 === (12))){
var inst_33352 = (state_33392[(8)]);
var inst_33380 = cljs.core.vec.call(null,inst_33352);
var state_33392__$1 = state_33392;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33392__$1,(15),out,inst_33380);
} else {
if((state_val_33393 === (2))){
var state_33392__$1 = state_33392;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_33392__$1,(4),ch);
} else {
if((state_val_33393 === (11))){
var inst_33356 = (state_33392[(9)]);
var inst_33360 = (state_33392[(10)]);
var inst_33370 = (state_33392[(2)]);
var inst_33371 = [];
var inst_33372 = inst_33371.push(inst_33356);
var inst_33352 = inst_33371;
var inst_33353 = inst_33360;
var state_33392__$1 = (function (){var statearr_33404 = state_33392;
(statearr_33404[(7)] = inst_33353);

(statearr_33404[(11)] = inst_33372);

(statearr_33404[(8)] = inst_33352);

(statearr_33404[(12)] = inst_33370);

return statearr_33404;
})();
var statearr_33405_33435 = state_33392__$1;
(statearr_33405_33435[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (9))){
var inst_33352 = (state_33392[(8)]);
var inst_33368 = cljs.core.vec.call(null,inst_33352);
var state_33392__$1 = state_33392;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_33392__$1,(11),out,inst_33368);
} else {
if((state_val_33393 === (5))){
var inst_33356 = (state_33392[(9)]);
var inst_33353 = (state_33392[(7)]);
var inst_33360 = (state_33392[(10)]);
var inst_33360__$1 = f.call(null,inst_33356);
var inst_33361 = cljs.core._EQ_.call(null,inst_33360__$1,inst_33353);
var inst_33362 = cljs.core.keyword_identical_QMARK_.call(null,inst_33353,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var inst_33363 = (inst_33361) || (inst_33362);
var state_33392__$1 = (function (){var statearr_33406 = state_33392;
(statearr_33406[(10)] = inst_33360__$1);

return statearr_33406;
})();
if(cljs.core.truth_(inst_33363)){
var statearr_33407_33436 = state_33392__$1;
(statearr_33407_33436[(1)] = (8));

} else {
var statearr_33408_33437 = state_33392__$1;
(statearr_33408_33437[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (14))){
var inst_33385 = (state_33392[(2)]);
var inst_33386 = cljs.core.async.close_BANG_.call(null,out);
var state_33392__$1 = (function (){var statearr_33410 = state_33392;
(statearr_33410[(13)] = inst_33385);

return statearr_33410;
})();
var statearr_33411_33438 = state_33392__$1;
(statearr_33411_33438[(2)] = inst_33386);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (10))){
var inst_33375 = (state_33392[(2)]);
var state_33392__$1 = state_33392;
var statearr_33412_33439 = state_33392__$1;
(statearr_33412_33439[(2)] = inst_33375);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_33393 === (8))){
var inst_33356 = (state_33392[(9)]);
var inst_33360 = (state_33392[(10)]);
var inst_33352 = (state_33392[(8)]);
var inst_33365 = inst_33352.push(inst_33356);
var tmp33409 = inst_33352;
var inst_33352__$1 = tmp33409;
var inst_33353 = inst_33360;
var state_33392__$1 = (function (){var statearr_33413 = state_33392;
(statearr_33413[(7)] = inst_33353);

(statearr_33413[(8)] = inst_33352__$1);

(statearr_33413[(14)] = inst_33365);

return statearr_33413;
})();
var statearr_33414_33440 = state_33392__$1;
(statearr_33414_33440[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__30600__auto___33426,out))
;
return ((function (switch__30486__auto__,c__30600__auto___33426,out){
return (function() {
var cljs$core$async$state_machine__30487__auto__ = null;
var cljs$core$async$state_machine__30487__auto____0 = (function (){
var statearr_33418 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_33418[(0)] = cljs$core$async$state_machine__30487__auto__);

(statearr_33418[(1)] = (1));

return statearr_33418;
});
var cljs$core$async$state_machine__30487__auto____1 = (function (state_33392){
while(true){
var ret_value__30488__auto__ = (function (){try{while(true){
var result__30489__auto__ = switch__30486__auto__.call(null,state_33392);
if(cljs.core.keyword_identical_QMARK_.call(null,result__30489__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__30489__auto__;
}
break;
}
}catch (e33419){if((e33419 instanceof Object)){
var ex__30490__auto__ = e33419;
var statearr_33420_33441 = state_33392;
(statearr_33420_33441[(5)] = ex__30490__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__30488__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__33442 = state_33392;
state_33392 = G__33442;
continue;
} else {
return ret_value__30488__auto__;
}
break;
}
});
cljs$core$async$state_machine__30487__auto__ = function(state_33392){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__30487__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__30487__auto____1.call(this,state_33392);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__30487__auto____0;
cljs$core$async$state_machine__30487__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__30487__auto____1;
return cljs$core$async$state_machine__30487__auto__;
})()
;})(switch__30486__auto__,c__30600__auto___33426,out))
})();
var state__30602__auto__ = (function (){var statearr_33421 = f__30601__auto__.call(null);
(statearr_33421[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__30600__auto___33426);

return statearr_33421;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__30602__auto__);
});})(c__30600__auto___33426,out))
);


return out;
});

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

