import "./cljs_env.js";
goog.provide('shadow.dom');
shadow.dom.transition_supported_QMARK_ = (((typeof window !== 'undefined'))?goog.style.transition.isSupported():null);

/**
 * @interface
 */
shadow.dom.IElement = function(){};

var shadow$dom$IElement$_to_dom$dyn_51326 = (function (this$){
var x__4521__auto__ = (((this$ == null))?null:this$);
var m__4522__auto__ = (shadow.dom._to_dom[goog.typeOf(x__4521__auto__)]);
if((!((m__4522__auto__ == null)))){
return (m__4522__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4522__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__4522__auto__.call(null,this$));
} else {
var m__4519__auto__ = (shadow.dom._to_dom["_"]);
if((!((m__4519__auto__ == null)))){
return (m__4519__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4519__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__4519__auto__.call(null,this$));
} else {
throw cljs.core.missing_protocol("IElement.-to-dom",this$);
}
}
});
shadow.dom._to_dom = (function shadow$dom$_to_dom(this$){
if((((!((this$ == null)))) && ((!((this$.shadow$dom$IElement$_to_dom$arity$1 == null)))))){
return this$.shadow$dom$IElement$_to_dom$arity$1(this$);
} else {
return shadow$dom$IElement$_to_dom$dyn_51326(this$);
}
});


/**
 * @interface
 */
shadow.dom.SVGElement = function(){};

var shadow$dom$SVGElement$_to_svg$dyn_51327 = (function (this$){
var x__4521__auto__ = (((this$ == null))?null:this$);
var m__4522__auto__ = (shadow.dom._to_svg[goog.typeOf(x__4521__auto__)]);
if((!((m__4522__auto__ == null)))){
return (m__4522__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4522__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__4522__auto__.call(null,this$));
} else {
var m__4519__auto__ = (shadow.dom._to_svg["_"]);
if((!((m__4519__auto__ == null)))){
return (m__4519__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4519__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__4519__auto__.call(null,this$));
} else {
throw cljs.core.missing_protocol("SVGElement.-to-svg",this$);
}
}
});
shadow.dom._to_svg = (function shadow$dom$_to_svg(this$){
if((((!((this$ == null)))) && ((!((this$.shadow$dom$SVGElement$_to_svg$arity$1 == null)))))){
return this$.shadow$dom$SVGElement$_to_svg$arity$1(this$);
} else {
return shadow$dom$SVGElement$_to_svg$dyn_51327(this$);
}
});

shadow.dom.lazy_native_coll_seq = (function shadow$dom$lazy_native_coll_seq(coll,idx){
if((idx < coll.length)){
return (new cljs.core.LazySeq(null,(function (){
return cljs.core.cons((coll[idx]),(function (){var G__50407 = coll;
var G__50408 = (idx + (1));
return (shadow.dom.lazy_native_coll_seq.cljs$core$IFn$_invoke$arity$2 ? shadow.dom.lazy_native_coll_seq.cljs$core$IFn$_invoke$arity$2(G__50407,G__50408) : shadow.dom.lazy_native_coll_seq.call(null,G__50407,G__50408));
})());
}),null,null));
} else {
return null;
}
});

/**
* @constructor
 * @implements {cljs.core.IIndexed}
 * @implements {cljs.core.ICounted}
 * @implements {cljs.core.ISeqable}
 * @implements {cljs.core.IDeref}
 * @implements {shadow.dom.IElement}
*/
shadow.dom.NativeColl = (function (coll){
this.coll = coll;
this.cljs$lang$protocol_mask$partition0$ = 8421394;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(shadow.dom.NativeColl.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.coll;
}));

(shadow.dom.NativeColl.prototype.cljs$core$IIndexed$_nth$arity$2 = (function (this$,n){
var self__ = this;
var this$__$1 = this;
return (self__.coll[n]);
}));

(shadow.dom.NativeColl.prototype.cljs$core$IIndexed$_nth$arity$3 = (function (this$,n,not_found){
var self__ = this;
var this$__$1 = this;
var or__4223__auto__ = (self__.coll[n]);
if(cljs.core.truth_(or__4223__auto__)){
return or__4223__auto__;
} else {
return not_found;
}
}));

(shadow.dom.NativeColl.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.coll.length;
}));

(shadow.dom.NativeColl.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return shadow.dom.lazy_native_coll_seq(self__.coll,(0));
}));

(shadow.dom.NativeColl.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(shadow.dom.NativeColl.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.coll;
}));

(shadow.dom.NativeColl.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"coll","coll",-1006698606,null)], null);
}));

(shadow.dom.NativeColl.cljs$lang$type = true);

(shadow.dom.NativeColl.cljs$lang$ctorStr = "shadow.dom/NativeColl");

(shadow.dom.NativeColl.cljs$lang$ctorPrWriter = (function (this__4461__auto__,writer__4462__auto__,opt__4463__auto__){
return cljs.core._write(writer__4462__auto__,"shadow.dom/NativeColl");
}));

/**
 * Positional factory function for shadow.dom/NativeColl.
 */
shadow.dom.__GT_NativeColl = (function shadow$dom$__GT_NativeColl(coll){
return (new shadow.dom.NativeColl(coll));
});

shadow.dom.native_coll = (function shadow$dom$native_coll(coll){
return (new shadow.dom.NativeColl(coll));
});
shadow.dom.dom_node = (function shadow$dom$dom_node(el){
if((el == null)){
return null;
} else {
if((((!((el == null))))?((((false) || ((cljs.core.PROTOCOL_SENTINEL === el.shadow$dom$IElement$))))?true:false):false)){
return el.shadow$dom$IElement$_to_dom$arity$1(null);
} else {
if(typeof el === 'string'){
return document.createTextNode(el);
} else {
if(typeof el === 'number'){
return document.createTextNode(cljs.core.str.cljs$core$IFn$_invoke$arity$1(el));
} else {
return el;

}
}
}
}
});
shadow.dom.query_one = (function shadow$dom$query_one(var_args){
var G__50441 = arguments.length;
switch (G__50441) {
case 1:
return shadow.dom.query_one.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.query_one.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('')));

}
});

(shadow.dom.query_one.cljs$core$IFn$_invoke$arity$1 = (function (sel){
return document.querySelector(sel);
}));

(shadow.dom.query_one.cljs$core$IFn$_invoke$arity$2 = (function (sel,root){
return shadow.dom.dom_node(root).querySelector(sel);
}));

(shadow.dom.query_one.cljs$lang$maxFixedArity = 2);

shadow.dom.query = (function shadow$dom$query(var_args){
var G__50464 = arguments.length;
switch (G__50464) {
case 1:
return shadow.dom.query.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.query.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('')));

}
});

(shadow.dom.query.cljs$core$IFn$_invoke$arity$1 = (function (sel){
return (new shadow.dom.NativeColl(document.querySelectorAll(sel)));
}));

(shadow.dom.query.cljs$core$IFn$_invoke$arity$2 = (function (sel,root){
return (new shadow.dom.NativeColl(shadow.dom.dom_node(root).querySelectorAll(sel)));
}));

(shadow.dom.query.cljs$lang$maxFixedArity = 2);

shadow.dom.by_id = (function shadow$dom$by_id(var_args){
var G__50468 = arguments.length;
switch (G__50468) {
case 2:
return shadow.dom.by_id.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 1:
return shadow.dom.by_id.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

}
});

(shadow.dom.by_id.cljs$core$IFn$_invoke$arity$2 = (function (id,el){
return shadow.dom.dom_node(el).getElementById(id);
}));

(shadow.dom.by_id.cljs$core$IFn$_invoke$arity$1 = (function (id){
return document.getElementById(id);
}));

(shadow.dom.by_id.cljs$lang$maxFixedArity = 2);

shadow.dom.build = shadow.dom.dom_node;
shadow.dom.ev_stop = (function shadow$dom$ev_stop(var_args){
var G__50482 = arguments.length;
switch (G__50482) {
case 1:
return shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

break;
case 4:
return shadow.dom.ev_stop.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('')));

}
});

(shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$1 = (function (e){
if(cljs.core.truth_(e.stopPropagation)){
e.stopPropagation();

e.preventDefault();
} else {
(e.cancelBubble = true);

(e.returnValue = false);
}

return e;
}));

(shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$2 = (function (e,el){
shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$1(e);

return el;
}));

(shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$4 = (function (e,el,scope,owner){
shadow.dom.ev_stop.cljs$core$IFn$_invoke$arity$1(e);

return el;
}));

(shadow.dom.ev_stop.cljs$lang$maxFixedArity = 4);

/**
 * check wether a parent node (or the document) contains the child
 */
shadow.dom.contains_QMARK_ = (function shadow$dom$contains_QMARK_(var_args){
var G__50493 = arguments.length;
switch (G__50493) {
case 1:
return shadow.dom.contains_QMARK_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.contains_QMARK_.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('')));

}
});

(shadow.dom.contains_QMARK_.cljs$core$IFn$_invoke$arity$1 = (function (el){
return goog.dom.contains(document,shadow.dom.dom_node(el));
}));

(shadow.dom.contains_QMARK_.cljs$core$IFn$_invoke$arity$2 = (function (parent,el){
return goog.dom.contains(shadow.dom.dom_node(parent),shadow.dom.dom_node(el));
}));

(shadow.dom.contains_QMARK_.cljs$lang$maxFixedArity = 2);

shadow.dom.add_class = (function shadow$dom$add_class(el,cls){
return goog.dom.classlist.add(shadow.dom.dom_node(el),cls);
});
shadow.dom.remove_class = (function shadow$dom$remove_class(el,cls){
return goog.dom.classlist.remove(shadow.dom.dom_node(el),cls);
});
shadow.dom.toggle_class = (function shadow$dom$toggle_class(var_args){
var G__50508 = arguments.length;
switch (G__50508) {
case 2:
return shadow.dom.toggle_class.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return shadow.dom.toggle_class.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('')));

}
});

(shadow.dom.toggle_class.cljs$core$IFn$_invoke$arity$2 = (function (el,cls){
return goog.dom.classlist.toggle(shadow.dom.dom_node(el),cls);
}));

(shadow.dom.toggle_class.cljs$core$IFn$_invoke$arity$3 = (function (el,cls,v){
if(cljs.core.truth_(v)){
return shadow.dom.add_class(el,cls);
} else {
return shadow.dom.remove_class(el,cls);
}
}));

(shadow.dom.toggle_class.cljs$lang$maxFixedArity = 3);

