// Compiled by ClojureScript 1.10.520 {}
goog.provide('cljs.core.async');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.channels');
goog.require('cljs.core.async.impl.buffers');
goog.require('cljs.core.async.impl.timers');
goog.require('cljs.core.async.impl.dispatch');
goog.require('cljs.core.async.impl.ioc_helpers');
cljs.core.async.fn_handler = (function cljs$core$async$fn_handler(var_args){
var G__25901 = arguments.length;
switch (G__25901) {
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.call(null,f,true);
});

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

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

cljs.core.async.t_cljs$core$async25902.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25904){
var self__ = this;
var _25904__$1 = this;
return self__.meta25903;
});

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

cljs.core.async.t_cljs$core$async25902.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$async25902.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$async25902.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$async25902.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,"meta25903","meta25903",485519211,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async25902.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async25902");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25902.
 */
cljs.core.async.__GT_t_cljs$core$async25902 = (function cljs$core$async$__GT_t_cljs$core$async25902(f__$1,blockable__$1,meta25903){
return (new cljs.core.async.t_cljs$core$async25902(f__$1,blockable__$1,meta25903));
});

}

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

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

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

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

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

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

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

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

/**
 * Creates a promise channel with an optional transducer, and an optional
 *   exception-handler. A promise channel can take exactly one value that consumers
 *   will receive. Once full, puts complete but val is dropped (no transfer).
 *   Consumers will block until either a value is placed in the channel or the
 *   channel is closed. See chan for the semantics of xform and ex-handler.
 */
cljs.core.async.promise_chan = (function cljs$core$async$promise_chan(var_args){
var G__25911 = arguments.length;
switch (G__25911) {
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.call(null,null);
});

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

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

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

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

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

return null;
});

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

cljs.core.async.nop = (function cljs$core$async$nop(_){
return null;
});
cljs.core.async.fhnop = cljs.core.async.fn_handler.call(null,cljs.core.async.nop);
/**
 * puts a val into port. nil values are not allowed. Must be called
 *   inside a (go ...) block. Will park if no buffer space is available.
 *   Returns true unless port is already closed.
 */
cljs.core.async._GT__BANG_ = (function cljs$core$async$_GT__BANG_(port,val){
throw (new Error(">! used not in (go ...) block"));
});
/**
 * Asynchronously puts a val into port, calling 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__25918 = arguments.length;
switch (G__25918) {
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__5718__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5718__auto__)){
var ret = temp__5718__auto__;
return cljs.core.deref.call(null,ret);
} else {
return true;
}
});

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

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

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

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

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

var G__25922 = (x_25921 + (1));
x_25921 = G__25922;
continue;
} else {
}
break;
}

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

(a[j] = i);

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

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

cljs.core.async.t_cljs$core$async25924.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){
return (function (_25926){
var self__ = this;
var _25926__$1 = this;
return self__.meta25925;
});})(flag))
;

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

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

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

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

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

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

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

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

cljs.core.async.t_cljs$core$async25924.cljs$lang$ctorPrWriter = ((function (flag){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async25924");
});})(flag))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25924.
 */
cljs.core.async.__GT_t_cljs$core$async25924 = ((function (flag){
return (function cljs$core$async$alt_flag_$___GT_t_cljs$core$async25924(flag__$1,meta25925){
return (new cljs.core.async.t_cljs$core$async25924(flag__$1,meta25925));
});})(flag))
;

}

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

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

cljs.core.async.t_cljs$core$async25927.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25929){
var self__ = this;
var _25929__$1 = this;
return self__.meta25928;
});

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

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

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

return self__.cb;
});

cljs.core.async.t_cljs$core$async25927.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,"meta25928","meta25928",-1368964886,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async25927.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async25927");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25927.
 */
cljs.core.async.__GT_t_cljs$core$async25927 = (function cljs$core$async$alt_handler_$___GT_t_cljs$core$async25927(flag__$1,cb__$1,meta25928){
return (new cljs.core.async.t_cljs$core$async25927(flag__$1,cb__$1,meta25928));
});

}

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

var G__25940 = (i__4731__auto___25939 + (1));
i__4731__auto___25939 = G__25940;
continue;
} else {
}
break;
}

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

cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__25935){
var map__25936 = p__25935;
var map__25936__$1 = (((((!((map__25936 == null))))?(((((map__25936.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__25936.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__25936):map__25936);
var opts = map__25936__$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 (seq25933){
var G__25934 = cljs.core.first.call(null,seq25933);
var seq25933__$1 = cljs.core.next.call(null,seq25933);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__25934,seq25933__$1);
});

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

cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__25841__auto___25988 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___25988){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___25988){
return (function (state_25966){
var state_val_25967 = (state_25966[(1)]);
if((state_val_25967 === (7))){
var inst_25962 = (state_25966[(2)]);
var state_25966__$1 = state_25966;
var statearr_25968_25989 = state_25966__$1;
(statearr_25968_25989[(2)] = inst_25962);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (1))){
var state_25966__$1 = state_25966;
var statearr_25969_25990 = state_25966__$1;
(statearr_25969_25990[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (4))){
var inst_25945 = (state_25966[(7)]);
var inst_25945__$1 = (state_25966[(2)]);
var inst_25946 = (inst_25945__$1 == null);
var state_25966__$1 = (function (){var statearr_25970 = state_25966;
(statearr_25970[(7)] = inst_25945__$1);

return statearr_25970;
})();
if(cljs.core.truth_(inst_25946)){
var statearr_25971_25991 = state_25966__$1;
(statearr_25971_25991[(1)] = (5));

} else {
var statearr_25972_25992 = state_25966__$1;
(statearr_25972_25992[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (13))){
var state_25966__$1 = state_25966;
var statearr_25973_25993 = state_25966__$1;
(statearr_25973_25993[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (6))){
var inst_25945 = (state_25966[(7)]);
var state_25966__$1 = state_25966;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_25966__$1,(11),to,inst_25945);
} else {
if((state_val_25967 === (3))){
var inst_25964 = (state_25966[(2)]);
var state_25966__$1 = state_25966;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_25966__$1,inst_25964);
} else {
if((state_val_25967 === (12))){
var state_25966__$1 = state_25966;
var statearr_25974_25994 = state_25966__$1;
(statearr_25974_25994[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (2))){
var state_25966__$1 = state_25966;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_25966__$1,(4),from);
} else {
if((state_val_25967 === (11))){
var inst_25955 = (state_25966[(2)]);
var state_25966__$1 = state_25966;
if(cljs.core.truth_(inst_25955)){
var statearr_25975_25995 = state_25966__$1;
(statearr_25975_25995[(1)] = (12));

} else {
var statearr_25976_25996 = state_25966__$1;
(statearr_25976_25996[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (9))){
var state_25966__$1 = state_25966;
var statearr_25977_25997 = state_25966__$1;
(statearr_25977_25997[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (5))){
var state_25966__$1 = state_25966;
if(cljs.core.truth_(close_QMARK_)){
var statearr_25978_25998 = state_25966__$1;
(statearr_25978_25998[(1)] = (8));

} else {
var statearr_25979_25999 = state_25966__$1;
(statearr_25979_25999[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (14))){
var inst_25960 = (state_25966[(2)]);
var state_25966__$1 = state_25966;
var statearr_25980_26000 = state_25966__$1;
(statearr_25980_26000[(2)] = inst_25960);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (10))){
var inst_25952 = (state_25966[(2)]);
var state_25966__$1 = state_25966;
var statearr_25981_26001 = state_25966__$1;
(statearr_25981_26001[(2)] = inst_25952);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25967 === (8))){
var inst_25949 = cljs.core.async.close_BANG_.call(null,to);
var state_25966__$1 = state_25966;
var statearr_25982_26002 = state_25966__$1;
(statearr_25982_26002[(2)] = inst_25949);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___25988))
;
return ((function (switch__25746__auto__,c__25841__auto___25988){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_25983 = [null,null,null,null,null,null,null,null];
(statearr_25983[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_25983[(1)] = (1));

return statearr_25983;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_25966){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_25966);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e25984){if((e25984 instanceof Object)){
var ex__25750__auto__ = e25984;
var statearr_25985_26003 = state_25966;
(statearr_25985_26003[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26004 = state_25966;
state_25966 = G__26004;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_25966){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_25966);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___25988))
})();
var state__25843__auto__ = (function (){var statearr_25986 = f__25842__auto__.call(null);
(statearr_25986[(6)] = c__25841__auto___25988);

return statearr_25986;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___25988))
);


return to;
});

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

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

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

return null;
} else {
var res = cljs.core.async.chan.call(null,(1),xf,ex_handler);
var c__25841__auto___26177 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results){
return (function (state_26013){
var state_val_26014 = (state_26013[(1)]);
if((state_val_26014 === (1))){
var state_26013__$1 = state_26013;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26013__$1,(2),res,v);
} else {
if((state_val_26014 === (2))){
var inst_26010 = (state_26013[(2)]);
var inst_26011 = cljs.core.async.close_BANG_.call(null,res);
var state_26013__$1 = (function (){var statearr_26015 = state_26013;
(statearr_26015[(7)] = inst_26010);

return statearr_26015;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26013__$1,inst_26011);
} else {
return null;
}
}
});})(c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results))
;
return ((function (switch__25746__auto__,c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_26016 = [null,null,null,null,null,null,null,null];
(statearr_26016[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__);

(statearr_26016[(1)] = (1));

return statearr_26016;
});
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1 = (function (state_26013){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26013);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26017){if((e26017 instanceof Object)){
var ex__25750__auto__ = e26017;
var statearr_26018_26178 = state_26013;
(statearr_26018_26178[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26179 = state_26013;
state_26013 = G__26179;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = function(state_26013){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1.call(this,state_26013);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results))
})();
var state__25843__auto__ = (function (){var statearr_26019 = f__25842__auto__.call(null);
(statearr_26019[(6)] = c__25841__auto___26177);

return statearr_26019;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___26177,res,vec__26006,v,p,job,jobs,results))
);


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

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

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

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

return true;
}
});})(jobs,results,process))
;
var n__4607__auto___26180 = n;
var __26181 = (0);
while(true){
if((__26181 < n__4607__auto___26180)){
var G__26024_26182 = type;
var G__26024_26183__$1 = (((G__26024_26182 instanceof cljs.core.Keyword))?G__26024_26182.fqn:null);
switch (G__26024_26183__$1) {
case "compute":
var c__25841__auto___26185 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__26181,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (__26181,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function (state_26037){
var state_val_26038 = (state_26037[(1)]);
if((state_val_26038 === (1))){
var state_26037__$1 = state_26037;
var statearr_26039_26186 = state_26037__$1;
(statearr_26039_26186[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26038 === (2))){
var state_26037__$1 = state_26037;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26037__$1,(4),jobs);
} else {
if((state_val_26038 === (3))){
var inst_26035 = (state_26037[(2)]);
var state_26037__$1 = state_26037;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26037__$1,inst_26035);
} else {
if((state_val_26038 === (4))){
var inst_26027 = (state_26037[(2)]);
var inst_26028 = process.call(null,inst_26027);
var state_26037__$1 = state_26037;
if(cljs.core.truth_(inst_26028)){
var statearr_26040_26187 = state_26037__$1;
(statearr_26040_26187[(1)] = (5));

} else {
var statearr_26041_26188 = state_26037__$1;
(statearr_26041_26188[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26038 === (5))){
var state_26037__$1 = state_26037;
var statearr_26042_26189 = state_26037__$1;
(statearr_26042_26189[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26038 === (6))){
var state_26037__$1 = state_26037;
var statearr_26043_26190 = state_26037__$1;
(statearr_26043_26190[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26038 === (7))){
var inst_26033 = (state_26037[(2)]);
var state_26037__$1 = state_26037;
var statearr_26044_26191 = state_26037__$1;
(statearr_26044_26191[(2)] = inst_26033);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__26181,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
;
return ((function (__26181,switch__25746__auto__,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_26045 = [null,null,null,null,null,null,null];
(statearr_26045[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__);

(statearr_26045[(1)] = (1));

return statearr_26045;
});
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1 = (function (state_26037){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26037);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26046){if((e26046 instanceof Object)){
var ex__25750__auto__ = e26046;
var statearr_26047_26192 = state_26037;
(statearr_26047_26192[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26193 = state_26037;
state_26037 = G__26193;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = function(state_26037){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1.call(this,state_26037);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__;
})()
;})(__26181,switch__25746__auto__,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
})();
var state__25843__auto__ = (function (){var statearr_26048 = f__25842__auto__.call(null);
(statearr_26048[(6)] = c__25841__auto___26185);

return statearr_26048;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(__26181,c__25841__auto___26185,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
);


break;
case "async":
var c__25841__auto___26194 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__26181,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (__26181,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function (state_26061){
var state_val_26062 = (state_26061[(1)]);
if((state_val_26062 === (1))){
var state_26061__$1 = state_26061;
var statearr_26063_26195 = state_26061__$1;
(statearr_26063_26195[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26062 === (2))){
var state_26061__$1 = state_26061;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26061__$1,(4),jobs);
} else {
if((state_val_26062 === (3))){
var inst_26059 = (state_26061[(2)]);
var state_26061__$1 = state_26061;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26061__$1,inst_26059);
} else {
if((state_val_26062 === (4))){
var inst_26051 = (state_26061[(2)]);
var inst_26052 = async.call(null,inst_26051);
var state_26061__$1 = state_26061;
if(cljs.core.truth_(inst_26052)){
var statearr_26064_26196 = state_26061__$1;
(statearr_26064_26196[(1)] = (5));

} else {
var statearr_26065_26197 = state_26061__$1;
(statearr_26065_26197[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26062 === (5))){
var state_26061__$1 = state_26061;
var statearr_26066_26198 = state_26061__$1;
(statearr_26066_26198[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26062 === (6))){
var state_26061__$1 = state_26061;
var statearr_26067_26199 = state_26061__$1;
(statearr_26067_26199[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26062 === (7))){
var inst_26057 = (state_26061[(2)]);
var state_26061__$1 = state_26061;
var statearr_26068_26200 = state_26061__$1;
(statearr_26068_26200[(2)] = inst_26057);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__26181,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
;
return ((function (__26181,switch__25746__auto__,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_26069 = [null,null,null,null,null,null,null];
(statearr_26069[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__);

(statearr_26069[(1)] = (1));

return statearr_26069;
});
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1 = (function (state_26061){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26061);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26070){if((e26070 instanceof Object)){
var ex__25750__auto__ = e26070;
var statearr_26071_26201 = state_26061;
(statearr_26071_26201[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26202 = state_26061;
state_26061 = G__26202;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = function(state_26061){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1.call(this,state_26061);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__;
})()
;})(__26181,switch__25746__auto__,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
})();
var state__25843__auto__ = (function (){var statearr_26072 = f__25842__auto__.call(null);
(statearr_26072[(6)] = c__25841__auto___26194);

return statearr_26072;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(__26181,c__25841__auto___26194,G__26024_26182,G__26024_26183__$1,n__4607__auto___26180,jobs,results,process,async))
);


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

}

var G__26203 = (__26181 + (1));
__26181 = G__26203;
continue;
} else {
}
break;
}

var c__25841__auto___26204 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___26204,jobs,results,process,async){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___26204,jobs,results,process,async){
return (function (state_26094){
var state_val_26095 = (state_26094[(1)]);
if((state_val_26095 === (7))){
var inst_26090 = (state_26094[(2)]);
var state_26094__$1 = state_26094;
var statearr_26096_26205 = state_26094__$1;
(statearr_26096_26205[(2)] = inst_26090);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26095 === (1))){
var state_26094__$1 = state_26094;
var statearr_26097_26206 = state_26094__$1;
(statearr_26097_26206[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26095 === (4))){
var inst_26075 = (state_26094[(7)]);
var inst_26075__$1 = (state_26094[(2)]);
var inst_26076 = (inst_26075__$1 == null);
var state_26094__$1 = (function (){var statearr_26098 = state_26094;
(statearr_26098[(7)] = inst_26075__$1);

return statearr_26098;
})();
if(cljs.core.truth_(inst_26076)){
var statearr_26099_26207 = state_26094__$1;
(statearr_26099_26207[(1)] = (5));

} else {
var statearr_26100_26208 = state_26094__$1;
(statearr_26100_26208[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26095 === (6))){
var inst_26080 = (state_26094[(8)]);
var inst_26075 = (state_26094[(7)]);
var inst_26080__$1 = cljs.core.async.chan.call(null,(1));
var inst_26081 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_26082 = [inst_26075,inst_26080__$1];
var inst_26083 = (new cljs.core.PersistentVector(null,2,(5),inst_26081,inst_26082,null));
var state_26094__$1 = (function (){var statearr_26101 = state_26094;
(statearr_26101[(8)] = inst_26080__$1);

return statearr_26101;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26094__$1,(8),jobs,inst_26083);
} else {
if((state_val_26095 === (3))){
var inst_26092 = (state_26094[(2)]);
var state_26094__$1 = state_26094;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26094__$1,inst_26092);
} else {
if((state_val_26095 === (2))){
var state_26094__$1 = state_26094;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26094__$1,(4),from);
} else {
if((state_val_26095 === (9))){
var inst_26087 = (state_26094[(2)]);
var state_26094__$1 = (function (){var statearr_26102 = state_26094;
(statearr_26102[(9)] = inst_26087);

return statearr_26102;
})();
var statearr_26103_26209 = state_26094__$1;
(statearr_26103_26209[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26095 === (5))){
var inst_26078 = cljs.core.async.close_BANG_.call(null,jobs);
var state_26094__$1 = state_26094;
var statearr_26104_26210 = state_26094__$1;
(statearr_26104_26210[(2)] = inst_26078);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26095 === (8))){
var inst_26080 = (state_26094[(8)]);
var inst_26085 = (state_26094[(2)]);
var state_26094__$1 = (function (){var statearr_26105 = state_26094;
(statearr_26105[(10)] = inst_26085);

return statearr_26105;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26094__$1,(9),results,inst_26080);
} else {
return null;
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___26204,jobs,results,process,async))
;
return ((function (switch__25746__auto__,c__25841__auto___26204,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_26106 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_26106[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__);

(statearr_26106[(1)] = (1));

return statearr_26106;
});
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1 = (function (state_26094){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26094);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26107){if((e26107 instanceof Object)){
var ex__25750__auto__ = e26107;
var statearr_26108_26211 = state_26094;
(statearr_26108_26211[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26212 = state_26094;
state_26094 = G__26212;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = function(state_26094){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1.call(this,state_26094);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___26204,jobs,results,process,async))
})();
var state__25843__auto__ = (function (){var statearr_26109 = f__25842__auto__.call(null);
(statearr_26109[(6)] = c__25841__auto___26204);

return statearr_26109;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___26204,jobs,results,process,async))
);


var c__25841__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto__,jobs,results,process,async){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto__,jobs,results,process,async){
return (function (state_26147){
var state_val_26148 = (state_26147[(1)]);
if((state_val_26148 === (7))){
var inst_26143 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
var statearr_26149_26213 = state_26147__$1;
(statearr_26149_26213[(2)] = inst_26143);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (20))){
var state_26147__$1 = state_26147;
var statearr_26150_26214 = state_26147__$1;
(statearr_26150_26214[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (1))){
var state_26147__$1 = state_26147;
var statearr_26151_26215 = state_26147__$1;
(statearr_26151_26215[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (4))){
var inst_26112 = (state_26147[(7)]);
var inst_26112__$1 = (state_26147[(2)]);
var inst_26113 = (inst_26112__$1 == null);
var state_26147__$1 = (function (){var statearr_26152 = state_26147;
(statearr_26152[(7)] = inst_26112__$1);

return statearr_26152;
})();
if(cljs.core.truth_(inst_26113)){
var statearr_26153_26216 = state_26147__$1;
(statearr_26153_26216[(1)] = (5));

} else {
var statearr_26154_26217 = state_26147__$1;
(statearr_26154_26217[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (15))){
var inst_26125 = (state_26147[(8)]);
var state_26147__$1 = state_26147;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26147__$1,(18),to,inst_26125);
} else {
if((state_val_26148 === (21))){
var inst_26138 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
var statearr_26155_26218 = state_26147__$1;
(statearr_26155_26218[(2)] = inst_26138);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (13))){
var inst_26140 = (state_26147[(2)]);
var state_26147__$1 = (function (){var statearr_26156 = state_26147;
(statearr_26156[(9)] = inst_26140);

return statearr_26156;
})();
var statearr_26157_26219 = state_26147__$1;
(statearr_26157_26219[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (6))){
var inst_26112 = (state_26147[(7)]);
var state_26147__$1 = state_26147;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26147__$1,(11),inst_26112);
} else {
if((state_val_26148 === (17))){
var inst_26133 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
if(cljs.core.truth_(inst_26133)){
var statearr_26158_26220 = state_26147__$1;
(statearr_26158_26220[(1)] = (19));

} else {
var statearr_26159_26221 = state_26147__$1;
(statearr_26159_26221[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (3))){
var inst_26145 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26147__$1,inst_26145);
} else {
if((state_val_26148 === (12))){
var inst_26122 = (state_26147[(10)]);
var state_26147__$1 = state_26147;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26147__$1,(14),inst_26122);
} else {
if((state_val_26148 === (2))){
var state_26147__$1 = state_26147;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26147__$1,(4),results);
} else {
if((state_val_26148 === (19))){
var state_26147__$1 = state_26147;
var statearr_26160_26222 = state_26147__$1;
(statearr_26160_26222[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (11))){
var inst_26122 = (state_26147[(2)]);
var state_26147__$1 = (function (){var statearr_26161 = state_26147;
(statearr_26161[(10)] = inst_26122);

return statearr_26161;
})();
var statearr_26162_26223 = state_26147__$1;
(statearr_26162_26223[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (9))){
var state_26147__$1 = state_26147;
var statearr_26163_26224 = state_26147__$1;
(statearr_26163_26224[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (5))){
var state_26147__$1 = state_26147;
if(cljs.core.truth_(close_QMARK_)){
var statearr_26164_26225 = state_26147__$1;
(statearr_26164_26225[(1)] = (8));

} else {
var statearr_26165_26226 = state_26147__$1;
(statearr_26165_26226[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (14))){
var inst_26127 = (state_26147[(11)]);
var inst_26125 = (state_26147[(8)]);
var inst_26125__$1 = (state_26147[(2)]);
var inst_26126 = (inst_26125__$1 == null);
var inst_26127__$1 = cljs.core.not.call(null,inst_26126);
var state_26147__$1 = (function (){var statearr_26166 = state_26147;
(statearr_26166[(11)] = inst_26127__$1);

(statearr_26166[(8)] = inst_26125__$1);

return statearr_26166;
})();
if(inst_26127__$1){
var statearr_26167_26227 = state_26147__$1;
(statearr_26167_26227[(1)] = (15));

} else {
var statearr_26168_26228 = state_26147__$1;
(statearr_26168_26228[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (16))){
var inst_26127 = (state_26147[(11)]);
var state_26147__$1 = state_26147;
var statearr_26169_26229 = state_26147__$1;
(statearr_26169_26229[(2)] = inst_26127);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (10))){
var inst_26119 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
var statearr_26170_26230 = state_26147__$1;
(statearr_26170_26230[(2)] = inst_26119);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (18))){
var inst_26130 = (state_26147[(2)]);
var state_26147__$1 = state_26147;
var statearr_26171_26231 = state_26147__$1;
(statearr_26171_26231[(2)] = inst_26130);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26148 === (8))){
var inst_26116 = cljs.core.async.close_BANG_.call(null,to);
var state_26147__$1 = state_26147;
var statearr_26172_26232 = state_26147__$1;
(statearr_26172_26232[(2)] = inst_26116);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto__,jobs,results,process,async))
;
return ((function (switch__25746__auto__,c__25841__auto__,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_26173 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26173[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__);

(statearr_26173[(1)] = (1));

return statearr_26173;
});
var cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1 = (function (state_26147){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26147);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26174){if((e26174 instanceof Object)){
var ex__25750__auto__ = e26174;
var statearr_26175_26233 = state_26147;
(statearr_26175_26233[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26234 = state_26147;
state_26147 = G__26234;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__ = function(state_26147){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1.call(this,state_26147);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto__,jobs,results,process,async))
})();
var state__25843__auto__ = (function (){var statearr_26176 = f__25842__auto__.call(null);
(statearr_26176[(6)] = c__25841__auto__);

return statearr_26176;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto__,jobs,results,process,async))
);

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

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

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

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

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

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

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

/**
 * Takes a predicate and a source channel and returns a vector of two
 *   channels, the first of which will contain the values for which the
 *   predicate returned true, the second those for which it returned
 *   false.
 * 
 *   The out channels will be unbuffered by default, or two buf-or-ns can
 *   be supplied. The channels will close after the source channel has
 *   closed.
 */
cljs.core.async.split = (function cljs$core$async$split(var_args){
var G__26242 = arguments.length;
switch (G__26242) {
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.call(null,p,ch,null,null);
});

cljs.core.async.split.cljs$core$IFn$_invoke$arity$4 = (function (p,ch,t_buf_or_n,f_buf_or_n){
var tc = cljs.core.async.chan.call(null,t_buf_or_n);
var fc = cljs.core.async.chan.call(null,f_buf_or_n);
var c__25841__auto___26291 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___26291,tc,fc){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___26291,tc,fc){
return (function (state_26268){
var state_val_26269 = (state_26268[(1)]);
if((state_val_26269 === (7))){
var inst_26264 = (state_26268[(2)]);
var state_26268__$1 = state_26268;
var statearr_26270_26292 = state_26268__$1;
(statearr_26270_26292[(2)] = inst_26264);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (1))){
var state_26268__$1 = state_26268;
var statearr_26271_26293 = state_26268__$1;
(statearr_26271_26293[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (4))){
var inst_26245 = (state_26268[(7)]);
var inst_26245__$1 = (state_26268[(2)]);
var inst_26246 = (inst_26245__$1 == null);
var state_26268__$1 = (function (){var statearr_26272 = state_26268;
(statearr_26272[(7)] = inst_26245__$1);

return statearr_26272;
})();
if(cljs.core.truth_(inst_26246)){
var statearr_26273_26294 = state_26268__$1;
(statearr_26273_26294[(1)] = (5));

} else {
var statearr_26274_26295 = state_26268__$1;
(statearr_26274_26295[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (13))){
var state_26268__$1 = state_26268;
var statearr_26275_26296 = state_26268__$1;
(statearr_26275_26296[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (6))){
var inst_26245 = (state_26268[(7)]);
var inst_26251 = p.call(null,inst_26245);
var state_26268__$1 = state_26268;
if(cljs.core.truth_(inst_26251)){
var statearr_26276_26297 = state_26268__$1;
(statearr_26276_26297[(1)] = (9));

} else {
var statearr_26277_26298 = state_26268__$1;
(statearr_26277_26298[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (3))){
var inst_26266 = (state_26268[(2)]);
var state_26268__$1 = state_26268;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26268__$1,inst_26266);
} else {
if((state_val_26269 === (12))){
var state_26268__$1 = state_26268;
var statearr_26278_26299 = state_26268__$1;
(statearr_26278_26299[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (2))){
var state_26268__$1 = state_26268;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26268__$1,(4),ch);
} else {
if((state_val_26269 === (11))){
var inst_26245 = (state_26268[(7)]);
var inst_26255 = (state_26268[(2)]);
var state_26268__$1 = state_26268;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26268__$1,(8),inst_26255,inst_26245);
} else {
if((state_val_26269 === (9))){
var state_26268__$1 = state_26268;
var statearr_26279_26300 = state_26268__$1;
(statearr_26279_26300[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (5))){
var inst_26248 = cljs.core.async.close_BANG_.call(null,tc);
var inst_26249 = cljs.core.async.close_BANG_.call(null,fc);
var state_26268__$1 = (function (){var statearr_26280 = state_26268;
(statearr_26280[(8)] = inst_26248);

return statearr_26280;
})();
var statearr_26281_26301 = state_26268__$1;
(statearr_26281_26301[(2)] = inst_26249);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (14))){
var inst_26262 = (state_26268[(2)]);
var state_26268__$1 = state_26268;
var statearr_26282_26302 = state_26268__$1;
(statearr_26282_26302[(2)] = inst_26262);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (10))){
var state_26268__$1 = state_26268;
var statearr_26283_26303 = state_26268__$1;
(statearr_26283_26303[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26269 === (8))){
var inst_26257 = (state_26268[(2)]);
var state_26268__$1 = state_26268;
if(cljs.core.truth_(inst_26257)){
var statearr_26284_26304 = state_26268__$1;
(statearr_26284_26304[(1)] = (12));

} else {
var statearr_26285_26305 = state_26268__$1;
(statearr_26285_26305[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___26291,tc,fc))
;
return ((function (switch__25746__auto__,c__25841__auto___26291,tc,fc){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_26286 = [null,null,null,null,null,null,null,null,null];
(statearr_26286[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_26286[(1)] = (1));

return statearr_26286;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_26268){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26268);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26287){if((e26287 instanceof Object)){
var ex__25750__auto__ = e26287;
var statearr_26288_26306 = state_26268;
(statearr_26288_26306[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26307 = state_26268;
state_26268 = G__26307;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_26268){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_26268);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___26291,tc,fc))
})();
var state__25843__auto__ = (function (){var statearr_26289 = f__25842__auto__.call(null);
(statearr_26289[(6)] = c__25841__auto___26291);

return statearr_26289;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___26291,tc,fc))
);


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

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

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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (1))){
var inst_26308 = init;
var state_26328__$1 = (function (){var statearr_26331 = state_26328;
(statearr_26331[(7)] = inst_26308);

return statearr_26331;
})();
var statearr_26332_26349 = state_26328__$1;
(statearr_26332_26349[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (4))){
var inst_26311 = (state_26328[(8)]);
var inst_26311__$1 = (state_26328[(2)]);
var inst_26312 = (inst_26311__$1 == null);
var state_26328__$1 = (function (){var statearr_26333 = state_26328;
(statearr_26333[(8)] = inst_26311__$1);

return statearr_26333;
})();
if(cljs.core.truth_(inst_26312)){
var statearr_26334_26350 = state_26328__$1;
(statearr_26334_26350[(1)] = (5));

} else {
var statearr_26335_26351 = state_26328__$1;
(statearr_26335_26351[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (6))){
var inst_26315 = (state_26328[(9)]);
var inst_26308 = (state_26328[(7)]);
var inst_26311 = (state_26328[(8)]);
var inst_26315__$1 = f.call(null,inst_26308,inst_26311);
var inst_26316 = cljs.core.reduced_QMARK_.call(null,inst_26315__$1);
var state_26328__$1 = (function (){var statearr_26336 = state_26328;
(statearr_26336[(9)] = inst_26315__$1);

return statearr_26336;
})();
if(inst_26316){
var statearr_26337_26352 = state_26328__$1;
(statearr_26337_26352[(1)] = (8));

} else {
var statearr_26338_26353 = state_26328__$1;
(statearr_26338_26353[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (3))){
var inst_26326 = (state_26328[(2)]);
var state_26328__$1 = state_26328;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26328__$1,inst_26326);
} else {
if((state_val_26329 === (2))){
var state_26328__$1 = state_26328;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26328__$1,(4),ch);
} else {
if((state_val_26329 === (9))){
var inst_26315 = (state_26328[(9)]);
var inst_26308 = inst_26315;
var state_26328__$1 = (function (){var statearr_26339 = state_26328;
(statearr_26339[(7)] = inst_26308);

return statearr_26339;
})();
var statearr_26340_26354 = state_26328__$1;
(statearr_26340_26354[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (5))){
var inst_26308 = (state_26328[(7)]);
var state_26328__$1 = state_26328;
var statearr_26341_26355 = state_26328__$1;
(statearr_26341_26355[(2)] = inst_26308);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (10))){
var inst_26322 = (state_26328[(2)]);
var state_26328__$1 = state_26328;
var statearr_26342_26356 = state_26328__$1;
(statearr_26342_26356[(2)] = inst_26322);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26329 === (8))){
var inst_26315 = (state_26328[(9)]);
var inst_26318 = cljs.core.deref.call(null,inst_26315);
var state_26328__$1 = state_26328;
var statearr_26343_26357 = state_26328__$1;
(statearr_26343_26357[(2)] = inst_26318);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto__))
;
return ((function (switch__25746__auto__,c__25841__auto__){
return (function() {
var cljs$core$async$reduce_$_state_machine__25747__auto__ = null;
var cljs$core$async$reduce_$_state_machine__25747__auto____0 = (function (){
var statearr_26344 = [null,null,null,null,null,null,null,null,null,null];
(statearr_26344[(0)] = cljs$core$async$reduce_$_state_machine__25747__auto__);

(statearr_26344[(1)] = (1));

return statearr_26344;
});
var cljs$core$async$reduce_$_state_machine__25747__auto____1 = (function (state_26328){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26328);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26345){if((e26345 instanceof Object)){
var ex__25750__auto__ = e26345;
var statearr_26346_26358 = state_26328;
(statearr_26346_26358[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26359 = state_26328;
state_26328 = G__26359;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__25747__auto__ = function(state_26328){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__25747__auto____1.call(this,state_26328);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__25747__auto____0;
cljs$core$async$reduce_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__25747__auto____1;
return cljs$core$async$reduce_$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto__))
})();
var state__25843__auto__ = (function (){var statearr_26347 = f__25842__auto__.call(null);
(statearr_26347[(6)] = c__25841__auto__);

return statearr_26347;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto__))
);

return c__25841__auto__;
});
/**
 * async/reduces a channel with a transformation (xform f).
 *   Returns a channel containing the result.  ch must close before
 *   transduce produces a result.
 */
cljs.core.async.transduce = (function cljs$core$async$transduce(xform,f,init,ch){
var f__$1 = xform.call(null,f);
var c__25841__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto__,f__$1){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto__,f__$1){
return (function (state_26365){
var state_val_26366 = (state_26365[(1)]);
if((state_val_26366 === (1))){
var inst_26360 = cljs.core.async.reduce.call(null,f__$1,init,ch);
var state_26365__$1 = state_26365;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26365__$1,(2),inst_26360);
} else {
if((state_val_26366 === (2))){
var inst_26362 = (state_26365[(2)]);
var inst_26363 = f__$1.call(null,inst_26362);
var state_26365__$1 = state_26365;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26365__$1,inst_26363);
} else {
return null;
}
}
});})(c__25841__auto__,f__$1))
;
return ((function (switch__25746__auto__,c__25841__auto__,f__$1){
return (function() {
var cljs$core$async$transduce_$_state_machine__25747__auto__ = null;
var cljs$core$async$transduce_$_state_machine__25747__auto____0 = (function (){
var statearr_26367 = [null,null,null,null,null,null,null];
(statearr_26367[(0)] = cljs$core$async$transduce_$_state_machine__25747__auto__);

(statearr_26367[(1)] = (1));

return statearr_26367;
});
var cljs$core$async$transduce_$_state_machine__25747__auto____1 = (function (state_26365){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26365);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26368){if((e26368 instanceof Object)){
var ex__25750__auto__ = e26368;
var statearr_26369_26371 = state_26365;
(statearr_26369_26371[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26372 = state_26365;
state_26365 = G__26372;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__25747__auto__ = function(state_26365){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__25747__auto____1.call(this,state_26365);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$transduce_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__25747__auto____0;
cljs$core$async$transduce_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__25747__auto____1;
return cljs$core$async$transduce_$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto__,f__$1))
})();
var state__25843__auto__ = (function (){var statearr_26370 = f__25842__auto__.call(null);
(statearr_26370[(6)] = c__25841__auto__);

return statearr_26370;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto__,f__$1))
);

return c__25841__auto__;
});
/**
 * Puts the contents of coll into the supplied channel.
 * 
 *   By default the channel will be closed after the items are copied,
 *   but can be determined by the close? parameter.
 * 
 *   Returns a channel which will close after the items are copied.
 */
cljs.core.async.onto_chan = (function cljs$core$async$onto_chan(var_args){
var G__26374 = arguments.length;
switch (G__26374) {
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.call(null,ch,coll,true);
});

cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__25841__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto__){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto__){
return (function (state_26399){
var state_val_26400 = (state_26399[(1)]);
if((state_val_26400 === (7))){
var inst_26381 = (state_26399[(2)]);
var state_26399__$1 = state_26399;
var statearr_26401_26422 = state_26399__$1;
(statearr_26401_26422[(2)] = inst_26381);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (1))){
var inst_26375 = cljs.core.seq.call(null,coll);
var inst_26376 = inst_26375;
var state_26399__$1 = (function (){var statearr_26402 = state_26399;
(statearr_26402[(7)] = inst_26376);

return statearr_26402;
})();
var statearr_26403_26423 = state_26399__$1;
(statearr_26403_26423[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (4))){
var inst_26376 = (state_26399[(7)]);
var inst_26379 = cljs.core.first.call(null,inst_26376);
var state_26399__$1 = state_26399;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26399__$1,(7),ch,inst_26379);
} else {
if((state_val_26400 === (13))){
var inst_26393 = (state_26399[(2)]);
var state_26399__$1 = state_26399;
var statearr_26404_26424 = state_26399__$1;
(statearr_26404_26424[(2)] = inst_26393);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (6))){
var inst_26384 = (state_26399[(2)]);
var state_26399__$1 = state_26399;
if(cljs.core.truth_(inst_26384)){
var statearr_26405_26425 = state_26399__$1;
(statearr_26405_26425[(1)] = (8));

} else {
var statearr_26406_26426 = state_26399__$1;
(statearr_26406_26426[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (3))){
var inst_26397 = (state_26399[(2)]);
var state_26399__$1 = state_26399;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26399__$1,inst_26397);
} else {
if((state_val_26400 === (12))){
var state_26399__$1 = state_26399;
var statearr_26407_26427 = state_26399__$1;
(statearr_26407_26427[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (2))){
var inst_26376 = (state_26399[(7)]);
var state_26399__$1 = state_26399;
if(cljs.core.truth_(inst_26376)){
var statearr_26408_26428 = state_26399__$1;
(statearr_26408_26428[(1)] = (4));

} else {
var statearr_26409_26429 = state_26399__$1;
(statearr_26409_26429[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (11))){
var inst_26390 = cljs.core.async.close_BANG_.call(null,ch);
var state_26399__$1 = state_26399;
var statearr_26410_26430 = state_26399__$1;
(statearr_26410_26430[(2)] = inst_26390);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (9))){
var state_26399__$1 = state_26399;
if(cljs.core.truth_(close_QMARK_)){
var statearr_26411_26431 = state_26399__$1;
(statearr_26411_26431[(1)] = (11));

} else {
var statearr_26412_26432 = state_26399__$1;
(statearr_26412_26432[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (5))){
var inst_26376 = (state_26399[(7)]);
var state_26399__$1 = state_26399;
var statearr_26413_26433 = state_26399__$1;
(statearr_26413_26433[(2)] = inst_26376);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (10))){
var inst_26395 = (state_26399[(2)]);
var state_26399__$1 = state_26399;
var statearr_26414_26434 = state_26399__$1;
(statearr_26414_26434[(2)] = inst_26395);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26400 === (8))){
var inst_26376 = (state_26399[(7)]);
var inst_26386 = cljs.core.next.call(null,inst_26376);
var inst_26376__$1 = inst_26386;
var state_26399__$1 = (function (){var statearr_26415 = state_26399;
(statearr_26415[(7)] = inst_26376__$1);

return statearr_26415;
})();
var statearr_26416_26435 = state_26399__$1;
(statearr_26416_26435[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto__))
;
return ((function (switch__25746__auto__,c__25841__auto__){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_26417 = [null,null,null,null,null,null,null,null];
(statearr_26417[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_26417[(1)] = (1));

return statearr_26417;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_26399){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26399);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26418){if((e26418 instanceof Object)){
var ex__25750__auto__ = e26418;
var statearr_26419_26436 = state_26399;
(statearr_26419_26436[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26437 = state_26399;
state_26399 = G__26437;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_26399){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_26399);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto__))
})();
var state__25843__auto__ = (function (){var statearr_26420 = f__25842__auto__.call(null);
(statearr_26420[(6)] = c__25841__auto__);

return statearr_26420;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto__))
);

return c__25841__auto__;
});

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

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

return ch;
});

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

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


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

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

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

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

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

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

cljs.core.async.t_cljs$core$async26438.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){
return (function (_26440){
var self__ = this;
var _26440__$1 = this;
return self__.meta26439;
});})(cs))
;

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

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

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

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

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

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

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

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

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

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

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

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

cljs.core.async.t_cljs$core$async26438.cljs$lang$ctorPrWriter = ((function (cs){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async26438");
});})(cs))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async26438.
 */
cljs.core.async.__GT_t_cljs$core$async26438 = ((function (cs){
return (function cljs$core$async$mult_$___GT_t_cljs$core$async26438(ch__$1,cs__$1,meta26439){
return (new cljs.core.async.t_cljs$core$async26438(ch__$1,cs__$1,meta26439));
});})(cs))
;

}

return (new cljs.core.async.t_cljs$core$async26438(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var dchan = cljs.core.async.chan.call(null,(1));
var dctr = cljs.core.atom.call(null,null);
var done = ((function (cs,m,dchan,dctr){
return (function (_){
if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,true);
} else {
return null;
}
});})(cs,m,dchan,dctr))
;
var c__25841__auto___26660 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___26660,cs,m,dchan,dctr,done){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___26660,cs,m,dchan,dctr,done){
return (function (state_26575){
var state_val_26576 = (state_26575[(1)]);
if((state_val_26576 === (7))){
var inst_26571 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26577_26661 = state_26575__$1;
(statearr_26577_26661[(2)] = inst_26571);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (20))){
var inst_26474 = (state_26575[(7)]);
var inst_26486 = cljs.core.first.call(null,inst_26474);
var inst_26487 = cljs.core.nth.call(null,inst_26486,(0),null);
var inst_26488 = cljs.core.nth.call(null,inst_26486,(1),null);
var state_26575__$1 = (function (){var statearr_26578 = state_26575;
(statearr_26578[(8)] = inst_26487);

return statearr_26578;
})();
if(cljs.core.truth_(inst_26488)){
var statearr_26579_26662 = state_26575__$1;
(statearr_26579_26662[(1)] = (22));

} else {
var statearr_26580_26663 = state_26575__$1;
(statearr_26580_26663[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (27))){
var inst_26443 = (state_26575[(9)]);
var inst_26518 = (state_26575[(10)]);
var inst_26516 = (state_26575[(11)]);
var inst_26523 = (state_26575[(12)]);
var inst_26523__$1 = cljs.core._nth.call(null,inst_26516,inst_26518);
var inst_26524 = cljs.core.async.put_BANG_.call(null,inst_26523__$1,inst_26443,done);
var state_26575__$1 = (function (){var statearr_26581 = state_26575;
(statearr_26581[(12)] = inst_26523__$1);

return statearr_26581;
})();
if(cljs.core.truth_(inst_26524)){
var statearr_26582_26664 = state_26575__$1;
(statearr_26582_26664[(1)] = (30));

} else {
var statearr_26583_26665 = state_26575__$1;
(statearr_26583_26665[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (1))){
var state_26575__$1 = state_26575;
var statearr_26584_26666 = state_26575__$1;
(statearr_26584_26666[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (24))){
var inst_26474 = (state_26575[(7)]);
var inst_26493 = (state_26575[(2)]);
var inst_26494 = cljs.core.next.call(null,inst_26474);
var inst_26452 = inst_26494;
var inst_26453 = null;
var inst_26454 = (0);
var inst_26455 = (0);
var state_26575__$1 = (function (){var statearr_26585 = state_26575;
(statearr_26585[(13)] = inst_26493);

(statearr_26585[(14)] = inst_26454);

(statearr_26585[(15)] = inst_26453);

(statearr_26585[(16)] = inst_26452);

(statearr_26585[(17)] = inst_26455);

return statearr_26585;
})();
var statearr_26586_26667 = state_26575__$1;
(statearr_26586_26667[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (39))){
var state_26575__$1 = state_26575;
var statearr_26590_26668 = state_26575__$1;
(statearr_26590_26668[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (4))){
var inst_26443 = (state_26575[(9)]);
var inst_26443__$1 = (state_26575[(2)]);
var inst_26444 = (inst_26443__$1 == null);
var state_26575__$1 = (function (){var statearr_26591 = state_26575;
(statearr_26591[(9)] = inst_26443__$1);

return statearr_26591;
})();
if(cljs.core.truth_(inst_26444)){
var statearr_26592_26669 = state_26575__$1;
(statearr_26592_26669[(1)] = (5));

} else {
var statearr_26593_26670 = state_26575__$1;
(statearr_26593_26670[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (15))){
var inst_26454 = (state_26575[(14)]);
var inst_26453 = (state_26575[(15)]);
var inst_26452 = (state_26575[(16)]);
var inst_26455 = (state_26575[(17)]);
var inst_26470 = (state_26575[(2)]);
var inst_26471 = (inst_26455 + (1));
var tmp26587 = inst_26454;
var tmp26588 = inst_26453;
var tmp26589 = inst_26452;
var inst_26452__$1 = tmp26589;
var inst_26453__$1 = tmp26588;
var inst_26454__$1 = tmp26587;
var inst_26455__$1 = inst_26471;
var state_26575__$1 = (function (){var statearr_26594 = state_26575;
(statearr_26594[(14)] = inst_26454__$1);

(statearr_26594[(18)] = inst_26470);

(statearr_26594[(15)] = inst_26453__$1);

(statearr_26594[(16)] = inst_26452__$1);

(statearr_26594[(17)] = inst_26455__$1);

return statearr_26594;
})();
var statearr_26595_26671 = state_26575__$1;
(statearr_26595_26671[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (21))){
var inst_26497 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26599_26672 = state_26575__$1;
(statearr_26599_26672[(2)] = inst_26497);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (31))){
var inst_26523 = (state_26575[(12)]);
var inst_26527 = done.call(null,null);
var inst_26528 = cljs.core.async.untap_STAR_.call(null,m,inst_26523);
var state_26575__$1 = (function (){var statearr_26600 = state_26575;
(statearr_26600[(19)] = inst_26527);

return statearr_26600;
})();
var statearr_26601_26673 = state_26575__$1;
(statearr_26601_26673[(2)] = inst_26528);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (32))){
var inst_26515 = (state_26575[(20)]);
var inst_26517 = (state_26575[(21)]);
var inst_26518 = (state_26575[(10)]);
var inst_26516 = (state_26575[(11)]);
var inst_26530 = (state_26575[(2)]);
var inst_26531 = (inst_26518 + (1));
var tmp26596 = inst_26515;
var tmp26597 = inst_26517;
var tmp26598 = inst_26516;
var inst_26515__$1 = tmp26596;
var inst_26516__$1 = tmp26598;
var inst_26517__$1 = tmp26597;
var inst_26518__$1 = inst_26531;
var state_26575__$1 = (function (){var statearr_26602 = state_26575;
(statearr_26602[(20)] = inst_26515__$1);

(statearr_26602[(21)] = inst_26517__$1);

(statearr_26602[(22)] = inst_26530);

(statearr_26602[(10)] = inst_26518__$1);

(statearr_26602[(11)] = inst_26516__$1);

return statearr_26602;
})();
var statearr_26603_26674 = state_26575__$1;
(statearr_26603_26674[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (40))){
var inst_26543 = (state_26575[(23)]);
var inst_26547 = done.call(null,null);
var inst_26548 = cljs.core.async.untap_STAR_.call(null,m,inst_26543);
var state_26575__$1 = (function (){var statearr_26604 = state_26575;
(statearr_26604[(24)] = inst_26547);

return statearr_26604;
})();
var statearr_26605_26675 = state_26575__$1;
(statearr_26605_26675[(2)] = inst_26548);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (33))){
var inst_26534 = (state_26575[(25)]);
var inst_26536 = cljs.core.chunked_seq_QMARK_.call(null,inst_26534);
var state_26575__$1 = state_26575;
if(inst_26536){
var statearr_26606_26676 = state_26575__$1;
(statearr_26606_26676[(1)] = (36));

} else {
var statearr_26607_26677 = state_26575__$1;
(statearr_26607_26677[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (13))){
var inst_26464 = (state_26575[(26)]);
var inst_26467 = cljs.core.async.close_BANG_.call(null,inst_26464);
var state_26575__$1 = state_26575;
var statearr_26608_26678 = state_26575__$1;
(statearr_26608_26678[(2)] = inst_26467);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (22))){
var inst_26487 = (state_26575[(8)]);
var inst_26490 = cljs.core.async.close_BANG_.call(null,inst_26487);
var state_26575__$1 = state_26575;
var statearr_26609_26679 = state_26575__$1;
(statearr_26609_26679[(2)] = inst_26490);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (36))){
var inst_26534 = (state_26575[(25)]);
var inst_26538 = cljs.core.chunk_first.call(null,inst_26534);
var inst_26539 = cljs.core.chunk_rest.call(null,inst_26534);
var inst_26540 = cljs.core.count.call(null,inst_26538);
var inst_26515 = inst_26539;
var inst_26516 = inst_26538;
var inst_26517 = inst_26540;
var inst_26518 = (0);
var state_26575__$1 = (function (){var statearr_26610 = state_26575;
(statearr_26610[(20)] = inst_26515);

(statearr_26610[(21)] = inst_26517);

(statearr_26610[(10)] = inst_26518);

(statearr_26610[(11)] = inst_26516);

return statearr_26610;
})();
var statearr_26611_26680 = state_26575__$1;
(statearr_26611_26680[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (41))){
var inst_26534 = (state_26575[(25)]);
var inst_26550 = (state_26575[(2)]);
var inst_26551 = cljs.core.next.call(null,inst_26534);
var inst_26515 = inst_26551;
var inst_26516 = null;
var inst_26517 = (0);
var inst_26518 = (0);
var state_26575__$1 = (function (){var statearr_26612 = state_26575;
(statearr_26612[(20)] = inst_26515);

(statearr_26612[(21)] = inst_26517);

(statearr_26612[(10)] = inst_26518);

(statearr_26612[(11)] = inst_26516);

(statearr_26612[(27)] = inst_26550);

return statearr_26612;
})();
var statearr_26613_26681 = state_26575__$1;
(statearr_26613_26681[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (43))){
var state_26575__$1 = state_26575;
var statearr_26614_26682 = state_26575__$1;
(statearr_26614_26682[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (29))){
var inst_26559 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26615_26683 = state_26575__$1;
(statearr_26615_26683[(2)] = inst_26559);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (44))){
var inst_26568 = (state_26575[(2)]);
var state_26575__$1 = (function (){var statearr_26616 = state_26575;
(statearr_26616[(28)] = inst_26568);

return statearr_26616;
})();
var statearr_26617_26684 = state_26575__$1;
(statearr_26617_26684[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (6))){
var inst_26507 = (state_26575[(29)]);
var inst_26506 = cljs.core.deref.call(null,cs);
var inst_26507__$1 = cljs.core.keys.call(null,inst_26506);
var inst_26508 = cljs.core.count.call(null,inst_26507__$1);
var inst_26509 = cljs.core.reset_BANG_.call(null,dctr,inst_26508);
var inst_26514 = cljs.core.seq.call(null,inst_26507__$1);
var inst_26515 = inst_26514;
var inst_26516 = null;
var inst_26517 = (0);
var inst_26518 = (0);
var state_26575__$1 = (function (){var statearr_26618 = state_26575;
(statearr_26618[(20)] = inst_26515);

(statearr_26618[(29)] = inst_26507__$1);

(statearr_26618[(21)] = inst_26517);

(statearr_26618[(30)] = inst_26509);

(statearr_26618[(10)] = inst_26518);

(statearr_26618[(11)] = inst_26516);

return statearr_26618;
})();
var statearr_26619_26685 = state_26575__$1;
(statearr_26619_26685[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (28))){
var inst_26515 = (state_26575[(20)]);
var inst_26534 = (state_26575[(25)]);
var inst_26534__$1 = cljs.core.seq.call(null,inst_26515);
var state_26575__$1 = (function (){var statearr_26620 = state_26575;
(statearr_26620[(25)] = inst_26534__$1);

return statearr_26620;
})();
if(inst_26534__$1){
var statearr_26621_26686 = state_26575__$1;
(statearr_26621_26686[(1)] = (33));

} else {
var statearr_26622_26687 = state_26575__$1;
(statearr_26622_26687[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (25))){
var inst_26517 = (state_26575[(21)]);
var inst_26518 = (state_26575[(10)]);
var inst_26520 = (inst_26518 < inst_26517);
var inst_26521 = inst_26520;
var state_26575__$1 = state_26575;
if(cljs.core.truth_(inst_26521)){
var statearr_26623_26688 = state_26575__$1;
(statearr_26623_26688[(1)] = (27));

} else {
var statearr_26624_26689 = state_26575__$1;
(statearr_26624_26689[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (34))){
var state_26575__$1 = state_26575;
var statearr_26625_26690 = state_26575__$1;
(statearr_26625_26690[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (17))){
var state_26575__$1 = state_26575;
var statearr_26626_26691 = state_26575__$1;
(statearr_26626_26691[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (3))){
var inst_26573 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26575__$1,inst_26573);
} else {
if((state_val_26576 === (12))){
var inst_26502 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26627_26692 = state_26575__$1;
(statearr_26627_26692[(2)] = inst_26502);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (35))){
var inst_26557 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26629_26694 = state_26575__$1;
(statearr_26629_26694[(2)] = inst_26557);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (19))){
var inst_26474 = (state_26575[(7)]);
var inst_26478 = cljs.core.chunk_first.call(null,inst_26474);
var inst_26479 = cljs.core.chunk_rest.call(null,inst_26474);
var inst_26480 = cljs.core.count.call(null,inst_26478);
var inst_26452 = inst_26479;
var inst_26453 = inst_26478;
var inst_26454 = inst_26480;
var inst_26455 = (0);
var state_26575__$1 = (function (){var statearr_26630 = state_26575;
(statearr_26630[(14)] = inst_26454);

(statearr_26630[(15)] = inst_26453);

(statearr_26630[(16)] = inst_26452);

(statearr_26630[(17)] = inst_26455);

return statearr_26630;
})();
var statearr_26631_26695 = state_26575__$1;
(statearr_26631_26695[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (11))){
var inst_26452 = (state_26575[(16)]);
var inst_26474 = (state_26575[(7)]);
var inst_26474__$1 = cljs.core.seq.call(null,inst_26452);
var state_26575__$1 = (function (){var statearr_26632 = state_26575;
(statearr_26632[(7)] = inst_26474__$1);

return statearr_26632;
})();
if(inst_26474__$1){
var statearr_26633_26696 = state_26575__$1;
(statearr_26633_26696[(1)] = (16));

} else {
var statearr_26634_26697 = state_26575__$1;
(statearr_26634_26697[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (9))){
var inst_26504 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26635_26698 = state_26575__$1;
(statearr_26635_26698[(2)] = inst_26504);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (5))){
var inst_26450 = cljs.core.deref.call(null,cs);
var inst_26451 = cljs.core.seq.call(null,inst_26450);
var inst_26452 = inst_26451;
var inst_26453 = null;
var inst_26454 = (0);
var inst_26455 = (0);
var state_26575__$1 = (function (){var statearr_26636 = state_26575;
(statearr_26636[(14)] = inst_26454);

(statearr_26636[(15)] = inst_26453);

(statearr_26636[(16)] = inst_26452);

(statearr_26636[(17)] = inst_26455);

return statearr_26636;
})();
var statearr_26637_26699 = state_26575__$1;
(statearr_26637_26699[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (14))){
var state_26575__$1 = state_26575;
var statearr_26638_26700 = state_26575__$1;
(statearr_26638_26700[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (45))){
var inst_26565 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26639_26701 = state_26575__$1;
(statearr_26639_26701[(2)] = inst_26565);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (26))){
var inst_26507 = (state_26575[(29)]);
var inst_26561 = (state_26575[(2)]);
var inst_26562 = cljs.core.seq.call(null,inst_26507);
var state_26575__$1 = (function (){var statearr_26640 = state_26575;
(statearr_26640[(31)] = inst_26561);

return statearr_26640;
})();
if(inst_26562){
var statearr_26641_26702 = state_26575__$1;
(statearr_26641_26702[(1)] = (42));

} else {
var statearr_26642_26703 = state_26575__$1;
(statearr_26642_26703[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (16))){
var inst_26474 = (state_26575[(7)]);
var inst_26476 = cljs.core.chunked_seq_QMARK_.call(null,inst_26474);
var state_26575__$1 = state_26575;
if(inst_26476){
var statearr_26643_26704 = state_26575__$1;
(statearr_26643_26704[(1)] = (19));

} else {
var statearr_26644_26705 = state_26575__$1;
(statearr_26644_26705[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (38))){
var inst_26554 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26645_26706 = state_26575__$1;
(statearr_26645_26706[(2)] = inst_26554);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (30))){
var state_26575__$1 = state_26575;
var statearr_26646_26707 = state_26575__$1;
(statearr_26646_26707[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (10))){
var inst_26453 = (state_26575[(15)]);
var inst_26455 = (state_26575[(17)]);
var inst_26463 = cljs.core._nth.call(null,inst_26453,inst_26455);
var inst_26464 = cljs.core.nth.call(null,inst_26463,(0),null);
var inst_26465 = cljs.core.nth.call(null,inst_26463,(1),null);
var state_26575__$1 = (function (){var statearr_26647 = state_26575;
(statearr_26647[(26)] = inst_26464);

return statearr_26647;
})();
if(cljs.core.truth_(inst_26465)){
var statearr_26648_26708 = state_26575__$1;
(statearr_26648_26708[(1)] = (13));

} else {
var statearr_26649_26709 = state_26575__$1;
(statearr_26649_26709[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (18))){
var inst_26500 = (state_26575[(2)]);
var state_26575__$1 = state_26575;
var statearr_26650_26710 = state_26575__$1;
(statearr_26650_26710[(2)] = inst_26500);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (42))){
var state_26575__$1 = state_26575;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_26575__$1,(45),dchan);
} else {
if((state_val_26576 === (37))){
var inst_26543 = (state_26575[(23)]);
var inst_26534 = (state_26575[(25)]);
var inst_26443 = (state_26575[(9)]);
var inst_26543__$1 = cljs.core.first.call(null,inst_26534);
var inst_26544 = cljs.core.async.put_BANG_.call(null,inst_26543__$1,inst_26443,done);
var state_26575__$1 = (function (){var statearr_26651 = state_26575;
(statearr_26651[(23)] = inst_26543__$1);

return statearr_26651;
})();
if(cljs.core.truth_(inst_26544)){
var statearr_26652_26711 = state_26575__$1;
(statearr_26652_26711[(1)] = (39));

} else {
var statearr_26653_26712 = state_26575__$1;
(statearr_26653_26712[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26576 === (8))){
var inst_26454 = (state_26575[(14)]);
var inst_26455 = (state_26575[(17)]);
var inst_26457 = (inst_26455 < inst_26454);
var inst_26458 = inst_26457;
var state_26575__$1 = state_26575;
if(cljs.core.truth_(inst_26458)){
var statearr_26654_26713 = state_26575__$1;
(statearr_26654_26713[(1)] = (10));

} else {
var statearr_26655_26714 = state_26575__$1;
(statearr_26655_26714[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___26660,cs,m,dchan,dctr,done))
;
return ((function (switch__25746__auto__,c__25841__auto___26660,cs,m,dchan,dctr,done){
return (function() {
var cljs$core$async$mult_$_state_machine__25747__auto__ = null;
var cljs$core$async$mult_$_state_machine__25747__auto____0 = (function (){
var statearr_26656 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26656[(0)] = cljs$core$async$mult_$_state_machine__25747__auto__);

(statearr_26656[(1)] = (1));

return statearr_26656;
});
var cljs$core$async$mult_$_state_machine__25747__auto____1 = (function (state_26575){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26575);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26657){if((e26657 instanceof Object)){
var ex__25750__auto__ = e26657;
var statearr_26658_26715 = state_26575;
(statearr_26658_26715[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26716 = state_26575;
state_26575 = G__26716;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__25747__auto__ = function(state_26575){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__25747__auto____1.call(this,state_26575);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__25747__auto____0;
cljs$core$async$mult_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__25747__auto____1;
return cljs$core$async$mult_$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___26660,cs,m,dchan,dctr,done))
})();
var state__25843__auto__ = (function (){var statearr_26659 = f__25842__auto__.call(null);
(statearr_26659[(6)] = c__25841__auto___26660);

return statearr_26659;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___26660,cs,m,dchan,dctr,done))
);


return m;
});
/**
 * Copies the mult source onto the supplied channel.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.tap = (function cljs$core$async$tap(var_args){
var G__26718 = arguments.length;
switch (G__26718) {
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.call(null,mult,ch,true);
});

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

return ch;
});

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

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

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

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

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

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

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

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

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

var G__26732 = (i__4731__auto___26731 + (1));
i__4731__auto___26731 = G__26732;
continue;
} else {
}
break;
}

var argseq__4737__auto__ = ((((3) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__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__4737__auto__);
});

cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__26724){
var map__26725 = p__26724;
var map__26725__$1 = (((((!((map__26725 == null))))?(((((map__26725.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__26725.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__26725):map__26725);
var opts = map__26725__$1;
var statearr_26727_26733 = state;
(statearr_26727_26733[(1)] = cont_block);


var temp__5720__auto__ = cljs.core.async.do_alts.call(null,((function (map__26725,map__26725__$1,opts){
return (function (val){
var statearr_26728_26734 = state;
(statearr_26728_26734[(2)] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
});})(map__26725,map__26725__$1,opts))
,ports,opts);
if(cljs.core.truth_(temp__5720__auto__)){
var cb = temp__5720__auto__;
var statearr_26729_26735 = state;
(statearr_26729_26735[(2)] = cljs.core.deref.call(null,cb));


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

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

/** @this {Function} */
cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq26720){
var G__26721 = cljs.core.first.call(null,seq26720);
var seq26720__$1 = cljs.core.next.call(null,seq26720);
var G__26722 = cljs.core.first.call(null,seq26720__$1);
var seq26720__$2 = cljs.core.next.call(null,seq26720__$1);
var G__26723 = cljs.core.first.call(null,seq26720__$2);
var seq26720__$3 = cljs.core.next.call(null,seq26720__$2);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__26721,G__26722,G__26723,seq26720__$3);
});

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

/**
* @constructor
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mix}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async26736 = (function (change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta26737){
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.meta26737 = meta26737;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async26736.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_26738,meta26737__$1){
var self__ = this;
var _26738__$1 = this;
return (new cljs.core.async.t_cljs$core$async26736(self__.change,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta26737__$1));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async26736.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_26738){
var self__ = this;
var _26738__$1 = this;
return self__.meta26737;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

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

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

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

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

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

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

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

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

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

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

cljs.core.async.t_cljs$core$async26736.prototype.cljs$core$async$Mix$solo_mode_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,mode){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.solo_modes.call(null,mode))){
} else {
throw (new Error(["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_.call(null,self__.solo_mode,mode);

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

cljs.core.async.t_cljs$core$async26736.getBasis = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (){
return new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"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,"meta26737","meta26737",-1904727161,null)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

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

cljs.core.async.t_cljs$core$async26736.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async26736");
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

}

return (new cljs.core.async.t_cljs$core$async26736(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__25841__auto___26900 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___26900,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___26900,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (state_26840){
var state_val_26841 = (state_26840[(1)]);
if((state_val_26841 === (7))){
var inst_26755 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
var statearr_26842_26901 = state_26840__$1;
(statearr_26842_26901[(2)] = inst_26755);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (20))){
var inst_26767 = (state_26840[(7)]);
var state_26840__$1 = state_26840;
var statearr_26843_26902 = state_26840__$1;
(statearr_26843_26902[(2)] = inst_26767);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (27))){
var state_26840__$1 = state_26840;
var statearr_26844_26903 = state_26840__$1;
(statearr_26844_26903[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (1))){
var inst_26742 = (state_26840[(8)]);
var inst_26742__$1 = calc_state.call(null);
var inst_26744 = (inst_26742__$1 == null);
var inst_26745 = cljs.core.not.call(null,inst_26744);
var state_26840__$1 = (function (){var statearr_26845 = state_26840;
(statearr_26845[(8)] = inst_26742__$1);

return statearr_26845;
})();
if(inst_26745){
var statearr_26846_26904 = state_26840__$1;
(statearr_26846_26904[(1)] = (2));

} else {
var statearr_26847_26905 = state_26840__$1;
(statearr_26847_26905[(1)] = (3));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (24))){
var inst_26800 = (state_26840[(9)]);
var inst_26814 = (state_26840[(10)]);
var inst_26791 = (state_26840[(11)]);
var inst_26814__$1 = inst_26791.call(null,inst_26800);
var state_26840__$1 = (function (){var statearr_26848 = state_26840;
(statearr_26848[(10)] = inst_26814__$1);

return statearr_26848;
})();
if(cljs.core.truth_(inst_26814__$1)){
var statearr_26849_26906 = state_26840__$1;
(statearr_26849_26906[(1)] = (29));

} else {
var statearr_26850_26907 = state_26840__$1;
(statearr_26850_26907[(1)] = (30));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (4))){
var inst_26758 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26758)){
var statearr_26851_26908 = state_26840__$1;
(statearr_26851_26908[(1)] = (8));

} else {
var statearr_26852_26909 = state_26840__$1;
(statearr_26852_26909[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (15))){
var inst_26785 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26785)){
var statearr_26853_26910 = state_26840__$1;
(statearr_26853_26910[(1)] = (19));

} else {
var statearr_26854_26911 = state_26840__$1;
(statearr_26854_26911[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (21))){
var inst_26790 = (state_26840[(12)]);
var inst_26790__$1 = (state_26840[(2)]);
var inst_26791 = cljs.core.get.call(null,inst_26790__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_26792 = cljs.core.get.call(null,inst_26790__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_26793 = cljs.core.get.call(null,inst_26790__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_26840__$1 = (function (){var statearr_26855 = state_26840;
(statearr_26855[(13)] = inst_26792);

(statearr_26855[(12)] = inst_26790__$1);

(statearr_26855[(11)] = inst_26791);

return statearr_26855;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_26840__$1,(22),inst_26793);
} else {
if((state_val_26841 === (31))){
var inst_26822 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26822)){
var statearr_26856_26912 = state_26840__$1;
(statearr_26856_26912[(1)] = (32));

} else {
var statearr_26857_26913 = state_26840__$1;
(statearr_26857_26913[(1)] = (33));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (32))){
var inst_26799 = (state_26840[(14)]);
var state_26840__$1 = state_26840;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_26840__$1,(35),out,inst_26799);
} else {
if((state_val_26841 === (33))){
var inst_26790 = (state_26840[(12)]);
var inst_26767 = inst_26790;
var state_26840__$1 = (function (){var statearr_26858 = state_26840;
(statearr_26858[(7)] = inst_26767);

return statearr_26858;
})();
var statearr_26859_26914 = state_26840__$1;
(statearr_26859_26914[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (13))){
var inst_26767 = (state_26840[(7)]);
var inst_26774 = inst_26767.cljs$lang$protocol_mask$partition0$;
var inst_26775 = (inst_26774 & (64));
var inst_26776 = inst_26767.cljs$core$ISeq$;
var inst_26777 = (cljs.core.PROTOCOL_SENTINEL === inst_26776);
var inst_26778 = ((inst_26775) || (inst_26777));
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26778)){
var statearr_26860_26915 = state_26840__$1;
(statearr_26860_26915[(1)] = (16));

} else {
var statearr_26861_26916 = state_26840__$1;
(statearr_26861_26916[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (22))){
var inst_26800 = (state_26840[(9)]);
var inst_26799 = (state_26840[(14)]);
var inst_26798 = (state_26840[(2)]);
var inst_26799__$1 = cljs.core.nth.call(null,inst_26798,(0),null);
var inst_26800__$1 = cljs.core.nth.call(null,inst_26798,(1),null);
var inst_26801 = (inst_26799__$1 == null);
var inst_26802 = cljs.core._EQ_.call(null,inst_26800__$1,change);
var inst_26803 = ((inst_26801) || (inst_26802));
var state_26840__$1 = (function (){var statearr_26862 = state_26840;
(statearr_26862[(9)] = inst_26800__$1);

(statearr_26862[(14)] = inst_26799__$1);

return statearr_26862;
})();
if(cljs.core.truth_(inst_26803)){
var statearr_26863_26917 = state_26840__$1;
(statearr_26863_26917[(1)] = (23));

} else {
var statearr_26864_26918 = state_26840__$1;
(statearr_26864_26918[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (36))){
var inst_26790 = (state_26840[(12)]);
var inst_26767 = inst_26790;
var state_26840__$1 = (function (){var statearr_26865 = state_26840;
(statearr_26865[(7)] = inst_26767);

return statearr_26865;
})();
var statearr_26866_26919 = state_26840__$1;
(statearr_26866_26919[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (29))){
var inst_26814 = (state_26840[(10)]);
var state_26840__$1 = state_26840;
var statearr_26867_26920 = state_26840__$1;
(statearr_26867_26920[(2)] = inst_26814);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (6))){
var state_26840__$1 = state_26840;
var statearr_26868_26921 = state_26840__$1;
(statearr_26868_26921[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (28))){
var inst_26810 = (state_26840[(2)]);
var inst_26811 = calc_state.call(null);
var inst_26767 = inst_26811;
var state_26840__$1 = (function (){var statearr_26869 = state_26840;
(statearr_26869[(15)] = inst_26810);

(statearr_26869[(7)] = inst_26767);

return statearr_26869;
})();
var statearr_26870_26922 = state_26840__$1;
(statearr_26870_26922[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (25))){
var inst_26836 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
var statearr_26871_26923 = state_26840__$1;
(statearr_26871_26923[(2)] = inst_26836);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (34))){
var inst_26834 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
var statearr_26872_26924 = state_26840__$1;
(statearr_26872_26924[(2)] = inst_26834);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (17))){
var state_26840__$1 = state_26840;
var statearr_26873_26925 = state_26840__$1;
(statearr_26873_26925[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (3))){
var state_26840__$1 = state_26840;
var statearr_26874_26926 = state_26840__$1;
(statearr_26874_26926[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (12))){
var inst_26838 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_26840__$1,inst_26838);
} else {
if((state_val_26841 === (2))){
var inst_26742 = (state_26840[(8)]);
var inst_26747 = inst_26742.cljs$lang$protocol_mask$partition0$;
var inst_26748 = (inst_26747 & (64));
var inst_26749 = inst_26742.cljs$core$ISeq$;
var inst_26750 = (cljs.core.PROTOCOL_SENTINEL === inst_26749);
var inst_26751 = ((inst_26748) || (inst_26750));
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26751)){
var statearr_26875_26927 = state_26840__$1;
(statearr_26875_26927[(1)] = (5));

} else {
var statearr_26876_26928 = state_26840__$1;
(statearr_26876_26928[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (23))){
var inst_26799 = (state_26840[(14)]);
var inst_26805 = (inst_26799 == null);
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26805)){
var statearr_26877_26929 = state_26840__$1;
(statearr_26877_26929[(1)] = (26));

} else {
var statearr_26878_26930 = state_26840__$1;
(statearr_26878_26930[(1)] = (27));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (35))){
var inst_26825 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
if(cljs.core.truth_(inst_26825)){
var statearr_26879_26931 = state_26840__$1;
(statearr_26879_26931[(1)] = (36));

} else {
var statearr_26880_26932 = state_26840__$1;
(statearr_26880_26932[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (19))){
var inst_26767 = (state_26840[(7)]);
var inst_26787 = cljs.core.apply.call(null,cljs.core.hash_map,inst_26767);
var state_26840__$1 = state_26840;
var statearr_26881_26933 = state_26840__$1;
(statearr_26881_26933[(2)] = inst_26787);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (11))){
var inst_26767 = (state_26840[(7)]);
var inst_26771 = (inst_26767 == null);
var inst_26772 = cljs.core.not.call(null,inst_26771);
var state_26840__$1 = state_26840;
if(inst_26772){
var statearr_26882_26934 = state_26840__$1;
(statearr_26882_26934[(1)] = (13));

} else {
var statearr_26883_26935 = state_26840__$1;
(statearr_26883_26935[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (9))){
var inst_26742 = (state_26840[(8)]);
var state_26840__$1 = state_26840;
var statearr_26884_26936 = state_26840__$1;
(statearr_26884_26936[(2)] = inst_26742);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (5))){
var state_26840__$1 = state_26840;
var statearr_26885_26937 = state_26840__$1;
(statearr_26885_26937[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (14))){
var state_26840__$1 = state_26840;
var statearr_26886_26938 = state_26840__$1;
(statearr_26886_26938[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (26))){
var inst_26800 = (state_26840[(9)]);
var inst_26807 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_26800);
var state_26840__$1 = state_26840;
var statearr_26887_26939 = state_26840__$1;
(statearr_26887_26939[(2)] = inst_26807);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (16))){
var state_26840__$1 = state_26840;
var statearr_26888_26940 = state_26840__$1;
(statearr_26888_26940[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (38))){
var inst_26830 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
var statearr_26889_26941 = state_26840__$1;
(statearr_26889_26941[(2)] = inst_26830);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (30))){
var inst_26800 = (state_26840[(9)]);
var inst_26792 = (state_26840[(13)]);
var inst_26791 = (state_26840[(11)]);
var inst_26817 = cljs.core.empty_QMARK_.call(null,inst_26791);
var inst_26818 = inst_26792.call(null,inst_26800);
var inst_26819 = cljs.core.not.call(null,inst_26818);
var inst_26820 = ((inst_26817) && (inst_26819));
var state_26840__$1 = state_26840;
var statearr_26890_26942 = state_26840__$1;
(statearr_26890_26942[(2)] = inst_26820);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (10))){
var inst_26742 = (state_26840[(8)]);
var inst_26763 = (state_26840[(2)]);
var inst_26764 = cljs.core.get.call(null,inst_26763,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_26765 = cljs.core.get.call(null,inst_26763,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_26766 = cljs.core.get.call(null,inst_26763,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_26767 = inst_26742;
var state_26840__$1 = (function (){var statearr_26891 = state_26840;
(statearr_26891[(16)] = inst_26766);

(statearr_26891[(7)] = inst_26767);

(statearr_26891[(17)] = inst_26764);

(statearr_26891[(18)] = inst_26765);

return statearr_26891;
})();
var statearr_26892_26943 = state_26840__$1;
(statearr_26892_26943[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (18))){
var inst_26782 = (state_26840[(2)]);
var state_26840__$1 = state_26840;
var statearr_26893_26944 = state_26840__$1;
(statearr_26893_26944[(2)] = inst_26782);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (37))){
var state_26840__$1 = state_26840;
var statearr_26894_26945 = state_26840__$1;
(statearr_26894_26945[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26841 === (8))){
var inst_26742 = (state_26840[(8)]);
var inst_26760 = cljs.core.apply.call(null,cljs.core.hash_map,inst_26742);
var state_26840__$1 = state_26840;
var statearr_26895_26946 = state_26840__$1;
(statearr_26895_26946[(2)] = inst_26760);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___26900,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
;
return ((function (switch__25746__auto__,c__25841__auto___26900,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function() {
var cljs$core$async$mix_$_state_machine__25747__auto__ = null;
var cljs$core$async$mix_$_state_machine__25747__auto____0 = (function (){
var statearr_26896 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26896[(0)] = cljs$core$async$mix_$_state_machine__25747__auto__);

(statearr_26896[(1)] = (1));

return statearr_26896;
});
var cljs$core$async$mix_$_state_machine__25747__auto____1 = (function (state_26840){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_26840);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e26897){if((e26897 instanceof Object)){
var ex__25750__auto__ = e26897;
var statearr_26898_26947 = state_26840;
(statearr_26898_26947[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26948 = state_26840;
state_26840 = G__26948;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__25747__auto__ = function(state_26840){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__25747__auto____1.call(this,state_26840);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__25747__auto____0;
cljs$core$async$mix_$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__25747__auto____1;
return cljs$core$async$mix_$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___26900,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
})();
var state__25843__auto__ = (function (){var statearr_26899 = f__25842__auto__.call(null);
(statearr_26899[(6)] = c__25841__auto___26900);

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


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

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

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

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

cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__26950 = arguments.length;
switch (G__26950) {
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 {
var x__4433__auto__ = (((p == null))?null:p);
var m__4434__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,p);
} else {
var m__4431__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,p);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p);
}
}
}
});

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

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


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

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

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

cljs.core.async.t_cljs$core$async26955.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){
return (function (_26957){
var self__ = this;
var _26957__$1 = this;
return self__.meta26956;
});})(mults,ensure_mult))
;

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

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

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

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

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

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

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

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

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

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

cljs.core.async.t_cljs$core$async26955.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async26955");
});})(mults,ensure_mult))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async26955.
 */
cljs.core.async.__GT_t_cljs$core$async26955 = ((function (mults,ensure_mult){
return (function cljs$core$async$__GT_t_cljs$core$async26955(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta26956){
return (new cljs.core.async.t_cljs$core$async26955(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta26956));
});})(mults,ensure_mult))
;

}

return (new cljs.core.async.t_cljs$core$async26955(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__25841__auto___27075 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27075,mults,ensure_mult,p){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27075,mults,ensure_mult,p){
return (function (state_27029){
var state_val_27030 = (state_27029[(1)]);
if((state_val_27030 === (7))){
var inst_27025 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27031_27076 = state_27029__$1;
(statearr_27031_27076[(2)] = inst_27025);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (20))){
var state_27029__$1 = state_27029;
var statearr_27032_27077 = state_27029__$1;
(statearr_27032_27077[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (1))){
var state_27029__$1 = state_27029;
var statearr_27033_27078 = state_27029__$1;
(statearr_27033_27078[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (24))){
var inst_27008 = (state_27029[(7)]);
var inst_27017 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_27008);
var state_27029__$1 = state_27029;
var statearr_27034_27079 = state_27029__$1;
(statearr_27034_27079[(2)] = inst_27017);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (4))){
var inst_26960 = (state_27029[(8)]);
var inst_26960__$1 = (state_27029[(2)]);
var inst_26961 = (inst_26960__$1 == null);
var state_27029__$1 = (function (){var statearr_27035 = state_27029;
(statearr_27035[(8)] = inst_26960__$1);

return statearr_27035;
})();
if(cljs.core.truth_(inst_26961)){
var statearr_27036_27080 = state_27029__$1;
(statearr_27036_27080[(1)] = (5));

} else {
var statearr_27037_27081 = state_27029__$1;
(statearr_27037_27081[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (15))){
var inst_27002 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27038_27082 = state_27029__$1;
(statearr_27038_27082[(2)] = inst_27002);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (21))){
var inst_27022 = (state_27029[(2)]);
var state_27029__$1 = (function (){var statearr_27039 = state_27029;
(statearr_27039[(9)] = inst_27022);

return statearr_27039;
})();
var statearr_27040_27083 = state_27029__$1;
(statearr_27040_27083[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (13))){
var inst_26984 = (state_27029[(10)]);
var inst_26986 = cljs.core.chunked_seq_QMARK_.call(null,inst_26984);
var state_27029__$1 = state_27029;
if(inst_26986){
var statearr_27041_27084 = state_27029__$1;
(statearr_27041_27084[(1)] = (16));

} else {
var statearr_27042_27085 = state_27029__$1;
(statearr_27042_27085[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (22))){
var inst_27014 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
if(cljs.core.truth_(inst_27014)){
var statearr_27043_27086 = state_27029__$1;
(statearr_27043_27086[(1)] = (23));

} else {
var statearr_27044_27087 = state_27029__$1;
(statearr_27044_27087[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (6))){
var inst_27010 = (state_27029[(11)]);
var inst_26960 = (state_27029[(8)]);
var inst_27008 = (state_27029[(7)]);
var inst_27008__$1 = topic_fn.call(null,inst_26960);
var inst_27009 = cljs.core.deref.call(null,mults);
var inst_27010__$1 = cljs.core.get.call(null,inst_27009,inst_27008__$1);
var state_27029__$1 = (function (){var statearr_27045 = state_27029;
(statearr_27045[(11)] = inst_27010__$1);

(statearr_27045[(7)] = inst_27008__$1);

return statearr_27045;
})();
if(cljs.core.truth_(inst_27010__$1)){
var statearr_27046_27088 = state_27029__$1;
(statearr_27046_27088[(1)] = (19));

} else {
var statearr_27047_27089 = state_27029__$1;
(statearr_27047_27089[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (25))){
var inst_27019 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27048_27090 = state_27029__$1;
(statearr_27048_27090[(2)] = inst_27019);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (17))){
var inst_26984 = (state_27029[(10)]);
var inst_26993 = cljs.core.first.call(null,inst_26984);
var inst_26994 = cljs.core.async.muxch_STAR_.call(null,inst_26993);
var inst_26995 = cljs.core.async.close_BANG_.call(null,inst_26994);
var inst_26996 = cljs.core.next.call(null,inst_26984);
var inst_26970 = inst_26996;
var inst_26971 = null;
var inst_26972 = (0);
var inst_26973 = (0);
var state_27029__$1 = (function (){var statearr_27049 = state_27029;
(statearr_27049[(12)] = inst_26970);

(statearr_27049[(13)] = inst_26973);

(statearr_27049[(14)] = inst_26972);

(statearr_27049[(15)] = inst_26971);

(statearr_27049[(16)] = inst_26995);

return statearr_27049;
})();
var statearr_27050_27091 = state_27029__$1;
(statearr_27050_27091[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (3))){
var inst_27027 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27029__$1,inst_27027);
} else {
if((state_val_27030 === (12))){
var inst_27004 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27051_27092 = state_27029__$1;
(statearr_27051_27092[(2)] = inst_27004);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (19))){
var inst_27010 = (state_27029[(11)]);
var inst_26960 = (state_27029[(8)]);
var inst_27012 = cljs.core.async.muxch_STAR_.call(null,inst_27010);
var state_27029__$1 = state_27029;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27029__$1,(22),inst_27012,inst_26960);
} else {
if((state_val_27030 === (11))){
var inst_26984 = (state_27029[(10)]);
var inst_26970 = (state_27029[(12)]);
var inst_26984__$1 = cljs.core.seq.call(null,inst_26970);
var state_27029__$1 = (function (){var statearr_27053 = state_27029;
(statearr_27053[(10)] = inst_26984__$1);

return statearr_27053;
})();
if(inst_26984__$1){
var statearr_27054_27094 = state_27029__$1;
(statearr_27054_27094[(1)] = (13));

} else {
var statearr_27055_27095 = state_27029__$1;
(statearr_27055_27095[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (9))){
var inst_27006 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27056_27096 = state_27029__$1;
(statearr_27056_27096[(2)] = inst_27006);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (5))){
var inst_26967 = cljs.core.deref.call(null,mults);
var inst_26968 = cljs.core.vals.call(null,inst_26967);
var inst_26969 = cljs.core.seq.call(null,inst_26968);
var inst_26970 = inst_26969;
var inst_26971 = null;
var inst_26972 = (0);
var inst_26973 = (0);
var state_27029__$1 = (function (){var statearr_27057 = state_27029;
(statearr_27057[(12)] = inst_26970);

(statearr_27057[(13)] = inst_26973);

(statearr_27057[(14)] = inst_26972);

(statearr_27057[(15)] = inst_26971);

return statearr_27057;
})();
var statearr_27058_27097 = state_27029__$1;
(statearr_27058_27097[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (14))){
var state_27029__$1 = state_27029;
var statearr_27062_27098 = state_27029__$1;
(statearr_27062_27098[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (16))){
var inst_26984 = (state_27029[(10)]);
var inst_26988 = cljs.core.chunk_first.call(null,inst_26984);
var inst_26989 = cljs.core.chunk_rest.call(null,inst_26984);
var inst_26990 = cljs.core.count.call(null,inst_26988);
var inst_26970 = inst_26989;
var inst_26971 = inst_26988;
var inst_26972 = inst_26990;
var inst_26973 = (0);
var state_27029__$1 = (function (){var statearr_27063 = state_27029;
(statearr_27063[(12)] = inst_26970);

(statearr_27063[(13)] = inst_26973);

(statearr_27063[(14)] = inst_26972);

(statearr_27063[(15)] = inst_26971);

return statearr_27063;
})();
var statearr_27064_27099 = state_27029__$1;
(statearr_27064_27099[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (10))){
var inst_26970 = (state_27029[(12)]);
var inst_26973 = (state_27029[(13)]);
var inst_26972 = (state_27029[(14)]);
var inst_26971 = (state_27029[(15)]);
var inst_26978 = cljs.core._nth.call(null,inst_26971,inst_26973);
var inst_26979 = cljs.core.async.muxch_STAR_.call(null,inst_26978);
var inst_26980 = cljs.core.async.close_BANG_.call(null,inst_26979);
var inst_26981 = (inst_26973 + (1));
var tmp27059 = inst_26970;
var tmp27060 = inst_26972;
var tmp27061 = inst_26971;
var inst_26970__$1 = tmp27059;
var inst_26971__$1 = tmp27061;
var inst_26972__$1 = tmp27060;
var inst_26973__$1 = inst_26981;
var state_27029__$1 = (function (){var statearr_27065 = state_27029;
(statearr_27065[(12)] = inst_26970__$1);

(statearr_27065[(13)] = inst_26973__$1);

(statearr_27065[(14)] = inst_26972__$1);

(statearr_27065[(15)] = inst_26971__$1);

(statearr_27065[(17)] = inst_26980);

return statearr_27065;
})();
var statearr_27066_27100 = state_27029__$1;
(statearr_27066_27100[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (18))){
var inst_26999 = (state_27029[(2)]);
var state_27029__$1 = state_27029;
var statearr_27067_27101 = state_27029__$1;
(statearr_27067_27101[(2)] = inst_26999);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27030 === (8))){
var inst_26973 = (state_27029[(13)]);
var inst_26972 = (state_27029[(14)]);
var inst_26975 = (inst_26973 < inst_26972);
var inst_26976 = inst_26975;
var state_27029__$1 = state_27029;
if(cljs.core.truth_(inst_26976)){
var statearr_27068_27102 = state_27029__$1;
(statearr_27068_27102[(1)] = (10));

} else {
var statearr_27069_27103 = state_27029__$1;
(statearr_27069_27103[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27075,mults,ensure_mult,p))
;
return ((function (switch__25746__auto__,c__25841__auto___27075,mults,ensure_mult,p){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27070 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27070[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27070[(1)] = (1));

return statearr_27070;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27029){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27029);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27071){if((e27071 instanceof Object)){
var ex__25750__auto__ = e27071;
var statearr_27072_27104 = state_27029;
(statearr_27072_27104[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27105 = state_27029;
state_27029 = G__27105;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27029){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27029);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27075,mults,ensure_mult,p))
})();
var state__25843__auto__ = (function (){var statearr_27073 = f__25842__auto__.call(null);
(statearr_27073[(6)] = c__25841__auto___27075);

return statearr_27073;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27075,mults,ensure_mult,p))
);


return p;
});

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

/**
 * Subscribes a channel to a topic of a pub.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.sub = (function cljs$core$async$sub(var_args){
var G__27107 = arguments.length;
switch (G__27107) {
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.call(null,p,topic,ch,true);
});

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

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

/**
 * Unsubscribes a channel from a topic of a pub
 */
cljs.core.async.unsub = (function cljs$core$async$unsub(p,topic,ch){
return cljs.core.async.unsub_STAR_.call(null,p,topic,ch);
});
/**
 * Unsubscribes all channels from a pub, or a topic of a pub
 */
cljs.core.async.unsub_all = (function cljs$core$async$unsub_all(var_args){
var G__27110 = arguments.length;
switch (G__27110) {
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_.call(null,p);
});

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

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

/**
 * Takes a function and a collection of source channels, and returns a
 *   channel which contains the values produced by applying f to the set
 *   of first items taken from each source channel, followed by applying
 *   f to the set of second items from each channel, until any one of the
 *   channels is closed, at which point the output channel will be
 *   closed. The returned channel will be unbuffered by default, or a
 *   buf-or-n can be supplied
 */
cljs.core.async.map = (function cljs$core$async$map(var_args){
var G__27113 = arguments.length;
switch (G__27113) {
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.call(null,f,chs,null);
});

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

if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,rets.slice((0)));
} else {
return null;
}
});
;})(chs__$1,out,cnt,rets,dchan,dctr))
});})(chs__$1,out,cnt,rets,dchan,dctr))
,cljs.core.range.call(null,cnt));
var c__25841__auto___27180 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (state_27152){
var state_val_27153 = (state_27152[(1)]);
if((state_val_27153 === (7))){
var state_27152__$1 = state_27152;
var statearr_27154_27181 = state_27152__$1;
(statearr_27154_27181[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (1))){
var state_27152__$1 = state_27152;
var statearr_27155_27182 = state_27152__$1;
(statearr_27155_27182[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (4))){
var inst_27116 = (state_27152[(7)]);
var inst_27118 = (inst_27116 < cnt);
var state_27152__$1 = state_27152;
if(cljs.core.truth_(inst_27118)){
var statearr_27156_27183 = state_27152__$1;
(statearr_27156_27183[(1)] = (6));

} else {
var statearr_27157_27184 = state_27152__$1;
(statearr_27157_27184[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (15))){
var inst_27148 = (state_27152[(2)]);
var state_27152__$1 = state_27152;
var statearr_27158_27185 = state_27152__$1;
(statearr_27158_27185[(2)] = inst_27148);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (13))){
var inst_27141 = cljs.core.async.close_BANG_.call(null,out);
var state_27152__$1 = state_27152;
var statearr_27159_27186 = state_27152__$1;
(statearr_27159_27186[(2)] = inst_27141);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (6))){
var state_27152__$1 = state_27152;
var statearr_27160_27187 = state_27152__$1;
(statearr_27160_27187[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (3))){
var inst_27150 = (state_27152[(2)]);
var state_27152__$1 = state_27152;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27152__$1,inst_27150);
} else {
if((state_val_27153 === (12))){
var inst_27138 = (state_27152[(8)]);
var inst_27138__$1 = (state_27152[(2)]);
var inst_27139 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_27138__$1);
var state_27152__$1 = (function (){var statearr_27161 = state_27152;
(statearr_27161[(8)] = inst_27138__$1);

return statearr_27161;
})();
if(cljs.core.truth_(inst_27139)){
var statearr_27162_27188 = state_27152__$1;
(statearr_27162_27188[(1)] = (13));

} else {
var statearr_27163_27189 = state_27152__$1;
(statearr_27163_27189[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (2))){
var inst_27115 = cljs.core.reset_BANG_.call(null,dctr,cnt);
var inst_27116 = (0);
var state_27152__$1 = (function (){var statearr_27164 = state_27152;
(statearr_27164[(7)] = inst_27116);

(statearr_27164[(9)] = inst_27115);

return statearr_27164;
})();
var statearr_27165_27190 = state_27152__$1;
(statearr_27165_27190[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (11))){
var inst_27116 = (state_27152[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_27152,(10),Object,null,(9));
var inst_27125 = chs__$1.call(null,inst_27116);
var inst_27126 = done.call(null,inst_27116);
var inst_27127 = cljs.core.async.take_BANG_.call(null,inst_27125,inst_27126);
var state_27152__$1 = state_27152;
var statearr_27166_27191 = state_27152__$1;
(statearr_27166_27191[(2)] = inst_27127);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (9))){
var inst_27116 = (state_27152[(7)]);
var inst_27129 = (state_27152[(2)]);
var inst_27130 = (inst_27116 + (1));
var inst_27116__$1 = inst_27130;
var state_27152__$1 = (function (){var statearr_27167 = state_27152;
(statearr_27167[(10)] = inst_27129);

(statearr_27167[(7)] = inst_27116__$1);

return statearr_27167;
})();
var statearr_27168_27192 = state_27152__$1;
(statearr_27168_27192[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (5))){
var inst_27136 = (state_27152[(2)]);
var state_27152__$1 = (function (){var statearr_27169 = state_27152;
(statearr_27169[(11)] = inst_27136);

return statearr_27169;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27152__$1,(12),dchan);
} else {
if((state_val_27153 === (14))){
var inst_27138 = (state_27152[(8)]);
var inst_27143 = cljs.core.apply.call(null,f,inst_27138);
var state_27152__$1 = state_27152;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27152__$1,(16),out,inst_27143);
} else {
if((state_val_27153 === (16))){
var inst_27145 = (state_27152[(2)]);
var state_27152__$1 = (function (){var statearr_27170 = state_27152;
(statearr_27170[(12)] = inst_27145);

return statearr_27170;
})();
var statearr_27171_27193 = state_27152__$1;
(statearr_27171_27193[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (10))){
var inst_27120 = (state_27152[(2)]);
var inst_27121 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec);
var state_27152__$1 = (function (){var statearr_27172 = state_27152;
(statearr_27172[(13)] = inst_27120);

return statearr_27172;
})();
var statearr_27173_27194 = state_27152__$1;
(statearr_27173_27194[(2)] = inst_27121);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27153 === (8))){
var inst_27134 = (state_27152[(2)]);
var state_27152__$1 = state_27152;
var statearr_27174_27195 = state_27152__$1;
(statearr_27174_27195[(2)] = inst_27134);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done))
;
return ((function (switch__25746__auto__,c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27175 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27175[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27175[(1)] = (1));

return statearr_27175;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27152){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27152);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27176){if((e27176 instanceof Object)){
var ex__25750__auto__ = e27176;
var statearr_27177_27196 = state_27152;
(statearr_27177_27196[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27197 = state_27152;
state_27152 = G__27197;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27152){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27152);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done))
})();
var state__25843__auto__ = (function (){var statearr_27178 = f__25842__auto__.call(null);
(statearr_27178[(6)] = c__25841__auto___27180);

return statearr_27178;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27180,chs__$1,out,cnt,rets,dchan,dctr,done))
);


return out;
});

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

/**
 * Takes a collection of source channels and returns a channel which
 *   contains all values taken from them. The returned channel will be
 *   unbuffered by default, or a buf-or-n can be supplied. The channel
 *   will close after all the source channels have closed.
 */
cljs.core.async.merge = (function cljs$core$async$merge(var_args){
var G__27200 = arguments.length;
switch (G__27200) {
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.call(null,chs,null);
});

cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27254 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27254,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27254,out){
return (function (state_27232){
var state_val_27233 = (state_27232[(1)]);
if((state_val_27233 === (7))){
var inst_27212 = (state_27232[(7)]);
var inst_27211 = (state_27232[(8)]);
var inst_27211__$1 = (state_27232[(2)]);
var inst_27212__$1 = cljs.core.nth.call(null,inst_27211__$1,(0),null);
var inst_27213 = cljs.core.nth.call(null,inst_27211__$1,(1),null);
var inst_27214 = (inst_27212__$1 == null);
var state_27232__$1 = (function (){var statearr_27234 = state_27232;
(statearr_27234[(9)] = inst_27213);

(statearr_27234[(7)] = inst_27212__$1);

(statearr_27234[(8)] = inst_27211__$1);

return statearr_27234;
})();
if(cljs.core.truth_(inst_27214)){
var statearr_27235_27255 = state_27232__$1;
(statearr_27235_27255[(1)] = (8));

} else {
var statearr_27236_27256 = state_27232__$1;
(statearr_27236_27256[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (1))){
var inst_27201 = cljs.core.vec.call(null,chs);
var inst_27202 = inst_27201;
var state_27232__$1 = (function (){var statearr_27237 = state_27232;
(statearr_27237[(10)] = inst_27202);

return statearr_27237;
})();
var statearr_27238_27257 = state_27232__$1;
(statearr_27238_27257[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (4))){
var inst_27202 = (state_27232[(10)]);
var state_27232__$1 = state_27232;
return cljs.core.async.ioc_alts_BANG_.call(null,state_27232__$1,(7),inst_27202);
} else {
if((state_val_27233 === (6))){
var inst_27228 = (state_27232[(2)]);
var state_27232__$1 = state_27232;
var statearr_27239_27258 = state_27232__$1;
(statearr_27239_27258[(2)] = inst_27228);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (3))){
var inst_27230 = (state_27232[(2)]);
var state_27232__$1 = state_27232;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27232__$1,inst_27230);
} else {
if((state_val_27233 === (2))){
var inst_27202 = (state_27232[(10)]);
var inst_27204 = cljs.core.count.call(null,inst_27202);
var inst_27205 = (inst_27204 > (0));
var state_27232__$1 = state_27232;
if(cljs.core.truth_(inst_27205)){
var statearr_27241_27259 = state_27232__$1;
(statearr_27241_27259[(1)] = (4));

} else {
var statearr_27242_27260 = state_27232__$1;
(statearr_27242_27260[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (11))){
var inst_27202 = (state_27232[(10)]);
var inst_27221 = (state_27232[(2)]);
var tmp27240 = inst_27202;
var inst_27202__$1 = tmp27240;
var state_27232__$1 = (function (){var statearr_27243 = state_27232;
(statearr_27243[(11)] = inst_27221);

(statearr_27243[(10)] = inst_27202__$1);

return statearr_27243;
})();
var statearr_27244_27261 = state_27232__$1;
(statearr_27244_27261[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (9))){
var inst_27212 = (state_27232[(7)]);
var state_27232__$1 = state_27232;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27232__$1,(11),out,inst_27212);
} else {
if((state_val_27233 === (5))){
var inst_27226 = cljs.core.async.close_BANG_.call(null,out);
var state_27232__$1 = state_27232;
var statearr_27245_27262 = state_27232__$1;
(statearr_27245_27262[(2)] = inst_27226);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (10))){
var inst_27224 = (state_27232[(2)]);
var state_27232__$1 = state_27232;
var statearr_27246_27263 = state_27232__$1;
(statearr_27246_27263[(2)] = inst_27224);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27233 === (8))){
var inst_27213 = (state_27232[(9)]);
var inst_27212 = (state_27232[(7)]);
var inst_27202 = (state_27232[(10)]);
var inst_27211 = (state_27232[(8)]);
var inst_27216 = (function (){var cs = inst_27202;
var vec__27207 = inst_27211;
var v = inst_27212;
var c = inst_27213;
return ((function (cs,vec__27207,v,c,inst_27213,inst_27212,inst_27202,inst_27211,state_val_27233,c__25841__auto___27254,out){
return (function (p1__27198_SHARP_){
return cljs.core.not_EQ_.call(null,c,p1__27198_SHARP_);
});
;})(cs,vec__27207,v,c,inst_27213,inst_27212,inst_27202,inst_27211,state_val_27233,c__25841__auto___27254,out))
})();
var inst_27217 = cljs.core.filterv.call(null,inst_27216,inst_27202);
var inst_27202__$1 = inst_27217;
var state_27232__$1 = (function (){var statearr_27247 = state_27232;
(statearr_27247[(10)] = inst_27202__$1);

return statearr_27247;
})();
var statearr_27248_27264 = state_27232__$1;
(statearr_27248_27264[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27254,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27254,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27249 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27249[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27249[(1)] = (1));

return statearr_27249;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27232){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27232);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27250){if((e27250 instanceof Object)){
var ex__25750__auto__ = e27250;
var statearr_27251_27265 = state_27232;
(statearr_27251_27265[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27266 = state_27232;
state_27232 = G__27266;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27232){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27232);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27254,out))
})();
var state__25843__auto__ = (function (){var statearr_27252 = f__25842__auto__.call(null);
(statearr_27252[(6)] = c__25841__auto___27254);

return statearr_27252;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27254,out))
);


return out;
});

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

/**
 * Returns a channel containing the single (collection) result of the
 *   items taken from the channel conjoined to the supplied
 *   collection. ch must close before into produces a result.
 */
cljs.core.async.into = (function cljs$core$async$into(coll,ch){
return cljs.core.async.reduce.call(null,cljs.core.conj,coll,ch);
});
/**
 * Returns a channel that will return, at most, n items from ch. After n items
 * have been returned, or ch has been closed, the return chanel will close.
 * 
 *   The output channel is unbuffered by default, unless buf-or-n is given.
 */
cljs.core.async.take = (function cljs$core$async$take(var_args){
var G__27268 = arguments.length;
switch (G__27268) {
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.call(null,n,ch,null);
});

cljs.core.async.take.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27313 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27313,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27313,out){
return (function (state_27292){
var state_val_27293 = (state_27292[(1)]);
if((state_val_27293 === (7))){
var inst_27274 = (state_27292[(7)]);
var inst_27274__$1 = (state_27292[(2)]);
var inst_27275 = (inst_27274__$1 == null);
var inst_27276 = cljs.core.not.call(null,inst_27275);
var state_27292__$1 = (function (){var statearr_27294 = state_27292;
(statearr_27294[(7)] = inst_27274__$1);

return statearr_27294;
})();
if(inst_27276){
var statearr_27295_27314 = state_27292__$1;
(statearr_27295_27314[(1)] = (8));

} else {
var statearr_27296_27315 = state_27292__$1;
(statearr_27296_27315[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (1))){
var inst_27269 = (0);
var state_27292__$1 = (function (){var statearr_27297 = state_27292;
(statearr_27297[(8)] = inst_27269);

return statearr_27297;
})();
var statearr_27298_27316 = state_27292__$1;
(statearr_27298_27316[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (4))){
var state_27292__$1 = state_27292;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27292__$1,(7),ch);
} else {
if((state_val_27293 === (6))){
var inst_27287 = (state_27292[(2)]);
var state_27292__$1 = state_27292;
var statearr_27299_27317 = state_27292__$1;
(statearr_27299_27317[(2)] = inst_27287);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (3))){
var inst_27289 = (state_27292[(2)]);
var inst_27290 = cljs.core.async.close_BANG_.call(null,out);
var state_27292__$1 = (function (){var statearr_27300 = state_27292;
(statearr_27300[(9)] = inst_27289);

return statearr_27300;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27292__$1,inst_27290);
} else {
if((state_val_27293 === (2))){
var inst_27269 = (state_27292[(8)]);
var inst_27271 = (inst_27269 < n);
var state_27292__$1 = state_27292;
if(cljs.core.truth_(inst_27271)){
var statearr_27301_27318 = state_27292__$1;
(statearr_27301_27318[(1)] = (4));

} else {
var statearr_27302_27319 = state_27292__$1;
(statearr_27302_27319[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (11))){
var inst_27269 = (state_27292[(8)]);
var inst_27279 = (state_27292[(2)]);
var inst_27280 = (inst_27269 + (1));
var inst_27269__$1 = inst_27280;
var state_27292__$1 = (function (){var statearr_27303 = state_27292;
(statearr_27303[(8)] = inst_27269__$1);

(statearr_27303[(10)] = inst_27279);

return statearr_27303;
})();
var statearr_27304_27320 = state_27292__$1;
(statearr_27304_27320[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (9))){
var state_27292__$1 = state_27292;
var statearr_27305_27321 = state_27292__$1;
(statearr_27305_27321[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (5))){
var state_27292__$1 = state_27292;
var statearr_27306_27322 = state_27292__$1;
(statearr_27306_27322[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (10))){
var inst_27284 = (state_27292[(2)]);
var state_27292__$1 = state_27292;
var statearr_27307_27323 = state_27292__$1;
(statearr_27307_27323[(2)] = inst_27284);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27293 === (8))){
var inst_27274 = (state_27292[(7)]);
var state_27292__$1 = state_27292;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27292__$1,(11),out,inst_27274);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27313,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27313,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27308 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_27308[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27308[(1)] = (1));

return statearr_27308;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27292){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27292);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27309){if((e27309 instanceof Object)){
var ex__25750__auto__ = e27309;
var statearr_27310_27324 = state_27292;
(statearr_27310_27324[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27325 = state_27292;
state_27292 = G__27325;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27292){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27292);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27313,out))
})();
var state__25843__auto__ = (function (){var statearr_27311 = f__25842__auto__.call(null);
(statearr_27311[(6)] = c__25841__auto___27313);

return statearr_27311;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27313,out))
);


return out;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_LT_ = (function cljs$core$async$map_LT_(f,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async27327 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async27327 = (function (f,ch,meta27328){
this.f = f;
this.ch = ch;
this.meta27328 = meta27328;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27329,meta27328__$1){
var self__ = this;
var _27329__$1 = this;
return (new cljs.core.async.t_cljs$core$async27327(self__.f,self__.ch,meta27328__$1));
});

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27329){
var self__ = this;
var _27329__$1 = this;
return self__.meta27328;
});

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

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,(function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async27330 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async27330 = (function (f,ch,meta27328,_,fn1,meta27331){
this.f = f;
this.ch = ch;
this.meta27328 = meta27328;
this._ = _;
this.fn1 = fn1;
this.meta27331 = meta27331;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async27330.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){
return (function (_27332,meta27331__$1){
var self__ = this;
var _27332__$1 = this;
return (new cljs.core.async.t_cljs$core$async27330(self__.f,self__.ch,self__.meta27328,self__._,self__.fn1,meta27331__$1));
});})(___$1))
;

cljs.core.async.t_cljs$core$async27330.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){
return (function (_27332){
var self__ = this;
var _27332__$1 = this;
return self__.meta27331;
});})(___$1))
;

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

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

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

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

cljs.core.async.t_cljs$core$async27330.getBasis = ((function (___$1){
return (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta27328","meta27328",1329277306,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$async27327","cljs.core.async/t_cljs$core$async27327",-1777487631,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta27331","meta27331",2055448167,null)], null);
});})(___$1))
;

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

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

cljs.core.async.t_cljs$core$async27330.cljs$lang$ctorPrWriter = ((function (___$1){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async27330");
});})(___$1))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async27330.
 */
cljs.core.async.__GT_t_cljs$core$async27330 = ((function (___$1){
return (function cljs$core$async$map_LT__$___GT_t_cljs$core$async27330(f__$1,ch__$1,meta27328__$1,___$2,fn1__$1,meta27331){
return (new cljs.core.async.t_cljs$core$async27330(f__$1,ch__$1,meta27328__$1,___$2,fn1__$1,meta27331));
});})(___$1))
;

}

return (new cljs.core.async.t_cljs$core$async27330(self__.f,self__.ch,self__.meta27328,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__4120__auto__ = ret;
if(cljs.core.truth_(and__4120__auto__)){
return (!((cljs.core.deref.call(null,ret) == null)));
} else {
return and__4120__auto__;
}
})())){
return cljs.core.async.impl.channels.box.call(null,self__.f.call(null,cljs.core.deref.call(null,ret)));
} else {
return ret;
}
});

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27327.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
});

cljs.core.async.t_cljs$core$async27327.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,"meta27328","meta27328",1329277306,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async27327.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async27327");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async27327.
 */
cljs.core.async.__GT_t_cljs$core$async27327 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async27327(f__$1,ch__$1,meta27328){
return (new cljs.core.async.t_cljs$core$async27327(f__$1,ch__$1,meta27328));
});

}

return (new cljs.core.async.t_cljs$core$async27327(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_GT_ = (function cljs$core$async$map_GT_(f,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async27333 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async27333 = (function (f,ch,meta27334){
this.f = f;
this.ch = ch;
this.meta27334 = meta27334;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27335,meta27334__$1){
var self__ = this;
var _27335__$1 = this;
return (new cljs.core.async.t_cljs$core$async27333(self__.f,self__.ch,meta27334__$1));
});

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27335){
var self__ = this;
var _27335__$1 = this;
return self__.meta27334;
});

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

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27333.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,self__.f.call(null,val),fn1);
});

cljs.core.async.t_cljs$core$async27333.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,"meta27334","meta27334",-1110188766,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async27333.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async27333");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async27333.
 */
cljs.core.async.__GT_t_cljs$core$async27333 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async27333(f__$1,ch__$1,meta27334){
return (new cljs.core.async.t_cljs$core$async27333(f__$1,ch__$1,meta27334));
});

}

return (new cljs.core.async.t_cljs$core$async27333(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_GT_ = (function cljs$core$async$filter_GT_(p,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async27336 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async27336 = (function (p,ch,meta27337){
this.p = p;
this.ch = ch;
this.meta27337 = meta27337;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27338,meta27337__$1){
var self__ = this;
var _27338__$1 = this;
return (new cljs.core.async.t_cljs$core$async27336(self__.p,self__.ch,meta27337__$1));
});

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27338){
var self__ = this;
var _27338__$1 = this;
return self__.meta27337;
});

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

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async27336.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.p.call(null,val))){
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box.call(null,cljs.core.not.call(null,cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch)));
}
});

cljs.core.async.t_cljs$core$async27336.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,"meta27337","meta27337",2134975110,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async27336.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async27336");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async27336.
 */
cljs.core.async.__GT_t_cljs$core$async27336 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async27336(p__$1,ch__$1,meta27337){
return (new cljs.core.async.t_cljs$core$async27336(p__$1,ch__$1,meta27337));
});

}

return (new cljs.core.async.t_cljs$core$async27336(p,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_GT_ = (function cljs$core$async$remove_GT_(p,ch){
return cljs.core.async.filter_GT_.call(null,cljs.core.complement.call(null,p),ch);
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_LT_ = (function cljs$core$async$filter_LT_(var_args){
var G__27340 = arguments.length;
switch (G__27340) {
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_.call(null,p,ch,null);
});

cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27380 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27380,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27380,out){
return (function (state_27361){
var state_val_27362 = (state_27361[(1)]);
if((state_val_27362 === (7))){
var inst_27357 = (state_27361[(2)]);
var state_27361__$1 = state_27361;
var statearr_27363_27381 = state_27361__$1;
(statearr_27363_27381[(2)] = inst_27357);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (1))){
var state_27361__$1 = state_27361;
var statearr_27364_27382 = state_27361__$1;
(statearr_27364_27382[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (4))){
var inst_27343 = (state_27361[(7)]);
var inst_27343__$1 = (state_27361[(2)]);
var inst_27344 = (inst_27343__$1 == null);
var state_27361__$1 = (function (){var statearr_27365 = state_27361;
(statearr_27365[(7)] = inst_27343__$1);

return statearr_27365;
})();
if(cljs.core.truth_(inst_27344)){
var statearr_27366_27383 = state_27361__$1;
(statearr_27366_27383[(1)] = (5));

} else {
var statearr_27367_27384 = state_27361__$1;
(statearr_27367_27384[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (6))){
var inst_27343 = (state_27361[(7)]);
var inst_27348 = p.call(null,inst_27343);
var state_27361__$1 = state_27361;
if(cljs.core.truth_(inst_27348)){
var statearr_27368_27385 = state_27361__$1;
(statearr_27368_27385[(1)] = (8));

} else {
var statearr_27369_27386 = state_27361__$1;
(statearr_27369_27386[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (3))){
var inst_27359 = (state_27361[(2)]);
var state_27361__$1 = state_27361;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27361__$1,inst_27359);
} else {
if((state_val_27362 === (2))){
var state_27361__$1 = state_27361;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27361__$1,(4),ch);
} else {
if((state_val_27362 === (11))){
var inst_27351 = (state_27361[(2)]);
var state_27361__$1 = state_27361;
var statearr_27370_27387 = state_27361__$1;
(statearr_27370_27387[(2)] = inst_27351);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (9))){
var state_27361__$1 = state_27361;
var statearr_27371_27388 = state_27361__$1;
(statearr_27371_27388[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (5))){
var inst_27346 = cljs.core.async.close_BANG_.call(null,out);
var state_27361__$1 = state_27361;
var statearr_27372_27389 = state_27361__$1;
(statearr_27372_27389[(2)] = inst_27346);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (10))){
var inst_27354 = (state_27361[(2)]);
var state_27361__$1 = (function (){var statearr_27373 = state_27361;
(statearr_27373[(8)] = inst_27354);

return statearr_27373;
})();
var statearr_27374_27390 = state_27361__$1;
(statearr_27374_27390[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27362 === (8))){
var inst_27343 = (state_27361[(7)]);
var state_27361__$1 = state_27361;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27361__$1,(11),out,inst_27343);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27380,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27380,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27375 = [null,null,null,null,null,null,null,null,null];
(statearr_27375[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27375[(1)] = (1));

return statearr_27375;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27361){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27361);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27376){if((e27376 instanceof Object)){
var ex__25750__auto__ = e27376;
var statearr_27377_27391 = state_27361;
(statearr_27377_27391[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27392 = state_27361;
state_27361 = G__27392;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27361){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27361);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27380,out))
})();
var state__25843__auto__ = (function (){var statearr_27378 = f__25842__auto__.call(null);
(statearr_27378[(6)] = c__25841__auto___27380);

return statearr_27378;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27380,out))
);


return out;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_LT_ = (function cljs$core$async$remove_LT_(var_args){
var G__27394 = arguments.length;
switch (G__27394) {
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_.call(null,p,ch,null);
});

cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
return cljs.core.async.filter_LT_.call(null,cljs.core.complement.call(null,p),ch,buf_or_n);
});

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

cljs.core.async.mapcat_STAR_ = (function cljs$core$async$mapcat_STAR_(f,in$,out){
var c__25841__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto__){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto__){
return (function (state_27457){
var state_val_27458 = (state_27457[(1)]);
if((state_val_27458 === (7))){
var inst_27453 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
var statearr_27459_27497 = state_27457__$1;
(statearr_27459_27497[(2)] = inst_27453);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (20))){
var inst_27423 = (state_27457[(7)]);
var inst_27434 = (state_27457[(2)]);
var inst_27435 = cljs.core.next.call(null,inst_27423);
var inst_27409 = inst_27435;
var inst_27410 = null;
var inst_27411 = (0);
var inst_27412 = (0);
var state_27457__$1 = (function (){var statearr_27460 = state_27457;
(statearr_27460[(8)] = inst_27411);

(statearr_27460[(9)] = inst_27410);

(statearr_27460[(10)] = inst_27434);

(statearr_27460[(11)] = inst_27409);

(statearr_27460[(12)] = inst_27412);

return statearr_27460;
})();
var statearr_27461_27498 = state_27457__$1;
(statearr_27461_27498[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (1))){
var state_27457__$1 = state_27457;
var statearr_27462_27499 = state_27457__$1;
(statearr_27462_27499[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (4))){
var inst_27398 = (state_27457[(13)]);
var inst_27398__$1 = (state_27457[(2)]);
var inst_27399 = (inst_27398__$1 == null);
var state_27457__$1 = (function (){var statearr_27463 = state_27457;
(statearr_27463[(13)] = inst_27398__$1);

return statearr_27463;
})();
if(cljs.core.truth_(inst_27399)){
var statearr_27464_27500 = state_27457__$1;
(statearr_27464_27500[(1)] = (5));

} else {
var statearr_27465_27501 = state_27457__$1;
(statearr_27465_27501[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (15))){
var state_27457__$1 = state_27457;
var statearr_27469_27502 = state_27457__$1;
(statearr_27469_27502[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (21))){
var state_27457__$1 = state_27457;
var statearr_27470_27503 = state_27457__$1;
(statearr_27470_27503[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (13))){
var inst_27411 = (state_27457[(8)]);
var inst_27410 = (state_27457[(9)]);
var inst_27409 = (state_27457[(11)]);
var inst_27412 = (state_27457[(12)]);
var inst_27419 = (state_27457[(2)]);
var inst_27420 = (inst_27412 + (1));
var tmp27466 = inst_27411;
var tmp27467 = inst_27410;
var tmp27468 = inst_27409;
var inst_27409__$1 = tmp27468;
var inst_27410__$1 = tmp27467;
var inst_27411__$1 = tmp27466;
var inst_27412__$1 = inst_27420;
var state_27457__$1 = (function (){var statearr_27471 = state_27457;
(statearr_27471[(8)] = inst_27411__$1);

(statearr_27471[(9)] = inst_27410__$1);

(statearr_27471[(11)] = inst_27409__$1);

(statearr_27471[(12)] = inst_27412__$1);

(statearr_27471[(14)] = inst_27419);

return statearr_27471;
})();
var statearr_27472_27504 = state_27457__$1;
(statearr_27472_27504[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (22))){
var state_27457__$1 = state_27457;
var statearr_27473_27505 = state_27457__$1;
(statearr_27473_27505[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (6))){
var inst_27398 = (state_27457[(13)]);
var inst_27407 = f.call(null,inst_27398);
var inst_27408 = cljs.core.seq.call(null,inst_27407);
var inst_27409 = inst_27408;
var inst_27410 = null;
var inst_27411 = (0);
var inst_27412 = (0);
var state_27457__$1 = (function (){var statearr_27474 = state_27457;
(statearr_27474[(8)] = inst_27411);

(statearr_27474[(9)] = inst_27410);

(statearr_27474[(11)] = inst_27409);

(statearr_27474[(12)] = inst_27412);

return statearr_27474;
})();
var statearr_27475_27506 = state_27457__$1;
(statearr_27475_27506[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (17))){
var inst_27423 = (state_27457[(7)]);
var inst_27427 = cljs.core.chunk_first.call(null,inst_27423);
var inst_27428 = cljs.core.chunk_rest.call(null,inst_27423);
var inst_27429 = cljs.core.count.call(null,inst_27427);
var inst_27409 = inst_27428;
var inst_27410 = inst_27427;
var inst_27411 = inst_27429;
var inst_27412 = (0);
var state_27457__$1 = (function (){var statearr_27476 = state_27457;
(statearr_27476[(8)] = inst_27411);

(statearr_27476[(9)] = inst_27410);

(statearr_27476[(11)] = inst_27409);

(statearr_27476[(12)] = inst_27412);

return statearr_27476;
})();
var statearr_27477_27507 = state_27457__$1;
(statearr_27477_27507[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (3))){
var inst_27455 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27457__$1,inst_27455);
} else {
if((state_val_27458 === (12))){
var inst_27443 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
var statearr_27478_27508 = state_27457__$1;
(statearr_27478_27508[(2)] = inst_27443);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (2))){
var state_27457__$1 = state_27457;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27457__$1,(4),in$);
} else {
if((state_val_27458 === (23))){
var inst_27451 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
var statearr_27479_27509 = state_27457__$1;
(statearr_27479_27509[(2)] = inst_27451);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (19))){
var inst_27438 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
var statearr_27480_27510 = state_27457__$1;
(statearr_27480_27510[(2)] = inst_27438);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (11))){
var inst_27423 = (state_27457[(7)]);
var inst_27409 = (state_27457[(11)]);
var inst_27423__$1 = cljs.core.seq.call(null,inst_27409);
var state_27457__$1 = (function (){var statearr_27481 = state_27457;
(statearr_27481[(7)] = inst_27423__$1);

return statearr_27481;
})();
if(inst_27423__$1){
var statearr_27482_27511 = state_27457__$1;
(statearr_27482_27511[(1)] = (14));

} else {
var statearr_27483_27512 = state_27457__$1;
(statearr_27483_27512[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (9))){
var inst_27445 = (state_27457[(2)]);
var inst_27446 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out);
var state_27457__$1 = (function (){var statearr_27484 = state_27457;
(statearr_27484[(15)] = inst_27445);

return statearr_27484;
})();
if(cljs.core.truth_(inst_27446)){
var statearr_27485_27513 = state_27457__$1;
(statearr_27485_27513[(1)] = (21));

} else {
var statearr_27486_27514 = state_27457__$1;
(statearr_27486_27514[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (5))){
var inst_27401 = cljs.core.async.close_BANG_.call(null,out);
var state_27457__$1 = state_27457;
var statearr_27487_27515 = state_27457__$1;
(statearr_27487_27515[(2)] = inst_27401);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (14))){
var inst_27423 = (state_27457[(7)]);
var inst_27425 = cljs.core.chunked_seq_QMARK_.call(null,inst_27423);
var state_27457__$1 = state_27457;
if(inst_27425){
var statearr_27488_27516 = state_27457__$1;
(statearr_27488_27516[(1)] = (17));

} else {
var statearr_27489_27517 = state_27457__$1;
(statearr_27489_27517[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (16))){
var inst_27441 = (state_27457[(2)]);
var state_27457__$1 = state_27457;
var statearr_27490_27518 = state_27457__$1;
(statearr_27490_27518[(2)] = inst_27441);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27458 === (10))){
var inst_27410 = (state_27457[(9)]);
var inst_27412 = (state_27457[(12)]);
var inst_27417 = cljs.core._nth.call(null,inst_27410,inst_27412);
var state_27457__$1 = state_27457;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27457__$1,(13),out,inst_27417);
} else {
if((state_val_27458 === (18))){
var inst_27423 = (state_27457[(7)]);
var inst_27432 = cljs.core.first.call(null,inst_27423);
var state_27457__$1 = state_27457;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27457__$1,(20),out,inst_27432);
} else {
if((state_val_27458 === (8))){
var inst_27411 = (state_27457[(8)]);
var inst_27412 = (state_27457[(12)]);
var inst_27414 = (inst_27412 < inst_27411);
var inst_27415 = inst_27414;
var state_27457__$1 = state_27457;
if(cljs.core.truth_(inst_27415)){
var statearr_27491_27519 = state_27457__$1;
(statearr_27491_27519[(1)] = (10));

} else {
var statearr_27492_27520 = state_27457__$1;
(statearr_27492_27520[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto__))
;
return ((function (switch__25746__auto__,c__25841__auto__){
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____0 = (function (){
var statearr_27493 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27493[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__);

(statearr_27493[(1)] = (1));

return statearr_27493;
});
var cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____1 = (function (state_27457){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27457);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27494){if((e27494 instanceof Object)){
var ex__25750__auto__ = e27494;
var statearr_27495_27521 = state_27457;
(statearr_27495_27521[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27522 = state_27457;
state_27457 = G__27522;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__ = function(state_27457){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____1.call(this,state_27457);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__25747__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto__))
})();
var state__25843__auto__ = (function (){var statearr_27496 = f__25842__auto__.call(null);
(statearr_27496[(6)] = c__25841__auto__);

return statearr_27496;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto__))
);

return c__25841__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__27524 = arguments.length;
switch (G__27524) {
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_.call(null,f,in$,null);
});

cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3 = (function (f,in$,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return out;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_GT_ = (function cljs$core$async$mapcat_GT_(var_args){
var G__27527 = arguments.length;
switch (G__27527) {
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_.call(null,f,out,null);
});

cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3 = (function (f,out,buf_or_n){
var in$ = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return in$;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.unique = (function cljs$core$async$unique(var_args){
var G__27530 = arguments.length;
switch (G__27530) {
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.call(null,ch,null);
});

cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27577 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27577,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27577,out){
return (function (state_27554){
var state_val_27555 = (state_27554[(1)]);
if((state_val_27555 === (7))){
var inst_27549 = (state_27554[(2)]);
var state_27554__$1 = state_27554;
var statearr_27556_27578 = state_27554__$1;
(statearr_27556_27578[(2)] = inst_27549);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (1))){
var inst_27531 = null;
var state_27554__$1 = (function (){var statearr_27557 = state_27554;
(statearr_27557[(7)] = inst_27531);

return statearr_27557;
})();
var statearr_27558_27579 = state_27554__$1;
(statearr_27558_27579[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (4))){
var inst_27534 = (state_27554[(8)]);
var inst_27534__$1 = (state_27554[(2)]);
var inst_27535 = (inst_27534__$1 == null);
var inst_27536 = cljs.core.not.call(null,inst_27535);
var state_27554__$1 = (function (){var statearr_27559 = state_27554;
(statearr_27559[(8)] = inst_27534__$1);

return statearr_27559;
})();
if(inst_27536){
var statearr_27560_27580 = state_27554__$1;
(statearr_27560_27580[(1)] = (5));

} else {
var statearr_27561_27581 = state_27554__$1;
(statearr_27561_27581[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (6))){
var state_27554__$1 = state_27554;
var statearr_27562_27582 = state_27554__$1;
(statearr_27562_27582[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (3))){
var inst_27551 = (state_27554[(2)]);
var inst_27552 = cljs.core.async.close_BANG_.call(null,out);
var state_27554__$1 = (function (){var statearr_27563 = state_27554;
(statearr_27563[(9)] = inst_27551);

return statearr_27563;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27554__$1,inst_27552);
} else {
if((state_val_27555 === (2))){
var state_27554__$1 = state_27554;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27554__$1,(4),ch);
} else {
if((state_val_27555 === (11))){
var inst_27534 = (state_27554[(8)]);
var inst_27543 = (state_27554[(2)]);
var inst_27531 = inst_27534;
var state_27554__$1 = (function (){var statearr_27564 = state_27554;
(statearr_27564[(10)] = inst_27543);

(statearr_27564[(7)] = inst_27531);

return statearr_27564;
})();
var statearr_27565_27583 = state_27554__$1;
(statearr_27565_27583[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (9))){
var inst_27534 = (state_27554[(8)]);
var state_27554__$1 = state_27554;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27554__$1,(11),out,inst_27534);
} else {
if((state_val_27555 === (5))){
var inst_27531 = (state_27554[(7)]);
var inst_27534 = (state_27554[(8)]);
var inst_27538 = cljs.core._EQ_.call(null,inst_27534,inst_27531);
var state_27554__$1 = state_27554;
if(inst_27538){
var statearr_27567_27584 = state_27554__$1;
(statearr_27567_27584[(1)] = (8));

} else {
var statearr_27568_27585 = state_27554__$1;
(statearr_27568_27585[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (10))){
var inst_27546 = (state_27554[(2)]);
var state_27554__$1 = state_27554;
var statearr_27569_27586 = state_27554__$1;
(statearr_27569_27586[(2)] = inst_27546);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27555 === (8))){
var inst_27531 = (state_27554[(7)]);
var tmp27566 = inst_27531;
var inst_27531__$1 = tmp27566;
var state_27554__$1 = (function (){var statearr_27570 = state_27554;
(statearr_27570[(7)] = inst_27531__$1);

return statearr_27570;
})();
var statearr_27571_27587 = state_27554__$1;
(statearr_27571_27587[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27577,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27577,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27572 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_27572[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27572[(1)] = (1));

return statearr_27572;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27554){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27554);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27573){if((e27573 instanceof Object)){
var ex__25750__auto__ = e27573;
var statearr_27574_27588 = state_27554;
(statearr_27574_27588[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27589 = state_27554;
state_27554 = G__27589;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27554){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27554);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27577,out))
})();
var state__25843__auto__ = (function (){var statearr_27575 = f__25842__auto__.call(null);
(statearr_27575[(6)] = c__25841__auto___27577);

return statearr_27575;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27577,out))
);


return out;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition = (function cljs$core$async$partition(var_args){
var G__27591 = arguments.length;
switch (G__27591) {
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.call(null,n,ch,null);
});

cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27657 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27657,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27657,out){
return (function (state_27629){
var state_val_27630 = (state_27629[(1)]);
if((state_val_27630 === (7))){
var inst_27625 = (state_27629[(2)]);
var state_27629__$1 = state_27629;
var statearr_27631_27658 = state_27629__$1;
(statearr_27631_27658[(2)] = inst_27625);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (1))){
var inst_27592 = (new Array(n));
var inst_27593 = inst_27592;
var inst_27594 = (0);
var state_27629__$1 = (function (){var statearr_27632 = state_27629;
(statearr_27632[(7)] = inst_27593);

(statearr_27632[(8)] = inst_27594);

return statearr_27632;
})();
var statearr_27633_27659 = state_27629__$1;
(statearr_27633_27659[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (4))){
var inst_27597 = (state_27629[(9)]);
var inst_27597__$1 = (state_27629[(2)]);
var inst_27598 = (inst_27597__$1 == null);
var inst_27599 = cljs.core.not.call(null,inst_27598);
var state_27629__$1 = (function (){var statearr_27634 = state_27629;
(statearr_27634[(9)] = inst_27597__$1);

return statearr_27634;
})();
if(inst_27599){
var statearr_27635_27660 = state_27629__$1;
(statearr_27635_27660[(1)] = (5));

} else {
var statearr_27636_27661 = state_27629__$1;
(statearr_27636_27661[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (15))){
var inst_27619 = (state_27629[(2)]);
var state_27629__$1 = state_27629;
var statearr_27637_27662 = state_27629__$1;
(statearr_27637_27662[(2)] = inst_27619);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (13))){
var state_27629__$1 = state_27629;
var statearr_27638_27663 = state_27629__$1;
(statearr_27638_27663[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (6))){
var inst_27594 = (state_27629[(8)]);
var inst_27615 = (inst_27594 > (0));
var state_27629__$1 = state_27629;
if(cljs.core.truth_(inst_27615)){
var statearr_27639_27664 = state_27629__$1;
(statearr_27639_27664[(1)] = (12));

} else {
var statearr_27640_27665 = state_27629__$1;
(statearr_27640_27665[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (3))){
var inst_27627 = (state_27629[(2)]);
var state_27629__$1 = state_27629;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27629__$1,inst_27627);
} else {
if((state_val_27630 === (12))){
var inst_27593 = (state_27629[(7)]);
var inst_27617 = cljs.core.vec.call(null,inst_27593);
var state_27629__$1 = state_27629;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27629__$1,(15),out,inst_27617);
} else {
if((state_val_27630 === (2))){
var state_27629__$1 = state_27629;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27629__$1,(4),ch);
} else {
if((state_val_27630 === (11))){
var inst_27609 = (state_27629[(2)]);
var inst_27610 = (new Array(n));
var inst_27593 = inst_27610;
var inst_27594 = (0);
var state_27629__$1 = (function (){var statearr_27641 = state_27629;
(statearr_27641[(10)] = inst_27609);

(statearr_27641[(7)] = inst_27593);

(statearr_27641[(8)] = inst_27594);

return statearr_27641;
})();
var statearr_27642_27666 = state_27629__$1;
(statearr_27642_27666[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (9))){
var inst_27593 = (state_27629[(7)]);
var inst_27607 = cljs.core.vec.call(null,inst_27593);
var state_27629__$1 = state_27629;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27629__$1,(11),out,inst_27607);
} else {
if((state_val_27630 === (5))){
var inst_27593 = (state_27629[(7)]);
var inst_27602 = (state_27629[(11)]);
var inst_27597 = (state_27629[(9)]);
var inst_27594 = (state_27629[(8)]);
var inst_27601 = (inst_27593[inst_27594] = inst_27597);
var inst_27602__$1 = (inst_27594 + (1));
var inst_27603 = (inst_27602__$1 < n);
var state_27629__$1 = (function (){var statearr_27643 = state_27629;
(statearr_27643[(12)] = inst_27601);

(statearr_27643[(11)] = inst_27602__$1);

return statearr_27643;
})();
if(cljs.core.truth_(inst_27603)){
var statearr_27644_27667 = state_27629__$1;
(statearr_27644_27667[(1)] = (8));

} else {
var statearr_27645_27668 = state_27629__$1;
(statearr_27645_27668[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (14))){
var inst_27622 = (state_27629[(2)]);
var inst_27623 = cljs.core.async.close_BANG_.call(null,out);
var state_27629__$1 = (function (){var statearr_27647 = state_27629;
(statearr_27647[(13)] = inst_27622);

return statearr_27647;
})();
var statearr_27648_27669 = state_27629__$1;
(statearr_27648_27669[(2)] = inst_27623);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (10))){
var inst_27613 = (state_27629[(2)]);
var state_27629__$1 = state_27629;
var statearr_27649_27670 = state_27629__$1;
(statearr_27649_27670[(2)] = inst_27613);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27630 === (8))){
var inst_27593 = (state_27629[(7)]);
var inst_27602 = (state_27629[(11)]);
var tmp27646 = inst_27593;
var inst_27593__$1 = tmp27646;
var inst_27594 = inst_27602;
var state_27629__$1 = (function (){var statearr_27650 = state_27629;
(statearr_27650[(7)] = inst_27593__$1);

(statearr_27650[(8)] = inst_27594);

return statearr_27650;
})();
var statearr_27651_27671 = state_27629__$1;
(statearr_27651_27671[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27657,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27657,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27652 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27652[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27652[(1)] = (1));

return statearr_27652;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27629){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27629);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27653){if((e27653 instanceof Object)){
var ex__25750__auto__ = e27653;
var statearr_27654_27672 = state_27629;
(statearr_27654_27672[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27673 = state_27629;
state_27629 = G__27673;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27629){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27629);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27657,out))
})();
var state__25843__auto__ = (function (){var statearr_27655 = f__25842__auto__.call(null);
(statearr_27655[(6)] = c__25841__auto___27657);

return statearr_27655;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27657,out))
);


return out;
});

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition_by = (function cljs$core$async$partition_by(var_args){
var G__27675 = arguments.length;
switch (G__27675) {
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.call(null,f,ch,null);
});

cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3 = (function (f,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__25841__auto___27745 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__25841__auto___27745,out){
return (function (){
var f__25842__auto__ = (function (){var switch__25746__auto__ = ((function (c__25841__auto___27745,out){
return (function (state_27717){
var state_val_27718 = (state_27717[(1)]);
if((state_val_27718 === (7))){
var inst_27713 = (state_27717[(2)]);
var state_27717__$1 = state_27717;
var statearr_27719_27746 = state_27717__$1;
(statearr_27719_27746[(2)] = inst_27713);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (1))){
var inst_27676 = [];
var inst_27677 = inst_27676;
var inst_27678 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_27717__$1 = (function (){var statearr_27720 = state_27717;
(statearr_27720[(7)] = inst_27677);

(statearr_27720[(8)] = inst_27678);

return statearr_27720;
})();
var statearr_27721_27747 = state_27717__$1;
(statearr_27721_27747[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (4))){
var inst_27681 = (state_27717[(9)]);
var inst_27681__$1 = (state_27717[(2)]);
var inst_27682 = (inst_27681__$1 == null);
var inst_27683 = cljs.core.not.call(null,inst_27682);
var state_27717__$1 = (function (){var statearr_27722 = state_27717;
(statearr_27722[(9)] = inst_27681__$1);

return statearr_27722;
})();
if(inst_27683){
var statearr_27723_27748 = state_27717__$1;
(statearr_27723_27748[(1)] = (5));

} else {
var statearr_27724_27749 = state_27717__$1;
(statearr_27724_27749[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (15))){
var inst_27707 = (state_27717[(2)]);
var state_27717__$1 = state_27717;
var statearr_27725_27750 = state_27717__$1;
(statearr_27725_27750[(2)] = inst_27707);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (13))){
var state_27717__$1 = state_27717;
var statearr_27726_27751 = state_27717__$1;
(statearr_27726_27751[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (6))){
var inst_27677 = (state_27717[(7)]);
var inst_27702 = inst_27677.length;
var inst_27703 = (inst_27702 > (0));
var state_27717__$1 = state_27717;
if(cljs.core.truth_(inst_27703)){
var statearr_27727_27752 = state_27717__$1;
(statearr_27727_27752[(1)] = (12));

} else {
var statearr_27728_27753 = state_27717__$1;
(statearr_27728_27753[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (3))){
var inst_27715 = (state_27717[(2)]);
var state_27717__$1 = state_27717;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_27717__$1,inst_27715);
} else {
if((state_val_27718 === (12))){
var inst_27677 = (state_27717[(7)]);
var inst_27705 = cljs.core.vec.call(null,inst_27677);
var state_27717__$1 = state_27717;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27717__$1,(15),out,inst_27705);
} else {
if((state_val_27718 === (2))){
var state_27717__$1 = state_27717;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_27717__$1,(4),ch);
} else {
if((state_val_27718 === (11))){
var inst_27681 = (state_27717[(9)]);
var inst_27685 = (state_27717[(10)]);
var inst_27695 = (state_27717[(2)]);
var inst_27696 = [];
var inst_27697 = inst_27696.push(inst_27681);
var inst_27677 = inst_27696;
var inst_27678 = inst_27685;
var state_27717__$1 = (function (){var statearr_27729 = state_27717;
(statearr_27729[(7)] = inst_27677);

(statearr_27729[(8)] = inst_27678);

(statearr_27729[(11)] = inst_27697);

(statearr_27729[(12)] = inst_27695);

return statearr_27729;
})();
var statearr_27730_27754 = state_27717__$1;
(statearr_27730_27754[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (9))){
var inst_27677 = (state_27717[(7)]);
var inst_27693 = cljs.core.vec.call(null,inst_27677);
var state_27717__$1 = state_27717;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_27717__$1,(11),out,inst_27693);
} else {
if((state_val_27718 === (5))){
var inst_27681 = (state_27717[(9)]);
var inst_27678 = (state_27717[(8)]);
var inst_27685 = (state_27717[(10)]);
var inst_27685__$1 = f.call(null,inst_27681);
var inst_27686 = cljs.core._EQ_.call(null,inst_27685__$1,inst_27678);
var inst_27687 = cljs.core.keyword_identical_QMARK_.call(null,inst_27678,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var inst_27688 = ((inst_27686) || (inst_27687));
var state_27717__$1 = (function (){var statearr_27731 = state_27717;
(statearr_27731[(10)] = inst_27685__$1);

return statearr_27731;
})();
if(cljs.core.truth_(inst_27688)){
var statearr_27732_27755 = state_27717__$1;
(statearr_27732_27755[(1)] = (8));

} else {
var statearr_27733_27756 = state_27717__$1;
(statearr_27733_27756[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (14))){
var inst_27710 = (state_27717[(2)]);
var inst_27711 = cljs.core.async.close_BANG_.call(null,out);
var state_27717__$1 = (function (){var statearr_27735 = state_27717;
(statearr_27735[(13)] = inst_27710);

return statearr_27735;
})();
var statearr_27736_27757 = state_27717__$1;
(statearr_27736_27757[(2)] = inst_27711);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (10))){
var inst_27700 = (state_27717[(2)]);
var state_27717__$1 = state_27717;
var statearr_27737_27758 = state_27717__$1;
(statearr_27737_27758[(2)] = inst_27700);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_27718 === (8))){
var inst_27681 = (state_27717[(9)]);
var inst_27677 = (state_27717[(7)]);
var inst_27685 = (state_27717[(10)]);
var inst_27690 = inst_27677.push(inst_27681);
var tmp27734 = inst_27677;
var inst_27677__$1 = tmp27734;
var inst_27678 = inst_27685;
var state_27717__$1 = (function (){var statearr_27738 = state_27717;
(statearr_27738[(14)] = inst_27690);

(statearr_27738[(7)] = inst_27677__$1);

(statearr_27738[(8)] = inst_27678);

return statearr_27738;
})();
var statearr_27739_27759 = state_27717__$1;
(statearr_27739_27759[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__25841__auto___27745,out))
;
return ((function (switch__25746__auto__,c__25841__auto___27745,out){
return (function() {
var cljs$core$async$state_machine__25747__auto__ = null;
var cljs$core$async$state_machine__25747__auto____0 = (function (){
var statearr_27740 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_27740[(0)] = cljs$core$async$state_machine__25747__auto__);

(statearr_27740[(1)] = (1));

return statearr_27740;
});
var cljs$core$async$state_machine__25747__auto____1 = (function (state_27717){
while(true){
var ret_value__25748__auto__ = (function (){try{while(true){
var result__25749__auto__ = switch__25746__auto__.call(null,state_27717);
if(cljs.core.keyword_identical_QMARK_.call(null,result__25749__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__25749__auto__;
}
break;
}
}catch (e27741){if((e27741 instanceof Object)){
var ex__25750__auto__ = e27741;
var statearr_27742_27760 = state_27717;
(statearr_27742_27760[(5)] = ex__25750__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__25748__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27761 = state_27717;
state_27717 = G__27761;
continue;
} else {
return ret_value__25748__auto__;
}
break;
}
});
cljs$core$async$state_machine__25747__auto__ = function(state_27717){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__25747__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__25747__auto____1.call(this,state_27717);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__25747__auto____0;
cljs$core$async$state_machine__25747__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__25747__auto____1;
return cljs$core$async$state_machine__25747__auto__;
})()
;})(switch__25746__auto__,c__25841__auto___27745,out))
})();
var state__25843__auto__ = (function (){var statearr_27743 = f__25842__auto__.call(null);
(statearr_27743[(6)] = c__25841__auto___27745);

return statearr_27743;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__25843__auto__);
});})(c__25841__auto___27745,out))
);


return out;
});

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

