// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async');
goog.require('cljs.core');
goog.require('cljs.core.constants');
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(f){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async8923 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async8923 = (function (f,meta8924){
this.f = f;
this.meta8924 = meta8924;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async8923.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_8925,meta8924__$1){
var self__ = this;
var _8925__$1 = this;
return (new cljs.core.async.t_cljs$core$async8923(self__.f,meta8924__$1));
}));

(cljs.core.async.t_cljs$core$async8923.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_8925){
var self__ = this;
var _8925__$1 = this;
return self__.meta8924;
}));

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

(cljs.core.async.t_cljs$core$async8923.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$async8923.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$async8923.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.cst$sym$meta8924], null);
}));

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

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

(cljs.core.async.t_cljs$core$async8923.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async8923");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async8923.
 */
cljs.core.async.__GT_t_cljs$core$async8923 = (function cljs$core$async$fn_handler_$___GT_t_cljs$core$async8923(f__$1,meta8924){
return (new cljs.core.async.t_cljs$core$async8923(f__$1,meta8924));
});

}

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

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

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

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

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

}
});

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

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

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

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

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

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

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

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

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

}
});

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

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

return null;
}));

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

cljs.core.async.nop = (function cljs$core$async$nop(_){
return null;
});
cljs.core.async.fhnop = cljs.core.async.fn_handler(cljs.core.async.nop);
/**
 * puts a val into port. nil values are not allowed. Must be called
 *   inside a (go ...) block. Will park if no buffer space is available.
 *   Returns true unless port is already closed.
 */
cljs.core.async._GT__BANG_ = (function cljs$core$async$_GT__BANG_(port,val){
throw (new Error(">! used not in (go ...) block"));
});
/**
 * Asynchronously puts a val into port, calling fn0 (if supplied) when
 * complete. nil values are not allowed. Will throw if closed. If
 * on-caller? (default true) is true, and the put is immediately
 * accepted, will call fn0 on calling thread.  Returns nil.
 */
cljs.core.async.put_BANG_ = (function cljs$core$async$put_BANG_(var_args){
var G__8935 = arguments.length;
switch (G__8935) {
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__4655__auto__ = cljs.core.async.impl.protocols.put_BANG_(port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__4655__auto__)){
var ret = temp__4655__auto__;
return cljs.core.deref(ret);
} else {
return true;
}
}));

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

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

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

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

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

var G__8939 = (x_8938 + (1));
x_8938 = G__8939;
continue;
} else {
}
break;
}

var i = (1);
while(true){
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(i,n)){
return a;
} else {
var j = cljs.core.rand_int(i);
(a[i] = (a[j]));

(a[j] = i);

var G__8940 = (i + (1));
i = G__8940;
continue;
}
break;
}
});
cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(true);
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async8941 !== 'undefined')){
} else {

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

(cljs.core.async.t_cljs$core$async8941.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_8943){
var self__ = this;
var _8943__$1 = this;
return self__.meta8942;
}));

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

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

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

return true;
}));

(cljs.core.async.t_cljs$core$async8941.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$flag,cljs.core.cst$sym$meta8942], null);
}));

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

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

(cljs.core.async.t_cljs$core$async8941.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async8941");
}));

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

}

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

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

(cljs.core.async.t_cljs$core$async8944.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_8946){
var self__ = this;
var _8946__$1 = this;
return self__.meta8945;
}));

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

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

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

return self__.cb;
}));

(cljs.core.async.t_cljs$core$async8944.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$flag,cljs.core.cst$sym$cb,cljs.core.cst$sym$meta8945], null);
}));

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

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

(cljs.core.async.t_cljs$core$async8944.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async8944");
}));

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

}

return (new cljs.core.async.t_cljs$core$async8944(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();
var n = cljs.core.count(ports);
var idxs = cljs.core.async.random_array(n);
var priority = cljs.core.cst$kw$priority.cljs$core$IFn$_invoke$arity$1(opts);
var ret = (function (){var i = (0);
while(true){
if((i < n)){
var idx = (cljs.core.truth_(priority)?i:(idxs[i]));
var port = cljs.core.nth.cljs$core$IFn$_invoke$arity$2(ports,idx);
var wport = ((cljs.core.vector_QMARK_(port))?(port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((0)) : port.call(null,(0))):null);
var vbox = (cljs.core.truth_(wport)?(function (){var val = (port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((1)) : port.call(null,(1)));
return cljs.core.async.impl.protocols.put_BANG_(wport,val,cljs.core.async.alt_handler(flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){
return (function (p1__8947_SHARP_){
var G__8949 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__8947_SHARP_,wport], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__8949) : fret.call(null,G__8949));
});})(i,val,idx,port,wport,flag,n,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_(port,cljs.core.async.alt_handler(flag,((function (i,idx,port,wport,flag,n,idxs,priority){
return (function (p1__8948_SHARP_){
var G__8950 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__8948_SHARP_,port], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__8950) : fret.call(null,G__8950));
});})(i,idx,port,wport,flag,n,idxs,priority))
)));
if(cljs.core.truth_(vbox)){
return cljs.core.async.impl.channels.box(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref(vbox),(function (){var or__5045__auto__ = wport;
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
return port;
}
})()], null));
} else {
var G__8951 = (i + (1));
i = G__8951;
continue;
}
} else {
return null;
}
break;
}
})();
var or__5045__auto__ = ret;
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
if(cljs.core.contains_QMARK_(opts,cljs.core.cst$kw$default)){
var temp__4657__auto__ = (function (){var and__5043__auto__ = flag.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(cljs.core.truth_(and__5043__auto__)){
return flag.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5043__auto__;
}
})();
if(cljs.core.truth_(temp__4657__auto__)){
var got = temp__4657__auto__;
return cljs.core.async.impl.channels.box(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$kw$default.cljs$core$IFn$_invoke$arity$1(opts),cljs.core.cst$kw$default], 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__5775__auto__ = [];
var len__5769__auto___8956 = arguments.length;
var i__5770__auto___8957 = (0);
while(true){
if((i__5770__auto___8957 < len__5769__auto___8956)){
args__5775__auto__.push((arguments[i__5770__auto___8957]));

var G__8958 = (i__5770__auto___8957 + (1));
i__5770__auto___8957 = G__8958;
continue;
} else {
}
break;
}

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

(cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__8954){
var map__8955 = p__8954;
var map__8955__$1 = cljs.core.__destructure_map(map__8955);
var opts = map__8955__$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 (seq8952){
var G__8953 = cljs.core.first(seq8952);
var seq8952__$1 = cljs.core.next(seq8952);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__8953,seq8952__$1);
}));