shadow.dom.dom_listen = (cljs.core.truth_((function (){var or__4223__auto__ = (!((typeof document !== 'undefined')));
if(or__4223__auto__){
return or__4223__auto__;
} else {
return document.addEventListener;
}
})())?(function shadow$dom$dom_listen_good(el,ev,handler){
return el.addEventListener(ev,handler,false);
}):(function shadow$dom$dom_listen_ie(el,ev,handler){
try{return el.attachEvent(["on",cljs.core.str.cljs$core$IFn$_invoke$arity$1(ev)].join(''),(function (e){
return (handler.cljs$core$IFn$_invoke$arity$2 ? handler.cljs$core$IFn$_invoke$arity$2(e,el) : handler.call(null,e,el));
}));
}catch (e50519){if((e50519 instanceof Object)){
var e = e50519;
return console.log("didnt support attachEvent",el,e);
} else {
throw e50519;

}
}}));
shadow.dom.dom_listen_remove = (cljs.core.truth_((function (){var or__4223__auto__ = (!((typeof document !== 'undefined')));
if(or__4223__auto__){
return or__4223__auto__;
} else {
return document.removeEventListener;
}
})())?(function shadow$dom$dom_listen_remove_good(el,ev,handler){
return el.removeEventListener(ev,handler,false);
}):(function shadow$dom$dom_listen_remove_ie(el,ev,handler){
return el.detachEvent(["on",cljs.core.str.cljs$core$IFn$_invoke$arity$1(ev)].join(''),handler);
}));
shadow.dom.on_query = (function shadow$dom$on_query(root_el,ev,selector,handler){
var seq__50536 = cljs.core.seq(shadow.dom.query.cljs$core$IFn$_invoke$arity$2(selector,root_el));
var chunk__50537 = null;
var count__50538 = (0);
var i__50539 = (0);
while(true){
if((i__50539 < count__50538)){
var el = chunk__50537.cljs$core$IIndexed$_nth$arity$2(null,i__50539);
var handler_51343__$1 = ((function (seq__50536,chunk__50537,count__50538,i__50539,el){
return (function (e){
return (handler.cljs$core$IFn$_invoke$arity$2 ? handler.cljs$core$IFn$_invoke$arity$2(e,el) : handler.call(null,e,el));
});})(seq__50536,chunk__50537,count__50538,i__50539,el))
;
shadow.dom.dom_listen(el,cljs.core.name(ev),handler_51343__$1);


var G__51344 = seq__50536;
var G__51345 = chunk__50537;
var G__51346 = count__50538;
var G__51347 = (i__50539 + (1));
seq__50536 = G__51344;
chunk__50537 = G__51345;
count__50538 = G__51346;
i__50539 = G__51347;
continue;
} else {
var temp__5753__auto__ = cljs.core.seq(seq__50536);
if(temp__5753__auto__){
var seq__50536__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__50536__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__50536__$1);
var G__51348 = cljs.core.chunk_rest(seq__50536__$1);
var G__51349 = c__4649__auto__;
var G__51350 = cljs.core.count(c__4649__auto__);
var G__51351 = (0);
seq__50536 = G__51348;
chunk__50537 = G__51349;
count__50538 = G__51350;
i__50539 = G__51351;
continue;
} else {
var el = cljs.core.first(seq__50536__$1);
var handler_51352__$1 = ((function (seq__50536,chunk__50537,count__50538,i__50539,el,seq__50536__$1,temp__5753__auto__){
return (function (e){
return (handler.cljs$core$IFn$_invoke$arity$2 ? handler.cljs$core$IFn$_invoke$arity$2(e,el) : handler.call(null,e,el));
});})(seq__50536,chunk__50537,count__50538,i__50539,el,seq__50536__$1,temp__5753__auto__))
;
shadow.dom.dom_listen(el,cljs.core.name(ev),handler_51352__$1);


var G__51353 = cljs.core.next(seq__50536__$1);
var G__51354 = null;
var G__51355 = (0);
var G__51356 = (0);
seq__50536 = G__51353;
chunk__50537 = G__51354;
count__50538 = G__51355;
i__50539 = G__51356;
continue;
}
} else {
return null;
}
}
break;
}
});
shadow.dom.on = (function shadow$dom$on(var_args){
var G__50548 = arguments.length;
switch (G__50548) {
case 3:
return shadow.dom.on.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return shadow.dom.on.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('')));

}
});

(shadow.dom.on.cljs$core$IFn$_invoke$arity$3 = (function (el,ev,handler){
return shadow.dom.on.cljs$core$IFn$_invoke$arity$4(el,ev,handler,false);
}));

(shadow.dom.on.cljs$core$IFn$_invoke$arity$4 = (function (el,ev,handler,capture){
if(cljs.core.vector_QMARK_(ev)){
return shadow.dom.on_query(el,cljs.core.first(ev),cljs.core.second(ev),handler);
} else {
var handler__$1 = (function (e){
return (handler.cljs$core$IFn$_invoke$arity$2 ? handler.cljs$core$IFn$_invoke$arity$2(e,el) : handler.call(null,e,el));
});
return shadow.dom.dom_listen(shadow.dom.dom_node(el),cljs.core.name(ev),handler__$1);
}
}));

(shadow.dom.on.cljs$lang$maxFixedArity = 4);

shadow.dom.remove_event_handler = (function shadow$dom$remove_event_handler(el,ev,handler){
return shadow.dom.dom_listen_remove(shadow.dom.dom_node(el),cljs.core.name(ev),handler);
});
shadow.dom.add_event_listeners = (function shadow$dom$add_event_listeners(el,events){
var seq__50566 = cljs.core.seq(events);
var chunk__50567 = null;
var count__50568 = (0);
var i__50569 = (0);
while(true){
if((i__50569 < count__50568)){
var vec__50589 = chunk__50567.cljs$core$IIndexed$_nth$arity$2(null,i__50569);
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50589,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50589,(1),null);
shadow.dom.on.cljs$core$IFn$_invoke$arity$3(el,k,v);


var G__51358 = seq__50566;
var G__51359 = chunk__50567;
var G__51360 = count__50568;
var G__51361 = (i__50569 + (1));
seq__50566 = G__51358;
chunk__50567 = G__51359;
count__50568 = G__51360;
i__50569 = G__51361;
continue;
} else {
var temp__5753__auto__ = cljs.core.seq(seq__50566);
if(temp__5753__auto__){
var seq__50566__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__50566__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__50566__$1);
var G__51362 = cljs.core.chunk_rest(seq__50566__$1);
var G__51363 = c__4649__auto__;
var G__51364 = cljs.core.count(c__4649__auto__);
var G__51365 = (0);
seq__50566 = G__51362;
chunk__50567 = G__51363;
count__50568 = G__51364;
i__50569 = G__51365;
continue;
} else {
var vec__50765 = cljs.core.first(seq__50566__$1);
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50765,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50765,(1),null);
shadow.dom.on.cljs$core$IFn$_invoke$arity$3(el,k,v);


var G__51366 = cljs.core.next(seq__50566__$1);
var G__51367 = null;
var G__51368 = (0);
var G__51369 = (0);
seq__50566 = G__51366;
chunk__50567 = G__51367;
count__50568 = G__51368;
i__50569 = G__51369;
continue;
}
} else {
return null;
}
}
break;
}
});
shadow.dom.set_style = (function shadow$dom$set_style(el,styles){
var dom = shadow.dom.dom_node(el);
var seq__50774 = cljs.core.seq(styles);
var chunk__50775 = null;
var count__50776 = (0);
var i__50777 = (0);
while(true){
if((i__50777 < count__50776)){
var vec__50790 = chunk__50775.cljs$core$IIndexed$_nth$arity$2(null,i__50777);
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50790,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50790,(1),null);
goog.style.setStyle(dom,cljs.core.name(k),(((v == null))?"":v));


var G__51370 = seq__50774;
var G__51371 = chunk__50775;
var G__51372 = count__50776;
var G__51373 = (i__50777 + (1));
seq__50774 = G__51370;
chunk__50775 = G__51371;
count__50776 = G__51372;
i__50777 = G__51373;
continue;
} else {
var temp__5753__auto__ = cljs.core.seq(seq__50774);
if(temp__5753__auto__){
var seq__50774__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__50774__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__50774__$1);
var G__51374 = cljs.core.chunk_rest(seq__50774__$1);
var G__51375 = c__4649__auto__;
var G__51376 = cljs.core.count(c__4649__auto__);
var G__51377 = (0);
seq__50774 = G__51374;
chunk__50775 = G__51375;
count__50776 = G__51376;
i__50777 = G__51377;
continue;
} else {
var vec__50793 = cljs.core.first(seq__50774__$1);
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50793,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50793,(1),null);
goog.style.setStyle(dom,cljs.core.name(k),(((v == null))?"":v));


var G__51378 = cljs.core.next(seq__50774__$1);
var G__51379 = null;
var G__51380 = (0);
var G__51381 = (0);
seq__50774 = G__51378;
chunk__50775 = G__51379;
count__50776 = G__51380;
i__50777 = G__51381;
continue;
}
} else {
return null;
}
}
break;
}
});
shadow.dom.set_attr_STAR_ = (function shadow$dom$set_attr_STAR_(el,key,value){
var G__50796_51388 = key;
var G__50796_51389__$1 = (((G__50796_51388 instanceof cljs.core.Keyword))?G__50796_51388.fqn:null);
switch (G__50796_51389__$1) {
case "id":
(el.id = cljs.core.str.cljs$core$IFn$_invoke$arity$1(value));

break;
case "class":
(el.className = cljs.core.str.cljs$core$IFn$_invoke$arity$1(value));

break;
case "for":
(el.htmlFor = value);

break;
case "cellpadding":
el.setAttribute("cellPadding",value);

break;
case "cellspacing":
el.setAttribute("cellSpacing",value);

break;
case "colspan":
el.setAttribute("colSpan",value);

break;
case "frameborder":
el.setAttribute("frameBorder",value);

break;
case "height":
el.setAttribute("height",value);

break;
case "maxlength":
el.setAttribute("maxLength",value);

break;
case "role":
el.setAttribute("role",value);

break;
case "rowspan":
el.setAttribute("rowSpan",value);

break;
case "type":
el.setAttribute("type",value);

break;
case "usemap":
el.setAttribute("useMap",value);

break;
case "valign":
el.setAttribute("vAlign",value);

break;
case "width":
el.setAttribute("width",value);

break;
case "on":
shadow.dom.add_event_listeners(el,value);

break;
case "style":
if((value == null)){
} else {
if(typeof value === 'string'){
el.setAttribute("style",value);
} else {
if(cljs.core.map_QMARK_(value)){
shadow.dom.set_style(el,value);
} else {
goog.style.setStyle(el,value);

}
}
}

break;
default:
var ks_51391 = cljs.core.name(key);
if(cljs.core.truth_((function (){var or__4223__auto__ = goog.string.startsWith(ks_51391,"data-");
if(cljs.core.truth_(or__4223__auto__)){
return or__4223__auto__;
} else {
return goog.string.startsWith(ks_51391,"aria-");
}
})())){
el.setAttribute(ks_51391,value);
} else {
(el[ks_51391] = value);
}

}

return el;
});
shadow.dom.set_attrs = (function shadow$dom$set_attrs(el,attrs){
return cljs.core.reduce_kv((function (el__$1,key,value){
shadow.dom.set_attr_STAR_(el__$1,key,value);

return el__$1;
}),shadow.dom.dom_node(el),attrs);
});
shadow.dom.set_attr = (function shadow$dom$set_attr(el,key,value){
return shadow.dom.set_attr_STAR_(shadow.dom.dom_node(el),key,value);
});
shadow.dom.has_class_QMARK_ = (function shadow$dom$has_class_QMARK_(el,cls){
return goog.dom.classlist.contains(shadow.dom.dom_node(el),cls);
});
shadow.dom.merge_class_string = (function shadow$dom$merge_class_string(current,extra_class){
if(cljs.core.seq(current)){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(current)," ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(extra_class)].join('');
} else {
return extra_class;
}
});
shadow.dom.parse_tag = (function shadow$dom$parse_tag(spec){
var spec__$1 = cljs.core.name(spec);
var fdot = spec__$1.indexOf(".");
var fhash = spec__$1.indexOf("#");
if(((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2((-1),fdot)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2((-1),fhash)))){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [spec__$1,null,null], null);
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2((-1),fhash)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [spec__$1.substring((0),fdot),null,clojure.string.replace(spec__$1.substring((fdot + (1))),/\./," ")], null);
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2((-1),fdot)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [spec__$1.substring((0),fhash),spec__$1.substring((fhash + (1))),null], null);
} else {
if((fhash > fdot)){
throw ["cant have id after class?",spec__$1].join('');
} else {
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [spec__$1.substring((0),fhash),spec__$1.substring((fhash + (1)),fdot),clojure.string.replace(spec__$1.substring((fdot + (1))),/\./," ")], null);

}
}
}
}
});
shadow.dom.create_dom_node = (function shadow$dom$create_dom_node(tag_def,p__50927){
var map__50928 = p__50927;
var map__50928__$1 = cljs.core.__destructure_map(map__50928);
var props = map__50928__$1;
var class$ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__50928__$1,new cljs.core.Keyword(null,"class","class",-2030961996));
var tag_props = ({});
var vec__50929 = shadow.dom.parse_tag(tag_def);
var tag_name = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50929,(0),null);
var tag_id = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50929,(1),null);
var tag_classes = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50929,(2),null);
if(cljs.core.truth_(tag_id)){
(tag_props["id"] = tag_id);
} else {
}

if(cljs.core.truth_(tag_classes)){
(tag_props["class"] = shadow.dom.merge_class_string(class$,tag_classes));
} else {
}

var G__50932 = goog.dom.createDom(tag_name,tag_props);
shadow.dom.set_attrs(G__50932,cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(props,new cljs.core.Keyword(null,"class","class",-2030961996)));

return G__50932;
});
shadow.dom.append = (function shadow$dom$append(var_args){
var G__50934 = arguments.length;
switch (G__50934) {
case 1:
return shadow.dom.append.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.append.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('')));

}
});

