// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced} goog.provide('reagent.ratom'); goog.require('cljs.core'); goog.require('cljs.core.constants'); goog.require('reagent.impl.util'); goog.require('reagent.debug'); if((typeof reagent !== 'undefined') && (typeof reagent.ratom !== 'undefined') && (typeof reagent.ratom.debug !== 'undefined')){ } else { reagent.ratom.debug = false; } if((typeof reagent !== 'undefined') && (typeof reagent.ratom !== 'undefined') && (typeof reagent.ratom._running !== 'undefined')){ } else { reagent.ratom._running = cljs.core.atom.cljs$core$IFn$_invoke$arity$1((0)); } reagent.ratom.running = (function reagent$ratom$running(){ return cljs.core.deref(reagent.ratom._running); }); reagent.ratom.capture_derefed = (function reagent$ratom$capture_derefed(f,obj){ (obj.cljsCaptured = null); var _STAR_ratom_context_STAR__orig_val__7264 = reagent.ratom._STAR_ratom_context_STAR_; var _STAR_ratom_context_STAR__temp_val__7265 = obj; (reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__temp_val__7265); try{return (f.cljs$core$IFn$_invoke$arity$0 ? f.cljs$core$IFn$_invoke$arity$0() : f.call(null)); }finally {(reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__orig_val__7264); }}); reagent.ratom.captured = (function reagent$ratom$captured(obj){ var c = obj.cljsCaptured; (obj.cljsCaptured = null); return c; }); reagent.ratom.notify_deref_watcher_BANG_ = (function reagent$ratom$notify_deref_watcher_BANG_(derefable){ var obj = reagent.ratom._STAR_ratom_context_STAR_; if((obj == null)){ return null; } else { var captured = obj.cljsCaptured; return (obj.cljsCaptured = cljs.core.conj.cljs$core$IFn$_invoke$arity$2((((captured == null))?cljs.core.PersistentHashSet.EMPTY:captured),derefable)); } }); /** * @interface */ reagent.ratom.IReactiveAtom = function(){}; /** * @constructor * @implements {cljs.core.IWatchable} * @implements {cljs.core.IAtom} * @implements {cljs.core.IEquiv} * @implements {cljs.core.IHash} * @implements {cljs.core.IReset} * @implements {cljs.core.ISwap} * @implements {reagent.ratom.IReactiveAtom} * @implements {cljs.core.IMeta} * @implements {cljs.core.IDeref} * @implements {cljs.core.IPrintWithWriter} */ reagent.ratom.RAtom = (function (state,meta,validator,watches){ this.state = state; this.meta = meta; this.validator = validator; this.watches = watches; this.cljs$lang$protocol_mask$partition0$ = 2153938944; this.cljs$lang$protocol_mask$partition1$ = 114690; }); (reagent.ratom.RAtom.prototype.reagent$ratom$IReactiveAtom$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.RAtom.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (a,writer,opts){ var self__ = this; var a__$1 = this; cljs.core._write(writer,"#"); })); (reagent.ratom.RAtom.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return self__.meta; })); (reagent.ratom.RAtom.prototype.cljs$core$IHash$_hash$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; return goog.getUid(this$__$1); })); (reagent.ratom.RAtom.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (o,other){ var self__ = this; var o__$1 = this; return (o__$1 === other); })); (reagent.ratom.RAtom.prototype.cljs$core$IReset$_reset_BANG_$arity$2 = (function (a,new_value){ var self__ = this; var a__$1 = this; if((self__.validator == null)){ } else { if(cljs.core.truth_((self__.validator.cljs$core$IFn$_invoke$arity$1 ? self__.validator.cljs$core$IFn$_invoke$arity$1(new_value) : self__.validator.call(null,new_value)))){ } else { throw (new Error(["Assert failed: ","Validator rejected reference state","\n","(validator new-value)"].join(''))); } } var old_value = self__.state; (self__.state = new_value); if((self__.watches == null)){ } else { a__$1.cljs$core$IWatchable$_notify_watches$arity$3(null,old_value,new_value); } return new_value; })); (reagent.ratom.RAtom.prototype.cljs$core$ISwap$_swap_BANG_$arity$2 = (function (a,f){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(self__.state) : f.call(null,self__.state))); })); (reagent.ratom.RAtom.prototype.cljs$core$ISwap$_swap_BANG_$arity$3 = (function (a,f,x){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(self__.state,x) : f.call(null,self__.state,x))); })); (reagent.ratom.RAtom.prototype.cljs$core$ISwap$_swap_BANG_$arity$4 = (function (a,f,x,y){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(self__.state,x,y) : f.call(null,self__.state,x,y))); })); (reagent.ratom.RAtom.prototype.cljs$core$ISwap$_swap_BANG_$arity$5 = (function (a,f,x,y,more){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,cljs.core.apply.cljs$core$IFn$_invoke$arity$5(f,self__.state,x,y,more)); })); (reagent.ratom.RAtom.prototype.cljs$core$IWatchable$_notify_watches$arity$3 = (function (this$,oldval,newval){ var self__ = this; var this$__$1 = this; return cljs.core.reduce_kv((function (_,key,f){ (f.cljs$core$IFn$_invoke$arity$4 ? f.cljs$core$IFn$_invoke$arity$4(key,this$__$1,oldval,newval) : f.call(null,key,this$__$1,oldval,newval)); return null; }),null,self__.watches); })); (reagent.ratom.RAtom.prototype.cljs$core$IWatchable$_add_watch$arity$3 = (function (this$,key,f){ var self__ = this; var this$__$1 = this; return (self__.watches = cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.watches,key,f)); })); (reagent.ratom.RAtom.prototype.cljs$core$IWatchable$_remove_watch$arity$2 = (function (this$,key){ var self__ = this; var this$__$1 = this; return (self__.watches = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.watches,key)); })); (reagent.ratom.RAtom.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; reagent.ratom.notify_deref_watcher_BANG_(this$__$1); return self__.state; })); (reagent.ratom.RAtom.getBasis = (function (){ return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(cljs.core.cst$sym$state,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$meta,cljs.core.cst$sym$validator,cljs.core.with_meta(cljs.core.cst$sym$watches,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null))], null); })); (reagent.ratom.RAtom.cljs$lang$type = true); (reagent.ratom.RAtom.cljs$lang$ctorStr = "reagent.ratom/RAtom"); (reagent.ratom.RAtom.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){ return cljs.core._write(writer__5331__auto__,"reagent.ratom/RAtom"); })); /** * Positional factory function for reagent.ratom/RAtom. */ reagent.ratom.__GT_RAtom = (function reagent$ratom$__GT_RAtom(state,meta,validator,watches){ return (new reagent.ratom.RAtom(state,meta,validator,watches)); }); /** * Like clojure.core/atom, except that it keeps track of derefs. */ reagent.ratom.atom = (function reagent$ratom$atom(var_args){ var G__7269 = arguments.length; switch (G__7269) { case 1: return reagent.ratom.atom.cljs$core$IFn$_invoke$arity$1((arguments[(0)])); break; default: var args_arr__5794__auto__ = []; var len__5769__auto___7273 = arguments.length; var i__5770__auto___7274 = (0); while(true){ if((i__5770__auto___7274 < len__5769__auto___7273)){ args_arr__5794__auto__.push((arguments[i__5770__auto___7274])); var G__7275 = (i__5770__auto___7274 + (1)); i__5770__auto___7274 = G__7275; continue; } else { } break; } var argseq__5795__auto__ = (new cljs.core.IndexedSeq(args_arr__5794__auto__.slice((1)),(0),null)); return reagent.ratom.atom.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5795__auto__); } }); (reagent.ratom.atom.cljs$core$IFn$_invoke$arity$1 = (function (x){ return (new reagent.ratom.RAtom(x,null,null,null)); })); (reagent.ratom.atom.cljs$core$IFn$_invoke$arity$variadic = (function (x,p__7270){ var map__7271 = p__7270; var map__7271__$1 = cljs.core.__destructure_map(map__7271); var meta = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7271__$1,cljs.core.cst$kw$meta); var validator = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7271__$1,cljs.core.cst$kw$validator); return (new reagent.ratom.RAtom(x,meta,validator,null)); })); /** @this {Function} */ (reagent.ratom.atom.cljs$lang$applyTo = (function (seq7267){ var G__7268 = cljs.core.first(seq7267); var seq7267__$1 = cljs.core.next(seq7267); var self__5754__auto__ = this; return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7268,seq7267__$1); })); (reagent.ratom.atom.cljs$lang$maxFixedArity = (1)); /** * @constructor * @implements {cljs.core.IWatchable} * @implements {cljs.core.IAtom} * @implements {cljs.core.IEquiv} * @implements {cljs.core.IHash} * @implements {cljs.core.IReset} * @implements {cljs.core.ISwap} * @implements {reagent.ratom.IReactiveAtom} * @implements {cljs.core.IDeref} * @implements {cljs.core.IPrintWithWriter} * @implements {reagent.ratom.Object} */ reagent.ratom.RCursor = (function (ratom,path,reaction){ this.ratom = ratom; this.path = path; this.reaction = reaction; this.cljs$lang$protocol_mask$partition0$ = 2153807872; this.cljs$lang$protocol_mask$partition1$ = 114690; }); (reagent.ratom.RCursor.prototype._reaction = (function (){ var self__ = this; var this$ = this; if((self__.reaction == null)){ return (self__.reaction = (((((!((self__.ratom == null))))?(((((self__.ratom.cljs$lang$protocol_mask$partition0$ & (32768))) || ((cljs.core.PROTOCOL_SENTINEL === self__.ratom.cljs$core$IDeref$))))?true:(((!self__.ratom.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.IDeref,self__.ratom):false)):cljs.core.native_satisfies_QMARK_(cljs.core.IDeref,self__.ratom)))?(function (){var G__7283 = (function (){ return cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(self__.ratom),self__.path); }); var G__7284 = cljs.core.cst$kw$on_DASH_set; var G__7285 = ((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(self__.path,cljs.core.PersistentVector.EMPTY))?(function (p1__7277_SHARP_,p2__7276_SHARP_){ return cljs.core.reset_BANG_(self__.ratom,p2__7276_SHARP_); }):(function (p1__7279_SHARP_,p2__7278_SHARP_){ return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(self__.ratom,cljs.core.assoc_in,self__.path,p2__7278_SHARP_); })); return (reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$3 ? reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$3(G__7283,G__7284,G__7285) : reagent.ratom.make_reaction.call(null,G__7283,G__7284,G__7285)); })():(function (){var G__7286 = (function (){ return (self__.ratom.cljs$core$IFn$_invoke$arity$1 ? self__.ratom.cljs$core$IFn$_invoke$arity$1(self__.path) : self__.ratom.call(null,self__.path)); }); var G__7287 = cljs.core.cst$kw$on_DASH_set; var G__7288 = (function (p1__7281_SHARP_,p2__7280_SHARP_){ return (self__.ratom.cljs$core$IFn$_invoke$arity$2 ? self__.ratom.cljs$core$IFn$_invoke$arity$2(self__.path,p2__7280_SHARP_) : self__.ratom.call(null,self__.path,p2__7280_SHARP_)); }); return (reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$3 ? reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$3(G__7286,G__7287,G__7288) : reagent.ratom.make_reaction.call(null,G__7286,G__7287,G__7288)); })())); } else { return self__.reaction; } })); (reagent.ratom.RCursor.prototype._peek = (function (){ var self__ = this; var this$ = this; var _STAR_ratom_context_STAR__orig_val__7289 = reagent.ratom._STAR_ratom_context_STAR_; var _STAR_ratom_context_STAR__temp_val__7290 = null; (reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__temp_val__7290); try{return cljs.core._deref(this$._reaction()); }finally {(reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__orig_val__7289); }})); (reagent.ratom.RCursor.prototype.reagent$ratom$IReactiveAtom$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.RCursor.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (a,writer,opts){ var self__ = this; var a__$1 = this; cljs.core._write(writer,["#"); })); (reagent.ratom.RCursor.prototype.cljs$core$IHash$_hash$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; return cljs.core.hash(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.ratom,self__.path], null)); })); (reagent.ratom.RCursor.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (o,other){ var self__ = this; var o__$1 = this; return (((other instanceof reagent.ratom.RCursor)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(self__.path,other.path)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(self__.ratom,other.ratom))))); })); (reagent.ratom.RCursor.prototype.cljs$core$IReset$_reset_BANG_$arity$2 = (function (this$,new_value){ var self__ = this; var this$__$1 = this; return cljs.core._reset_BANG_(this$__$1._reaction(),new_value); })); (reagent.ratom.RCursor.prototype.cljs$core$ISwap$_swap_BANG_$arity$2 = (function (a,f){ var self__ = this; var a__$1 = this; return cljs.core._swap_BANG_.cljs$core$IFn$_invoke$arity$2(a__$1._reaction(),f); })); (reagent.ratom.RCursor.prototype.cljs$core$ISwap$_swap_BANG_$arity$3 = (function (a,f,x){ var self__ = this; var a__$1 = this; return cljs.core._swap_BANG_.cljs$core$IFn$_invoke$arity$3(a__$1._reaction(),f,x); })); (reagent.ratom.RCursor.prototype.cljs$core$ISwap$_swap_BANG_$arity$4 = (function (a,f,x,y){ var self__ = this; var a__$1 = this; return cljs.core._swap_BANG_.cljs$core$IFn$_invoke$arity$4(a__$1._reaction(),f,x,y); })); (reagent.ratom.RCursor.prototype.cljs$core$ISwap$_swap_BANG_$arity$5 = (function (a,f,x,y,more){ var self__ = this; var a__$1 = this; return cljs.core._swap_BANG_.cljs$core$IFn$_invoke$arity$5(a__$1._reaction(),f,x,y,more); })); (reagent.ratom.RCursor.prototype.cljs$core$IWatchable$_notify_watches$arity$3 = (function (this$,oldval,newval){ var self__ = this; var this$__$1 = this; return cljs.core._notify_watches(this$__$1._reaction(),oldval,newval); })); (reagent.ratom.RCursor.prototype.cljs$core$IWatchable$_add_watch$arity$3 = (function (this$,key,f){ var self__ = this; var this$__$1 = this; return cljs.core._add_watch(this$__$1._reaction(),key,f); })); (reagent.ratom.RCursor.prototype.cljs$core$IWatchable$_remove_watch$arity$2 = (function (this$,key){ var self__ = this; var this$__$1 = this; return cljs.core._remove_watch(this$__$1._reaction(),key); })); (reagent.ratom.RCursor.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; return cljs.core._deref(this$__$1._reaction()); })); (reagent.ratom.RCursor.getBasis = (function (){ return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$ratom,cljs.core.cst$sym$path,cljs.core.with_meta(cljs.core.cst$sym$reaction,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null))], null); })); (reagent.ratom.RCursor.cljs$lang$type = true); (reagent.ratom.RCursor.cljs$lang$ctorStr = "reagent.ratom/RCursor"); (reagent.ratom.RCursor.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){ return cljs.core._write(writer__5331__auto__,"reagent.ratom/RCursor"); })); /** * Positional factory function for reagent.ratom/RCursor. */ reagent.ratom.__GT_RCursor = (function reagent$ratom$__GT_RCursor(ratom,path,reaction){ return (new reagent.ratom.RCursor(ratom,path,reaction)); }); reagent.ratom.cursor = (function reagent$ratom$cursor(src,path){ if((((!((path == null))))?(((((path.cljs$lang$protocol_mask$partition0$ & (32768))) || ((cljs.core.PROTOCOL_SENTINEL === path.cljs$core$IDeref$))))?true:(((!path.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.IDeref,path):false)):cljs.core.native_satisfies_QMARK_(cljs.core.IDeref,path))){ if((typeof console !== 'undefined')){ console.warn(["Warning: ","Calling cursor with an atom as the second arg is ","deprecated, in (cursor ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(src)," ",cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([path], 0)),")"].join('')); } else { } if((((!((path == null))))?((((false) || ((cljs.core.PROTOCOL_SENTINEL === path.reagent$ratom$IReactiveAtom$))))?true:(((!path.cljs$lang$protocol_mask$partition$))?cljs.core.native_satisfies_QMARK_(reagent.ratom.IReactiveAtom,path):false)):cljs.core.native_satisfies_QMARK_(reagent.ratom.IReactiveAtom,path))){ } else { throw (new Error(["Assert failed: ",["src must be a reactive atom, not ",cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([path], 0))].join(''),"\n","(satisfies? IReactiveAtom path)"].join(''))); } return (new reagent.ratom.RCursor(path,src,null)); } else { if((function (){var or__5045__auto__ = (((!((src == null))))?((((false) || ((cljs.core.PROTOCOL_SENTINEL === src.reagent$ratom$IReactiveAtom$))))?true:(((!src.cljs$lang$protocol_mask$partition$))?cljs.core.native_satisfies_QMARK_(reagent.ratom.IReactiveAtom,src):false)):cljs.core.native_satisfies_QMARK_(reagent.ratom.IReactiveAtom,src)); if(or__5045__auto__){ return or__5045__auto__; } else { return ((cljs.core.ifn_QMARK_(src)) && ((!(cljs.core.vector_QMARK_(src))))); } })()){ } else { throw (new Error(["Assert failed: ",["src must be a reactive atom or a function, not ",cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([src], 0))].join(''),"\n","(or (satisfies? IReactiveAtom src) (and (ifn? src) (not (vector? src))))"].join(''))); } return (new reagent.ratom.RCursor(src,path,null)); } }); /** * @interface */ reagent.ratom.IDisposable = function(){}; var reagent$ratom$IDisposable$dispose_BANG_$dyn_7294 = (function (this$){ var x__5393__auto__ = (((this$ == null))?null:this$); var m__5394__auto__ = (reagent.ratom.dispose_BANG_[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(this$) : m__5394__auto__.call(null,this$)); } else { var m__5392__auto__ = (reagent.ratom.dispose_BANG_["_"]); if((!((m__5392__auto__ == null)))){ return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5392__auto__.call(null,this$)); } else { throw cljs.core.missing_protocol("IDisposable.dispose!",this$); } } }); reagent.ratom.dispose_BANG_ = (function reagent$ratom$dispose_BANG_(this$){ if((((!((this$ == null)))) && ((!((this$.reagent$ratom$IDisposable$dispose_BANG_$arity$1 == null)))))){ return this$.reagent$ratom$IDisposable$dispose_BANG_$arity$1(this$); } else { return reagent$ratom$IDisposable$dispose_BANG_$dyn_7294(this$); } }); /** * @interface */ reagent.ratom.IRunnable = function(){}; var reagent$ratom$IRunnable$run$dyn_7295 = (function (this$){ var x__5393__auto__ = (((this$ == null))?null:this$); var m__5394__auto__ = (reagent.ratom.run[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(this$) : m__5394__auto__.call(null,this$)); } else { var m__5392__auto__ = (reagent.ratom.run["_"]); if((!((m__5392__auto__ == null)))){ return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5392__auto__.call(null,this$)); } else { throw cljs.core.missing_protocol("IRunnable.run",this$); } } }); reagent.ratom.run = (function reagent$ratom$run(this$){ if((((!((this$ == null)))) && ((!((this$.reagent$ratom$IRunnable$run$arity$1 == null)))))){ return this$.reagent$ratom$IRunnable$run$arity$1(this$); } else { return reagent$ratom$IRunnable$run$dyn_7295(this$); } }); /** * @interface */ reagent.ratom.IComputedImpl = function(){}; var reagent$ratom$IComputedImpl$_update_watching$dyn_7296 = (function (this$,derefed){ var x__5393__auto__ = (((this$ == null))?null:this$); var m__5394__auto__ = (reagent.ratom._update_watching[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(this$,derefed) : m__5394__auto__.call(null,this$,derefed)); } else { var m__5392__auto__ = (reagent.ratom._update_watching["_"]); if((!((m__5392__auto__ == null)))){ return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(this$,derefed) : m__5392__auto__.call(null,this$,derefed)); } else { throw cljs.core.missing_protocol("IComputedImpl.-update-watching",this$); } } }); reagent.ratom._update_watching = (function reagent$ratom$_update_watching(this$,derefed){ if((((!((this$ == null)))) && ((!((this$.reagent$ratom$IComputedImpl$_update_watching$arity$2 == null)))))){ return this$.reagent$ratom$IComputedImpl$_update_watching$arity$2(this$,derefed); } else { return reagent$ratom$IComputedImpl$_update_watching$dyn_7296(this$,derefed); } }); var reagent$ratom$IComputedImpl$_handle_change$dyn_7297 = (function (k,sender,oldval,newval){ var x__5393__auto__ = (((k == null))?null:k); var m__5394__auto__ = (reagent.ratom._handle_change[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(k,sender,oldval,newval) : m__5394__auto__.call(null,k,sender,oldval,newval)); } else { var m__5392__auto__ = (reagent.ratom._handle_change["_"]); if((!((m__5392__auto__ == null)))){ return (m__5392__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$4(k,sender,oldval,newval) : m__5392__auto__.call(null,k,sender,oldval,newval)); } else { throw cljs.core.missing_protocol("IComputedImpl.-handle-change",k); } } }); reagent.ratom._handle_change = (function reagent$ratom$_handle_change(k,sender,oldval,newval){ if((((!((k == null)))) && ((!((k.reagent$ratom$IComputedImpl$_handle_change$arity$4 == null)))))){ return k.reagent$ratom$IComputedImpl$_handle_change$arity$4(k,sender,oldval,newval); } else { return reagent$ratom$IComputedImpl$_handle_change$dyn_7297(k,sender,oldval,newval); } }); var reagent$ratom$IComputedImpl$_peek_at$dyn_7298 = (function (this$){ var x__5393__auto__ = (((this$ == null))?null:this$); var m__5394__auto__ = (reagent.ratom._peek_at[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(this$) : m__5394__auto__.call(null,this$)); } else { var m__5392__auto__ = (reagent.ratom._peek_at["_"]); if((!((m__5392__auto__ == null)))){ return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5392__auto__.call(null,this$)); } else { throw cljs.core.missing_protocol("IComputedImpl.-peek-at",this$); } } }); reagent.ratom._peek_at = (function reagent$ratom$_peek_at(this$){ if((((!((this$ == null)))) && ((!((this$.reagent$ratom$IComputedImpl$_peek_at$arity$1 == null)))))){ return this$.reagent$ratom$IComputedImpl$_peek_at$arity$1(this$); } else { return reagent$ratom$IComputedImpl$_peek_at$dyn_7298(this$); } }); /** * @constructor * @implements {cljs.core.IWatchable} * @implements {cljs.core.IAtom} * @implements {cljs.core.IEquiv} * @implements {cljs.core.IHash} * @implements {reagent.ratom.IComputedImpl} * @implements {cljs.core.IReset} * @implements {cljs.core.ISwap} * @implements {reagent.ratom.IReactiveAtom} * @implements {reagent.ratom.IRunnable} * @implements {reagent.ratom.IDisposable} * @implements {cljs.core.IDeref} * @implements {cljs.core.IPrintWithWriter} */ reagent.ratom.Reaction = (function (f,state,dirty_QMARK_,active_QMARK_,watching,watches,auto_run,on_set,on_dispose){ this.f = f; this.state = state; this.dirty_QMARK_ = dirty_QMARK_; this.active_QMARK_ = active_QMARK_; this.watching = watching; this.watches = watches; this.auto_run = auto_run; this.on_set = on_set; this.on_dispose = on_dispose; this.cljs$lang$protocol_mask$partition0$ = 2153807872; this.cljs$lang$protocol_mask$partition1$ = 114690; }); (reagent.ratom.Reaction.prototype.reagent$ratom$IComputedImpl$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.Reaction.prototype.reagent$ratom$IComputedImpl$_handle_change$arity$4 = (function (this$,sender,oldval,newval){ var self__ = this; var this$__$1 = this; if(cljs.core.truth_((function (){var and__5043__auto__ = self__.active_QMARK_; if(cljs.core.truth_(and__5043__auto__)){ return (!((oldval === newval))); } else { return and__5043__auto__; } })())){ (self__.dirty_QMARK_ = true); var fexpr__7299 = (function (){var or__5045__auto__ = self__.auto_run; if(cljs.core.truth_(or__5045__auto__)){ return or__5045__auto__; } else { return reagent.ratom.run; } })(); return (fexpr__7299.cljs$core$IFn$_invoke$arity$1 ? fexpr__7299.cljs$core$IFn$_invoke$arity$1(this$__$1) : fexpr__7299.call(null,this$__$1)); } else { return null; } })); (reagent.ratom.Reaction.prototype.reagent$ratom$IComputedImpl$_update_watching$arity$2 = (function (this$,derefed){ var self__ = this; var this$__$1 = this; var seq__7300_7320 = cljs.core.seq(derefed); var chunk__7301_7321 = null; var count__7302_7322 = (0); var i__7303_7323 = (0); while(true){ if((i__7303_7323 < count__7302_7322)){ var w_7324 = chunk__7301_7321.cljs$core$IIndexed$_nth$arity$2(null,i__7303_7323); if(cljs.core.contains_QMARK_(self__.watching,w_7324)){ } else { cljs.core.add_watch(w_7324,this$__$1,reagent.ratom._handle_change); } var G__7325 = seq__7300_7320; var G__7326 = chunk__7301_7321; var G__7327 = count__7302_7322; var G__7328 = (i__7303_7323 + (1)); seq__7300_7320 = G__7325; chunk__7301_7321 = G__7326; count__7302_7322 = G__7327; i__7303_7323 = G__7328; continue; } else { var temp__4657__auto___7329 = cljs.core.seq(seq__7300_7320); if(temp__4657__auto___7329){ var seq__7300_7330__$1 = temp__4657__auto___7329; if(cljs.core.chunked_seq_QMARK_(seq__7300_7330__$1)){ var c__5568__auto___7331 = cljs.core.chunk_first(seq__7300_7330__$1); var G__7332 = cljs.core.chunk_rest(seq__7300_7330__$1); var G__7333 = c__5568__auto___7331; var G__7334 = cljs.core.count(c__5568__auto___7331); var G__7335 = (0); seq__7300_7320 = G__7332; chunk__7301_7321 = G__7333; count__7302_7322 = G__7334; i__7303_7323 = G__7335; continue; } else { var w_7336 = cljs.core.first(seq__7300_7330__$1); if(cljs.core.contains_QMARK_(self__.watching,w_7336)){ } else { cljs.core.add_watch(w_7336,this$__$1,reagent.ratom._handle_change); } var G__7337 = cljs.core.next(seq__7300_7330__$1); var G__7338 = null; var G__7339 = (0); var G__7340 = (0); seq__7300_7320 = G__7337; chunk__7301_7321 = G__7338; count__7302_7322 = G__7339; i__7303_7323 = G__7340; continue; } } else { } } break; } var seq__7304_7341 = cljs.core.seq(self__.watching); var chunk__7305_7342 = null; var count__7306_7343 = (0); var i__7307_7344 = (0); while(true){ if((i__7307_7344 < count__7306_7343)){ var w_7345 = chunk__7305_7342.cljs$core$IIndexed$_nth$arity$2(null,i__7307_7344); if(cljs.core.contains_QMARK_(derefed,w_7345)){ } else { cljs.core.remove_watch(w_7345,this$__$1); } var G__7346 = seq__7304_7341; var G__7347 = chunk__7305_7342; var G__7348 = count__7306_7343; var G__7349 = (i__7307_7344 + (1)); seq__7304_7341 = G__7346; chunk__7305_7342 = G__7347; count__7306_7343 = G__7348; i__7307_7344 = G__7349; continue; } else { var temp__4657__auto___7350 = cljs.core.seq(seq__7304_7341); if(temp__4657__auto___7350){ var seq__7304_7351__$1 = temp__4657__auto___7350; if(cljs.core.chunked_seq_QMARK_(seq__7304_7351__$1)){ var c__5568__auto___7352 = cljs.core.chunk_first(seq__7304_7351__$1); var G__7353 = cljs.core.chunk_rest(seq__7304_7351__$1); var G__7354 = c__5568__auto___7352; var G__7355 = cljs.core.count(c__5568__auto___7352); var G__7356 = (0); seq__7304_7341 = G__7353; chunk__7305_7342 = G__7354; count__7306_7343 = G__7355; i__7307_7344 = G__7356; continue; } else { var w_7357 = cljs.core.first(seq__7304_7351__$1); if(cljs.core.contains_QMARK_(derefed,w_7357)){ } else { cljs.core.remove_watch(w_7357,this$__$1); } var G__7358 = cljs.core.next(seq__7304_7351__$1); var G__7359 = null; var G__7360 = (0); var G__7361 = (0); seq__7304_7341 = G__7358; chunk__7305_7342 = G__7359; count__7306_7343 = G__7360; i__7307_7344 = G__7361; continue; } } else { } } break; } return (self__.watching = derefed); })); (reagent.ratom.Reaction.prototype.reagent$ratom$IComputedImpl$_peek_at$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; if(cljs.core.not(self__.dirty_QMARK_)){ return self__.state; } else { var _STAR_ratom_context_STAR__orig_val__7308 = reagent.ratom._STAR_ratom_context_STAR_; var _STAR_ratom_context_STAR__temp_val__7309 = null; (reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__temp_val__7309); try{return this$__$1.cljs$core$IDeref$_deref$arity$1(null); }finally {(reagent.ratom._STAR_ratom_context_STAR_ = _STAR_ratom_context_STAR__orig_val__7308); }} })); (reagent.ratom.Reaction.prototype.reagent$ratom$IReactiveAtom$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.Reaction.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this$,writer,opts){ var self__ = this; var this$__$1 = this; cljs.core._write(writer,["#"); })); (reagent.ratom.Reaction.prototype.cljs$core$IHash$_hash$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; return goog.getUid(this$__$1); })); (reagent.ratom.Reaction.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (o,other){ var self__ = this; var o__$1 = this; return (o__$1 === other); })); (reagent.ratom.Reaction.prototype.reagent$ratom$IDisposable$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.Reaction.prototype.reagent$ratom$IDisposable$dispose_BANG_$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; var seq__7310_7362 = cljs.core.seq(self__.watching); var chunk__7311_7363 = null; var count__7312_7364 = (0); var i__7313_7365 = (0); while(true){ if((i__7313_7365 < count__7312_7364)){ var w_7366 = chunk__7311_7363.cljs$core$IIndexed$_nth$arity$2(null,i__7313_7365); cljs.core.remove_watch(w_7366,this$__$1); var G__7367 = seq__7310_7362; var G__7368 = chunk__7311_7363; var G__7369 = count__7312_7364; var G__7370 = (i__7313_7365 + (1)); seq__7310_7362 = G__7367; chunk__7311_7363 = G__7368; count__7312_7364 = G__7369; i__7313_7365 = G__7370; continue; } else { var temp__4657__auto___7371 = cljs.core.seq(seq__7310_7362); if(temp__4657__auto___7371){ var seq__7310_7372__$1 = temp__4657__auto___7371; if(cljs.core.chunked_seq_QMARK_(seq__7310_7372__$1)){ var c__5568__auto___7373 = cljs.core.chunk_first(seq__7310_7372__$1); var G__7374 = cljs.core.chunk_rest(seq__7310_7372__$1); var G__7375 = c__5568__auto___7373; var G__7376 = cljs.core.count(c__5568__auto___7373); var G__7377 = (0); seq__7310_7362 = G__7374; chunk__7311_7363 = G__7375; count__7312_7364 = G__7376; i__7313_7365 = G__7377; continue; } else { var w_7378 = cljs.core.first(seq__7310_7372__$1); cljs.core.remove_watch(w_7378,this$__$1); var G__7379 = cljs.core.next(seq__7310_7372__$1); var G__7380 = null; var G__7381 = (0); var G__7382 = (0); seq__7310_7362 = G__7379; chunk__7311_7363 = G__7380; count__7312_7364 = G__7381; i__7313_7365 = G__7382; continue; } } else { } } break; } (self__.watching = null); (self__.state = null); (self__.dirty_QMARK_ = true); if(cljs.core.truth_(self__.active_QMARK_)){ if(reagent.ratom.debug){ cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.ratom._running,cljs.core.dec); } else { } (self__.active_QMARK_ = false); } else { } if(cljs.core.truth_(self__.on_dispose)){ return (self__.on_dispose.cljs$core$IFn$_invoke$arity$0 ? self__.on_dispose.cljs$core$IFn$_invoke$arity$0() : self__.on_dispose.call(null)); } else { return null; } })); (reagent.ratom.Reaction.prototype.cljs$core$IReset$_reset_BANG_$arity$2 = (function (a,newval){ var self__ = this; var a__$1 = this; var oldval = self__.state; (self__.state = newval); if(cljs.core.truth_(self__.on_set)){ (self__.dirty_QMARK_ = true); (self__.on_set.cljs$core$IFn$_invoke$arity$2 ? self__.on_set.cljs$core$IFn$_invoke$arity$2(oldval,newval) : self__.on_set.call(null,oldval,newval)); } else { } a__$1.cljs$core$IWatchable$_notify_watches$arity$3(null,oldval,newval); return newval; })); (reagent.ratom.Reaction.prototype.cljs$core$ISwap$_swap_BANG_$arity$2 = (function (a,f__$1){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(function (){var G__7314 = a__$1.reagent$ratom$IComputedImpl$_peek_at$arity$1(null); return (f__$1.cljs$core$IFn$_invoke$arity$1 ? f__$1.cljs$core$IFn$_invoke$arity$1(G__7314) : f__$1.call(null,G__7314)); })()); })); (reagent.ratom.Reaction.prototype.cljs$core$ISwap$_swap_BANG_$arity$3 = (function (a,f__$1,x){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(function (){var G__7315 = a__$1.reagent$ratom$IComputedImpl$_peek_at$arity$1(null); var G__7316 = x; return (f__$1.cljs$core$IFn$_invoke$arity$2 ? f__$1.cljs$core$IFn$_invoke$arity$2(G__7315,G__7316) : f__$1.call(null,G__7315,G__7316)); })()); })); (reagent.ratom.Reaction.prototype.cljs$core$ISwap$_swap_BANG_$arity$4 = (function (a,f__$1,x,y){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(function (){var G__7317 = a__$1.reagent$ratom$IComputedImpl$_peek_at$arity$1(null); var G__7318 = x; var G__7319 = y; return (f__$1.cljs$core$IFn$_invoke$arity$3 ? f__$1.cljs$core$IFn$_invoke$arity$3(G__7317,G__7318,G__7319) : f__$1.call(null,G__7317,G__7318,G__7319)); })()); })); (reagent.ratom.Reaction.prototype.cljs$core$ISwap$_swap_BANG_$arity$5 = (function (a,f__$1,x,y,more){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,cljs.core.apply.cljs$core$IFn$_invoke$arity$5(f__$1,a__$1.reagent$ratom$IComputedImpl$_peek_at$arity$1(null),x,y,more)); })); (reagent.ratom.Reaction.prototype.reagent$ratom$IRunnable$ = cljs.core.PROTOCOL_SENTINEL); (reagent.ratom.Reaction.prototype.reagent$ratom$IRunnable$run$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; var oldstate = self__.state; var res = reagent.ratom.capture_derefed(self__.f,this$__$1); var derefed = reagent.ratom.captured(this$__$1); if(cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(derefed,self__.watching)){ this$__$1.reagent$ratom$IComputedImpl$_update_watching$arity$2(null,derefed); } else { } if(cljs.core.truth_(self__.active_QMARK_)){ } else { if(reagent.ratom.debug){ cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.ratom._running,cljs.core.inc); } else { } (self__.active_QMARK_ = true); } (self__.dirty_QMARK_ = false); (self__.state = res); this$__$1.cljs$core$IWatchable$_notify_watches$arity$3(null,oldstate,self__.state); return res; })); (reagent.ratom.Reaction.prototype.cljs$core$IWatchable$_notify_watches$arity$3 = (function (this$,oldval,newval){ var self__ = this; var this$__$1 = this; return cljs.core.reduce_kv((function (_,key,f__$1){ (f__$1.cljs$core$IFn$_invoke$arity$4 ? f__$1.cljs$core$IFn$_invoke$arity$4(key,this$__$1,oldval,newval) : f__$1.call(null,key,this$__$1,oldval,newval)); return null; }),null,self__.watches); })); (reagent.ratom.Reaction.prototype.cljs$core$IWatchable$_add_watch$arity$3 = (function (this$,k,wf){ var self__ = this; var this$__$1 = this; return (self__.watches = cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.watches,k,wf)); })); (reagent.ratom.Reaction.prototype.cljs$core$IWatchable$_remove_watch$arity$2 = (function (this$,k){ var self__ = this; var this$__$1 = this; (self__.watches = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.watches,k)); if(((cljs.core.empty_QMARK_(self__.watches)) && (cljs.core.not(self__.auto_run)))){ return this$__$1.reagent$ratom$IDisposable$dispose_BANG_$arity$1(null); } else { return null; } })); (reagent.ratom.Reaction.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; if(cljs.core.truth_((function (){var or__5045__auto__ = self__.auto_run; if(cljs.core.truth_(or__5045__auto__)){ return or__5045__auto__; } else { return (!((reagent.ratom._STAR_ratom_context_STAR_ == null))); } })())){ reagent.ratom.notify_deref_watcher_BANG_(this$__$1); if(cljs.core.truth_(self__.dirty_QMARK_)){ return this$__$1.reagent$ratom$IRunnable$run$arity$1(null); } else { return self__.state; } } else { if(cljs.core.truth_(self__.dirty_QMARK_)){ var oldstate_7383 = self__.state; (self__.state = (self__.f.cljs$core$IFn$_invoke$arity$0 ? self__.f.cljs$core$IFn$_invoke$arity$0() : self__.f.call(null))); if((oldstate_7383 === self__.state)){ } else { this$__$1.cljs$core$IWatchable$_notify_watches$arity$3(null,oldstate_7383,self__.state); } } else { } return self__.state; } })); (reagent.ratom.Reaction.getBasis = (function (){ return new cljs.core.PersistentVector(null, 9, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.with_meta(cljs.core.cst$sym$state,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$dirty_QMARK_,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$active_QMARK_,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$watching,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$watches,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$auto_DASH_run,cljs.core.cst$sym$on_DASH_set,cljs.core.cst$sym$on_DASH_dispose], null); })); (reagent.ratom.Reaction.cljs$lang$type = true); (reagent.ratom.Reaction.cljs$lang$ctorStr = "reagent.ratom/Reaction"); (reagent.ratom.Reaction.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){ return cljs.core._write(writer__5331__auto__,"reagent.ratom/Reaction"); })); /** * Positional factory function for reagent.ratom/Reaction. */ reagent.ratom.__GT_Reaction = (function reagent$ratom$__GT_Reaction(f,state,dirty_QMARK_,active_QMARK_,watching,watches,auto_run,on_set,on_dispose){ return (new reagent.ratom.Reaction(f,state,dirty_QMARK_,active_QMARK_,watching,watches,auto_run,on_set,on_dispose)); }); reagent.ratom.make_reaction = (function reagent$ratom$make_reaction(var_args){ var args__5775__auto__ = []; var len__5769__auto___7388 = arguments.length; var i__5770__auto___7389 = (0); while(true){ if((i__5770__auto___7389 < len__5769__auto___7388)){ args__5775__auto__.push((arguments[i__5770__auto___7389])); var G__7390 = (i__5770__auto___7389 + (1)); i__5770__auto___7389 = G__7390; 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 reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__); }); (reagent.ratom.make_reaction.cljs$core$IFn$_invoke$arity$variadic = (function (f,p__7386){ var map__7387 = p__7386; var map__7387__$1 = cljs.core.__destructure_map(map__7387); var auto_run = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7387__$1,cljs.core.cst$kw$auto_DASH_run); var on_set = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7387__$1,cljs.core.cst$kw$on_DASH_set); var on_dispose = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7387__$1,cljs.core.cst$kw$on_DASH_dispose); var derefed = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__7387__$1,cljs.core.cst$kw$derefed); var runner = ((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(auto_run,true))?reagent.ratom.run:auto_run); var active = (!((derefed == null))); var dirty = (!(active)); var reaction = (new reagent.ratom.Reaction(f,null,dirty,active,null,null,runner,on_set,on_dispose)); if((derefed == null)){ } else { if(reagent.ratom.debug){ cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.ratom._running,cljs.core.inc); } else { } reaction.reagent$ratom$IComputedImpl$_update_watching$arity$2(null,derefed); } return reaction; })); (reagent.ratom.make_reaction.cljs$lang$maxFixedArity = (1)); /** @this {Function} */ (reagent.ratom.make_reaction.cljs$lang$applyTo = (function (seq7384){ var G__7385 = cljs.core.first(seq7384); var seq7384__$1 = cljs.core.next(seq7384); var self__5754__auto__ = this; return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7385,seq7384__$1); })); /** * @constructor * @implements {cljs.core.IWatchable} * @implements {cljs.core.IAtom} * @implements {cljs.core.IEquiv} * @implements {cljs.core.IReset} * @implements {cljs.core.ISwap} * @implements {cljs.core.IDeref} * @implements {cljs.core.IPrintWithWriter} */ reagent.ratom.Wrapper = (function (state,callback,changed,watches){ this.state = state; this.callback = callback; this.changed = changed; this.watches = watches; this.cljs$lang$protocol_mask$partition1$ = 114690; this.cljs$lang$protocol_mask$partition0$ = 2149613568; }); (reagent.ratom.Wrapper.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){ var self__ = this; var this$__$1 = this; if(cljs.core.truth_((function (){var and__5043__auto__ = self__.changed; if(cljs.core.truth_(and__5043__auto__)){ return (!((reagent.ratom._STAR_ratom_context_STAR_ == null))); } else { return and__5043__auto__; } })())){ if((typeof console !== 'undefined')){ console.warn(["Warning: ","derefing stale wrap: ",cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([this$__$1], 0))].join('')); } else { } } else { } return self__.state; })); (reagent.ratom.Wrapper.prototype.cljs$core$IReset$_reset_BANG_$arity$2 = (function (this$,newval){ var self__ = this; var this$__$1 = this; var oldval = self__.state; (self__.changed = true); (self__.state = newval); if((self__.watches == null)){ } else { this$__$1.cljs$core$IWatchable$_notify_watches$arity$3(null,oldval,newval); } (self__.callback.cljs$core$IFn$_invoke$arity$1 ? self__.callback.cljs$core$IFn$_invoke$arity$1(newval) : self__.callback.call(null,newval)); return newval; })); (reagent.ratom.Wrapper.prototype.cljs$core$ISwap$_swap_BANG_$arity$2 = (function (a,f){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(self__.state) : f.call(null,self__.state))); })); (reagent.ratom.Wrapper.prototype.cljs$core$ISwap$_swap_BANG_$arity$3 = (function (a,f,x){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(self__.state,x) : f.call(null,self__.state,x))); })); (reagent.ratom.Wrapper.prototype.cljs$core$ISwap$_swap_BANG_$arity$4 = (function (a,f,x,y){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(self__.state,x,y) : f.call(null,self__.state,x,y))); })); (reagent.ratom.Wrapper.prototype.cljs$core$ISwap$_swap_BANG_$arity$5 = (function (a,f,x,y,more){ var self__ = this; var a__$1 = this; return a__$1.cljs$core$IReset$_reset_BANG_$arity$2(null,cljs.core.apply.cljs$core$IFn$_invoke$arity$5(f,self__.state,x,y,more)); })); (reagent.ratom.Wrapper.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (_,other){ var self__ = this; var ___$1 = this; return (((other instanceof reagent.ratom.Wrapper)) && (((cljs.core.not(self__.changed)) && (((cljs.core.not(other.changed)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(self__.state,other.state)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(self__.callback,other.callback))))))))); })); (reagent.ratom.Wrapper.prototype.cljs$core$IWatchable$_notify_watches$arity$3 = (function (this$,oldval,newval){ var self__ = this; var this$__$1 = this; return cljs.core.reduce_kv((function (_,key,f){ (f.cljs$core$IFn$_invoke$arity$4 ? f.cljs$core$IFn$_invoke$arity$4(key,this$__$1,oldval,newval) : f.call(null,key,this$__$1,oldval,newval)); return null; }),null,self__.watches); })); (reagent.ratom.Wrapper.prototype.cljs$core$IWatchable$_add_watch$arity$3 = (function (this$,key,f){ var self__ = this; var this$__$1 = this; return (self__.watches = cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.watches,key,f)); })); (reagent.ratom.Wrapper.prototype.cljs$core$IWatchable$_remove_watch$arity$2 = (function (this$,key){ var self__ = this; var this$__$1 = this; return (self__.watches = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.watches,key)); })); (reagent.ratom.Wrapper.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (_,writer,opts){ var self__ = this; var ___$1 = this; cljs.core._write(writer,"#"); })); (reagent.ratom.Wrapper.getBasis = (function (){ return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(cljs.core.cst$sym$state,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$callback,cljs.core.with_meta(cljs.core.cst$sym$changed,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$watches,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null))], null); })); (reagent.ratom.Wrapper.cljs$lang$type = true); (reagent.ratom.Wrapper.cljs$lang$ctorStr = "reagent.ratom/Wrapper"); (reagent.ratom.Wrapper.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){ return cljs.core._write(writer__5331__auto__,"reagent.ratom/Wrapper"); })); /** * Positional factory function for reagent.ratom/Wrapper. */ reagent.ratom.__GT_Wrapper = (function reagent$ratom$__GT_Wrapper(state,callback,changed,watches){ return (new reagent.ratom.Wrapper(state,callback,changed,watches)); }); reagent.ratom.make_wrapper = (function reagent$ratom$make_wrapper(value,callback_fn,args){ return (new reagent.ratom.Wrapper(value,(new reagent.impl.util.partial_ifn(callback_fn,args,null)),false,null)); });