/**
 * 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__8960 = arguments.length;
switch (G__8960) {
case 2:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__8878__auto___9006 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_8984){
var state_val_8985 = (state_8984[(1)]);
if((state_val_8985 === (7))){
var inst_8980 = (state_8984[(2)]);
var state_8984__$1 = state_8984;
var statearr_8986_9007 = state_8984__$1;
(statearr_8986_9007[(2)] = inst_8980);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (1))){
var state_8984__$1 = state_8984;
var statearr_8987_9008 = state_8984__$1;
(statearr_8987_9008[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (4))){
var inst_8963 = (state_8984[(7)]);
var inst_8963__$1 = (state_8984[(2)]);
var inst_8964 = (inst_8963__$1 == null);
var state_8984__$1 = (function (){var statearr_8988 = state_8984;
(statearr_8988[(7)] = inst_8963__$1);

return statearr_8988;
})();
if(cljs.core.truth_(inst_8964)){
var statearr_8989_9009 = state_8984__$1;
(statearr_8989_9009[(1)] = (5));

} else {
var statearr_8990_9010 = state_8984__$1;
(statearr_8990_9010[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (13))){
var state_8984__$1 = state_8984;
var statearr_8991_9011 = state_8984__$1;
(statearr_8991_9011[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (6))){
var inst_8963 = (state_8984[(7)]);
var state_8984__$1 = state_8984;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_8984__$1,(11),to,inst_8963);
} else {
if((state_val_8985 === (3))){
var inst_8982 = (state_8984[(2)]);
var state_8984__$1 = state_8984;
return cljs.core.async.impl.ioc_helpers.return_chan(state_8984__$1,inst_8982);
} else {
if((state_val_8985 === (12))){
var state_8984__$1 = state_8984;
var statearr_8992_9012 = state_8984__$1;
(statearr_8992_9012[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (2))){
var state_8984__$1 = state_8984;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_8984__$1,(4),from);
} else {
if((state_val_8985 === (11))){
var inst_8973 = (state_8984[(2)]);
var state_8984__$1 = state_8984;
if(cljs.core.truth_(inst_8973)){
var statearr_8993_9013 = state_8984__$1;
(statearr_8993_9013[(1)] = (12));

} else {
var statearr_8994_9014 = state_8984__$1;
(statearr_8994_9014[(1)] = (13));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (9))){
var state_8984__$1 = state_8984;
var statearr_8995_9015 = state_8984__$1;
(statearr_8995_9015[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (5))){
var state_8984__$1 = state_8984;
if(cljs.core.truth_(close_QMARK_)){
var statearr_8996_9016 = state_8984__$1;
(statearr_8996_9016[(1)] = (8));

} else {
var statearr_8997_9017 = state_8984__$1;
(statearr_8997_9017[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (14))){
var inst_8978 = (state_8984[(2)]);
var state_8984__$1 = state_8984;
var statearr_8998_9018 = state_8984__$1;
(statearr_8998_9018[(2)] = inst_8978);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (10))){
var inst_8970 = (state_8984[(2)]);
var state_8984__$1 = state_8984;
var statearr_8999_9019 = state_8984__$1;
(statearr_8999_9019[(2)] = inst_8970);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_8985 === (8))){
var inst_8967 = cljs.core.async.close_BANG_(to);
var state_8984__$1 = state_8984;
var statearr_9000_9020 = state_8984__$1;
(statearr_9000_9020[(2)] = inst_8967);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_9001 = [null,null,null,null,null,null,null,null];
(statearr_9001[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_9001[(1)] = (1));

return statearr_9001;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_8984){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_8984);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9002){if((e9002 instanceof Object)){
var ex__8775__auto__ = e9002;
var statearr_9003_9021 = state_8984;
(statearr_9003_9021[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_8984);

return cljs.core.cst$kw$recur;
} else {
throw e9002;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9022 = state_8984;
state_8984 = G__9022;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_8984){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_8984);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9004 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9004[(6)] = c__8878__auto___9006);

return statearr_9004;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return to;
}));

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

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

var jobs = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(n);
var results = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(n);
var process__$1 = (function (p__9023){
var vec__9024 = p__9023;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__9024,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__9024,(1),null);
var job = vec__9024;
if((job == null)){
cljs.core.async.close_BANG_(results);

return null;
} else {
var res = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3((1),xf,ex_handler);
var c__8878__auto___9195 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9031){
var state_val_9032 = (state_9031[(1)]);
if((state_val_9032 === (1))){
var state_9031__$1 = state_9031;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9031__$1,(2),res,v);
} else {
if((state_val_9032 === (2))){
var inst_9028 = (state_9031[(2)]);
var inst_9029 = cljs.core.async.close_BANG_(res);
var state_9031__$1 = (function (){var statearr_9033 = state_9031;
(statearr_9033[(7)] = inst_9028);

return statearr_9033;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_9031__$1,inst_9029);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_9034 = [null,null,null,null,null,null,null,null];
(statearr_9034[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__);

(statearr_9034[(1)] = (1));

return statearr_9034;
});
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1 = (function (state_9031){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9031);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9035){if((e9035 instanceof Object)){
var ex__8775__auto__ = e9035;
var statearr_9036_9196 = state_9031;
(statearr_9036_9196[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9031);

return cljs.core.cst$kw$recur;
} else {
throw e9035;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9197 = state_9031;
state_9031 = G__9197;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = function(state_9031){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1.call(this,state_9031);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9037 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9037[(6)] = c__8878__auto___9195);

return statearr_9037;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


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

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

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

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

return true;
}
});
var n__5636__auto___9198 = n;
var __9199 = (0);
while(true){
if((__9199 < n__5636__auto___9198)){
var G__9042_9200 = type;
var G__9042_9201__$1 = (((G__9042_9200 instanceof cljs.core.Keyword))?G__9042_9200.fqn:null);
switch (G__9042_9201__$1) {
case "compute":
var c__8878__auto___9203 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__9199,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = ((function (__9199,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function (state_9055){
var state_val_9056 = (state_9055[(1)]);
if((state_val_9056 === (1))){
var state_9055__$1 = state_9055;
var statearr_9057_9204 = state_9055__$1;
(statearr_9057_9204[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9056 === (2))){
var state_9055__$1 = state_9055;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9055__$1,(4),jobs);
} else {
if((state_val_9056 === (3))){
var inst_9053 = (state_9055[(2)]);
var state_9055__$1 = state_9055;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9055__$1,inst_9053);
} else {
if((state_val_9056 === (4))){
var inst_9045 = (state_9055[(2)]);
var inst_9046 = process__$1(inst_9045);
var state_9055__$1 = state_9055;
if(cljs.core.truth_(inst_9046)){
var statearr_9058_9205 = state_9055__$1;
(statearr_9058_9205[(1)] = (5));

} else {
var statearr_9059_9206 = state_9055__$1;
(statearr_9059_9206[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9056 === (5))){
var state_9055__$1 = state_9055;
var statearr_9060_9207 = state_9055__$1;
(statearr_9060_9207[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9056 === (6))){
var state_9055__$1 = state_9055;
var statearr_9061_9208 = state_9055__$1;
(statearr_9061_9208[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9056 === (7))){
var inst_9051 = (state_9055[(2)]);
var state_9055__$1 = state_9055;
var statearr_9062_9209 = state_9055__$1;
(statearr_9062_9209[(2)] = inst_9051);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
});})(__9199,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
;
return ((function (__9199,switch__8771__auto__,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_9063 = [null,null,null,null,null,null,null];
(statearr_9063[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__);

(statearr_9063[(1)] = (1));

return statearr_9063;
});
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1 = (function (state_9055){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9055);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9064){if((e9064 instanceof Object)){
var ex__8775__auto__ = e9064;
var statearr_9065_9210 = state_9055;
(statearr_9065_9210[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9055);

return cljs.core.cst$kw$recur;
} else {
throw e9064;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9211 = state_9055;
state_9055 = G__9211;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = function(state_9055){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1.call(this,state_9055);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__;
})()
;})(__9199,switch__8771__auto__,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
})();
var state__8880__auto__ = (function (){var statearr_9066 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9066[(6)] = c__8878__auto___9203);

return statearr_9066;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
});})(__9199,c__8878__auto___9203,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
);


break;
case "async":
var c__8878__auto___9212 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__9199,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = ((function (__9199,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function (state_9079){
var state_val_9080 = (state_9079[(1)]);
if((state_val_9080 === (1))){
var state_9079__$1 = state_9079;
var statearr_9081_9213 = state_9079__$1;
(statearr_9081_9213[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9080 === (2))){
var state_9079__$1 = state_9079;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9079__$1,(4),jobs);
} else {
if((state_val_9080 === (3))){
var inst_9077 = (state_9079[(2)]);
var state_9079__$1 = state_9079;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9079__$1,inst_9077);
} else {
if((state_val_9080 === (4))){
var inst_9069 = (state_9079[(2)]);
var inst_9070 = async(inst_9069);
var state_9079__$1 = state_9079;
if(cljs.core.truth_(inst_9070)){
var statearr_9082_9214 = state_9079__$1;
(statearr_9082_9214[(1)] = (5));

} else {
var statearr_9083_9215 = state_9079__$1;
(statearr_9083_9215[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9080 === (5))){
var state_9079__$1 = state_9079;
var statearr_9084_9216 = state_9079__$1;
(statearr_9084_9216[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9080 === (6))){
var state_9079__$1 = state_9079;
var statearr_9085_9217 = state_9079__$1;
(statearr_9085_9217[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9080 === (7))){
var inst_9075 = (state_9079[(2)]);
var state_9079__$1 = state_9079;
var statearr_9086_9218 = state_9079__$1;
(statearr_9086_9218[(2)] = inst_9075);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
});})(__9199,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
;
return ((function (__9199,switch__8771__auto__,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_9087 = [null,null,null,null,null,null,null];
(statearr_9087[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__);

(statearr_9087[(1)] = (1));

return statearr_9087;
});
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1 = (function (state_9079){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9079);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9088){if((e9088 instanceof Object)){
var ex__8775__auto__ = e9088;
var statearr_9089_9219 = state_9079;
(statearr_9089_9219[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9079);

return cljs.core.cst$kw$recur;
} else {
throw e9088;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9220 = state_9079;
state_9079 = G__9220;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = function(state_9079){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1.call(this,state_9079);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__;
})()
;})(__9199,switch__8771__auto__,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
})();
var state__8880__auto__ = (function (){var statearr_9090 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9090[(6)] = c__8878__auto___9212);

return statearr_9090;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
});})(__9199,c__8878__auto___9212,G__9042_9200,G__9042_9201__$1,n__5636__auto___9198,jobs,results,process__$1,async))
);


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

}

var G__9221 = (__9199 + (1));
__9199 = G__9221;
continue;
} else {
}
break;
}

var c__8878__auto___9222 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9112){
var state_val_9113 = (state_9112[(1)]);
if((state_val_9113 === (1))){
var state_9112__$1 = state_9112;
var statearr_9114_9223 = state_9112__$1;
(statearr_9114_9223[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9113 === (2))){
var state_9112__$1 = state_9112;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9112__$1,(4),from);
} else {
if((state_val_9113 === (3))){
var inst_9110 = (state_9112[(2)]);
var state_9112__$1 = state_9112;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9112__$1,inst_9110);
} else {
if((state_val_9113 === (4))){
var inst_9093 = (state_9112[(7)]);
var inst_9093__$1 = (state_9112[(2)]);
var inst_9094 = (inst_9093__$1 == null);
var state_9112__$1 = (function (){var statearr_9115 = state_9112;
(statearr_9115[(7)] = inst_9093__$1);

return statearr_9115;
})();
if(cljs.core.truth_(inst_9094)){
var statearr_9116_9224 = state_9112__$1;
(statearr_9116_9224[(1)] = (5));

} else {
var statearr_9117_9225 = state_9112__$1;
(statearr_9117_9225[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9113 === (5))){
var inst_9096 = cljs.core.async.close_BANG_(jobs);
var state_9112__$1 = state_9112;
var statearr_9118_9226 = state_9112__$1;
(statearr_9118_9226[(2)] = inst_9096);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9113 === (6))){
var inst_9098 = (state_9112[(8)]);
var inst_9093 = (state_9112[(7)]);
var inst_9098__$1 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var inst_9099 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_9100 = [inst_9093,inst_9098__$1];
var inst_9101 = (new cljs.core.PersistentVector(null,2,(5),inst_9099,inst_9100,null));
var state_9112__$1 = (function (){var statearr_9119 = state_9112;
(statearr_9119[(8)] = inst_9098__$1);

return statearr_9119;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9112__$1,(8),jobs,inst_9101);
} else {
if((state_val_9113 === (7))){
var inst_9108 = (state_9112[(2)]);
var state_9112__$1 = state_9112;
var statearr_9120_9227 = state_9112__$1;
(statearr_9120_9227[(2)] = inst_9108);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9113 === (8))){
var inst_9098 = (state_9112[(8)]);
var inst_9103 = (state_9112[(2)]);
var state_9112__$1 = (function (){var statearr_9121 = state_9112;
(statearr_9121[(9)] = inst_9103);

return statearr_9121;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9112__$1,(9),results,inst_9098);
} else {
if((state_val_9113 === (9))){
var inst_9105 = (state_9112[(2)]);
var state_9112__$1 = (function (){var statearr_9122 = state_9112;
(statearr_9122[(10)] = inst_9105);

return statearr_9122;
})();
var statearr_9123_9228 = state_9112__$1;
(statearr_9123_9228[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_9124 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_9124[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__);

(statearr_9124[(1)] = (1));

return statearr_9124;
});
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1 = (function (state_9112){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9112);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9125){if((e9125 instanceof Object)){
var ex__8775__auto__ = e9125;
var statearr_9126_9229 = state_9112;
(statearr_9126_9229[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9112);

return cljs.core.cst$kw$recur;
} else {
throw e9125;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9230 = state_9112;
state_9112 = G__9230;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = function(state_9112){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1.call(this,state_9112);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9127 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9127[(6)] = c__8878__auto___9222);

return statearr_9127;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


var c__8878__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9165){
var state_val_9166 = (state_9165[(1)]);
if((state_val_9166 === (7))){
var inst_9161 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
var statearr_9167_9231 = state_9165__$1;
(statearr_9167_9231[(2)] = inst_9161);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (20))){
var state_9165__$1 = state_9165;
var statearr_9168_9232 = state_9165__$1;
(statearr_9168_9232[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (1))){
var state_9165__$1 = state_9165;
var statearr_9169_9233 = state_9165__$1;
(statearr_9169_9233[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (4))){
var inst_9130 = (state_9165[(7)]);
var inst_9130__$1 = (state_9165[(2)]);
var inst_9131 = (inst_9130__$1 == null);
var state_9165__$1 = (function (){var statearr_9170 = state_9165;
(statearr_9170[(7)] = inst_9130__$1);

return statearr_9170;
})();
if(cljs.core.truth_(inst_9131)){
var statearr_9171_9234 = state_9165__$1;
(statearr_9171_9234[(1)] = (5));

} else {
var statearr_9172_9235 = state_9165__$1;
(statearr_9172_9235[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (15))){
var inst_9143 = (state_9165[(8)]);
var state_9165__$1 = state_9165;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9165__$1,(18),to,inst_9143);
} else {
if((state_val_9166 === (21))){
var inst_9156 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
var statearr_9173_9236 = state_9165__$1;
(statearr_9173_9236[(2)] = inst_9156);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (13))){
var inst_9158 = (state_9165[(2)]);
var state_9165__$1 = (function (){var statearr_9174 = state_9165;
(statearr_9174[(9)] = inst_9158);

return statearr_9174;
})();
var statearr_9175_9237 = state_9165__$1;
(statearr_9175_9237[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (6))){
var inst_9130 = (state_9165[(7)]);
var state_9165__$1 = state_9165;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9165__$1,(11),inst_9130);
} else {
if((state_val_9166 === (17))){
var inst_9151 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
if(cljs.core.truth_(inst_9151)){
var statearr_9176_9238 = state_9165__$1;
(statearr_9176_9238[(1)] = (19));

} else {
var statearr_9177_9239 = state_9165__$1;
(statearr_9177_9239[(1)] = (20));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (3))){
var inst_9163 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9165__$1,inst_9163);
} else {
if((state_val_9166 === (12))){
var inst_9140 = (state_9165[(10)]);
var state_9165__$1 = state_9165;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9165__$1,(14),inst_9140);
} else {
if((state_val_9166 === (2))){
var state_9165__$1 = state_9165;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9165__$1,(4),results);
} else {
if((state_val_9166 === (19))){
var state_9165__$1 = state_9165;
var statearr_9178_9240 = state_9165__$1;
(statearr_9178_9240[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (11))){
var inst_9140 = (state_9165[(2)]);
var state_9165__$1 = (function (){var statearr_9179 = state_9165;
(statearr_9179[(10)] = inst_9140);

return statearr_9179;
})();
var statearr_9180_9241 = state_9165__$1;
(statearr_9180_9241[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (9))){
var state_9165__$1 = state_9165;
var statearr_9181_9242 = state_9165__$1;
(statearr_9181_9242[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (5))){
var state_9165__$1 = state_9165;
if(cljs.core.truth_(close_QMARK_)){
var statearr_9182_9243 = state_9165__$1;
(statearr_9182_9243[(1)] = (8));

} else {
var statearr_9183_9244 = state_9165__$1;
(statearr_9183_9244[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (14))){
var inst_9145 = (state_9165[(11)]);
var inst_9143 = (state_9165[(8)]);
var inst_9143__$1 = (state_9165[(2)]);
var inst_9144 = (inst_9143__$1 == null);
var inst_9145__$1 = cljs.core.not(inst_9144);
var state_9165__$1 = (function (){var statearr_9184 = state_9165;
(statearr_9184[(11)] = inst_9145__$1);

(statearr_9184[(8)] = inst_9143__$1);

return statearr_9184;
})();
if(inst_9145__$1){
var statearr_9185_9245 = state_9165__$1;
(statearr_9185_9245[(1)] = (15));

} else {
var statearr_9186_9246 = state_9165__$1;
(statearr_9186_9246[(1)] = (16));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (16))){
var inst_9145 = (state_9165[(11)]);
var state_9165__$1 = state_9165;
var statearr_9187_9247 = state_9165__$1;
(statearr_9187_9247[(2)] = inst_9145);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (10))){
var inst_9137 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
var statearr_9188_9248 = state_9165__$1;
(statearr_9188_9248[(2)] = inst_9137);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (18))){
var inst_9148 = (state_9165[(2)]);
var state_9165__$1 = state_9165;
var statearr_9189_9249 = state_9165__$1;
(statearr_9189_9249[(2)] = inst_9148);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9166 === (8))){
var inst_9134 = cljs.core.async.close_BANG_(to);
var state_9165__$1 = state_9165;
var statearr_9190_9250 = state_9165__$1;
(statearr_9190_9250[(2)] = inst_9134);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_9191 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_9191[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__);

(statearr_9191[(1)] = (1));

return statearr_9191;
});
var cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1 = (function (state_9165){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9165);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9192){if((e9192 instanceof Object)){
var ex__8775__auto__ = e9192;
var statearr_9193_9251 = state_9165;
(statearr_9193_9251[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9165);

return cljs.core.cst$kw$recur;
} else {
throw e9192;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9252 = state_9165;
state_9165 = G__9252;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__ = function(state_9165){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1.call(this,state_9165);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9194 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9194[(6)] = c__8878__auto__);

return statearr_9194;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));

return c__8878__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__9254 = arguments.length;
switch (G__9254) {
case 4:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

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

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

}
});

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

(cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5 = (function (n,to,af,from,close_QMARK_){
return cljs.core.async.pipeline_STAR_(n,to,af,from,close_QMARK_,null,cljs.core.cst$kw$async);
}));

(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__9257 = arguments.length;
switch (G__9257) {
case 4:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

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

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

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

}
});

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

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

(cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$6 = (function (n,to,xf,from,close_QMARK_,ex_handler){
return cljs.core.async.pipeline_STAR_(n,to,xf,from,close_QMARK_,ex_handler,cljs.core.cst$kw$compute);
}));

(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__9260 = arguments.length;
switch (G__9260) {
case 2:
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.split.cljs$core$IFn$_invoke$arity$4 = (function (p,ch,t_buf_or_n,f_buf_or_n){
var tc = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(t_buf_or_n);
var fc = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(f_buf_or_n);
var c__8878__auto___9309 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9286){
var state_val_9287 = (state_9286[(1)]);
if((state_val_9287 === (7))){
var inst_9282 = (state_9286[(2)]);
var state_9286__$1 = state_9286;
var statearr_9288_9310 = state_9286__$1;
(statearr_9288_9310[(2)] = inst_9282);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (1))){
var state_9286__$1 = state_9286;
var statearr_9289_9311 = state_9286__$1;
(statearr_9289_9311[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (4))){
var inst_9263 = (state_9286[(7)]);
var inst_9263__$1 = (state_9286[(2)]);
var inst_9264 = (inst_9263__$1 == null);
var state_9286__$1 = (function (){var statearr_9290 = state_9286;
(statearr_9290[(7)] = inst_9263__$1);

return statearr_9290;
})();
if(cljs.core.truth_(inst_9264)){
var statearr_9291_9312 = state_9286__$1;
(statearr_9291_9312[(1)] = (5));

} else {
var statearr_9292_9313 = state_9286__$1;
(statearr_9292_9313[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (13))){
var state_9286__$1 = state_9286;
var statearr_9293_9314 = state_9286__$1;
(statearr_9293_9314[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (6))){
var inst_9263 = (state_9286[(7)]);
var inst_9269 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_9263) : p.call(null,inst_9263));
var state_9286__$1 = state_9286;
if(cljs.core.truth_(inst_9269)){
var statearr_9294_9315 = state_9286__$1;
(statearr_9294_9315[(1)] = (9));

} else {
var statearr_9295_9316 = state_9286__$1;
(statearr_9295_9316[(1)] = (10));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (3))){
var inst_9284 = (state_9286[(2)]);
var state_9286__$1 = state_9286;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9286__$1,inst_9284);
} else {
if((state_val_9287 === (12))){
var state_9286__$1 = state_9286;
var statearr_9296_9317 = state_9286__$1;
(statearr_9296_9317[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (2))){
var state_9286__$1 = state_9286;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9286__$1,(4),ch);
} else {
if((state_val_9287 === (11))){
var inst_9263 = (state_9286[(7)]);
var inst_9273 = (state_9286[(2)]);
var state_9286__$1 = state_9286;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9286__$1,(8),inst_9273,inst_9263);
} else {
if((state_val_9287 === (9))){
var state_9286__$1 = state_9286;
var statearr_9297_9318 = state_9286__$1;
(statearr_9297_9318[(2)] = tc);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (5))){
var inst_9266 = cljs.core.async.close_BANG_(tc);
var inst_9267 = cljs.core.async.close_BANG_(fc);
var state_9286__$1 = (function (){var statearr_9298 = state_9286;
(statearr_9298[(8)] = inst_9266);

return statearr_9298;
})();
var statearr_9299_9319 = state_9286__$1;
(statearr_9299_9319[(2)] = inst_9267);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (14))){
var inst_9280 = (state_9286[(2)]);
var state_9286__$1 = state_9286;
var statearr_9300_9320 = state_9286__$1;
(statearr_9300_9320[(2)] = inst_9280);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (10))){
var state_9286__$1 = state_9286;
var statearr_9301_9321 = state_9286__$1;
(statearr_9301_9321[(2)] = fc);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9287 === (8))){
var inst_9275 = (state_9286[(2)]);
var state_9286__$1 = state_9286;
if(cljs.core.truth_(inst_9275)){
var statearr_9302_9322 = state_9286__$1;
(statearr_9302_9322[(1)] = (12));

} else {
var statearr_9303_9323 = state_9286__$1;
(statearr_9303_9323[(1)] = (13));

}

return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_9304 = [null,null,null,null,null,null,null,null,null];
(statearr_9304[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_9304[(1)] = (1));

return statearr_9304;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_9286){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9286);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9305){if((e9305 instanceof Object)){
var ex__8775__auto__ = e9305;
var statearr_9306_9324 = state_9286;
(statearr_9306_9324[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9286);

return cljs.core.cst$kw$recur;
} else {
throw e9305;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9325 = state_9286;
state_9286 = G__9325;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_9286){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_9286);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9307 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9307[(6)] = c__8878__auto___9309);

return statearr_9307;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


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

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

/**
 * f should be a function of 2 arguments. Returns a channel containing
 *   the single result of applying f to init and the first item from the
 *   channel, then applying f to that result and the 2nd item, etc. If
 *   the channel closes without yielding items, returns init and f is not
 *   called. ch must close before reduce produces a result.
 */