(shadow.dom.append.cljs$core$IFn$_invoke$arity$1 = (function (node){
if(cljs.core.truth_(node)){
var temp__5753__auto__ = shadow.dom.dom_node(node);
if(cljs.core.truth_(temp__5753__auto__)){
var n = temp__5753__auto__;
document.body.appendChild(n);

return n;
} else {
return null;
}
} else {
return null;
}
}));

(shadow.dom.append.cljs$core$IFn$_invoke$arity$2 = (function (el,node){
if(cljs.core.truth_(node)){
var temp__5753__auto__ = shadow.dom.dom_node(node);
if(cljs.core.truth_(temp__5753__auto__)){
var n = temp__5753__auto__;
shadow.dom.dom_node(el).appendChild(n);

return n;
} else {
return null;
}
} else {
return null;
}
}));

(shadow.dom.append.cljs$lang$maxFixedArity = 2);

shadow.dom.destructure_node = (function shadow$dom$destructure_node(create_fn,p__50935){
var vec__50936 = p__50935;
var seq__50937 = cljs.core.seq(vec__50936);
var first__50938 = cljs.core.first(seq__50937);
var seq__50937__$1 = cljs.core.next(seq__50937);
var nn = first__50938;
var first__50938__$1 = cljs.core.first(seq__50937__$1);
var seq__50937__$2 = cljs.core.next(seq__50937__$1);
var np = first__50938__$1;
var nc = seq__50937__$2;
var node = vec__50936;
if((nn instanceof cljs.core.Keyword)){
} else {
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2("invalid dom node",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"node","node",581201198),node], null));
}

if((((np == null)) && ((nc == null)))){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(function (){var G__50941 = nn;
var G__50942 = cljs.core.PersistentArrayMap.EMPTY;
return (create_fn.cljs$core$IFn$_invoke$arity$2 ? create_fn.cljs$core$IFn$_invoke$arity$2(G__50941,G__50942) : create_fn.call(null,G__50941,G__50942));
})(),cljs.core.List.EMPTY], null);
} else {
if(cljs.core.map_QMARK_(np)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(create_fn.cljs$core$IFn$_invoke$arity$2 ? create_fn.cljs$core$IFn$_invoke$arity$2(nn,np) : create_fn.call(null,nn,np)),nc], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(function (){var G__50945 = nn;
var G__50946 = cljs.core.PersistentArrayMap.EMPTY;
return (create_fn.cljs$core$IFn$_invoke$arity$2 ? create_fn.cljs$core$IFn$_invoke$arity$2(G__50945,G__50946) : create_fn.call(null,G__50945,G__50946));
})(),cljs.core.conj.cljs$core$IFn$_invoke$arity$2(nc,np)], null);

}
}
});
shadow.dom.make_dom_node = (function shadow$dom$make_dom_node(structure){
var vec__50947 = shadow.dom.destructure_node(shadow.dom.create_dom_node,structure);
var node = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50947,(0),null);
var node_children = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__50947,(1),null);
var seq__50950_51396 = cljs.core.seq(node_children);
var chunk__50951_51397 = null;
var count__50952_51398 = (0);
var i__50953_51399 = (0);
while(true){
if((i__50953_51399 < count__50952_51398)){
var child_struct_51400 = chunk__50951_51397.cljs$core$IIndexed$_nth$arity$2(null,i__50953_51399);
var children_51401 = shadow.dom.dom_node(child_struct_51400);
if(cljs.core.seq_QMARK_(children_51401)){
var seq__51076_51402 = cljs.core.seq(cljs.core.map.cljs$core$IFn$_invoke$arity$2(shadow.dom.dom_node,children_51401));
var chunk__51078_51403 = null;
var count__51079_51404 = (0);
var i__51080_51405 = (0);
while(true){
if((i__51080_51405 < count__51079_51404)){
var child_51406 = chunk__51078_51403.cljs$core$IIndexed$_nth$arity$2(null,i__51080_51405);
if(cljs.core.truth_(child_51406)){
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,child_51406);


var G__51407 = seq__51076_51402;
var G__51408 = chunk__51078_51403;
var G__51409 = count__51079_51404;
var G__51410 = (i__51080_51405 + (1));
seq__51076_51402 = G__51407;
chunk__51078_51403 = G__51408;
count__51079_51404 = G__51409;
i__51080_51405 = G__51410;
continue;
} else {
var G__51411 = seq__51076_51402;
var G__51412 = chunk__51078_51403;
var G__51413 = count__51079_51404;
var G__51414 = (i__51080_51405 + (1));
seq__51076_51402 = G__51411;
chunk__51078_51403 = G__51412;
count__51079_51404 = G__51413;
i__51080_51405 = G__51414;
continue;
}
} else {
var temp__5753__auto___51415 = cljs.core.seq(seq__51076_51402);
if(temp__5753__auto___51415){
var seq__51076_51416__$1 = temp__5753__auto___51415;
if(cljs.core.chunked_seq_QMARK_(seq__51076_51416__$1)){
var c__4649__auto___51417 = cljs.core.chunk_first(seq__51076_51416__$1);
var G__51418 = cljs.core.chunk_rest(seq__51076_51416__$1);
var G__51419 = c__4649__auto___51417;
var G__51420 = cljs.core.count(c__4649__auto___51417);
var G__51421 = (0);
seq__51076_51402 = G__51418;
chunk__51078_51403 = G__51419;
count__51079_51404 = G__51420;
i__51080_51405 = G__51421;
continue;
} else {
var child_51422 = cljs.core.first(seq__51076_51416__$1);
if(cljs.core.truth_(child_51422)){
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,child_51422);


var G__51423 = cljs.core.next(seq__51076_51416__$1);
var G__51424 = null;
var G__51425 = (0);
var G__51426 = (0);
seq__51076_51402 = G__51423;
chunk__51078_51403 = G__51424;
count__51079_51404 = G__51425;
i__51080_51405 = G__51426;
continue;
} else {
var G__51427 = cljs.core.next(seq__51076_51416__$1);
var G__51428 = null;
var G__51429 = (0);
var G__51430 = (0);
seq__51076_51402 = G__51427;
chunk__51078_51403 = G__51428;
count__51079_51404 = G__51429;
i__51080_51405 = G__51430;
continue;
}
}
} else {
}
}
break;
}
} else {
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,children_51401);
}


var G__51431 = seq__50950_51396;
var G__51432 = chunk__50951_51397;
var G__51433 = count__50952_51398;
var G__51434 = (i__50953_51399 + (1));
seq__50950_51396 = G__51431;
chunk__50951_51397 = G__51432;
count__50952_51398 = G__51433;
i__50953_51399 = G__51434;
continue;
} else {
var temp__5753__auto___51435 = cljs.core.seq(seq__50950_51396);
if(temp__5753__auto___51435){
var seq__50950_51436__$1 = temp__5753__auto___51435;
if(cljs.core.chunked_seq_QMARK_(seq__50950_51436__$1)){
var c__4649__auto___51437 = cljs.core.chunk_first(seq__50950_51436__$1);
var G__51438 = cljs.core.chunk_rest(seq__50950_51436__$1);
var G__51439 = c__4649__auto___51437;
var G__51440 = cljs.core.count(c__4649__auto___51437);
var G__51441 = (0);
seq__50950_51396 = G__51438;
chunk__50951_51397 = G__51439;
count__50952_51398 = G__51440;
i__50953_51399 = G__51441;
continue;
} else {
var child_struct_51442 = cljs.core.first(seq__50950_51436__$1);
var children_51443 = shadow.dom.dom_node(child_struct_51442);
if(cljs.core.seq_QMARK_(children_51443)){
var seq__51147_51444 = cljs.core.seq(cljs.core.map.cljs$core$IFn$_invoke$arity$2(shadow.dom.dom_node,children_51443));
var chunk__51149_51445 = null;
var count__51150_51446 = (0);
var i__51151_51447 = (0);
while(true){
if((i__51151_51447 < count__51150_51446)){
var child_51448 = chunk__51149_51445.cljs$core$IIndexed$_nth$arity$2(null,i__51151_51447);
if(cljs.core.truth_(child_51448)){
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,child_51448);


var G__51449 = seq__51147_51444;
var G__51450 = chunk__51149_51445;
var G__51451 = count__51150_51446;
var G__51452 = (i__51151_51447 + (1));
seq__51147_51444 = G__51449;
chunk__51149_51445 = G__51450;
count__51150_51446 = G__51451;
i__51151_51447 = G__51452;
continue;
} else {
var G__51453 = seq__51147_51444;
var G__51454 = chunk__51149_51445;
var G__51455 = count__51150_51446;
var G__51456 = (i__51151_51447 + (1));
seq__51147_51444 = G__51453;
chunk__51149_51445 = G__51454;
count__51150_51446 = G__51455;
i__51151_51447 = G__51456;
continue;
}
} else {
var temp__5753__auto___51457__$1 = cljs.core.seq(seq__51147_51444);
if(temp__5753__auto___51457__$1){
var seq__51147_51458__$1 = temp__5753__auto___51457__$1;
if(cljs.core.chunked_seq_QMARK_(seq__51147_51458__$1)){
var c__4649__auto___51459 = cljs.core.chunk_first(seq__51147_51458__$1);
var G__51460 = cljs.core.chunk_rest(seq__51147_51458__$1);
var G__51461 = c__4649__auto___51459;
var G__51462 = cljs.core.count(c__4649__auto___51459);
var G__51463 = (0);
seq__51147_51444 = G__51460;
chunk__51149_51445 = G__51461;
count__51150_51446 = G__51462;
i__51151_51447 = G__51463;
continue;
} else {
var child_51464 = cljs.core.first(seq__51147_51458__$1);
if(cljs.core.truth_(child_51464)){
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,child_51464);


var G__51465 = cljs.core.next(seq__51147_51458__$1);
var G__51466 = null;
var G__51467 = (0);
var G__51468 = (0);
seq__51147_51444 = G__51465;
chunk__51149_51445 = G__51466;
count__51150_51446 = G__51467;
i__51151_51447 = G__51468;
continue;
} else {
var G__51469 = cljs.core.next(seq__51147_51458__$1);
var G__51470 = null;
var G__51471 = (0);
var G__51472 = (0);
seq__51147_51444 = G__51469;
chunk__51149_51445 = G__51470;
count__51150_51446 = G__51471;
i__51151_51447 = G__51472;
continue;
}
}
} else {
}
}
break;
}
} else {
shadow.dom.append.cljs$core$IFn$_invoke$arity$2(node,children_51443);
}


var G__51473 = cljs.core.next(seq__50950_51436__$1);
var G__51474 = null;
var G__51475 = (0);
var G__51476 = (0);
seq__50950_51396 = G__51473;
chunk__50951_51397 = G__51474;
count__50952_51398 = G__51475;
i__50953_51399 = G__51476;
continue;
}
} else {
}
}
break;
}

return node;
});
(cljs.core.Keyword.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.Keyword.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var this$__$1 = this;
return shadow.dom.make_dom_node(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [this$__$1], null));
}));

(cljs.core.PersistentVector.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.PersistentVector.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var this$__$1 = this;
return shadow.dom.make_dom_node(this$__$1);
}));

(cljs.core.LazySeq.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.LazySeq.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var this$__$1 = this;
return cljs.core.map.cljs$core$IFn$_invoke$arity$2(shadow.dom._to_dom,this$__$1);
}));
if(cljs.core.truth_(((typeof HTMLElement) != 'undefined'))){
(HTMLElement.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(HTMLElement.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var this$__$1 = this;
return this$__$1;
}));
} else {
}
if(cljs.core.truth_(((typeof DocumentFragment) != 'undefined'))){
(DocumentFragment.prototype.shadow$dom$IElement$ = cljs.core.PROTOCOL_SENTINEL);

(DocumentFragment.prototype.shadow$dom$IElement$_to_dom$arity$1 = (function (this$){
var this$__$1 = this;
return this$__$1;
}));
} else {
}
/**
 * clear node children
 */
