mini-program-cljs
Version:
1 lines • 62.3 kB
JSON
["^ ","~:output",["^ ","~:js","goog.provide('datascript.impl.entity');\n\n\n\n\ndatascript.impl.entity.entid = (function datascript$impl$entity$entid(db,eid){\nif(((typeof eid === 'number') || (cljs.core.sequential_QMARK_(eid)) || ((eid instanceof cljs.core.Keyword)))){\nreturn datascript.db.entid(db,eid);\n} else {\nreturn null;\n}\n});\ndatascript.impl.entity.entity = (function datascript$impl$entity$entity(db,eid){\n\nvar temp__5735__auto__ = datascript.impl.entity.entid(db,eid);\nif(cljs.core.truth_(temp__5735__auto__)){\nvar e = temp__5735__auto__;\nvar G__23129 = db;\nvar G__23130 = e;\nvar G__23131 = cljs.core.volatile_BANG_(false);\nvar G__23132 = cljs.core.volatile_BANG_(cljs.core.PersistentArrayMap.EMPTY);\nreturn (datascript.impl.entity.__GT_Entity.cljs$core$IFn$_invoke$arity$4 ? datascript.impl.entity.__GT_Entity.cljs$core$IFn$_invoke$arity$4(G__23129,G__23130,G__23131,G__23132) : datascript.impl.entity.__GT_Entity.call(null,G__23129,G__23130,G__23131,G__23132));\n} else {\nreturn null;\n}\n});\ndatascript.impl.entity.entity_attr = (function datascript$impl$entity$entity_attr(db,a,datoms){\nif(datascript.db.multival_QMARK_(db,a)){\nif(datascript.db.ref_QMARK_(db,a)){\nreturn cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__23133_SHARP_,p2__23134_SHARP_){\nreturn cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__23133_SHARP_,datascript.impl.entity.entity(db,new cljs.core.Keyword(null,\"v\",\"v\",21465059).cljs$core$IFn$_invoke$arity$1(p2__23134_SHARP_)));\n}),cljs.core.PersistentHashSet.EMPTY,datoms);\n} else {\nreturn cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__23135_SHARP_,p2__23136_SHARP_){\nreturn cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__23135_SHARP_,new cljs.core.Keyword(null,\"v\",\"v\",21465059).cljs$core$IFn$_invoke$arity$1(p2__23136_SHARP_));\n}),cljs.core.PersistentHashSet.EMPTY,datoms);\n}\n} else {\nif(datascript.db.ref_QMARK_(db,a)){\nreturn datascript.impl.entity.entity(db,new cljs.core.Keyword(null,\"v\",\"v\",21465059).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms)));\n} else {\nreturn new cljs.core.Keyword(null,\"v\",\"v\",21465059).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms));\n}\n}\n});\ndatascript.impl.entity._lookup_backwards = (function datascript$impl$entity$_lookup_backwards(db,eid,attr,not_found){\nvar temp__5733__auto__ = cljs.core.not_empty(datascript.db._search(db,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,attr,eid], null)));\nif(cljs.core.truth_(temp__5733__auto__)){\nvar datoms = temp__5733__auto__;\nif(datascript.db.component_QMARK_(db,attr)){\nreturn datascript.impl.entity.entity(db,new cljs.core.Keyword(null,\"e\",\"e\",1381269198).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms)));\n} else {\nreturn cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__23137_SHARP_,p2__23138_SHARP_){\nreturn cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__23137_SHARP_,datascript.impl.entity.entity(db,new cljs.core.Keyword(null,\"e\",\"e\",1381269198).cljs$core$IFn$_invoke$arity$1(p2__23138_SHARP_)));\n}),cljs.core.PersistentHashSet.EMPTY,datoms);\n}\n} else {\nreturn not_found;\n}\n});\ndatascript.impl.entity.multival__GT_js = (function datascript$impl$entity$multival__GT_js(val){\nif(cljs.core.truth_(val)){\nreturn cljs.core.to_array(val);\n} else {\nreturn null;\n}\n});\ndatascript.impl.entity.js_seq = (function datascript$impl$entity$js_seq(e){\n(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(e) : datascript.impl.entity.touch.call(null,e));\n\nvar iter__4582__auto__ = (function datascript$impl$entity$js_seq_$_iter__23139(s__23140){\nreturn (new cljs.core.LazySeq(null,(function (){\nvar s__23140__$1 = s__23140;\nwhile(true){\nvar temp__5735__auto__ = cljs.core.seq(s__23140__$1);\nif(temp__5735__auto__){\nvar s__23140__$2 = temp__5735__auto__;\nif(cljs.core.chunked_seq_QMARK_(s__23140__$2)){\nvar c__4580__auto__ = cljs.core.chunk_first(s__23140__$2);\nvar size__4581__auto__ = cljs.core.count(c__4580__auto__);\nvar b__23142 = cljs.core.chunk_buffer(size__4581__auto__);\nif((function (){var i__23141 = (0);\nwhile(true){\nif((i__23141 < size__4581__auto__)){\nvar vec__23143 = cljs.core._nth(c__4580__auto__,i__23141);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23143,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23143,(1),null);\ncljs.core.chunk_append(b__23142,((datascript.db.multival_QMARK_(e.db,a))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,datascript.impl.entity.multival__GT_js(v)], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,v], null)));\n\nvar G__23189 = (i__23141 + (1));\ni__23141 = G__23189;\ncontinue;\n} else {\nreturn true;\n}\nbreak;\n}\n})()){\nreturn cljs.core.chunk_cons(cljs.core.chunk(b__23142),datascript$impl$entity$js_seq_$_iter__23139(cljs.core.chunk_rest(s__23140__$2)));\n} else {\nreturn cljs.core.chunk_cons(cljs.core.chunk(b__23142),null);\n}\n} else {\nvar vec__23146 = cljs.core.first(s__23140__$2);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23146,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23146,(1),null);\nreturn cljs.core.cons(((datascript.db.multival_QMARK_(e.db,a))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,datascript.impl.entity.multival__GT_js(v)], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,v], null)),datascript$impl$entity$js_seq_$_iter__23139(cljs.core.rest(s__23140__$2)));\n}\n} else {\nreturn null;\n}\nbreak;\n}\n}),null,null));\n});\nreturn iter__4582__auto__(cljs.core.deref(e.cache));\n});\n\n/**\n* @constructor\n * @implements {cljs.core.IEquiv}\n * @implements {cljs.core.IHash}\n * @implements {cljs.core.IFn}\n * @implements {cljs.core.ICounted}\n * @implements {cljs.core.ISeqable}\n * @implements {cljs.core.IPrintWithWriter}\n * @implements {cljs.core.IAssociative}\n * @implements {cljs.core.ILookup}\n*/\ndatascript.impl.entity.Entity = (function (db,eid,touched,cache){\nthis.db = db;\nthis.eid = eid;\nthis.touched = touched;\nthis.cache = cache;\nthis.cljs$lang$protocol_mask$partition0$ = 2162164483;\nthis.cljs$lang$protocol_mask$partition1$ = 0;\n});\n(datascript.impl.entity.Entity.prototype.entry_set = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.to_array(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.to_array,datascript.impl.entity.js_seq(this$)));\n}));\n\n(datascript.impl.entity.Entity.prototype.forEach = (function() {\nvar G__23192 = null;\nvar G__23192__1 = (function (f){\nvar self__ = this;\nvar this$ = this;\nvar seq__23150 = cljs.core.seq(datascript.impl.entity.js_seq(this$));\nvar chunk__23151 = null;\nvar count__23152 = (0);\nvar i__23153 = (0);\nwhile(true){\nif((i__23153 < count__23152)){\nvar vec__23160 = chunk__23151.cljs$core$IIndexed$_nth$arity$2(null,i__23153);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23160,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23160,(1),null);\n(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(v,a,this$) : f.call(null,v,a,this$));\n\n\nvar G__23193 = seq__23150;\nvar G__23194 = chunk__23151;\nvar G__23195 = count__23152;\nvar G__23196 = (i__23153 + (1));\nseq__23150 = G__23193;\nchunk__23151 = G__23194;\ncount__23152 = G__23195;\ni__23153 = G__23196;\ncontinue;\n} else {\nvar temp__5735__auto__ = cljs.core.seq(seq__23150);\nif(temp__5735__auto__){\nvar seq__23150__$1 = temp__5735__auto__;\nif(cljs.core.chunked_seq_QMARK_(seq__23150__$1)){\nvar c__4609__auto__ = cljs.core.chunk_first(seq__23150__$1);\nvar G__23199 = cljs.core.chunk_rest(seq__23150__$1);\nvar G__23200 = c__4609__auto__;\nvar G__23201 = cljs.core.count(c__4609__auto__);\nvar G__23202 = (0);\nseq__23150 = G__23199;\nchunk__23151 = G__23200;\ncount__23152 = G__23201;\ni__23153 = G__23202;\ncontinue;\n} else {\nvar vec__23163 = cljs.core.first(seq__23150__$1);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23163,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23163,(1),null);\n(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(v,a,this$) : f.call(null,v,a,this$));\n\n\nvar G__23205 = cljs.core.next(seq__23150__$1);\nvar G__23206 = null;\nvar G__23207 = (0);\nvar G__23208 = (0);\nseq__23150 = G__23205;\nchunk__23151 = G__23206;\ncount__23152 = G__23207;\ni__23153 = G__23208;\ncontinue;\n}\n} else {\nreturn null;\n}\n}\nbreak;\n}\n});\nvar G__23192__2 = (function (f,use_as_this){\nvar self__ = this;\nvar this$ = this;\nvar seq__23166 = cljs.core.seq(datascript.impl.entity.js_seq(this$));\nvar chunk__23167 = null;\nvar count__23168 = (0);\nvar i__23169 = (0);\nwhile(true){\nif((i__23169 < count__23168)){\nvar vec__23176 = chunk__23167.cljs$core$IIndexed$_nth$arity$2(null,i__23169);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23176,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23176,(1),null);\nf.call(use_as_this,v,a,this$);\n\n\nvar G__23224 = seq__23166;\nvar G__23225 = chunk__23167;\nvar G__23226 = count__23168;\nvar G__23227 = (i__23169 + (1));\nseq__23166 = G__23224;\nchunk__23167 = G__23225;\ncount__23168 = G__23226;\ni__23169 = G__23227;\ncontinue;\n} else {\nvar temp__5735__auto__ = cljs.core.seq(seq__23166);\nif(temp__5735__auto__){\nvar seq__23166__$1 = temp__5735__auto__;\nif(cljs.core.chunked_seq_QMARK_(seq__23166__$1)){\nvar c__4609__auto__ = cljs.core.chunk_first(seq__23166__$1);\nvar G__23228 = cljs.core.chunk_rest(seq__23166__$1);\nvar G__23229 = c__4609__auto__;\nvar G__23230 = cljs.core.count(c__4609__auto__);\nvar G__23231 = (0);\nseq__23166 = G__23228;\nchunk__23167 = G__23229;\ncount__23168 = G__23230;\ni__23169 = G__23231;\ncontinue;\n} else {\nvar vec__23179 = cljs.core.first(seq__23166__$1);\nvar a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23179,(0),null);\nvar v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23179,(1),null);\nf.call(use_as_this,v,a,this$);\n\n\nvar G__23234 = cljs.core.next(seq__23166__$1);\nvar G__23235 = null;\nvar G__23236 = (0);\nvar G__23237 = (0);\nseq__23166 = G__23234;\nchunk__23167 = G__23235;\ncount__23168 = G__23236;\ni__23169 = G__23237;\ncontinue;\n}\n} else {\nreturn null;\n}\n}\nbreak;\n}\n});\nG__23192 = function(f,use_as_this){\nswitch(arguments.length){\ncase 1:\nreturn G__23192__1.call(this,f);\ncase 2:\nreturn G__23192__2.call(this,f,use_as_this);\n}\nthrow(new Error('Invalid arity: ' + arguments.length));\n};\nG__23192.cljs$core$IFn$_invoke$arity$1 = G__23192__1;\nG__23192.cljs$core$IFn$_invoke$arity$2 = G__23192__2;\nreturn G__23192;\n})()\n);\n\n(datascript.impl.entity.Entity.prototype.get = (function (attr){\nvar self__ = this;\nvar this$ = this;\nif(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(attr,\":db/id\")){\nreturn self__.eid;\n} else {\nif(datascript.db.reverse_ref_QMARK_(attr)){\nreturn datascript.impl.entity.multival__GT_js(datascript.impl.entity._lookup_backwards(self__.db,self__.eid,datascript.db.reverse_ref(attr),null));\n} else {\nvar G__23182 = (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2(this$,attr) : datascript.impl.entity.lookup_entity.call(null,this$,attr));\nif(datascript.db.multival_QMARK_(self__.db,attr)){\nreturn datascript.impl.entity.multival__GT_js(G__23182);\n} else {\nreturn G__23182;\n}\n}\n}\n}));\n\n(datascript.impl.entity.Entity.prototype.key_set = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.to_array(cljs.core.keys(this$));\n}));\n\n(datascript.impl.entity.Entity.prototype.entries = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.es6_entries_iterator(datascript.impl.entity.js_seq(this$));\n}));\n\n(datascript.impl.entity.Entity.prototype.value_set = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.to_array(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.second,datascript.impl.entity.js_seq(this$)));\n}));\n\n(datascript.impl.entity.Entity.prototype.toString = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.pr_str_STAR_(this$);\n}));\n\n(datascript.impl.entity.Entity.prototype.keys = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.es6_iterator(cljs.core.keys(this$));\n}));\n\n(datascript.impl.entity.Entity.prototype.values = (function (){\nvar self__ = this;\nvar this$ = this;\nreturn cljs.core.es6_iterator(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.second,datascript.impl.entity.js_seq(this$)));\n}));\n\n(datascript.impl.entity.Entity.prototype.equiv = (function (other){\nvar self__ = this;\nvar this$ = this;\nreturn (datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2(this$,other) : datascript.impl.entity.equiv_entity.call(null,this$,other));\n}));\n\n(datascript.impl.entity.Entity.prototype.has = (function (attr){\nvar self__ = this;\nvar this$ = this;\nreturn (!((this$.get(attr) == null)));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this$,attr){\nvar self__ = this;\nvar this$__$1 = this;\nreturn (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,attr,null) : datascript.impl.entity.lookup_entity.call(null,this$__$1,attr,null));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this$,attr,not_found){\nvar self__ = this;\nvar this$__$1 = this;\nreturn (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,attr,not_found) : datascript.impl.entity.lookup_entity.call(null,this$__$1,attr,not_found));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (_,writer,opts){\nvar self__ = this;\nvar ___$1 = this;\nreturn cljs.core._pr_writer(cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(self__.cache),new cljs.core.Keyword(\"db\",\"id\",\"db/id\",-1388397098),self__.eid),writer,opts);\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){\nvar self__ = this;\nvar this$__$1 = this;\n(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(this$__$1) : datascript.impl.entity.touch.call(null,this$__$1));\n\nreturn cljs.core.count(cljs.core.deref(self__.cache));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IHash$_hash$arity$1 = (function (_){\nvar self__ = this;\nvar ___$1 = this;\nreturn cljs.core.hash(self__.eid);\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this$,o){\nvar self__ = this;\nvar this$__$1 = this;\nreturn (datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2(this$__$1,o) : datascript.impl.entity.equiv_entity.call(null,this$__$1,o));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this$,k){\nvar self__ = this;\nvar this$__$1 = this;\nreturn cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(\"datascript.impl.entity\",\"nf\",\"datascript.impl.entity/nf\",-953741353),(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,k,new cljs.core.Keyword(\"datascript.impl.entity\",\"nf\",\"datascript.impl.entity/nf\",-953741353)) : datascript.impl.entity.lookup_entity.call(null,this$__$1,k,new cljs.core.Keyword(\"datascript.impl.entity\",\"nf\",\"datascript.impl.entity/nf\",-953741353))));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this$){\nvar self__ = this;\nvar this$__$1 = this;\n(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(this$__$1) : datascript.impl.entity.touch.call(null,this$__$1));\n\nreturn cljs.core.seq(cljs.core.deref(self__.cache));\n}));\n\n(datascript.impl.entity.Entity.prototype.call = (function (unused__10585__auto__){\nvar self__ = this;\nvar self__ = this;\nvar G__23183 = (arguments.length - (1));\nswitch (G__23183) {\ncase (1):\nreturn self__.cljs$core$IFn$_invoke$arity$1((arguments[(1)]));\n\nbreak;\ncase (2):\nreturn self__.cljs$core$IFn$_invoke$arity$2((arguments[(1)]),(arguments[(2)]));\n\nbreak;\ndefault:\nthrow (new Error([\"Invalid arity: \",cljs.core.str.cljs$core$IFn$_invoke$arity$1((arguments.length - (1)))].join('')));\n\n}\n}));\n\n(datascript.impl.entity.Entity.prototype.apply = (function (self__,args23149){\nvar self__ = this;\nvar self____$1 = this;\nreturn self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone(args23149)));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IFn$_invoke$arity$1 = (function (k){\nvar self__ = this;\nvar this$ = this;\nreturn (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2(this$,k) : datascript.impl.entity.lookup_entity.call(null,this$,k));\n}));\n\n(datascript.impl.entity.Entity.prototype.cljs$core$IFn$_invoke$arity$2 = (function (k,not_found){\nvar self__ = this;\nvar this$ = this;\nreturn (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$,k,not_found) : datascript.impl.entity.lookup_entity.call(null,this$,k,not_found));\n}));\n\n(datascript.impl.entity.Entity.getBasis = (function (){\nreturn new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,\"db\",\"db\",-1661185010,null),new cljs.core.Symbol(null,\"eid\",\"eid\",-2094915839,null),new cljs.core.Symbol(null,\"touched\",\"touched\",1031397108,null),new cljs.core.Symbol(null,\"cache\",\"cache\",403508473,null)], null);\n}));\n\n(datascript.impl.entity.Entity.cljs$lang$type = true);\n\n(datascript.impl.entity.Entity.cljs$lang$ctorStr = \"datascript.impl.entity/Entity\");\n\n(datascript.impl.entity.Entity.cljs$lang$ctorPrWriter = (function (this__4428__auto__,writer__4429__auto__,opt__4430__auto__){\nreturn cljs.core._write(writer__4429__auto__,\"datascript.impl.entity/Entity\");\n}));\n\n/**\n * Positional factory function for datascript.impl.entity/Entity.\n */\ndatascript.impl.entity.__GT_Entity = (function datascript$impl$entity$__GT_Entity(db,eid,touched,cache){\nreturn (new datascript.impl.entity.Entity(db,eid,touched,cache));\n});\n\ndatascript.impl.entity.entity_QMARK_ = (function datascript$impl$entity$entity_QMARK_(x){\nreturn (x instanceof datascript.impl.entity.Entity);\n});\ndatascript.impl.entity.equiv_entity = (function datascript$impl$entity$equiv_entity(this$,that){\nreturn (((that instanceof datascript.impl.entity.Entity)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this$.eid,that.eid)));\n});\ndatascript.impl.entity.lookup_entity = (function datascript$impl$entity$lookup_entity(var_args){\nvar G__23185 = arguments.length;\nswitch (G__23185) {\ncase 2:\nreturn datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));\n\nbreak;\ncase 3:\nreturn datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));\n\nbreak;\ndefault:\nthrow (new Error([\"Invalid arity: \",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));\n\n}\n});\n\n(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 = (function (this$,attr){\nreturn datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$,attr,null);\n}));\n\n(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 = (function (this$,attr,not_found){\nif(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(attr,new cljs.core.Keyword(\"db\",\"id\",\"db/id\",-1388397098))){\nreturn this$.eid;\n} else {\nif(datascript.db.reverse_ref_QMARK_(attr)){\nreturn datascript.impl.entity._lookup_backwards(this$.db,this$.eid,datascript.db.reverse_ref(attr),not_found);\n} else {\nvar temp__5737__auto__ = (function (){var fexpr__23186 = cljs.core.deref(this$.cache);\nreturn (fexpr__23186.cljs$core$IFn$_invoke$arity$1 ? fexpr__23186.cljs$core$IFn$_invoke$arity$1(attr) : fexpr__23186.call(null,attr));\n})();\nif((temp__5737__auto__ == null)){\nif(cljs.core.truth_(cljs.core.deref(this$.touched))){\nreturn not_found;\n} else {\nvar temp__5737__auto____$1 = cljs.core.not_empty(datascript.db._search(this$.db,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [this$.eid,attr], null)));\nif((temp__5737__auto____$1 == null)){\nreturn not_found;\n} else {\nvar datoms = temp__5737__auto____$1;\nvar value = datascript.impl.entity.entity_attr(this$.db,attr,datoms);\ncljs.core.vreset_BANG_(this$.cache,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(this$.cache),attr,value));\n\nreturn value;\n}\n}\n} else {\nvar v = temp__5737__auto__;\nreturn v;\n}\n}\n}\n}));\n\n(datascript.impl.entity.lookup_entity.cljs$lang$maxFixedArity = 3);\n\ndatascript.impl.entity.touch_components = (function datascript$impl$entity$touch_components(db,a__GT_v){\nreturn cljs.core.reduce_kv((function (acc,a,v){\nreturn cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(acc,a,((datascript.db.component_QMARK_(db,a))?((datascript.db.multival_QMARK_(db,a))?cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2(datascript.impl.entity.touch,v)):(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(v) : datascript.impl.entity.touch.call(null,v))):v));\n}),cljs.core.PersistentArrayMap.EMPTY,a__GT_v);\n});\ndatascript.impl.entity.datoms__GT_cache = (function datascript$impl$entity$datoms__GT_cache(db,datoms){\nreturn cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (acc,part){\nvar a = new cljs.core.Keyword(null,\"a\",\"a\",-2123407586).cljs$core$IFn$_invoke$arity$1(cljs.core.first(part));\nreturn cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(acc,a,datascript.impl.entity.entity_attr(db,a,part));\n}),cljs.core.PersistentArrayMap.EMPTY,cljs.core.partition_by.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,\"a\",\"a\",-2123407586),datoms));\n});\ndatascript.impl.entity.touch = (function datascript$impl$entity$touch(e){\n\nif(cljs.core.truth_(cljs.core.deref(e.touched))){\n} else {\nvar temp__5735__auto___23300 = cljs.core.not_empty(datascript.db._search(e.db,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [e.eid], null)));\nif(cljs.core.truth_(temp__5735__auto___23300)){\nvar datoms_23303 = temp__5735__auto___23300;\ncljs.core.vreset_BANG_(e.cache,datascript.impl.entity.touch_components(e.db,datascript.impl.entity.datoms__GT_cache(e.db,datoms_23303)));\n\ncljs.core.vreset_BANG_(e.touched,true);\n} else {\n}\n}\n\nreturn e;\n});\ngoog.exportSymbol(\"datascript.impl.entity.Entity\",datascript.impl.entity.Entity);\n","~:ns-info",["^ ","~:rename-macros",null,"~:renames",["^ "],"~:meta",["^ ","~:file","datascript/impl/entity.cljc","~:line",1,"~:column",14,"~:end-line",1,"~:end-column",36,"~:no-doc",true],"~:ns-aliases",["^ ","~$cljs.loader","~$shadow.loader"],"~:use-macros",null,"~:excludes",["~#set",["~$get","~$keys"]],"~:name","~$datascript.impl.entity","~:op","~:ns","~:imports",null,"~:requires",["^ ","~$cljs.core","^J","~$c","^J","~$datascript.db","^K","~$db","^K","~$goog","^M"],"~:seen",["^A",["~:require"]],"~:uses",null,"~:require-macros",["^ ","^J","^J","~$c","^J","^K","^K","^L","^K"],"~:form",["~#list",["~$ns","^E",["^S",["~:refer-clojure","~:exclude",["^C","^B"]]],["^S",["^O",["^J","~:as","~$c"],["^K","^W","^L"]]]]],"~:flags",["^ ","^O",["^A",[]]],"~:js-deps",["^ "],"~:deps",["^M","^J","^K"]],"^G","^E","~:resource-id",["~:shadow.build.classpath/resource","datascript/impl/entity.cljc"],"~:compiled-at",1590236737633,"~:resource-name","datascript/impl/entity.cljc","~:warnings",[],"~:source","(ns ^:no-doc datascript.impl.entity\n (:refer-clojure :exclude [keys get])\n (:require [#?(:cljs cljs.core :clj clojure.core) :as c]\n [datascript.db :as db]))\n\n(declare entity ->Entity equiv-entity lookup-entity touch)\n\n(defn- entid [db eid]\n (when (or (number? eid)\n (sequential? eid)\n (keyword? eid))\n (db/entid db eid)))\n\n(defn entity [db eid]\n {:pre [(db/db? db)]}\n (when-let [e (entid db eid)]\n (->Entity db e (volatile! false) (volatile! {}))))\n\n(defn- entity-attr [db a datoms]\n (if (db/multival? db a)\n (if (db/ref? db a)\n (reduce #(conj %1 (entity db (:v %2))) #{} datoms)\n (reduce #(conj %1 (:v %2)) #{} datoms))\n (if (db/ref? db a)\n (entity db (:v (first datoms)))\n (:v (first datoms)))))\n\n(defn- -lookup-backwards [db eid attr not-found]\n (if-let [datoms (not-empty (db/-search db [nil attr eid]))]\n (if (db/component? db attr)\n (entity db (:e (first datoms)))\n (reduce #(conj %1 (entity db (:e %2))) #{} datoms))\n not-found))\n\n#?(:cljs\n (defn- multival->js [val]\n (when val (to-array val))))\n\n#?(:cljs\n (defn- js-seq [e]\n (touch e)\n (for [[a v] @(.-cache e)]\n (if (db/multival? (.-db e) a)\n [a (multival->js v)]\n [a v]))))\n\n(deftype Entity [db eid touched cache]\n #?@(:cljs\n [Object\n (toString [this]\n (pr-str* this))\n (equiv [this other]\n (equiv-entity this other))\n\n ;; js/map interface\n (keys [this]\n (es6-iterator (c/keys this)))\n (entries [this]\n (es6-entries-iterator (js-seq this)))\n (values [this]\n (es6-iterator (map second (js-seq this))))\n (has [this attr]\n (not (nil? (.get this attr))))\n (get [this attr]\n (if (= attr \":db/id\")\n eid\n (if (db/reverse-ref? attr)\n (-> (-lookup-backwards db eid (db/reverse-ref attr) nil)\n multival->js)\n (cond-> (lookup-entity this attr)\n (db/multival? db attr) multival->js))))\n (forEach [this f]\n (doseq [[a v] (js-seq this)]\n (f v a this)))\n (forEach [this f use-as-this]\n (doseq [[a v] (js-seq this)]\n (.call f use-as-this v a this)))\n\n ;; js fallbacks\n (key_set [this] (to-array (c/keys this)))\n (entry_set [this] (to-array (map to-array (js-seq this))))\n (value_set [this] (to-array (map second (js-seq this))))\n\n IEquiv\n (-equiv [this o] (equiv-entity this o))\n\n IHash\n (-hash [_]\n (hash eid)) ;; db?\n\n ISeqable\n (-seq [this]\n (touch this)\n (seq @cache))\n\n ICounted\n (-count [this]\n (touch this)\n (count @cache))\n\n ILookup\n (-lookup [this attr] (lookup-entity this attr nil))\n (-lookup [this attr not-found] (lookup-entity this attr not-found))\n\n IAssociative\n (-contains-key? [this k]\n (not= ::nf (lookup-entity this k ::nf)))\n\n IFn\n (-invoke [this k]\n (lookup-entity this k))\n (-invoke [this k not-found]\n (lookup-entity this k not-found))\n\n IPrintWithWriter\n (-pr-writer [_ writer opts]\n (-pr-writer (assoc @cache :db/id eid) writer opts))]\n\n :clj\n [Object\n (toString [e] (pr-str (assoc @cache :db/id eid)))\n (hashCode [e] (hash eid)) ; db?\n (equals [e o] (equiv-entity e o))\n\n clojure.lang.Seqable\n (seq [e] (touch e) (seq @cache))\n\n clojure.lang.Associative\n (equiv [e o] (equiv-entity e o))\n (containsKey [e k] (not= ::nf (lookup-entity e k ::nf)))\n (entryAt [e k] (some->> (lookup-entity e k) (clojure.lang.MapEntry. k)))\n\n (empty [e] (throw (UnsupportedOperationException.)))\n (assoc [e k v] (throw (UnsupportedOperationException.)))\n (cons [e [k v]] (throw (UnsupportedOperationException.)))\n (count [e] (touch e) (count @(.-cache e)))\n\n clojure.lang.ILookup\n (valAt [e k] (lookup-entity e k))\n (valAt [e k not-found] (lookup-entity e k not-found))\n\n clojure.lang.IFn\n (invoke [e k] (lookup-entity e k))\n (invoke [e k not-found] (lookup-entity e k not-found))\n ]))\n\n(defn entity? [x] (instance? Entity x))\n\n#?(:clj\n (defmethod print-method Entity [e, ^java.io.Writer w]\n (.write w (str e))))\n\n(defn- equiv-entity [^Entity this that]\n (and\n (instance? Entity that)\n ;; (= db (.-db ^Entity that))\n (= (.-eid this) (.-eid ^Entity that))))\n\n(defn- lookup-entity\n ([this attr] (lookup-entity this attr nil))\n ([^Entity this attr not-found]\n (if (= attr :db/id)\n (.-eid this)\n (if (db/reverse-ref? attr)\n (-lookup-backwards (.-db this) (.-eid this) (db/reverse-ref attr) not-found)\n (if-some [v (@(.-cache this) attr)]\n v\n (if @(.-touched this)\n not-found\n (if-some [datoms (not-empty (db/-search (.-db this) [(.-eid this) attr]))]\n (let [value (entity-attr (.-db this) attr datoms)]\n (vreset! (.-cache this) (assoc @(.-cache this) attr value))\n value)\n not-found)))))))\n\n(defn touch-components [db a->v]\n (reduce-kv (fn [acc a v]\n (assoc acc a\n (if (db/component? db a)\n (if (db/multival? db a)\n (set (map touch v))\n (touch v))\n v)))\n {} a->v))\n\n(defn- datoms->cache [db datoms]\n (reduce (fn [acc part]\n (let [a (:a (first part))]\n (assoc acc a (entity-attr db a part))))\n {} (partition-by :a datoms)))\n\n(defn touch [^Entity e]\n {:pre [(entity? e)]}\n (when-not @(.-touched e)\n (when-let [datoms (not-empty (db/-search (.-db e) [(.-eid e)]))]\n (vreset! (.-cache e) (->> datoms\n (datoms->cache (.-db e))\n (touch-components (.-db e))))\n (vreset! (.-touched e) true)))\n e)\n\n#?(:cljs (goog/exportSymbol \"datascript.impl.entity.Entity\" Entity))\n","~:reader-features",["^A",["~:cljs"]],"~:cljc",true,"~:source-map-compact",["^ ","mappings",";AAKA,AAAA;AAAA;AAAA;AAAA;AAAA,AAEA,AAAA,AAAOA,AAAOC,AAAGC;AAAjB,AACE,AAAM,AAAI,AAASA,AACT,AAACC,AAAYD,AACb,AAAAE,AAAUF;AAFpB,AAGE,AAACG,AAASJ,AAAGC;;AAHf;;;AAKF,AAAA,AAAMI,AAAQL,AAAGC;AAAjB,AAAA;AAEE,AAAAK,AAAa,AAACP,AAAMC,AAAGC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AInH,AAAE,AAACD,AAAYd,AAAGe,AAAEsH;AAFnC,AAGK,AAAA,AAACC,AAAgBtH;;AAExB,AAAA,AAAMuB,AAAehC;AAArB,AAAA;AAEE,AAAA,AAAAuD,AAAW,AAAWvD;AAAtB;AAAA,AACE,AAAAD,AAAkB,AAACwB,AAAU,AAAA,AAACC,AAAW,AAAMxB,AAAI,AAAOA;AAA1D,AAAA,AAAAD;AAAA,AAAA,AAAAA,AAAWU;AAAX,AACE,AAAC8G,AAAQ,AAASvH,AAAQS,AACA,AAACoH,AAAc,AAAM7H,AACrB,AAACwH,AAAiB,AAAMxH;;AAClD,AAAA,AAACuH,AAAQ,AAAWvH;;AAJtB;;;AAKFA;;AAEO,AAAA,AAACgI,AAAkD7D","names",["datascript.impl.entity/entid","db","eid","cljs.core/sequential?","cljs.core/Keyword","datascript.db/entid","datascript.impl.entity/entity","temp__5735__auto__","e","G__23129","G__23130","G__23131","G__23132","datascript.impl.entity/->Entity","cljs.core/volatile!","datascript.impl.entity/entity-attr","a","datoms","datascript.db/multival?","datascript.db/ref?","p1__23133#","p2__23134#","cljs.core.reduce","cljs.core.conj","p1__23135#","p2__23136#","cljs.core/first","datascript.impl.entity/-lookup-backwards","attr","not-found","temp__5733__auto__","cljs.core/not-empty","datascript.db/-search","datascript.db/component?","p1__23137#","p2__23138#","datascript.impl.entity/multival->js","val","cljs.core/to-array","datascript.impl.entity/js-seq","datascript.impl.entity/touch","iter__4582__auto__","s__23140","cljs.core/LazySeq","cljs.core/seq","cljs.core/chunked-seq?","c__4580__auto__","size__4581__auto__","cljs.core/count","b__23142","cljs.core/chunk-buffer","i__23141","vec__23143","cljs.core/-nth","cljs.core.nth","cljs.core/chunk-append","cljs.core/chunk-cons","cljs.core/chunk","iter__23139","cljs.core/chunk-rest","vec__23146","cljs.core/cons","cljs.core/rest","cljs.core/deref","v","unused__10585__auto__","self__","G__23183","js/Error","args23149","cljs.core/aclone","this__4428__auto__","writer__4429__auto__","opt__4430__auto__","cljs.core/-write","datascript.impl.entity/Entity","touched","cache","this","cljs.core/pr-str*","other","datascript.impl.entity/equiv-entity","cljs.core/es6-iterator","cljs.core/keys","cljs.core/es6-entries-iterator","cljs.core.map","cljs.core/second","cljs.core._EQ_","datascript.db/reverse-ref?","datascript.db/reverse-ref","G__23182","datascript.impl.entity/lookup-entity","f","seq__23150","chunk__23151","count__23152","i__23153","vec__23160","c__4609__auto__","cljs.core/chunk-first","vec__23163","cljs.core/next","use-as-this","seq__23166","chunk__23167","count__23168","i__23169","vec__23176","vec__23179","o","_","cljs.core/hash","k","cljs.core.not_EQ_","writer","opts","cljs.core/-pr-writer","cljs.core.assoc","datascript.impl.entity/entity?","x","that","var_args","G__23185","datascript.impl.entity.lookup_entity","temp__5737__auto__","fexpr__23186","value","cljs.core/vreset!","datascript.impl.entity/touch-components","a->v","cljs.core/reduce-kv","acc","cljs.core/set","datascript.impl.entity/datoms->cache","part","cljs.core.partition_by","goog/exportSymbol"]],"~:used-vars",["^A",["~$cljs.core/to-array","~$cljs.core/sequential?","~$datascript.db/component?","~$cljs.core/=","~$cljs.core/keys","~$cljs.core/-write","~$cljs.core/hash","~$cljs.core/count","~$cljs.core/deref","~$cljs.core/reduce","~$cljs.core/seq","~$cljs.core/Keyword","~$cljs.core/aclone","~$datascript.db/ref?","~$cljs.core/vreset!","~$cljs.core/not=","~$cljs.core/es6-iterator","~$datascript.impl.entity/entity?","~$cljs.core/chunk-rest","~$cljs.core/pr-str*","~$goog/exportSymbol","~$datascript.db/reverse-ref?","~$datascript.impl.entity/entity","~$cljs.core/set","~$datascript.impl.entity/equiv-entity","~$datascript.impl.entity/entity-attr","~$cljs.core/conj","~$datascript.impl.entity/Entity","~$datascript.impl.entity/touch-components","~$cljs.core/map","~$datascript.db/multival?","~$datascript.db/reverse-ref","~$datascript.impl.entity/js-seq","~$cljs.core/partition-by","~$datascript.impl.entity/-lookup-backwards","~$cljs.core/-pr-writer","~$datascript.impl.entity/touch","~$datascript.impl.entity/lookup-entity","~$datascript.impl.entity/->Entity","~$datascript.db/entid","~$datascript.impl.entity/entid","~$datascript.impl.entity/datoms->cache","~$cljs.core/second","~$datascript.impl.entity/multival->js","~$cljs.core/next","~$cljs.core/not","~$cljs.core/assoc","~$cljs.core/reduce-kv","~$cljs.core/first","~$cljs.core/es6-entries-iterator","~$js/Error","~$cljs.core/chunked-seq?"]]],"~:cache-keys",["~#cmap",[["^10","datascript/db.cljc"],[1590236302000,"~:shadow.build.compiler/resolve",["^ ","~:require-id",null,"~:deps-ids",["^A",[]],"~:deps-syms",["^M","^J","~$goog.array","~$clojure.walk","~$clojure.data","~$me.tonsky.persistent-sorted-set","~$me.tonsky.persistent-sorted-set.arrays"]]],["^10","goog/dom/tagname.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","~$goog.dom.HtmlElement"]]],["^10","goog/math/math.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","~$goog.asserts"]]],["^10","goog/html/trustedtypes.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/labs/useragent/browser.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","~$goog.labs.userAgent.util","~$goog.object","~$goog.string.internal"]]],["^10","goog/html/safeurl.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","~$goog.fs.url","~$goog.html.TrustedResourceUrl","~$goog.i18n.bidi.Dir","~$goog.i18n.bidi.DirectionalString","~$goog.string.Const","~$goog.string.TypedString","^2S"]]],["^10","goog/array/array.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P"]]],["^10","goog/debug/error.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/dom/nodetype.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/string/typedstring.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/object/object.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/dom/asserts.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P"]]],"~:SHADOW-TIMESTAMP",[1585692398000,1585692398000,1579838325000],["^10","goog/math/long.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","~$goog.reflect"]]],["^10","goog/html/trustedresourceurl.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","~$goog.html.trustedtypes","^2V","^2W","^2X","^2Y"]]],["^10","goog/string/internal.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/functions/functions.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/html/safestyle.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2P","~$goog.html.SafeUrl","^2X","^2Y","^2S"]]],["^10","goog/dom/safe.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","~$goog.dom.asserts","~$goog.functions","~$goog.html.SafeHtml","~$goog.html.SafeScript","~$goog.html.SafeStyle","^31","^2U","~$goog.html.uncheckedconversions","^2X","^2S"]]],["^10","clojure/walk.cljs"],[1579838325000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J"]]],["^10","goog/structs/map.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","~$goog.iter.Iterator","~$goog.iter.StopIteration"]]],["^10","goog/html/safehtml.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2P","~$goog.dom.TagName","~$goog.dom.tags","^35","^36","~$goog.html.SafeStyleSheet","^31","^2U","^30","^2V","^2W","~$goog.labs.userAgent.browser","^2R","^2X","^2Y","^2S"]]],["^10","goog/dom/tags.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2R"]]],["^10","datascript/impl/entity.cljc"],[1590236302000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J","^K"]]],["^10","me/tonsky/persistent_sorted_set/arrays.cljc"],[1589003956000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J","~$clojure.string"]]],["^10","goog/asserts/asserts.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","~$goog.debug.Error","~$goog.dom.NodeType"]]],["^10","me/tonsky/persistent_sorted_set.cljs"],[1589003956000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J","^2N"]]],["^10","goog/uri/uri.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2P","~$goog.string","~$goog.structs","~$goog.structs.Map","~$goog.uri.utils","~$goog.uri.utils.ComponentIndex","~$goog.uri.utils.StandardQueryParam"]]],["^10","goog/i18n/bidi.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/fs/url.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/base.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",[]]],["^10","goog/structs/structs.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2R"]]],["^10","clojure/string.cljs"],[1579838325000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J","^3A","~$goog.string.StringBuffer"]]],["^10","goog/string/string.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","~$goog.dom.safe","^37","^2X","^2S"]]],["^10","clojure/data.cljs"],[1579838325000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^J","~$clojure.set"]]],["^10","goog/reflect/reflect.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/labs/useragent/util.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2S"]]],["^10","goog/string/stringbuffer.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","goog/iter/iter.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2P","^33","~$goog.math"]]],["^10","goog/html/uncheckedconversions.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","^34","^35","^36","^3<","^31","^2U","^2X","^2S"]]],["^10","goog/dom/htmlelement.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M"]]],["^10","cljs/core.cljs"],[1579838325000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","~$goog.math.Long","~$goog.math.Integer","^3A","^2R","^2J","~$goog.Uri","^3G"]]],["^10","goog/html/safescript.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2P","^30","^2X","^2Y"]]],["^10","goog/html/safestylesheet.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"^2I",["^M","^2J","^2P","^36","^2R","^2X","^2Y","^2S"]]],["^10","goog/math/integer.js"],[1579837703000,"^2F",["^ ","^2G",null,"^2H",["^A",[]],"