cljs.core.async.reduce = (function cljs$core$async$reduce(f,init,ch){
var c__8878__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9340){
var state_val_9341 = (state_9340[(1)]);
if((state_val_9341 === (1))){
var inst_9326 = init;
var state_9340__$1 = (function (){var statearr_9342 = state_9340;
(statearr_9342[(7)] = inst_9326);

return statearr_9342;
})();
var statearr_9343_9355 = state_9340__$1;
(statearr_9343_9355[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9341 === (2))){
var state_9340__$1 = state_9340;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9340__$1,(4),ch);
} else {
if((state_val_9341 === (3))){
var inst_9338 = (state_9340[(2)]);
var state_9340__$1 = state_9340;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9340__$1,inst_9338);
} else {
if((state_val_9341 === (4))){
var inst_9329 = (state_9340[(8)]);
var inst_9329__$1 = (state_9340[(2)]);
var inst_9330 = (inst_9329__$1 == null);
var state_9340__$1 = (function (){var statearr_9344 = state_9340;
(statearr_9344[(8)] = inst_9329__$1);

return statearr_9344;
})();
if(cljs.core.truth_(inst_9330)){
var statearr_9345_9356 = state_9340__$1;
(statearr_9345_9356[(1)] = (5));

} else {
var statearr_9346_9357 = state_9340__$1;
(statearr_9346_9357[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9341 === (5))){
var inst_9326 = (state_9340[(7)]);
var state_9340__$1 = state_9340;
var statearr_9347_9358 = state_9340__$1;
(statearr_9347_9358[(2)] = inst_9326);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9341 === (6))){
var inst_9326 = (state_9340[(7)]);
var inst_9329 = (state_9340[(8)]);
var inst_9333 = (f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(inst_9326,inst_9329) : f.call(null,inst_9326,inst_9329));
var inst_9326__$1 = inst_9333;
var state_9340__$1 = (function (){var statearr_9348 = state_9340;
(statearr_9348[(7)] = inst_9326__$1);

return statearr_9348;
})();
var statearr_9349_9359 = state_9340__$1;
(statearr_9349_9359[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9341 === (7))){
var inst_9336 = (state_9340[(2)]);
var state_9340__$1 = state_9340;
var statearr_9350_9360 = state_9340__$1;
(statearr_9350_9360[(2)] = inst_9336);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$reduce_$_state_machine__8772__auto__ = null;
var cljs$core$async$reduce_$_state_machine__8772__auto____0 = (function (){
var statearr_9351 = [null,null,null,null,null,null,null,null,null];
(statearr_9351[(0)] = cljs$core$async$reduce_$_state_machine__8772__auto__);

(statearr_9351[(1)] = (1));

return statearr_9351;
});
var cljs$core$async$reduce_$_state_machine__8772__auto____1 = (function (state_9340){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9340);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9352){if((e9352 instanceof Object)){
var ex__8775__auto__ = e9352;
var statearr_9353_9361 = state_9340;
(statearr_9353_9361[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9340);

return cljs.core.cst$kw$recur;
} else {
throw e9352;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9362 = state_9340;
state_9340 = G__9362;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__8772__auto__ = function(state_9340){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__8772__auto____1.call(this,state_9340);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__8772__auto____0;
cljs$core$async$reduce_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__8772__auto____1;
return cljs$core$async$reduce_$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9354 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9354[(6)] = c__8878__auto__);

return statearr_9354;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));

return c__8878__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__9364 = arguments.length;
switch (G__9364) {
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.cljs$core$IFn$_invoke$arity$3(ch,coll,true);
}));

(cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__8878__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9389){
var state_val_9390 = (state_9389[(1)]);
if((state_val_9390 === (7))){
var inst_9371 = (state_9389[(2)]);
var state_9389__$1 = state_9389;
var statearr_9391_9412 = state_9389__$1;
(statearr_9391_9412[(2)] = inst_9371);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (1))){
var inst_9365 = cljs.core.seq(coll);
var inst_9366 = inst_9365;
var state_9389__$1 = (function (){var statearr_9392 = state_9389;
(statearr_9392[(7)] = inst_9366);

return statearr_9392;
})();
var statearr_9393_9413 = state_9389__$1;
(statearr_9393_9413[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (4))){
var inst_9366 = (state_9389[(7)]);
var inst_9369 = cljs.core.first(inst_9366);
var state_9389__$1 = state_9389;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9389__$1,(7),ch,inst_9369);
} else {
if((state_val_9390 === (13))){
var inst_9383 = (state_9389[(2)]);
var state_9389__$1 = state_9389;
var statearr_9394_9414 = state_9389__$1;
(statearr_9394_9414[(2)] = inst_9383);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (6))){
var inst_9374 = (state_9389[(2)]);
var state_9389__$1 = state_9389;
if(cljs.core.truth_(inst_9374)){
var statearr_9395_9415 = state_9389__$1;
(statearr_9395_9415[(1)] = (8));

} else {
var statearr_9396_9416 = state_9389__$1;
(statearr_9396_9416[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (3))){
var inst_9387 = (state_9389[(2)]);
var state_9389__$1 = state_9389;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9389__$1,inst_9387);
} else {
if((state_val_9390 === (12))){
var state_9389__$1 = state_9389;
var statearr_9397_9417 = state_9389__$1;
(statearr_9397_9417[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (2))){
var inst_9366 = (state_9389[(7)]);
var state_9389__$1 = state_9389;
if(cljs.core.truth_(inst_9366)){
var statearr_9398_9418 = state_9389__$1;
(statearr_9398_9418[(1)] = (4));

} else {
var statearr_9399_9419 = state_9389__$1;
(statearr_9399_9419[(1)] = (5));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (11))){
var inst_9380 = cljs.core.async.close_BANG_(ch);
var state_9389__$1 = state_9389;
var statearr_9400_9420 = state_9389__$1;
(statearr_9400_9420[(2)] = inst_9380);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (9))){
var state_9389__$1 = state_9389;
if(cljs.core.truth_(close_QMARK_)){
var statearr_9401_9421 = state_9389__$1;
(statearr_9401_9421[(1)] = (11));

} else {
var statearr_9402_9422 = state_9389__$1;
(statearr_9402_9422[(1)] = (12));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (5))){
var inst_9366 = (state_9389[(7)]);
var state_9389__$1 = state_9389;
var statearr_9403_9423 = state_9389__$1;
(statearr_9403_9423[(2)] = inst_9366);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (10))){
var inst_9385 = (state_9389[(2)]);
var state_9389__$1 = state_9389;
var statearr_9404_9424 = state_9389__$1;
(statearr_9404_9424[(2)] = inst_9385);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9390 === (8))){
var inst_9366 = (state_9389[(7)]);
var inst_9376 = cljs.core.next(inst_9366);
var inst_9366__$1 = inst_9376;
var state_9389__$1 = (function (){var statearr_9405 = state_9389;
(statearr_9405[(7)] = inst_9366__$1);

return statearr_9405;
})();
var statearr_9406_9425 = state_9389__$1;
(statearr_9406_9425[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_9407 = [null,null,null,null,null,null,null,null];
(statearr_9407[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_9407[(1)] = (1));

return statearr_9407;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_9389){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9389);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9408){if((e9408 instanceof Object)){
var ex__8775__auto__ = e9408;
var statearr_9409_9426 = state_9389;
(statearr_9409_9426[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9389);

return cljs.core.cst$kw$recur;
} else {
throw e9408;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9427 = state_9389;
state_9389 = G__9427;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_9389){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_9389);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9410 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9410[(6)] = c__8878__auto__);

return statearr_9410;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));

return c__8878__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.cljs$core$IFn$_invoke$arity$1(cljs.core.bounded_count((100),coll));
cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2(ch,coll);

return ch;
});

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

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


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

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

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

var cljs$core$async$Mult$untap_all_STAR_$dyn_9431 = (function (m){
var x__5393__auto__ = (((m == null))?null:m);
var m__5394__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5394__auto__.call(null,m));
} else {
var m__5392__auto__ = (cljs.core.async.untap_all_STAR_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5392__auto__.call(null,m));
} else {
throw cljs.core.missing_protocol("Mult.untap-all*",m);
}
}
});
cljs.core.async.untap_all_STAR_ = (function cljs$core$async$untap_all_STAR_(m){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mult$untap_all_STAR_$arity$1 == null)))))){
return m.cljs$core$async$Mult$untap_all_STAR_$arity$1(m);
} else {
return cljs$core$async$Mult$untap_all_STAR_$dyn_9431(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.cljs$core$IFn$_invoke$arity$1(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$async9432 !== '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$async9432 = (function (ch,cs,meta9433){
this.ch = ch;
this.cs = cs;
this.meta9433 = meta9433;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async9432.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_9434,meta9433__$1){
var self__ = this;
var _9434__$1 = this;
return (new cljs.core.async.t_cljs$core$async9432(self__.ch,self__.cs,meta9433__$1));
}));

(cljs.core.async.t_cljs$core$async9432.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_9434){
var self__ = this;
var _9434__$1 = this;
return self__.meta9433;
}));

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

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

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

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

return null;
}));

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

return null;
}));

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

return null;
}));

(cljs.core.async.t_cljs$core$async9432.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$ch,cljs.core.cst$sym$cs,cljs.core.cst$sym$meta9433], null);
}));

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

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

(cljs.core.async.t_cljs$core$async9432.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async9432");
}));

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

}