shadow.dom.reset = (function shadow$dom$reset(node){
return goog.dom.removeChildren(shadow.dom.dom_node(node));
});
shadow.dom.remove = (function shadow$dom$remove(node){
if((((!((node == null))))?(((((node.cljs$lang$protocol_mask$partition0$ & (8388608))) || ((cljs.core.PROTOCOL_SENTINEL === node.cljs$core$ISeqable$))))?true:false):false)){
var seq__51155 = cljs.core.seq(node);
var chunk__51156 = null;
var count__51157 = (0);
var i__51158 = (0);
while(true){
if((i__51158 < count__51157)){
var n = chunk__51156.cljs$core$IIndexed$_nth$arity$2(null,i__51158);
(shadow.dom.remove.cljs$core$IFn$_invoke$arity$1 ? shadow.dom.remove.cljs$core$IFn$_invoke$arity$1(n) : shadow.dom.remove.call(null,n));


var G__51478 = seq__51155;
var G__51479 = chunk__51156;
var G__51480 = count__51157;
var G__51481 = (i__51158 + (1));
seq__51155 = G__51478;
chunk__51156 = G__51479;
count__51157 = G__51480;
i__51158 = G__51481;
continue;
} else {
var temp__5753__auto__ = cljs.core.seq(seq__51155);
if(temp__5753__auto__){
var seq__51155__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__51155__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__51155__$1);
var G__51482 = cljs.core.chunk_rest(seq__51155__$1);
var G__51483 = c__4649__auto__;
var G__51484 = cljs.core.count(c__4649__auto__);
var G__51485 = (0);
seq__51155 = G__51482;
chunk__51156 = G__51483;
count__51157 = G__51484;
i__51158 = G__51485;
continue;
} else {
var n = cljs.core.first(seq__51155__$1);
(shadow.dom.remove.cljs$core$IFn$_invoke$arity$1 ? shadow.dom.remove.cljs$core$IFn$_invoke$arity$1(n) : shadow.dom.remove.call(null,n));


var G__51487 = cljs.core.next(seq__51155__$1);
var G__51488 = null;
var G__51489 = (0);
var G__51490 = (0);
seq__51155 = G__51487;
chunk__51156 = G__51488;
count__51157 = G__51489;
i__51158 = G__51490;
continue;
}
} else {
return null;
}
}
break;
}
} else {
return goog.dom.removeNode(node);
}
});
shadow.dom.replace_node = (function shadow$dom$replace_node(old,new$){
return goog.dom.replaceNode(shadow.dom.dom_node(new$),shadow.dom.dom_node(old));
});
shadow.dom.text = (function shadow$dom$text(var_args){
var G__51165 = arguments.length;
switch (G__51165) {
case 2:
return shadow.dom.text.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 1:
return shadow.dom.text.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

}
});

(shadow.dom.text.cljs$core$IFn$_invoke$arity$2 = (function (el,new_text){
return (shadow.dom.dom_node(el).innerText = new_text);
}));

(shadow.dom.text.cljs$core$IFn$_invoke$arity$1 = (function (el){
return shadow.dom.dom_node(el).innerText;
}));

(shadow.dom.text.cljs$lang$maxFixedArity = 2);

shadow.dom.check = (function shadow$dom$check(var_args){
var G__51167 = arguments.length;
switch (G__51167) {
case 1:
return shadow.dom.check.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.check.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('')));

}
});

(shadow.dom.check.cljs$core$IFn$_invoke$arity$1 = (function (el){
return shadow.dom.check.cljs$core$IFn$_invoke$arity$2(el,true);
}));

(shadow.dom.check.cljs$core$IFn$_invoke$arity$2 = (function (el,checked){
return (shadow.dom.dom_node(el).checked = checked);
}));

(shadow.dom.check.cljs$lang$maxFixedArity = 2);

shadow.dom.checked_QMARK_ = (function shadow$dom$checked_QMARK_(el){
return shadow.dom.dom_node(el).checked;
});
shadow.dom.form_elements = (function shadow$dom$form_elements(el){
return (new shadow.dom.NativeColl(shadow.dom.dom_node(el).elements));
});
shadow.dom.children = (function shadow$dom$children(el){
return (new shadow.dom.NativeColl(shadow.dom.dom_node(el).children));
});
shadow.dom.child_nodes = (function shadow$dom$child_nodes(el){
return (new shadow.dom.NativeColl(shadow.dom.dom_node(el).childNodes));
});
shadow.dom.attr = (function shadow$dom$attr(var_args){
var G__51169 = arguments.length;
switch (G__51169) {
case 2:
return shadow.dom.attr.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return shadow.dom.attr.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('')));

}
});

(shadow.dom.attr.cljs$core$IFn$_invoke$arity$2 = (function (el,key){
return shadow.dom.dom_node(el).getAttribute(cljs.core.name(key));
}));

(shadow.dom.attr.cljs$core$IFn$_invoke$arity$3 = (function (el,key,default$){
var or__4223__auto__ = shadow.dom.dom_node(el).getAttribute(cljs.core.name(key));
if(cljs.core.truth_(or__4223__auto__)){
return or__4223__auto__;
} else {
return default$;
}
}));

(shadow.dom.attr.cljs$lang$maxFixedArity = 3);

shadow.dom.del_attr = (function shadow$dom$del_attr(el,key){
return shadow.dom.dom_node(el).removeAttribute(cljs.core.name(key));
});
shadow.dom.data = (function shadow$dom$data(el,key){
return shadow.dom.dom_node(el).getAttribute(["data-",cljs.core.name(key)].join(''));
});
shadow.dom.set_data = (function shadow$dom$set_data(el,key,value){
return shadow.dom.dom_node(el).setAttribute(["data-",cljs.core.name(key)].join(''),cljs.core.str.cljs$core$IFn$_invoke$arity$1(value));
});
shadow.dom.set_html = (function shadow$dom$set_html(node,text){
return (shadow.dom.dom_node(node).innerHTML = text);
});
shadow.dom.get_html = (function shadow$dom$get_html(node){
return shadow.dom.dom_node(node).innerHTML;
});
shadow.dom.fragment = (function shadow$dom$fragment(var_args){
var args__4835__auto__ = [];
var len__4829__auto___51495 = arguments.length;
var i__4830__auto___51496 = (0);
while(true){
if((i__4830__auto___51496 < len__4829__auto___51495)){
args__4835__auto__.push((arguments[i__4830__auto___51496]));

var G__51497 = (i__4830__auto___51496 + (1));
i__4830__auto___51496 = G__51497;
continue;
} else {
}
break;
}

var argseq__4836__auto__ = ((((0) < args__4835__auto__.length))?(new cljs.core.IndexedSeq(args__4835__auto__.slice((0)),(0),null)):null);
return shadow.dom.fragment.cljs$core$IFn$_invoke$arity$variadic(argseq__4836__auto__);
});

(shadow.dom.fragment.cljs$core$IFn$_invoke$arity$variadic = (function (nodes){
var fragment = document.createDocumentFragment();
var seq__51171_51498 = cljs.core.seq(nodes);
var chunk__51172_51499 = null;
var count__51173_51500 = (0);
var i__51174_51501 = (0);
while(true){
if((i__51174_51501 < count__51173_51500)){
var node_51502 = chunk__51172_51499.cljs$core$IIndexed$_nth$arity$2(null,i__51174_51501);
fragment.appendChild(shadow.dom._to_dom(node_51502));


var G__51503 = seq__51171_51498;
var G__51504 = chunk__51172_51499;
var G__51505 = count__51173_51500;
var G__51506 = (i__51174_51501 + (1));
seq__51171_51498 = G__51503;
chunk__51172_51499 = G__51504;
count__51173_51500 = G__51505;
i__51174_51501 = G__51506;
continue;
} else {
var temp__5753__auto___51507 = cljs.core.seq(seq__51171_51498);
if(temp__5753__auto___51507){
var seq__51171_51508__$1 = temp__5753__auto___51507;
if(cljs.core.chunked_seq_QMARK_(seq__51171_51508__$1)){
var c__4649__auto___51509 = cljs.core.chunk_first(seq__51171_51508__$1);
var G__51510 = cljs.core.chunk_rest(seq__51171_51508__$1);
var G__51511 = c__4649__auto___51509;
var G__51512 = cljs.core.count(c__4649__auto___51509);
var G__51513 = (0);
seq__51171_51498 = G__51510;
chunk__51172_51499 = G__51511;
count__51173_51500 = G__51512;
i__51174_51501 = G__51513;
continue;
} else {
var node_51514 = cljs.core.first(seq__51171_51508__$1);
fragment.appendChild(shadow.dom._to_dom(node_51514));


var G__51515 = cljs.core.next(seq__51171_51508__$1);
var G__51516 = null;
var G__51517 = (0);
var G__51518 = (0);
seq__51171_51498 = G__51515;
chunk__51172_51499 = G__51516;
count__51173_51500 = G__51517;
i__51174_51501 = G__51518;
continue;
}
} else {
}
}
break;
}

return (new shadow.dom.NativeColl(fragment));
}));

(shadow.dom.fragment.cljs$lang$maxFixedArity = (0));

/** @this {Function} */
(shadow.dom.fragment.cljs$lang$applyTo = (function (seq51170){
var self__4817__auto__ = this;
return self__4817__auto__.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq(seq51170));
}));

/**
 * given a html string, eval all <script> tags and return the html without the scripts
 * don't do this for everything, only content you trust.
 */
shadow.dom.eval_scripts = (function shadow$dom$eval_scripts(s){
var scripts = cljs.core.re_seq(/<script[^>]*?>(.+?)<\/script>/,s);
var seq__51175_51519 = cljs.core.seq(scripts);
var chunk__51176_51520 = null;
var count__51177_51521 = (0);
var i__51178_51522 = (0);
while(true){
if((i__51178_51522 < count__51177_51521)){
var vec__51185_51523 = chunk__51176_51520.cljs$core$IIndexed$_nth$arity$2(null,i__51178_51522);
var script_tag_51524 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51185_51523,(0),null);
var script_body_51525 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51185_51523,(1),null);
eval(script_body_51525);


var G__51526 = seq__51175_51519;
var G__51527 = chunk__51176_51520;
var G__51528 = count__51177_51521;
var G__51529 = (i__51178_51522 + (1));
seq__51175_51519 = G__51526;
chunk__51176_51520 = G__51527;
count__51177_51521 = G__51528;
i__51178_51522 = G__51529;
continue;
} else {
var temp__5753__auto___51530 = cljs.core.seq(seq__51175_51519);
if(temp__5753__auto___51530){
var seq__51175_51531__$1 = temp__5753__auto___51530;
if(cljs.core.chunked_seq_QMARK_(seq__51175_51531__$1)){
var c__4649__auto___51532 = cljs.core.chunk_first(seq__51175_51531__$1);
var G__51533 = cljs.core.chunk_rest(seq__51175_51531__$1);
var G__51534 = c__4649__auto___51532;
var G__51535 = cljs.core.count(c__4649__auto___51532);
var G__51536 = (0);
seq__51175_51519 = G__51533;
chunk__51176_51520 = G__51534;
count__51177_51521 = G__51535;
i__51178_51522 = G__51536;
continue;
} else {
var vec__51188_51537 = cljs.core.first(seq__51175_51531__$1);
var script_tag_51538 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51188_51537,(0),null);
var script_body_51539 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51188_51537,(1),null);
eval(script_body_51539);


var G__51540 = cljs.core.next(seq__51175_51531__$1);
var G__51541 = null;
var G__51542 = (0);
var G__51543 = (0);
seq__51175_51519 = G__51540;
chunk__51176_51520 = G__51541;
count__51177_51521 = G__51542;
i__51178_51522 = G__51543;
continue;
}
} else {
}
}
break;
}

return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (s__$1,p__51191){
var vec__51192 = p__51191;
var script_tag = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51192,(0),null);
var script_body = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51192,(1),null);
return clojure.string.replace(s__$1,script_tag,"");
}),s,scripts);
});
shadow.dom.str__GT_fragment = (function shadow$dom$str__GT_fragment(s){
var el = document.createElement("div");
(el.innerHTML = s);

return (new shadow.dom.NativeColl(goog.dom.childrenToNode_(document,el)));
});
shadow.dom.node_name = (function shadow$dom$node_name(el){
return shadow.dom.dom_node(el).nodeName;
});
shadow.dom.ancestor_by_class = (function shadow$dom$ancestor_by_class(el,cls){
return goog.dom.getAncestorByClass(shadow.dom.dom_node(el),cls);
});
shadow.dom.ancestor_by_tag = (function shadow$dom$ancestor_by_tag(var_args){
var G__51196 = arguments.length;
switch (G__51196) {
case 2:
return shadow.dom.ancestor_by_tag.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return shadow.dom.ancestor_by_tag.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('')));

}
});

(shadow.dom.ancestor_by_tag.cljs$core$IFn$_invoke$arity$2 = (function (el,tag){
return goog.dom.getAncestorByTagNameAndClass(shadow.dom.dom_node(el),cljs.core.name(tag));
}));

