goog.provide('cljs.core.async');
goog.scope(function(){
  cljs.core.async.goog$module$goog$array = goog.module.get('goog.array');
});

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

(cljs.core.async.t_cljs$core$async15792.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_15794){
var self__ = this;
var _15794__$1 = this;
return self__.meta15793;
}));

(cljs.core.async.t_cljs$core$async15792.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async15792.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$async15792.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$async15792.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$async15792.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,"meta15793","meta15793",1884241342,null)], null);
}));

(cljs.core.async.t_cljs$core$async15792.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async15792.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async15792");

(cljs.core.async.t_cljs$core$async15792.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async15792");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async15792.
 */
cljs.core.async.__GT_t_cljs$core$async15792 = (function cljs$core$async$__GT_t_cljs$core$async15792(f,blockable,meta15793){
return (new cljs.core.async.t_cljs$core$async15792(f,blockable,meta15793));
});


cljs.core.async.fn_handler = (function cljs$core$async$fn_handler(var_args){
var G__15780 = arguments.length;
switch (G__15780) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2 = (function (f,blockable){
return (new cljs.core.async.t_cljs$core$async15792(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(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(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(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_(cljs.core.async.impl.protocols.UnblockingBuffer,buff);
} else {
return false;
}
}
} else {
return cljs.core.native_satisfies_QMARK_(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 G__15825 = arguments.length;
switch (G__15825) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf_or_n){
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$3(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_.cljs$core$IFn$_invoke$arity$2(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(["Assert failed: ","buffer must be supplied when transducer is","\n","buf-or-n"].join('')));
}
} else {
}

return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3(((typeof buf_or_n__$1 === 'number')?cljs.core.async.buffer(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 G__15831 = arguments.length;
switch (G__15831) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

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

(cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2 = (function (xform,ex_handler){
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3(cljs.core.async.impl.buffers.promise_buffer(),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(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 G__15882 = arguments.length;
switch (G__15882) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,fn1){
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$3(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_(port,cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$1(fn1));
if(cljs.core.truth_(ret)){
var val_18779 = cljs.core.deref(ret);
if(cljs.core.truth_(on_caller_QMARK_)){
(fn1.cljs$core$IFn$_invoke$arity$1 ? fn1.cljs$core$IFn$_invoke$arity$1(val_18779) : fn1.call(null,val_18779));
} else {
cljs.core.async.impl.dispatch.run((function (){
return (fn1.cljs$core$IFn$_invoke$arity$1 ? fn1.cljs$core$IFn$_invoke$arity$1(val_18779) : fn1.call(null,val_18779));
}));
}
} 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.cljs$core$IFn$_invoke$arity$1(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 fn1 (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 fn1 on calling thread.  Returns nil.
 */
cljs.core.async.put_BANG_ = (function cljs$core$async$put_BANG_(var_args){
var G__15939 = arguments.length;
switch (G__15939) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,val){
var temp__5802__auto__ = cljs.core.async.impl.protocols.put_BANG_(port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5802__auto__)){
var ret = temp__5802__auto__;
return cljs.core.deref(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_.cljs$core$IFn$_invoke$arity$4(port,val,fn1,true);
}));

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

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_(port);
});
cljs.core.async.random_array = (function cljs$core$async$random_array(n){
var a = (new Array(n));
var n__5593__auto___18781 = n;
var x_18782 = (0);
while(true){
if((x_18782 < n__5593__auto___18781)){
(a[x_18782] = x_18782);

var G__18783 = (x_18782 + (1));
x_18782 = G__18783;
continue;
} else {
}
break;
}

cljs.core.async.goog$module$goog$array.shuffle(a);

return a;
});

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

(cljs.core.async.t_cljs$core$async15989.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_15991){
var self__ = this;
var _15991__$1 = this;
return self__.meta15990;
}));

(cljs.core.async.t_cljs$core$async15989.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async15989.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$async15989.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_(self__.flag,null);

return true;
}));

(cljs.core.async.t_cljs$core$async15989.getBasis = (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,"meta15990","meta15990",-1984919620,null)], null);
}));

(cljs.core.async.t_cljs$core$async15989.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async15989.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async15989");

(cljs.core.async.t_cljs$core$async15989.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async15989");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async15989.
 */
cljs.core.async.__GT_t_cljs$core$async15989 = (function cljs$core$async$__GT_t_cljs$core$async15989(flag,meta15990){
return (new cljs.core.async.t_cljs$core$async15989(flag,meta15990));
});


cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(true);
return (new cljs.core.async.t_cljs$core$async15989(flag,cljs.core.PersistentArrayMap.EMPTY));
});

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

(cljs.core.async.t_cljs$core$async16046.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_16048){
var self__ = this;
var _16048__$1 = this;
return self__.meta16047;
}));

(cljs.core.async.t_cljs$core$async16046.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async16046.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_(self__.flag);
}));

(cljs.core.async.t_cljs$core$async16046.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$async16046.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.async.impl.protocols.commit(self__.flag);

return self__.cb;
}));

(cljs.core.async.t_cljs$core$async16046.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,"meta16047","meta16047",-1379562318,null)], null);
}));