return (new cljs.core.async.t_cljs$core$async9432(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var dchan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var dctr = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
var done = (function (_){
if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,true);
} else {
return null;
}
});
var c__8878__auto___9654 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9569){
var state_val_9570 = (state_9569[(1)]);
if((state_val_9570 === (7))){
var inst_9565 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9571_9655 = state_9569__$1;
(statearr_9571_9655[(2)] = inst_9565);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (20))){
var inst_9468 = (state_9569[(7)]);
var inst_9480 = cljs.core.first(inst_9468);
var inst_9481 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9480,(0),null);
var inst_9482 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9480,(1),null);
var state_9569__$1 = (function (){var statearr_9572 = state_9569;
(statearr_9572[(8)] = inst_9481);

return statearr_9572;
})();
if(cljs.core.truth_(inst_9482)){
var statearr_9573_9656 = state_9569__$1;
(statearr_9573_9656[(1)] = (22));

} else {
var statearr_9574_9657 = state_9569__$1;
(statearr_9574_9657[(1)] = (23));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (27))){
var inst_9512 = (state_9569[(9)]);
var inst_9437 = (state_9569[(10)]);
var inst_9510 = (state_9569[(11)]);
var inst_9517 = (state_9569[(12)]);
var inst_9517__$1 = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(inst_9510,inst_9512);
var inst_9518 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_9517__$1,inst_9437,done);
var state_9569__$1 = (function (){var statearr_9575 = state_9569;
(statearr_9575[(12)] = inst_9517__$1);

return statearr_9575;
})();
if(cljs.core.truth_(inst_9518)){
var statearr_9576_9658 = state_9569__$1;
(statearr_9576_9658[(1)] = (30));

} else {
var statearr_9577_9659 = state_9569__$1;
(statearr_9577_9659[(1)] = (31));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (1))){
var state_9569__$1 = state_9569;
var statearr_9578_9660 = state_9569__$1;
(statearr_9578_9660[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (24))){
var inst_9468 = (state_9569[(7)]);
var inst_9487 = (state_9569[(2)]);
var inst_9488 = cljs.core.next(inst_9468);
var inst_9446 = inst_9488;
var inst_9447 = null;
var inst_9448 = (0);
var inst_9449 = (0);
var state_9569__$1 = (function (){var statearr_9579 = state_9569;
(statearr_9579[(13)] = inst_9448);

(statearr_9579[(14)] = inst_9446);

(statearr_9579[(15)] = inst_9449);

(statearr_9579[(16)] = inst_9447);

(statearr_9579[(17)] = inst_9487);

return statearr_9579;
})();
var statearr_9580_9661 = state_9569__$1;
(statearr_9580_9661[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (39))){
var state_9569__$1 = state_9569;
var statearr_9584_9662 = state_9569__$1;
(statearr_9584_9662[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (4))){
var inst_9437 = (state_9569[(10)]);
var inst_9437__$1 = (state_9569[(2)]);
var inst_9438 = (inst_9437__$1 == null);
var state_9569__$1 = (function (){var statearr_9585 = state_9569;
(statearr_9585[(10)] = inst_9437__$1);

return statearr_9585;
})();
if(cljs.core.truth_(inst_9438)){
var statearr_9586_9663 = state_9569__$1;
(statearr_9586_9663[(1)] = (5));

} else {
var statearr_9587_9664 = state_9569__$1;
(statearr_9587_9664[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (15))){
var inst_9448 = (state_9569[(13)]);
var inst_9446 = (state_9569[(14)]);
var inst_9449 = (state_9569[(15)]);
var inst_9447 = (state_9569[(16)]);
var inst_9464 = (state_9569[(2)]);
var inst_9465 = (inst_9449 + (1));
var tmp9581 = inst_9448;
var tmp9582 = inst_9446;
var tmp9583 = inst_9447;
var inst_9446__$1 = tmp9582;
var inst_9447__$1 = tmp9583;
var inst_9448__$1 = tmp9581;
var inst_9449__$1 = inst_9465;
var state_9569__$1 = (function (){var statearr_9588 = state_9569;
(statearr_9588[(13)] = inst_9448__$1);

(statearr_9588[(14)] = inst_9446__$1);

(statearr_9588[(18)] = inst_9464);

(statearr_9588[(15)] = inst_9449__$1);

(statearr_9588[(16)] = inst_9447__$1);

return statearr_9588;
})();
var statearr_9589_9665 = state_9569__$1;
(statearr_9589_9665[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (21))){
var inst_9491 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9593_9666 = state_9569__$1;
(statearr_9593_9666[(2)] = inst_9491);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (31))){
var inst_9517 = (state_9569[(12)]);
var inst_9521 = done(null);
var inst_9522 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_9517);
var state_9569__$1 = (function (){var statearr_9594 = state_9569;
(statearr_9594[(19)] = inst_9521);

return statearr_9594;
})();
var statearr_9595_9667 = state_9569__$1;
(statearr_9595_9667[(2)] = inst_9522);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (32))){
var inst_9509 = (state_9569[(20)]);
var inst_9512 = (state_9569[(9)]);
var inst_9511 = (state_9569[(21)]);
var inst_9510 = (state_9569[(11)]);
var inst_9524 = (state_9569[(2)]);
var inst_9525 = (inst_9512 + (1));
var tmp9590 = inst_9509;
var tmp9591 = inst_9511;
var tmp9592 = inst_9510;
var inst_9509__$1 = tmp9590;
var inst_9510__$1 = tmp9592;
var inst_9511__$1 = tmp9591;
var inst_9512__$1 = inst_9525;
var state_9569__$1 = (function (){var statearr_9596 = state_9569;
(statearr_9596[(20)] = inst_9509__$1);

(statearr_9596[(9)] = inst_9512__$1);

(statearr_9596[(21)] = inst_9511__$1);

(statearr_9596[(11)] = inst_9510__$1);

(statearr_9596[(22)] = inst_9524);

return statearr_9596;
})();
var statearr_9597_9668 = state_9569__$1;
(statearr_9597_9668[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (40))){
var inst_9537 = (state_9569[(23)]);
var inst_9541 = done(null);
var inst_9542 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_9537);
var state_9569__$1 = (function (){var statearr_9598 = state_9569;
(statearr_9598[(24)] = inst_9541);

return statearr_9598;
})();
var statearr_9599_9669 = state_9569__$1;
(statearr_9599_9669[(2)] = inst_9542);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (33))){
var inst_9528 = (state_9569[(25)]);
var inst_9530 = cljs.core.chunked_seq_QMARK_(inst_9528);
var state_9569__$1 = state_9569;
if(inst_9530){
var statearr_9600_9670 = state_9569__$1;
(statearr_9600_9670[(1)] = (36));

} else {
var statearr_9601_9671 = state_9569__$1;
(statearr_9601_9671[(1)] = (37));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (13))){
var inst_9458 = (state_9569[(26)]);
var inst_9461 = cljs.core.async.close_BANG_(inst_9458);
var state_9569__$1 = state_9569;
var statearr_9602_9672 = state_9569__$1;
(statearr_9602_9672[(2)] = inst_9461);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (22))){
var inst_9481 = (state_9569[(8)]);
var inst_9484 = cljs.core.async.close_BANG_(inst_9481);
var state_9569__$1 = state_9569;
var statearr_9603_9673 = state_9569__$1;
(statearr_9603_9673[(2)] = inst_9484);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (36))){
var inst_9528 = (state_9569[(25)]);
var inst_9532 = cljs.core.chunk_first(inst_9528);
var inst_9533 = cljs.core.chunk_rest(inst_9528);
var inst_9534 = cljs.core.count(inst_9532);
var inst_9509 = inst_9533;
var inst_9510 = inst_9532;
var inst_9511 = inst_9534;
var inst_9512 = (0);
var state_9569__$1 = (function (){var statearr_9604 = state_9569;
(statearr_9604[(20)] = inst_9509);

(statearr_9604[(9)] = inst_9512);

(statearr_9604[(21)] = inst_9511);

(statearr_9604[(11)] = inst_9510);

return statearr_9604;
})();
var statearr_9605_9674 = state_9569__$1;
(statearr_9605_9674[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (41))){
var inst_9528 = (state_9569[(25)]);
var inst_9544 = (state_9569[(2)]);
var inst_9545 = cljs.core.next(inst_9528);
var inst_9509 = inst_9545;
var inst_9510 = null;
var inst_9511 = (0);
var inst_9512 = (0);
var state_9569__$1 = (function (){var statearr_9606 = state_9569;
(statearr_9606[(20)] = inst_9509);

(statearr_9606[(9)] = inst_9512);

(statearr_9606[(21)] = inst_9511);

(statearr_9606[(11)] = inst_9510);

(statearr_9606[(27)] = inst_9544);

return statearr_9606;
})();
var statearr_9607_9675 = state_9569__$1;
(statearr_9607_9675[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (43))){
var state_9569__$1 = state_9569;
var statearr_9608_9676 = state_9569__$1;
(statearr_9608_9676[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (29))){
var inst_9553 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9609_9677 = state_9569__$1;
(statearr_9609_9677[(2)] = inst_9553);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (44))){
var inst_9562 = (state_9569[(2)]);
var state_9569__$1 = (function (){var statearr_9610 = state_9569;
(statearr_9610[(28)] = inst_9562);

return statearr_9610;
})();
var statearr_9611_9678 = state_9569__$1;
(statearr_9611_9678[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (6))){
var inst_9501 = (state_9569[(29)]);
var inst_9500 = cljs.core.deref(cs);
var inst_9501__$1 = cljs.core.keys(inst_9500);
var inst_9502 = cljs.core.count(inst_9501__$1);
var inst_9503 = cljs.core.reset_BANG_(dctr,inst_9502);
var inst_9508 = cljs.core.seq(inst_9501__$1);
var inst_9509 = inst_9508;
var inst_9510 = null;
var inst_9511 = (0);
var inst_9512 = (0);
var state_9569__$1 = (function (){var statearr_9612 = state_9569;
(statearr_9612[(29)] = inst_9501__$1);

(statearr_9612[(20)] = inst_9509);

(statearr_9612[(9)] = inst_9512);

(statearr_9612[(30)] = inst_9503);

(statearr_9612[(21)] = inst_9511);

(statearr_9612[(11)] = inst_9510);

return statearr_9612;
})();
var statearr_9613_9679 = state_9569__$1;
(statearr_9613_9679[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (28))){
var inst_9509 = (state_9569[(20)]);
var inst_9528 = (state_9569[(25)]);
var inst_9528__$1 = cljs.core.seq(inst_9509);
var state_9569__$1 = (function (){var statearr_9614 = state_9569;
(statearr_9614[(25)] = inst_9528__$1);

return statearr_9614;
})();
if(inst_9528__$1){
var statearr_9615_9680 = state_9569__$1;
(statearr_9615_9680[(1)] = (33));

} else {
var statearr_9616_9681 = state_9569__$1;
(statearr_9616_9681[(1)] = (34));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (25))){
var inst_9512 = (state_9569[(9)]);
var inst_9511 = (state_9569[(21)]);
var inst_9514 = (inst_9512 < inst_9511);
var inst_9515 = inst_9514;
var state_9569__$1 = state_9569;
if(cljs.core.truth_(inst_9515)){
var statearr_9617_9682 = state_9569__$1;
(statearr_9617_9682[(1)] = (27));

} else {
var statearr_9618_9683 = state_9569__$1;
(statearr_9618_9683[(1)] = (28));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (34))){
var state_9569__$1 = state_9569;
var statearr_9619_9684 = state_9569__$1;
(statearr_9619_9684[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (17))){
var state_9569__$1 = state_9569;
var statearr_9620_9685 = state_9569__$1;
(statearr_9620_9685[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (3))){
var inst_9567 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9569__$1,inst_9567);
} else {
if((state_val_9570 === (12))){
var inst_9496 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9621_9686 = state_9569__$1;
(statearr_9621_9686[(2)] = inst_9496);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (2))){
var state_9569__$1 = state_9569;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9569__$1,(4),ch);
} else {
if((state_val_9570 === (23))){
var state_9569__$1 = state_9569;
var statearr_9622_9687 = state_9569__$1;
(statearr_9622_9687[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (35))){
var inst_9551 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9623_9688 = state_9569__$1;
(statearr_9623_9688[(2)] = inst_9551);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (19))){
var inst_9468 = (state_9569[(7)]);
var inst_9472 = cljs.core.chunk_first(inst_9468);
var inst_9473 = cljs.core.chunk_rest(inst_9468);
var inst_9474 = cljs.core.count(inst_9472);
var inst_9446 = inst_9473;
var inst_9447 = inst_9472;
var inst_9448 = inst_9474;
var inst_9449 = (0);
var state_9569__$1 = (function (){var statearr_9624 = state_9569;
(statearr_9624[(13)] = inst_9448);

(statearr_9624[(14)] = inst_9446);

(statearr_9624[(15)] = inst_9449);

(statearr_9624[(16)] = inst_9447);

return statearr_9624;
})();
var statearr_9625_9689 = state_9569__$1;
(statearr_9625_9689[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (11))){
var inst_9446 = (state_9569[(14)]);
var inst_9468 = (state_9569[(7)]);
var inst_9468__$1 = cljs.core.seq(inst_9446);
var state_9569__$1 = (function (){var statearr_9626 = state_9569;
(statearr_9626[(7)] = inst_9468__$1);

return statearr_9626;
})();
if(inst_9468__$1){
var statearr_9627_9690 = state_9569__$1;
(statearr_9627_9690[(1)] = (16));

} else {
var statearr_9628_9691 = state_9569__$1;
(statearr_9628_9691[(1)] = (17));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (9))){
var inst_9498 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9629_9692 = state_9569__$1;
(statearr_9629_9692[(2)] = inst_9498);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (5))){
var inst_9444 = cljs.core.deref(cs);
var inst_9445 = cljs.core.seq(inst_9444);
var inst_9446 = inst_9445;
var inst_9447 = null;
var inst_9448 = (0);
var inst_9449 = (0);
var state_9569__$1 = (function (){var statearr_9630 = state_9569;
(statearr_9630[(13)] = inst_9448);

(statearr_9630[(14)] = inst_9446);

(statearr_9630[(15)] = inst_9449);

(statearr_9630[(16)] = inst_9447);

return statearr_9630;
})();
var statearr_9631_9693 = state_9569__$1;
(statearr_9631_9693[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (14))){
var state_9569__$1 = state_9569;
var statearr_9632_9694 = state_9569__$1;
(statearr_9632_9694[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (45))){
var inst_9559 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9633_9695 = state_9569__$1;
(statearr_9633_9695[(2)] = inst_9559);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (26))){
var inst_9501 = (state_9569[(29)]);
var inst_9555 = (state_9569[(2)]);
var inst_9556 = cljs.core.seq(inst_9501);
var state_9569__$1 = (function (){var statearr_9634 = state_9569;
(statearr_9634[(31)] = inst_9555);

return statearr_9634;
})();
if(inst_9556){
var statearr_9635_9696 = state_9569__$1;
(statearr_9635_9696[(1)] = (42));

} else {
var statearr_9636_9697 = state_9569__$1;
(statearr_9636_9697[(1)] = (43));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (16))){
var inst_9468 = (state_9569[(7)]);
var inst_9470 = cljs.core.chunked_seq_QMARK_(inst_9468);
var state_9569__$1 = state_9569;
if(inst_9470){
var statearr_9637_9698 = state_9569__$1;
(statearr_9637_9698[(1)] = (19));

} else {
var statearr_9638_9699 = state_9569__$1;
(statearr_9638_9699[(1)] = (20));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (38))){
var inst_9548 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9639_9700 = state_9569__$1;
(statearr_9639_9700[(2)] = inst_9548);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (30))){
var state_9569__$1 = state_9569;
var statearr_9640_9701 = state_9569__$1;
(statearr_9640_9701[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (10))){
var inst_9449 = (state_9569[(15)]);
var inst_9447 = (state_9569[(16)]);
var inst_9457 = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(inst_9447,inst_9449);
var inst_9458 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9457,(0),null);
var inst_9459 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9457,(1),null);
var state_9569__$1 = (function (){var statearr_9641 = state_9569;
(statearr_9641[(26)] = inst_9458);

return statearr_9641;
})();
if(cljs.core.truth_(inst_9459)){
var statearr_9642_9702 = state_9569__$1;
(statearr_9642_9702[(1)] = (13));

} else {
var statearr_9643_9703 = state_9569__$1;
(statearr_9643_9703[(1)] = (14));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (18))){
var inst_9494 = (state_9569[(2)]);
var state_9569__$1 = state_9569;
var statearr_9644_9704 = state_9569__$1;
(statearr_9644_9704[(2)] = inst_9494);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (42))){
var state_9569__$1 = state_9569;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9569__$1,(45),dchan);
} else {
if((state_val_9570 === (37))){
var inst_9528 = (state_9569[(25)]);
var inst_9437 = (state_9569[(10)]);
var inst_9537 = (state_9569[(23)]);
var inst_9537__$1 = cljs.core.first(inst_9528);
var inst_9538 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_9537__$1,inst_9437,done);
var state_9569__$1 = (function (){var statearr_9645 = state_9569;
(statearr_9645[(23)] = inst_9537__$1);

return statearr_9645;
})();
if(cljs.core.truth_(inst_9538)){
var statearr_9646_9705 = state_9569__$1;
(statearr_9646_9705[(1)] = (39));

} else {
var statearr_9647_9706 = state_9569__$1;
(statearr_9647_9706[(1)] = (40));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9570 === (8))){
var inst_9448 = (state_9569[(13)]);
var inst_9449 = (state_9569[(15)]);
var inst_9451 = (inst_9449 < inst_9448);
var inst_9452 = inst_9451;
var state_9569__$1 = state_9569;
if(cljs.core.truth_(inst_9452)){
var statearr_9648_9707 = state_9569__$1;
(statearr_9648_9707[(1)] = (10));

} else {
var statearr_9649_9708 = state_9569__$1;
(statearr_9649_9708[(1)] = (11));

}

return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mult_$_state_machine__8772__auto__ = null;
var cljs$core$async$mult_$_state_machine__8772__auto____0 = (function (){
var statearr_9650 = [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_9650[(0)] = cljs$core$async$mult_$_state_machine__8772__auto__);

(statearr_9650[(1)] = (1));

return statearr_9650;
});
var cljs$core$async$mult_$_state_machine__8772__auto____1 = (function (state_9569){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9569);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9651){if((e9651 instanceof Object)){
var ex__8775__auto__ = e9651;
var statearr_9652_9709 = state_9569;
(statearr_9652_9709[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9569);

return cljs.core.cst$kw$recur;
} else {
throw e9651;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9710 = state_9569;
state_9569 = G__9710;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__8772__auto__ = function(state_9569){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__8772__auto____1.call(this,state_9569);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__8772__auto____0;
cljs$core$async$mult_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__8772__auto____1;
return cljs$core$async$mult_$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9653 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9653[(6)] = c__8878__auto___9654);

return statearr_9653;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return m;
});
/**
 * Copies the mult source onto the supplied channel.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.tap = (function cljs$core$async$tap(var_args){
var G__9712 = arguments.length;
switch (G__9712) {
case 2:
return cljs.core.async.tap.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

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

return ch;
}));

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

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

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

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

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

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

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

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

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

var G__9730 = (i__5770__auto___9729 + (1));
i__5770__auto___9729 = G__9730;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((3) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__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__5776__auto__);
});

(cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__9723){
var map__9724 = p__9723;
var map__9724__$1 = cljs.core.__destructure_map(map__9724);
var opts = map__9724__$1;
var statearr_9725_9731 = state;
(statearr_9725_9731[(1)] = cont_block);


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


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


return cljs.core.cst$kw$recur;
} 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 (seq9719){
var G__9720 = cljs.core.first(seq9719);
var seq9719__$1 = cljs.core.next(seq9719);
var G__9721 = cljs.core.first(seq9719__$1);
var seq9719__$2 = cljs.core.next(seq9719__$1);
var G__9722 = cljs.core.first(seq9719__$2);
var seq9719__$3 = cljs.core.next(seq9719__$2);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__9720,G__9721,G__9722,seq9719__$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.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var solo_modes = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$pause,null,cljs.core.cst$kw$mute,null], null), null);
var attrs = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(solo_modes,cljs.core.cst$kw$solo);
var solo_mode = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.cst$kw$mute);
var change = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0();
var changed = (function (){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(change,true);
});
var pick = (function (attr,chs){
return cljs.core.reduce_kv((function (ret,c,v){
if(cljs.core.truth_((attr.cljs$core$IFn$_invoke$arity$1 ? attr.cljs$core$IFn$_invoke$arity$1(v) : attr.call(null,v)))){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(ret,c);
} else {
return ret;
}
}),cljs.core.PersistentHashSet.EMPTY,chs);
});
var calc_state = (function (){
var chs = cljs.core.deref(cs);
var mode = cljs.core.deref(solo_mode);
var solos = pick(cljs.core.cst$kw$solo,chs);
var pauses = pick(cljs.core.cst$kw$pause,chs);
return new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$solos,solos,cljs.core.cst$kw$mutes,pick(cljs.core.cst$kw$mute,chs),cljs.core.cst$kw$reads,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(((((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(mode,cljs.core.cst$kw$pause)) && ((!(cljs.core.empty_QMARK_(solos))))))?cljs.core.vec(solos):cljs.core.vec(cljs.core.remove.cljs$core$IFn$_invoke$arity$2(pauses,cljs.core.keys(chs)))),change)], null);
});
var m = (function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async9734 !== '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$async9734 = (function (out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,meta9735){
this.out = out;
this.cs = cs;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.solo_mode = solo_mode;
this.change = change;
this.changed = changed;
this.pick = pick;
this.calc_state = calc_state;
this.meta9735 = meta9735;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async9734.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_9736,meta9735__$1){
var self__ = this;
var _9736__$1 = this;
return (new cljs.core.async.t_cljs$core$async9734(self__.out,self__.cs,self__.solo_modes,self__.attrs,self__.solo_mode,self__.change,self__.changed,self__.pick,self__.calc_state,meta9735__$1));
}));

(cljs.core.async.t_cljs$core$async9734.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_9736){
var self__ = this;
var _9736__$1 = this;
return self__.meta9735;
}));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(cljs.core.async.t_cljs$core$async9734.getBasis = (function (){
return new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$out,cljs.core.cst$sym$cs,cljs.core.cst$sym$solo_DASH_modes,cljs.core.cst$sym$attrs,cljs.core.cst$sym$solo_DASH_mode,cljs.core.cst$sym$change,cljs.core.cst$sym$changed,cljs.core.cst$sym$pick,cljs.core.cst$sym$calc_DASH_state,cljs.core.cst$sym$meta9735], null);
}));

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

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

(cljs.core.async.t_cljs$core$async9734.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async9734");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async9734.
 */
cljs.core.async.__GT_t_cljs$core$async9734 = (function cljs$core$async$mix_$___GT_t_cljs$core$async9734(out__$1,cs__$1,solo_modes__$1,attrs__$1,solo_mode__$1,change__$1,changed__$1,pick__$1,calc_state__$1,meta9735){
return (new cljs.core.async.t_cljs$core$async9734(out__$1,cs__$1,solo_modes__$1,attrs__$1,solo_mode__$1,change__$1,changed__$1,pick__$1,calc_state__$1,meta9735));
});

}

return (new cljs.core.async.t_cljs$core$async9734(out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__8878__auto___9848 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9804){
var state_val_9805 = (state_9804[(1)]);
if((state_val_9805 === (7))){
var inst_9764 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
if(cljs.core.truth_(inst_9764)){
var statearr_9806_9849 = state_9804__$1;
(statearr_9806_9849[(1)] = (8));

} else {
var statearr_9807_9850 = state_9804__$1;
(statearr_9807_9850[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (20))){
var inst_9757 = (state_9804[(7)]);
var state_9804__$1 = state_9804;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9804__$1,(23),out,inst_9757);
} else {
if((state_val_9805 === (1))){
var inst_9740 = calc_state();
var inst_9741 = cljs.core.__destructure_map(inst_9740);
var inst_9742 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9741,cljs.core.cst$kw$solos);
var inst_9743 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9741,cljs.core.cst$kw$mutes);
var inst_9744 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9741,cljs.core.cst$kw$reads);
var inst_9745 = inst_9740;
var state_9804__$1 = (function (){var statearr_9808 = state_9804;
(statearr_9808[(8)] = inst_9743);

(statearr_9808[(9)] = inst_9744);

(statearr_9808[(10)] = inst_9742);

(statearr_9808[(11)] = inst_9745);

return statearr_9808;
})();
var statearr_9809_9851 = state_9804__$1;
(statearr_9809_9851[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (24))){
var inst_9748 = (state_9804[(12)]);
var inst_9745 = inst_9748;
var state_9804__$1 = (function (){var statearr_9810 = state_9804;
(statearr_9810[(11)] = inst_9745);

return statearr_9810;
})();
var statearr_9811_9852 = state_9804__$1;
(statearr_9811_9852[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (4))){
var inst_9759 = (state_9804[(13)]);
var inst_9757 = (state_9804[(7)]);
var inst_9756 = (state_9804[(2)]);
var inst_9757__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9756,(0),null);
var inst_9758 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_9756,(1),null);
var inst_9759__$1 = (inst_9757__$1 == null);
var state_9804__$1 = (function (){var statearr_9812 = state_9804;
(statearr_9812[(13)] = inst_9759__$1);

(statearr_9812[(7)] = inst_9757__$1);

(statearr_9812[(14)] = inst_9758);

return statearr_9812;
})();
if(cljs.core.truth_(inst_9759__$1)){
var statearr_9813_9853 = state_9804__$1;
(statearr_9813_9853[(1)] = (5));

} else {
var statearr_9814_9854 = state_9804__$1;
(statearr_9814_9854[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (15))){
var inst_9778 = (state_9804[(15)]);
var inst_9749 = (state_9804[(16)]);
var inst_9778__$1 = cljs.core.empty_QMARK_(inst_9749);
var state_9804__$1 = (function (){var statearr_9815 = state_9804;
(statearr_9815[(15)] = inst_9778__$1);

return statearr_9815;
})();
if(inst_9778__$1){
var statearr_9816_9855 = state_9804__$1;
(statearr_9816_9855[(1)] = (17));

} else {
var statearr_9817_9856 = state_9804__$1;
(statearr_9817_9856[(1)] = (18));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (21))){
var inst_9748 = (state_9804[(12)]);
var inst_9745 = inst_9748;
var state_9804__$1 = (function (){var statearr_9818 = state_9804;
(statearr_9818[(11)] = inst_9745);

return statearr_9818;
})();
var statearr_9819_9857 = state_9804__$1;
(statearr_9819_9857[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (13))){
var inst_9771 = (state_9804[(2)]);
var inst_9772 = calc_state();
var inst_9745 = inst_9772;
var state_9804__$1 = (function (){var statearr_9820 = state_9804;
(statearr_9820[(17)] = inst_9771);

(statearr_9820[(11)] = inst_9745);

return statearr_9820;
})();
var statearr_9821_9858 = state_9804__$1;
(statearr_9821_9858[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (22))){
var inst_9798 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
var statearr_9822_9859 = state_9804__$1;
(statearr_9822_9859[(2)] = inst_9798);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (6))){
var inst_9758 = (state_9804[(14)]);
var inst_9762 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_9758,change);
var state_9804__$1 = state_9804;
var statearr_9823_9860 = state_9804__$1;
(statearr_9823_9860[(2)] = inst_9762);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (25))){
var state_9804__$1 = state_9804;
var statearr_9824_9861 = state_9804__$1;
(statearr_9824_9861[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (17))){
var inst_9750 = (state_9804[(18)]);
var inst_9758 = (state_9804[(14)]);
var inst_9780 = (inst_9750.cljs$core$IFn$_invoke$arity$1 ? inst_9750.cljs$core$IFn$_invoke$arity$1(inst_9758) : inst_9750.call(null,inst_9758));
var inst_9781 = cljs.core.not(inst_9780);
var state_9804__$1 = state_9804;
var statearr_9825_9862 = state_9804__$1;
(statearr_9825_9862[(2)] = inst_9781);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (3))){
var inst_9802 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9804__$1,inst_9802);
} else {
if((state_val_9805 === (12))){
var state_9804__$1 = state_9804;
var statearr_9826_9863 = state_9804__$1;
(statearr_9826_9863[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (2))){
var inst_9748 = (state_9804[(12)]);
var inst_9745 = (state_9804[(11)]);
var inst_9748__$1 = cljs.core.__destructure_map(inst_9745);
var inst_9749 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9748__$1,cljs.core.cst$kw$solos);
var inst_9750 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9748__$1,cljs.core.cst$kw$mutes);
var inst_9751 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9748__$1,cljs.core.cst$kw$reads);
var state_9804__$1 = (function (){var statearr_9827 = state_9804;
(statearr_9827[(18)] = inst_9750);

(statearr_9827[(16)] = inst_9749);

(statearr_9827[(12)] = inst_9748__$1);

return statearr_9827;
})();
return cljs.core.async.ioc_alts_BANG_(state_9804__$1,(4),inst_9751);
} else {
if((state_val_9805 === (23))){
var inst_9789 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
if(cljs.core.truth_(inst_9789)){
var statearr_9828_9864 = state_9804__$1;
(statearr_9828_9864[(1)] = (24));

} else {
var statearr_9829_9865 = state_9804__$1;
(statearr_9829_9865[(1)] = (25));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (19))){
var inst_9784 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
var statearr_9830_9866 = state_9804__$1;
(statearr_9830_9866[(2)] = inst_9784);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (11))){
var inst_9758 = (state_9804[(14)]);
var inst_9768 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(cs,cljs.core.dissoc,inst_9758);
var state_9804__$1 = state_9804;
var statearr_9831_9867 = state_9804__$1;
(statearr_9831_9867[(2)] = inst_9768);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (9))){
var inst_9775 = (state_9804[(19)]);
var inst_9749 = (state_9804[(16)]);
var inst_9758 = (state_9804[(14)]);
var inst_9775__$1 = (inst_9749.cljs$core$IFn$_invoke$arity$1 ? inst_9749.cljs$core$IFn$_invoke$arity$1(inst_9758) : inst_9749.call(null,inst_9758));
var state_9804__$1 = (function (){var statearr_9832 = state_9804;
(statearr_9832[(19)] = inst_9775__$1);

return statearr_9832;
})();
if(cljs.core.truth_(inst_9775__$1)){
var statearr_9833_9868 = state_9804__$1;
(statearr_9833_9868[(1)] = (14));

} else {
var statearr_9834_9869 = state_9804__$1;
(statearr_9834_9869[(1)] = (15));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (5))){
var inst_9759 = (state_9804[(13)]);
var state_9804__$1 = state_9804;
var statearr_9835_9870 = state_9804__$1;
(statearr_9835_9870[(2)] = inst_9759);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (14))){
var inst_9775 = (state_9804[(19)]);
var state_9804__$1 = state_9804;
var statearr_9836_9871 = state_9804__$1;
(statearr_9836_9871[(2)] = inst_9775);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (26))){
var inst_9794 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
var statearr_9837_9872 = state_9804__$1;
(statearr_9837_9872[(2)] = inst_9794);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (16))){
var inst_9786 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
if(cljs.core.truth_(inst_9786)){
var statearr_9838_9873 = state_9804__$1;
(statearr_9838_9873[(1)] = (20));

} else {
var statearr_9839_9874 = state_9804__$1;
(statearr_9839_9874[(1)] = (21));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (10))){
var inst_9800 = (state_9804[(2)]);
var state_9804__$1 = state_9804;
var statearr_9840_9875 = state_9804__$1;
(statearr_9840_9875[(2)] = inst_9800);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (18))){
var inst_9778 = (state_9804[(15)]);
var state_9804__$1 = state_9804;
var statearr_9841_9876 = state_9804__$1;
(statearr_9841_9876[(2)] = inst_9778);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9805 === (8))){
var inst_9757 = (state_9804[(7)]);
var inst_9766 = (inst_9757 == null);
var state_9804__$1 = state_9804;
if(cljs.core.truth_(inst_9766)){
var statearr_9842_9877 = state_9804__$1;
(statearr_9842_9877[(1)] = (11));

} else {
var statearr_9843_9878 = state_9804__$1;
(statearr_9843_9878[(1)] = (12));

}

return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mix_$_state_machine__8772__auto__ = null;
var cljs$core$async$mix_$_state_machine__8772__auto____0 = (function (){
var statearr_9844 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_9844[(0)] = cljs$core$async$mix_$_state_machine__8772__auto__);

(statearr_9844[(1)] = (1));

return statearr_9844;
});
var cljs$core$async$mix_$_state_machine__8772__auto____1 = (function (state_9804){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9804);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e9845){if((e9845 instanceof Object)){
var ex__8775__auto__ = e9845;
var statearr_9846_9879 = state_9804;
(statearr_9846_9879[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9804);

return cljs.core.cst$kw$recur;
} else {
throw e9845;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__9880 = state_9804;
state_9804 = G__9880;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__8772__auto__ = function(state_9804){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__8772__auto____1.call(this,state_9804);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__8772__auto____0;
cljs$core$async$mix_$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__8772__auto____1;
return cljs$core$async$mix_$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_9847 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_9847[(6)] = c__8878__auto___9848);

return statearr_9847;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


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

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

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

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

var cljs$core$async$Pub$unsub_all_STAR_$dyn_9885 = (function() {
var G__9886 = null;
var G__9886__1 = (function (p){
var x__5393__auto__ = (((p == null))?null:p);
var m__5394__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5394__auto__.call(null,p));
} else {
var m__5392__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5392__auto__.call(null,p));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
var G__9886__2 = (function (p,v){
var x__5393__auto__ = (((p == null))?null:p);
var m__5394__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5394__auto__.call(null,p,v));
} else {
var m__5392__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5392__auto__.call(null,p,v));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
G__9886 = function(p,v){
switch(arguments.length){
case 1:
return G__9886__1.call(this,p);
case 2:
return G__9886__2.call(this,p,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__9886.cljs$core$IFn$_invoke$arity$1 = G__9886__1;
G__9886.cljs$core$IFn$_invoke$arity$2 = G__9886__2;
return G__9886;
})()
;
cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__9882 = arguments.length;
switch (G__9882) {
case 1:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

(cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1 = (function (p){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$1 == null)))))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1(p);
} else {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_9885.cljs$core$IFn$_invoke$arity$1(p);
}
}));

(cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2 = (function (p,v){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$2 == null)))))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$2(p,v);
} else {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_9885.cljs$core$IFn$_invoke$arity$2(p,v);
}
}));