(shadow.dom.ancestor_by_tag.cljs$core$IFn$_invoke$arity$3 = (function (el,tag,cls){
return goog.dom.getAncestorByTagNameAndClass(shadow.dom.dom_node(el),cljs.core.name(tag),cljs.core.name(cls));
}));

(shadow.dom.ancestor_by_tag.cljs$lang$maxFixedArity = 3);

shadow.dom.get_value = (function shadow$dom$get_value(dom){
return goog.dom.forms.getValue(shadow.dom.dom_node(dom));
});
shadow.dom.set_value = (function shadow$dom$set_value(dom,value){
return goog.dom.forms.setValue(shadow.dom.dom_node(dom),value);
});
shadow.dom.px = (function shadow$dom$px(value){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1((value | (0))),"px"].join('');
});
shadow.dom.pct = (function shadow$dom$pct(value){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(value),"%"].join('');
});
shadow.dom.remove_style_STAR_ = (function shadow$dom$remove_style_STAR_(el,style){
return el.style.removeProperty(cljs.core.name(style));
});
shadow.dom.remove_style = (function shadow$dom$remove_style(el,style){
var el__$1 = shadow.dom.dom_node(el);
return shadow.dom.remove_style_STAR_(el__$1,style);
});
shadow.dom.remove_styles = (function shadow$dom$remove_styles(el,style_keys){
var el__$1 = shadow.dom.dom_node(el);
var seq__51197 = cljs.core.seq(style_keys);
var chunk__51198 = null;
var count__51199 = (0);
var i__51200 = (0);
while(true){
if((i__51200 < count__51199)){
var it = chunk__51198.cljs$core$IIndexed$_nth$arity$2(null,i__51200);
shadow.dom.remove_style_STAR_(el__$1,it);


var G__51546 = seq__51197;
var G__51547 = chunk__51198;
var G__51548 = count__51199;
var G__51549 = (i__51200 + (1));
seq__51197 = G__51546;
chunk__51198 = G__51547;
count__51199 = G__51548;
i__51200 = G__51549;
continue;
} else {
var temp__5753__auto__ = cljs.core.seq(seq__51197);
if(temp__5753__auto__){
var seq__51197__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__51197__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__51197__$1);
var G__51550 = cljs.core.chunk_rest(seq__51197__$1);
var G__51551 = c__4649__auto__;
var G__51552 = cljs.core.count(c__4649__auto__);
var G__51553 = (0);
seq__51197 = G__51550;
chunk__51198 = G__51551;
count__51199 = G__51552;
i__51200 = G__51553;
continue;
} else {
var it = cljs.core.first(seq__51197__$1);
shadow.dom.remove_style_STAR_(el__$1,it);


var G__51555 = cljs.core.next(seq__51197__$1);
var G__51556 = null;
var G__51557 = (0);
var G__51558 = (0);
seq__51197 = G__51555;
chunk__51198 = G__51556;
count__51199 = G__51557;
i__51200 = G__51558;
continue;
}
} else {
return null;
}
}
break;
}
});

/**
* @constructor
 * @implements {cljs.core.IRecord}
 * @implements {cljs.core.IKVReduce}
 * @implements {cljs.core.IEquiv}
 * @implements {cljs.core.IHash}
 * @implements {cljs.core.ICollection}
 * @implements {cljs.core.ICounted}
 * @implements {cljs.core.ISeqable}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.ICloneable}
 * @implements {cljs.core.IPrintWithWriter}
 * @implements {cljs.core.IIterable}
 * @implements {cljs.core.IWithMeta}
 * @implements {cljs.core.IAssociative}
 * @implements {cljs.core.IMap}
 * @implements {cljs.core.ILookup}
*/
shadow.dom.Coordinate = (function (x,y,__meta,__extmap,__hash){
this.x = x;
this.y = y;
this.__meta = __meta;
this.__extmap = __extmap;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition0$ = 2230716170;
this.cljs$lang$protocol_mask$partition1$ = 139264;
});
(shadow.dom.Coordinate.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this__4472__auto__,k__4473__auto__){
var self__ = this;
var this__4472__auto____$1 = this;
return this__4472__auto____$1.cljs$core$ILookup$_lookup$arity$3(null,k__4473__auto__,null);
}));

(shadow.dom.Coordinate.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this__4474__auto__,k51202,else__4475__auto__){
var self__ = this;
var this__4474__auto____$1 = this;
var G__51206 = k51202;
var G__51206__$1 = (((G__51206 instanceof cljs.core.Keyword))?G__51206.fqn:null);
switch (G__51206__$1) {
case "x":
return self__.x;

break;
case "y":
return self__.y;

break;
default:
return cljs.core.get.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k51202,else__4475__auto__);

}
}));

(shadow.dom.Coordinate.prototype.cljs$core$IKVReduce$_kv_reduce$arity$3 = (function (this__4492__auto__,f__4493__auto__,init__4494__auto__){
var self__ = this;
var this__4492__auto____$1 = this;
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret__4495__auto__,p__51207){
var vec__51208 = p__51207;
var k__4496__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51208,(0),null);
var v__4497__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51208,(1),null);
return (f__4493__auto__.cljs$core$IFn$_invoke$arity$3 ? f__4493__auto__.cljs$core$IFn$_invoke$arity$3(ret__4495__auto__,k__4496__auto__,v__4497__auto__) : f__4493__auto__.call(null,ret__4495__auto__,k__4496__auto__,v__4497__auto__));
}),init__4494__auto__,this__4492__auto____$1);
}));

(shadow.dom.Coordinate.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this__4487__auto__,writer__4488__auto__,opts__4489__auto__){
var self__ = this;
var this__4487__auto____$1 = this;
var pr_pair__4490__auto__ = (function (keyval__4491__auto__){
return cljs.core.pr_sequential_writer(writer__4488__auto__,cljs.core.pr_writer,""," ","",opts__4489__auto__,keyval__4491__auto__);
});
return cljs.core.pr_sequential_writer(writer__4488__auto__,pr_pair__4490__auto__,"#shadow.dom.Coordinate{",", ","}",opts__4489__auto__,cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"x","x",2099068185),self__.x],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"y","y",-1757859776),self__.y],null))], null),self__.__extmap));
}));

(shadow.dom.Coordinate.prototype.cljs$core$IIterable$_iterator$arity$1 = (function (G__51201){
var self__ = this;
var G__51201__$1 = this;
return (new cljs.core.RecordIter((0),G__51201__$1,2,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"x","x",2099068185),new cljs.core.Keyword(null,"y","y",-1757859776)], null),(cljs.core.truth_(self__.__extmap)?cljs.core._iterator(self__.__extmap):cljs.core.nil_iter())));
}));

(shadow.dom.Coordinate.prototype.cljs$core$IMeta$_meta$arity$1 = (function (this__4470__auto__){
var self__ = this;
var this__4470__auto____$1 = this;
return self__.__meta;
}));

(shadow.dom.Coordinate.prototype.cljs$core$ICloneable$_clone$arity$1 = (function (this__4467__auto__){
var self__ = this;
var this__4467__auto____$1 = this;
return (new shadow.dom.Coordinate(self__.x,self__.y,self__.__meta,self__.__extmap,self__.__hash));
}));

(shadow.dom.Coordinate.prototype.cljs$core$ICounted$_count$arity$1 = (function (this__4476__auto__){
var self__ = this;
var this__4476__auto____$1 = this;
return (2 + cljs.core.count(self__.__extmap));
}));

(shadow.dom.Coordinate.prototype.cljs$core$IHash$_hash$arity$1 = (function (this__4468__auto__){
var self__ = this;
var this__4468__auto____$1 = this;
var h__4330__auto__ = self__.__hash;
if((!((h__4330__auto__ == null)))){
return h__4330__auto__;
} else {
var h__4330__auto____$1 = (function (coll__4469__auto__){
return (145542109 ^ cljs.core.hash_unordered_coll(coll__4469__auto__));
})(this__4468__auto____$1);
(self__.__hash = h__4330__auto____$1);

return h__4330__auto____$1;
}
}));

(shadow.dom.Coordinate.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this51203,other51204){
var self__ = this;
var this51203__$1 = this;
return (((!((other51204 == null)))) && ((((this51203__$1.constructor === other51204.constructor)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51203__$1.x,other51204.x)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51203__$1.y,other51204.y)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51203__$1.__extmap,other51204.__extmap)))))))));
}));

(shadow.dom.Coordinate.prototype.cljs$core$IMap$_dissoc$arity$2 = (function (this__4482__auto__,k__4483__auto__){
var self__ = this;
var this__4482__auto____$1 = this;
if(cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"y","y",-1757859776),null,new cljs.core.Keyword(null,"x","x",2099068185),null], null), null),k__4483__auto__)){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(cljs.core._with_meta(cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,this__4482__auto____$1),self__.__meta),k__4483__auto__);
} else {
return (new shadow.dom.Coordinate(self__.x,self__.y,self__.__meta,cljs.core.not_empty(cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.__extmap,k__4483__auto__)),null));
}
}));

(shadow.dom.Coordinate.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this__4479__auto__,k51202){
var self__ = this;
var this__4479__auto____$1 = this;
var G__51211 = k51202;
var G__51211__$1 = (((G__51211 instanceof cljs.core.Keyword))?G__51211.fqn:null);
switch (G__51211__$1) {
case "x":
case "y":
return true;

break;
default:
return cljs.core.contains_QMARK_(self__.__extmap,k51202);

}
}));

(shadow.dom.Coordinate.prototype.cljs$core$IAssociative$_assoc$arity$3 = (function (this__4480__auto__,k__4481__auto__,G__51201){
var self__ = this;
var this__4480__auto____$1 = this;
var pred__51212 = cljs.core.keyword_identical_QMARK_;
var expr__51213 = k__4481__auto__;
if(cljs.core.truth_((pred__51212.cljs$core$IFn$_invoke$arity$2 ? pred__51212.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"x","x",2099068185),expr__51213) : pred__51212.call(null,new cljs.core.Keyword(null,"x","x",2099068185),expr__51213)))){
return (new shadow.dom.Coordinate(G__51201,self__.y,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((pred__51212.cljs$core$IFn$_invoke$arity$2 ? pred__51212.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"y","y",-1757859776),expr__51213) : pred__51212.call(null,new cljs.core.Keyword(null,"y","y",-1757859776),expr__51213)))){
return (new shadow.dom.Coordinate(self__.x,G__51201,self__.__meta,self__.__extmap,null));
} else {
return (new shadow.dom.Coordinate(self__.x,self__.y,self__.__meta,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k__4481__auto__,G__51201),null));
}
}
}));

(shadow.dom.Coordinate.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this__4485__auto__){
var self__ = this;
var this__4485__auto____$1 = this;
return cljs.core.seq(cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.MapEntry(new cljs.core.Keyword(null,"x","x",2099068185),self__.x,null)),(new cljs.core.MapEntry(new cljs.core.Keyword(null,"y","y",-1757859776),self__.y,null))], null),self__.__extmap));
}));

(shadow.dom.Coordinate.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (this__4471__auto__,G__51201){
var self__ = this;
var this__4471__auto____$1 = this;
return (new shadow.dom.Coordinate(self__.x,self__.y,G__51201,self__.__extmap,self__.__hash));
}));

(shadow.dom.Coordinate.prototype.cljs$core$ICollection$_conj$arity$2 = (function (this__4477__auto__,entry__4478__auto__){
var self__ = this;
var this__4477__auto____$1 = this;
if(cljs.core.vector_QMARK_(entry__4478__auto__)){
return this__4477__auto____$1.cljs$core$IAssociative$_assoc$arity$3(null,cljs.core._nth(entry__4478__auto__,(0)),cljs.core._nth(entry__4478__auto__,(1)));
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core._conj,this__4477__auto____$1,entry__4478__auto__);
}
}));

(shadow.dom.Coordinate.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"x","x",-555367584,null),new cljs.core.Symbol(null,"y","y",-117328249,null)], null);
}));

(shadow.dom.Coordinate.cljs$lang$type = true);

(shadow.dom.Coordinate.cljs$lang$ctorPrSeq = (function (this__4516__auto__){
return (new cljs.core.List(null,"shadow.dom/Coordinate",null,(1),null));
}));