(cljs.core.async.t_cljs$core$async16046.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async16046.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async16046");

(cljs.core.async.t_cljs$core$async16046.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async16046");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async16046.
 */
cljs.core.async.__GT_t_cljs$core$async16046 = (function cljs$core$async$__GT_t_cljs$core$async16046(flag,cb,meta16047){
return (new cljs.core.async.t_cljs$core$async16046(flag,cb,meta16047));
});


cljs.core.async.alt_handler = (function cljs$core$async$alt_handler(flag,cb){
return (new cljs.core.async.t_cljs$core$async16046(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){
if((cljs.core.count(ports) > (0))){
} else {
throw (new Error(["Assert failed: ","alts must have at least one channel operation","\n","(pos? (count ports))"].join('')));
}

var flag = cljs.core.async.alt_flag();
var n = cljs.core.count(ports);
var idxs = cljs.core.async.random_array(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.cljs$core$IFn$_invoke$arity$2(ports,idx);
var wport = ((cljs.core.vector_QMARK_(port))?(port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((0)) : port.call(null,(0))):null);
var vbox = (cljs.core.truth_(wport)?(function (){var val = (port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((1)) : port.call(null,(1)));
return cljs.core.async.impl.protocols.put_BANG_(wport,val,cljs.core.async.alt_handler(flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){
return (function (p1__16091_SHARP_){
var G__16102 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__16091_SHARP_,wport], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__16102) : fret.call(null,G__16102));
});})(i,val,idx,port,wport,flag,n,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_(port,cljs.core.async.alt_handler(flag,((function (i,idx,port,wport,flag,n,idxs,priority){
return (function (p1__16093_SHARP_){
var G__16104 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__16093_SHARP_,port], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__16104) : fret.call(null,G__16104));
});})(i,idx,port,wport,flag,n,idxs,priority))
)));
if(cljs.core.truth_(vbox)){
return cljs.core.async.impl.channels.box(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref(vbox),(function (){var or__5002__auto__ = wport;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return port;
}
})()], null));
} else {
var G__18792 = (i + (1));
i = G__18792;
continue;
}
} else {
return null;
}
break;
}
})();
var or__5002__auto__ = ret;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
if(cljs.core.contains_QMARK_(opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5804__auto__ = (function (){var and__5000__auto__ = flag.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(cljs.core.truth_(and__5000__auto__)){
return flag.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5000__auto__;
}
})();
if(cljs.core.truth_(temp__5804__auto__)){
var got = temp__5804__auto__;
return cljs.core.async.impl.channels.box(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__5732__auto__ = [];
var len__5726__auto___18793 = arguments.length;
var i__5727__auto___18794 = (0);
while(true){
if((i__5727__auto___18794 < len__5726__auto___18793)){
args__5732__auto__.push((arguments[i__5727__auto___18794]));

var G__18795 = (i__5727__auto___18794 + (1));
i__5727__auto___18794 = G__18795;
continue;
} else {
}
break;
}

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

(cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__16115){
var map__16116 = p__16115;
var map__16116__$1 = cljs.core.__destructure_map(map__16116);
var opts = map__16116__$1;
throw (new Error("alts! used not in (go ...) block"));
}));

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

/** @this {Function} */
(cljs.core.async.alts_BANG_.cljs$lang$applyTo = (function (seq16109){
var G__16110 = cljs.core.first(seq16109);
var seq16109__$1 = cljs.core.next(seq16109);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__16110,seq16109__$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_(port,val,cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2(cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref(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_(port,cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2(cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref(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 G__16121 = arguments.length;
switch (G__16121) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__15554__auto___18800 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16157){
var state_val_16158 = (state_16157[(1)]);
if((state_val_16158 === (7))){
var inst_16153 = (state_16157[(2)]);
var state_16157__$1 = state_16157;
var statearr_16168_18805 = state_16157__$1;
(statearr_16168_18805[(2)] = inst_16153);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (1))){
var state_16157__$1 = state_16157;
var statearr_16169_18806 = state_16157__$1;
(statearr_16169_18806[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (4))){
var inst_16136 = (state_16157[(7)]);
var inst_16136__$1 = (state_16157[(2)]);
var inst_16137 = (inst_16136__$1 == null);
var state_16157__$1 = (function (){var statearr_16174 = state_16157;
(statearr_16174[(7)] = inst_16136__$1);

return statearr_16174;
})();
if(cljs.core.truth_(inst_16137)){
var statearr_16175_18807 = state_16157__$1;
(statearr_16175_18807[(1)] = (5));

} else {
var statearr_16176_18808 = state_16157__$1;
(statearr_16176_18808[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (13))){
var state_16157__$1 = state_16157;
var statearr_16179_18809 = state_16157__$1;
(statearr_16179_18809[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (6))){
var inst_16136 = (state_16157[(7)]);
var state_16157__$1 = state_16157;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16157__$1,(11),to,inst_16136);
} else {
if((state_val_16158 === (3))){
var inst_16155 = (state_16157[(2)]);
var state_16157__$1 = state_16157;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16157__$1,inst_16155);
} else {
if((state_val_16158 === (12))){
var state_16157__$1 = state_16157;
var statearr_16190_18810 = state_16157__$1;
(statearr_16190_18810[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (2))){
var state_16157__$1 = state_16157;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16157__$1,(4),from);
} else {
if((state_val_16158 === (11))){
var inst_16146 = (state_16157[(2)]);
var state_16157__$1 = state_16157;
if(cljs.core.truth_(inst_16146)){
var statearr_16194_18811 = state_16157__$1;
(statearr_16194_18811[(1)] = (12));

} else {
var statearr_16196_18812 = state_16157__$1;
(statearr_16196_18812[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (9))){
var state_16157__$1 = state_16157;
var statearr_16197_18813 = state_16157__$1;
(statearr_16197_18813[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (5))){
var state_16157__$1 = state_16157;
if(cljs.core.truth_(close_QMARK_)){
var statearr_16199_18814 = state_16157__$1;
(statearr_16199_18814[(1)] = (8));

} else {
var statearr_16200_18815 = state_16157__$1;
(statearr_16200_18815[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (14))){
var inst_16151 = (state_16157[(2)]);
var state_16157__$1 = state_16157;
var statearr_16201_18816 = state_16157__$1;
(statearr_16201_18816[(2)] = inst_16151);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (10))){
var inst_16143 = (state_16157[(2)]);
var state_16157__$1 = state_16157;
var statearr_16202_18817 = state_16157__$1;
(statearr_16202_18817[(2)] = inst_16143);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16158 === (8))){
var inst_16140 = cljs.core.async.close_BANG_(to);
var state_16157__$1 = state_16157;
var statearr_16203_18819 = state_16157__$1;
(statearr_16203_18819[(2)] = inst_16140);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_16205 = [null,null,null,null,null,null,null,null];
(statearr_16205[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_16205[(1)] = (1));

return statearr_16205;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_16157){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16157);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16207){var ex__14459__auto__ = e16207;
var statearr_16208_18824 = state_16157;
(statearr_16208_18824[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16157[(4)]))){
var statearr_16209_18825 = state_16157;
(statearr_16209_18825[(1)] = cljs.core.first((state_16157[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18826 = state_16157;
state_16157 = G__18826;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_16157){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_16157);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16210 = f__15556__auto__();
(statearr_16210[(6)] = c__15554__auto___18800);

return statearr_16210;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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.cljs$core$IFn$_invoke$arity$1(n);
var results = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(n);
var process__$1 = (function (p__16232){
var vec__16235 = p__16232;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__16235,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__16235,(1),null);
var job = vec__16235;
if((job == null)){
cljs.core.async.close_BANG_(results);

return null;
} else {
var res = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3((1),xf,ex_handler);
var c__15554__auto___18830 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16254){
var state_val_16255 = (state_16254[(1)]);
if((state_val_16255 === (1))){
var state_16254__$1 = state_16254;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16254__$1,(2),res,v);
} else {
if((state_val_16255 === (2))){
var inst_16248 = (state_16254[(2)]);
var inst_16249 = cljs.core.async.close_BANG_(res);
var state_16254__$1 = (function (){var statearr_16260 = state_16254;
(statearr_16260[(7)] = inst_16248);

return statearr_16260;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_16254__$1,inst_16249);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_16263 = [null,null,null,null,null,null,null,null];
(statearr_16263[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__);

(statearr_16263[(1)] = (1));

return statearr_16263;
});
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1 = (function (state_16254){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16254);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16266){var ex__14459__auto__ = e16266;
var statearr_16267_18833 = state_16254;
(statearr_16267_18833[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16254[(4)]))){
var statearr_16269_18834 = state_16254;
(statearr_16269_18834[(1)] = cljs.core.first((state_16254[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18835 = state_16254;
state_16254 = G__18835;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = function(state_16254){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1.call(this,state_16254);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16270 = f__15556__auto__();
(statearr_16270[(6)] = c__15554__auto___18830);

return statearr_16270;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(p,res);

return true;
}
});
var async = (function (p__16272){
var vec__16273 = p__16272;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__16273,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__16273,(1),null);
var job = vec__16273;
if((job == null)){
cljs.core.async.close_BANG_(results);

return null;
} else {
var res = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
(xf.cljs$core$IFn$_invoke$arity$2 ? xf.cljs$core$IFn$_invoke$arity$2(v,res) : xf.call(null,v,res));

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(p,res);

return true;
}
});
var n__5593__auto___18840 = n;
var __18841 = (0);
while(true){
if((__18841 < n__5593__auto___18840)){
var G__16280_18842 = type;
var G__16280_18843__$1 = (((G__16280_18842 instanceof cljs.core.Keyword))?G__16280_18842.fqn:null);
switch (G__16280_18843__$1) {
case "compute":
var c__15554__auto___18845 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__18841,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = ((function (__18841,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function (state_16298){
var state_val_16299 = (state_16298[(1)]);
if((state_val_16299 === (1))){
var state_16298__$1 = state_16298;
var statearr_16302_18846 = state_16298__$1;
(statearr_16302_18846[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16299 === (2))){
var state_16298__$1 = state_16298;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16298__$1,(4),jobs);
} else {
if((state_val_16299 === (3))){
var inst_16296 = (state_16298[(2)]);
var state_16298__$1 = state_16298;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16298__$1,inst_16296);
} else {
if((state_val_16299 === (4))){
var inst_16288 = (state_16298[(2)]);
var inst_16289 = process__$1(inst_16288);
var state_16298__$1 = state_16298;
if(cljs.core.truth_(inst_16289)){
var statearr_16307_18847 = state_16298__$1;
(statearr_16307_18847[(1)] = (5));

} else {
var statearr_16308_18848 = state_16298__$1;
(statearr_16308_18848[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16299 === (5))){
var state_16298__$1 = state_16298;
var statearr_16309_18849 = state_16298__$1;
(statearr_16309_18849[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16299 === (6))){
var state_16298__$1 = state_16298;
var statearr_16310_18850 = state_16298__$1;
(statearr_16310_18850[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16299 === (7))){
var inst_16294 = (state_16298[(2)]);
var state_16298__$1 = state_16298;
var statearr_16311_18851 = state_16298__$1;
(statearr_16311_18851[(2)] = inst_16294);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__18841,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
;
return ((function (__18841,switch__14455__auto__,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_16313 = [null,null,null,null,null,null,null];
(statearr_16313[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__);

(statearr_16313[(1)] = (1));

return statearr_16313;
});
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1 = (function (state_16298){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16298);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16315){var ex__14459__auto__ = e16315;
var statearr_16317_18853 = state_16298;
(statearr_16317_18853[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16298[(4)]))){
var statearr_16318_18854 = state_16298;
(statearr_16318_18854[(1)] = cljs.core.first((state_16298[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18855 = state_16298;
state_16298 = G__18855;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = function(state_16298){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1.call(this,state_16298);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__;
})()
;})(__18841,switch__14455__auto__,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
})();
var state__15557__auto__ = (function (){var statearr_16325 = f__15556__auto__();
(statearr_16325[(6)] = c__15554__auto___18845);

return statearr_16325;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
});})(__18841,c__15554__auto___18845,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
);


break;
case "async":
var c__15554__auto___18856 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__18841,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = ((function (__18841,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function (state_16344){
var state_val_16345 = (state_16344[(1)]);
if((state_val_16345 === (1))){
var state_16344__$1 = state_16344;
var statearr_16349_18857 = state_16344__$1;
(statearr_16349_18857[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16345 === (2))){
var state_16344__$1 = state_16344;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16344__$1,(4),jobs);
} else {
if((state_val_16345 === (3))){
var inst_16342 = (state_16344[(2)]);
var state_16344__$1 = state_16344;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16344__$1,inst_16342);
} else {
if((state_val_16345 === (4))){
var inst_16331 = (state_16344[(2)]);
var inst_16333 = async(inst_16331);
var state_16344__$1 = state_16344;
if(cljs.core.truth_(inst_16333)){
var statearr_16351_18858 = state_16344__$1;
(statearr_16351_18858[(1)] = (5));

} else {
var statearr_16352_18859 = state_16344__$1;
(statearr_16352_18859[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16345 === (5))){
var state_16344__$1 = state_16344;
var statearr_16353_18860 = state_16344__$1;
(statearr_16353_18860[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16345 === (6))){
var state_16344__$1 = state_16344;
var statearr_16354_18861 = state_16344__$1;
(statearr_16354_18861[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16345 === (7))){
var inst_16338 = (state_16344[(2)]);
var state_16344__$1 = state_16344;
var statearr_16355_18862 = state_16344__$1;
(statearr_16355_18862[(2)] = inst_16338);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__18841,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
;
return ((function (__18841,switch__14455__auto__,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_16356 = [null,null,null,null,null,null,null];
(statearr_16356[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__);

(statearr_16356[(1)] = (1));

return statearr_16356;
});
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1 = (function (state_16344){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16344);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16357){var ex__14459__auto__ = e16357;
var statearr_16358_18863 = state_16344;
(statearr_16358_18863[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16344[(4)]))){
var statearr_16359_18864 = state_16344;
(statearr_16359_18864[(1)] = cljs.core.first((state_16344[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18865 = state_16344;
state_16344 = G__18865;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = function(state_16344){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1.call(this,state_16344);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__;
})()
;})(__18841,switch__14455__auto__,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
})();
var state__15557__auto__ = (function (){var statearr_16360 = f__15556__auto__();
(statearr_16360[(6)] = c__15554__auto___18856);

return statearr_16360;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
});})(__18841,c__15554__auto___18856,G__16280_18842,G__16280_18843__$1,n__5593__auto___18840,jobs,results,process__$1,async))
);


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

}

var G__18866 = (__18841 + (1));
__18841 = G__18866;
continue;
} else {
}
break;
}

var c__15554__auto___18867 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16410){
var state_val_16411 = (state_16410[(1)]);
if((state_val_16411 === (7))){
var inst_16405 = (state_16410[(2)]);
var state_16410__$1 = state_16410;
var statearr_16422_18868 = state_16410__$1;
(statearr_16422_18868[(2)] = inst_16405);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16411 === (1))){
var state_16410__$1 = state_16410;
var statearr_16423_18873 = state_16410__$1;
(statearr_16423_18873[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16411 === (4))){
var inst_16368 = (state_16410[(7)]);
var inst_16368__$1 = (state_16410[(2)]);
var inst_16373 = (inst_16368__$1 == null);
var state_16410__$1 = (function (){var statearr_16424 = state_16410;
(statearr_16424[(7)] = inst_16368__$1);

return statearr_16424;
})();
if(cljs.core.truth_(inst_16373)){
var statearr_16425_18874 = state_16410__$1;
(statearr_16425_18874[(1)] = (5));

} else {
var statearr_16426_18875 = state_16410__$1;
(statearr_16426_18875[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16411 === (6))){
var inst_16368 = (state_16410[(7)]);
var inst_16379 = (state_16410[(8)]);
var inst_16379__$1 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var inst_16383 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_16392 = [inst_16368,inst_16379__$1];
var inst_16393 = (new cljs.core.PersistentVector(null,2,(5),inst_16383,inst_16392,null));
var state_16410__$1 = (function (){var statearr_16427 = state_16410;
(statearr_16427[(8)] = inst_16379__$1);

return statearr_16427;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16410__$1,(8),jobs,inst_16393);
} else {
if((state_val_16411 === (3))){
var inst_16407 = (state_16410[(2)]);
var state_16410__$1 = state_16410;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16410__$1,inst_16407);
} else {
if((state_val_16411 === (2))){
var state_16410__$1 = state_16410;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16410__$1,(4),from);
} else {
if((state_val_16411 === (9))){
var inst_16402 = (state_16410[(2)]);
var state_16410__$1 = (function (){var statearr_16435 = state_16410;
(statearr_16435[(9)] = inst_16402);

return statearr_16435;
})();
var statearr_16436_18876 = state_16410__$1;
(statearr_16436_18876[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16411 === (5))){
var inst_16377 = cljs.core.async.close_BANG_(jobs);
var state_16410__$1 = state_16410;
var statearr_16437_18877 = state_16410__$1;
(statearr_16437_18877[(2)] = inst_16377);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16411 === (8))){
var inst_16379 = (state_16410[(8)]);
var inst_16395 = (state_16410[(2)]);
var state_16410__$1 = (function (){var statearr_16438 = state_16410;
(statearr_16438[(10)] = inst_16395);

return statearr_16438;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16410__$1,(9),results,inst_16379);
} else {
return null;
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_16439 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_16439[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__);

(statearr_16439[(1)] = (1));

return statearr_16439;
});
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1 = (function (state_16410){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16410);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16440){var ex__14459__auto__ = e16440;
var statearr_16441_18882 = state_16410;
(statearr_16441_18882[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16410[(4)]))){
var statearr_16442_18883 = state_16410;
(statearr_16442_18883[(1)] = cljs.core.first((state_16410[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18884 = state_16410;
state_16410 = G__18884;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = function(state_16410){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1.call(this,state_16410);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16447 = f__15556__auto__();
(statearr_16447[(6)] = c__15554__auto___18867);

return statearr_16447;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


var c__15554__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16509){
var state_val_16510 = (state_16509[(1)]);
if((state_val_16510 === (7))){
var inst_16501 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
var statearr_16520_18885 = state_16509__$1;
(statearr_16520_18885[(2)] = inst_16501);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (20))){
var state_16509__$1 = state_16509;
var statearr_16521_18886 = state_16509__$1;
(statearr_16521_18886[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (1))){
var state_16509__$1 = state_16509;
var statearr_16525_18888 = state_16509__$1;
(statearr_16525_18888[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (4))){
var inst_16458 = (state_16509[(7)]);
var inst_16458__$1 = (state_16509[(2)]);
var inst_16459 = (inst_16458__$1 == null);
var state_16509__$1 = (function (){var statearr_16530 = state_16509;
(statearr_16530[(7)] = inst_16458__$1);

return statearr_16530;
})();
if(cljs.core.truth_(inst_16459)){
var statearr_16531_18889 = state_16509__$1;
(statearr_16531_18889[(1)] = (5));

} else {
var statearr_16532_18890 = state_16509__$1;
(statearr_16532_18890[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (15))){
var inst_16479 = (state_16509[(8)]);
var state_16509__$1 = state_16509;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16509__$1,(18),to,inst_16479);
} else {
if((state_val_16510 === (21))){
var inst_16496 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
var statearr_16539_18891 = state_16509__$1;
(statearr_16539_18891[(2)] = inst_16496);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (13))){
var inst_16498 = (state_16509[(2)]);
var state_16509__$1 = (function (){var statearr_16540 = state_16509;
(statearr_16540[(9)] = inst_16498);

return statearr_16540;
})();
var statearr_16544_18892 = state_16509__$1;
(statearr_16544_18892[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (6))){
var inst_16458 = (state_16509[(7)]);
var state_16509__$1 = state_16509;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16509__$1,(11),inst_16458);
} else {
if((state_val_16510 === (17))){
var inst_16490 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
if(cljs.core.truth_(inst_16490)){
var statearr_16545_18894 = state_16509__$1;
(statearr_16545_18894[(1)] = (19));

} else {
var statearr_16546_18895 = state_16509__$1;
(statearr_16546_18895[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (3))){
var inst_16503 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16509__$1,inst_16503);
} else {
if((state_val_16510 === (12))){
var inst_16469 = (state_16509[(10)]);
var state_16509__$1 = state_16509;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16509__$1,(14),inst_16469);
} else {
if((state_val_16510 === (2))){
var state_16509__$1 = state_16509;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16509__$1,(4),results);
} else {
if((state_val_16510 === (19))){
var state_16509__$1 = state_16509;
var statearr_16547_18896 = state_16509__$1;
(statearr_16547_18896[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (11))){
var inst_16469 = (state_16509[(2)]);
var state_16509__$1 = (function (){var statearr_16548 = state_16509;
(statearr_16548[(10)] = inst_16469);

return statearr_16548;
})();
var statearr_16549_18900 = state_16509__$1;
(statearr_16549_18900[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (9))){
var state_16509__$1 = state_16509;
var statearr_16550_18901 = state_16509__$1;
(statearr_16550_18901[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (5))){
var state_16509__$1 = state_16509;
if(cljs.core.truth_(close_QMARK_)){
var statearr_16551_18908 = state_16509__$1;
(statearr_16551_18908[(1)] = (8));

} else {
var statearr_16552_18909 = state_16509__$1;
(statearr_16552_18909[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (14))){
var inst_16481 = (state_16509[(11)]);
var inst_16479 = (state_16509[(8)]);
var inst_16479__$1 = (state_16509[(2)]);
var inst_16480 = (inst_16479__$1 == null);
var inst_16481__$1 = cljs.core.not(inst_16480);
var state_16509__$1 = (function (){var statearr_16554 = state_16509;
(statearr_16554[(11)] = inst_16481__$1);

(statearr_16554[(8)] = inst_16479__$1);

return statearr_16554;
})();
if(inst_16481__$1){
var statearr_16555_18919 = state_16509__$1;
(statearr_16555_18919[(1)] = (15));

} else {
var statearr_16556_18920 = state_16509__$1;
(statearr_16556_18920[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (16))){
var inst_16481 = (state_16509[(11)]);
var state_16509__$1 = state_16509;
var statearr_16557_18930 = state_16509__$1;
(statearr_16557_18930[(2)] = inst_16481);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (10))){
var inst_16466 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
var statearr_16561_18937 = state_16509__$1;
(statearr_16561_18937[(2)] = inst_16466);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (18))){
var inst_16487 = (state_16509[(2)]);
var state_16509__$1 = state_16509;
var statearr_16562_18938 = state_16509__$1;
(statearr_16562_18938[(2)] = inst_16487);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16510 === (8))){
var inst_16462 = cljs.core.async.close_BANG_(to);
var state_16509__$1 = state_16509;
var statearr_16563_18939 = state_16509__$1;
(statearr_16563_18939[(2)] = inst_16462);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_16568 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_16568[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__);

(statearr_16568[(1)] = (1));

return statearr_16568;
});
var cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1 = (function (state_16509){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16509);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16569){var ex__14459__auto__ = e16569;
var statearr_16570_18940 = state_16509;
(statearr_16570_18940[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16509[(4)]))){
var statearr_16571_18945 = state_16509;
(statearr_16571_18945[(1)] = cljs.core.first((state_16509[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18948 = state_16509;
state_16509 = G__18948;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__ = function(state_16509){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1.call(this,state_16509);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16572 = f__15556__auto__();
(statearr_16572[(6)] = c__15554__auto__);

return statearr_16572;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

return c__15554__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). The
 *   presumption is that af will return immediately, having launched some
 *   asynchronous operation whose completion/callback will put results on
 *   the channel, then close! it. 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. See also pipeline, pipeline-blocking.
 */
cljs.core.async.pipeline_async = (function cljs$core$async$pipeline_async(var_args){
var G__16574 = arguments.length;
switch (G__16574) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4 = (function (n,to,af,from){
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5(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_(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 G__16584 = arguments.length;
switch (G__16584) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4 = (function (n,to,xf,from){
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5(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.cljs$core$IFn$_invoke$arity$6(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_(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 G__16588 = arguments.length;
switch (G__16588) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.split.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$4(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.cljs$core$IFn$_invoke$arity$1(t_buf_or_n);
var fc = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(f_buf_or_n);
var c__15554__auto___18961 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16624){
var state_val_16625 = (state_16624[(1)]);
if((state_val_16625 === (7))){
var inst_16620 = (state_16624[(2)]);
var state_16624__$1 = state_16624;
var statearr_16630_18962 = state_16624__$1;
(statearr_16630_18962[(2)] = inst_16620);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (1))){
var state_16624__$1 = state_16624;
var statearr_16632_18963 = state_16624__$1;
(statearr_16632_18963[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (4))){
var inst_16601 = (state_16624[(7)]);
var inst_16601__$1 = (state_16624[(2)]);
var inst_16602 = (inst_16601__$1 == null);
var state_16624__$1 = (function (){var statearr_16634 = state_16624;
(statearr_16634[(7)] = inst_16601__$1);

return statearr_16634;
})();
if(cljs.core.truth_(inst_16602)){
var statearr_16635_18964 = state_16624__$1;
(statearr_16635_18964[(1)] = (5));

} else {
var statearr_16636_18965 = state_16624__$1;
(statearr_16636_18965[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (13))){
var state_16624__$1 = state_16624;
var statearr_16637_18966 = state_16624__$1;
(statearr_16637_18966[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (6))){
var inst_16601 = (state_16624[(7)]);
var inst_16607 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_16601) : p.call(null,inst_16601));
var state_16624__$1 = state_16624;
if(cljs.core.truth_(inst_16607)){
var statearr_16638_18967 = state_16624__$1;
(statearr_16638_18967[(1)] = (9));

} else {
var statearr_16640_18968 = state_16624__$1;
(statearr_16640_18968[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (3))){
var inst_16622 = (state_16624[(2)]);
var state_16624__$1 = state_16624;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16624__$1,inst_16622);
} else {
if((state_val_16625 === (12))){
var state_16624__$1 = state_16624;
var statearr_16642_18969 = state_16624__$1;
(statearr_16642_18969[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (2))){
var state_16624__$1 = state_16624;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16624__$1,(4),ch);
} else {
if((state_val_16625 === (11))){
var inst_16601 = (state_16624[(7)]);
var inst_16611 = (state_16624[(2)]);
var state_16624__$1 = state_16624;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16624__$1,(8),inst_16611,inst_16601);
} else {
if((state_val_16625 === (9))){
var state_16624__$1 = state_16624;
var statearr_16646_18970 = state_16624__$1;
(statearr_16646_18970[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (5))){
var inst_16604 = cljs.core.async.close_BANG_(tc);
var inst_16605 = cljs.core.async.close_BANG_(fc);
var state_16624__$1 = (function (){var statearr_16647 = state_16624;
(statearr_16647[(8)] = inst_16604);

return statearr_16647;
})();
var statearr_16648_18972 = state_16624__$1;
(statearr_16648_18972[(2)] = inst_16605);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (14))){
var inst_16618 = (state_16624[(2)]);
var state_16624__$1 = state_16624;
var statearr_16649_18973 = state_16624__$1;
(statearr_16649_18973[(2)] = inst_16618);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (10))){
var state_16624__$1 = state_16624;
var statearr_16650_18974 = state_16624__$1;
(statearr_16650_18974[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16625 === (8))){
var inst_16613 = (state_16624[(2)]);
var state_16624__$1 = state_16624;
if(cljs.core.truth_(inst_16613)){
var statearr_16654_18975 = state_16624__$1;
(statearr_16654_18975[(1)] = (12));

} else {
var statearr_16655_18976 = state_16624__$1;
(statearr_16655_18976[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_16656 = [null,null,null,null,null,null,null,null,null];
(statearr_16656[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_16656[(1)] = (1));

return statearr_16656;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_16624){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16624);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16659){var ex__14459__auto__ = e16659;
var statearr_16660_18977 = state_16624;
(statearr_16660_18977[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16624[(4)]))){
var statearr_16663_18979 = state_16624;
(statearr_16663_18979[(1)] = cljs.core.first((state_16624[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18981 = state_16624;
state_16624 = G__18981;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_16624){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_16624);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16666 = f__15556__auto__();
(statearr_16666[(6)] = c__15554__auto___18961);

return statearr_16666;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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__15554__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16690){
var state_val_16691 = (state_16690[(1)]);
if((state_val_16691 === (7))){
var inst_16686 = (state_16690[(2)]);
var state_16690__$1 = state_16690;
var statearr_16695_18983 = state_16690__$1;
(statearr_16695_18983[(2)] = inst_16686);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (1))){
var inst_16668 = init;
var inst_16669 = inst_16668;
var state_16690__$1 = (function (){var statearr_16703 = state_16690;
(statearr_16703[(7)] = inst_16669);

return statearr_16703;
})();
var statearr_16704_18984 = state_16690__$1;
(statearr_16704_18984[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (4))){
var inst_16672 = (state_16690[(8)]);
var inst_16672__$1 = (state_16690[(2)]);
var inst_16674 = (inst_16672__$1 == null);
var state_16690__$1 = (function (){var statearr_16719 = state_16690;
(statearr_16719[(8)] = inst_16672__$1);

return statearr_16719;
})();
if(cljs.core.truth_(inst_16674)){
var statearr_16720_18985 = state_16690__$1;
(statearr_16720_18985[(1)] = (5));

} else {
var statearr_16730_18986 = state_16690__$1;
(statearr_16730_18986[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (6))){
var inst_16669 = (state_16690[(7)]);
var inst_16672 = (state_16690[(8)]);
var inst_16677 = (state_16690[(9)]);
var inst_16677__$1 = (f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(inst_16669,inst_16672) : f.call(null,inst_16669,inst_16672));
var inst_16678 = cljs.core.reduced_QMARK_(inst_16677__$1);
var state_16690__$1 = (function (){var statearr_16747 = state_16690;
(statearr_16747[(9)] = inst_16677__$1);

return statearr_16747;
})();
if(inst_16678){
var statearr_16748_18987 = state_16690__$1;
(statearr_16748_18987[(1)] = (8));

} else {
var statearr_16749_18988 = state_16690__$1;
(statearr_16749_18988[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (3))){
var inst_16688 = (state_16690[(2)]);
var state_16690__$1 = state_16690;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16690__$1,inst_16688);
} else {
if((state_val_16691 === (2))){
var state_16690__$1 = state_16690;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16690__$1,(4),ch);
} else {
if((state_val_16691 === (9))){
var inst_16677 = (state_16690[(9)]);
var inst_16669 = inst_16677;
var state_16690__$1 = (function (){var statearr_16758 = state_16690;
(statearr_16758[(7)] = inst_16669);

return statearr_16758;
})();
var statearr_16759_18989 = state_16690__$1;
(statearr_16759_18989[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (5))){
var inst_16669 = (state_16690[(7)]);
var state_16690__$1 = state_16690;
var statearr_16760_18990 = state_16690__$1;
(statearr_16760_18990[(2)] = inst_16669);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (10))){
var inst_16684 = (state_16690[(2)]);
var state_16690__$1 = state_16690;
var statearr_16762_18991 = state_16690__$1;
(statearr_16762_18991[(2)] = inst_16684);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16691 === (8))){
var inst_16677 = (state_16690[(9)]);
var inst_16680 = cljs.core.deref(inst_16677);
var state_16690__$1 = state_16690;
var statearr_16769_18992 = state_16690__$1;
(statearr_16769_18992[(2)] = inst_16680);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$reduce_$_state_machine__14456__auto__ = null;
var cljs$core$async$reduce_$_state_machine__14456__auto____0 = (function (){
var statearr_16772 = [null,null,null,null,null,null,null,null,null,null];
(statearr_16772[(0)] = cljs$core$async$reduce_$_state_machine__14456__auto__);

(statearr_16772[(1)] = (1));

return statearr_16772;
});
var cljs$core$async$reduce_$_state_machine__14456__auto____1 = (function (state_16690){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16690);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16773){var ex__14459__auto__ = e16773;
var statearr_16774_18993 = state_16690;
(statearr_16774_18993[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16690[(4)]))){
var statearr_16775_18994 = state_16690;
(statearr_16775_18994[(1)] = cljs.core.first((state_16690[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__18995 = state_16690;
state_16690 = G__18995;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__14456__auto__ = function(state_16690){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__14456__auto____1.call(this,state_16690);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__14456__auto____0;
cljs$core$async$reduce_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__14456__auto____1;
return cljs$core$async$reduce_$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16776 = f__15556__auto__();
(statearr_16776[(6)] = c__15554__auto__);

return statearr_16776;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

return c__15554__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.cljs$core$IFn$_invoke$arity$1 ? xform.cljs$core$IFn$_invoke$arity$1(f) : xform.call(null,f));
var c__15554__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16787){
var state_val_16788 = (state_16787[(1)]);
if((state_val_16788 === (1))){
var inst_16782 = cljs.core.async.reduce(f__$1,init,ch);
var state_16787__$1 = state_16787;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_16787__$1,(2),inst_16782);
} else {
if((state_val_16788 === (2))){
var inst_16784 = (state_16787[(2)]);
var inst_16785 = (f__$1.cljs$core$IFn$_invoke$arity$1 ? f__$1.cljs$core$IFn$_invoke$arity$1(inst_16784) : f__$1.call(null,inst_16784));
var state_16787__$1 = state_16787;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16787__$1,inst_16785);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$transduce_$_state_machine__14456__auto__ = null;
var cljs$core$async$transduce_$_state_machine__14456__auto____0 = (function (){
var statearr_16792 = [null,null,null,null,null,null,null];
(statearr_16792[(0)] = cljs$core$async$transduce_$_state_machine__14456__auto__);

(statearr_16792[(1)] = (1));

return statearr_16792;
});
var cljs$core$async$transduce_$_state_machine__14456__auto____1 = (function (state_16787){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16787);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16794){var ex__14459__auto__ = e16794;
var statearr_16795_18998 = state_16787;
(statearr_16795_18998[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16787[(4)]))){
var statearr_16796_18999 = state_16787;
(statearr_16796_18999[(1)] = cljs.core.first((state_16787[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19000 = state_16787;
state_16787 = G__19000;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__14456__auto__ = function(state_16787){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__14456__auto____1.call(this,state_16787);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$transduce_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__14456__auto____0;
cljs$core$async$transduce_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__14456__auto____1;
return cljs$core$async$transduce_$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16799 = f__15556__auto__();
(statearr_16799[(6)] = c__15554__auto__);

return statearr_16799;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

return c__15554__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_BANG_ = (function cljs$core$async$onto_chan_BANG_(var_args){
var G__16802 = arguments.length;
switch (G__16802) {
case 2:
return cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__15554__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_16829){
var state_val_16830 = (state_16829[(1)]);
if((state_val_16830 === (7))){
var inst_16811 = (state_16829[(2)]);
var state_16829__$1 = state_16829;
var statearr_16834_19002 = state_16829__$1;
(statearr_16834_19002[(2)] = inst_16811);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (1))){
var inst_16804 = cljs.core.seq(coll);
var inst_16805 = inst_16804;
var state_16829__$1 = (function (){var statearr_16836 = state_16829;
(statearr_16836[(7)] = inst_16805);

return statearr_16836;
})();
var statearr_16837_19003 = state_16829__$1;
(statearr_16837_19003[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (4))){
var inst_16805 = (state_16829[(7)]);
var inst_16809 = cljs.core.first(inst_16805);
var state_16829__$1 = state_16829;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_16829__$1,(7),ch,inst_16809);
} else {
if((state_val_16830 === (13))){
var inst_16823 = (state_16829[(2)]);
var state_16829__$1 = state_16829;
var statearr_16841_19007 = state_16829__$1;
(statearr_16841_19007[(2)] = inst_16823);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (6))){
var inst_16814 = (state_16829[(2)]);
var state_16829__$1 = state_16829;
if(cljs.core.truth_(inst_16814)){
var statearr_16842_19008 = state_16829__$1;
(statearr_16842_19008[(1)] = (8));

} else {
var statearr_16843_19009 = state_16829__$1;
(statearr_16843_19009[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (3))){
var inst_16827 = (state_16829[(2)]);
var state_16829__$1 = state_16829;
return cljs.core.async.impl.ioc_helpers.return_chan(state_16829__$1,inst_16827);
} else {
if((state_val_16830 === (12))){
var state_16829__$1 = state_16829;
var statearr_16844_19010 = state_16829__$1;
(statearr_16844_19010[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (2))){
var inst_16805 = (state_16829[(7)]);
var state_16829__$1 = state_16829;
if(cljs.core.truth_(inst_16805)){
var statearr_16846_19011 = state_16829__$1;
(statearr_16846_19011[(1)] = (4));

} else {
var statearr_16847_19012 = state_16829__$1;
(statearr_16847_19012[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (11))){
var inst_16820 = cljs.core.async.close_BANG_(ch);
var state_16829__$1 = state_16829;
var statearr_16848_19013 = state_16829__$1;
(statearr_16848_19013[(2)] = inst_16820);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (9))){
var state_16829__$1 = state_16829;
if(cljs.core.truth_(close_QMARK_)){
var statearr_16850_19014 = state_16829__$1;
(statearr_16850_19014[(1)] = (11));

} else {
var statearr_16851_19015 = state_16829__$1;
(statearr_16851_19015[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (5))){
var inst_16805 = (state_16829[(7)]);
var state_16829__$1 = state_16829;
var statearr_16852_19016 = state_16829__$1;
(statearr_16852_19016[(2)] = inst_16805);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (10))){
var inst_16825 = (state_16829[(2)]);
var state_16829__$1 = state_16829;
var statearr_16870_19017 = state_16829__$1;
(statearr_16870_19017[(2)] = inst_16825);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_16830 === (8))){
var inst_16805 = (state_16829[(7)]);
var inst_16816 = cljs.core.next(inst_16805);
var inst_16805__$1 = inst_16816;
var state_16829__$1 = (function (){var statearr_16879 = state_16829;
(statearr_16879[(7)] = inst_16805__$1);

return statearr_16879;
})();
var statearr_16880_19018 = state_16829__$1;
(statearr_16880_19018[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_16882 = [null,null,null,null,null,null,null,null];
(statearr_16882[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_16882[(1)] = (1));

return statearr_16882;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_16829){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_16829);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e16883){var ex__14459__auto__ = e16883;
var statearr_16884_19019 = state_16829;
(statearr_16884_19019[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_16829[(4)]))){
var statearr_16885_19020 = state_16829;
(statearr_16885_19020[(1)] = cljs.core.first((state_16829[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19021 = state_16829;
state_16829 = G__19021;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_16829){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_16829);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_16887 = f__15556__auto__();
(statearr_16887[(6)] = c__15554__auto__);

return statearr_16887;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

return c__15554__auto__;
}));

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

/**
 * Creates and returns a channel which contains the contents of coll,
 *   closing when exhausted.
 */
cljs.core.async.to_chan_BANG_ = (function cljs$core$async$to_chan_BANG_(coll){
var ch = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(cljs.core.bounded_count((100),coll));
cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$2(ch,coll);

return ch;
});
/**
 * Deprecated - use onto-chan!
 */
cljs.core.async.onto_chan = (function cljs$core$async$onto_chan(var_args){
var G__16896 = arguments.length;
switch (G__16896) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
return cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$3(ch,coll,close_QMARK_);
}));

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

/**
 * Deprecated - use to-chan!
 */
cljs.core.async.to_chan = (function cljs$core$async$to_chan(coll){
return cljs.core.async.to_chan_BANG_(coll);
});

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

var cljs$core$async$Mux$muxch_STAR_$dyn_19026 = (function (_){
var x__5350__auto__ = (((_ == null))?null:_);
var m__5351__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5351__auto__.call(null,_));
} else {
var m__5349__auto__ = (cljs.core.async.muxch_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5349__auto__.call(null,_));
} else {
throw cljs.core.missing_protocol("Mux.muxch*",_);
}
}
});
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 {
return cljs$core$async$Mux$muxch_STAR_$dyn_19026(_);
}
});


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

var cljs$core$async$Mult$tap_STAR_$dyn_19027 = (function (m,ch,close_QMARK_){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5351__auto__.call(null,m,ch,close_QMARK_));
} else {
var m__5349__auto__ = (cljs.core.async.tap_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5349__auto__.call(null,m,ch,close_QMARK_));
} else {
throw cljs.core.missing_protocol("Mult.tap*",m);
}
}
});
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 {
return cljs$core$async$Mult$tap_STAR_$dyn_19027(m,ch,close_QMARK_);
}
});

var cljs$core$async$Mult$untap_STAR_$dyn_19031 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null,m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.untap_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null,m,ch));
} else {
throw cljs.core.missing_protocol("Mult.untap*",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 {
return cljs$core$async$Mult$untap_STAR_$dyn_19031(m,ch);
}
});

var cljs$core$async$Mult$untap_all_STAR_$dyn_19036 = (function (m){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5351__auto__.call(null,m));
} else {
var m__5349__auto__ = (cljs.core.async.untap_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5349__auto__.call(null,m));
} else {
throw cljs.core.missing_protocol("Mult.untap-all*",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 {
return cljs$core$async$Mult$untap_all_STAR_$dyn_19036(m);
}
});


/**
* @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$async16951 = (function (ch,cs,meta16952){
this.ch = ch;
this.cs = cs;
this.meta16952 = meta16952;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_16953,meta16952__$1){
var self__ = this;
var _16953__$1 = this;
return (new cljs.core.async.t_cljs$core$async16951(self__.ch,self__.cs,meta16952__$1));
}));

(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_16953){
var self__ = this;
var _16953__$1 = this;
return self__.meta16952;
}));

(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$async$Mult$tap_STAR_$arity$3 = (function (_,ch__$1,close_QMARK_){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(self__.cs,cljs.core.assoc,ch__$1,close_QMARK_);

return null;
}));

(cljs.core.async.t_cljs$core$async16951.prototype.cljs$core$async$Mult$untap_STAR_$arity$2 = (function (_,ch__$1){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.dissoc,ch__$1);

return null;
}));

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

return null;
}));

(cljs.core.async.t_cljs$core$async16951.getBasis = (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,"meta16952","meta16952",1801914384,null)], null);
}));

(cljs.core.async.t_cljs$core$async16951.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async16951.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async16951");

(cljs.core.async.t_cljs$core$async16951.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async16951");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async16951.
 */
cljs.core.async.__GT_t_cljs$core$async16951 = (function cljs$core$async$__GT_t_cljs$core$async16951(ch,cs,meta16952){
return (new cljs.core.async.t_cljs$core$async16951(ch,cs,meta16952));
});


/**
 * 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.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var m = (new cljs.core.async.t_cljs$core$async16951(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
var dchan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var dctr = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
var done = (function (_){
if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,true);
} else {
return null;
}
});
var c__15554__auto___19037 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17106){
var state_val_17107 = (state_17106[(1)]);
if((state_val_17107 === (7))){
var inst_17099 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17113_19038 = state_17106__$1;
(statearr_17113_19038[(2)] = inst_17099);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (20))){
var inst_16996 = (state_17106[(7)]);
var inst_17008 = cljs.core.first(inst_16996);
var inst_17009 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17008,(0),null);
var inst_17010 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17008,(1),null);
var state_17106__$1 = (function (){var statearr_17115 = state_17106;
(statearr_17115[(8)] = inst_17009);

return statearr_17115;
})();
if(cljs.core.truth_(inst_17010)){
var statearr_17116_19039 = state_17106__$1;
(statearr_17116_19039[(1)] = (22));

} else {
var statearr_17117_19040 = state_17106__$1;
(statearr_17117_19040[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (27))){
var inst_17038 = (state_17106[(9)]);
var inst_17045 = (state_17106[(10)]);
var inst_16962 = (state_17106[(11)]);
var inst_17040 = (state_17106[(12)]);
var inst_17045__$1 = cljs.core._nth(inst_17038,inst_17040);
var inst_17046 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_17045__$1,inst_16962,done);
var state_17106__$1 = (function (){var statearr_17118 = state_17106;
(statearr_17118[(10)] = inst_17045__$1);

return statearr_17118;
})();
if(cljs.core.truth_(inst_17046)){
var statearr_17120_19041 = state_17106__$1;
(statearr_17120_19041[(1)] = (30));

} else {
var statearr_17121_19042 = state_17106__$1;
(statearr_17121_19042[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (1))){
var state_17106__$1 = state_17106;
var statearr_17122_19043 = state_17106__$1;
(statearr_17122_19043[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (24))){
var inst_16996 = (state_17106[(7)]);
var inst_17015 = (state_17106[(2)]);
var inst_17016 = cljs.core.next(inst_16996);
var inst_16971 = inst_17016;
var inst_16972 = null;
var inst_16973 = (0);
var inst_16974 = (0);
var state_17106__$1 = (function (){var statearr_17123 = state_17106;
(statearr_17123[(13)] = inst_16973);

(statearr_17123[(14)] = inst_17015);

(statearr_17123[(15)] = inst_16971);

(statearr_17123[(16)] = inst_16974);

(statearr_17123[(17)] = inst_16972);

return statearr_17123;
})();
var statearr_17125_19044 = state_17106__$1;
(statearr_17125_19044[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (39))){
var state_17106__$1 = state_17106;
var statearr_17135_19045 = state_17106__$1;
(statearr_17135_19045[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (4))){
var inst_16962 = (state_17106[(11)]);
var inst_16962__$1 = (state_17106[(2)]);
var inst_16963 = (inst_16962__$1 == null);
var state_17106__$1 = (function (){var statearr_17136 = state_17106;
(statearr_17136[(11)] = inst_16962__$1);

return statearr_17136;
})();
if(cljs.core.truth_(inst_16963)){
var statearr_17137_19046 = state_17106__$1;
(statearr_17137_19046[(1)] = (5));

} else {
var statearr_17140_19047 = state_17106__$1;
(statearr_17140_19047[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (15))){
var inst_16973 = (state_17106[(13)]);
var inst_16971 = (state_17106[(15)]);
var inst_16974 = (state_17106[(16)]);
var inst_16972 = (state_17106[(17)]);
var inst_16992 = (state_17106[(2)]);
var inst_16993 = (inst_16974 + (1));
var tmp17126 = inst_16973;
var tmp17127 = inst_16971;
var tmp17128 = inst_16972;
var inst_16971__$1 = tmp17127;
var inst_16972__$1 = tmp17128;
var inst_16973__$1 = tmp17126;
var inst_16974__$1 = inst_16993;
var state_17106__$1 = (function (){var statearr_17142 = state_17106;
(statearr_17142[(13)] = inst_16973__$1);

(statearr_17142[(15)] = inst_16971__$1);

(statearr_17142[(18)] = inst_16992);

(statearr_17142[(16)] = inst_16974__$1);

(statearr_17142[(17)] = inst_16972__$1);

return statearr_17142;
})();
var statearr_17145_19048 = state_17106__$1;
(statearr_17145_19048[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (21))){
var inst_17019 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17149_19053 = state_17106__$1;
(statearr_17149_19053[(2)] = inst_17019);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (31))){
var inst_17045 = (state_17106[(10)]);
var inst_17049 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_17045);
var state_17106__$1 = state_17106;
var statearr_17153_19054 = state_17106__$1;
(statearr_17153_19054[(2)] = inst_17049);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (32))){
var inst_17038 = (state_17106[(9)]);
var inst_17040 = (state_17106[(12)]);
var inst_17039 = (state_17106[(19)]);
var inst_17037 = (state_17106[(20)]);
var inst_17051 = (state_17106[(2)]);
var inst_17052 = (inst_17040 + (1));
var tmp17146 = inst_17038;
var tmp17147 = inst_17039;
var tmp17148 = inst_17037;
var inst_17037__$1 = tmp17148;
var inst_17038__$1 = tmp17146;
var inst_17039__$1 = tmp17147;
var inst_17040__$1 = inst_17052;
var state_17106__$1 = (function (){var statearr_17159 = state_17106;
(statearr_17159[(9)] = inst_17038__$1);

(statearr_17159[(12)] = inst_17040__$1);

(statearr_17159[(21)] = inst_17051);

(statearr_17159[(19)] = inst_17039__$1);

(statearr_17159[(20)] = inst_17037__$1);

return statearr_17159;
})();
var statearr_17160_19055 = state_17106__$1;
(statearr_17160_19055[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (40))){
var inst_17064 = (state_17106[(22)]);
var inst_17068 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_17064);
var state_17106__$1 = state_17106;
var statearr_17161_19056 = state_17106__$1;
(statearr_17161_19056[(2)] = inst_17068);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (33))){
var inst_17055 = (state_17106[(23)]);
var inst_17057 = cljs.core.chunked_seq_QMARK_(inst_17055);
var state_17106__$1 = state_17106;
if(inst_17057){
var statearr_17164_19057 = state_17106__$1;
(statearr_17164_19057[(1)] = (36));

} else {
var statearr_17165_19058 = state_17106__$1;
(statearr_17165_19058[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (13))){
var inst_16986 = (state_17106[(24)]);
var inst_16989 = cljs.core.async.close_BANG_(inst_16986);
var state_17106__$1 = state_17106;
var statearr_17168_19059 = state_17106__$1;
(statearr_17168_19059[(2)] = inst_16989);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (22))){
var inst_17009 = (state_17106[(8)]);
var inst_17012 = cljs.core.async.close_BANG_(inst_17009);
var state_17106__$1 = state_17106;
var statearr_17169_19060 = state_17106__$1;
(statearr_17169_19060[(2)] = inst_17012);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (36))){
var inst_17055 = (state_17106[(23)]);
var inst_17059 = cljs.core.chunk_first(inst_17055);
var inst_17060 = cljs.core.chunk_rest(inst_17055);
var inst_17061 = cljs.core.count(inst_17059);
var inst_17037 = inst_17060;
var inst_17038 = inst_17059;
var inst_17039 = inst_17061;
var inst_17040 = (0);
var state_17106__$1 = (function (){var statearr_17170 = state_17106;
(statearr_17170[(9)] = inst_17038);

(statearr_17170[(12)] = inst_17040);

(statearr_17170[(19)] = inst_17039);

(statearr_17170[(20)] = inst_17037);

return statearr_17170;
})();
var statearr_17171_19061 = state_17106__$1;
(statearr_17171_19061[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (41))){
var inst_17055 = (state_17106[(23)]);
var inst_17070 = (state_17106[(2)]);
var inst_17071 = cljs.core.next(inst_17055);
var inst_17037 = inst_17071;
var inst_17038 = null;
var inst_17039 = (0);
var inst_17040 = (0);
var state_17106__$1 = (function (){var statearr_17172 = state_17106;
(statearr_17172[(9)] = inst_17038);

(statearr_17172[(12)] = inst_17040);

(statearr_17172[(19)] = inst_17039);

(statearr_17172[(20)] = inst_17037);

(statearr_17172[(25)] = inst_17070);

return statearr_17172;
})();
var statearr_17173_19062 = state_17106__$1;
(statearr_17173_19062[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (43))){
var state_17106__$1 = state_17106;
var statearr_17174_19063 = state_17106__$1;
(statearr_17174_19063[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (29))){
var inst_17081 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17175_19064 = state_17106__$1;
(statearr_17175_19064[(2)] = inst_17081);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (44))){
var inst_17096 = (state_17106[(2)]);
var state_17106__$1 = (function (){var statearr_17177 = state_17106;
(statearr_17177[(26)] = inst_17096);

return statearr_17177;
})();
var statearr_17182_19067 = state_17106__$1;
(statearr_17182_19067[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (6))){
var inst_17029 = (state_17106[(27)]);
var inst_17028 = cljs.core.deref(cs);
var inst_17029__$1 = cljs.core.keys(inst_17028);
var inst_17030 = cljs.core.count(inst_17029__$1);
var inst_17031 = cljs.core.reset_BANG_(dctr,inst_17030);
var inst_17036 = cljs.core.seq(inst_17029__$1);
var inst_17037 = inst_17036;
var inst_17038 = null;
var inst_17039 = (0);
var inst_17040 = (0);
var state_17106__$1 = (function (){var statearr_17188 = state_17106;
(statearr_17188[(9)] = inst_17038);

(statearr_17188[(28)] = inst_17031);

(statearr_17188[(12)] = inst_17040);

(statearr_17188[(19)] = inst_17039);

(statearr_17188[(27)] = inst_17029__$1);

(statearr_17188[(20)] = inst_17037);

return statearr_17188;
})();
var statearr_17193_19069 = state_17106__$1;
(statearr_17193_19069[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (28))){
var inst_17055 = (state_17106[(23)]);
var inst_17037 = (state_17106[(20)]);
var inst_17055__$1 = cljs.core.seq(inst_17037);
var state_17106__$1 = (function (){var statearr_17194 = state_17106;
(statearr_17194[(23)] = inst_17055__$1);

return statearr_17194;
})();
if(inst_17055__$1){
var statearr_17195_19070 = state_17106__$1;
(statearr_17195_19070[(1)] = (33));

} else {
var statearr_17196_19071 = state_17106__$1;
(statearr_17196_19071[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (25))){
var inst_17040 = (state_17106[(12)]);
var inst_17039 = (state_17106[(19)]);
var inst_17042 = (inst_17040 < inst_17039);
var inst_17043 = inst_17042;
var state_17106__$1 = state_17106;
if(cljs.core.truth_(inst_17043)){
var statearr_17200_19072 = state_17106__$1;
(statearr_17200_19072[(1)] = (27));

} else {
var statearr_17201_19073 = state_17106__$1;
(statearr_17201_19073[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (34))){
var state_17106__$1 = state_17106;
var statearr_17202_19074 = state_17106__$1;
(statearr_17202_19074[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (17))){
var state_17106__$1 = state_17106;
var statearr_17203_19075 = state_17106__$1;
(statearr_17203_19075[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (3))){
var inst_17101 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
return cljs.core.async.impl.ioc_helpers.return_chan(state_17106__$1,inst_17101);
} else {
if((state_val_17107 === (12))){
var inst_17024 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17205_19079 = state_17106__$1;
(statearr_17205_19079[(2)] = inst_17024);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (2))){
var state_17106__$1 = state_17106;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_17106__$1,(4),ch);
} else {
if((state_val_17107 === (23))){
var state_17106__$1 = state_17106;
var statearr_17225_19080 = state_17106__$1;
(statearr_17225_19080[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (35))){
var inst_17077 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17234_19081 = state_17106__$1;
(statearr_17234_19081[(2)] = inst_17077);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (19))){
var inst_16996 = (state_17106[(7)]);
var inst_17000 = cljs.core.chunk_first(inst_16996);
var inst_17001 = cljs.core.chunk_rest(inst_16996);
var inst_17002 = cljs.core.count(inst_17000);
var inst_16971 = inst_17001;
var inst_16972 = inst_17000;
var inst_16973 = inst_17002;
var inst_16974 = (0);
var state_17106__$1 = (function (){var statearr_17238 = state_17106;
(statearr_17238[(13)] = inst_16973);

(statearr_17238[(15)] = inst_16971);

(statearr_17238[(16)] = inst_16974);

(statearr_17238[(17)] = inst_16972);

return statearr_17238;
})();
var statearr_17239_19088 = state_17106__$1;
(statearr_17239_19088[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (11))){
var inst_16996 = (state_17106[(7)]);
var inst_16971 = (state_17106[(15)]);
var inst_16996__$1 = cljs.core.seq(inst_16971);
var state_17106__$1 = (function (){var statearr_17243 = state_17106;
(statearr_17243[(7)] = inst_16996__$1);

return statearr_17243;
})();
if(inst_16996__$1){
var statearr_17244_19089 = state_17106__$1;
(statearr_17244_19089[(1)] = (16));

} else {
var statearr_17248_19090 = state_17106__$1;
(statearr_17248_19090[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (9))){
var inst_17026 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17253_19091 = state_17106__$1;
(statearr_17253_19091[(2)] = inst_17026);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (5))){
var inst_16969 = cljs.core.deref(cs);
var inst_16970 = cljs.core.seq(inst_16969);
var inst_16971 = inst_16970;
var inst_16972 = null;
var inst_16973 = (0);
var inst_16974 = (0);
var state_17106__$1 = (function (){var statearr_17258 = state_17106;
(statearr_17258[(13)] = inst_16973);

(statearr_17258[(15)] = inst_16971);

(statearr_17258[(16)] = inst_16974);

(statearr_17258[(17)] = inst_16972);

return statearr_17258;
})();
var statearr_17259_19095 = state_17106__$1;
(statearr_17259_19095[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (14))){
var state_17106__$1 = state_17106;
var statearr_17264_19096 = state_17106__$1;
(statearr_17264_19096[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (45))){
var inst_17093 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17265_19097 = state_17106__$1;
(statearr_17265_19097[(2)] = inst_17093);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (26))){
var inst_17029 = (state_17106[(27)]);
var inst_17083 = (state_17106[(2)]);
var inst_17086 = cljs.core.seq(inst_17029);
var state_17106__$1 = (function (){var statearr_17266 = state_17106;
(statearr_17266[(29)] = inst_17083);

return statearr_17266;
})();
if(inst_17086){
var statearr_17267_19098 = state_17106__$1;
(statearr_17267_19098[(1)] = (42));

} else {
var statearr_17270_19099 = state_17106__$1;
(statearr_17270_19099[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (16))){
var inst_16996 = (state_17106[(7)]);
var inst_16998 = cljs.core.chunked_seq_QMARK_(inst_16996);
var state_17106__$1 = state_17106;
if(inst_16998){
var statearr_17271_19100 = state_17106__$1;
(statearr_17271_19100[(1)] = (19));

} else {
var statearr_17272_19101 = state_17106__$1;
(statearr_17272_19101[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (38))){
var inst_17074 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17273_19102 = state_17106__$1;
(statearr_17273_19102[(2)] = inst_17074);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (30))){
var state_17106__$1 = state_17106;
var statearr_17274_19103 = state_17106__$1;
(statearr_17274_19103[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (10))){
var inst_16974 = (state_17106[(16)]);
var inst_16972 = (state_17106[(17)]);
var inst_16985 = cljs.core._nth(inst_16972,inst_16974);
var inst_16986 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_16985,(0),null);
var inst_16987 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_16985,(1),null);
var state_17106__$1 = (function (){var statearr_17276 = state_17106;
(statearr_17276[(24)] = inst_16986);

return statearr_17276;
})();
if(cljs.core.truth_(inst_16987)){
var statearr_17277_19104 = state_17106__$1;
(statearr_17277_19104[(1)] = (13));

} else {
var statearr_17278_19105 = state_17106__$1;
(statearr_17278_19105[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (18))){
var inst_17022 = (state_17106[(2)]);
var state_17106__$1 = state_17106;
var statearr_17279_19106 = state_17106__$1;
(statearr_17279_19106[(2)] = inst_17022);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (42))){
var state_17106__$1 = state_17106;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_17106__$1,(45),dchan);
} else {
if((state_val_17107 === (37))){
var inst_17064 = (state_17106[(22)]);
var inst_16962 = (state_17106[(11)]);
var inst_17055 = (state_17106[(23)]);
var inst_17064__$1 = cljs.core.first(inst_17055);
var inst_17065 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_17064__$1,inst_16962,done);
var state_17106__$1 = (function (){var statearr_17280 = state_17106;
(statearr_17280[(22)] = inst_17064__$1);

return statearr_17280;
})();
if(cljs.core.truth_(inst_17065)){
var statearr_17281_19107 = state_17106__$1;
(statearr_17281_19107[(1)] = (39));

} else {
var statearr_17282_19108 = state_17106__$1;
(statearr_17282_19108[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17107 === (8))){
var inst_16973 = (state_17106[(13)]);
var inst_16974 = (state_17106[(16)]);
var inst_16979 = (inst_16974 < inst_16973);
var inst_16980 = inst_16979;
var state_17106__$1 = state_17106;
if(cljs.core.truth_(inst_16980)){
var statearr_17283_19109 = state_17106__$1;
(statearr_17283_19109[(1)] = (10));

} else {
var statearr_17284_19110 = state_17106__$1;
(statearr_17284_19110[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mult_$_state_machine__14456__auto__ = null;
var cljs$core$async$mult_$_state_machine__14456__auto____0 = (function (){
var statearr_17285 = [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_17285[(0)] = cljs$core$async$mult_$_state_machine__14456__auto__);

(statearr_17285[(1)] = (1));

return statearr_17285;
});
var cljs$core$async$mult_$_state_machine__14456__auto____1 = (function (state_17106){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17106);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17286){var ex__14459__auto__ = e17286;
var statearr_17287_19111 = state_17106;
(statearr_17287_19111[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17106[(4)]))){
var statearr_17288_19112 = state_17106;
(statearr_17288_19112[(1)] = cljs.core.first((state_17106[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19116 = state_17106;
state_17106 = G__19116;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__14456__auto__ = function(state_17106){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__14456__auto____1.call(this,state_17106);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__14456__auto____0;
cljs$core$async$mult_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__14456__auto____1;
return cljs$core$async$mult_$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17289 = f__15556__auto__();
(statearr_17289[(6)] = c__15554__auto___19037);

return statearr_17289;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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 G__17291 = arguments.length;
switch (G__17291) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3 = (function (mult,ch,close_QMARK_){
cljs.core.async.tap_STAR_(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_(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_(mult);
});

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

var cljs$core$async$Mix$admix_STAR_$dyn_19118 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null,m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.admix_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null,m,ch));
} else {
throw cljs.core.missing_protocol("Mix.admix*",m);
}
}
});
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 {
return cljs$core$async$Mix$admix_STAR_$dyn_19118(m,ch);
}
});

var cljs$core$async$Mix$unmix_STAR_$dyn_19119 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null,m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.unmix_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null,m,ch));
} else {
throw cljs.core.missing_protocol("Mix.unmix*",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 {
return cljs$core$async$Mix$unmix_STAR_$dyn_19119(m,ch);
}
});

var cljs$core$async$Mix$unmix_all_STAR_$dyn_19120 = (function (m){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5351__auto__.call(null,m));
} else {
var m__5349__auto__ = (cljs.core.async.unmix_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5349__auto__.call(null,m));
} else {
throw cljs.core.missing_protocol("Mix.unmix-all*",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 {
return cljs$core$async$Mix$unmix_all_STAR_$dyn_19120(m);
}
});

var cljs$core$async$Mix$toggle_STAR_$dyn_19123 = (function (m,state_map){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5351__auto__.call(null,m,state_map));
} else {
var m__5349__auto__ = (cljs.core.async.toggle_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5349__auto__.call(null,m,state_map));
} else {
throw cljs.core.missing_protocol("Mix.toggle*",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 {
return cljs$core$async$Mix$toggle_STAR_$dyn_19123(m,state_map);
}
});

var cljs$core$async$Mix$solo_mode_STAR_$dyn_19127 = (function (m,mode){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5351__auto__.call(null,m,mode));
} else {
var m__5349__auto__ = (cljs.core.async.solo_mode_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5349__auto__.call(null,m,mode));
} else {
throw cljs.core.missing_protocol("Mix.solo-mode*",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 {
return cljs$core$async$Mix$solo_mode_STAR_$dyn_19127(m,mode);
}
});

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

var G__19136 = (i__5727__auto___19135 + (1));
i__5727__auto___19135 = G__19136;
continue;
} else {
}
break;
}

var argseq__5733__auto__ = ((((3) < args__5732__auto__.length))?(new cljs.core.IndexedSeq(args__5732__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__5733__auto__);
});

(cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__17329){
var map__17330 = p__17329;
var map__17330__$1 = cljs.core.__destructure_map(map__17330);
var opts = map__17330__$1;
var statearr_17331_19137 = state;
(statearr_17331_19137[(1)] = cont_block);


var temp__5804__auto__ = cljs.core.async.do_alts((function (val){
var statearr_17341_19138 = state;
(statearr_17341_19138[(2)] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
}),ports,opts);
if(cljs.core.truth_(temp__5804__auto__)){
var cb = temp__5804__auto__;
var statearr_17342_19139 = state;
(statearr_17342_19139[(2)] = cljs.core.deref(cb));


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

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

/** @this {Function} */
(cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq17325){
var G__17326 = cljs.core.first(seq17325);
var seq17325__$1 = cljs.core.next(seq17325);
var G__17327 = cljs.core.first(seq17325__$1);
var seq17325__$2 = cljs.core.next(seq17325__$1);
var G__17328 = cljs.core.first(seq17325__$2);
var seq17325__$3 = cljs.core.next(seq17325__$2);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__17326,G__17327,G__17328,seq17325__$3);
}));


/**
* @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$async17344 = (function (change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta17345){
this.change = change;
this.solo_mode = solo_mode;
this.pick = pick;
this.cs = cs;
this.calc_state = calc_state;
this.out = out;
this.changed = changed;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.meta17345 = meta17345;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17346,meta17345__$1){
var self__ = this;
var _17346__$1 = this;
return (new cljs.core.async.t_cljs$core$async17344(self__.change,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta17345__$1));
}));

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17346){
var self__ = this;
var _17346__$1 = this;
return self__.meta17345;
}));

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mix$admix_STAR_$arity$2 = (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(self__.cs,cljs.core.assoc,ch,cljs.core.PersistentArrayMap.EMPTY);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null));
}));

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mix$unmix_STAR_$arity$2 = (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.dissoc,ch);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null));
}));

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mix$unmix_all_STAR_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_(self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null));
}));

(cljs.core.async.t_cljs$core$async17344.prototype.cljs$core$async$Mix$toggle_STAR_$arity$2 = (function (_,state_map){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.partial.cljs$core$IFn$_invoke$arity$2(cljs.core.merge_with,cljs.core.merge),state_map);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null));
}));

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

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

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null));
}));

(cljs.core.async.t_cljs$core$async17344.getBasis = (function (){
return new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"change","change",477485025,null),new cljs.core.Symbol(null,"solo-mode","solo-mode",2031788074,null),new cljs.core.Symbol(null,"pick","pick",1300068175,null),new cljs.core.Symbol(null,"cs","cs",-117024463,null),new cljs.core.Symbol(null,"calc-state","calc-state",-349968968,null),new cljs.core.Symbol(null,"out","out",729986010,null),new cljs.core.Symbol(null,"changed","changed",-2083710852,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,"meta17345","meta17345",1855856411,null)], null);
}));

(cljs.core.async.t_cljs$core$async17344.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17344.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17344");

(cljs.core.async.t_cljs$core$async17344.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17344");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17344.
 */
cljs.core.async.__GT_t_cljs$core$async17344 = (function cljs$core$async$__GT_t_cljs$core$async17344(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta17345){
return (new cljs.core.async.t_cljs$core$async17344(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta17345));
});


/**
 * 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.cljs$core$IFn$_invoke$arity$1(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.cljs$core$IFn$_invoke$arity$2(solo_modes,new cljs.core.Keyword(null,"solo","solo",-316350075));
var solo_mode = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"mute","mute",1151223646));
var change = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(cljs.core.async.sliding_buffer((1)));
var changed = (function (){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(change,true);
});
var pick = (function (attr,chs){
return cljs.core.reduce_kv((function (ret,c,v){
if(cljs.core.truth_((attr.cljs$core$IFn$_invoke$arity$1 ? attr.cljs$core$IFn$_invoke$arity$1(v) : attr.call(null,v)))){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(ret,c);
} else {
return ret;
}
}),cljs.core.PersistentHashSet.EMPTY,chs);
});
var calc_state = (function (){
var chs = cljs.core.deref(cs);
var mode = cljs.core.deref(solo_mode);
var solos = pick(new cljs.core.Keyword(null,"solo","solo",-316350075),chs);
var pauses = pick(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(new cljs.core.Keyword(null,"mute","mute",1151223646),chs),new cljs.core.Keyword(null,"reads","reads",-1215067361),cljs.core.conj.cljs$core$IFn$_invoke$arity$2(((((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(mode,new cljs.core.Keyword(null,"pause","pause",-2095325672))) && ((!(cljs.core.empty_QMARK_(solos))))))?cljs.core.vec(solos):cljs.core.vec(cljs.core.remove.cljs$core$IFn$_invoke$arity$2(pauses,cljs.core.keys(chs)))),change)], null);
});
var m = (new cljs.core.async.t_cljs$core$async17344(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,cljs.core.PersistentArrayMap.EMPTY));
var c__15554__auto___19156 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17422){
var state_val_17423 = (state_17422[(1)]);
if((state_val_17423 === (7))){
var inst_17382 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
if(cljs.core.truth_(inst_17382)){
var statearr_17425_19160 = state_17422__$1;
(statearr_17425_19160[(1)] = (8));

} else {
var statearr_17432_19161 = state_17422__$1;
(statearr_17432_19161[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (20))){
var inst_17375 = (state_17422[(7)]);
var state_17422__$1 = state_17422;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_17422__$1,(23),out,inst_17375);
} else {
if((state_val_17423 === (1))){
var inst_17357 = calc_state();
var inst_17358 = cljs.core.__destructure_map(inst_17357);
var inst_17359 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17358,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_17360 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17358,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_17361 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17358,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_17363 = inst_17357;
var state_17422__$1 = (function (){var statearr_17434 = state_17422;
(statearr_17434[(8)] = inst_17363);

(statearr_17434[(9)] = inst_17361);

(statearr_17434[(10)] = inst_17359);

(statearr_17434[(11)] = inst_17360);

return statearr_17434;
})();
var statearr_17435_19162 = state_17422__$1;
(statearr_17435_19162[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (24))){
var inst_17366 = (state_17422[(12)]);
var inst_17363 = inst_17366;
var state_17422__$1 = (function (){var statearr_17445 = state_17422;
(statearr_17445[(8)] = inst_17363);

return statearr_17445;
})();
var statearr_17446_19163 = state_17422__$1;
(statearr_17446_19163[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (4))){
var inst_17377 = (state_17422[(13)]);
var inst_17375 = (state_17422[(7)]);
var inst_17374 = (state_17422[(2)]);
var inst_17375__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17374,(0),null);
var inst_17376 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17374,(1),null);
var inst_17377__$1 = (inst_17375__$1 == null);
var state_17422__$1 = (function (){var statearr_17447 = state_17422;
(statearr_17447[(13)] = inst_17377__$1);

(statearr_17447[(14)] = inst_17376);

(statearr_17447[(7)] = inst_17375__$1);

return statearr_17447;
})();
if(cljs.core.truth_(inst_17377__$1)){
var statearr_17449_19164 = state_17422__$1;
(statearr_17449_19164[(1)] = (5));

} else {
var statearr_17452_19165 = state_17422__$1;
(statearr_17452_19165[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (15))){
var inst_17396 = (state_17422[(15)]);
var inst_17367 = (state_17422[(16)]);
var inst_17396__$1 = cljs.core.empty_QMARK_(inst_17367);
var state_17422__$1 = (function (){var statearr_17455 = state_17422;
(statearr_17455[(15)] = inst_17396__$1);

return statearr_17455;
})();
if(inst_17396__$1){
var statearr_17457_19166 = state_17422__$1;
(statearr_17457_19166[(1)] = (17));

} else {
var statearr_17464_19167 = state_17422__$1;
(statearr_17464_19167[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (21))){
var inst_17366 = (state_17422[(12)]);
var inst_17363 = inst_17366;
var state_17422__$1 = (function (){var statearr_17465 = state_17422;
(statearr_17465[(8)] = inst_17363);

return statearr_17465;
})();
var statearr_17466_19168 = state_17422__$1;
(statearr_17466_19168[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (13))){
var inst_17389 = (state_17422[(2)]);
var inst_17390 = calc_state();
var inst_17363 = inst_17390;
var state_17422__$1 = (function (){var statearr_17468 = state_17422;
(statearr_17468[(8)] = inst_17363);

(statearr_17468[(17)] = inst_17389);

return statearr_17468;
})();
var statearr_17469_19173 = state_17422__$1;
(statearr_17469_19173[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (22))){
var inst_17416 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
var statearr_17470_19178 = state_17422__$1;
(statearr_17470_19178[(2)] = inst_17416);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (6))){
var inst_17376 = (state_17422[(14)]);
var inst_17380 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_17376,change);
var state_17422__$1 = state_17422;
var statearr_17471_19179 = state_17422__$1;
(statearr_17471_19179[(2)] = inst_17380);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (25))){
var state_17422__$1 = state_17422;
var statearr_17475_19181 = state_17422__$1;
(statearr_17475_19181[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (17))){
var inst_17376 = (state_17422[(14)]);
var inst_17368 = (state_17422[(18)]);
var inst_17398 = (inst_17368.cljs$core$IFn$_invoke$arity$1 ? inst_17368.cljs$core$IFn$_invoke$arity$1(inst_17376) : inst_17368.call(null,inst_17376));
var inst_17399 = cljs.core.not(inst_17398);
var state_17422__$1 = state_17422;
var statearr_17485_19184 = state_17422__$1;
(statearr_17485_19184[(2)] = inst_17399);

(statearr_17485_19184[(1)] = (19));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (3))){
var inst_17420 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
return cljs.core.async.impl.ioc_helpers.return_chan(state_17422__$1,inst_17420);
} else {
if((state_val_17423 === (12))){
var state_17422__$1 = state_17422;
var statearr_17488_19188 = state_17422__$1;
(statearr_17488_19188[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (2))){
var inst_17363 = (state_17422[(8)]);
var inst_17366 = (state_17422[(12)]);
var inst_17366__$1 = cljs.core.__destructure_map(inst_17363);
var inst_17367 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17366__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_17368 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17366__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_17369 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17366__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_17422__$1 = (function (){var statearr_17492 = state_17422;
(statearr_17492[(12)] = inst_17366__$1);

(statearr_17492[(18)] = inst_17368);

(statearr_17492[(16)] = inst_17367);

return statearr_17492;
})();
return cljs.core.async.ioc_alts_BANG_(state_17422__$1,(4),inst_17369);
} else {
if((state_val_17423 === (23))){
var inst_17407 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
if(cljs.core.truth_(inst_17407)){
var statearr_17493_19189 = state_17422__$1;
(statearr_17493_19189[(1)] = (24));

} else {
var statearr_17494_19190 = state_17422__$1;
(statearr_17494_19190[(1)] = (25));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (19))){
var inst_17402 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
var statearr_17496_19194 = state_17422__$1;
(statearr_17496_19194[(2)] = inst_17402);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (11))){
var inst_17376 = (state_17422[(14)]);
var inst_17386 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(cs,cljs.core.dissoc,inst_17376);
var state_17422__$1 = state_17422;
var statearr_17497_19195 = state_17422__$1;
(statearr_17497_19195[(2)] = inst_17386);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (9))){
var inst_17376 = (state_17422[(14)]);
var inst_17367 = (state_17422[(16)]);
var inst_17393 = (state_17422[(19)]);
var inst_17393__$1 = (inst_17367.cljs$core$IFn$_invoke$arity$1 ? inst_17367.cljs$core$IFn$_invoke$arity$1(inst_17376) : inst_17367.call(null,inst_17376));
var state_17422__$1 = (function (){var statearr_17502 = state_17422;
(statearr_17502[(19)] = inst_17393__$1);

return statearr_17502;
})();
if(cljs.core.truth_(inst_17393__$1)){
var statearr_17503_19196 = state_17422__$1;
(statearr_17503_19196[(1)] = (14));

} else {
var statearr_17504_19197 = state_17422__$1;
(statearr_17504_19197[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (5))){
var inst_17377 = (state_17422[(13)]);
var state_17422__$1 = state_17422;
var statearr_17505_19198 = state_17422__$1;
(statearr_17505_19198[(2)] = inst_17377);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (14))){
var inst_17393 = (state_17422[(19)]);
var state_17422__$1 = state_17422;
var statearr_17509_19199 = state_17422__$1;
(statearr_17509_19199[(2)] = inst_17393);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (26))){
var inst_17412 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
var statearr_17510_19200 = state_17422__$1;
(statearr_17510_19200[(2)] = inst_17412);

(statearr_17510_19200[(1)] = (22));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (16))){
var inst_17404 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
if(cljs.core.truth_(inst_17404)){
var statearr_17511_19201 = state_17422__$1;
(statearr_17511_19201[(1)] = (20));

} else {
var statearr_17512_19202 = state_17422__$1;
(statearr_17512_19202[(1)] = (21));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (10))){
var inst_17418 = (state_17422[(2)]);
var state_17422__$1 = state_17422;
var statearr_17513_19203 = state_17422__$1;
(statearr_17513_19203[(2)] = inst_17418);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (18))){
var inst_17396 = (state_17422[(15)]);
var state_17422__$1 = state_17422;
var statearr_17514_19204 = state_17422__$1;
(statearr_17514_19204[(2)] = inst_17396);

(statearr_17514_19204[(1)] = (19));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17423 === (8))){
var inst_17375 = (state_17422[(7)]);
var inst_17384 = (inst_17375 == null);
var state_17422__$1 = state_17422;
if(cljs.core.truth_(inst_17384)){
var statearr_17516_19205 = state_17422__$1;
(statearr_17516_19205[(1)] = (11));

} else {
var statearr_17517_19206 = state_17422__$1;
(statearr_17517_19206[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mix_$_state_machine__14456__auto__ = null;
var cljs$core$async$mix_$_state_machine__14456__auto____0 = (function (){
var statearr_17518 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_17518[(0)] = cljs$core$async$mix_$_state_machine__14456__auto__);

(statearr_17518[(1)] = (1));

return statearr_17518;
});
var cljs$core$async$mix_$_state_machine__14456__auto____1 = (function (state_17422){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17422);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17523){var ex__14459__auto__ = e17523;
var statearr_17524_19210 = state_17422;
(statearr_17524_19210[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17422[(4)]))){
var statearr_17528_19211 = state_17422;
(statearr_17528_19211[(1)] = cljs.core.first((state_17422[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19212 = state_17422;
state_17422 = G__19212;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__14456__auto__ = function(state_17422){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__14456__auto____1.call(this,state_17422);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__14456__auto____0;
cljs$core$async$mix_$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__14456__auto____1;
return cljs$core$async$mix_$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17529 = f__15556__auto__();
(statearr_17529[(6)] = c__15554__auto___19156);

return statearr_17529;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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_(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_(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_(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_(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_(mix,mode);
});

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

var cljs$core$async$Pub$sub_STAR_$dyn_19217 = (function (p,v,ch,close_QMARK_){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5351__auto__.call(null,p,v,ch,close_QMARK_));
} else {
var m__5349__auto__ = (cljs.core.async.sub_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5349__auto__.call(null,p,v,ch,close_QMARK_));
} else {
throw cljs.core.missing_protocol("Pub.sub*",p);
}
}
});
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 {
return cljs$core$async$Pub$sub_STAR_$dyn_19217(p,v,ch,close_QMARK_);
}
});

var cljs$core$async$Pub$unsub_STAR_$dyn_19219 = (function (p,v,ch){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5351__auto__.call(null,p,v,ch));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5349__auto__.call(null,p,v,ch));
} else {
throw cljs.core.missing_protocol("Pub.unsub*",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 {
return cljs$core$async$Pub$unsub_STAR_$dyn_19219(p,v,ch);
}
});

var cljs$core$async$Pub$unsub_all_STAR_$dyn_19221 = (function() {
var G__19222 = null;
var G__19222__1 = (function (p){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5351__auto__.call(null,p));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5349__auto__.call(null,p));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
var G__19222__2 = (function (p,v){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5351__auto__.call(null,p,v));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5349__auto__.call(null,p,v));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
G__19222 = function(p,v){
switch(arguments.length){
case 1:
return G__19222__1.call(this,p);
case 2:
return G__19222__2.call(this,p,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__19222.cljs$core$IFn$_invoke$arity$1 = G__19222__1;
G__19222.cljs$core$IFn$_invoke$arity$2 = G__19222__2;
return G__19222;
})()
;
cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__17542 = arguments.length;
switch (G__17542) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.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 {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_19221(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 {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_19221(p,v);
}
}));

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



/**
* @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$async17551 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta17552){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta17552 = meta17552;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17551.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17553,meta17552__$1){
var self__ = this;
var _17553__$1 = this;
return (new cljs.core.async.t_cljs$core$async17551(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta17552__$1));
}));

(cljs.core.async.t_cljs$core$async17551.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17553){
var self__ = this;
var _17553__$1 = this;
return self__.meta17552;
}));

(cljs.core.async.t_cljs$core$async17551.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async17551.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL);

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

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

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

(cljs.core.async.t_cljs$core$async17551.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$2 = (function (_,topic){
var self__ = this;
var ___$1 = this;
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.mults,cljs.core.dissoc,topic);
}));

(cljs.core.async.t_cljs$core$async17551.getBasis = (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,"meta17552","meta17552",-1950173785,null)], null);
}));

(cljs.core.async.t_cljs$core$async17551.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17551.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17551");

(cljs.core.async.t_cljs$core$async17551.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17551");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17551.
 */
cljs.core.async.__GT_t_cljs$core$async17551 = (function cljs$core$async$__GT_t_cljs$core$async17551(ch,topic_fn,buf_fn,mults,ensure_mult,meta17552){
return (new cljs.core.async.t_cljs$core$async17551(ch,topic_fn,buf_fn,mults,ensure_mult,meta17552));
});


/**
 * 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 G__17550 = arguments.length;
switch (G__17550) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3 = (function (ch,topic_fn,buf_fn){
var mults = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var ensure_mult = (function (topic){
var or__5002__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(mults),topic);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(mults,(function (p1__17548_SHARP_){
if(cljs.core.truth_((p1__17548_SHARP_.cljs$core$IFn$_invoke$arity$1 ? p1__17548_SHARP_.cljs$core$IFn$_invoke$arity$1(topic) : p1__17548_SHARP_.call(null,topic)))){
return p1__17548_SHARP_;
} else {
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(p1__17548_SHARP_,topic,cljs.core.async.mult(cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((buf_fn.cljs$core$IFn$_invoke$arity$1 ? buf_fn.cljs$core$IFn$_invoke$arity$1(topic) : buf_fn.call(null,topic)))));
}
})),topic);
}
});
var p = (new cljs.core.async.t_cljs$core$async17551(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
var c__15554__auto___19245 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17657){
var state_val_17658 = (state_17657[(1)]);
if((state_val_17658 === (7))){
var inst_17653 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17659_19250 = state_17657__$1;
(statearr_17659_19250[(2)] = inst_17653);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (20))){
var state_17657__$1 = state_17657;
var statearr_17660_19251 = state_17657__$1;
(statearr_17660_19251[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (1))){
var state_17657__$1 = state_17657;
var statearr_17661_19252 = state_17657__$1;
(statearr_17661_19252[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (24))){
var inst_17636 = (state_17657[(7)]);
var inst_17645 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(mults,cljs.core.dissoc,inst_17636);
var state_17657__$1 = state_17657;
var statearr_17662_19253 = state_17657__$1;
(statearr_17662_19253[(2)] = inst_17645);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (4))){
var inst_17574 = (state_17657[(8)]);
var inst_17574__$1 = (state_17657[(2)]);
var inst_17575 = (inst_17574__$1 == null);
var state_17657__$1 = (function (){var statearr_17668 = state_17657;
(statearr_17668[(8)] = inst_17574__$1);

return statearr_17668;
})();
if(cljs.core.truth_(inst_17575)){
var statearr_17669_19254 = state_17657__$1;
(statearr_17669_19254[(1)] = (5));

} else {
var statearr_17670_19255 = state_17657__$1;
(statearr_17670_19255[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (15))){
var inst_17629 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17671_19258 = state_17657__$1;
(statearr_17671_19258[(2)] = inst_17629);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (21))){
var inst_17650 = (state_17657[(2)]);
var state_17657__$1 = (function (){var statearr_17677 = state_17657;
(statearr_17677[(9)] = inst_17650);

return statearr_17677;
})();
var statearr_17678_19259 = state_17657__$1;
(statearr_17678_19259[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (13))){
var inst_17610 = (state_17657[(10)]);
var inst_17612 = cljs.core.chunked_seq_QMARK_(inst_17610);
var state_17657__$1 = state_17657;
if(inst_17612){
var statearr_17679_19272 = state_17657__$1;
(statearr_17679_19272[(1)] = (16));

} else {
var statearr_17680_19273 = state_17657__$1;
(statearr_17680_19273[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (22))){
var inst_17642 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
if(cljs.core.truth_(inst_17642)){
var statearr_17681_19274 = state_17657__$1;
(statearr_17681_19274[(1)] = (23));

} else {
var statearr_17682_19275 = state_17657__$1;
(statearr_17682_19275[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (6))){
var inst_17636 = (state_17657[(7)]);
var inst_17638 = (state_17657[(11)]);
var inst_17574 = (state_17657[(8)]);
var inst_17636__$1 = (topic_fn.cljs$core$IFn$_invoke$arity$1 ? topic_fn.cljs$core$IFn$_invoke$arity$1(inst_17574) : topic_fn.call(null,inst_17574));
var inst_17637 = cljs.core.deref(mults);
var inst_17638__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_17637,inst_17636__$1);
var state_17657__$1 = (function (){var statearr_17683 = state_17657;
(statearr_17683[(7)] = inst_17636__$1);

(statearr_17683[(11)] = inst_17638__$1);

return statearr_17683;
})();
if(cljs.core.truth_(inst_17638__$1)){
var statearr_17684_19276 = state_17657__$1;
(statearr_17684_19276[(1)] = (19));

} else {
var statearr_17685_19277 = state_17657__$1;
(statearr_17685_19277[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (25))){
var inst_17647 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17687_19278 = state_17657__$1;
(statearr_17687_19278[(2)] = inst_17647);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (17))){
var inst_17610 = (state_17657[(10)]);
var inst_17619 = cljs.core.first(inst_17610);
var inst_17621 = cljs.core.async.muxch_STAR_(inst_17619);
var inst_17622 = cljs.core.async.close_BANG_(inst_17621);
var inst_17623 = cljs.core.next(inst_17610);
var inst_17590 = inst_17623;
var inst_17591 = null;
var inst_17592 = (0);
var inst_17593 = (0);
var state_17657__$1 = (function (){var statearr_17688 = state_17657;
(statearr_17688[(12)] = inst_17593);

(statearr_17688[(13)] = inst_17591);

(statearr_17688[(14)] = inst_17592);

(statearr_17688[(15)] = inst_17622);

(statearr_17688[(16)] = inst_17590);

return statearr_17688;
})();
var statearr_17690_19280 = state_17657__$1;
(statearr_17690_19280[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (3))){
var inst_17655 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
return cljs.core.async.impl.ioc_helpers.return_chan(state_17657__$1,inst_17655);
} else {
if((state_val_17658 === (12))){
var inst_17631 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17691_19282 = state_17657__$1;
(statearr_17691_19282[(2)] = inst_17631);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (2))){
var state_17657__$1 = state_17657;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_17657__$1,(4),ch);
} else {
if((state_val_17658 === (23))){
var state_17657__$1 = state_17657;
var statearr_17697_19283 = state_17657__$1;
(statearr_17697_19283[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (19))){
var inst_17638 = (state_17657[(11)]);
var inst_17574 = (state_17657[(8)]);
var inst_17640 = cljs.core.async.muxch_STAR_(inst_17638);
var state_17657__$1 = state_17657;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_17657__$1,(22),inst_17640,inst_17574);
} else {
if((state_val_17658 === (11))){
var inst_17610 = (state_17657[(10)]);
var inst_17590 = (state_17657[(16)]);
var inst_17610__$1 = cljs.core.seq(inst_17590);
var state_17657__$1 = (function (){var statearr_17698 = state_17657;
(statearr_17698[(10)] = inst_17610__$1);

return statearr_17698;
})();
if(inst_17610__$1){
var statearr_17699_19284 = state_17657__$1;
(statearr_17699_19284[(1)] = (13));

} else {
var statearr_17700_19285 = state_17657__$1;
(statearr_17700_19285[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (9))){
var inst_17633 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17701_19286 = state_17657__$1;
(statearr_17701_19286[(2)] = inst_17633);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (5))){
var inst_17587 = cljs.core.deref(mults);
var inst_17588 = cljs.core.vals(inst_17587);
var inst_17589 = cljs.core.seq(inst_17588);
var inst_17590 = inst_17589;
var inst_17591 = null;
var inst_17592 = (0);
var inst_17593 = (0);
var state_17657__$1 = (function (){var statearr_17702 = state_17657;
(statearr_17702[(12)] = inst_17593);

(statearr_17702[(13)] = inst_17591);

(statearr_17702[(14)] = inst_17592);

(statearr_17702[(16)] = inst_17590);

return statearr_17702;
})();
var statearr_17703_19287 = state_17657__$1;
(statearr_17703_19287[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (14))){
var state_17657__$1 = state_17657;
var statearr_17707_19288 = state_17657__$1;
(statearr_17707_19288[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (16))){
var inst_17610 = (state_17657[(10)]);
var inst_17614 = cljs.core.chunk_first(inst_17610);
var inst_17615 = cljs.core.chunk_rest(inst_17610);
var inst_17616 = cljs.core.count(inst_17614);
var inst_17590 = inst_17615;
var inst_17591 = inst_17614;
var inst_17592 = inst_17616;
var inst_17593 = (0);
var state_17657__$1 = (function (){var statearr_17708 = state_17657;
(statearr_17708[(12)] = inst_17593);

(statearr_17708[(13)] = inst_17591);

(statearr_17708[(14)] = inst_17592);

(statearr_17708[(16)] = inst_17590);

return statearr_17708;
})();
var statearr_17709_19289 = state_17657__$1;
(statearr_17709_19289[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (10))){
var inst_17593 = (state_17657[(12)]);
var inst_17591 = (state_17657[(13)]);
var inst_17592 = (state_17657[(14)]);
var inst_17590 = (state_17657[(16)]);
var inst_17598 = cljs.core._nth(inst_17591,inst_17593);
var inst_17599 = cljs.core.async.muxch_STAR_(inst_17598);
var inst_17600 = cljs.core.async.close_BANG_(inst_17599);
var inst_17607 = (inst_17593 + (1));
var tmp17704 = inst_17591;
var tmp17705 = inst_17592;
var tmp17706 = inst_17590;
var inst_17590__$1 = tmp17706;
var inst_17591__$1 = tmp17704;
var inst_17592__$1 = tmp17705;
var inst_17593__$1 = inst_17607;
var state_17657__$1 = (function (){var statearr_17714 = state_17657;
(statearr_17714[(12)] = inst_17593__$1);

(statearr_17714[(17)] = inst_17600);

(statearr_17714[(13)] = inst_17591__$1);

(statearr_17714[(14)] = inst_17592__$1);

(statearr_17714[(16)] = inst_17590__$1);

return statearr_17714;
})();
var statearr_17715_19290 = state_17657__$1;
(statearr_17715_19290[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (18))){
var inst_17626 = (state_17657[(2)]);
var state_17657__$1 = state_17657;
var statearr_17716_19291 = state_17657__$1;
(statearr_17716_19291[(2)] = inst_17626);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17658 === (8))){
var inst_17593 = (state_17657[(12)]);
var inst_17592 = (state_17657[(14)]);
var inst_17595 = (inst_17593 < inst_17592);
var inst_17596 = inst_17595;
var state_17657__$1 = state_17657;
if(cljs.core.truth_(inst_17596)){
var statearr_17717_19292 = state_17657__$1;
(statearr_17717_19292[(1)] = (10));

} else {
var statearr_17718_19293 = state_17657__$1;
(statearr_17718_19293[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_17719 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_17719[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_17719[(1)] = (1));

return statearr_17719;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_17657){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17657);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17720){var ex__14459__auto__ = e17720;
var statearr_17721_19295 = state_17657;
(statearr_17721_19295[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17657[(4)]))){
var statearr_17722_19296 = state_17657;
(statearr_17722_19296[(1)] = cljs.core.first((state_17657[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19297 = state_17657;
state_17657 = G__19297;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_17657){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_17657);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17723 = f__15556__auto__();
(statearr_17723[(6)] = c__15554__auto___19245);

return statearr_17723;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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 G__17725 = arguments.length;
switch (G__17725) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3 = (function (p,topic,ch){
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4(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_(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_(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 G__17737 = arguments.length;
switch (G__17737) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2 = (function (p,topic){
return cljs.core.async.unsub_all_STAR_(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 G__17742 = arguments.length;
switch (G__17742) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.map.cljs$core$IFn$_invoke$arity$2 = (function (f,chs){
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$3(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(chs);
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var cnt = cljs.core.count(chs__$1);
var rets = cljs.core.object_array.cljs$core$IFn$_invoke$arity$1(cnt);
var dchan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var dctr = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
var done = cljs.core.mapv.cljs$core$IFn$_invoke$arity$2((function (i){
return (function (ret){
(rets[i] = ret);

if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,rets.slice((0)));
} else {
return null;
}
});
}),cljs.core.range.cljs$core$IFn$_invoke$arity$1(cnt));
if((cnt === (0))){
cljs.core.async.close_BANG_(out);
} else {
var c__15554__auto___19310 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17788){
var state_val_17789 = (state_17788[(1)]);
if((state_val_17789 === (7))){
var state_17788__$1 = state_17788;
var statearr_17790_19311 = state_17788__$1;
(statearr_17790_19311[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (1))){
var state_17788__$1 = state_17788;
var statearr_17791_19313 = state_17788__$1;
(statearr_17791_19313[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (4))){
var inst_17748 = (state_17788[(7)]);
var inst_17749 = (state_17788[(8)]);
var inst_17751 = (inst_17749 < inst_17748);
var state_17788__$1 = state_17788;
if(cljs.core.truth_(inst_17751)){
var statearr_17792_19314 = state_17788__$1;
(statearr_17792_19314[(1)] = (6));

} else {
var statearr_17793_19315 = state_17788__$1;
(statearr_17793_19315[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (15))){
var inst_17774 = (state_17788[(9)]);
var inst_17779 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(f,inst_17774);
var state_17788__$1 = state_17788;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_17788__$1,(17),out,inst_17779);
} else {
if((state_val_17789 === (13))){
var inst_17774 = (state_17788[(9)]);
var inst_17774__$1 = (state_17788[(2)]);
var inst_17775 = cljs.core.some(cljs.core.nil_QMARK_,inst_17774__$1);
var state_17788__$1 = (function (){var statearr_17794 = state_17788;
(statearr_17794[(9)] = inst_17774__$1);

return statearr_17794;
})();
if(cljs.core.truth_(inst_17775)){
var statearr_17795_19316 = state_17788__$1;
(statearr_17795_19316[(1)] = (14));

} else {
var statearr_17796_19317 = state_17788__$1;
(statearr_17796_19317[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (6))){
var state_17788__$1 = state_17788;
var statearr_17797_19318 = state_17788__$1;
(statearr_17797_19318[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (17))){
var inst_17781 = (state_17788[(2)]);
var state_17788__$1 = (function (){var statearr_17800 = state_17788;
(statearr_17800[(10)] = inst_17781);

return statearr_17800;
})();
var statearr_17801_19319 = state_17788__$1;
(statearr_17801_19319[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (3))){
var inst_17786 = (state_17788[(2)]);
var state_17788__$1 = state_17788;
return cljs.core.async.impl.ioc_helpers.return_chan(state_17788__$1,inst_17786);
} else {
if((state_val_17789 === (12))){
var _ = (function (){var statearr_17802 = state_17788;
(statearr_17802[(4)] = cljs.core.rest((state_17788[(4)])));

return statearr_17802;
})();
var state_17788__$1 = state_17788;
var ex17798 = (state_17788__$1[(2)]);
var statearr_17803_19321 = state_17788__$1;
(statearr_17803_19321[(5)] = ex17798);


if((ex17798 instanceof Object)){
var statearr_17807_19322 = state_17788__$1;
(statearr_17807_19322[(1)] = (11));

(statearr_17807_19322[(5)] = null);

} else {
throw ex17798;

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (2))){
var inst_17747 = cljs.core.reset_BANG_(dctr,cnt);
var inst_17748 = cnt;
var inst_17749 = (0);
var state_17788__$1 = (function (){var statearr_17808 = state_17788;
(statearr_17808[(11)] = inst_17747);

(statearr_17808[(7)] = inst_17748);

(statearr_17808[(8)] = inst_17749);

return statearr_17808;
})();
var statearr_17812_19323 = state_17788__$1;
(statearr_17812_19323[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (11))){
var inst_17753 = (state_17788[(2)]);
var inst_17754 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec);
var state_17788__$1 = (function (){var statearr_17813 = state_17788;
(statearr_17813[(12)] = inst_17753);

return statearr_17813;
})();
var statearr_17814_19324 = state_17788__$1;
(statearr_17814_19324[(2)] = inst_17754);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (9))){
var inst_17749 = (state_17788[(8)]);
var _ = (function (){var statearr_17815 = state_17788;
(statearr_17815[(4)] = cljs.core.cons((12),(state_17788[(4)])));

return statearr_17815;
})();
var inst_17760 = (chs__$1.cljs$core$IFn$_invoke$arity$1 ? chs__$1.cljs$core$IFn$_invoke$arity$1(inst_17749) : chs__$1.call(null,inst_17749));
var inst_17761 = (done.cljs$core$IFn$_invoke$arity$1 ? done.cljs$core$IFn$_invoke$arity$1(inst_17749) : done.call(null,inst_17749));
var inst_17762 = cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2(inst_17760,inst_17761);
var ___$1 = (function (){var statearr_17816 = state_17788;
(statearr_17816[(4)] = cljs.core.rest((state_17788[(4)])));

return statearr_17816;
})();
var state_17788__$1 = state_17788;
var statearr_17817_19325 = state_17788__$1;
(statearr_17817_19325[(2)] = inst_17762);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (5))){
var inst_17772 = (state_17788[(2)]);
var state_17788__$1 = (function (){var statearr_17818 = state_17788;
(statearr_17818[(13)] = inst_17772);

return statearr_17818;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_17788__$1,(13),dchan);
} else {
if((state_val_17789 === (14))){
var inst_17777 = cljs.core.async.close_BANG_(out);
var state_17788__$1 = state_17788;
var statearr_17819_19330 = state_17788__$1;
(statearr_17819_19330[(2)] = inst_17777);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (16))){
var inst_17784 = (state_17788[(2)]);
var state_17788__$1 = state_17788;
var statearr_17820_19331 = state_17788__$1;
(statearr_17820_19331[(2)] = inst_17784);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (10))){
var inst_17749 = (state_17788[(8)]);
var inst_17765 = (state_17788[(2)]);
var inst_17766 = (inst_17749 + (1));
var inst_17749__$1 = inst_17766;
var state_17788__$1 = (function (){var statearr_17824 = state_17788;
(statearr_17824[(14)] = inst_17765);

(statearr_17824[(8)] = inst_17749__$1);

return statearr_17824;
})();
var statearr_17825_19332 = state_17788__$1;
(statearr_17825_19332[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17789 === (8))){
var inst_17770 = (state_17788[(2)]);
var state_17788__$1 = state_17788;
var statearr_17826_19333 = state_17788__$1;
(statearr_17826_19333[(2)] = inst_17770);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_17827 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_17827[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_17827[(1)] = (1));

return statearr_17827;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_17788){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17788);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17828){var ex__14459__auto__ = e17828;
var statearr_17829_19338 = state_17788;
(statearr_17829_19338[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17788[(4)]))){
var statearr_17830_19339 = state_17788;
(statearr_17830_19339[(1)] = cljs.core.first((state_17788[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19346 = state_17788;
state_17788 = G__19346;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_17788){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_17788);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17831 = f__15556__auto__();
(statearr_17831[(6)] = c__15554__auto___19310);

return statearr_17831;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

}

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 G__17834 = arguments.length;
switch (G__17834) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19348 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17867){
var state_val_17868 = (state_17867[(1)]);
if((state_val_17868 === (7))){
var inst_17847 = (state_17867[(7)]);
var inst_17846 = (state_17867[(8)]);
var inst_17846__$1 = (state_17867[(2)]);
var inst_17847__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17846__$1,(0),null);
var inst_17848 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_17846__$1,(1),null);
var inst_17849 = (inst_17847__$1 == null);
var state_17867__$1 = (function (){var statearr_17869 = state_17867;
(statearr_17869[(7)] = inst_17847__$1);

(statearr_17869[(8)] = inst_17846__$1);

(statearr_17869[(9)] = inst_17848);

return statearr_17869;
})();
if(cljs.core.truth_(inst_17849)){
var statearr_17870_19349 = state_17867__$1;
(statearr_17870_19349[(1)] = (8));

} else {
var statearr_17872_19350 = state_17867__$1;
(statearr_17872_19350[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (1))){
var inst_17836 = cljs.core.vec(chs);
var inst_17837 = inst_17836;
var state_17867__$1 = (function (){var statearr_17875 = state_17867;
(statearr_17875[(10)] = inst_17837);

return statearr_17875;
})();
var statearr_17876_19351 = state_17867__$1;
(statearr_17876_19351[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (4))){
var inst_17837 = (state_17867[(10)]);
var state_17867__$1 = state_17867;
return cljs.core.async.ioc_alts_BANG_(state_17867__$1,(7),inst_17837);
} else {
if((state_val_17868 === (6))){
var inst_17863 = (state_17867[(2)]);
var state_17867__$1 = state_17867;
var statearr_17881_19352 = state_17867__$1;
(statearr_17881_19352[(2)] = inst_17863);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (3))){
var inst_17865 = (state_17867[(2)]);
var state_17867__$1 = state_17867;
return cljs.core.async.impl.ioc_helpers.return_chan(state_17867__$1,inst_17865);
} else {
if((state_val_17868 === (2))){
var inst_17837 = (state_17867[(10)]);
var inst_17839 = cljs.core.count(inst_17837);
var inst_17840 = (inst_17839 > (0));
var state_17867__$1 = state_17867;
if(cljs.core.truth_(inst_17840)){
var statearr_17883_19353 = state_17867__$1;
(statearr_17883_19353[(1)] = (4));

} else {
var statearr_17884_19354 = state_17867__$1;
(statearr_17884_19354[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (11))){
var inst_17837 = (state_17867[(10)]);
var inst_17856 = (state_17867[(2)]);
var tmp17882 = inst_17837;
var inst_17837__$1 = tmp17882;
var state_17867__$1 = (function (){var statearr_17885 = state_17867;
(statearr_17885[(11)] = inst_17856);

(statearr_17885[(10)] = inst_17837__$1);

return statearr_17885;
})();
var statearr_17886_19356 = state_17867__$1;
(statearr_17886_19356[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (9))){
var inst_17847 = (state_17867[(7)]);
var state_17867__$1 = state_17867;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_17867__$1,(11),out,inst_17847);
} else {
if((state_val_17868 === (5))){
var inst_17861 = cljs.core.async.close_BANG_(out);
var state_17867__$1 = state_17867;
var statearr_17891_19357 = state_17867__$1;
(statearr_17891_19357[(2)] = inst_17861);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (10))){
var inst_17859 = (state_17867[(2)]);
var state_17867__$1 = state_17867;
var statearr_17892_19358 = state_17867__$1;
(statearr_17892_19358[(2)] = inst_17859);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17868 === (8))){
var inst_17847 = (state_17867[(7)]);
var inst_17846 = (state_17867[(8)]);
var inst_17848 = (state_17867[(9)]);
var inst_17837 = (state_17867[(10)]);
var inst_17851 = (function (){var cs = inst_17837;
var vec__17842 = inst_17846;
var v = inst_17847;
var c = inst_17848;
return (function (p1__17832_SHARP_){
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(c,p1__17832_SHARP_);
});
})();
var inst_17852 = cljs.core.filterv(inst_17851,inst_17837);
var inst_17837__$1 = inst_17852;
var state_17867__$1 = (function (){var statearr_17893 = state_17867;
(statearr_17893[(10)] = inst_17837__$1);

return statearr_17893;
})();
var statearr_17894_19364 = state_17867__$1;
(statearr_17894_19364[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_17895 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_17895[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_17895[(1)] = (1));

return statearr_17895;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_17867){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17867);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17896){var ex__14459__auto__ = e17896;
var statearr_17897_19369 = state_17867;
(statearr_17897_19369[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17867[(4)]))){
var statearr_17898_19370 = state_17867;
(statearr_17898_19370[(1)] = cljs.core.first((state_17867[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19371 = state_17867;
state_17867 = G__19371;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_17867){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_17867);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17899 = f__15556__auto__();
(statearr_17899[(6)] = c__15554__auto___19348);

return statearr_17899;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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(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 G__17901 = arguments.length;
switch (G__17901) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.take.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19373 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_17930){
var state_val_17931 = (state_17930[(1)]);
if((state_val_17931 === (7))){
var inst_17911 = (state_17930[(7)]);
var inst_17911__$1 = (state_17930[(2)]);
var inst_17913 = (inst_17911__$1 == null);
var inst_17914 = cljs.core.not(inst_17913);
var state_17930__$1 = (function (){var statearr_17932 = state_17930;
(statearr_17932[(7)] = inst_17911__$1);

return statearr_17932;
})();
if(inst_17914){
var statearr_17933_19374 = state_17930__$1;
(statearr_17933_19374[(1)] = (8));

} else {
var statearr_17934_19376 = state_17930__$1;
(statearr_17934_19376[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (1))){
var inst_17905 = (0);
var state_17930__$1 = (function (){var statearr_17935 = state_17930;
(statearr_17935[(8)] = inst_17905);

return statearr_17935;
})();
var statearr_17936_19377 = state_17930__$1;
(statearr_17936_19377[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (4))){
var state_17930__$1 = state_17930;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_17930__$1,(7),ch);
} else {
if((state_val_17931 === (6))){
var inst_17925 = (state_17930[(2)]);
var state_17930__$1 = state_17930;
var statearr_17937_19378 = state_17930__$1;
(statearr_17937_19378[(2)] = inst_17925);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (3))){
var inst_17927 = (state_17930[(2)]);
var inst_17928 = cljs.core.async.close_BANG_(out);
var state_17930__$1 = (function (){var statearr_17951 = state_17930;
(statearr_17951[(9)] = inst_17927);

return statearr_17951;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_17930__$1,inst_17928);
} else {
if((state_val_17931 === (2))){
var inst_17905 = (state_17930[(8)]);
var inst_17907 = (inst_17905 < n);
var state_17930__$1 = state_17930;
if(cljs.core.truth_(inst_17907)){
var statearr_17952_19379 = state_17930__$1;
(statearr_17952_19379[(1)] = (4));

} else {
var statearr_17953_19380 = state_17930__$1;
(statearr_17953_19380[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (11))){
var inst_17905 = (state_17930[(8)]);
var inst_17917 = (state_17930[(2)]);
var inst_17918 = (inst_17905 + (1));
var inst_17905__$1 = inst_17918;
var state_17930__$1 = (function (){var statearr_17954 = state_17930;
(statearr_17954[(8)] = inst_17905__$1);

(statearr_17954[(10)] = inst_17917);

return statearr_17954;
})();
var statearr_17955_19383 = state_17930__$1;
(statearr_17955_19383[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (9))){
var state_17930__$1 = state_17930;
var statearr_17956_19385 = state_17930__$1;
(statearr_17956_19385[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (5))){
var state_17930__$1 = state_17930;
var statearr_17957_19386 = state_17930__$1;
(statearr_17957_19386[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (10))){
var inst_17922 = (state_17930[(2)]);
var state_17930__$1 = state_17930;
var statearr_17958_19387 = state_17930__$1;
(statearr_17958_19387[(2)] = inst_17922);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_17931 === (8))){
var inst_17911 = (state_17930[(7)]);
var state_17930__$1 = state_17930;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_17930__$1,(11),out,inst_17911);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_17959 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_17959[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_17959[(1)] = (1));

return statearr_17959;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_17930){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_17930);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e17960){var ex__14459__auto__ = e17960;
var statearr_17961_19388 = state_17930;
(statearr_17961_19388[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_17930[(4)]))){
var statearr_17962_19389 = state_17930;
(statearr_17962_19389[(1)] = cljs.core.first((state_17930[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19390 = state_17930;
state_17930 = G__19390;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_17930){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_17930);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_17963 = f__15556__auto__();
(statearr_17963[(6)] = c__15554__auto___19373);

return statearr_17963;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


return out;
}));

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


/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async17977 = (function (f,ch,meta17972,_,fn1,meta17978){
this.f = f;
this.ch = ch;
this.meta17972 = meta17972;
this._ = _;
this.fn1 = fn1;
this.meta17978 = meta17978;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17977.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17979,meta17978__$1){
var self__ = this;
var _17979__$1 = this;
return (new cljs.core.async.t_cljs$core$async17977(self__.f,self__.ch,self__.meta17972,self__._,self__.fn1,meta17978__$1));
}));

(cljs.core.async.t_cljs$core$async17977.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17979){
var self__ = this;
var _17979__$1 = this;
return self__.meta17978;
}));

(cljs.core.async.t_cljs$core$async17977.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

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

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

(cljs.core.async.t_cljs$core$async17977.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (___$1){
var self__ = this;
var ___$2 = this;
var f1 = cljs.core.async.impl.protocols.commit(self__.fn1);
return (function (p1__17970_SHARP_){
var G__17980 = (((p1__17970_SHARP_ == null))?null:(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(p1__17970_SHARP_) : self__.f.call(null,p1__17970_SHARP_)));
return (f1.cljs$core$IFn$_invoke$arity$1 ? f1.cljs$core$IFn$_invoke$arity$1(G__17980) : f1.call(null,G__17980));
});
}));

(cljs.core.async.t_cljs$core$async17977.getBasis = (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,"meta17972","meta17972",-632436674,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$async17971","cljs.core.async/t_cljs$core$async17971",-181154749,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta17978","meta17978",1923326813,null)], null);
}));

(cljs.core.async.t_cljs$core$async17977.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17977.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17977");

(cljs.core.async.t_cljs$core$async17977.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17977");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17977.
 */
cljs.core.async.__GT_t_cljs$core$async17977 = (function cljs$core$async$__GT_t_cljs$core$async17977(f,ch,meta17972,_,fn1,meta17978){
return (new cljs.core.async.t_cljs$core$async17977(f,ch,meta17972,_,fn1,meta17978));
});



/**
* @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$async17971 = (function (f,ch,meta17972){
this.f = f;
this.ch = ch;
this.meta17972 = meta17972;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17971.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17973,meta17972__$1){
var self__ = this;
var _17973__$1 = this;
return (new cljs.core.async.t_cljs$core$async17971(self__.f,self__.ch,meta17972__$1));
}));

(cljs.core.async.t_cljs$core$async17971.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17973){
var self__ = this;
var _17973__$1 = this;
return self__.meta17972;
}));

(cljs.core.async.t_cljs$core$async17971.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17971.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async17971.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async17971.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17971.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_(self__.ch,(new cljs.core.async.t_cljs$core$async17977(self__.f,self__.ch,self__.meta17972,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY)));
if(cljs.core.truth_((function (){var and__5000__auto__ = ret;
if(cljs.core.truth_(and__5000__auto__)){
return (!((cljs.core.deref(ret) == null)));
} else {
return and__5000__auto__;
}
})())){
return cljs.core.async.impl.channels.box((function (){var G__17985 = cljs.core.deref(ret);
return (self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(G__17985) : self__.f.call(null,G__17985));
})());
} else {
return ret;
}
}));

(cljs.core.async.t_cljs$core$async17971.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17971.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_(self__.ch,val,fn1);
}));

(cljs.core.async.t_cljs$core$async17971.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,"meta17972","meta17972",-632436674,null)], null);
}));

(cljs.core.async.t_cljs$core$async17971.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17971.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17971");

(cljs.core.async.t_cljs$core$async17971.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17971");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17971.
 */
cljs.core.async.__GT_t_cljs$core$async17971 = (function cljs$core$async$__GT_t_cljs$core$async17971(f,ch,meta17972){
return (new cljs.core.async.t_cljs$core$async17971(f,ch,meta17972));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_LT_ = (function cljs$core$async$map_LT_(f,ch){
return (new cljs.core.async.t_cljs$core$async17971(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});

/**
* @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$async17989 = (function (f,ch,meta17990){
this.f = f;
this.ch = ch;
this.meta17990 = meta17990;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17989.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17991,meta17990__$1){
var self__ = this;
var _17991__$1 = this;
return (new cljs.core.async.t_cljs$core$async17989(self__.f,self__.ch,meta17990__$1));
}));

(cljs.core.async.t_cljs$core$async17989.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17991){
var self__ = this;
var _17991__$1 = this;
return self__.meta17990;
}));

(cljs.core.async.t_cljs$core$async17989.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17989.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async17989.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17989.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_(self__.ch,fn1);
}));

(cljs.core.async.t_cljs$core$async17989.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17989.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_(self__.ch,(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(val) : self__.f.call(null,val)),fn1);
}));

(cljs.core.async.t_cljs$core$async17989.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,"meta17990","meta17990",1359985220,null)], null);
}));

(cljs.core.async.t_cljs$core$async17989.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17989.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17989");

(cljs.core.async.t_cljs$core$async17989.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17989");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17989.
 */
cljs.core.async.__GT_t_cljs$core$async17989 = (function cljs$core$async$__GT_t_cljs$core$async17989(f,ch,meta17990){
return (new cljs.core.async.t_cljs$core$async17989(f,ch,meta17990));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_GT_ = (function cljs$core$async$map_GT_(f,ch){
return (new cljs.core.async.t_cljs$core$async17989(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});

/**
* @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$async17996 = (function (p,ch,meta17997){
this.p = p;
this.ch = ch;
this.meta17997 = meta17997;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async17996.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_17998,meta17997__$1){
var self__ = this;
var _17998__$1 = this;
return (new cljs.core.async.t_cljs$core$async17996(self__.p,self__.ch,meta17997__$1));
}));

(cljs.core.async.t_cljs$core$async17996.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_17998){
var self__ = this;
var _17998__$1 = this;
return self__.meta17997;
}));

(cljs.core.async.t_cljs$core$async17996.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17996.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async17996.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async17996.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17996.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_(self__.ch,fn1);
}));

(cljs.core.async.t_cljs$core$async17996.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async17996.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.cljs$core$IFn$_invoke$arity$1 ? self__.p.cljs$core$IFn$_invoke$arity$1(val) : self__.p.call(null,val)))){
return cljs.core.async.impl.protocols.put_BANG_(self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box(cljs.core.not(cljs.core.async.impl.protocols.closed_QMARK_(self__.ch)));
}
}));

(cljs.core.async.t_cljs$core$async17996.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,"meta17997","meta17997",1566046277,null)], null);
}));

(cljs.core.async.t_cljs$core$async17996.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async17996.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async17996");

(cljs.core.async.t_cljs$core$async17996.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async17996");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async17996.
 */
cljs.core.async.__GT_t_cljs$core$async17996 = (function cljs$core$async$__GT_t_cljs$core$async17996(p,ch,meta17997){
return (new cljs.core.async.t_cljs$core$async17996(p,ch,meta17997));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_GT_ = (function cljs$core$async$filter_GT_(p,ch){
return (new cljs.core.async.t_cljs$core$async17996(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_(cljs.core.complement(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 G__18006 = arguments.length;
switch (G__18006) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19413 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_18027){
var state_val_18028 = (state_18027[(1)]);
if((state_val_18028 === (7))){
var inst_18023 = (state_18027[(2)]);
var state_18027__$1 = state_18027;
var statearr_18029_19415 = state_18027__$1;
(statearr_18029_19415[(2)] = inst_18023);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (1))){
var state_18027__$1 = state_18027;
var statearr_18030_19416 = state_18027__$1;
(statearr_18030_19416[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (4))){
var inst_18009 = (state_18027[(7)]);
var inst_18009__$1 = (state_18027[(2)]);
var inst_18010 = (inst_18009__$1 == null);
var state_18027__$1 = (function (){var statearr_18044 = state_18027;
(statearr_18044[(7)] = inst_18009__$1);

return statearr_18044;
})();
if(cljs.core.truth_(inst_18010)){
var statearr_18045_19417 = state_18027__$1;
(statearr_18045_19417[(1)] = (5));

} else {
var statearr_18047_19418 = state_18027__$1;
(statearr_18047_19418[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (6))){
var inst_18009 = (state_18027[(7)]);
var inst_18014 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_18009) : p.call(null,inst_18009));
var state_18027__$1 = state_18027;
if(cljs.core.truth_(inst_18014)){
var statearr_18049_19419 = state_18027__$1;
(statearr_18049_19419[(1)] = (8));

} else {
var statearr_18050_19420 = state_18027__$1;
(statearr_18050_19420[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (3))){
var inst_18025 = (state_18027[(2)]);
var state_18027__$1 = state_18027;
return cljs.core.async.impl.ioc_helpers.return_chan(state_18027__$1,inst_18025);
} else {
if((state_val_18028 === (2))){
var state_18027__$1 = state_18027;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_18027__$1,(4),ch);
} else {
if((state_val_18028 === (11))){
var inst_18017 = (state_18027[(2)]);
var state_18027__$1 = state_18027;
var statearr_18051_19425 = state_18027__$1;
(statearr_18051_19425[(2)] = inst_18017);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (9))){
var state_18027__$1 = state_18027;
var statearr_18052_19426 = state_18027__$1;
(statearr_18052_19426[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (5))){
var inst_18012 = cljs.core.async.close_BANG_(out);
var state_18027__$1 = state_18027;
var statearr_18053_19427 = state_18027__$1;
(statearr_18053_19427[(2)] = inst_18012);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (10))){
var inst_18020 = (state_18027[(2)]);
var state_18027__$1 = (function (){var statearr_18054 = state_18027;
(statearr_18054[(8)] = inst_18020);

return statearr_18054;
})();
var statearr_18055_19432 = state_18027__$1;
(statearr_18055_19432[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18028 === (8))){
var inst_18009 = (state_18027[(7)]);
var state_18027__$1 = state_18027;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18027__$1,(11),out,inst_18009);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_18056 = [null,null,null,null,null,null,null,null,null];
(statearr_18056[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_18056[(1)] = (1));

return statearr_18056;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_18027){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_18027);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e18057){var ex__14459__auto__ = e18057;
var statearr_18058_19434 = state_18027;
(statearr_18058_19434[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_18027[(4)]))){
var statearr_18059_19435 = state_18027;
(statearr_18059_19435[(1)] = cljs.core.first((state_18027[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19436 = state_18027;
state_18027 = G__19436;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_18027){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_18027);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_18060 = f__15556__auto__();
(statearr_18060[(6)] = c__15554__auto___19413);

return statearr_18060;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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 G__18062 = arguments.length;
switch (G__18062) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3(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_.cljs$core$IFn$_invoke$arity$3(cljs.core.complement(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__15554__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_18148){
var state_val_18149 = (state_18148[(1)]);
if((state_val_18149 === (7))){
var inst_18144 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
var statearr_18150_19443 = state_18148__$1;
(statearr_18150_19443[(2)] = inst_18144);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (20))){
var inst_18114 = (state_18148[(7)]);
var inst_18125 = (state_18148[(2)]);
var inst_18126 = cljs.core.next(inst_18114);
var inst_18091 = inst_18126;
var inst_18095 = null;
var inst_18096 = (0);
var inst_18097 = (0);
var state_18148__$1 = (function (){var statearr_18151 = state_18148;
(statearr_18151[(8)] = inst_18097);

(statearr_18151[(9)] = inst_18091);

(statearr_18151[(10)] = inst_18125);

(statearr_18151[(11)] = inst_18095);

(statearr_18151[(12)] = inst_18096);

return statearr_18151;
})();
var statearr_18152_19446 = state_18148__$1;
(statearr_18152_19446[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (1))){
var state_18148__$1 = state_18148;
var statearr_18153_19448 = state_18148__$1;
(statearr_18153_19448[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (4))){
var inst_18065 = (state_18148[(13)]);
var inst_18065__$1 = (state_18148[(2)]);
var inst_18069 = (inst_18065__$1 == null);
var state_18148__$1 = (function (){var statearr_18154 = state_18148;
(statearr_18154[(13)] = inst_18065__$1);

return statearr_18154;
})();
if(cljs.core.truth_(inst_18069)){
var statearr_18155_19453 = state_18148__$1;
(statearr_18155_19453[(1)] = (5));

} else {
var statearr_18156_19454 = state_18148__$1;
(statearr_18156_19454[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (15))){
var state_18148__$1 = state_18148;
var statearr_18160_19455 = state_18148__$1;
(statearr_18160_19455[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (21))){
var state_18148__$1 = state_18148;
var statearr_18161_19457 = state_18148__$1;
(statearr_18161_19457[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (13))){
var inst_18097 = (state_18148[(8)]);
var inst_18091 = (state_18148[(9)]);
var inst_18095 = (state_18148[(11)]);
var inst_18096 = (state_18148[(12)]);
var inst_18110 = (state_18148[(2)]);
var inst_18111 = (inst_18097 + (1));
var tmp18157 = inst_18091;
var tmp18158 = inst_18095;
var tmp18159 = inst_18096;
var inst_18091__$1 = tmp18157;
var inst_18095__$1 = tmp18158;
var inst_18096__$1 = tmp18159;
var inst_18097__$1 = inst_18111;
var state_18148__$1 = (function (){var statearr_18162 = state_18148;
(statearr_18162[(14)] = inst_18110);

(statearr_18162[(8)] = inst_18097__$1);

(statearr_18162[(9)] = inst_18091__$1);

(statearr_18162[(11)] = inst_18095__$1);

(statearr_18162[(12)] = inst_18096__$1);

return statearr_18162;
})();
var statearr_18163_19459 = state_18148__$1;
(statearr_18163_19459[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (22))){
var state_18148__$1 = state_18148;
var statearr_18164_19464 = state_18148__$1;
(statearr_18164_19464[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (6))){
var inst_18065 = (state_18148[(13)]);
var inst_18088 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_18065) : f.call(null,inst_18065));
var inst_18089 = cljs.core.seq(inst_18088);
var inst_18091 = inst_18089;
var inst_18095 = null;
var inst_18096 = (0);
var inst_18097 = (0);
var state_18148__$1 = (function (){var statearr_18165 = state_18148;
(statearr_18165[(8)] = inst_18097);

(statearr_18165[(9)] = inst_18091);

(statearr_18165[(11)] = inst_18095);

(statearr_18165[(12)] = inst_18096);

return statearr_18165;
})();
var statearr_18166_19465 = state_18148__$1;
(statearr_18166_19465[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (17))){
var inst_18114 = (state_18148[(7)]);
var inst_18118 = cljs.core.chunk_first(inst_18114);
var inst_18119 = cljs.core.chunk_rest(inst_18114);
var inst_18120 = cljs.core.count(inst_18118);
var inst_18091 = inst_18119;
var inst_18095 = inst_18118;
var inst_18096 = inst_18120;
var inst_18097 = (0);
var state_18148__$1 = (function (){var statearr_18176 = state_18148;
(statearr_18176[(8)] = inst_18097);

(statearr_18176[(9)] = inst_18091);

(statearr_18176[(11)] = inst_18095);

(statearr_18176[(12)] = inst_18096);

return statearr_18176;
})();
var statearr_18177_19466 = state_18148__$1;
(statearr_18177_19466[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (3))){
var inst_18146 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
return cljs.core.async.impl.ioc_helpers.return_chan(state_18148__$1,inst_18146);
} else {
if((state_val_18149 === (12))){
var inst_18134 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
var statearr_18183_19467 = state_18148__$1;
(statearr_18183_19467[(2)] = inst_18134);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (2))){
var state_18148__$1 = state_18148;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_18148__$1,(4),in$);
} else {
if((state_val_18149 === (23))){
var inst_18142 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
var statearr_18186_19468 = state_18148__$1;
(statearr_18186_19468[(2)] = inst_18142);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (19))){
var inst_18129 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
var statearr_18187_19471 = state_18148__$1;
(statearr_18187_19471[(2)] = inst_18129);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (11))){
var inst_18114 = (state_18148[(7)]);
var inst_18091 = (state_18148[(9)]);
var inst_18114__$1 = cljs.core.seq(inst_18091);
var state_18148__$1 = (function (){var statearr_18188 = state_18148;
(statearr_18188[(7)] = inst_18114__$1);

return statearr_18188;
})();
if(inst_18114__$1){
var statearr_18189_19473 = state_18148__$1;
(statearr_18189_19473[(1)] = (14));

} else {
var statearr_18190_19474 = state_18148__$1;
(statearr_18190_19474[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (9))){
var inst_18136 = (state_18148[(2)]);
var inst_18137 = cljs.core.async.impl.protocols.closed_QMARK_(out);
var state_18148__$1 = (function (){var statearr_18201 = state_18148;
(statearr_18201[(15)] = inst_18136);

return statearr_18201;
})();
if(cljs.core.truth_(inst_18137)){
var statearr_18202_19475 = state_18148__$1;
(statearr_18202_19475[(1)] = (21));

} else {
var statearr_18203_19476 = state_18148__$1;
(statearr_18203_19476[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (5))){
var inst_18075 = cljs.core.async.close_BANG_(out);
var state_18148__$1 = state_18148;
var statearr_18204_19477 = state_18148__$1;
(statearr_18204_19477[(2)] = inst_18075);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (14))){
var inst_18114 = (state_18148[(7)]);
var inst_18116 = cljs.core.chunked_seq_QMARK_(inst_18114);
var state_18148__$1 = state_18148;
if(inst_18116){
var statearr_18205_19478 = state_18148__$1;
(statearr_18205_19478[(1)] = (17));

} else {
var statearr_18206_19479 = state_18148__$1;
(statearr_18206_19479[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (16))){
var inst_18132 = (state_18148[(2)]);
var state_18148__$1 = state_18148;
var statearr_18207_19480 = state_18148__$1;
(statearr_18207_19480[(2)] = inst_18132);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18149 === (10))){
var inst_18097 = (state_18148[(8)]);
var inst_18095 = (state_18148[(11)]);
var inst_18108 = cljs.core._nth(inst_18095,inst_18097);
var state_18148__$1 = state_18148;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18148__$1,(13),out,inst_18108);
} else {
if((state_val_18149 === (18))){
var inst_18114 = (state_18148[(7)]);
var inst_18123 = cljs.core.first(inst_18114);
var state_18148__$1 = state_18148;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18148__$1,(20),out,inst_18123);
} else {
if((state_val_18149 === (8))){
var inst_18097 = (state_18148[(8)]);
var inst_18096 = (state_18148[(12)]);
var inst_18102 = (inst_18097 < inst_18096);
var inst_18103 = inst_18102;
var state_18148__$1 = state_18148;
if(cljs.core.truth_(inst_18103)){
var statearr_18209_19481 = state_18148__$1;
(statearr_18209_19481[(1)] = (10));

} else {
var statearr_18210_19482 = state_18148__$1;
(statearr_18210_19482[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____0 = (function (){
var statearr_18211 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_18211[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__);

(statearr_18211[(1)] = (1));

return statearr_18211;
});
var cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____1 = (function (state_18148){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_18148);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e18213){var ex__14459__auto__ = e18213;
var statearr_18214_19488 = state_18148;
(statearr_18214_19488[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_18148[(4)]))){
var statearr_18215_19490 = state_18148;
(statearr_18215_19490[(1)] = cljs.core.first((state_18148[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19491 = state_18148;
state_18148 = G__19491;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__ = function(state_18148){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____1.call(this,state_18148);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__14456__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_18216 = f__15556__auto__();
(statearr_18216[(6)] = c__15554__auto__);

return statearr_18216;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));

return c__15554__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var G__18218 = arguments.length;
switch (G__18218) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = (function (f,in$){
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(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 G__18243 = arguments.length;
switch (G__18243) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = (function (f,out){
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(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 G__18262 = arguments.length;
switch (G__18262) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

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

(cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19512 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_18336){
var state_val_18337 = (state_18336[(1)]);
if((state_val_18337 === (7))){
var inst_18323 = (state_18336[(2)]);
var state_18336__$1 = state_18336;
var statearr_18361_19513 = state_18336__$1;
(statearr_18361_19513[(2)] = inst_18323);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (1))){
var inst_18287 = null;
var state_18336__$1 = (function (){var statearr_18362 = state_18336;
(statearr_18362[(7)] = inst_18287);

return statearr_18362;
})();
var statearr_18363_19515 = state_18336__$1;
(statearr_18363_19515[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (4))){
var inst_18297 = (state_18336[(8)]);
var inst_18297__$1 = (state_18336[(2)]);
var inst_18305 = (inst_18297__$1 == null);
var inst_18306 = cljs.core.not(inst_18305);
var state_18336__$1 = (function (){var statearr_18375 = state_18336;
(statearr_18375[(8)] = inst_18297__$1);

return statearr_18375;
})();
if(inst_18306){
var statearr_18379_19517 = state_18336__$1;
(statearr_18379_19517[(1)] = (5));

} else {
var statearr_18380_19519 = state_18336__$1;
(statearr_18380_19519[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (6))){
var state_18336__$1 = state_18336;
var statearr_18385_19520 = state_18336__$1;
(statearr_18385_19520[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (3))){
var inst_18325 = (state_18336[(2)]);
var inst_18326 = cljs.core.async.close_BANG_(out);
var state_18336__$1 = (function (){var statearr_18390 = state_18336;
(statearr_18390[(9)] = inst_18325);

return statearr_18390;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_18336__$1,inst_18326);
} else {
if((state_val_18337 === (2))){
var state_18336__$1 = state_18336;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_18336__$1,(4),ch);
} else {
if((state_val_18337 === (11))){
var inst_18297 = (state_18336[(8)]);
var inst_18317 = (state_18336[(2)]);
var inst_18287 = inst_18297;
var state_18336__$1 = (function (){var statearr_18401 = state_18336;
(statearr_18401[(7)] = inst_18287);

(statearr_18401[(10)] = inst_18317);

return statearr_18401;
})();
var statearr_18402_19522 = state_18336__$1;
(statearr_18402_19522[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (9))){
var inst_18297 = (state_18336[(8)]);
var state_18336__$1 = state_18336;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18336__$1,(11),out,inst_18297);
} else {
if((state_val_18337 === (5))){
var inst_18287 = (state_18336[(7)]);
var inst_18297 = (state_18336[(8)]);
var inst_18312 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_18297,inst_18287);
var state_18336__$1 = state_18336;
if(inst_18312){
var statearr_18404_19523 = state_18336__$1;
(statearr_18404_19523[(1)] = (8));

} else {
var statearr_18406_19525 = state_18336__$1;
(statearr_18406_19525[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (10))){
var inst_18320 = (state_18336[(2)]);
var state_18336__$1 = state_18336;
var statearr_18407_19532 = state_18336__$1;
(statearr_18407_19532[(2)] = inst_18320);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18337 === (8))){
var inst_18287 = (state_18336[(7)]);
var tmp18403 = inst_18287;
var inst_18287__$1 = tmp18403;
var state_18336__$1 = (function (){var statearr_18408 = state_18336;
(statearr_18408[(7)] = inst_18287__$1);

return statearr_18408;
})();
var statearr_18409_19537 = state_18336__$1;
(statearr_18409_19537[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_18411 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_18411[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_18411[(1)] = (1));

return statearr_18411;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_18336){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_18336);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e18412){var ex__14459__auto__ = e18412;
var statearr_18413_19538 = state_18336;
(statearr_18413_19538[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_18336[(4)]))){
var statearr_18414_19539 = state_18336;
(statearr_18414_19539[(1)] = cljs.core.first((state_18336[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19540 = state_18336;
state_18336 = G__19540;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_18336){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_18336);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_18415 = f__15556__auto__();
(statearr_18415[(6)] = c__15554__auto___19512);

return statearr_18415;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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 G__18424 = arguments.length;
switch (G__18424) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19556 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_18471){
var state_val_18472 = (state_18471[(1)]);
if((state_val_18472 === (7))){
var inst_18466 = (state_18471[(2)]);
var state_18471__$1 = state_18471;
var statearr_18477_19557 = state_18471__$1;
(statearr_18477_19557[(2)] = inst_18466);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (1))){
var inst_18430 = (new Array(n));
var inst_18431 = inst_18430;
var inst_18432 = (0);
var state_18471__$1 = (function (){var statearr_18483 = state_18471;
(statearr_18483[(7)] = inst_18431);

(statearr_18483[(8)] = inst_18432);

return statearr_18483;
})();
var statearr_18485_19558 = state_18471__$1;
(statearr_18485_19558[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (4))){
var inst_18437 = (state_18471[(9)]);
var inst_18437__$1 = (state_18471[(2)]);
var inst_18438 = (inst_18437__$1 == null);
var inst_18439 = cljs.core.not(inst_18438);
var state_18471__$1 = (function (){var statearr_18490 = state_18471;
(statearr_18490[(9)] = inst_18437__$1);

return statearr_18490;
})();
if(inst_18439){
var statearr_18491_19559 = state_18471__$1;
(statearr_18491_19559[(1)] = (5));

} else {
var statearr_18492_19560 = state_18471__$1;
(statearr_18492_19560[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (15))){
var inst_18460 = (state_18471[(2)]);
var state_18471__$1 = state_18471;
var statearr_18499_19561 = state_18471__$1;
(statearr_18499_19561[(2)] = inst_18460);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (13))){
var state_18471__$1 = state_18471;
var statearr_18500_19562 = state_18471__$1;
(statearr_18500_19562[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (6))){
var inst_18432 = (state_18471[(8)]);
var inst_18456 = (inst_18432 > (0));
var state_18471__$1 = state_18471;
if(cljs.core.truth_(inst_18456)){
var statearr_18502_19563 = state_18471__$1;
(statearr_18502_19563[(1)] = (12));

} else {
var statearr_18503_19564 = state_18471__$1;
(statearr_18503_19564[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (3))){
var inst_18468 = (state_18471[(2)]);
var state_18471__$1 = state_18471;
return cljs.core.async.impl.ioc_helpers.return_chan(state_18471__$1,inst_18468);
} else {
if((state_val_18472 === (12))){
var inst_18431 = (state_18471[(7)]);
var inst_18458 = cljs.core.vec(inst_18431);
var state_18471__$1 = state_18471;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18471__$1,(15),out,inst_18458);
} else {
if((state_val_18472 === (2))){
var state_18471__$1 = state_18471;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_18471__$1,(4),ch);
} else {
if((state_val_18472 === (11))){
var inst_18449 = (state_18471[(2)]);
var inst_18451 = (new Array(n));
var inst_18431 = inst_18451;
var inst_18432 = (0);
var state_18471__$1 = (function (){var statearr_18507 = state_18471;
(statearr_18507[(10)] = inst_18449);

(statearr_18507[(7)] = inst_18431);

(statearr_18507[(8)] = inst_18432);

return statearr_18507;
})();
var statearr_18511_19566 = state_18471__$1;
(statearr_18511_19566[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (9))){
var inst_18431 = (state_18471[(7)]);
var inst_18447 = cljs.core.vec(inst_18431);
var state_18471__$1 = state_18471;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18471__$1,(11),out,inst_18447);
} else {
if((state_val_18472 === (5))){
var inst_18442 = (state_18471[(11)]);
var inst_18431 = (state_18471[(7)]);
var inst_18432 = (state_18471[(8)]);
var inst_18437 = (state_18471[(9)]);
var inst_18441 = (inst_18431[inst_18432] = inst_18437);
var inst_18442__$1 = (inst_18432 + (1));
var inst_18443 = (inst_18442__$1 < n);
var state_18471__$1 = (function (){var statearr_18512 = state_18471;
(statearr_18512[(12)] = inst_18441);

(statearr_18512[(11)] = inst_18442__$1);

return statearr_18512;
})();
if(cljs.core.truth_(inst_18443)){
var statearr_18514_19577 = state_18471__$1;
(statearr_18514_19577[(1)] = (8));

} else {
var statearr_18515_19579 = state_18471__$1;
(statearr_18515_19579[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (14))){
var inst_18463 = (state_18471[(2)]);
var inst_18464 = cljs.core.async.close_BANG_(out);
var state_18471__$1 = (function (){var statearr_18517 = state_18471;
(statearr_18517[(13)] = inst_18463);

return statearr_18517;
})();
var statearr_18518_19580 = state_18471__$1;
(statearr_18518_19580[(2)] = inst_18464);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (10))){
var inst_18454 = (state_18471[(2)]);
var state_18471__$1 = state_18471;
var statearr_18520_19585 = state_18471__$1;
(statearr_18520_19585[(2)] = inst_18454);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18472 === (8))){
var inst_18442 = (state_18471[(11)]);
var inst_18431 = (state_18471[(7)]);
var tmp18516 = inst_18431;
var inst_18431__$1 = tmp18516;
var inst_18432 = inst_18442;
var state_18471__$1 = (function (){var statearr_18521 = state_18471;
(statearr_18521[(7)] = inst_18431__$1);

(statearr_18521[(8)] = inst_18432);

return statearr_18521;
})();
var statearr_18522_19586 = state_18471__$1;
(statearr_18522_19586[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_18528 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_18528[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_18528[(1)] = (1));

return statearr_18528;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_18471){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_18471);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e18529){var ex__14459__auto__ = e18529;
var statearr_18530_19588 = state_18471;
(statearr_18530_19588[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_18471[(4)]))){
var statearr_18531_19592 = state_18471;
(statearr_18531_19592[(1)] = cljs.core.first((state_18471[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19593 = state_18471;
state_18471 = G__19593;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_18471){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_18471);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_18535 = f__15556__auto__();
(statearr_18535[(6)] = c__15554__auto___19556);

return statearr_18535;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


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 G__18542 = arguments.length;
switch (G__18542) {
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(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

(cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2 = (function (f,ch){
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__15554__auto___19600 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__15556__auto__ = (function (){var switch__14455__auto__ = (function (state_18602){
var state_val_18603 = (state_18602[(1)]);
if((state_val_18603 === (7))){
var inst_18598 = (state_18602[(2)]);
var state_18602__$1 = state_18602;
var statearr_18613_19601 = state_18602__$1;
(statearr_18613_19601[(2)] = inst_18598);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (1))){
var inst_18557 = [];
var inst_18558 = inst_18557;
var inst_18559 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_18602__$1 = (function (){var statearr_18614 = state_18602;
(statearr_18614[(7)] = inst_18559);

(statearr_18614[(8)] = inst_18558);

return statearr_18614;
})();
var statearr_18615_19602 = state_18602__$1;
(statearr_18615_19602[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (4))){
var inst_18562 = (state_18602[(9)]);
var inst_18562__$1 = (state_18602[(2)]);
var inst_18563 = (inst_18562__$1 == null);
var inst_18564 = cljs.core.not(inst_18563);
var state_18602__$1 = (function (){var statearr_18616 = state_18602;
(statearr_18616[(9)] = inst_18562__$1);

return statearr_18616;
})();
if(inst_18564){
var statearr_18619_19604 = state_18602__$1;
(statearr_18619_19604[(1)] = (5));

} else {
var statearr_18620_19605 = state_18602__$1;
(statearr_18620_19605[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (15))){
var inst_18558 = (state_18602[(8)]);
var inst_18589 = cljs.core.vec(inst_18558);
var state_18602__$1 = state_18602;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18602__$1,(18),out,inst_18589);
} else {
if((state_val_18603 === (13))){
var inst_18584 = (state_18602[(2)]);
var state_18602__$1 = state_18602;
var statearr_18628_19606 = state_18602__$1;
(statearr_18628_19606[(2)] = inst_18584);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (6))){
var inst_18558 = (state_18602[(8)]);
var inst_18586 = inst_18558.length;
var inst_18587 = (inst_18586 > (0));
var state_18602__$1 = state_18602;
if(cljs.core.truth_(inst_18587)){
var statearr_18634_19607 = state_18602__$1;
(statearr_18634_19607[(1)] = (15));

} else {
var statearr_18635_19608 = state_18602__$1;
(statearr_18635_19608[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (17))){
var inst_18595 = (state_18602[(2)]);
var inst_18596 = cljs.core.async.close_BANG_(out);
var state_18602__$1 = (function (){var statearr_18641 = state_18602;
(statearr_18641[(10)] = inst_18595);

return statearr_18641;
})();
var statearr_18642_19609 = state_18602__$1;
(statearr_18642_19609[(2)] = inst_18596);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (3))){
var inst_18600 = (state_18602[(2)]);
var state_18602__$1 = state_18602;
return cljs.core.async.impl.ioc_helpers.return_chan(state_18602__$1,inst_18600);
} else {
if((state_val_18603 === (12))){
var inst_18558 = (state_18602[(8)]);
var inst_18577 = cljs.core.vec(inst_18558);
var state_18602__$1 = state_18602;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_18602__$1,(14),out,inst_18577);
} else {
if((state_val_18603 === (2))){
var state_18602__$1 = state_18602;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_18602__$1,(4),ch);
} else {
if((state_val_18603 === (11))){
var inst_18566 = (state_18602[(11)]);
var inst_18562 = (state_18602[(9)]);
var inst_18558 = (state_18602[(8)]);
var inst_18574 = inst_18558.push(inst_18562);
var tmp18647 = inst_18558;
var inst_18558__$1 = tmp18647;
var inst_18559 = inst_18566;
var state_18602__$1 = (function (){var statearr_18653 = state_18602;
(statearr_18653[(7)] = inst_18559);

(statearr_18653[(12)] = inst_18574);

(statearr_18653[(8)] = inst_18558__$1);

return statearr_18653;
})();
var statearr_18654_19613 = state_18602__$1;
(statearr_18654_19613[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (9))){
var inst_18559 = (state_18602[(7)]);
var inst_18570 = cljs.core.keyword_identical_QMARK_(inst_18559,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var state_18602__$1 = state_18602;
var statearr_18658_19618 = state_18602__$1;
(statearr_18658_19618[(2)] = inst_18570);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (5))){
var inst_18566 = (state_18602[(11)]);
var inst_18567 = (state_18602[(13)]);
var inst_18559 = (state_18602[(7)]);
var inst_18562 = (state_18602[(9)]);
var inst_18566__$1 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_18562) : f.call(null,inst_18562));
var inst_18567__$1 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_18566__$1,inst_18559);
var state_18602__$1 = (function (){var statearr_18659 = state_18602;
(statearr_18659[(11)] = inst_18566__$1);

(statearr_18659[(13)] = inst_18567__$1);

return statearr_18659;
})();
if(inst_18567__$1){
var statearr_18665_19619 = state_18602__$1;
(statearr_18665_19619[(1)] = (8));

} else {
var statearr_18666_19620 = state_18602__$1;
(statearr_18666_19620[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (14))){
var inst_18566 = (state_18602[(11)]);
var inst_18562 = (state_18602[(9)]);
var inst_18579 = (state_18602[(2)]);
var inst_18580 = [];
var inst_18581 = inst_18580.push(inst_18562);
var inst_18558 = inst_18580;
var inst_18559 = inst_18566;
var state_18602__$1 = (function (){var statearr_18667 = state_18602;
(statearr_18667[(14)] = inst_18581);

(statearr_18667[(7)] = inst_18559);

(statearr_18667[(15)] = inst_18579);

(statearr_18667[(8)] = inst_18558);

return statearr_18667;
})();
var statearr_18668_19621 = state_18602__$1;
(statearr_18668_19621[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (16))){
var state_18602__$1 = state_18602;
var statearr_18669_19628 = state_18602__$1;
(statearr_18669_19628[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (10))){
var inst_18572 = (state_18602[(2)]);
var state_18602__$1 = state_18602;
if(cljs.core.truth_(inst_18572)){
var statearr_18670_19632 = state_18602__$1;
(statearr_18670_19632[(1)] = (11));

} else {
var statearr_18671_19633 = state_18602__$1;
(statearr_18671_19633[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (18))){
var inst_18591 = (state_18602[(2)]);
var state_18602__$1 = state_18602;
var statearr_18675_19634 = state_18602__$1;
(statearr_18675_19634[(2)] = inst_18591);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_18603 === (8))){
var inst_18567 = (state_18602[(13)]);
var state_18602__$1 = state_18602;
var statearr_18676_19635 = state_18602__$1;
(statearr_18676_19635[(2)] = inst_18567);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__14456__auto__ = null;
var cljs$core$async$state_machine__14456__auto____0 = (function (){
var statearr_18677 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_18677[(0)] = cljs$core$async$state_machine__14456__auto__);

(statearr_18677[(1)] = (1));

return statearr_18677;
});
var cljs$core$async$state_machine__14456__auto____1 = (function (state_18602){
while(true){
var ret_value__14457__auto__ = (function (){try{while(true){
var result__14458__auto__ = switch__14455__auto__(state_18602);
if(cljs.core.keyword_identical_QMARK_(result__14458__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__14458__auto__;
}
break;
}
}catch (e18678){var ex__14459__auto__ = e18678;
var statearr_18679_19640 = state_18602;
(statearr_18679_19640[(2)] = ex__14459__auto__);


if(cljs.core.seq((state_18602[(4)]))){
var statearr_18680_19641 = state_18602;
(statearr_18680_19641[(1)] = cljs.core.first((state_18602[(4)])));

} else {
throw ex__14459__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__14457__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__19642 = state_18602;
state_18602 = G__19642;
continue;
} else {
return ret_value__14457__auto__;
}
break;
}
});
cljs$core$async$state_machine__14456__auto__ = function(state_18602){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__14456__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__14456__auto____1.call(this,state_18602);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__14456__auto____0;
cljs$core$async$state_machine__14456__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__14456__auto____1;
return cljs$core$async$state_machine__14456__auto__;
})()
})();
var state__15557__auto__ = (function (){var statearr_18681 = f__15556__auto__();
(statearr_18681[(6)] = c__15554__auto___19600);

return statearr_18681;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__15557__auto__);
}));


return out;
}));

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


//# sourceMappingURL=cljs.core.async.js.map