(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__9890 = arguments.length;
switch (G__9890) {
case 2:
return cljs.core.async.pub.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3 = (function (ch,topic_fn,buf_fn){
var mults = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var ensure_mult = (function (topic){
var or__5045__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(mults),topic);
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(mults,(function (p1__9888_SHARP_){
if(cljs.core.truth_((p1__9888_SHARP_.cljs$core$IFn$_invoke$arity$1 ? p1__9888_SHARP_.cljs$core$IFn$_invoke$arity$1(topic) : p1__9888_SHARP_.call(null,topic)))){
return p1__9888_SHARP_;
} else {
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(p1__9888_SHARP_,topic,cljs.core.async.mult(cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((buf_fn.cljs$core$IFn$_invoke$arity$1 ? buf_fn.cljs$core$IFn$_invoke$arity$1(topic) : buf_fn.call(null,topic)))));
}
})),topic);
}
});
var p = (function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async9891 !== '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$async9891 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta9892){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta9892 = meta9892;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async9891.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_9893,meta9892__$1){
var self__ = this;
var _9893__$1 = this;
return (new cljs.core.async.t_cljs$core$async9891(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta9892__$1));
}));

(cljs.core.async.t_cljs$core$async9891.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_9893){
var self__ = this;
var _9893__$1 = this;
return self__.meta9892;
}));

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

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

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

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

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

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

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

(cljs.core.async.t_cljs$core$async9891.getBasis = (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$ch,cljs.core.cst$sym$topic_DASH_fn,cljs.core.cst$sym$buf_DASH_fn,cljs.core.cst$sym$mults,cljs.core.cst$sym$ensure_DASH_mult,cljs.core.cst$sym$meta9892], null);
}));

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

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

(cljs.core.async.t_cljs$core$async9891.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async9891");
}));

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

}