(shadow.dom.Coordinate.cljs$lang$ctorPrWriter = (function (this__4516__auto__,writer__4517__auto__){
return cljs.core._write(writer__4517__auto__,"shadow.dom/Coordinate");
}));

/**
 * Positional factory function for shadow.dom/Coordinate.
 */
shadow.dom.__GT_Coordinate = (function shadow$dom$__GT_Coordinate(x,y){
return (new shadow.dom.Coordinate(x,y,null,null,null));
});

/**
 * Factory function for shadow.dom/Coordinate, taking a map of keywords to field values.
 */
shadow.dom.map__GT_Coordinate = (function shadow$dom$map__GT_Coordinate(G__51205){
var extmap__4512__auto__ = (function (){var G__51215 = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$variadic(G__51205,new cljs.core.Keyword(null,"x","x",2099068185),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"y","y",-1757859776)], 0));
if(cljs.core.record_QMARK_(G__51205)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,G__51215);
} else {
return G__51215;
}
})();
return (new shadow.dom.Coordinate(new cljs.core.Keyword(null,"x","x",2099068185).cljs$core$IFn$_invoke$arity$1(G__51205),new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$arity$1(G__51205),null,cljs.core.not_empty(extmap__4512__auto__),null));
});

shadow.dom.get_position = (function shadow$dom$get_position(el){
var pos = goog.style.getPosition(shadow.dom.dom_node(el));
return shadow.dom.__GT_Coordinate(pos.x,pos.y);
});
shadow.dom.get_client_position = (function shadow$dom$get_client_position(el){
var pos = goog.style.getClientPosition(shadow.dom.dom_node(el));
return shadow.dom.__GT_Coordinate(pos.x,pos.y);
});
shadow.dom.get_page_offset = (function shadow$dom$get_page_offset(el){
var pos = goog.style.getPageOffset(shadow.dom.dom_node(el));
return shadow.dom.__GT_Coordinate(pos.x,pos.y);
});

/**
* @constructor
 * @implements {cljs.core.IRecord}
 * @implements {cljs.core.IKVReduce}
 * @implements {cljs.core.IEquiv}
 * @implements {cljs.core.IHash}
 * @implements {cljs.core.ICollection}
 * @implements {cljs.core.ICounted}
 * @implements {cljs.core.ISeqable}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.ICloneable}
 * @implements {cljs.core.IPrintWithWriter}
 * @implements {cljs.core.IIterable}
 * @implements {cljs.core.IWithMeta}
 * @implements {cljs.core.IAssociative}
 * @implements {cljs.core.IMap}
 * @implements {cljs.core.ILookup}
*/
shadow.dom.Size = (function (w,h,__meta,__extmap,__hash){
this.w = w;
this.h = h;
this.__meta = __meta;
this.__extmap = __extmap;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition0$ = 2230716170;
this.cljs$lang$protocol_mask$partition1$ = 139264;
});
(shadow.dom.Size.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this__4472__auto__,k__4473__auto__){
var self__ = this;
var this__4472__auto____$1 = this;
return this__4472__auto____$1.cljs$core$ILookup$_lookup$arity$3(null,k__4473__auto__,null);
}));

(shadow.dom.Size.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this__4474__auto__,k51217,else__4475__auto__){
var self__ = this;
var this__4474__auto____$1 = this;
var G__51221 = k51217;
var G__51221__$1 = (((G__51221 instanceof cljs.core.Keyword))?G__51221.fqn:null);
switch (G__51221__$1) {
case "w":
return self__.w;

break;
case "h":
return self__.h;

break;
default:
return cljs.core.get.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k51217,else__4475__auto__);

}
}));

(shadow.dom.Size.prototype.cljs$core$IKVReduce$_kv_reduce$arity$3 = (function (this__4492__auto__,f__4493__auto__,init__4494__auto__){
var self__ = this;
var this__4492__auto____$1 = this;
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret__4495__auto__,p__51222){
var vec__51223 = p__51222;
var k__4496__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51223,(0),null);
var v__4497__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51223,(1),null);
return (f__4493__auto__.cljs$core$IFn$_invoke$arity$3 ? f__4493__auto__.cljs$core$IFn$_invoke$arity$3(ret__4495__auto__,k__4496__auto__,v__4497__auto__) : f__4493__auto__.call(null,ret__4495__auto__,k__4496__auto__,v__4497__auto__));
}),init__4494__auto__,this__4492__auto____$1);
}));

(shadow.dom.Size.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this__4487__auto__,writer__4488__auto__,opts__4489__auto__){
var self__ = this;
var this__4487__auto____$1 = this;
var pr_pair__4490__auto__ = (function (keyval__4491__auto__){
return cljs.core.pr_sequential_writer(writer__4488__auto__,cljs.core.pr_writer,""," ","",opts__4489__auto__,keyval__4491__auto__);
});
return cljs.core.pr_sequential_writer(writer__4488__auto__,pr_pair__4490__auto__,"#shadow.dom.Size{",", ","}",opts__4489__auto__,cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"w","w",354169001),self__.w],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"h","h",1109658740),self__.h],null))], null),self__.__extmap));
}));

(shadow.dom.Size.prototype.cljs$core$IIterable$_iterator$arity$1 = (function (G__51216){
var self__ = this;
var G__51216__$1 = this;
return (new cljs.core.RecordIter((0),G__51216__$1,2,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"w","w",354169001),new cljs.core.Keyword(null,"h","h",1109658740)], null),(cljs.core.truth_(self__.__extmap)?cljs.core._iterator(self__.__extmap):cljs.core.nil_iter())));
}));

(shadow.dom.Size.prototype.cljs$core$IMeta$_meta$arity$1 = (function (this__4470__auto__){
var self__ = this;
var this__4470__auto____$1 = this;
return self__.__meta;
}));

(shadow.dom.Size.prototype.cljs$core$ICloneable$_clone$arity$1 = (function (this__4467__auto__){
var self__ = this;
var this__4467__auto____$1 = this;
return (new shadow.dom.Size(self__.w,self__.h,self__.__meta,self__.__extmap,self__.__hash));
}));

(shadow.dom.Size.prototype.cljs$core$ICounted$_count$arity$1 = (function (this__4476__auto__){
var self__ = this;
var this__4476__auto____$1 = this;
return (2 + cljs.core.count(self__.__extmap));
}));

(shadow.dom.Size.prototype.cljs$core$IHash$_hash$arity$1 = (function (this__4468__auto__){
var self__ = this;
var this__4468__auto____$1 = this;
var h__4330__auto__ = self__.__hash;
if((!((h__4330__auto__ == null)))){
return h__4330__auto__;
} else {
var h__4330__auto____$1 = (function (coll__4469__auto__){
return (-1228019642 ^ cljs.core.hash_unordered_coll(coll__4469__auto__));
})(this__4468__auto____$1);
(self__.__hash = h__4330__auto____$1);

return h__4330__auto____$1;
}
}));

(shadow.dom.Size.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this51218,other51219){
var self__ = this;
var this51218__$1 = this;
return (((!((other51219 == null)))) && ((((this51218__$1.constructor === other51219.constructor)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51218__$1.w,other51219.w)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51218__$1.h,other51219.h)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this51218__$1.__extmap,other51219.__extmap)))))))));
}));

(shadow.dom.Size.prototype.cljs$core$IMap$_dissoc$arity$2 = (function (this__4482__auto__,k__4483__auto__){
var self__ = this;
var this__4482__auto____$1 = this;
if(cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"w","w",354169001),null,new cljs.core.Keyword(null,"h","h",1109658740),null], null), null),k__4483__auto__)){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(cljs.core._with_meta(cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,this__4482__auto____$1),self__.__meta),k__4483__auto__);
} else {
return (new shadow.dom.Size(self__.w,self__.h,self__.__meta,cljs.core.not_empty(cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.__extmap,k__4483__auto__)),null));
}
}));

(shadow.dom.Size.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this__4479__auto__,k51217){
var self__ = this;
var this__4479__auto____$1 = this;
var G__51226 = k51217;
var G__51226__$1 = (((G__51226 instanceof cljs.core.Keyword))?G__51226.fqn:null);
switch (G__51226__$1) {
case "w":
case "h":
return true;

break;
default:
return cljs.core.contains_QMARK_(self__.__extmap,k51217);

}
}));

(shadow.dom.Size.prototype.cljs$core$IAssociative$_assoc$arity$3 = (function (this__4480__auto__,k__4481__auto__,G__51216){
var self__ = this;
var this__4480__auto____$1 = this;
var pred__51227 = cljs.core.keyword_identical_QMARK_;
var expr__51228 = k__4481__auto__;
if(cljs.core.truth_((pred__51227.cljs$core$IFn$_invoke$arity$2 ? pred__51227.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"w","w",354169001),expr__51228) : pred__51227.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__51228)))){
return (new shadow.dom.Size(G__51216,self__.h,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((pred__51227.cljs$core$IFn$_invoke$arity$2 ? pred__51227.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"h","h",1109658740),expr__51228) : pred__51227.call(null,new cljs.core.Keyword(null,"h","h",1109658740),expr__51228)))){
return (new shadow.dom.Size(self__.w,G__51216,self__.__meta,self__.__extmap,null));
} else {
return (new shadow.dom.Size(self__.w,self__.h,self__.__meta,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k__4481__auto__,G__51216),null));
}
}
}));

(shadow.dom.Size.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this__4485__auto__){
var self__ = this;
var this__4485__auto____$1 = this;
return cljs.core.seq(cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.MapEntry(new cljs.core.Keyword(null,"w","w",354169001),self__.w,null)),(new cljs.core.MapEntry(new cljs.core.Keyword(null,"h","h",1109658740),self__.h,null))], null),self__.__extmap));
}));

(shadow.dom.Size.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (this__4471__auto__,G__51216){
var self__ = this;
var this__4471__auto____$1 = this;
return (new shadow.dom.Size(self__.w,self__.h,G__51216,self__.__extmap,self__.__hash));
}));

(shadow.dom.Size.prototype.cljs$core$ICollection$_conj$arity$2 = (function (this__4477__auto__,entry__4478__auto__){
var self__ = this;
var this__4477__auto____$1 = this;
if(cljs.core.vector_QMARK_(entry__4478__auto__)){
return this__4477__auto____$1.cljs$core$IAssociative$_assoc$arity$3(null,cljs.core._nth(entry__4478__auto__,(0)),cljs.core._nth(entry__4478__auto__,(1)));
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core._conj,this__4477__auto____$1,entry__4478__auto__);
}
}));

(shadow.dom.Size.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"w","w",1994700528,null),new cljs.core.Symbol(null,"h","h",-1544777029,null)], null);
}));

(shadow.dom.Size.cljs$lang$type = true);

(shadow.dom.Size.cljs$lang$ctorPrSeq = (function (this__4516__auto__){
return (new cljs.core.List(null,"shadow.dom/Size",null,(1),null));
}));

(shadow.dom.Size.cljs$lang$ctorPrWriter = (function (this__4516__auto__,writer__4517__auto__){
return cljs.core._write(writer__4517__auto__,"shadow.dom/Size");
}));

/**
 * Positional factory function for shadow.dom/Size.
 */
shadow.dom.__GT_Size = (function shadow$dom$__GT_Size(w,h){
return (new shadow.dom.Size(w,h,null,null,null));
});

/**
 * Factory function for shadow.dom/Size, taking a map of keywords to field values.
 */
shadow.dom.map__GT_Size = (function shadow$dom$map__GT_Size(G__51220){
var extmap__4512__auto__ = (function (){var G__51230 = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$variadic(G__51220,new cljs.core.Keyword(null,"w","w",354169001),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"h","h",1109658740)], 0));
if(cljs.core.record_QMARK_(G__51220)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,G__51230);
} else {
return G__51230;
}
})();
return (new shadow.dom.Size(new cljs.core.Keyword(null,"w","w",354169001).cljs$core$IFn$_invoke$arity$1(G__51220),new cljs.core.Keyword(null,"h","h",1109658740).cljs$core$IFn$_invoke$arity$1(G__51220),null,cljs.core.not_empty(extmap__4512__auto__),null));
});