return (new cljs.core.async.t_cljs$core$async9891(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__8878__auto___10011 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_9965){
var state_val_9966 = (state_9965[(1)]);
if((state_val_9966 === (7))){
var inst_9961 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_9967_10012 = state_9965__$1;
(statearr_9967_10012[(2)] = inst_9961);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (20))){
var state_9965__$1 = state_9965;
var statearr_9968_10013 = state_9965__$1;
(statearr_9968_10013[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (1))){
var state_9965__$1 = state_9965;
var statearr_9969_10014 = state_9965__$1;
(statearr_9969_10014[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (24))){
var inst_9944 = (state_9965[(7)]);
var inst_9953 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(mults,cljs.core.dissoc,inst_9944);
var state_9965__$1 = state_9965;
var statearr_9970_10015 = state_9965__$1;
(statearr_9970_10015[(2)] = inst_9953);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (4))){
var inst_9896 = (state_9965[(8)]);
var inst_9896__$1 = (state_9965[(2)]);
var inst_9897 = (inst_9896__$1 == null);
var state_9965__$1 = (function (){var statearr_9971 = state_9965;
(statearr_9971[(8)] = inst_9896__$1);

return statearr_9971;
})();
if(cljs.core.truth_(inst_9897)){
var statearr_9972_10016 = state_9965__$1;
(statearr_9972_10016[(1)] = (5));

} else {
var statearr_9973_10017 = state_9965__$1;
(statearr_9973_10017[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (15))){
var inst_9938 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_9974_10018 = state_9965__$1;
(statearr_9974_10018[(2)] = inst_9938);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (21))){
var inst_9958 = (state_9965[(2)]);
var state_9965__$1 = (function (){var statearr_9975 = state_9965;
(statearr_9975[(9)] = inst_9958);

return statearr_9975;
})();
var statearr_9976_10019 = state_9965__$1;
(statearr_9976_10019[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (13))){
var inst_9920 = (state_9965[(10)]);
var inst_9922 = cljs.core.chunked_seq_QMARK_(inst_9920);
var state_9965__$1 = state_9965;
if(inst_9922){
var statearr_9977_10020 = state_9965__$1;
(statearr_9977_10020[(1)] = (16));

} else {
var statearr_9978_10021 = state_9965__$1;
(statearr_9978_10021[(1)] = (17));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (22))){
var inst_9950 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
if(cljs.core.truth_(inst_9950)){
var statearr_9979_10022 = state_9965__$1;
(statearr_9979_10022[(1)] = (23));

} else {
var statearr_9980_10023 = state_9965__$1;
(statearr_9980_10023[(1)] = (24));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (6))){
var inst_9896 = (state_9965[(8)]);
var inst_9944 = (state_9965[(7)]);
var inst_9946 = (state_9965[(11)]);
var inst_9944__$1 = (topic_fn.cljs$core$IFn$_invoke$arity$1 ? topic_fn.cljs$core$IFn$_invoke$arity$1(inst_9896) : topic_fn.call(null,inst_9896));
var inst_9945 = cljs.core.deref(mults);
var inst_9946__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_9945,inst_9944__$1);
var state_9965__$1 = (function (){var statearr_9981 = state_9965;
(statearr_9981[(7)] = inst_9944__$1);

(statearr_9981[(11)] = inst_9946__$1);

return statearr_9981;
})();
if(cljs.core.truth_(inst_9946__$1)){
var statearr_9982_10024 = state_9965__$1;
(statearr_9982_10024[(1)] = (19));

} else {
var statearr_9983_10025 = state_9965__$1;
(statearr_9983_10025[(1)] = (20));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (25))){
var inst_9955 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_9984_10026 = state_9965__$1;
(statearr_9984_10026[(2)] = inst_9955);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (17))){
var inst_9920 = (state_9965[(10)]);
var inst_9929 = cljs.core.first(inst_9920);
var inst_9930 = cljs.core.async.muxch_STAR_(inst_9929);
var inst_9931 = cljs.core.async.close_BANG_(inst_9930);
var inst_9932 = cljs.core.next(inst_9920);
var inst_9906 = inst_9932;
var inst_9907 = null;
var inst_9908 = (0);
var inst_9909 = (0);
var state_9965__$1 = (function (){var statearr_9985 = state_9965;
(statearr_9985[(12)] = inst_9909);

(statearr_9985[(13)] = inst_9906);

(statearr_9985[(14)] = inst_9908);

(statearr_9985[(15)] = inst_9907);

(statearr_9985[(16)] = inst_9931);

return statearr_9985;
})();
var statearr_9986_10027 = state_9965__$1;
(statearr_9986_10027[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (3))){
var inst_9963 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
return cljs.core.async.impl.ioc_helpers.return_chan(state_9965__$1,inst_9963);
} else {
if((state_val_9966 === (12))){
var inst_9940 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_9987_10028 = state_9965__$1;
(statearr_9987_10028[(2)] = inst_9940);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (2))){
var state_9965__$1 = state_9965;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_9965__$1,(4),ch);
} else {
if((state_val_9966 === (23))){
var state_9965__$1 = state_9965;
var statearr_9988_10029 = state_9965__$1;
(statearr_9988_10029[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (19))){
var inst_9896 = (state_9965[(8)]);
var inst_9946 = (state_9965[(11)]);
var inst_9948 = cljs.core.async.muxch_STAR_(inst_9946);
var state_9965__$1 = state_9965;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_9965__$1,(22),inst_9948,inst_9896);
} else {
if((state_val_9966 === (11))){
var inst_9906 = (state_9965[(13)]);
var inst_9920 = (state_9965[(10)]);
var inst_9920__$1 = cljs.core.seq(inst_9906);
var state_9965__$1 = (function (){var statearr_9989 = state_9965;
(statearr_9989[(10)] = inst_9920__$1);

return statearr_9989;
})();
if(inst_9920__$1){
var statearr_9990_10030 = state_9965__$1;
(statearr_9990_10030[(1)] = (13));

} else {
var statearr_9991_10031 = state_9965__$1;
(statearr_9991_10031[(1)] = (14));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (9))){
var inst_9942 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_9992_10032 = state_9965__$1;
(statearr_9992_10032[(2)] = inst_9942);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (5))){
var inst_9903 = cljs.core.deref(mults);
var inst_9904 = cljs.core.vals(inst_9903);
var inst_9905 = cljs.core.seq(inst_9904);
var inst_9906 = inst_9905;
var inst_9907 = null;
var inst_9908 = (0);
var inst_9909 = (0);
var state_9965__$1 = (function (){var statearr_9993 = state_9965;
(statearr_9993[(12)] = inst_9909);

(statearr_9993[(13)] = inst_9906);

(statearr_9993[(14)] = inst_9908);

(statearr_9993[(15)] = inst_9907);

return statearr_9993;
})();
var statearr_9994_10033 = state_9965__$1;
(statearr_9994_10033[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (14))){
var state_9965__$1 = state_9965;
var statearr_9998_10034 = state_9965__$1;
(statearr_9998_10034[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (16))){
var inst_9920 = (state_9965[(10)]);
var inst_9924 = cljs.core.chunk_first(inst_9920);
var inst_9925 = cljs.core.chunk_rest(inst_9920);
var inst_9926 = cljs.core.count(inst_9924);
var inst_9906 = inst_9925;
var inst_9907 = inst_9924;
var inst_9908 = inst_9926;
var inst_9909 = (0);
var state_9965__$1 = (function (){var statearr_9999 = state_9965;
(statearr_9999[(12)] = inst_9909);

(statearr_9999[(13)] = inst_9906);

(statearr_9999[(14)] = inst_9908);

(statearr_9999[(15)] = inst_9907);

return statearr_9999;
})();
var statearr_10000_10035 = state_9965__$1;
(statearr_10000_10035[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (10))){
var inst_9909 = (state_9965[(12)]);
var inst_9906 = (state_9965[(13)]);
var inst_9908 = (state_9965[(14)]);
var inst_9907 = (state_9965[(15)]);
var inst_9914 = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(inst_9907,inst_9909);
var inst_9915 = cljs.core.async.muxch_STAR_(inst_9914);
var inst_9916 = cljs.core.async.close_BANG_(inst_9915);
var inst_9917 = (inst_9909 + (1));
var tmp9995 = inst_9906;
var tmp9996 = inst_9908;
var tmp9997 = inst_9907;
var inst_9906__$1 = tmp9995;
var inst_9907__$1 = tmp9997;
var inst_9908__$1 = tmp9996;
var inst_9909__$1 = inst_9917;
var state_9965__$1 = (function (){var statearr_10001 = state_9965;
(statearr_10001[(12)] = inst_9909__$1);

(statearr_10001[(17)] = inst_9916);

(statearr_10001[(13)] = inst_9906__$1);

(statearr_10001[(14)] = inst_9908__$1);

(statearr_10001[(15)] = inst_9907__$1);

return statearr_10001;
})();
var statearr_10002_10036 = state_9965__$1;
(statearr_10002_10036[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (18))){
var inst_9935 = (state_9965[(2)]);
var state_9965__$1 = state_9965;
var statearr_10003_10037 = state_9965__$1;
(statearr_10003_10037[(2)] = inst_9935);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_9966 === (8))){
var inst_9909 = (state_9965[(12)]);
var inst_9908 = (state_9965[(14)]);
var inst_9911 = (inst_9909 < inst_9908);
var inst_9912 = inst_9911;
var state_9965__$1 = state_9965;
if(cljs.core.truth_(inst_9912)){
var statearr_10004_10038 = state_9965__$1;
(statearr_10004_10038[(1)] = (10));

} else {
var statearr_10005_10039 = state_9965__$1;
(statearr_10005_10039[(1)] = (11));

}

return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10006 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10006[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10006[(1)] = (1));

return statearr_10006;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_9965){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_9965);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10007){if((e10007 instanceof Object)){
var ex__8775__auto__ = e10007;
var statearr_10008_10040 = state_9965;
(statearr_10008_10040[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_9965);

return cljs.core.cst$kw$recur;
} else {
throw e10007;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10041 = state_9965;
state_9965 = G__10041;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_9965){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_9965);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10009 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10009[(6)] = c__8878__auto___10011);

return statearr_10009;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return p;
}));

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

/**
 * Subscribes a channel to a topic of a pub.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.sub = (function cljs$core$async$sub(var_args){
var G__10043 = arguments.length;
switch (G__10043) {
case 3:
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

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

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

}
});

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

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

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

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

(cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2 = (function (p,topic){
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2(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__10049 = arguments.length;
switch (G__10049) {
case 2:
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

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

if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,rets.slice((0)));
} else {
return null;
}
});
}),cljs.core.range.cljs$core$IFn$_invoke$arity$1(cnt));
var c__8878__auto___10116 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10088){
var state_val_10089 = (state_10088[(1)]);
if((state_val_10089 === (7))){
var state_10088__$1 = state_10088;
var statearr_10090_10117 = state_10088__$1;
(statearr_10090_10117[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (1))){
var state_10088__$1 = state_10088;
var statearr_10091_10118 = state_10088__$1;
(statearr_10091_10118[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (4))){
var inst_10052 = (state_10088[(7)]);
var inst_10054 = (inst_10052 < cnt);
var state_10088__$1 = state_10088;
if(cljs.core.truth_(inst_10054)){
var statearr_10092_10119 = state_10088__$1;
(statearr_10092_10119[(1)] = (6));

} else {
var statearr_10093_10120 = state_10088__$1;
(statearr_10093_10120[(1)] = (7));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (15))){
var inst_10084 = (state_10088[(2)]);
var state_10088__$1 = state_10088;
var statearr_10094_10121 = state_10088__$1;
(statearr_10094_10121[(2)] = inst_10084);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (13))){
var inst_10077 = cljs.core.async.close_BANG_(out);
var state_10088__$1 = state_10088;
var statearr_10095_10122 = state_10088__$1;
(statearr_10095_10122[(2)] = inst_10077);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (6))){
var state_10088__$1 = state_10088;
var statearr_10096_10123 = state_10088__$1;
(statearr_10096_10123[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (3))){
var inst_10086 = (state_10088[(2)]);
var state_10088__$1 = state_10088;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10088__$1,inst_10086);
} else {
if((state_val_10089 === (12))){
var inst_10074 = (state_10088[(8)]);
var inst_10074__$1 = (state_10088[(2)]);
var inst_10075 = cljs.core.some(cljs.core.nil_QMARK_,inst_10074__$1);
var state_10088__$1 = (function (){var statearr_10097 = state_10088;
(statearr_10097[(8)] = inst_10074__$1);

return statearr_10097;
})();
if(cljs.core.truth_(inst_10075)){
var statearr_10098_10124 = state_10088__$1;
(statearr_10098_10124[(1)] = (13));

} else {
var statearr_10099_10125 = state_10088__$1;
(statearr_10099_10125[(1)] = (14));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (2))){
var inst_10051 = cljs.core.reset_BANG_(dctr,cnt);
var inst_10052 = (0);
var state_10088__$1 = (function (){var statearr_10100 = state_10088;
(statearr_10100[(9)] = inst_10051);

(statearr_10100[(7)] = inst_10052);

return statearr_10100;
})();
var statearr_10101_10126 = state_10088__$1;
(statearr_10101_10126[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (11))){
var inst_10052 = (state_10088[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame(state_10088,(10),Object,null,(9));
var inst_10061 = (chs__$1.cljs$core$IFn$_invoke$arity$1 ? chs__$1.cljs$core$IFn$_invoke$arity$1(inst_10052) : chs__$1.call(null,inst_10052));
var inst_10062 = (done.cljs$core$IFn$_invoke$arity$1 ? done.cljs$core$IFn$_invoke$arity$1(inst_10052) : done.call(null,inst_10052));
var inst_10063 = cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2(inst_10061,inst_10062);
var state_10088__$1 = state_10088;
var statearr_10102_10127 = state_10088__$1;
(statearr_10102_10127[(2)] = inst_10063);


cljs.core.async.impl.ioc_helpers.process_exception(state_10088__$1);

return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (9))){
var inst_10052 = (state_10088[(7)]);
var inst_10065 = (state_10088[(2)]);
var inst_10066 = (inst_10052 + (1));
var inst_10052__$1 = inst_10066;
var state_10088__$1 = (function (){var statearr_10103 = state_10088;
(statearr_10103[(7)] = inst_10052__$1);

(statearr_10103[(10)] = inst_10065);

return statearr_10103;
})();
var statearr_10104_10128 = state_10088__$1;
(statearr_10104_10128[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (5))){
var inst_10072 = (state_10088[(2)]);
var state_10088__$1 = (function (){var statearr_10105 = state_10088;
(statearr_10105[(11)] = inst_10072);

return statearr_10105;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10088__$1,(12),dchan);
} else {
if((state_val_10089 === (14))){
var inst_10074 = (state_10088[(8)]);
var inst_10079 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(f,inst_10074);
var state_10088__$1 = state_10088;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10088__$1,(16),out,inst_10079);
} else {
if((state_val_10089 === (16))){
var inst_10081 = (state_10088[(2)]);
var state_10088__$1 = (function (){var statearr_10106 = state_10088;
(statearr_10106[(12)] = inst_10081);

return statearr_10106;
})();
var statearr_10107_10129 = state_10088__$1;
(statearr_10107_10129[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (10))){
var inst_10056 = (state_10088[(2)]);
var inst_10057 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec);
var state_10088__$1 = (function (){var statearr_10108 = state_10088;
(statearr_10108[(13)] = inst_10056);

return statearr_10108;
})();
var statearr_10109_10130 = state_10088__$1;
(statearr_10109_10130[(2)] = inst_10057);


cljs.core.async.impl.ioc_helpers.process_exception(state_10088__$1);

return cljs.core.cst$kw$recur;
} else {
if((state_val_10089 === (8))){
var inst_10070 = (state_10088[(2)]);
var state_10088__$1 = state_10088;
var statearr_10110_10131 = state_10088__$1;
(statearr_10110_10131[(2)] = inst_10070);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10111 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10111[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10111[(1)] = (1));

return statearr_10111;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10088){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10088);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10112){if((e10112 instanceof Object)){
var ex__8775__auto__ = e10112;
var statearr_10113_10132 = state_10088;
(statearr_10113_10132[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10088);

return cljs.core.cst$kw$recur;
} else {
throw e10112;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10133 = state_10088;
state_10088 = G__10133;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10088){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10088);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10114 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10114[(6)] = c__8878__auto___10116);

return statearr_10114;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

/**
 * Takes a collection of source channels and returns a channel which
 *   contains all values taken from them. The returned channel will be
 *   unbuffered by default, or a buf-or-n can be supplied. The channel
 *   will close after all the source channels have closed.
 */
cljs.core.async.merge = (function cljs$core$async$merge(var_args){
var G__10136 = arguments.length;
switch (G__10136) {
case 1:
return cljs.core.async.merge.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

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

(cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10190 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10168){
var state_val_10169 = (state_10168[(1)]);
if((state_val_10169 === (7))){
var inst_10148 = (state_10168[(7)]);
var inst_10147 = (state_10168[(8)]);
var inst_10147__$1 = (state_10168[(2)]);
var inst_10148__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_10147__$1,(0),null);
var inst_10149 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_10147__$1,(1),null);
var inst_10150 = (inst_10148__$1 == null);
var state_10168__$1 = (function (){var statearr_10170 = state_10168;
(statearr_10170[(7)] = inst_10148__$1);

(statearr_10170[(9)] = inst_10149);

(statearr_10170[(8)] = inst_10147__$1);

return statearr_10170;
})();
if(cljs.core.truth_(inst_10150)){
var statearr_10171_10191 = state_10168__$1;
(statearr_10171_10191[(1)] = (8));

} else {
var statearr_10172_10192 = state_10168__$1;
(statearr_10172_10192[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (1))){
var inst_10137 = cljs.core.vec(chs);
var inst_10138 = inst_10137;
var state_10168__$1 = (function (){var statearr_10173 = state_10168;
(statearr_10173[(10)] = inst_10138);

return statearr_10173;
})();
var statearr_10174_10193 = state_10168__$1;
(statearr_10174_10193[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (4))){
var inst_10138 = (state_10168[(10)]);
var state_10168__$1 = state_10168;
return cljs.core.async.ioc_alts_BANG_(state_10168__$1,(7),inst_10138);
} else {
if((state_val_10169 === (6))){
var inst_10164 = (state_10168[(2)]);
var state_10168__$1 = state_10168;
var statearr_10175_10194 = state_10168__$1;
(statearr_10175_10194[(2)] = inst_10164);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (3))){
var inst_10166 = (state_10168[(2)]);
var state_10168__$1 = state_10168;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10168__$1,inst_10166);
} else {
if((state_val_10169 === (2))){
var inst_10138 = (state_10168[(10)]);
var inst_10140 = cljs.core.count(inst_10138);
var inst_10141 = (inst_10140 > (0));
var state_10168__$1 = state_10168;
if(cljs.core.truth_(inst_10141)){
var statearr_10177_10195 = state_10168__$1;
(statearr_10177_10195[(1)] = (4));

} else {
var statearr_10178_10196 = state_10168__$1;
(statearr_10178_10196[(1)] = (5));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (11))){
var inst_10138 = (state_10168[(10)]);
var inst_10157 = (state_10168[(2)]);
var tmp10176 = inst_10138;
var inst_10138__$1 = tmp10176;
var state_10168__$1 = (function (){var statearr_10179 = state_10168;
(statearr_10179[(10)] = inst_10138__$1);

(statearr_10179[(11)] = inst_10157);

return statearr_10179;
})();
var statearr_10180_10197 = state_10168__$1;
(statearr_10180_10197[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (9))){
var inst_10148 = (state_10168[(7)]);
var state_10168__$1 = state_10168;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10168__$1,(11),out,inst_10148);
} else {
if((state_val_10169 === (5))){
var inst_10162 = cljs.core.async.close_BANG_(out);
var state_10168__$1 = state_10168;
var statearr_10181_10198 = state_10168__$1;
(statearr_10181_10198[(2)] = inst_10162);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (10))){
var inst_10160 = (state_10168[(2)]);
var state_10168__$1 = state_10168;
var statearr_10182_10199 = state_10168__$1;
(statearr_10182_10199[(2)] = inst_10160);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10169 === (8))){
var inst_10148 = (state_10168[(7)]);
var inst_10138 = (state_10168[(10)]);
var inst_10149 = (state_10168[(9)]);
var inst_10147 = (state_10168[(8)]);
var inst_10152 = (function (){var cs = inst_10138;
var vec__10143 = inst_10147;
var v = inst_10148;
var c = inst_10149;
return (function (p1__10134_SHARP_){
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(c,p1__10134_SHARP_);
});
})();
var inst_10153 = cljs.core.filterv(inst_10152,inst_10138);
var inst_10138__$1 = inst_10153;
var state_10168__$1 = (function (){var statearr_10183 = state_10168;
(statearr_10183[(10)] = inst_10138__$1);

return statearr_10183;
})();
var statearr_10184_10200 = state_10168__$1;
(statearr_10184_10200[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10185 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10185[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10185[(1)] = (1));

return statearr_10185;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10168){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10168);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10186){if((e10186 instanceof Object)){
var ex__8775__auto__ = e10186;
var statearr_10187_10201 = state_10168;
(statearr_10187_10201[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10168);

return cljs.core.cst$kw$recur;
} else {
throw e10186;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10202 = state_10168;
state_10168 = G__10202;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10168){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10168);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10188 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10188[(6)] = c__8878__auto___10190);

return statearr_10188;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

/**
 * Returns a channel containing the single (collection) result of the
 *   items taken from the channel conjoined to the supplied
 *   collection. ch must close before into produces a result.
 */
cljs.core.async.into = (function cljs$core$async$into(coll,ch){
return cljs.core.async.reduce(cljs.core.conj,coll,ch);
});
/**
 * Returns a channel that will return, at most, n items from ch. After n items
 * have been returned, or ch has been closed, the return chanel will close.
 * 
 *   The output channel is unbuffered by default, unless buf-or-n is given.
 */
cljs.core.async.take = (function cljs$core$async$take(var_args){
var G__10204 = arguments.length;
switch (G__10204) {
case 2:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.take.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10249 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10228){
var state_val_10229 = (state_10228[(1)]);
if((state_val_10229 === (7))){
var inst_10210 = (state_10228[(7)]);
var inst_10210__$1 = (state_10228[(2)]);
var inst_10211 = (inst_10210__$1 == null);
var inst_10212 = cljs.core.not(inst_10211);
var state_10228__$1 = (function (){var statearr_10230 = state_10228;
(statearr_10230[(7)] = inst_10210__$1);

return statearr_10230;
})();
if(inst_10212){
var statearr_10231_10250 = state_10228__$1;
(statearr_10231_10250[(1)] = (8));

} else {
var statearr_10232_10251 = state_10228__$1;
(statearr_10232_10251[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (1))){
var inst_10205 = (0);
var state_10228__$1 = (function (){var statearr_10233 = state_10228;
(statearr_10233[(8)] = inst_10205);

return statearr_10233;
})();
var statearr_10234_10252 = state_10228__$1;
(statearr_10234_10252[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (4))){
var state_10228__$1 = state_10228;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10228__$1,(7),ch);
} else {
if((state_val_10229 === (6))){
var inst_10223 = (state_10228[(2)]);
var state_10228__$1 = state_10228;
var statearr_10235_10253 = state_10228__$1;
(statearr_10235_10253[(2)] = inst_10223);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (3))){
var inst_10225 = (state_10228[(2)]);
var inst_10226 = cljs.core.async.close_BANG_(out);
var state_10228__$1 = (function (){var statearr_10236 = state_10228;
(statearr_10236[(9)] = inst_10225);

return statearr_10236;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_10228__$1,inst_10226);
} else {
if((state_val_10229 === (2))){
var inst_10205 = (state_10228[(8)]);
var inst_10207 = (inst_10205 < n);
var state_10228__$1 = state_10228;
if(cljs.core.truth_(inst_10207)){
var statearr_10237_10254 = state_10228__$1;
(statearr_10237_10254[(1)] = (4));

} else {
var statearr_10238_10255 = state_10228__$1;
(statearr_10238_10255[(1)] = (5));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (11))){
var inst_10205 = (state_10228[(8)]);
var inst_10215 = (state_10228[(2)]);
var inst_10216 = (inst_10205 + (1));
var inst_10205__$1 = inst_10216;
var state_10228__$1 = (function (){var statearr_10239 = state_10228;
(statearr_10239[(8)] = inst_10205__$1);

(statearr_10239[(10)] = inst_10215);

return statearr_10239;
})();
var statearr_10240_10256 = state_10228__$1;
(statearr_10240_10256[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (9))){
var state_10228__$1 = state_10228;
var statearr_10241_10257 = state_10228__$1;
(statearr_10241_10257[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (5))){
var state_10228__$1 = state_10228;
var statearr_10242_10258 = state_10228__$1;
(statearr_10242_10258[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (10))){
var inst_10220 = (state_10228[(2)]);
var state_10228__$1 = state_10228;
var statearr_10243_10259 = state_10228__$1;
(statearr_10243_10259[(2)] = inst_10220);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10229 === (8))){
var inst_10210 = (state_10228[(7)]);
var state_10228__$1 = state_10228;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10228__$1,(11),out,inst_10210);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10244 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_10244[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10244[(1)] = (1));

return statearr_10244;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10228){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10228);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10245){if((e10245 instanceof Object)){
var ex__8775__auto__ = e10245;
var statearr_10246_10260 = state_10228;
(statearr_10246_10260[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10228);

return cljs.core.cst$kw$recur;
} else {
throw e10245;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10261 = state_10228;
state_10228 = G__10261;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10228){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10228);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10247 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10247[(6)] = c__8878__auto___10249);

return statearr_10247;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


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$async10263 !== '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$async10263 = (function (f,ch,meta10264){
this.f = f;
this.ch = ch;
this.meta10264 = meta10264;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async10263.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_10265,meta10264__$1){
var self__ = this;
var _10265__$1 = this;
return (new cljs.core.async.t_cljs$core$async10263(self__.f,self__.ch,meta10264__$1));
}));

(cljs.core.async.t_cljs$core$async10263.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_10265){
var self__ = this;
var _10265__$1 = this;
return self__.meta10264;
}));

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

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

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

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

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

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async10266 = (function (f,ch,meta10264,_,fn1,meta10267){
this.f = f;
this.ch = ch;
this.meta10264 = meta10264;
this._ = _;
this.fn1 = fn1;
this.meta10267 = meta10267;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async10266.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_10268,meta10267__$1){
var self__ = this;
var _10268__$1 = this;
return (new cljs.core.async.t_cljs$core$async10266(self__.f,self__.ch,self__.meta10264,self__._,self__.fn1,meta10267__$1));
}));

(cljs.core.async.t_cljs$core$async10266.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_10268){
var self__ = this;
var _10268__$1 = this;
return self__.meta10267;
}));

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

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

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

(cljs.core.async.t_cljs$core$async10266.getBasis = (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.cst$sym$ch,cljs.core.cst$sym$meta10264,cljs.core.with_meta(cljs.core.cst$sym$_,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$tag,cljs.core.cst$sym$cljs$core$async_SLASH_t_cljs$core$async10263], null)),cljs.core.cst$sym$fn1,cljs.core.cst$sym$meta10267], null);
}));

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

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

(cljs.core.async.t_cljs$core$async10266.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async10266");
}));

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

}

return (new cljs.core.async.t_cljs$core$async10266(self__.f,self__.ch,self__.meta10264,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__5043__auto__ = ret;
if(cljs.core.truth_(and__5043__auto__)){
return (!((cljs.core.deref(ret) == null)));
} else {
return and__5043__auto__;
}
})())){
return cljs.core.async.impl.channels.box((function (){var G__10270 = cljs.core.deref(ret);
return (self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(G__10270) : self__.f.call(null,G__10270));
})());
} else {
return ret;
}
}));

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

(cljs.core.async.t_cljs$core$async10263.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_(self__.ch,val,fn1);
}));

(cljs.core.async.t_cljs$core$async10263.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.cst$sym$ch,cljs.core.cst$sym$meta10264], null);
}));

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

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

(cljs.core.async.t_cljs$core$async10263.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async10263");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async10263.
 */
cljs.core.async.__GT_t_cljs$core$async10263 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async10263(f__$1,ch__$1,meta10264){
return (new cljs.core.async.t_cljs$core$async10263(f__$1,ch__$1,meta10264));
});

}

return (new cljs.core.async.t_cljs$core$async10263(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$async10271 !== '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$async10271 = (function (f,ch,meta10272){
this.f = f;
this.ch = ch;
this.meta10272 = meta10272;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async10271.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_10273,meta10272__$1){
var self__ = this;
var _10273__$1 = this;
return (new cljs.core.async.t_cljs$core$async10271(self__.f,self__.ch,meta10272__$1));
}));

(cljs.core.async.t_cljs$core$async10271.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_10273){
var self__ = this;
var _10273__$1 = this;
return self__.meta10272;
}));

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

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

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

(cljs.core.async.t_cljs$core$async10271.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_(self__.ch,fn1);
}));

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

(cljs.core.async.t_cljs$core$async10271.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_(self__.ch,(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(val) : self__.f.call(null,val)),fn1);
}));

(cljs.core.async.t_cljs$core$async10271.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.cst$sym$ch,cljs.core.cst$sym$meta10272], null);
}));

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

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

(cljs.core.async.t_cljs$core$async10271.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async10271");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async10271.
 */
cljs.core.async.__GT_t_cljs$core$async10271 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async10271(f__$1,ch__$1,meta10272){
return (new cljs.core.async.t_cljs$core$async10271(f__$1,ch__$1,meta10272));
});

}

return (new cljs.core.async.t_cljs$core$async10271(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$async10274 !== '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$async10274 = (function (p,ch,meta10275){
this.p = p;
this.ch = ch;
this.meta10275 = meta10275;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async10274.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_10276,meta10275__$1){
var self__ = this;
var _10276__$1 = this;
return (new cljs.core.async.t_cljs$core$async10274(self__.p,self__.ch,meta10275__$1));
}));

(cljs.core.async.t_cljs$core$async10274.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_10276){
var self__ = this;
var _10276__$1 = this;
return self__.meta10275;
}));

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

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

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

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

(cljs.core.async.t_cljs$core$async10274.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_(self__.ch,fn1);
}));

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

(cljs.core.async.t_cljs$core$async10274.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_((self__.p.cljs$core$IFn$_invoke$arity$1 ? self__.p.cljs$core$IFn$_invoke$arity$1(val) : self__.p.call(null,val)))){
return cljs.core.async.impl.protocols.put_BANG_(self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box(cljs.core.not(cljs.core.async.impl.protocols.closed_QMARK_(self__.ch)));
}
}));

(cljs.core.async.t_cljs$core$async10274.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$p,cljs.core.cst$sym$ch,cljs.core.cst$sym$meta10275], null);
}));

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

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

(cljs.core.async.t_cljs$core$async10274.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async/t_cljs$core$async10274");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async10274.
 */
cljs.core.async.__GT_t_cljs$core$async10274 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async10274(p__$1,ch__$1,meta10275){
return (new cljs.core.async.t_cljs$core$async10274(p__$1,ch__$1,meta10275));
});

}