shadow.dom.size__GT_clj = (function shadow$dom$size__GT_clj(size){
return (new shadow.dom.Size(size.width,size.height,null,null,null));
});
shadow.dom.get_size = (function shadow$dom$get_size(el){
return shadow.dom.size__GT_clj(goog.style.getSize(shadow.dom.dom_node(el)));
});
shadow.dom.get_height = (function shadow$dom$get_height(el){
return shadow.dom.get_size(el).h;
});
shadow.dom.get_viewport_size = (function shadow$dom$get_viewport_size(){
return shadow.dom.size__GT_clj(goog.dom.getViewportSize());
});
shadow.dom.first_child = (function shadow$dom$first_child(el){
return (shadow.dom.dom_node(el).children[(0)]);
});
shadow.dom.select_option_values = (function shadow$dom$select_option_values(el){
var native$ = shadow.dom.dom_node(el);
var opts = (native$["options"]);
var a__4703__auto__ = opts;
var l__4704__auto__ = a__4703__auto__.length;
var i = (0);
var ret = cljs.core.PersistentVector.EMPTY;
while(true){
if((i < l__4704__auto__)){
var G__51574 = (i + (1));
var G__51575 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(ret,(opts[i]["value"]));
i = G__51574;
ret = G__51575;
continue;
} else {
return ret;
}
break;
}
});
shadow.dom.build_url = (function shadow$dom$build_url(path,query_params){
if(cljs.core.empty_QMARK_(query_params)){
return path;
} else {
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(path),"?",clojure.string.join.cljs$core$IFn$_invoke$arity$2("&",cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p__51235){
var vec__51236 = p__51235;
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51236,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51236,(1),null);
return [cljs.core.name(k),"=",cljs.core.str.cljs$core$IFn$_invoke$arity$1(encodeURIComponent(cljs.core.str.cljs$core$IFn$_invoke$arity$1(v)))].join('');
}),query_params))].join('');
}
});
shadow.dom.redirect = (function shadow$dom$redirect(var_args){
var G__51240 = arguments.length;
switch (G__51240) {
case 1:
return shadow.dom.redirect.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return shadow.dom.redirect.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('')));

}
});

(shadow.dom.redirect.cljs$core$IFn$_invoke$arity$1 = (function (path){
return shadow.dom.redirect.cljs$core$IFn$_invoke$arity$2(path,cljs.core.PersistentArrayMap.EMPTY);
}));

(shadow.dom.redirect.cljs$core$IFn$_invoke$arity$2 = (function (path,query_params){
return (document["location"]["href"] = shadow.dom.build_url(path,query_params));
}));

(shadow.dom.redirect.cljs$lang$maxFixedArity = 2);

shadow.dom.reload_BANG_ = (function shadow$dom$reload_BANG_(){
return (document.location.href = document.location.href);
});
shadow.dom.tag_name = (function shadow$dom$tag_name(el){
var dom = shadow.dom.dom_node(el);
return dom.tagName;
});
shadow.dom.insert_after = (function shadow$dom$insert_after(ref,new$){
var new_node = shadow.dom.dom_node(new$);
goog.dom.insertSiblingAfter(new_node,shadow.dom.dom_node(ref));

return new_node;
});
shadow.dom.insert_before = (function shadow$dom$insert_before(ref,new$){
var new_node = shadow.dom.dom_node(new$);
goog.dom.insertSiblingBefore(new_node,shadow.dom.dom_node(ref));

return new_node;
});
shadow.dom.insert_first = (function shadow$dom$insert_first(ref,new$){
var temp__5751__auto__ = shadow.dom.dom_node(ref).firstChild;
if(cljs.core.truth_(temp__5751__auto__)){
var child = temp__5751__auto__;
return shadow.dom.insert_before(child,new$);
} else {
return shadow.dom.append.cljs$core$IFn$_invoke$arity$2(ref,new$);
}
});
shadow.dom.index_of = (function shadow$dom$index_of(el){
var el__$1 = shadow.dom.dom_node(el);
var i = (0);
while(true){
var ps = el__$1.previousSibling;
if((ps == null)){
return i;
} else {
var G__51581 = ps;
var G__51582 = (i + (1));
el__$1 = G__51581;
i = G__51582;
continue;
}
break;
}
});
shadow.dom.get_parent = (function shadow$dom$get_parent(el){
return goog.dom.getParentElement(shadow.dom.dom_node(el));
});
shadow.dom.parents = (function shadow$dom$parents(el){
var parent = shadow.dom.get_parent(el);
if(cljs.core.truth_(parent)){
return cljs.core.cons(parent,(new cljs.core.LazySeq(null,(function (){
return (shadow.dom.parents.cljs$core$IFn$_invoke$arity$1 ? shadow.dom.parents.cljs$core$IFn$_invoke$arity$1(parent) : shadow.dom.parents.call(null,parent));
}),null,null)));
} else {
return null;
}
});
shadow.dom.matches = (function shadow$dom$matches(el,sel){
return shadow.dom.dom_node(el).matches(sel);
});
shadow.dom.get_next_sibling = (function shadow$dom$get_next_sibling(el){
return goog.dom.getNextElementSibling(shadow.dom.dom_node(el));
});
shadow.dom.get_previous_sibling = (function shadow$dom$get_previous_sibling(el){
return goog.dom.getPreviousElementSibling(shadow.dom.dom_node(el));
});
shadow.dom.xmlns = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(new cljs.core.PersistentArrayMap(null, 2, ["svg","http://www.w3.org/2000/svg","xlink","http://www.w3.org/1999/xlink"], null));
shadow.dom.create_svg_node = (function shadow$dom$create_svg_node(tag_def,props){
var vec__51241 = shadow.dom.parse_tag(tag_def);
var tag_name = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51241,(0),null);
var tag_id = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51241,(1),null);
var tag_classes = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51241,(2),null);
var el = document.createElementNS("http://www.w3.org/2000/svg",tag_name);
if(cljs.core.truth_(tag_id)){
el.setAttribute("id",tag_id);
} else {
}

if(cljs.core.truth_(tag_classes)){
el.setAttribute("class",shadow.dom.merge_class_string(new cljs.core.Keyword(null,"class","class",-2030961996).cljs$core$IFn$_invoke$arity$1(props),tag_classes));
} else {
}

var seq__51244_51586 = cljs.core.seq(props);
var chunk__51245_51587 = null;
var count__51246_51588 = (0);
var i__51247_51589 = (0);
while(true){
if((i__51247_51589 < count__51246_51588)){
var vec__51254_51590 = chunk__51245_51587.cljs$core$IIndexed$_nth$arity$2(null,i__51247_51589);
var k_51591 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51254_51590,(0),null);
var v_51592 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51254_51590,(1),null);
el.setAttributeNS((function (){var temp__5753__auto__ = cljs.core.namespace(k_51591);
if(cljs.core.truth_(temp__5753__auto__)){
var ns = temp__5753__auto__;
return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(shadow.dom.xmlns),ns);
} else {
return null;
}
})(),cljs.core.name(k_51591),v_51592);


var G__51593 = seq__51244_51586;
var G__51594 = chunk__51245_51587;
var G__51595 = count__51246_51588;
var G__51596 = (i__51247_51589 + (1));
seq__51244_51586 = G__51593;
chunk__51245_51587 = G__51594;
count__51246_51588 = G__51595;
i__51247_51589 = G__51596;
continue;
} else {
var temp__5753__auto___51597 = cljs.core.seq(seq__51244_51586);
if(temp__5753__auto___51597){
var seq__51244_51598__$1 = temp__5753__auto___51597;
if(cljs.core.chunked_seq_QMARK_(seq__51244_51598__$1)){
var c__4649__auto___51599 = cljs.core.chunk_first(seq__51244_51598__$1);
var G__51600 = cljs.core.chunk_rest(seq__51244_51598__$1);
var G__51601 = c__4649__auto___51599;
var G__51602 = cljs.core.count(c__4649__auto___51599);
var G__51603 = (0);
seq__51244_51586 = G__51600;
chunk__51245_51587 = G__51601;
count__51246_51588 = G__51602;
i__51247_51589 = G__51603;
continue;
} else {
var vec__51257_51604 = cljs.core.first(seq__51244_51598__$1);
var k_51605 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51257_51604,(0),null);
var v_51606 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51257_51604,(1),null);
el.setAttributeNS((function (){var temp__5753__auto____$1 = cljs.core.namespace(k_51605);
if(cljs.core.truth_(temp__5753__auto____$1)){
var ns = temp__5753__auto____$1;
return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(shadow.dom.xmlns),ns);
} else {
return null;
}
})(),cljs.core.name(k_51605),v_51606);


var G__51607 = cljs.core.next(seq__51244_51598__$1);
var G__51608 = null;
var G__51609 = (0);
var G__51610 = (0);
seq__51244_51586 = G__51607;
chunk__51245_51587 = G__51608;
count__51246_51588 = G__51609;
i__51247_51589 = G__51610;
continue;
}
} else {
}
}
break;
}