return (new cljs.core.async.t_cljs$core$async10274(p,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_GT_ = (function cljs$core$async$remove_GT_(p,ch){
return cljs.core.async.filter_GT_(cljs.core.complement(p),ch);
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_LT_ = (function cljs$core$async$filter_LT_(var_args){
var G__10278 = arguments.length;
switch (G__10278) {
case 2:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10318 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10299){
var state_val_10300 = (state_10299[(1)]);
if((state_val_10300 === (7))){
var inst_10295 = (state_10299[(2)]);
var state_10299__$1 = state_10299;
var statearr_10301_10319 = state_10299__$1;
(statearr_10301_10319[(2)] = inst_10295);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (1))){
var state_10299__$1 = state_10299;
var statearr_10302_10320 = state_10299__$1;
(statearr_10302_10320[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (4))){
var inst_10281 = (state_10299[(7)]);
var inst_10281__$1 = (state_10299[(2)]);
var inst_10282 = (inst_10281__$1 == null);
var state_10299__$1 = (function (){var statearr_10303 = state_10299;
(statearr_10303[(7)] = inst_10281__$1);

return statearr_10303;
})();
if(cljs.core.truth_(inst_10282)){
var statearr_10304_10321 = state_10299__$1;
(statearr_10304_10321[(1)] = (5));

} else {
var statearr_10305_10322 = state_10299__$1;
(statearr_10305_10322[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (6))){
var inst_10281 = (state_10299[(7)]);
var inst_10286 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_10281) : p.call(null,inst_10281));
var state_10299__$1 = state_10299;
if(cljs.core.truth_(inst_10286)){
var statearr_10306_10323 = state_10299__$1;
(statearr_10306_10323[(1)] = (8));

} else {
var statearr_10307_10324 = state_10299__$1;
(statearr_10307_10324[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (3))){
var inst_10297 = (state_10299[(2)]);
var state_10299__$1 = state_10299;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10299__$1,inst_10297);
} else {
if((state_val_10300 === (2))){
var state_10299__$1 = state_10299;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10299__$1,(4),ch);
} else {
if((state_val_10300 === (11))){
var inst_10289 = (state_10299[(2)]);
var state_10299__$1 = state_10299;
var statearr_10308_10325 = state_10299__$1;
(statearr_10308_10325[(2)] = inst_10289);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (9))){
var state_10299__$1 = state_10299;
var statearr_10309_10326 = state_10299__$1;
(statearr_10309_10326[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (5))){
var inst_10284 = cljs.core.async.close_BANG_(out);
var state_10299__$1 = state_10299;
var statearr_10310_10327 = state_10299__$1;
(statearr_10310_10327[(2)] = inst_10284);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (10))){
var inst_10292 = (state_10299[(2)]);
var state_10299__$1 = (function (){var statearr_10311 = state_10299;
(statearr_10311[(8)] = inst_10292);

return statearr_10311;
})();
var statearr_10312_10328 = state_10299__$1;
(statearr_10312_10328[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10300 === (8))){
var inst_10281 = (state_10299[(7)]);
var state_10299__$1 = state_10299;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10299__$1,(11),out,inst_10281);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10313 = [null,null,null,null,null,null,null,null,null];
(statearr_10313[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10313[(1)] = (1));

return statearr_10313;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10299){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10299);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10314){if((e10314 instanceof Object)){
var ex__8775__auto__ = e10314;
var statearr_10315_10329 = state_10299;
(statearr_10315_10329[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10299);

return cljs.core.cst$kw$recur;
} else {
throw e10314;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10330 = state_10299;
state_10299 = G__10330;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10299){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10299);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10316 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10316[(6)] = c__8878__auto___10318);

return statearr_10316;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_LT_ = (function cljs$core$async$remove_LT_(var_args){
var G__10332 = arguments.length;
switch (G__10332) {
case 2:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3(cljs.core.complement(p),ch,buf_or_n);
}));

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

cljs.core.async.mapcat_STAR_ = (function cljs$core$async$mapcat_STAR_(f,in$,out){
var c__8878__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10395){
var state_val_10396 = (state_10395[(1)]);
if((state_val_10396 === (7))){
var inst_10391 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
var statearr_10397_10435 = state_10395__$1;
(statearr_10397_10435[(2)] = inst_10391);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (20))){
var inst_10361 = (state_10395[(7)]);
var inst_10372 = (state_10395[(2)]);
var inst_10373 = cljs.core.next(inst_10361);
var inst_10347 = inst_10373;
var inst_10348 = null;
var inst_10349 = (0);
var inst_10350 = (0);
var state_10395__$1 = (function (){var statearr_10398 = state_10395;
(statearr_10398[(8)] = inst_10350);

(statearr_10398[(9)] = inst_10348);

(statearr_10398[(10)] = inst_10349);

(statearr_10398[(11)] = inst_10372);

(statearr_10398[(12)] = inst_10347);

return statearr_10398;
})();
var statearr_10399_10436 = state_10395__$1;
(statearr_10399_10436[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (1))){
var state_10395__$1 = state_10395;
var statearr_10400_10437 = state_10395__$1;
(statearr_10400_10437[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (4))){
var inst_10336 = (state_10395[(13)]);
var inst_10336__$1 = (state_10395[(2)]);
var inst_10337 = (inst_10336__$1 == null);
var state_10395__$1 = (function (){var statearr_10401 = state_10395;
(statearr_10401[(13)] = inst_10336__$1);

return statearr_10401;
})();
if(cljs.core.truth_(inst_10337)){
var statearr_10402_10438 = state_10395__$1;
(statearr_10402_10438[(1)] = (5));

} else {
var statearr_10403_10439 = state_10395__$1;
(statearr_10403_10439[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (15))){
var state_10395__$1 = state_10395;
var statearr_10407_10440 = state_10395__$1;
(statearr_10407_10440[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (21))){
var state_10395__$1 = state_10395;
var statearr_10408_10441 = state_10395__$1;
(statearr_10408_10441[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (13))){
var inst_10350 = (state_10395[(8)]);
var inst_10348 = (state_10395[(9)]);
var inst_10349 = (state_10395[(10)]);
var inst_10347 = (state_10395[(12)]);
var inst_10357 = (state_10395[(2)]);
var inst_10358 = (inst_10350 + (1));
var tmp10404 = inst_10348;
var tmp10405 = inst_10349;
var tmp10406 = inst_10347;
var inst_10347__$1 = tmp10406;
var inst_10348__$1 = tmp10404;
var inst_10349__$1 = tmp10405;
var inst_10350__$1 = inst_10358;
var state_10395__$1 = (function (){var statearr_10409 = state_10395;
(statearr_10409[(8)] = inst_10350__$1);

(statearr_10409[(9)] = inst_10348__$1);

(statearr_10409[(14)] = inst_10357);

(statearr_10409[(10)] = inst_10349__$1);

(statearr_10409[(12)] = inst_10347__$1);

return statearr_10409;
})();
var statearr_10410_10442 = state_10395__$1;
(statearr_10410_10442[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (22))){
var state_10395__$1 = state_10395;
var statearr_10411_10443 = state_10395__$1;
(statearr_10411_10443[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (6))){
var inst_10336 = (state_10395[(13)]);
var inst_10345 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_10336) : f.call(null,inst_10336));
var inst_10346 = cljs.core.seq(inst_10345);
var inst_10347 = inst_10346;
var inst_10348 = null;
var inst_10349 = (0);
var inst_10350 = (0);
var state_10395__$1 = (function (){var statearr_10412 = state_10395;
(statearr_10412[(8)] = inst_10350);

(statearr_10412[(9)] = inst_10348);

(statearr_10412[(10)] = inst_10349);

(statearr_10412[(12)] = inst_10347);

return statearr_10412;
})();
var statearr_10413_10444 = state_10395__$1;
(statearr_10413_10444[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (17))){
var inst_10361 = (state_10395[(7)]);
var inst_10365 = cljs.core.chunk_first(inst_10361);
var inst_10366 = cljs.core.chunk_rest(inst_10361);
var inst_10367 = cljs.core.count(inst_10365);
var inst_10347 = inst_10366;
var inst_10348 = inst_10365;
var inst_10349 = inst_10367;
var inst_10350 = (0);
var state_10395__$1 = (function (){var statearr_10414 = state_10395;
(statearr_10414[(8)] = inst_10350);

(statearr_10414[(9)] = inst_10348);

(statearr_10414[(10)] = inst_10349);

(statearr_10414[(12)] = inst_10347);

return statearr_10414;
})();
var statearr_10415_10445 = state_10395__$1;
(statearr_10415_10445[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (3))){
var inst_10393 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10395__$1,inst_10393);
} else {
if((state_val_10396 === (12))){
var inst_10381 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
var statearr_10416_10446 = state_10395__$1;
(statearr_10416_10446[(2)] = inst_10381);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (2))){
var state_10395__$1 = state_10395;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10395__$1,(4),in$);
} else {
if((state_val_10396 === (23))){
var inst_10389 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
var statearr_10417_10447 = state_10395__$1;
(statearr_10417_10447[(2)] = inst_10389);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (19))){
var inst_10376 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
var statearr_10418_10448 = state_10395__$1;
(statearr_10418_10448[(2)] = inst_10376);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (11))){
var inst_10361 = (state_10395[(7)]);
var inst_10347 = (state_10395[(12)]);
var inst_10361__$1 = cljs.core.seq(inst_10347);
var state_10395__$1 = (function (){var statearr_10419 = state_10395;
(statearr_10419[(7)] = inst_10361__$1);

return statearr_10419;
})();
if(inst_10361__$1){
var statearr_10420_10449 = state_10395__$1;
(statearr_10420_10449[(1)] = (14));

} else {
var statearr_10421_10450 = state_10395__$1;
(statearr_10421_10450[(1)] = (15));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (9))){
var inst_10383 = (state_10395[(2)]);
var inst_10384 = cljs.core.async.impl.protocols.closed_QMARK_(out);
var state_10395__$1 = (function (){var statearr_10422 = state_10395;
(statearr_10422[(15)] = inst_10383);

return statearr_10422;
})();
if(cljs.core.truth_(inst_10384)){
var statearr_10423_10451 = state_10395__$1;
(statearr_10423_10451[(1)] = (21));

} else {
var statearr_10424_10452 = state_10395__$1;
(statearr_10424_10452[(1)] = (22));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (5))){
var inst_10339 = cljs.core.async.close_BANG_(out);
var state_10395__$1 = state_10395;
var statearr_10425_10453 = state_10395__$1;
(statearr_10425_10453[(2)] = inst_10339);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (14))){
var inst_10361 = (state_10395[(7)]);
var inst_10363 = cljs.core.chunked_seq_QMARK_(inst_10361);
var state_10395__$1 = state_10395;
if(inst_10363){
var statearr_10426_10454 = state_10395__$1;
(statearr_10426_10454[(1)] = (17));

} else {
var statearr_10427_10455 = state_10395__$1;
(statearr_10427_10455[(1)] = (18));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (16))){
var inst_10379 = (state_10395[(2)]);
var state_10395__$1 = state_10395;
var statearr_10428_10456 = state_10395__$1;
(statearr_10428_10456[(2)] = inst_10379);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10396 === (10))){
var inst_10350 = (state_10395[(8)]);
var inst_10348 = (state_10395[(9)]);
var inst_10355 = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(inst_10348,inst_10350);
var state_10395__$1 = state_10395;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10395__$1,(13),out,inst_10355);
} else {
if((state_val_10396 === (18))){
var inst_10361 = (state_10395[(7)]);
var inst_10370 = cljs.core.first(inst_10361);
var state_10395__$1 = state_10395;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10395__$1,(20),out,inst_10370);
} else {
if((state_val_10396 === (8))){
var inst_10350 = (state_10395[(8)]);
var inst_10349 = (state_10395[(10)]);
var inst_10352 = (inst_10350 < inst_10349);
var inst_10353 = inst_10352;
var state_10395__$1 = state_10395;
if(cljs.core.truth_(inst_10353)){
var statearr_10429_10457 = state_10395__$1;
(statearr_10429_10457[(1)] = (10));

} else {
var statearr_10430_10458 = state_10395__$1;
(statearr_10430_10458[(1)] = (11));

}

return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____0 = (function (){
var statearr_10431 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10431[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__);

(statearr_10431[(1)] = (1));

return statearr_10431;
});
var cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____1 = (function (state_10395){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10395);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10432){if((e10432 instanceof Object)){
var ex__8775__auto__ = e10432;
var statearr_10433_10459 = state_10395;
(statearr_10433_10459[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10395);

return cljs.core.cst$kw$recur;
} else {
throw e10432;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10460 = state_10395;
state_10395 = G__10460;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__ = function(state_10395){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____1.call(this,state_10395);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__8772__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10434 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10434[(6)] = c__8878__auto__);

return statearr_10434;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));

return c__8878__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__10462 = arguments.length;
switch (G__10462) {
case 2:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = (function (f,in$){
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3(f,in$,null);
}));

(cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3 = (function (f,in$,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(f,in$,out);

return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_GT_ = (function cljs$core$async$mapcat_GT_(var_args){
var G__10465 = arguments.length;
switch (G__10465) {
case 2:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = (function (f,out){
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3(f,out,null);
}));

(cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3 = (function (f,out,buf_or_n){
var in$ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(f,in$,out);

return in$;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.unique = (function cljs$core$async$unique(var_args){
var G__10468 = arguments.length;
switch (G__10468) {
case 1:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

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

(cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10515 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10492){
var state_val_10493 = (state_10492[(1)]);
if((state_val_10493 === (7))){
var inst_10487 = (state_10492[(2)]);
var state_10492__$1 = state_10492;
var statearr_10494_10516 = state_10492__$1;
(statearr_10494_10516[(2)] = inst_10487);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (1))){
var inst_10469 = null;
var state_10492__$1 = (function (){var statearr_10495 = state_10492;
(statearr_10495[(7)] = inst_10469);

return statearr_10495;
})();
var statearr_10496_10517 = state_10492__$1;
(statearr_10496_10517[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (4))){
var inst_10472 = (state_10492[(8)]);
var inst_10472__$1 = (state_10492[(2)]);
var inst_10473 = (inst_10472__$1 == null);
var inst_10474 = cljs.core.not(inst_10473);
var state_10492__$1 = (function (){var statearr_10497 = state_10492;
(statearr_10497[(8)] = inst_10472__$1);

return statearr_10497;
})();
if(inst_10474){
var statearr_10498_10518 = state_10492__$1;
(statearr_10498_10518[(1)] = (5));

} else {
var statearr_10499_10519 = state_10492__$1;
(statearr_10499_10519[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (6))){
var state_10492__$1 = state_10492;
var statearr_10500_10520 = state_10492__$1;
(statearr_10500_10520[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (3))){
var inst_10489 = (state_10492[(2)]);
var inst_10490 = cljs.core.async.close_BANG_(out);
var state_10492__$1 = (function (){var statearr_10501 = state_10492;
(statearr_10501[(9)] = inst_10489);

return statearr_10501;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_10492__$1,inst_10490);
} else {
if((state_val_10493 === (2))){
var state_10492__$1 = state_10492;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10492__$1,(4),ch);
} else {
if((state_val_10493 === (11))){
var inst_10472 = (state_10492[(8)]);
var inst_10481 = (state_10492[(2)]);
var inst_10469 = inst_10472;
var state_10492__$1 = (function (){var statearr_10502 = state_10492;
(statearr_10502[(7)] = inst_10469);

(statearr_10502[(10)] = inst_10481);

return statearr_10502;
})();
var statearr_10503_10521 = state_10492__$1;
(statearr_10503_10521[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (9))){
var inst_10472 = (state_10492[(8)]);
var state_10492__$1 = state_10492;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10492__$1,(11),out,inst_10472);
} else {
if((state_val_10493 === (5))){
var inst_10469 = (state_10492[(7)]);
var inst_10472 = (state_10492[(8)]);
var inst_10476 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_10472,inst_10469);
var state_10492__$1 = state_10492;
if(inst_10476){
var statearr_10505_10522 = state_10492__$1;
(statearr_10505_10522[(1)] = (8));

} else {
var statearr_10506_10523 = state_10492__$1;
(statearr_10506_10523[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (10))){
var inst_10484 = (state_10492[(2)]);
var state_10492__$1 = state_10492;
var statearr_10507_10524 = state_10492__$1;
(statearr_10507_10524[(2)] = inst_10484);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10493 === (8))){
var inst_10469 = (state_10492[(7)]);
var tmp10504 = inst_10469;
var inst_10469__$1 = tmp10504;
var state_10492__$1 = (function (){var statearr_10508 = state_10492;
(statearr_10508[(7)] = inst_10469__$1);

return statearr_10508;
})();
var statearr_10509_10525 = state_10492__$1;
(statearr_10509_10525[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10510 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_10510[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10510[(1)] = (1));

return statearr_10510;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10492){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10492);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10511){if((e10511 instanceof Object)){
var ex__8775__auto__ = e10511;
var statearr_10512_10526 = state_10492;
(statearr_10512_10526[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10492);

return cljs.core.cst$kw$recur;
} else {
throw e10511;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10527 = state_10492;
state_10492 = G__10527;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10492){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10492);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10513 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10513[(6)] = c__8878__auto___10515);

return statearr_10513;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition = (function cljs$core$async$partition(var_args){
var G__10529 = arguments.length;
switch (G__10529) {
case 2:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10595 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10567){
var state_val_10568 = (state_10567[(1)]);
if((state_val_10568 === (7))){
var inst_10563 = (state_10567[(2)]);
var state_10567__$1 = state_10567;
var statearr_10569_10596 = state_10567__$1;
(statearr_10569_10596[(2)] = inst_10563);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (1))){
var inst_10530 = (new Array(n));
var inst_10531 = inst_10530;
var inst_10532 = (0);
var state_10567__$1 = (function (){var statearr_10570 = state_10567;
(statearr_10570[(7)] = inst_10532);

(statearr_10570[(8)] = inst_10531);

return statearr_10570;
})();
var statearr_10571_10597 = state_10567__$1;
(statearr_10571_10597[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (4))){
var inst_10535 = (state_10567[(9)]);
var inst_10535__$1 = (state_10567[(2)]);
var inst_10536 = (inst_10535__$1 == null);
var inst_10537 = cljs.core.not(inst_10536);
var state_10567__$1 = (function (){var statearr_10572 = state_10567;
(statearr_10572[(9)] = inst_10535__$1);

return statearr_10572;
})();
if(inst_10537){
var statearr_10573_10598 = state_10567__$1;
(statearr_10573_10598[(1)] = (5));

} else {
var statearr_10574_10599 = state_10567__$1;
(statearr_10574_10599[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (15))){
var inst_10557 = (state_10567[(2)]);
var state_10567__$1 = state_10567;
var statearr_10575_10600 = state_10567__$1;
(statearr_10575_10600[(2)] = inst_10557);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (13))){
var state_10567__$1 = state_10567;
var statearr_10576_10601 = state_10567__$1;
(statearr_10576_10601[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (6))){
var inst_10532 = (state_10567[(7)]);
var inst_10553 = (inst_10532 > (0));
var state_10567__$1 = state_10567;
if(cljs.core.truth_(inst_10553)){
var statearr_10577_10602 = state_10567__$1;
(statearr_10577_10602[(1)] = (12));

} else {
var statearr_10578_10603 = state_10567__$1;
(statearr_10578_10603[(1)] = (13));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (3))){
var inst_10565 = (state_10567[(2)]);
var state_10567__$1 = state_10567;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10567__$1,inst_10565);
} else {
if((state_val_10568 === (12))){
var inst_10531 = (state_10567[(8)]);
var inst_10555 = cljs.core.vec(inst_10531);
var state_10567__$1 = state_10567;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10567__$1,(15),out,inst_10555);
} else {
if((state_val_10568 === (2))){
var state_10567__$1 = state_10567;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10567__$1,(4),ch);
} else {
if((state_val_10568 === (11))){
var inst_10547 = (state_10567[(2)]);
var inst_10548 = (new Array(n));
var inst_10531 = inst_10548;
var inst_10532 = (0);
var state_10567__$1 = (function (){var statearr_10579 = state_10567;
(statearr_10579[(7)] = inst_10532);

(statearr_10579[(8)] = inst_10531);

(statearr_10579[(10)] = inst_10547);

return statearr_10579;
})();
var statearr_10580_10604 = state_10567__$1;
(statearr_10580_10604[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (9))){
var inst_10531 = (state_10567[(8)]);
var inst_10545 = cljs.core.vec(inst_10531);
var state_10567__$1 = state_10567;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10567__$1,(11),out,inst_10545);
} else {
if((state_val_10568 === (5))){
var inst_10540 = (state_10567[(11)]);
var inst_10535 = (state_10567[(9)]);
var inst_10532 = (state_10567[(7)]);
var inst_10531 = (state_10567[(8)]);
var inst_10539 = (inst_10531[inst_10532] = inst_10535);
var inst_10540__$1 = (inst_10532 + (1));
var inst_10541 = (inst_10540__$1 < n);
var state_10567__$1 = (function (){var statearr_10581 = state_10567;
(statearr_10581[(11)] = inst_10540__$1);

(statearr_10581[(12)] = inst_10539);

return statearr_10581;
})();
if(cljs.core.truth_(inst_10541)){
var statearr_10582_10605 = state_10567__$1;
(statearr_10582_10605[(1)] = (8));

} else {
var statearr_10583_10606 = state_10567__$1;
(statearr_10583_10606[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (14))){
var inst_10560 = (state_10567[(2)]);
var inst_10561 = cljs.core.async.close_BANG_(out);
var state_10567__$1 = (function (){var statearr_10585 = state_10567;
(statearr_10585[(13)] = inst_10560);

return statearr_10585;
})();
var statearr_10586_10607 = state_10567__$1;
(statearr_10586_10607[(2)] = inst_10561);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (10))){
var inst_10551 = (state_10567[(2)]);
var state_10567__$1 = state_10567;
var statearr_10587_10608 = state_10567__$1;
(statearr_10587_10608[(2)] = inst_10551);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10568 === (8))){
var inst_10540 = (state_10567[(11)]);
var inst_10531 = (state_10567[(8)]);
var tmp10584 = inst_10531;
var inst_10531__$1 = tmp10584;
var inst_10532 = inst_10540;
var state_10567__$1 = (function (){var statearr_10588 = state_10567;
(statearr_10588[(7)] = inst_10532);

(statearr_10588[(8)] = inst_10531__$1);

return statearr_10588;
})();
var statearr_10589_10609 = state_10567__$1;
(statearr_10589_10609[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10590 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10590[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10590[(1)] = (1));

return statearr_10590;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10567){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10567);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10591){if((e10591 instanceof Object)){
var ex__8775__auto__ = e10591;
var statearr_10592_10610 = state_10567;
(statearr_10592_10610[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10567);

return cljs.core.cst$kw$recur;
} else {
throw e10591;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10611 = state_10567;
state_10567 = G__10611;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10567){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10567);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10593 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10593[(6)] = c__8878__auto___10595);

return statearr_10593;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition_by = (function cljs$core$async$partition_by(var_args){
var G__10613 = arguments.length;
switch (G__10613) {
case 2:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3 = (function (f,ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__8878__auto___10690 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__8879__auto__ = (function (){var switch__8771__auto__ = (function (state_10658){
var state_val_10659 = (state_10658[(1)]);
if((state_val_10659 === (7))){
var inst_10654 = (state_10658[(2)]);
var state_10658__$1 = state_10658;
var statearr_10660_10691 = state_10658__$1;
(statearr_10660_10691[(2)] = inst_10654);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (1))){
var inst_10614 = [];
var inst_10615 = inst_10614;
var inst_10616 = cljs.core.cst$kw$cljs$core$async_SLASH_nothing;
var state_10658__$1 = (function (){var statearr_10661 = state_10658;
(statearr_10661[(7)] = inst_10616);

(statearr_10661[(8)] = inst_10615);

return statearr_10661;
})();
var statearr_10662_10692 = state_10658__$1;
(statearr_10662_10692[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (4))){
var inst_10619 = (state_10658[(9)]);
var inst_10619__$1 = (state_10658[(2)]);
var inst_10620 = (inst_10619__$1 == null);
var inst_10621 = cljs.core.not(inst_10620);
var state_10658__$1 = (function (){var statearr_10663 = state_10658;
(statearr_10663[(9)] = inst_10619__$1);

return statearr_10663;
})();
if(inst_10621){
var statearr_10664_10693 = state_10658__$1;
(statearr_10664_10693[(1)] = (5));

} else {
var statearr_10665_10694 = state_10658__$1;
(statearr_10665_10694[(1)] = (6));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (15))){
var inst_10615 = (state_10658[(8)]);
var inst_10646 = cljs.core.vec(inst_10615);
var state_10658__$1 = state_10658;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10658__$1,(18),out,inst_10646);
} else {
if((state_val_10659 === (13))){
var inst_10641 = (state_10658[(2)]);
var state_10658__$1 = state_10658;
var statearr_10666_10695 = state_10658__$1;
(statearr_10666_10695[(2)] = inst_10641);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (6))){
var inst_10615 = (state_10658[(8)]);
var inst_10643 = inst_10615.length;
var inst_10644 = (inst_10643 > (0));
var state_10658__$1 = state_10658;
if(cljs.core.truth_(inst_10644)){
var statearr_10667_10696 = state_10658__$1;
(statearr_10667_10696[(1)] = (15));

} else {
var statearr_10668_10697 = state_10658__$1;
(statearr_10668_10697[(1)] = (16));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (17))){
var inst_10651 = (state_10658[(2)]);
var inst_10652 = cljs.core.async.close_BANG_(out);
var state_10658__$1 = (function (){var statearr_10669 = state_10658;
(statearr_10669[(10)] = inst_10651);

return statearr_10669;
})();
var statearr_10670_10698 = state_10658__$1;
(statearr_10670_10698[(2)] = inst_10652);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (3))){
var inst_10656 = (state_10658[(2)]);
var state_10658__$1 = state_10658;
return cljs.core.async.impl.ioc_helpers.return_chan(state_10658__$1,inst_10656);
} else {
if((state_val_10659 === (12))){
var inst_10615 = (state_10658[(8)]);
var inst_10634 = cljs.core.vec(inst_10615);
var state_10658__$1 = state_10658;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_10658__$1,(14),out,inst_10634);
} else {
if((state_val_10659 === (2))){
var state_10658__$1 = state_10658;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_10658__$1,(4),ch);
} else {
if((state_val_10659 === (11))){
var inst_10615 = (state_10658[(8)]);
var inst_10619 = (state_10658[(9)]);
var inst_10623 = (state_10658[(11)]);
var inst_10631 = inst_10615.push(inst_10619);
var tmp10671 = inst_10615;
var inst_10615__$1 = tmp10671;
var inst_10616 = inst_10623;
var state_10658__$1 = (function (){var statearr_10672 = state_10658;
(statearr_10672[(12)] = inst_10631);

(statearr_10672[(7)] = inst_10616);

(statearr_10672[(8)] = inst_10615__$1);

return statearr_10672;
})();
var statearr_10673_10699 = state_10658__$1;
(statearr_10673_10699[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (9))){
var inst_10616 = (state_10658[(7)]);
var inst_10627 = cljs.core.keyword_identical_QMARK_(inst_10616,cljs.core.cst$kw$cljs$core$async_SLASH_nothing);
var state_10658__$1 = state_10658;
var statearr_10674_10700 = state_10658__$1;
(statearr_10674_10700[(2)] = inst_10627);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (5))){
var inst_10616 = (state_10658[(7)]);
var inst_10619 = (state_10658[(9)]);
var inst_10623 = (state_10658[(11)]);
var inst_10624 = (state_10658[(13)]);
var inst_10623__$1 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_10619) : f.call(null,inst_10619));
var inst_10624__$1 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_10623__$1,inst_10616);
var state_10658__$1 = (function (){var statearr_10675 = state_10658;
(statearr_10675[(11)] = inst_10623__$1);

(statearr_10675[(13)] = inst_10624__$1);

return statearr_10675;
})();
if(inst_10624__$1){
var statearr_10676_10701 = state_10658__$1;
(statearr_10676_10701[(1)] = (8));

} else {
var statearr_10677_10702 = state_10658__$1;
(statearr_10677_10702[(1)] = (9));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (14))){
var inst_10619 = (state_10658[(9)]);
var inst_10623 = (state_10658[(11)]);
var inst_10636 = (state_10658[(2)]);
var inst_10637 = [];
var inst_10638 = inst_10637.push(inst_10619);
var inst_10615 = inst_10637;
var inst_10616 = inst_10623;
var state_10658__$1 = (function (){var statearr_10678 = state_10658;
(statearr_10678[(7)] = inst_10616);

(statearr_10678[(8)] = inst_10615);

(statearr_10678[(14)] = inst_10638);

(statearr_10678[(15)] = inst_10636);

return statearr_10678;
})();
var statearr_10679_10703 = state_10658__$1;
(statearr_10679_10703[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (16))){
var state_10658__$1 = state_10658;
var statearr_10680_10704 = state_10658__$1;
(statearr_10680_10704[(2)] = null);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (10))){
var inst_10629 = (state_10658[(2)]);
var state_10658__$1 = state_10658;
if(cljs.core.truth_(inst_10629)){
var statearr_10681_10705 = state_10658__$1;
(statearr_10681_10705[(1)] = (11));

} else {
var statearr_10682_10706 = state_10658__$1;
(statearr_10682_10706[(1)] = (12));

}

return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (18))){
var inst_10648 = (state_10658[(2)]);
var state_10658__$1 = state_10658;
var statearr_10683_10707 = state_10658__$1;
(statearr_10683_10707[(2)] = inst_10648);

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


return cljs.core.cst$kw$recur;
} else {
if((state_val_10659 === (8))){
var inst_10624 = (state_10658[(13)]);
var state_10658__$1 = state_10658;
var statearr_10684_10708 = state_10658__$1;
(statearr_10684_10708[(2)] = inst_10624);

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


return cljs.core.cst$kw$recur;
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__8772__auto__ = null;
var cljs$core$async$state_machine__8772__auto____0 = (function (){
var statearr_10685 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_10685[(0)] = cljs$core$async$state_machine__8772__auto__);

(statearr_10685[(1)] = (1));

return statearr_10685;
});
var cljs$core$async$state_machine__8772__auto____1 = (function (state_10658){
while(true){
var ret_value__8773__auto__ = (function (){try{while(true){
var result__8774__auto__ = switch__8771__auto__(state_10658);
if(cljs.core.keyword_identical_QMARK_(result__8774__auto__,cljs.core.cst$kw$recur)){
continue;
} else {
return result__8774__auto__;
}
break;
}
}catch (e10686){if((e10686 instanceof Object)){
var ex__8775__auto__ = e10686;
var statearr_10687_10709 = state_10658;
(statearr_10687_10709[(5)] = ex__8775__auto__);


cljs.core.async.impl.ioc_helpers.process_exception(state_10658);

return cljs.core.cst$kw$recur;
} else {
throw e10686;

}
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__8773__auto__,cljs.core.cst$kw$recur)){
var G__10710 = state_10658;
state_10658 = G__10710;
continue;
} else {
return ret_value__8773__auto__;
}
break;
}
});
cljs$core$async$state_machine__8772__auto__ = function(state_10658){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__8772__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__8772__auto____1.call(this,state_10658);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__8772__auto____0;
cljs$core$async$state_machine__8772__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__8772__auto____1;
return cljs$core$async$state_machine__8772__auto__;
})()
})();
var state__8880__auto__ = (function (){var statearr_10688 = (f__8879__auto__.cljs$core$IFn$_invoke$arity$0 ? f__8879__auto__.cljs$core$IFn$_invoke$arity$0() : f__8879__auto__.call(null));
(statearr_10688[(6)] = c__8878__auto___10690);

return statearr_10688;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__8880__auto__);
}));


return out;
}));

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