return el;
});
shadow.dom.svg_node = (function shadow$dom$svg_node(el){
if((el == null)){
return null;
} else {
if((((!((el == null))))?((((false) || ((cljs.core.PROTOCOL_SENTINEL === el.shadow$dom$SVGElement$))))?true:false):false)){
return el.shadow$dom$SVGElement$_to_svg$arity$1(null);
} else {
return el;

}
}
});
shadow.dom.make_svg_node = (function shadow$dom$make_svg_node(structure){
var vec__51261 = shadow.dom.destructure_node(shadow.dom.create_svg_node,structure);
var node = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51261,(0),null);
var node_children = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__51261,(1),null);
var seq__51264_51611 = cljs.core.seq(node_children);
var chunk__51266_51612 = null;
var count__51267_51613 = (0);
var i__51268_51614 = (0);
while(true){
if((i__51268_51614 < count__51267_51613)){
var child_struct_51615 = chunk__51266_51612.cljs$core$IIndexed$_nth$arity$2(null,i__51268_51614);
if((!((child_struct_51615 == null)))){
if(typeof child_struct_51615 === 'string'){
var text_51616 = (node["textContent"]);
(node["textContent"] = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(text_51616),child_struct_51615].join(''));
} else {
var children_51617 = shadow.dom.svg_node(child_struct_51615);
if(cljs.core.seq_QMARK_(children_51617)){
var seq__51282_51618 = cljs.core.seq(children_51617);
var chunk__51284_51619 = null;
var count__51285_51620 = (0);
var i__51286_51621 = (0);
while(true){
if((i__51286_51621 < count__51285_51620)){
var child_51622 = chunk__51284_51619.cljs$core$IIndexed$_nth$arity$2(null,i__51286_51621);
if(cljs.core.truth_(child_51622)){
node.appendChild(child_51622);


var G__51623 = seq__51282_51618;
var G__51624 = chunk__51284_51619;
var G__51625 = count__51285_51620;
var G__51626 = (i__51286_51621 + (1));
seq__51282_51618 = G__51623;
chunk__51284_51619 = G__51624;
count__51285_51620 = G__51625;
i__51286_51621 = G__51626;
continue;
} else {
var G__51627 = seq__51282_51618;
var G__51628 = chunk__51284_51619;
var G__51629 = count__51285_51620;
var G__51630 = (i__51286_51621 + (1));
seq__51282_51618 = G__51627;
chunk__51284_51619 = G__51628;
count__51285_51620 = G__51629;
i__51286_51621 = G__51630;
continue;
}
} else {
var temp__5753__auto___51631 = cljs.core.seq(seq__51282_51618);
if(temp__5753__auto___51631){
var seq__51282_51632__$1 = temp__5753__auto___51631;
if(cljs.core.chunked_seq_QMARK_(seq__51282_51632__$1)){
var c__4649__auto___51636 = cljs.core.chunk_first(seq__51282_51632__$1);
var G__51637 = cljs.core.chunk_rest(seq__51282_51632__$1);
var G__51638 = c__4649__auto___51636;
var G__51639 = cljs.core.count(c__4649__auto___51636);
var G__51640 = (0);
seq__51282_51618 = G__51637;
chunk__51284_51619 = G__51638;
count__51285_51620 = G__51639;
i__51286_51621 = G__51640;
continue;
} else {
var child_51641 = cljs.core.first(seq__51282_51632__$1);
if(cljs.core.truth_(child_51641)){
node.appendChild(child_51641);


var G__51642 = cljs.core.next(seq__51282_51632__$1);
var G__51643 = null;
var G__51644 = (0);
var G__51645 = (0);
seq__51282_51618 = G__51642;
chunk__51284_51619 = G__51643;
count__51285_51620 = G__51644;
i__51286_51621 = G__51645;
continue;
} else {
var G__51646 = cljs.core.next(seq__51282_51632__$1);
var G__51647 = null;
var G__51648 = (0);
var G__51649 = (0);
seq__51282_51618 = G__51646;
chunk__51284_51619 = G__51647;
count__51285_51620 = G__51648;
i__51286_51621 = G__51649;
continue;
}
}
} else {
}
}
break;
}
} else {
node.appendChild(children_51617);
}
}


var G__51650 = seq__51264_51611;
var G__51651 = chunk__51266_51612;
var G__51652 = count__51267_51613;
var G__51653 = (i__51268_51614 + (1));
seq__51264_51611 = G__51650;
chunk__51266_51612 = G__51651;
count__51267_51613 = G__51652;
i__51268_51614 = G__51653;
continue;
} else {
var G__51654 = seq__51264_51611;
var G__51655 = chunk__51266_51612;
var G__51656 = count__51267_51613;
var G__51657 = (i__51268_51614 + (1));
seq__51264_51611 = G__51654;
chunk__51266_51612 = G__51655;
count__51267_51613 = G__51656;
i__51268_51614 = G__51657;
continue;
}
} else {
var temp__5753__auto___51658 = cljs.core.seq(seq__51264_51611);
if(temp__5753__auto___51658){
var seq__51264_51659__$1 = temp__5753__auto___51658;
if(cljs.core.chunked_seq_QMARK_(seq__51264_51659__$1)){
var c__4649__auto___51660 = cljs.core.chunk_first(seq__51264_51659__$1);
var G__51661 = cljs.core.chunk_rest(seq__51264_51659__$1);
var G__51662 = c__4649__auto___51660;
var G__51663 = cljs.core.count(c__4649__auto___51660);
var G__51664 = (0);
seq__51264_51611 = G__51661;
chunk__51266_51612 = G__51662;
count__51267_51613 = G__51663;
i__51268_51614 = G__51664;
continue;
} else {
var child_struct_51665 = cljs.core.first(seq__51264_51659__$1);
if((!((child_struct_51665 == null)))){
if(typeof child_struct_51665 === 'string'){
var text_51666 = (node["textContent"]);
(node["textContent"] = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(text_51666),child_struct_51665].join(''));
} else {
var children_51667 = shadow.dom.svg_node(child_struct_51665);
if(cljs.core.seq_QMARK_(children_51667)){
var seq__51288_51668 = cljs.core.seq(children_51667);
var chunk__51290_51669 = null;
var count__51291_51670 = (0);
var i__51292_51671 = (0);
while(true){
if((i__51292_51671 < count__51291_51670)){
var child_51672 = chunk__51290_51669.cljs$core$IIndexed$_nth$arity$2(null,i__51292_51671);
if(cljs.core.truth_(child_51672)){
node.appendChild(child_51672);


var G__51673 = seq__51288_51668;
var G__51674 = chunk__51290_51669;
var G__51675 = count__51291_51670;
var G__51676 = (i__51292_51671 + (1));
seq__51288_51668 = G__51673;
chunk__51290_51669 = G__51674;
count__51291_51670 = G__51675;
i__51292_51671 = G__51676;
continue;
} else {
var G__51677 = seq__51288_51668;
var G__51678 = chunk__51290_51669;
var G__51679 = count__51291_51670;
var G__51680 = (i__51292_51671 + (1));
seq__51288_51668 = G__51677;
chunk__51290_51669 = G__51678;
count__51291_51670 = G__51679;
i__51292_51671 = G__51680;
continue;
}
} else {
var temp__5753__auto___51681__$1 = cljs.core.seq(seq__51288_51668);
if(temp__5753__auto___51681__$1){
var seq__51288_51682__$1 = temp__5753__auto___51681__$1;
if(cljs.core.chunked_seq_QMARK_(seq__51288_51682__$1)){
var c__4649__auto___51683 = cljs.core.chunk_first(seq__51288_51682__$1);
var G__51684 = cljs.core.chunk_rest(seq__51288_51682__$1);
var G__51685 = c__4649__auto___51683;
var G__51686 = cljs.core.count(c__4649__auto___51683);
var G__51687 = (0);
seq__51288_51668 = G__51684;
chunk__51290_51669 = G__51685;
count__51291_51670 = G__51686;
i__51292_51671 = G__51687;
continue;
} else {
var child_51688 = cljs.core.first(seq__51288_51682__$1);
if(cljs.core.truth_(child_51688)){
node.appendChild(child_51688);


var G__51689 = cljs.core.next(seq__51288_51682__$1);
var G__51690 = null;
var G__51691 = (0);
var G__51692 = (0);
seq__51288_51668 = G__51689;
chunk__51290_51669 = G__51690;
count__51291_51670 = G__51691;
i__51292_51671 = G__51692;
continue;
} else {
var G__51693 = cljs.core.next(seq__51288_51682__$1);
var G__51694 = null;
var G__51695 = (0);
var G__51696 = (0);
seq__51288_51668 = G__51693;
chunk__51290_51669 = G__51694;
count__51291_51670 = G__51695;
i__51292_51671 = G__51696;
continue;
}
}
} else {
}
}
break;
}
} else {
node.appendChild(children_51667);
}
}


var G__51697 = cljs.core.next(seq__51264_51659__$1);
var G__51698 = null;
var G__51699 = (0);
var G__51700 = (0);
seq__51264_51611 = G__51697;
chunk__51266_51612 = G__51698;
count__51267_51613 = G__51699;
i__51268_51614 = G__51700;
continue;
} else {
var G__51701 = cljs.core.next(seq__51264_51659__$1);
var G__51702 = null;
var G__51703 = (0);
var G__51704 = (0);
seq__51264_51611 = G__51701;
chunk__51266_51612 = G__51702;
count__51267_51613 = G__51703;
i__51268_51614 = G__51704;
continue;
}
}
} else {
}
}
break;
}

return node;
});
goog.object.set(shadow.dom.SVGElement,"string",true);

goog.object.set(shadow.dom._to_svg,"string",(function (this$){
if((this$ instanceof cljs.core.Keyword)){
return shadow.dom.make_svg_node(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [this$], null));
} else {
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2("strings cannot be in svgs",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"this","this",-611633625),this$], null));
}
}));

(cljs.core.PersistentVector.prototype.shadow$dom$SVGElement$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.PersistentVector.prototype.shadow$dom$SVGElement$_to_svg$arity$1 = (function (this$){
var this$__$1 = this;
return shadow.dom.make_svg_node(this$__$1);
}));

(cljs.core.LazySeq.prototype.shadow$dom$SVGElement$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.LazySeq.prototype.shadow$dom$SVGElement$_to_svg$arity$1 = (function (this$){
var this$__$1 = this;
return cljs.core.map.cljs$core$IFn$_invoke$arity$2(shadow.dom._to_svg,this$__$1);
}));

goog.object.set(shadow.dom.SVGElement,"null",true);

goog.object.set(shadow.dom._to_svg,"null",(function (_){
return null;
}));
shadow.dom.svg = (function shadow$dom$svg(var_args){
var args__4835__auto__ = [];
var len__4829__auto___51705 = arguments.length;
var i__4830__auto___51706 = (0);
while(true){
if((i__4830__auto___51706 < len__4829__auto___51705)){
args__4835__auto__.push((arguments[i__4830__auto___51706]));

var G__51707 = (i__4830__auto___51706 + (1));
i__4830__auto___51706 = G__51707;
continue;
} else {
}
break;
}

var argseq__4836__auto__ = ((((1) < args__4835__auto__.length))?(new cljs.core.IndexedSeq(args__4835__auto__.slice((1)),(0),null)):null);
return shadow.dom.svg.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__4836__auto__);
});

(shadow.dom.svg.cljs$core$IFn$_invoke$arity$variadic = (function (attrs,children){
return shadow.dom._to_svg(cljs.core.vec(cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"svg","svg",856789142),attrs], null),children)));
}));

(shadow.dom.svg.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(shadow.dom.svg.cljs$lang$applyTo = (function (seq51294){
var G__51295 = cljs.core.first(seq51294);
var seq51294__$1 = cljs.core.next(seq51294);
var self__4816__auto__ = this;
return self__4816__auto__.cljs$core$IFn$_invoke$arity$variadic(G__51295,seq51294__$1);
}));

/**
 * returns a channel for events on el
 * transform-fn should be a (fn [e el] some-val) where some-val will be put on the chan
 * once-or-cleanup handles the removal of the event handler
 * - true: remove after one event
 * - false: never removed
 * - chan: remove on msg/close
 */
shadow.dom.event_chan = (function shadow$dom$event_chan(var_args){
var G__51297 = arguments.length;
switch (G__51297) {
case 2:
return shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

break;
case 4:
return shadow.dom.event_chan.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('')));

}
});

(shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$2 = (function (el,event){
return shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$4(el,event,null,false);
}));

(shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$3 = (function (el,event,xf){
return shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$4(el,event,xf,false);
}));

(shadow.dom.event_chan.cljs$core$IFn$_invoke$arity$4 = (function (el,event,xf,once_or_cleanup){
var buf = cljs.core.async.sliding_buffer((1));
var chan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$2(buf,xf);
var event_fn = (function shadow$dom$event_fn(e){
cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(chan,e);

if(once_or_cleanup === true){
shadow.dom.remove_event_handler(el,event,shadow$dom$event_fn);

return cljs.core.async.close_BANG_(chan);
} else {
return null;
}
});
shadow.dom.dom_listen(shadow.dom.dom_node(el),cljs.core.name(event),event_fn);

if(cljs.core.truth_((function (){var and__4221__auto__ = once_or_cleanup;
if(cljs.core.truth_(and__4221__auto__)){
return (!(once_or_cleanup === true));
} else {
return and__4221__auto__;
}
})())){
var c__47915__auto___51712 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__47916__auto__ = (function (){var switch__47851__auto__ = (function (state_51318){
var state_val_51319 = (state_51318[(1)]);
if((state_val_51319 === (1))){
var state_51318__$1 = state_51318;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_51318__$1,(2),once_or_cleanup);
} else {
if((state_val_51319 === (2))){
var inst_51315 = (state_51318[(2)]);
var inst_51316 = shadow.dom.remove_event_handler(el,event,event_fn);
var state_51318__$1 = (function (){var statearr_51320 = state_51318;
(statearr_51320[(7)] = inst_51315);

return statearr_51320;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_51318__$1,inst_51316);
} else {
return null;
}
}
});
return (function() {
var shadow$dom$state_machine__47852__auto__ = null;
var shadow$dom$state_machine__47852__auto____0 = (function (){
var statearr_51321 = [null,null,null,null,null,null,null,null];
(statearr_51321[(0)] = shadow$dom$state_machine__47852__auto__);

(statearr_51321[(1)] = (1));

return statearr_51321;
});
var shadow$dom$state_machine__47852__auto____1 = (function (state_51318){
while(true){
var ret_value__47853__auto__ = (function (){try{while(true){
var result__47854__auto__ = switch__47851__auto__(state_51318);
if(cljs.core.keyword_identical_QMARK_(result__47854__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__47854__auto__;
}
break;
}
}catch (e51322){var ex__47855__auto__ = e51322;
var statearr_51323_51713 = state_51318;
(statearr_51323_51713[(2)] = ex__47855__auto__);


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

} else {
throw ex__47855__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__47853__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__51715 = state_51318;
state_51318 = G__51715;
continue;
} else {
return ret_value__47853__auto__;
}
break;
}
});
shadow$dom$state_machine__47852__auto__ = function(state_51318){
switch(arguments.length){
case 0:
return shadow$dom$state_machine__47852__auto____0.call(this);
case 1:
return shadow$dom$state_machine__47852__auto____1.call(this,state_51318);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
shadow$dom$state_machine__47852__auto__.cljs$core$IFn$_invoke$arity$0 = shadow$dom$state_machine__47852__auto____0;
shadow$dom$state_machine__47852__auto__.cljs$core$IFn$_invoke$arity$1 = shadow$dom$state_machine__47852__auto____1;
return shadow$dom$state_machine__47852__auto__;
})()
})();
var state__47917__auto__ = (function (){var statearr_51325 = f__47916__auto__();
(statearr_51325[(6)] = c__47915__auto___51712);

return statearr_51325;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__47917__auto__);
}));

} else {
}

return chan;
}));

(shadow.dom.event_chan.cljs$lang$maxFixedArity = 4);


//# sourceMappingURL=shadow.dom.js.map
